/* ==========================================================================
   Unbrek — reset, shell, and shared components
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--t-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* DM Sans is a variable font — let it optically size, and keep numerals
     aligned wherever they sit in a column. */
  font-optical-sizing: auto;
  font-variant-numeric: lining-nums;
}

/* A very fine grain over the flat ink. Large dark areas band on cheap panels
   and read as plasticky; a few percent of noise gives the surface depth
   without becoming a visible texture. Sits above the canvas, below all
   content, and is never in the way of a pointer. */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Scrollbar ----------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--ink-line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-line);
  border-radius: 99px;
  border: 3px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* Locked while the loader is up; released by js/loader.js */
html.is-loading, html.is-loading body { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--t-hi);
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

/* Inline links use the lighter accent so body-size link text clears AA
   (#D9693D on ink is 4.06:1). The underline is always present but starts
   transparent, so it grows in on hover without shifting the text. */
a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}
a:hover { color: var(--t-hi); text-decoration-color: var(--accent); }

/* Components manage their own affordances. */
.nav__link, .btn, .footer-list a, .legal-links a, .site-footer__base a,
.arrow-link, .socials a, .site-header__logo, .skip {
  text-decoration: none;
}

img, svg { display: block; max-width: 100%; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--accent); color: var(--ink); }

/* Focus ring: the accent alone can get lost against a warm card, so it carries
   a dark halo and always reads on any surface on the page. */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 5px rgba(10, 26, 24, .85);
}

/* --- Skip link ---------------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: var(--ink);
  padding: 12px 20px; border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 500;
}
.skip:focus { left: 0; color: var(--ink); }

/* --- Layout primitives -------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.wrap-narrow { width: 100%; max-width: var(--wrap-narrow); margin-inline: auto; padding-inline: var(--gut); }

.eyebrow {
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--t-low);
  margin: 0 0 22px;
  font-weight: 500;
}
.eyebrow--accent { color: var(--accent-text); }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-body);
  color: var(--t-body);
  text-shadow: var(--shadow-text-sm);
}

.shadowed { text-shadow: var(--shadow-text); }

/* --- Loader ------------------------------------------------------------- */
.loader {
  position: fixed; inset: 0;
  z-index: var(--z-loader);
  background: var(--ink);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 30px;
  opacity: 1;
  transition: opacity .8s var(--ease), visibility .8s;
}
.loader.is-out { opacity: 0; visibility: hidden; pointer-events: none; }
.loader[hidden] { display: none; }
.loader__ring { width: 96px; height: 96px; overflow: visible; }
.loader__glow { filter: blur(9px); }
.loader__label {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--t-low);   /* --t-faint measured 3.53:1 here — under AA at 11px */
  animation: loader-label 1s var(--ease) .5s both;
}
@keyframes loader-label { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .loader__label { animation: none; }
}

/* --- Background canvas (the thread) ------------------------------------- */
#thread-canvas-layer {
  position: fixed; inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
}
#thread-canvas { display: block; width: 100%; height: 100%; }

/* The thread is held back on inner pages inside the canvas (see thread.js), not
   with opacity here — dimming the whole layer would fade the drifting dots too
   and the background would read differently from page to page. */

/* --- Scroll progress bar ------------------------------------------------ */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: var(--z-progress);
  background: var(--line-soft);
}
.progress__bar {
  height: 100%; width: 0%;
  background: var(--accent);
  transform-origin: left center;
}

/* --- Phase label (vertical, right edge) --------------------------------- */
.phase {
  position: fixed; right: 26px; top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-nav);
  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--t-low);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
@media (max-width: 1100px) { .phase { display: none; } }

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 20px var(--gut);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), padding var(--dur) var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-stuck {
  background: rgba(10, 26, 24, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line-soft);
  padding-block: 14px;
}
.site-header__logo img { height: 26px; }

.nav { display: flex; align-items: center; gap: 32px; }
.nav__link {
  font-size: 15px;
  color: var(--t-mid);
  letter-spacing: 0.01em;
  position: relative;
  padding-block: 4px;
}
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--t-hi); }

/* The rule under a nav link wipes in from the left on hover and sits fixed
   for the current page. */
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform var(--dur) var(--ease-out);
}
.nav__link:hover::after { transform: scaleX(1); }
.nav__link[aria-current="page"]::after { transform: scaleX(1); }

/* --- Touch targets ------------------------------------------------------
   Several links are visually small by design (13px nav, 14px footer). Rather
   than inflate the type, each gets an invisible hit area padded out to 44px.
   Layout is untouched; only the tappable region grows. */
.nav__link, .footer-list a, .arrow-link, .legal-links a, .site-header__logo,
.site-footer__base a, .quote__back { position: relative; }

.nav__link::before, .footer-list a::before, .arrow-link::before,
.legal-links a::before, .site-header__logo::before, .site-footer__base a::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  height: var(--tap);
  min-height: 100%;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: var(--ink);
  font-weight: 500;
  /* A one-pixel warm highlight along the top edge — the thing that separates
     a printed-looking button from a flat rectangle of colour. */
  box-shadow: inset 0 1px 0 rgba(255, 240, 232, .35),
              0 1px 2px rgba(10, 26, 24, .4);
}
.btn--primary:hover {
  background: var(--accent-bright);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 240, 232, .45),
              0 8px 22px -10px rgba(217, 105, 61, .7);
}

.btn--ghost { color: var(--t-hi); border-color: var(--line-strong); }
.btn--ghost:hover { color: var(--t-hi); border-color: var(--accent); background: var(--accent-ghost); }

.btn--nav { padding: 10px 20px; border-color: var(--accent-dim); color: var(--t-hi); font-size: 14.5px; }
.btn--nav:hover { color: var(--ink); background: var(--accent); border-color: var(--accent); }

.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* --- Link with arrow ---------------------------------------------------- */
.arrow-link {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--t-hi);
}
.arrow-link svg { transition: transform var(--dur-fast) var(--ease); }
.arrow-link:hover { color: var(--accent); }
.arrow-link:hover svg { transform: translateX(4px); }

/* --- Cards -------------------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  background: rgba(20, 48, 44, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.card:hover { border-color: var(--accent-dim); transform: translateY(-4px); }
.card__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 20px; letter-spacing: -0.01em; color: var(--t-hi);
  margin: 0 0 14px;
}
.card__body { font-size: var(--fs-sm); line-height: 1.7; color: var(--t-mid); margin: 0; }

/* --- Pills -------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center;
  font-size: var(--fs-xs); color: var(--t-body);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 8px 16px;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.pill:hover { border-color: var(--accent-dim); color: var(--t-hi); }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --- Scroll reveal ------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  position: relative; z-index: var(--z-content);
  border-top: 1px solid var(--line-soft);
  background: rgba(10, 26, 24, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 64px 0 34px;
  margin-top: 0;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
}
.site-footer__brand img { height: 26px; margin-bottom: 18px; }
.site-footer__blurb { font-size: var(--fs-sm); color: var(--t-mid); max-width: 34ch; }
.footer-head {
  font-size: var(--fs-eyebrow); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--t-low); margin: 0 0 16px; font-weight: 500;
}
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.footer-list a { font-size: var(--fs-sm); color: var(--t-mid); }
.footer-list a:hover { color: var(--t-hi); }

.socials { display: flex; gap: 12px; }
.socials a {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--t-mid);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.socials a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-ghost); }
.socials a[aria-disabled="true"] { opacity: .38; pointer-events: none; }
.socials svg { width: 16px; height: 16px; }

.site-footer__base {
  display: flex; flex-wrap: wrap; gap: 16px 28px;
  justify-content: space-between; align-items: center;
  margin-top: 52px; padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-xs); color: var(--t-low);
}
.site-footer__base a { color: var(--t-low); }
.site-footer__base a:hover { color: var(--t-hi); }
.legal-links { display: flex; gap: 22px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 36px 24px; }
  .site-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* --- Mobile nav --------------------------------------------------------- */
.nav-toggle {
  display: none;
  width: var(--tap); height: var(--tap);
  border: 1px solid var(--line); border-radius: 50%;
  place-items: center;
}
.nav-toggle span {
  display: block; width: 16px; height: 1.5px; background: var(--t-hi);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle span + span { margin-top: 4px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed; inset: 0 0 auto;
    top: 0; padding: 96px var(--gut) 40px;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: rgba(10, 26, 24, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateY(-102%);
    transition: transform var(--dur-slow) var(--ease-out);
    height: 100dvh;
    justify-content: center;
  }
  .nav.is-open { transform: none; }
  .nav__link { font-size: 26px; font-family: var(--font-display); font-weight: 500; padding-block: 14px; border-bottom: 1px solid var(--line-soft); }
  .nav__link[aria-current="page"]::after { display: none; }
  .btn--nav { margin-top: 26px; align-self: flex-start; padding: 14px 26px; font-size: 15px; }
}

/* --- Sticky mobile CTA (wireframe 1m) ----------------------------------- */
.mobile-cta {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 55;
  display: none;
  align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px var(--gut);
  background: rgba(10, 26, 24, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  transform: translateY(110%);
  transition: transform var(--dur-slow) var(--ease-out);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.mobile-cta.is-in { transform: none; }
.mobile-cta__label { font-size: var(--fs-sm); color: var(--t-mid); }

@media (max-width: 880px) {
  .mobile-cta { display: flex; }
  /* The bar is fixed over the page, so the footer needs to end above it —
     otherwise it sits on top of the Privacy and Terms links. */
  .site-footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
