/* Speaker Elves — guide menu (sidebar). Behaviour lives in js/menu.js. */

:root{
  /* Shared colours come from the base tokens in css/01.css; the rest are the menu's own. */
  --gn-mint: var(--accent);
  --gn-mint-hi: #bdf0d6;
  --gn-leaf: var(--green);
  --gn-ink: var(--accent-ink); /* text on the mint pill */
  --gn-text: #c9d6e0;
  --gn-soft: #b9c8d4;
  --gn-faint: #6f8090;
  --gn-line: var(--line);
  --gn-line-soft: #223040;
  --gn-panel: var(--panel);
  --gn-gold: #f0d77a;         /* the right edge of every mint highlight */
  /* Mint body that warms to almost-gold at its right edge. */
  --gn-fill: linear-gradient(90deg, #bdf0d6 0%, #a2ddc0 52%, #cfe6a8 82%, #f0d77a 100%);
  --gn-glow-rest: -4px 0 14px 0 rgba(120,222,153,.22), 6px 0 14px 0 rgba(240,215,122,.22);
  --gn-glow-peak: -6px 0 26px 3px rgba(120,222,153,.42), 9px 0 28px 4px rgba(240,215,122,.5), 0 0 0 3px rgba(162,221,192,.12);
  --gn-glow-still: -5px 0 20px 2px rgba(120,222,153,.32), 8px 0 20px 2px rgba(240,215,122,.36), 0 0 0 3px rgba(162,221,192,.12);
}

/* ---------- Layout: sidebar beside the content ---------- */
#guide-nav{ display: contents; }
@media (min-width: 901px){
  body > main.wrap{ display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 28px; row-gap: 0; align-items: start; }
  body > main.wrap > .pane,
  body > main.wrap > .guide-pager{ grid-column: 2; min-width: 0; }
  .gn-side{ grid-column: 1; grid-row: 1 / span 40; align-self: start; position: sticky; top: 16px; margin-top: 12px; }
  /* Every part starts open, so the desktop rows are a little tighter to fit a laptop screen. */
  .gn-side .sb-head{ height: 36px; }
  .gn-side .sb-item{ padding-top: 5px; padding-bottom: 5px; }
  .gn-side .sb-items-inner{ margin-bottom: 4px; }
  .gn-mobile{ display: none; }
}

/* ---------- Glow ---------- */
@keyframes gn-breathe{ 0%,100%{ box-shadow: var(--gn-glow-rest); } 50%{ box-shadow: var(--gn-glow-peak); } }
@keyframes gn-text-breathe{
  0%,100%{ text-shadow: 0 0 6px rgba(120,222,153,.35); }
  50%{ text-shadow: 0 0 12px rgba(120,222,153,.85), 0 0 22px rgba(120,222,153,.35); }
}
/* A pulse of light starts gold at the right edge and travels left as it fades. */
@keyframes gn-sweep{
  0%{ background-position: 25% 0; opacity: .95; }
  55%{ background-position: 75% 0; opacity: 0; }
  100%{ background-position: 75% 0; opacity: 0; }
}
.sb-pill::before, .gn-chapter::before{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, transparent 38%, rgba(255,244,196,.85) 50%, rgba(240,215,122,0) 62%, transparent 100%);
  background-size: 300% 100%; background-position: 25% 0; opacity: 0;
  animation: gn-sweep 2.8s ease-out infinite;
}
@keyframes gn-ping{ 0%{ opacity: .85; transform: scale(1); } 100%{ opacity: 0; transform: scale(1.06, 1.5); } }

/* ---------- Sidebar ---------- */
.sb{
  position: relative; width: 252px; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 10px 16px;
  border: 1px solid var(--gn-line-soft); border-radius: 14px;
  background: rgba(12,19,27,.8);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
}
.gn-side .sb{ max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sb-top{ display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding-left: 12px; }
.sb-title{ font-size: 12px; font-weight: 700; color: var(--gn-faint); white-space: nowrap; }
.sb-body{ position: relative; display: grid; gap: 2px; }

/* The pill: current section only. */
.sb-pill{
  position: absolute; left: 0; top: 0; width: 0; height: 0; border-radius: 9px; pointer-events: none;
  background: var(--gn-fill);
  animation: gn-breathe 2.8s ease-in-out infinite;
  transition: opacity .2s;
}
.sb-pill.is-hidden{ opacity: 0; }
.sb-pill::after{ content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 2px solid var(--gn-leaf); opacity: 0; }
.sb-pill.is-ping::after{ animation: gn-ping .9s cubic-bezier(.2,.7,.3,1); }

.sb-head{
  all: unset; box-sizing: border-box; width: 100%;
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 12px; border-radius: 9px;
  color: var(--gn-text); font-weight: 700; font-size: 14px; white-space: nowrap;
  cursor: pointer; transition: color .25s;
}
.sb-head:hover{ background: rgba(255,255,255,.03); }
/* The current part: its own words and icon light up, no pill. */
.sb-head.is-current{ color: var(--gn-mint); animation: gn-text-breathe 2.8s ease-in-out infinite; }
.sb-head.is-current .sb-ic{ filter: drop-shadow(0 0 5px rgba(120,222,153,.7)); }
.sb-head:focus-visible, .sb-item:focus-visible{ outline: 2px solid var(--gn-mint); outline-offset: -2px; }
.sb-ic{ display: block; width: 20px; height: 20px; flex: none; }
.sb-ic svg, .sb-chev{ display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sb-chev{ width: 16px; height: 16px; margin-left: auto; flex: none; opacity: .7; transition: transform .35s cubic-bezier(.3,.7,.2,1), opacity .2s; }
.sb-head[aria-expanded="true"] .sb-chev{ transform: rotate(180deg); }

.sb-items{ overflow: hidden; }
.sb-items-inner{ display: grid; gap: 1px; margin: 2px 0 8px 21px; padding-left: 9px; border-left: 1px solid var(--gn-line); }
.sb-item{
  all: unset; box-sizing: border-box;
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--gn-soft); white-space: nowrap;
  cursor: pointer; transition: color .2s;
}
.sb-item:hover{ color: var(--text); }
.sb-item[aria-current="page"]{ color: var(--gn-ink); font-weight: 700; }
/* Reserve the bold width so selecting never shifts the row. */
.sb-lb{ display: inline-flex; flex-direction: column; }
.sb-lb::after{ content: attr(data-text); font-weight: 700; height: 0; overflow: hidden; visibility: hidden; }
.sb-sr{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The page has no header: the sidebar opens with the way back to the library and the guide's name. */
.sb-top.has-back{ padding-left: 0; }
.sb-back, .gn-back{ all: unset; box-sizing: border-box; display: flex; align-items: center; cursor: pointer;
  transition: transform 160ms cubic-bezier(.23,1,.32,1), background-color 150ms ease, color 150ms ease; }
.sb-back{ gap: 8px; height: 34px; padding: 0 12px 0 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--gn-soft); white-space: nowrap; }
.sb-back svg, .gn-back svg{ width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms cubic-bezier(.23,1,.32,1); }
@media (hover: hover) and (pointer: fine){
  .sb-back:hover{ background: rgba(255,255,255,.05); color: var(--text); }
  .sb-back:hover svg{ transform: translateX(-2px); }
}
.sb-back:active, .gn-back:active{ transform: scale(.97); }
.sb-back:focus-visible, .gn-back:focus-visible{ outline: 2px solid var(--gn-mint); outline-offset: 2px; }
.sb-brand{ display: grid; justify-items: start; gap: 7px; padding: 8px 12px 14px; border-bottom: 1px solid var(--gn-line-soft); }
.sb-brand-title{ font-size: 19px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; color: var(--text); }
.sb-brand-badge{ padding: 3px 8px; border-radius: 999px; border: 1px solid #2c6a43; background: #12241c; color: var(--gn-mint); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Phones and portrait tablets: sticky chapter bar + sheet ----------
   Up to 900 px (runkor, 23 Oct 2026): at 768–834 px the fixed sidebar left ~505 px for the content.
   The other phone rules stay at 760 px; the page padding and the jump offset follow the bar here. */
@media (max-width: 900px){
  .wrap{ padding: 16px 12px; }
  .pane{ scroll-margin-top: 72px; }
  .gn-side{ display: none; }
  .gn-mobile{
    position: sticky; top: 0; z-index: 40;
    margin: -16px -12px 12px; padding: 10px 12px;
    background: #0b1118; border-bottom: 1px solid var(--gn-line-soft); box-shadow: 0 8px 18px rgba(0,0,0,.35);
  }
  .gn-bar{ display: flex; align-items: center; gap: 8px; }
  .gn-back{ justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 12px; color: var(--gn-soft); background: var(--gn-panel); border: 1px solid var(--gn-line); }
  .gn-back svg{ width: 18px; height: 18px; }
  .gn-chapter{
    all: unset; box-sizing: border-box; width: 100%; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 12px; cursor: pointer;
    color: var(--gn-ink); font-weight: 700; font-size: 14px;
    position: relative;
    background: var(--gn-fill);
    animation: gn-breathe 2.8s ease-in-out infinite;
  }
  .gn-chapter > *{ position: relative; z-index: 1; }
  .gn-chapter small{ font-weight: 500; opacity: .7; }
  .gn-chev{ margin-left: auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s; }
  .gn-chapter[aria-expanded="true"] .gn-chev{ transform: rotate(180deg); }
  .gn-chapter:focus-visible{ outline: 2px solid var(--text); outline-offset: 3px; }
  .gn-sheet{ overflow: hidden; height: 0; }
  .gn-sheet .sb{ width: auto; border: 0; background: #0b1118; padding: 12px 0 4px; max-height: 70vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
}

/* ---------- Previous / next at the end of a section ---------- */
.guide-pager{ display: flex; justify-content: space-between; gap: 12px; margin: 36px 0 12px; padding-top: 18px; border-top: 1px solid var(--gn-line-soft); }
.guide-pager button{ all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--gn-line); border-radius: 10px; max-width: 48%; min-width: 0; font-family: Roboto, "Segoe UI", system-ui, sans-serif; }
.guide-pager button:hover{ border-color: var(--gn-mint); }
.guide-pager button:focus-visible{ outline: 2px solid var(--gn-mint); outline-offset: 2px; }
.guide-pager small{ font-size: 12px; color: var(--gn-faint); }
.guide-pager b{ font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-pager .next{ margin-left: auto; text-align: right; }

/* Animations switch at the foot of the sidebar */
.sb-motion{ all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 12px; border-radius: 9px; font-size: 12px; font-weight: 500; color: var(--gn-faint); cursor: pointer; white-space: nowrap; }
.sb-motion:hover{ color: var(--gn-soft); background: rgba(255,255,255,.03); }
.sb-motion:focus-visible{ outline: 2px solid var(--gn-mint); outline-offset: -2px; }
.sb-motion-switch{ position: relative; width: 26px; height: 15px; flex: none; border-radius: 999px; background: var(--gn-line); transition: background .2s; }
.sb-motion-switch::after{ content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--gn-soft); transition: transform .2s; }
.sb-motion[aria-pressed="true"] .sb-motion-switch{ background: var(--gn-mint); }
.sb-motion[aria-pressed="true"] .sb-motion-switch::after{ transform: translateX(11px); background: var(--gn-ink); }
/* Sign out (js/account.js, full edition only): a quiet row under the Animations switch. */
.sb-signout{ box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 8px 12px; border-radius: 9px; font-size: 12px; font-weight: 500; color: var(--gn-faint) !important; text-decoration: none !important; }
.sb-signout svg{ width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: 5px; }
.sb-signout:hover{ color: var(--gn-soft) !important; background: rgba(255,255,255,.03); }
.sb-signout:focus-visible{ outline: 2px solid var(--gn-mint); outline-offset: -2px; }

/* Reduced motion (system setting, unless the visitor switched animations on, or the visitor
   switched them off): nothing moves, but every highlight keeps a steady glow. */
@media (prefers-reduced-motion: reduce){
  :root:not(.motion-on) .sb-pill, :root:not(.motion-on) .gn-chapter{ animation: none; box-shadow: var(--gn-glow-still); }
  :root:not(.motion-on) .sb-head.is-current{ animation: none; text-shadow: 0 0 10px rgba(120,222,153,.7); }
  :root:not(.motion-on) .sb-pill.is-ping::after{ animation: none; }
  :root:not(.motion-on) .sb-pill::before, :root:not(.motion-on) .gn-chapter::before{ animation: none; opacity: 0; }
  :root:not(.motion-on) .sb-chev, :root:not(.motion-on) .gn-chev, :root:not(.motion-on) .sb-head, :root:not(.motion-on) .sb-item{ transition: none; }
}
:root.motion-off .sb-pill, :root.motion-off .gn-chapter{ animation: none; box-shadow: var(--gn-glow-still); }
:root.motion-off .sb-head.is-current{ animation: none; text-shadow: 0 0 10px rgba(120,222,153,.7); }
:root.motion-off .sb-pill.is-ping::after{ animation: none; }
:root.motion-off .sb-pill::before, :root.motion-off .gn-chapter::before{ animation: none; opacity: 0; }
:root.motion-off .sb-chev, :root.motion-off .gn-chev, :root.motion-off .sb-head, :root.motion-off .sb-item{ transition: none; }

/* Calmer current item (audit, 14 Oct 2026; runkor: "more emphasis on the halo, not the whole button lit").
   The pill is now a dark mint-to-gold tint with a thin edge; the light lives in the halo around it, which
   breathes slowly. The text stays light instead of dark ink on a bright fill. */
:root{
  --gn-pill-fill: linear-gradient(90deg, rgba(162,221,192,.17) 0%, rgba(162,221,192,.12) 60%, rgba(240,215,122,.2) 100%);
  --gn-pill-edge: inset 0 0 0 1px rgba(162,221,192,.42);
  --gn-glow-rest: var(--gn-pill-edge), -5px 0 16px 0 rgba(120,222,153,.24), 7px 0 16px 0 rgba(240,215,122,.24);
  --gn-glow-peak: var(--gn-pill-edge), -7px 0 26px 2px rgba(120,222,153,.4), 10px 0 26px 3px rgba(240,215,122,.42);
  --gn-glow-still: var(--gn-pill-edge), -6px 0 20px 1px rgba(120,222,153,.32), 8px 0 20px 2px rgba(240,215,122,.34);
}
.sb-pill{ background: var(--gn-pill-fill); animation-duration: 4.2s; }
/* The halo breathes on two layers that cross-fade (rest and peak), 27 Oct 2026: animating opacity runs on the GPU,
   animating box-shadow repainted the menu every frame. The thin edge stays on the pill itself. */
:root{
  --gn-halo-rest: -5px 0 16px 0 rgba(120,222,153,.24), 7px 0 16px 0 rgba(240,215,122,.24);
  --gn-halo-peak: -7px 0 26px 2px rgba(120,222,153,.4), 10px 0 26px 3px rgba(240,215,122,.42);
}
.sb-pill, .gn-chapter{ animation: none; box-shadow: var(--gn-pill-edge); }
.gn-glow{ position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: var(--gn-halo-rest); animation: gn-glow-out 2.8s ease-in-out infinite; }
.gn-glow.peak{ box-shadow: var(--gn-halo-peak); animation-name: gn-glow-in; }
.sb-pill .gn-glow{ animation-duration: 4.2s; }
.gn-chapter > .gn-glow{ position: absolute; z-index: 0; }
@keyframes gn-glow-out{ 0%,100%{ opacity: 1; } 50%{ opacity: 0; } }
@keyframes gn-glow-in{ 0%,100%{ opacity: 0; } 50%{ opacity: 1; } }
@media (prefers-reduced-motion: reduce){ :root:not(.motion-on) .gn-glow{ display: none; } }
:root.motion-off .gn-glow{ display: none; }
.sb-pill::before{ display: none; }
.sb-item[aria-current="page"]{ color: var(--gn-mint-hi); }

/* "New" / "Updated" tags for visitors who come back (27 Oct 2026, js/nav.js): small, after the label. */
/* Rows fit the menu: the widest row (a long label with its tag and, in the free edition, its lock) must not widen the rest. */
.sb-items-inner{ grid-template-columns: minmax(0, 1fr); }
.sb-item:has(.sb-upd) .sb-lb{ min-width: 0; overflow: hidden; }
/* Where the word would cut the label (Sideboard Optimizer, or any row with the free edition's lock), the tag is a dot. */
.sb-item.upd-tight .sb-upd{ font-size: 0; width: 7px; height: 7px; padding: 0; border: 0; background: var(--gn-gold); }
.sb-item.upd-tight .sb-upd.new{ background: var(--accent); }
.sb-upd{ flex: none; margin-left: auto; font-size: 8.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5;
  padding: 0 5px; border-radius: 999px; color: var(--gn-gold); border: 1px solid rgba(237,204,114,.45); background: rgba(237,204,114,.08); }
.sb-upd.new{ color: var(--gn-ink); background: var(--accent); border-color: var(--accent); }
.sb-item[aria-current="page"] .sb-upd{ display: none; }
.sb-item.is-locked .sb-upd + .lock-ic{ margin-left: 6px; }
.home-upd{ justify-self: start; width: max-content; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gn-gold); padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(237,204,114,.35); background: rgba(9,14,20,.7); }
/* The phone chapter bar shows only the number: the sheet names each section. */
.gn-upd{ margin-left: auto; flex: none; min-width: 18px; height: 18px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 800;
  padding: 0 5px; border-radius: 999px; background: rgba(11,40,28,.85); color: var(--gn-gold); position: relative; z-index: 1; }
.gn-upd + .gn-chev{ margin-left: 6px; }
