@import './tokens.css';
@import './components.css';

/* Sealed Grid public site. Colors, type, spacing and radii come only from tokens.css (web-style-spec.md). */

/* Landing page (decision 0068): its own styles are in landing.css. This file holds the frame shared by every page. */
:root { --ease-soft: cubic-bezier(.22, .8, .24, 1); --header-space: 112px; }

*, *::before, *::after { box-sizing: border-box; }
/* overflow-x clip: the full-width section glows can never cause a sideways scroll (it does not create a scroll container,
   so the sticky header keeps working). scroll-padding keeps anchor targets and focused controls clear of the sticky header. */
html { overflow-x: clip; scroll-padding-top: var(--header-space); }
body { position: relative; margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 4px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { margin-bottom: var(--space-4); }
h1 { font-size: clamp(2.25rem, 1.2rem + 3.6vw, 3.5rem); line-height: 1.1; letter-spacing: -0.03em; max-width: 14ch; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.2; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; line-height: 1.3; }
p { margin: 0 0 var(--space-4); text-wrap: pretty; }
.eyebrow { margin-bottom: var(--space-2); }
main > section > h2 { margin-bottom: var(--space-6); }
.panel > * { margin: 0; }
.panel > * + * { margin-top: var(--space-3); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
section[tabindex="-1"]:focus { outline: none; }
select { font: inherit; color: var(--text); background: var(--surface); min-height: 44px; max-width: 100%; padding: var(--space-2); border: 1px solid var(--border-input); border-radius: var(--inner-radius); }

/* Page frame: one centered container, equal edges. */
.site-header, main, .site-footer { width: 100%; max-width: 1160px; margin: 0 auto; padding-left: var(--space-6); padding-right: var(--space-6); }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding-top: var(--space-4); padding-bottom: var(--space-4); }
.brand img { display: block; width: 168px; max-width: 100%; height: auto; }
.brand .brand-dark { display: none; }
html[data-theme=dark] .brand .brand-light { display: none; }
html[data-theme=dark] .brand .brand-dark { display: block; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.site-nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; font-weight: 550; }
.site-nav a:hover { text-decoration: underline; text-underline-offset: 6px; }
/* Current page or section: a short gold bar under the link (plus aria-current for screen readers). */
.site-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; border-radius: var(--radius-pill); background: var(--gold); transform: scaleX(0); transform-origin: left center; transition: transform var(--motion-panel) var(--ease); }
.site-nav a[aria-current]::after { transform: scaleX(1); }
.site-nav a[aria-current]:hover { text-decoration: none; }

/* Sticky header. Transparent over the hero; once the page scrolls (chrome.js sets data-scrolled) a soft page-colored veil
   with a light blur, a hairline and a faint shadow fade in. Only opacity animates. */
.header-bar { position: sticky; top: 0; z-index: 20; }
.header-bar::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); border-bottom: 1px solid var(--border); box-shadow: 0 10px 28px -22px var(--shadow); opacity: 0; transition: opacity var(--motion-panel) var(--ease); }
.header-bar[data-scrolled]::before { opacity: 1; }
.header-bar .site-header { position: relative; }
.top-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 8px; pointer-events: none; }

main { padding-top: var(--space-8); padding-bottom: var(--space-16); }
.page { max-width: 76ch; }
/* Reading pages (policies, support, credits): paragraphs about 70 to 75 characters wide (style spec: 60 to 75). */
.page p, .policy-draft p { max-width: 58ch; }
.page h1 { margin-bottom: var(--space-6); }
main > section { margin-bottom: var(--space-16); }
main > section + section { margin-top: var(--space-24); }
.site-footer { padding-bottom: var(--space-8); color: var(--text-secondary); }
.footer-top { border-top: 1px solid var(--border); padding-top: var(--space-6); }
.footer-top, .footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-8); }
.footer-brand { margin: 0; font-weight: 700; color: var(--text); }
.footer-bottom { margin-top: var(--space-4); }
.footer-bottom p { margin: 0; font-size: var(--small); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; }

/* Text helpers */
.eyebrow, .muted, small, figcaption { font-size: var(--small); color: var(--text-secondary); }
.lede { font-size: 1.125rem; line-height: 1.6; max-width: 42ch; color: var(--text-secondary); }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: var(--space-3) var(--space-6); border-radius: var(--radius-pill); border: 1px solid var(--border-input); text-decoration: none; font-weight: 650; }
.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

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

/* The same atmosphere further down (decision 0063), quieter than the hero: a faint grain tiled over the whole body (static),
   one soft band of glows per section that drifts slower than the page (sections.js), a gentle fade to the surface color
   behind the footer, and on the other pages a short version of the hero's top fade. Token colors mixed with transparency only. */
body::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: url(grain.svg) repeat; opacity: .035; }
html[data-theme=dark] body::before { opacity: .045; filter: invert(1); }
.end-backdrop { position: absolute; left: 0; right: 0; bottom: 0; height: 560px; z-index: -1; pointer-events: none; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface) 85%, transparent)); }
.page-backdrop { position: absolute; top: 0; left: 0; right: 0; height: 560px; z-index: -1; overflow: hidden; pointer-events: none; background: linear-gradient(180deg, var(--surface), var(--bg)); mask-image: linear-gradient(180deg, black 50%, transparent); }
.page-glow { position: absolute; width: 640px; height: 640px; top: -260px; right: calc(50% - 760px); border-radius: var(--radius-pill); background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 14%, transparent), transparent); }
html[data-theme=dark] .page-glow { background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 8%, transparent), transparent); }


/* Store buttons. Fixed height, width from the artwork's own proportions (official badges can replace the files). */
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }
.store-badge { display: inline-flex; padding: 0; border: 0; background: none; border-radius: var(--radius-input); font: inherit; color: inherit; outline-offset: 2px; }
.store-badge img { display: block; height: 48px; width: auto; max-width: 100%; transition: transform var(--motion-fast) var(--ease); }
a.store-badge:hover img { transform: translateY(-2px); }
.store-badge[aria-disabled=true] { cursor: default; }
.store-badge[aria-disabled=true] { outline: 1px dashed var(--border-input); }
.store-primary .store-badge, .store-badge.store-primary { outline: 2px solid var(--gold); }
.store-badge:focus-visible, .store-primary .store-badge:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.store-soon { position: relative; display: inline-flex; }
.store-tip { position: absolute; left: 50%; bottom: calc(100% + var(--space-2)); z-index: 3; padding: var(--space-1) var(--space-3); border-radius: var(--radius-input); background: var(--accent); color: var(--on-accent); font-size: var(--small); font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 4px); transition: opacity var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease); }
.store-tip::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--space-2); }
.store-soon:hover .store-tip, .store-badge:focus-visible + .store-tip, .store-soon[data-tip-open] .store-tip { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.store-soon[data-tip-hidden] .store-tip { opacity: 0; pointer-events: none; }
.store-note { margin: var(--space-3) 0 0; }

/* Support form */
.support-form { display: grid; gap: var(--space-2); max-width: 560px; margin-top: var(--space-4); }
.support-form label { font-weight: 600; margin-top: var(--space-3); }
.support-form input, .support-form textarea, .support-form select { font: inherit; color: var(--text); background: var(--surface); width: 100%; min-height: 44px; padding: var(--space-3); border: 1px solid var(--border-input); border-radius: var(--inner-radius); }
.support-form textarea { resize: vertical; }
.support-form .button { justify-self: start; margin-top: var(--space-4); cursor: pointer; }
.support-form .muted { margin: 0; font-weight: 400; }
.form-status { min-height: 1.6em; margin: var(--space-3) 0 0; font-weight: 600; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Skip link and preview banner */
.skip { position: absolute; top: -100px; left: var(--space-4); background: var(--surface); padding: var(--space-3); z-index: 30; }
.skip:focus { top: var(--space-2); }
.preview-banner { text-align: center; background: var(--surface); padding: var(--space-3); margin: 0; }


/* Floating pill navigation (every page): black-navy bar, same height as the old header so the hero does not move. */
.header-bar::before { display: none; }
.site-header { width: calc(100% - 2 * var(--space-6)); max-width: 1112px; margin: var(--space-4) auto; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-6); background: var(--lp-ink); border-radius: var(--radius-pill); box-shadow: 0 18px 40px -22px var(--shadow), 0 2px 6px var(--shadow); }
.brand img { width: auto; height: 43.6px; max-width: none; }
.brand .brand-light, html[data-theme=dark] .brand .brand-light { display: none; }
.brand .brand-dark, html[data-theme=dark] .brand .brand-dark { display: block; }
.site-header .site-nav { gap: var(--space-1) var(--space-6); }
.site-header .site-nav a { color: var(--lp-on-ink); }
.site-header .site-nav a::after { background: var(--lp-mint); }
.site-header .site-nav a.nav-cta { padding: 0 var(--space-6); border-radius: var(--radius-pill); background: var(--lp-on-ink); color: var(--lp-ink); }
.site-header .site-nav a.nav-cta::after { display: none; }
.site-header .site-nav a.nav-cta:hover { text-decoration: none; background: var(--lp-mint); }
.site-header :focus-visible { outline-color: var(--lp-mint); }


@media (max-width: 960px) { .store-badges { gap: var(--space-3); } }
@media (max-width: 640px) {
  :root { --header-space: var(--space-4); }
  .header-bar { position: relative; }
  .site-header, main, .site-footer { padding-left: var(--space-4); padding-right: var(--space-4); }
  .site-header { width: calc(100% - 2 * var(--space-4)); margin: var(--space-3) auto; padding: var(--space-2) var(--space-4); border-radius: 28px; justify-content: center; flex-wrap: wrap; }
  .site-header .site-nav { justify-content: center; gap: 0 var(--space-4); }
  main > section + section { margin-top: var(--space-16); }
  .page-glow { right: calc(50% - 480px); }
  body { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  .store-badge img, .store-tip, .site-nav a::after { transition: none; }
  a.store-badge:hover img { transform: none; }
}
