/* ==========================================================================
   Header menu as a radio dial (markup: src/views/menu-dial.js; script:
   assets/js/menu-dial.js). Linked after site.css on every public page.

   1180px and up: sections are stations on a thin tuning scale; a gold needle
   rests on the current section and slides to the hovered or focused one;
   menus drop a "dial face" (a panel with a shallow domed top).
   Below 1180px: the "thumb dial", a round button at the right end of the
   header bar that opens a quarter dial unfolding down and left from that
   corner (built by the script). Without JavaScript the button opens the <nav>
   as a plain full-screen list.

   Everything sits inside .site-header, which keeps the light tokens in dark
   mode (theme.css), so the dial is the same plum in both themes.
   ========================================================================== */

.site-header { --dial-gold: var(--header-focus, #E8C877); --dial-text: #E7EAF2; }

/* ------------------------------------------------------- Desktop band */
.dial-nav { position: relative; display: flex; align-items: center; align-self: stretch; flex-shrink: 0; margin-left: 2rem; }
.dial-x, .dial-fab { display: none; }
.dial-band { display: flex; align-items: center; gap: 0.1rem; margin: 0; padding: 0; list-style: none; }
.dial-st { position: relative; }
.dial-tune {
  position: relative; display: flex; align-items: center; min-height: 44px; padding: 0 0.72rem;
  font: 500 0.92rem/1.2 var(--font); letter-spacing: 0.012em; color: var(--dial-text); white-space: nowrap;
  background: none; border: 0; border-radius: 4px; cursor: pointer; list-style: none;
  transition: color 0.15s ease;
}
.dial-tune::-webkit-details-marker { display: none; }
.dial-tune:hover, .dial-st.is-tuned .dial-tune, .dial-menu[open] .dial-tune, .dial-menu.is-open .dial-tune { color: #fff; }
.dial-st.is-current .dial-tune { color: #fff; }

/* The scale: a hairline with fine ticks across the band, a taller tick under each station. */
.dial-scale {
  position: absolute; left: 0; right: 0; bottom: calc(50% - 31px); height: 6px; pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.24)) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 7px) left bottom / 100% 4px no-repeat;
  -webkit-mask: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.dial-st::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 1px; height: 8px; margin-left: -0.5px;
  background: rgba(255, 255, 255, 0.5); pointer-events: none;
}
.dial-st.is-current::after { background: var(--dial-gold); }

/* The needle: a slim gold line across the scale with a small cap; the script moves it. */
.dial-needle {
  position: absolute; left: 0; bottom: calc(50% - 34px); width: 2px; height: 20px; margin-left: -1px; pointer-events: none;
  background: linear-gradient(var(--dial-gold), var(--dial-gold) 70%, rgba(232, 200, 119, 0.15));
  border-radius: 1px; box-shadow: 0 0 8px rgba(232, 200, 119, 0.55);
  transform: translateX(var(--needle-x, 0px)); opacity: 0;
  transition: transform 0.5s cubic-bezier(0.3, 0.75, 0.2, 1), opacity 0.3s ease;
}
.dial-needle::before {
  content: ""; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px; margin-left: -3px;
  background: var(--dial-gold); border-radius: 50%;
}
.dial-js .dial-needle { opacity: 1; }
.dial-js .dial-nav.is-parked .dial-needle { opacity: 0.4; }

/* Dial face: hangs from the bar's lower edge, centred under its station (the script keeps it on screen). */
.dial-face {
  --gap: calc((var(--header-h) - 44px) / 2);
  position: absolute; top: calc(100% + var(--gap)); left: 50%; z-index: 50;
  width: max-content; min-width: 250px; max-width: calc(100vw - 24px); padding: 12px 10px 14px;
  color: var(--dial-text); text-align: left;
  background: radial-gradient(120% 70px at 50% 0, rgba(255, 255, 255, 0.07), transparent), var(--ink);
  border: 1px solid var(--line-dark); border-top-color: rgba(232, 200, 119, 0.45);
  border-radius: 50% 50% 14px 14px / 26px 26px 14px 14px;
  box-shadow: 0 24px 48px -18px rgba(8, 4, 20, 0.6), 0 4px 12px rgba(8, 4, 20, 0.2);
  transform: translateX(calc(-50% + var(--shift, 0px)));
}
/* A bridge over the gap so the pointer can travel from the station to its face. */
.dial-face::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--gap) - 2px); height: calc(var(--gap) + 2px); }
.dial-dome { display: block; margin: 0 auto; overflow: visible; }
.dial-dome-ticks { stroke: rgba(255, 255, 255, 0.42); stroke-width: 1; }
.dial-dome-needle { stroke: var(--dial-gold); stroke-width: 1.6; stroke-linecap: round; }
.dial-dome-pivot { fill: var(--dial-gold); }
.dial-face-title {
  margin: 2px 0 6px; padding: 0 12px 8px; text-align: center; border-bottom: 1px solid var(--line-dark);
  font-family: var(--font-serif); font-size: 1rem; font-weight: 600; line-height: 1.3;
  font-variant-caps: all-small-caps; letter-spacing: var(--kicker-track, 0.12em); color: var(--dial-gold);
}
.dial-face ul { margin: 0; padding: 0; list-style: none; }
.dial-face a {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border-radius: 6px;
  font-size: 0.9rem; font-weight: 450; letter-spacing: 0.005em; line-height: 1.25; color: var(--dial-text);
  transition: background 0.15s ease, color 0.15s ease;
}
.dial-face a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.dial-face a[aria-current="page"] { color: #fff; box-shadow: inset 2px 0 0 var(--dial-gold); }
.dial-face a:focus-visible { outline-offset: -2px; }
.dial-glyph { flex: none; color: var(--dial-gold); opacity: 0.85; }

/* The Observatory's face: its tools in headed groups, side by side. */
.dial-face.is-wide { width: min(780px, calc(100vw - 24px)); padding-left: 14px; padding-right: 14px; }
.dial-face-body.is-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 10px; }
.dial-group-h {
  margin: 6px 0 2px; padding: 0 14px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--on-ink-muted);
}
.dial-face.is-wide a { padding: 6px 10px; min-height: 36px; font-size: 0.86rem; }
.dial-all {
  justify-content: flex-end; margin-top: 8px; border-top: 1px solid var(--line-dark); border-radius: 0 0 8px 8px;
  font-weight: 550 !important; color: var(--dial-gold) !important;
}
.dial-all:hover { background: rgba(232, 200, 119, 0.08) !important; }
.dial-face .dial-all[aria-current="page"], .tdial-sheet-body .dial-all[aria-current="page"] { box-shadow: none; }

/* With the script: menus open by class (hover, focus, click), with a short fade. */
.dial-js .dial-menu .dial-face { visibility: hidden; opacity: 0; transform: translateX(calc(-50% + var(--shift, 0px))) translateY(-4px); transition: opacity 0.18s ease, transform 0.22s ease, visibility 0s linear 0.22s; }
.dial-js .dial-menu.is-open .dial-face { visibility: visible; opacity: 1; transform: translateX(calc(-50% + var(--shift, 0px))); transition: opacity 0.18s ease, transform 0.22s ease; }

/* Compact band */
@media (max-width: 1359px) {
  .dial-nav { margin-left: 1.25rem; }
  .dial-tune { padding: 0 0.5rem; font-size: 0.87rem; }
  .dial-scale { bottom: calc(50% - 28px); }
  .dial-st::after { bottom: -6px; height: 7px; }
  .dial-needle { bottom: calc(50% - 31px); height: 18px; }
}

/* ---------------------------------------------- Phones and tablets */
@media (max-width: 1179px) {
  .dial-nav { display: none; }
  /* The menu button: the last of the header's 44px tools, round, with a gold rim. */
  .dial-fab {
    display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0;
    color: #fff; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.12), transparent 62%), rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(232, 200, 119, 0.55); border-radius: 50%; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.2s ease;
  }
  .dial-fab svg { width: 28px; height: 28px; }
  .dial-fab:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--dial-gold); }
  .dial-fab-needle { stroke: var(--dial-gold); }
  html.dial-open .dial-fab { opacity: 0; pointer-events: none; }

  /* Without JavaScript: the button opens the menu as a plain full-screen list. */
  html:not(.dial-js) .dial-nav:target {
    position: fixed; inset: 0; z-index: 70; display: block; margin: 0; padding: 12px 20px 40px; overflow-y: auto;
    background: var(--ink);
  }
  html:not(.dial-js) .dial-nav:target .dial-x {
    display: flex; align-items: center; justify-content: flex-end; min-height: 48px; margin-bottom: 8px;
    color: var(--dial-gold); font-weight: 600; border-bottom: 1px solid var(--line-dark);
  }
  .dial-nav:target .dial-band { flex-direction: column; align-items: stretch; }
  .dial-nav:target .dial-st::after, .dial-nav:target .dial-scale, .dial-nav:target .dial-needle, .dial-nav:target .dial-dome, .dial-nav:target .dial-face-title { display: none; }
  .dial-nav:target .dial-tune { min-height: 52px; font-size: 1.05rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); border-radius: 0; }
  .dial-nav:target .dial-face { position: static; width: auto; max-width: none; padding: 4px 0 10px 12px; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; }
}

/* ------------------------------------------------- The thumb dial */
.tdial { position: fixed; inset: 0; z-index: 70; visibility: hidden; pointer-events: none; color: #fff; }
.tdial.is-open { visibility: visible; pointer-events: auto; }
.tdial-backdrop {
  position: absolute; inset: 0; background: rgba(14, 8, 28, 0.58);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.28s ease;
}
.tdial.is-open .tdial-backdrop { opacity: 1; }
.tdial-disc {
  position: absolute; left: calc(var(--cx) - var(--R)); top: calc(var(--cy) - var(--R)); width: calc(var(--R) * 2); height: calc(var(--R) * 2);
  border-radius: 50%; touch-action: none; cursor: grab;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 70%), var(--ink);
  border: 1px solid rgba(232, 200, 119, 0.35);
  box-shadow: 0 0 0 6px rgba(42, 27, 69, 0.35), -30px 30px 80px -20px rgba(0, 0, 0, 0.55);
  transform: scale(0.18); opacity: 0;
  transition: transform 0.42s cubic-bezier(0.2, 0.85, 0.25, 1), opacity 0.22s ease;
}
.tdial-disc.is-dragging { cursor: grabbing; }
.tdial.is-open .tdial-disc { transform: none; opacity: 1; }
.tdial-ticks {
  display: none; /* plain rim, no tick marks */
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.34) 0deg 0.35deg, transparent 0.35deg 3deg);
  -webkit-mask: radial-gradient(closest-side, transparent 92.5%, #000 92.8%, #000 96.5%, transparent 96.8%);
  mask: radial-gradient(closest-side, transparent 92.5%, #000 92.8%, #000 96.5%, transparent 96.8%);
}
.tdial-mark, .tdial-needle { position: absolute; left: var(--cx); top: var(--cy); height: 2px; margin-top: -1px; transform-origin: 0 50%; pointer-events: none; }
.tdial-mark { width: calc(var(--R) - 4px); }
.tdial-mark { display: none; }
.tdial-needle {
  width: calc(var(--R) - 2px);
  background: none; opacity: 0; transition: opacity 0.3s ease 0.12s;
}
.tdial-needle::after { content: ""; position: absolute; right: -4px; top: -3px; width: 8px; height: 8px; background: var(--dial-gold); border-radius: 50%; box-shadow: 0 0 8px rgba(232, 200, 119, 0.6); }
.tdial.is-open .tdial-needle { opacity: 1; }

.tdial-st {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px;
  font: 550 1.02rem/1.2 var(--font); letter-spacing: 0.01em; color: var(--dial-text); white-space: nowrap;
  background: none; border: 0; border-radius: 22px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  opacity: 0; transition: color 0.2s ease, background 0.2s ease;
}
.tdial-st.is-tuned { color: var(--dial-gold); background: #3A2858; box-shadow: inset 0 0 0 1px rgba(232, 200, 119, 0.45), 0 6px 18px -6px rgba(0, 0, 0, 0.5); }
.tdial-st.is-current::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.tdial-st:focus-visible, .tdial-btn:focus-visible, .tdial-sheet a:focus-visible, .tdial-sheet button:focus-visible { outline: 2px solid var(--dial-gold); outline-offset: 2px; }

.tdial-btn {
  position: absolute; left: var(--x); top: var(--y); display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin: -23px 0 0 -23px; padding: 0; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 50%;
  opacity: 0; transform: scale(0.6); transition: opacity 0.25s ease 0.1s, transform 0.3s ease 0.1s, background 0.15s ease;
}
.tdial-btn:hover { background: rgba(255, 255, 255, 0.12); }
.tdial.is-open .tdial-btn { opacity: 1; transform: none; }
.tdial-btn.is-close { width: 48px; height: 48px; margin: -24px 0 0 -24px; border-color: rgba(232, 200, 119, 0.55); background: var(--ink); }
.tdial-btn .theme-sun, :root[data-theme="dark"] .tdial-btn .theme-moon { display: none; }
:root[data-theme="dark"] .tdial-btn .theme-sun { display: block; color: var(--dial-gold); }

/* A section's links: a sheet with the face's domed top, below or beside the dial. */
.tdial-sheet {
  position: absolute; left: var(--sl); top: var(--st); width: var(--sw); max-height: var(--sh);
  display: flex; flex-direction: column; padding: 10px 8px 8px;
  background: radial-gradient(120% 80px at 50% 0, rgba(255, 255, 255, 0.07), transparent), var(--ink);
  border: 1px solid var(--line-dark); border-top-color: rgba(232, 200, 119, 0.45);
  border-radius: 50% 50% 16px 16px / 24px 24px 16px 16px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  opacity: 0; transform: translateY(-10px); transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.tdial-sheet[hidden] { display: none; }
.tdial-sheet.is-in { opacity: 1; transform: none; }
.tdial-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 8px 14px; border-bottom: 1px solid var(--line-dark); }
.tdial-sheet-title {
  margin: 0; font-family: var(--font-serif); font-size: 1.12rem; font-weight: 600; line-height: 1.2;
  font-variant-caps: all-small-caps; letter-spacing: var(--kicker-track, 0.12em); color: var(--dial-gold);
}
.tdial-sheet-close {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; padding: 0;
  color: #fff; background: none; border: 1px solid var(--line-dark); border-radius: 50%; cursor: pointer;
}
.tdial-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 2px 2px; }
.tdial-sheet-body ul { margin: 0; padding: 0; list-style: none; }
.tdial-sheet-body a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 4px 12px; border-radius: 8px;
  font-size: 1rem; line-height: 1.25; color: var(--dial-text);
}
.tdial-sheet-body a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.tdial-sheet-body a[aria-current="page"] { color: #fff; box-shadow: inset 2px 0 0 var(--dial-gold); }
.tdial-sheet-body .dial-face-body.is-groups { display: block; }
.tdial-sheet-body .dial-group-h { margin: 10px 0 2px; padding: 0 12px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-ink-muted); }
.tdial-sheet-body .dial-all { justify-content: flex-start; margin-top: 8px; border-top: 1px solid var(--line-dark); border-radius: 0; font-weight: 600; color: var(--dial-gold); }
html.dial-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .dial-needle, .dial-js .dial-menu .dial-face, .dial-js .dial-menu.is-open .dial-face, .dial-fab,
  .tdial-backdrop, .tdial-disc, .tdial-needle, .tdial-btn, .tdial-sheet, .tdial-st { transition: none; }
  .tdial-disc, .tdial-sheet, .tdial-btn { transform: none; }
}
@media print { .dial-nav, .dial-fab, .tdial { display: none !important; } }
/* The search button's "/" tooltip shows on wide screens only; below that it must not widen the page. */
@media (max-width: 1179px) { .site-header .header-search-tip { display: none; } }
/* Below 350px the bar keeps the brand and the dial button; search stays on the dial's inner ring. */
@media (max-width: 349px) { .site-header .header-search { display: none; } }
