/* ──────────────────────────────────────────────
   PRIMORA: the masthead, the mobile sheet, the footer
   and the grounds the pages stand on.
   Loaded after styles.css on every page.
   ────────────────────────────────────────────── */

html { background: var(--paper); }
body { background: transparent; font-family: var(--f-sans); color: var(--ink); position: relative; min-height: 100vh; overflow-x: hidden; }

/* ── The living atlas (drawn by shared/bg.js) ───
   data-mode="hero": the night ground of the home page.
   data-mode="page": a quiet corner of the same map on the paper of the content pages. */
#bg-canvas { position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh; display: block; pointer-events: none; }
#bg-canvas[data-mode="hero"] { background: var(--night); }
/* The body paints above a canvas of negative z-index, so on the home page the night is the canvas's
   own ground and the page element's (the latter is what shows when a touch screen over-scrolls). */
html:has(body.home) { background: var(--night); }

/* ── Masthead ─────────────────────────────────── */
.nav-wrap {
  position: sticky; top: 0; z-index: 50;
  background: var(--night);
  border-bottom: 1px solid rgba(233, 238, 242, 0.08);
}
/* Over the night canvas of the home page the bar lets the atlas show through. */
body.home .nav-wrap {
  background: color-mix(in oklch, var(--night) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
}
.nav {
  max-width: 1304px; margin: 0 auto;
  padding: 15px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.brand-mark { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
/* The mark is 602 x 112: the ratio reserves its room before the file arrives. */
.brand-mark img { height: 30px; aspect-ratio: 602 / 112; width: auto; display: block; }

.links { display: flex; align-items: center; gap: 34px; }
.links a {
  font-family: var(--f-sans); font-size: 14.5px; font-weight: 500; letter-spacing: 0.005em;
  color: var(--on-night-2); text-decoration: none;
  padding: 6px 0; border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.links a:hover { color: var(--on-night); }
.links a.active { color: var(--on-night); border-bottom-color: var(--warm); }

.nav-cta { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 17px;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--f-sans); font-size: 13.5px; font-weight: 600; letter-spacing: 0;
  border: 1px solid transparent; cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.pill.primary { background: var(--on-night); color: var(--night); }
.pill.primary:hover { background: #fff; color: var(--night); }
.pill.secondary { background: transparent; color: var(--on-night-2); border-color: rgba(233, 238, 242, 0.22); }
.pill.secondary:hover { color: var(--on-night); border-color: rgba(233, 238, 242, 0.5); }
.pill:active { transform: scale(0.98); }
.pill .ar { font-family: var(--f-mono); font-weight: 500; }

.menu-btn {
  display: none;
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 1px solid rgba(233, 238, 242, 0.22);
  width: 38px; height: 38px; border-radius: 50%;
  align-items: center; justify-content: center;
  color: var(--on-night); cursor: pointer;
  padding: 0; flex-shrink: 0;
}
.menu-btn svg { width: 17px; height: 17px; display: block; }

/* ── Mobile sheet ─────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 21, 31, 0.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; right: 0; top: 0; z-index: 81;
  width: min(88vw, 360px); height: 100dvh;
  background: var(--night-2); color: var(--on-night);
  box-shadow: -12px 0 48px rgba(10, 21, 31, 0.4);
  transform: translateX(100%);
  transition: transform .45s cubic-bezier(.22,1,.36,1);
  padding: 20px 26px;
  display: flex; flex-direction: column; gap: 22px;
}
.sheet.open { transform: translateX(0); }
.sheet:not(.open) { box-shadow: none; }
.sheet .top { display: flex; justify-content: space-between; align-items: center; }
.sheet .top img { height: 28px; aspect-ratio: 602 / 112; width: auto; }
.sheet .menu-btn { display: inline-flex; }
.sheet .div { height: 1px; background: rgba(233, 238, 242, 0.14); }
.sheet .list { display: flex; flex-direction: column; gap: 2px; }
.sheet .list a {
  font-family: var(--f-display); font-weight: 400;
  font-size: 32px; line-height: 1.2;
  color: var(--on-night); text-decoration: none;
  padding: 6px 0;
}
.sheet .list a:hover { color: var(--warm); }
.sheet .ctas { margin-top: auto; display: grid; gap: 10px; }
.sheet .ctas .pill { justify-content: center; padding: 13px 18px; font-size: 14.5px; }

/* ── Footer ───────────────────────────────────── */
.foot { position: relative; background: var(--night); color: var(--on-night-3); }
.foot .row {
  max-width: 1304px; margin: 0 auto;
  padding: 22px 32px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  gap: 14px 24px; flex-wrap: wrap;
}
.foot a { color: var(--on-night-3); text-decoration: none; margin-left: 18px; transition: color .15s; }
.foot a:first-child { margin-left: 0; }
.foot a:hover { color: var(--on-night); }

/* ── Responsive ─────────────────────────────────
   Up to 900 px the links move into the sheet. */
@media (max-width: 900px) {
  .nav { padding: 12px 18px; gap: 12px; }
  .brand-mark img { height: 26px; }
  .links { display: none; }
  .menu-btn { display: inline-flex; }
  .pill { padding: 8px 14px; font-size: 13px; }
  .foot .row { padding: 20px 20px; }
}
@media (max-width: 540px) {
  .brand-mark img { height: 24px; }
  .pill.primary .ar { display: none; }
  .sheet { padding: 18px 22px; }
  .sheet .list a { font-size: 28px; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .links { gap: 24px; }
}
