/* The page shell: header, its menus, the phone menu sheet and the footer. The same markup sits on
   every page between the shell markers (scripts/sync-shell.py copies it). Loaded after site.css,
   which keeps the header's sticky bar, brand and backdrop.

   Desktop (1100 px and wider): Network, Labs and Foundation are <details> disclosures that open a
   panel of links; they work without scripts. Below 1100 px, with scripts, the bar shows the brand,
   "Get SOQ" and Menu, and Menu opens a full-height sheet (js/shell.js). Without scripts the nav
   shows as a wrapped list and the menus open in place. */

.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* the mark, drawn in the text colour through the SVG as a mask */
.brand-mark {
  display: inline-block; flex: none; width: 22px; height: 22px; margin-right: 0.6rem; background: currentColor;
  -webkit-mask: url("/images/soqucoin-mark.svg?mask") center / contain no-repeat;
  mask: url("/images/soqucoin-mark.svg?mask") center / contain no-repeat;
}
@media (forced-colors: active) { .brand-mark { background: CanvasText; } }

/* header row */
.site-head { gap: 0 1.2rem; }
.shell-nav { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-bar { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.3rem; }
.nav-bar > li > a,
.nav-menu summary {
  display: inline-flex; align-items: center; gap: 0.45em; min-height: 40px; color: var(--muted); text-decoration: none; cursor: pointer;
}
.nav-bar > li > a:hover,
.nav-menu summary:hover { color: var(--accent-ink); }
.nav-menu summary { list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-chev { width: 8px; height: 5px; fill: currentColor; transition: transform var(--dur) var(--ease); }
.nav-menu details[open] > summary { color: var(--ink); }
.nav-menu details[open] .nav-chev { transform: rotate(180deg); }
/* the current page, and the menu that holds it: an underline, which forced colours keep */
.shell-nav a[aria-current="page"],
.nav-menu:has(a[aria-current="page"]) > details > summary,
.menu-sheet a[aria-current="page"] {
  color: var(--ink); text-decoration-line: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1px; text-underline-offset: 0.7em;
}
.nav-cta {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.75rem; margin-left: auto;
  font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-ink); text-decoration: none; border: 1px solid var(--accent); white-space: nowrap;
}
.nav-cta:hover { background: var(--accent); color: var(--accent-on); }

/* menu panels: plain link lists */
.nav-panel { font-family: var(--sans); font-size: var(--t-small); letter-spacing: 0; text-transform: none; }
.nav-panel ul, .sheet-group ul { list-style: none; margin: 0; padding: 0; }
.nav-panel a { display: flex; align-items: center; min-height: 40px; padding: 0 0.9rem; color: var(--ink); text-decoration: none; }
.nav-panel a:hover { background: rgba(217, 111, 50, 0.1); color: var(--accent-ink); }
.nav-sep { border-top: 1px solid var(--rule); margin-top: 0.35rem; padding-top: 0.35rem; }
.nav-group-name {
  margin: 0; padding: 0.5rem 0.9rem 0.3rem; font-family: var(--mono); font-size: var(--t-label);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2);
}
.ext { margin-left: 0.4em; color: var(--muted-2); }

/* phone menu: the button, and the sheet it opens */
.menu-btn, .menu-close {
  display: none; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0 0.8rem; cursor: pointer;
  font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 1px solid #3a444f;
}
.menu-btn:hover, .menu-btn[aria-expanded="true"], .menu-close:hover { border-color: var(--accent); }
.menu-icon { width: 14px; height: 10px; fill: currentColor; }
.menu-close .menu-icon { width: 10px; height: 10px; }
.menu-close { display: inline-flex; }
.menu-sheet[hidden] { display: none; }

@media (min-width: 1100px) {
  .site-head { flex-wrap: nowrap; }
  .shell-nav { margin-left: auto; }
  .nav-cta { margin-left: 0.4rem; }
  .nav-menu { position: relative; }
  .nav-panel {
    position: absolute; top: calc(100% + 0.45rem); left: -0.9rem; z-index: 1; min-width: 15rem; padding: 0.4rem 0;
    background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
  .nav-panel-2 { display: grid; grid-template-columns: repeat(2, minmax(13rem, 1fr)); }
  .nav-panel-2 .nav-group + .nav-group { border-left: 1px solid var(--rule); }
  /* the last menu opens toward the left, so it stays on screen */
  .nav-menu:nth-last-child(2) .nav-panel { left: auto; right: -0.9rem; }
  @media (prefers-reduced-motion: no-preference) {
    .nav-menu details[open] .nav-panel { animation: panel-in 180ms var(--ease); }
  }
}
@keyframes panel-in { from { opacity: 0; transform: translateY(-4px); } }

/* below 1100 px without scripts: the nav is a wrapped list under the brand, the menus open in
   place, and the header scrolls away instead of covering the screen */
@media (max-width: 1099.98px) {
  .site-head { flex-wrap: wrap; }
  .shell-nav { order: 3; flex: 1 0 100%; }
  .nav-bar { gap: 0 1.1rem; }
  .nav-panel { padding: 0 0 0.6rem; }
  .nav-panel a { padding: 0 0.6rem; }
  .nav-group-name { padding-left: 0.6rem; }
}
@media (scripting: none) and (max-width: 1099.98px) {
  .site-head { position: relative; }
  html { scroll-padding-top: 0.75rem; }
}
/* below 1100 px once shell.js runs (it sets .shell-js): one row, the brand, "Get SOQ" and Menu.
   Gated on the script itself, not on scripting being enabled, so a script that is slow or fails to
   load leaves the wrapped link list in place instead of a Menu button that opens nothing. */
@media (max-width: 1099.98px) {
  .shell-js .site-head { flex-wrap: nowrap; gap: 0 0.6rem; }
  .shell-js .shell-nav { display: none; }
  .shell-js .menu-btn { display: inline-flex; }
  .shell-js .nav-cta { min-height: 44px; }
}

/* narrow phones: Menu keeps its name for screen readers but shows only its icon; below 360 px the
   brand drops its mark, so the row fits at 320 px */
@media (max-width: 479.98px) {
  .site-head { gap: 0 0.45rem; }
  .menu-btn { justify-content: center; width: 44px; padding: 0; }
  .menu-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .nav-cta { padding: 0 0.6rem; }
}
@media (max-width: 359.98px) {
  .site-head > .brand .brand-mark { display: none; }
}

/* the sheet fills the screen below the header; the page behind it is inert and does not scroll */
.menu-sheet {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 2;
  height: calc(100vh - var(--head-h, 4rem) - env(safe-area-inset-top, 0px));
  height: calc(100dvh - var(--head-h, 4rem) - env(safe-area-inset-top, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--head-pad-r) calc(2rem + env(safe-area-inset-bottom, 0px)) var(--head-pad-l);
  background: var(--paper); border-top: 1px solid var(--rule);
}
.menu-open { overflow: hidden; }
.menu-open .site-head { z-index: 45; background: var(--paper); }
.sheet-bar { display: flex; justify-content: flex-end; padding: 0.75rem 0 0.25rem; }
.sheet-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.5rem 2rem; }
.sheet-group .nav-group-name { padding: 1rem 0 0.4rem; border-bottom: 1px solid var(--rule); }
.sheet-group li + li { border-top: 1px solid var(--rule); }
.menu-sheet a {
  display: flex; align-items: center; min-height: 48px; color: var(--ink); text-decoration: none;
  font-size: 1.05rem;
}
.menu-sheet a:hover { color: var(--accent-ink); }
@media (prefers-reduced-motion: no-preference) {
  .menu-sheet:not([hidden]) { animation: sheet-in 220ms var(--ease); }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(-8px); } }

/* footer: three entities and the community, then a base line */
footer.site-foot { padding-top: 3rem; }
.foot-grid {
  max-width: 72rem; margin: 0 auto; display: grid; gap: 2rem 2.5rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 0.8fr);
}
.foot-col { min-width: 0; }
.foot-name {
  display: flex; align-items: center; margin: 0 0 0.7rem; font-size: 0.95rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink);
}
.foot-name .brand-mark { width: 20px; height: 20px; margin-right: 0.55rem; }
footer.site-foot address { margin: 0 0 0.7rem; color: var(--muted); }
.foot-addr { display: block; }
.foot-addr > span { white-space: nowrap; }
footer.site-foot .foot-col > p { color: var(--muted-2); max-width: 22rem; }
.foot-list { list-style: none; margin: 0.9rem 0 0; padding: 0; }
.foot-list a { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 32px; text-decoration: none; }
footer.site-foot .foot-list a:hover { color: var(--accent-ink); }
.foot-list .ext { margin-left: 0; }
.foot-social svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.foot-base {
  max-width: 72rem; margin: 2.5rem auto 0; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 2rem;
}
.foot-inline { display: flex; flex-wrap: wrap; gap: 0 1.6rem; margin: 0; }
@media (max-width: 960px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .foot-list:not(.foot-inline) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
  .foot-list a { min-height: 44px; }
}

@media print {
  .site-head, .menu-sheet, .scene-hud, .skip-link { display: none !important; }
}
