*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.009em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--text); }
h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.022em; }
h2 { font-size: 24px; line-height: 1.17; font-weight: 650; letter-spacing: -0.018em; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.012em; }
h4 { font-size: 13px; line-height: 1.3; font-weight: 600; letter-spacing: 0; color: var(--text-2); }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-s); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 30;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
}
.skip-link:focus-visible { top: 8px; }

/* ── top bar: frosted, hairline under, never glued content ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hairline);
}
.topbar__inner {
  max-width: 1280px; height: 100%; margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: var(--s-5);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 24px; height: 24px; }
.brand__mark rect { fill: var(--text); }
.brand__mark path { stroke: var(--bg); stroke-width: 1.8; stroke-linecap: round; fill: none; }
.brand__name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

.topnav { display: flex; gap: 2px; }
.topnav a {
  padding: 6px 12px; border-radius: var(--r-pill);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.topnav a:hover { color: var(--text); text-decoration: none; background: var(--bg-hover); }
.topnav a[aria-current="page"] { color: var(--text); background: var(--fill-quiet); }

.session { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-2); min-width: 0; }
.session__who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session:not([hidden]) + .staging-flag { margin-left: 0; }
.staging-flag {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: var(--r-pill);
  font-size: 12px; color: var(--text-2);
  box-shadow: inset 0 0 0 0.5px var(--hairline-strong);
  white-space: nowrap;
}
.staging-flag strong { color: var(--text); font-weight: 600; }
.staging-flag__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--review);
  box-shadow: 0 0 0 3px var(--review-soft);
}

.mock-ribbon {
  max-width: 1280px; margin: 12px auto 0; padding: 8px 16px;
  border-radius: var(--r-m);
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 13px; font-weight: 500; text-align: center;
  width: calc(100% - 48px);
}

.main {
  max-width: 1280px; margin: 0 auto;
  padding: var(--s-7) 24px var(--s-8);
  min-height: calc(100dvh - var(--bar-h));
}

.noscript { padding: 48px; text-align: center; color: var(--text-2); }

/* entry motion: short, heavy, transform + opacity only */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.enter { animation: rise 520ms var(--ease-out) both; }
.enter-2 { animation: rise 520ms var(--ease-out) 60ms both; }
.enter-3 { animation: rise 520ms var(--ease-out) 120ms both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  .staging-flag__rest {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }
  .topbar__inner { padding: 0 16px; gap: var(--s-3); }
  .brand__name { display: none; }
  .session__who { display: none; }
  .topnav a { padding: 6px 10px; }
  .main { padding: var(--s-5) 16px var(--s-7); }
  .mock-ribbon { width: calc(100% - 32px); }
}

/* main takes focus on navigation for screen readers; it is not a control */
.main:focus, .main:focus-visible { box-shadow: none; }
