/* Shared public-site chrome. Generated HTML: scripts/sync-site-chrome.mjs.
   Deliberately isolated from legacy .hdr / .ed-header / .home-* components. */
@font-face {
  font-family: 'Geist Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/media/fonts/geist-sans-variable.woff2') format('woff2');
  /* P_cjk-punctuation-full-width — Geist carries narrow, Latin-proportioned
     glyphs for the CJK punctuation blocks (U+3000-303F and U+FF00-FFEF).
     A face without a unicode-range may be used for every code point, so the
     browser hands ，。！？；：（） to Geist — the first family in the stack —
     and a Chinese sentence renders them at half width: the text is full
     width in the DOM but reads as English punctuation on screen. Excluding
     the two blocks lets those code points fall through to Noto Sans SC,
     which carries the full-width metrics. Everything Geist does cover
     (Latin, digits, arrows, quotes, dashes) keeps its own glyphs, so the
     Latin face is unchanged. Same contract as frontend/src/styles/
     foundations/fonts.css — keep the two in sync. */
  unicode-range: U+0000-2E7F, U+3040-FEFF, U+FFF0-FFFF;
}
/* The "中文" language label needs a Chinese face that does not depend on
   fonts.css: ten English pages link that sheet only for Geist Mono, the rest
   not at all, and the label used to fall back to whatever the platform offers
   (two empty boxes where none is installed). This face points at a two-glyph
   subset and claims only 中 (U+4E2D) and 文 (U+6587), so a browser downloads
   it only when that label is on the page — 1.2 KB, not the 356 KB ideograph
   subset in fonts.css. */
@font-face {
  font-family: 'Socrates Locale';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/media/fonts/noto-sans-sc-locale-var.woff2') format('woff2');
  unicode-range: U+4E2D, U+6587;
}

/* OpenAI-style chrome: a plain white top bar the width of the content
   container (wordmark, compact 14px links, a gray "Log in" pill and a black
   "Try" pill), and a white footer of small grouped links. Every control is a
   full pill; hit areas reach 44px through transparent padding, so the
   visible controls stay small (36px). */
.site-header,
.site-footer {
  --site-chrome-font: var(--site-font);
  box-sizing: border-box;
  color: var(--site-color-ink);
  font: var(--type-body-6);
  font-family: var(--site-chrome-font);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
.site-header *,
.site-footer * { box-sizing: border-box; }
.site-header a,
.site-footer a { color: inherit; text-decoration: none; }
.site-header :focus-visible,
.site-footer :focus-visible { outline: 2px solid var(--site-color-ink); outline-offset: 2px; border-radius: var(--radius-full); }
.site-chrome-shell { width: 100%; max-width: var(--site-width); margin-inline: auto; padding-inline: var(--site-gutter); }
.site-locale { font-family: 'Geist Sans', 'Socrates Locale', 'Noto Sans SC', sans-serif; }

.site-header { position: sticky; top: 0; z-index: 100; }
/* The bar's layer is a pseudo-element, so nothing on the header itself can
   become the containing block of the fixed mobile menu.
   At the top of the page the bar is clear and borderless; once the page
   moves under it, the layer fades in as a frosted sheet with a hairline
   below. Only the layer's opacity animates. */
.site-header::before { content: ''; position: absolute; z-index: 0; inset: 0; background: var(--site-color-paper); box-shadow: 0 1px 0 var(--site-color-line); pointer-events: none; transition: opacity 300ms var(--site-ease); }
.site-header[data-scroll-aware]:not(.is-scrolled)::before { opacity: 0; }
html.site-menu-open .site-header[data-scroll-aware]::before { opacity: 1; }
.site-header-inner { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-400); height: var(--site-header-height); }
.site-header .site-brand,
.site-footer .site-brand { display: inline-flex; align-items: center; flex-shrink: 0; gap: var(--space-75); min-height: 44px; }
.site-brand img { width: 22px; height: 22px; display: block; object-fit: contain; }
.site-header .site-brand img { display: none; }
.site-brand-label { font: 600 var(--fs-18)/1.5rem var(--site-chrome-font); letter-spacing: -.03em; }

/* Text links and pills share one recipe: the element is the 44px hit area,
   ::before paints the 36px pill behind the label. */
.site-nav { display: flex; align-items: center; gap: var(--space-50); }
.site-nav a,
.site-header .site-locale,
.site-search,
.site-menu-toggle { position: relative; isolation: isolate; }
.site-nav a::before,
.site-header .site-locale::before,
.site-search::before,
.site-menu-toggle::before { content: ''; position: absolute; z-index: -1; inset: 4px 0; border-radius: var(--radius-full); background: transparent; transition: background-color var(--site-motion-color), transform var(--site-motion-move); }
.site-nav a { display: flex; align-items: center; min-height: 44px; padding-inline: var(--space-100); color: var(--site-color-ink); font: var(--type-caption-4); white-space: nowrap; }
.site-nav a:hover::before,
.site-header .site-locale:hover::before,
.site-search:hover::before,
.site-menu-toggle:hover::before { background: var(--site-color-fill); }
.site-nav a:active::before,
.site-header .site-locale:active::before,
.site-search:active::before,
.site-menu-toggle:active::before { transform: scale(.96); }
/* Current page: the pill stays filled, the label turns medium. */
.site-nav a[aria-current="page"] { font-weight: 500; }
.site-nav a[aria-current="page"]::before { background: var(--site-color-fill); }

.site-header-actions { display: flex; align-items: center; gap: var(--space-75); margin-left: auto; }
.site-header-actions > * { flex-shrink: 0; }
.site-header .site-locale { display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--space-100); color: var(--site-color-muted); font: var(--type-caption-4); font-family: 'Geist Sans', 'Socrates Locale', 'Noto Sans SC', sans-serif; white-space: nowrap; transition: color var(--site-motion-color); }
.site-header .site-locale:hover { color: var(--site-color-ink); }
.site-header .site-login,
.site-header .site-try { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-50); height: 36px; padding-inline: var(--space-200); border-radius: var(--radius-full); font: var(--type-button-lg); font-family: var(--site-chrome-font); white-space: nowrap; transition: background-color var(--site-motion-color), color var(--site-motion-color), transform var(--site-motion-move); }
.site-header :is(.site-login, .site-try)::after { content: ''; position: absolute; inset: -4px -2px; }
.site-header .site-login { background: var(--site-color-fill); color: var(--site-color-ink); }
.site-header .site-login:hover { background: var(--site-color-fill-hover); }
.site-header .site-try { background: var(--site-color-button-primary, #ececec); color: var(--site-color-button-primary-ink, #000000); }
.site-header .site-try:hover { background: var(--site-color-button-primary-hover, #ffffff); color: #000000; }
.site-header :is(.site-login, .site-try):active { transform: scale(.98); }
.site-try svg { flex: none; width: 14px; height: 14px; transition: transform var(--site-motion-move); }
.site-try:hover svg { transform: translate(1px, -1px); }
.site-search { display: none; flex: none; width: 44px; height: 44px; place-items: center; color: var(--site-color-ink); }
.site-search::before { inset: 4px; }
.site-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* Menu toggle: two strokes that rotate into a cross. */
.site-menu-toggle { display: none; flex: none; width: 44px; height: 44px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: var(--radius-full); cursor: pointer; }
.site-menu-toggle::before { inset: 4px; }
.site-menu-toggle span { position: absolute; top: 50%; left: 50%; width: 16px; height: 1.5px; margin: -.75px 0 0 -8px; border-radius: var(--radius-full); background: currentColor; transition: transform var(--site-motion-move); }
.site-menu-toggle span:first-child { transform: translateY(-3px); }
.site-menu-toggle span:last-child { transform: translateY(3px); }
.site-menu-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.site-menu-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
.site-header [hidden] { display: none; }

/* Mobile menu: a white sheet that drops from the bar with rounded lower
   corners and a soft shadow; the dimmed page below stays tappable to close. */
.site-mobile-menu {
  position: fixed;
  z-index: 0;
  top: var(--site-header-height);
  left: 0;
  right: 0;
  max-height: calc(100dvh - var(--site-header-height) - var(--space-600));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-75) var(--site-gutter) var(--space-300);
  border-radius: 0 0 var(--radius-3xl) var(--radius-3xl);
  background: #141414;
  border-bottom: 1px solid var(--site-color-line);
  box-shadow: 0 24px 48px -16px rgb(0 0 0 / .6);
}
.site-mobile-menu nav { display: grid; }
.site-mobile-menu nav a { display: flex; align-items: center; min-height: 48px; font: 500 var(--fs-18)/1.5rem var(--site-chrome-font); letter-spacing: -.01em; transition: color var(--site-motion-color); }
.site-mobile-menu nav a:hover { color: var(--site-color-muted); }
.site-mobile-menu nav a[aria-current="page"] { color: var(--site-color-muted); }
.site-mobile-utilities { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-75); margin-top: var(--space-300); padding-top: var(--space-300); border-top: 1px solid var(--site-color-line); }
.site-mobile-utilities a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--space-200); border-radius: var(--radius-full); background: var(--site-color-fill); color: var(--site-color-ink); font: var(--type-button-lg); font-family: var(--site-chrome-font); }
.site-mobile-utilities a:first-child { background: var(--site-color-button-primary, #ececec); color: var(--site-color-button-primary-ink, #000000); }
.site-mobile-utilities .site-locale { font-family: 'Geist Sans', 'Socrates Locale', 'Noto Sans SC', sans-serif; }
.site-menu-scrim { position: fixed; z-index: 90; inset: 0; background: rgb(0 0 0 / .6); }
html.site-menu-open { overflow: hidden; }

/* Footer: white, five columns of small links under muted group labels, then
   one row with social icons, copyright and legal links, and a gray
   language pill. */
.site-footer { padding-block: var(--space-900) var(--space-400); background: var(--site-color-paper); color: var(--site-color-ink); border-top: 1px solid var(--site-color-line); }
.site-footer-inner { display: grid; gap: var(--space-700); }
.site-footer-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-400) var(--space-300); }
.site-footer-col { min-width: 0; }
.site-footer-summary { display: none; }
.site-footer-group + .site-footer-group { margin-top: var(--space-500); }
.site-footer .site-footer-group h2 { margin: 0 0 var(--space-100); color: var(--site-color-quiet); font: var(--type-caption-4); font-family: var(--site-chrome-font); }
.site-footer-group a { display: block; width: fit-content; max-width: 100%; padding-block: 7px; color: var(--site-color-ink); font: var(--type-caption-1); overflow-wrap: anywhere; transition: color var(--site-motion-color); }
/* The underline is drawn from the left on hover and erased the same way. */
.site-footer-group a { background: linear-gradient(currentColor, currentColor) 0 calc(50% + .75em) / 0 1px no-repeat; transition: color var(--site-motion-color), background-size 400ms cubic-bezier(.22,1,.36,1); }
.site-footer-group a:hover, .site-footer-group a:focus-visible { color: var(--site-color-muted); background-size: 100% 1px; }
.site-footer-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-100) var(--space-300); }
.site-footer-social { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin-left: calc(var(--space-100) * -1); }
.site-footer-social a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-full); color: var(--site-color-ink); transition: background-color var(--site-motion-color), transform var(--site-motion-move); }
.site-footer-social a:hover { background: var(--site-color-fill); }
.site-footer-social a:active { transform: scale(.96); }
.site-footer-social a svg { display: block; width: 15px; height: 15px; }
.site-footer .site-footer-legal { margin: 0 0 0 auto; color: var(--site-color-ink); font: var(--type-caption-5); font-family: var(--site-chrome-font); }
.site-footer-policies { display: flex; flex-wrap: wrap; gap: 0 var(--space-200); margin-right: auto; }
.site-footer-policies a { display: inline-flex; align-items: center; min-height: 40px; color: var(--site-color-ink); font: var(--type-caption-5); font-family: var(--site-chrome-font); text-decoration: underline; text-decoration-color: var(--site-color-line-strong); text-underline-offset: 3px; transition: text-decoration-color var(--site-motion-color); }
.site-footer-policies a:hover { text-decoration-color: currentColor; }
.site-footer-bottom > .site-locale { display: inline-flex; align-items: center; gap: var(--space-75); height: 36px; padding-inline: var(--space-200) var(--space-200); border-radius: var(--radius-full); background: var(--site-color-fill); color: var(--site-color-ink); font: var(--type-caption-4); font-family: 'Geist Sans', 'Socrates Locale', 'Noto Sans SC', sans-serif; transition: background-color var(--site-motion-color), transform var(--site-motion-move); }
.site-footer-bottom > .site-locale:hover { background: var(--site-color-fill-hover); }
.site-footer-bottom > .site-locale:active { transform: scale(.98); }
.site-footer-locale svg { flex: none; width: 14px; height: 14px; }

@media (max-width: 1280px) {
  .site-header-inner { gap: var(--space-200); }
  .site-nav { gap: 0; }
  .site-nav a { padding-inline: 10px; }
}
@media (max-width: 1180px) {
  .site-header-actions > .site-locale { display: none; }
}
@media (max-width: 1080px) {
  .site-nav,
  .site-header-actions > .site-login { display: none; }
  .site-menu-toggle { display: block; }
}
/* Links stay in the header when scripts are off. locale.js marks the root
   in <head>, so with scripts the header is collapsed from the first paint and
   chrome.js arriving at the end of the body no longer shrinks it and shifts
   the page (was CLS 0.13 at 390). Every link also stays in the footer. */
@media (max-width: 1080px) {
  :root:not([data-site-js]) .site-header:not([data-chrome-ready]) .site-header-inner { flex-wrap: wrap; height: auto; min-height: var(--site-header-height); padding-block: var(--space-75); }
  :root:not([data-site-js]) .site-header:not([data-chrome-ready]) .site-nav { display: flex; flex-wrap: wrap; order: 3; width: 100%; gap: 0 var(--space-50); }
  :root:not([data-site-js]) .site-header:not([data-chrome-ready]) .site-menu-toggle { display: none; }
}
@media (max-width: 760px) {
  .site-header-inner { gap: var(--space-50); }
  .site-header .site-try { display: none; }
  .site-search { display: grid; margin-left: auto; }
  .site-header .site-brand { min-height: 44px; }
  .site-search + .site-header-actions { margin-left: 0; }
  .site-header-actions { margin-right: calc(var(--space-100) * -1); }
  .site-footer { padding-block: var(--space-700) var(--space-300); }
  .site-footer-inner { gap: var(--space-300); }
  .site-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-400) var(--space-300); }
  .site-footer-col { border: 0; }
  .site-footer-group a { display: flex; align-items: center; min-height: 44px; padding-block: var(--space-75); }
  .site-footer-group + .site-footer-group { margin-top: var(--space-300); }
  .site-footer[data-chrome-ready] .site-footer-grid { display: block; border-top: 1px solid var(--site-color-line); }
  .site-footer[data-chrome-ready] .site-footer-col { border-bottom: 1px solid var(--site-color-line); }
  .site-footer[data-chrome-ready] .site-footer-summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding-block: var(--space-100); cursor: pointer; list-style: none; font: var(--type-title-4); font-family: var(--site-chrome-font); }
  .site-footer-summary::-webkit-details-marker { display: none; }
  .site-footer-summary::after { content: ''; width: 8px; height: 8px; margin-right: var(--space-50); border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform var(--site-motion-move); }
  .site-footer-col[open] > .site-footer-summary::after { transform: translateY(2px) rotate(-135deg); }
  .site-footer[data-chrome-ready] .site-footer-group { padding-left: var(--space-100); }
  .site-footer[data-chrome-ready] .site-footer-group:last-child { padding-bottom: var(--space-200); }
  .site-footer-bottom { gap: var(--space-75) var(--space-200); }
  .site-footer .site-footer-legal { order: 4; width: 100%; margin: 0; color: var(--site-color-muted); }
  .site-footer-policies { order: 3; width: 100%; margin-right: 0; }
  .site-footer-social { margin-right: auto; }
}

/* The mobile home header gets out of the reading path on a downward scroll,
   then returns on an upward scroll. Only the bar layers move: transforming
   .site-header itself would make its fixed mobile menu use the wrong origin. */
@media (max-width: 760px) {
  .home-refresh .site-header-inner,
  .home-refresh .site-header::before {
    transition: transform 180ms var(--site-ease), opacity 300ms var(--site-ease);
  }
  .home-refresh .site-header.is-hidden-on-scroll { pointer-events: none; }
  .home-refresh .site-header.is-hidden-on-scroll .site-header-inner,
  .home-refresh .site-header.is-hidden-on-scroll::before { transform: translateY(-100%); }
  .home-refresh .site-header.is-hidden-on-scroll::before { opacity: 0; }
  html.site-menu-open .home-refresh .site-header.is-hidden-on-scroll { pointer-events: auto; }
  html.site-menu-open .home-refresh .site-header.is-hidden-on-scroll .site-header-inner,
  html.site-menu-open .home-refresh .site-header.is-hidden-on-scroll::before { transform: translateY(0); }
}

/* Reading progress line retired to keep the header minimal and non-distracting. */
.site-header[data-reading-progress]::after { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .site-header, .site-header::before, .home-refresh .site-header-inner, .home-refresh .site-header::before, .site-nav a::before, .site-try svg, .site-menu-toggle span, .site-header :is(.site-login, .site-try, .site-search), .site-footer-group a, .site-footer-summary::after { transition: none; }
  .site-try:hover svg { transform: none; }
}

/* Round 7 · E. A full-width, very light "Socrates" wordmark closes every
   page (decorative, aria-hidden; outlines of Geist at weight 500, so it never
   reflows when fonts load). Round 10: its full stop answers the hero's
   question mark in the same language: Geist's square period drawn as a 3 x 3
   block of halftone dots (each .36 of its cell, like the hero's), not a solid
   disc. With motion the block waits a little loose and as light as the
   letters; when the end of the page is reached it gathers to its cells and
   turns ink (motion.js). Without scripts or with reduced motion it is
   simply there, in ink. */
.site-wordmark { position: relative; margin-top: var(--space-500); user-select: none; pointer-events: none; }
.site-wordmark img { display: block; width: 100%; height: auto; aspect-ratio: 4168 / 738; }
.site-wordmark-dot, .site-wordmark-dot::after { --wm-dot: var(--site-color-ink); background: radial-gradient(circle closest-side, var(--wm-dot) 72%, transparent 78%) 0 0 / 33.3333% 33.3333%; }
.site-wordmark-dot { position: absolute; left: 95.441%; top: 72.629%; width: 4.559%; aspect-ratio: 1; transform: none; }
.site-wordmark-dot::after { content: ''; position: absolute; inset: 0; }
@media (prefers-reduced-motion: no-preference) {
  [data-site-js] .site-wordmark-dot { --wm-dot: #e3e3e3; transition: transform 900ms cubic-bezier(.22,1,.36,1); }
  [data-site-js] .site-wordmark-dot::after { opacity: 0; transition: opacity 500ms cubic-bezier(.22,1,.36,1) 350ms; }
  [data-site-js] .site-wordmark:not(.is-lit) .site-wordmark-dot { transform: scale(1.18); }
  [data-site-js] .site-wordmark.is-lit .site-wordmark-dot::after { opacity: 1; }
}
@media (max-width: 760px) {
  .site-wordmark { margin-top: var(--space-200); }
}

/* Round 9: one continuous thought across pages. Same-origin navigations
   cross-fade the page while the header, which every page shares, stays
   exactly where it is (it is named, so it is matched, not faded). Browsers
   without cross-document view transitions ignore all of this; reduced
   motion switches it off. Only opacity moves, so nothing shifts layout. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-group(site-header) { animation-duration: 0s; }
  ::view-transition-old(root) { animation: 140ms cubic-bezier(.22,1,.36,1) both site-vt-out; }
  ::view-transition-new(root) { animation: 220ms cubic-bezier(.22,1,.36,1) 40ms both site-vt-in; }
}
@keyframes site-vt-out { to { opacity: 0; } }
@keyframes site-vt-in { from { opacity: 0; } }
