/* Mobile nav: one amber button that fans the section links out on an arc.
   Mobile only (<=820px). Desktop keeps the current bar. */

/* button lives in the bar, hidden until mobile */
.fan-btn { display: none; }
.fan, .fan-scrim { display: none; }
@media (max-width: 820px) {
  .fan, .fan-scrim { display: block; }
  .fan { display: flex; }
}

@media (max-width: 820px) {
  /* the four links move into the fan; the mark and the two toggles stay in the bar */
  .stage .toplinks .talk { display: none; }
  .stage .toplinks { gap: 8px !important; }
  .stage .topright { display: flex; align-items: center; gap: 8px; direction: ltr; }
  .tbtn { min-width: 40px !important; height: 40px !important; padding: 0 8px !important; }

  .fan-btn {
    display: inline-grid; place-items: center;
    width: 48px; height: 48px; padding: 0; border-radius: 50%;
    border: 0; cursor: pointer; position: relative; z-index: 42;
    background: radial-gradient(circle at 50% 32%, #ffd08a 0%, #f2a01f 46%, #d9820c 100%);
    box-shadow: 0 0 0 1px rgba(255,196,107,.45), 0 6px 20px rgba(242,160,31,.42), 0 0 34px rgba(242,160,31,.26);
    color: #0b101d; -webkit-tap-highlight-color: transparent;
    transition: transform .22s cubic-bezier(.3,.8,.3,1), box-shadow .3s ease, background .3s ease;
  }
  .fan-btn:active { transform: scale(.94); }
  .fan-btn:focus-visible { outline: 2px solid #ffd08a; outline-offset: 3px; }
  .fan-btn svg { width: 22px; height: 22px; display: block; }
  .fan-btn .ico-x { display: none; }
  .fan-btn[aria-expanded="true"] .ico-menu { display: none; }
  .fan-btn[aria-expanded="true"] .ico-x { display: block; }

  /* scrim */
  .fan-scrim {
    position: fixed; inset: 0; z-index: 5; display: block;
    background: rgba(4,7,13,.44);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    opacity: 0; pointer-events: none; transition: opacity .26s ease;
  }
  .fan-scrim.on { opacity: 1; pointer-events: auto; }

  /* the fan */
  .fan {
    position: fixed; z-index: 41; top: 62px; right: 12px;
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 10px; direction: ltr; pointer-events: none;
    visibility: hidden; transition: visibility 0s linear .32s;
  }
  .fan.open { visibility: visible; transition-delay: 0s; }
  .fan-pill {
    --r: 0deg;
    pointer-events: none;
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 46px; padding: 0 20px;
    border-radius: 999px; text-decoration: none;
    font: 800 15px/1 'TomAR', system-ui, sans-serif; letter-spacing: .01em;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(22,30,46,.94), rgba(11,16,29,.94));
    border: 1px solid rgba(190,205,228,.20);
    color: #eef1f7;
    box-shadow: 0 12px 28px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.05);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    transform-origin: 100% 50%;
    transform: translateY(-10px) scale(.86) rotate(var(--r));
    opacity: 0;
    transition: opacity .2s ease, transform .3s cubic-bezier(.2,.9,.25,1),
                border-color .2s ease, color .2s ease, background .2s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .fan-pill:nth-child(1) { --r: 0deg; margin-right: 0; }
  .fan-pill:nth-child(2) { --r: -3deg; margin-right: 10px; }
  .fan-pill:nth-child(3) { --r: -6deg; margin-right: 24px; }
  .fan-pill:nth-child(4) { --r: -9deg; margin-right: 42px; }
  .fan.open .fan-pill { opacity: 1; transform: rotate(var(--r)); pointer-events: auto; }
  .fan.open .fan-pill:nth-child(1) { transition-delay: .02s; }
  .fan.open .fan-pill:nth-child(2) { transition-delay: .07s; }
  .fan.open .fan-pill:nth-child(3) { transition-delay: .12s; }
  .fan.open .fan-pill:nth-child(4) { transition-delay: .17s; }
  .fan-pill:focus-visible { outline: 2px solid #ffd08a; outline-offset: 3px; }

  /* clear active state */
  .fan-pill.on {
    color: #ffc46b; border-color: rgba(242,160,31,.62);
    background: linear-gradient(180deg, rgba(52,36,12,.94), rgba(26,19,10,.94));
    box-shadow: 0 12px 28px rgba(0,0,0,.46), inset 0 0 0 1px rgba(242,160,31,.12), 0 0 22px rgba(242,160,31,.18);
  }
  .fan-pill.on::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: #f2a01f; box-shadow: 0 0 8px rgba(242,160,31,.9); flex: none;
  }

  /* day */
  html[data-theme="light"] .fan-btn {
    background: linear-gradient(180deg, #e08a12 0%, #c97609 100%);
    box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 18px rgba(120,72,12,.30), 0 2px 5px rgba(120,72,12,.18);
    color: #fffaf0;
  }
  html[data-theme="light"] .fan-btn:focus-visible { outline-color: #c97609; }
  html[data-theme="light"] .fan-scrim { background: rgba(246,241,231,.58); }
  html[data-theme="light"] .fan-pill {
    background: #fffdf8;
    border-color: rgba(30,40,70,.14);
    color: #1b2233;
    box-shadow: 0 10px 24px rgba(60,50,30,.16), 0 1px 2px rgba(60,50,30,.08);
  }
  html[data-theme="light"] .fan-pill.on {
    color: #8a5206; border-color: rgba(201,118,9,.55);
    background: #fdf1de;
    box-shadow: 0 10px 24px rgba(60,50,30,.16), inset 0 0 0 1px rgba(201,118,9,.10);
  }
  html[data-theme="light"] .fan-pill.on::before { background: #c97609; box-shadow: none; }
  html[data-theme="light"] .fan-pill:focus-visible { outline-color: #c97609; }
}

@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .fan-pill, .fan-scrim, .fan-btn { transition: none !important; }
  .fan-pill { transform: rotate(var(--r)); }
}

/* LTR: same geometry (button is on the right), labels read left to right */
html[dir="ltr"] .fan-pill { direction: ltr; }
html[dir="ltr"] .fan-pill.on::before { order: -1; }
