/* ============================================
   SALTY MINIMAL v2 — Icon Sidebar Theme
   ============================================ */

:root {
  /* Logo color — driven by user's primary tenant group via user-group-manager.
     Plugin injects --tenant-color on :root when a primary group with a color is active.
     Fallback #fc0fc0 = Saltitup-Pink. */
  --logo-color: var(--tenant-color, #fc0fc0);

  --color-accent: #fc0fc0;
  --color-accent-hover: #e00eab;
  --color-bg: #0e0e12;
  --color-bg-sidebar: #16161d;
  --color-bg-content: #1a1a24;
  --color-bg-card: #22222e;
  --color-text: #e8e6f0;
  --color-text-muted: #9895a8;
  --color-text-heading: #ffffff;
  --color-border: #2a2a38;

  --sidebar-expanded: 260px;
  --sidebar-collapsed: 64px;
  --content-max-width: 900px;
  --radius: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Force logo SVG to consume --logo-color. Overrides the SVG's internal <style>
   in case browser caching or specificity gets in the way. */
.salty-sidebar__logo-icon { color: var(--logo-color); }
.salty-sidebar__logo-icon svg .st0 { fill: var(--logo-color) !important; }

/* ============================================
   LIGHT MODE
   ============================================ */
:root.light,
body.light {
  --color-accent: #d60aaa;
  --color-accent-hover: #b8088f;
  --color-bg: #f5f5f8;
  --color-bg-sidebar: #ffffff;
  --color-bg-content: #eeeef3;
  --color-bg-card: #ffffff;
  --color-text: #2a2a3a;
  --color-text-muted: #6b6880;
  --color-text-heading: #1a1a2a;
  --color-border: #d8d8e2;
}

@media (prefers-color-scheme: light) {
  :root:not(.dark),
  body:not(.dark) {
    --color-accent: #d60aaa;
    --color-accent-hover: #b8088f;
    --color-bg: #f5f5f8;
    --color-bg-sidebar: #ffffff;
    --color-bg-content: #eeeef3;
    --color-bg-card: #ffffff;
    --color-text: #2a2a3a;
    --color-text-muted: #6b6880;
    --color-text-heading: #1a1a2a;
    --color-border: #d8d8e2;
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: 2.25rem; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }
p  { margin-bottom: 1.25rem; }

/* ============================================
   LAYOUT
   ============================================ */
.salty-layout { display: flex; min-height: 100vh; }

/* ============================================
   SIDEBAR
   ============================================ */
.salty-sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-collapsed);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: hidden;
}

body.sidebar-expanded .salty-sidebar {
  width: var(--sidebar-expanded);
}

/* --- Logo --- */
.salty-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: 60px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  flex-shrink: 0;
}

.salty-sidebar__logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.salty-sidebar__logo-icon svg {
  width: 100%;
  height: 100%;
}

.salty-sidebar__logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text-heading);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

body.sidebar-expanded .salty-sidebar__logo-text {
  opacity: 1;
  pointer-events: auto;
}

/* --- Desktop Toggle (hamburger inside sidebar) --- */
.salty-sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.salty-sidebar__toggle:hover {
  color: var(--color-accent);
  background: rgba(252, 15, 192, 0.05);
}

.salty-sidebar__toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- Navigation --- */
.salty-sidebar__nav {
  flex: 1;
  padding: 6px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.salty-sidebar__nav-label {
  display: block;
  padding: 8px 20px 4px;
  font-size: 0;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  height: 0;
  transition: all var(--transition);
}

body.sidebar-expanded .salty-sidebar__nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  height: auto;
  padding: 12px 20px 6px;
}

.salty-sidebar__nav ul { list-style: none; }
.salty-sidebar__nav ul li { position: relative; }

.salty-sidebar__nav ul li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 44px;
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 400;
  transition: all var(--transition);
  white-space: nowrap;
  border-left: 3px solid transparent;
  position: relative;
}

.salty-sidebar__nav ul li a:hover {
  color: var(--color-accent);
  background: rgba(252, 15, 192, 0.05);
}

.salty-sidebar__nav ul li.current-menu-item > a,
.salty-sidebar__nav ul li.current_page_item > a {
  color: var(--color-accent);
  background: rgba(252, 15, 192, 0.08);
  border-left-color: var(--color-accent);
  font-weight: 600;
}

/* Menu Icon */
.menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.65;
}

.current-menu-item .menu-icon,
.current_page_item .menu-icon { opacity: 1; }

.menu-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Menu Text */
.menu-text {
  opacity: 0;
  transition: opacity var(--transition);
  overflow: hidden;
}

body.sidebar-expanded .menu-text { opacity: 1; }

/* Tooltip for collapsed state */
.salty-sidebar__nav ul li a[data-title]::after {
  content: attr(data-title);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-bg-card);
  color: var(--color-text);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  border: 1px solid var(--color-border);
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.salty-sidebar__nav ul li a[data-title]:hover::after { opacity: 1; }
body.sidebar-expanded .salty-sidebar__nav ul li a[data-title]::after { display: none; }

/* Sub-Menus */
.salty-sidebar__nav ul ul { display: none; }

/* Flyout submenu (collapsed sidebar) — controlled via JS class .flyout-open */
.salty-sidebar__nav ul li.flyout-open > ul {
  display: block;
  position: fixed;
  left: var(--sidebar-collapsed);
  min-width: 200px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 8px 0;
  z-index: 10000;
}

/* Show text inside flyout items */
.salty-sidebar__nav ul li.flyout-open > ul .menu-text {
  opacity: 1;
}

.salty-sidebar__nav ul li.flyout-open > ul li a {
  font-size: 0.85rem;
  height: 38px;
  padding: 0 16px;
  color: var(--color-text-muted);
  white-space: nowrap;
  border-left: none;
  gap: 10px;
}

/* Hide tooltip on parent items that have a submenu flyout + inside flyout */
.salty-sidebar__nav ul li:has(> ul) > a[data-title]:hover::after,
.salty-sidebar__nav ul ul li a[data-title]::after {
  display: none !important;
}

/* Expanded sidebar: submenus inline (no flyout) */
body.sidebar-expanded .salty-sidebar__nav ul ul {
  display: block;
  position: static;
  left: auto;
  min-width: auto;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  padding-left: 14px;
  z-index: auto;
}

body.sidebar-expanded .salty-sidebar__nav ul ul li a {
  font-size: 0.82rem;
  height: 36px;
  color: var(--color-text-muted);
  padding: 0 20px;
  white-space: normal;
  border-left: 3px solid transparent;
}

/* --- Theme Toggle --- */
.salty-theme-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 44px;
  padding: 0 20px;
  background: none;
  border: none;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  overflow: hidden;
}

.salty-theme-toggle:hover {
  color: var(--color-accent);
  background: rgba(252, 15, 192, 0.05);
}

.salty-theme-toggle__icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.salty-theme-toggle__icon svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
}

/* Dark mode active: show sun icon (click to go light) */
.salty-theme-toggle__icon--light { display: flex; }
.salty-theme-toggle__icon--dark  { display: none; }

/* Light mode: show moon icon (click to go dark) */
body.light .salty-theme-toggle__icon--light,
:root.light .salty-theme-toggle__icon--light { display: none; }
body.light .salty-theme-toggle__icon--dark,
:root.light .salty-theme-toggle__icon--dark  { display: flex; }

@media (prefers-color-scheme: light) {
  body:not(.dark) .salty-theme-toggle__icon--light,
  :root:not(.dark) .salty-theme-toggle__icon--light { display: none; }
  body:not(.dark) .salty-theme-toggle__icon--dark,
  :root:not(.dark) .salty-theme-toggle__icon--dark  { display: flex; }
}

.salty-theme-toggle__text {
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
}

body.sidebar-expanded .salty-theme-toggle__text { opacity: 1; }

/* --- Sidebar Footer --- */
.salty-sidebar__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.salty-sidebar__footer-text {
  opacity: 0;
  transition: opacity var(--transition);
}

body.sidebar-expanded .salty-sidebar__footer-text { opacity: 1; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.salty-main {
  flex: 1;
  margin-left: var(--sidebar-collapsed);
  transition: margin-left var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.sidebar-expanded .salty-main {
  margin-left: var(--sidebar-expanded);
}

.salty-content {
  flex: 1;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.salty-content__article {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.salty-content__article > *:last-child { margin-bottom: 0; }

/* WordPress Content Styles */
.entry-content ul, .entry-content ol { margin: 0 0 1.25rem 1.5rem; }
.entry-content li { margin-bottom: 0.35rem; }

.entry-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--color-accent);
  background: rgba(252, 15, 192, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

.entry-content pre, .entry-content code { font-family: var(--font-mono); }
.entry-content code {
  background: rgba(252, 15, 192, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}
.entry-content pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.entry-content pre code { background: none; padding: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.entry-content th, .entry-content td {
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border);
  text-align: left;
}
.entry-content th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-heading);
}

/* Footer */
.salty-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* Overlay (mobile) */
.salty-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition);
}

.salty-overlay.is-visible { display: block; opacity: 1; }

/* ============================================
   MOBILE HAMBURGER (floating)
   ============================================ */
.salty-mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--color-bg-sidebar);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  line-height: 0;
}

.salty-mobile-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .salty-sidebar {
    width: 0;
    border-right: none;
  }

  body.sidebar-mobile-open .salty-sidebar {
    width: var(--sidebar-expanded);
    border-right: 1px solid var(--color-border);
  }

  body.sidebar-mobile-open .salty-sidebar__logo-text,
  body.sidebar-mobile-open .menu-text,
  body.sidebar-mobile-open .salty-sidebar__footer-text { opacity: 1; }

  body.sidebar-mobile-open .salty-sidebar__nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    height: auto;
    padding: 12px 20px 6px;
  }

  /* Disable flyout on mobile, show submenus inline */
  .salty-sidebar__nav ul li:hover > ul {
    position: static;
    left: auto;
    min-width: auto;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    z-index: auto;
    display: none;
  }

  body.sidebar-mobile-open .salty-sidebar__nav ul ul {
    display: block;
    padding-left: 14px;
  }

  .salty-main { margin-left: 0 !important; }
  .salty-mobile-toggle { display: flex; }
  .salty-sidebar__toggle { display: none; }

  .salty-content {
    padding: 1.5rem 1rem;
    padding-top: 4rem;
  }

  .salty-content__article { padding: 1.5rem; }

  .salty-sidebar__nav ul li a[data-title]::after { display: none !important; }
}

@media (max-width: 600px) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }
  .salty-content__article { padding: 1.25rem; }
}

/* ============================================
   PAGE WIDTH TEMPLATES
   ============================================ */
.salty-content--w100 { max-width: 100%; padding: 0; }
.salty-content--w100 .salty-content__article {
  border: none;
  border-radius: 0;
}
.salty-content--w95  { max-width: 95%;   }
.salty-content--w90  { max-width: 90%;   }
.salty-content--w80  { max-width: 80%;   }
.salty-content--w70  { max-width: 70%;   }

/* ============================================
   UTILITY
   ============================================ */
.screen-reader-text {
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  height: 1px; width: 1px;
  margin: -1px; overflow: hidden;
  padding: 0; position: absolute;
}

.salty-sidebar::-webkit-scrollbar { width: 4px; }
.salty-sidebar::-webkit-scrollbar-track { background: transparent; }
.salty-sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

/* ============================================
   GUTENBERG BLOCK UTILITIES
   (wp-block-library is dequeued for performance,
    so we replicate the classes used in content)
   ============================================ */

/* Text alignment */
.has-text-align-left   { text-align: left; }
.has-text-align-center { text-align: center; }
.has-text-align-right  { text-align: right; }

/* Font sizes */
.has-small-font-size   { font-size: 13px; }
.has-medium-font-size  { font-size: 20px; }
.has-large-font-size   { font-size: 36px; }
.has-x-large-font-size { font-size: 42px; }

/* Text colors */
.has-text-color { /* marker class — color set by specific color class */ }
.has-vivid-red-color          { color: #cf2e2e; }
.has-luminous-vivid-orange-color { color: #ff6900; }
.has-luminous-vivid-amber-color  { color: #fcb900; }
.has-light-green-cyan-color   { color: #7bdcb5; }
.has-vivid-green-cyan-color   { color: #00d084; }
.has-pale-cyan-blue-color     { color: #8ed1fc; }
.has-vivid-cyan-blue-color    { color: #0693e3; }
.has-vivid-purple-color       { color: #9b51e0; }
.has-white-color              { color: #ffffff; }
.has-cyan-bluish-gray-color   { color: #abb8c3; }
.has-pale-pink-color          { color: #f78da7; }

/* Background colors */
.has-background { /* marker class */ }
.has-vivid-red-background-color          { background-color: #cf2e2e; }
.has-luminous-vivid-orange-background-color { background-color: #ff6900; }
.has-luminous-vivid-amber-background-color  { background-color: #fcb900; }
.has-light-green-cyan-background-color   { background-color: #7bdcb5; }
.has-vivid-green-cyan-background-color   { background-color: #00d084; }
.has-pale-cyan-blue-background-color     { background-color: #8ed1fc; }
.has-vivid-cyan-blue-background-color    { background-color: #0693e3; }
.has-vivid-purple-background-color       { background-color: #9b51e0; }
.has-white-background-color              { background-color: #ffffff; }
.has-cyan-bluish-gray-background-color   { background-color: #abb8c3; }
.has-pale-pink-background-color          { background-color: #f78da7; }
