/* aswell.app — one stylesheet for every page.
   Colours, fonts and motion copy the app (src/shared/lib/theme.ts), so the
   site and the app feel like one thing. Change a token here and the whole
   site follows. */

@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  /* Colours (same as the app) */
  --bg: #141613;
  --bg-deep: #0f110e;
  --surface: #1e231d;
  --raised: #252b24;
  --text: #ede8dc;
  --muted: #8f978a;
  --border: #2a2f29;
  --border-strong: #3a4138;
  --accent: #c7603a;
  --accent-ink: #20100a;
  --accent-soft: #2a1e18;
  --olive: #a9af97;
  --sage: #7fa98f;
  --amber: #c9a26a;
  --rose: #c98bae;
  --teal: #1f2a21;

  /* Type */
  --heading: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Shape */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --page: 1180px;
  --gutter: clamp(16px, 4vw, 40px);

  /* Motion (the app's "Juicy" tokens) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-draw: cubic-bezier(0.5, 0, 0.2, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --quick: 180ms;
  --base: 320ms;
  --slow: 560ms;
  --stagger: 140ms;
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Film grain over everything: keeps the big dark areas from looking flat. */
body::after {
  content: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

@media (min-width: 861px) and (hover: hover) { body::after { content: ""; } }

/* ── Small shared pieces ─────────────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 12px/1 var(--body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--olive);
}
.eyebrow.ember { color: var(--accent); }

.h-xl, .h-lg, .h-md { font-family: var(--heading); font-weight: 700; margin: 0; letter-spacing: -0.03em; }
.h-lg { font-size: clamp(36px, 5.4vw, 64px); line-height: 1.02; }
.h-md { font-size: clamp(26px, 3vw, 34px); line-height: 1.12; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; margin: 0; max-width: 34em; }
.muted { color: var(--muted); }

.btn {
  --press: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 16px/1 var(--heading);
  text-decoration: none;
  cursor: pointer;
  transform: scale(var(--press));
  transition: transform var(--quick) var(--ease-out), background var(--base) var(--ease-out), box-shadow var(--base) var(--ease-out);
  box-shadow: 0 0 0 0 rgba(199, 96, 58, 0);
  white-space: nowrap;
}
.btn:hover { background: #d36b44; box-shadow: 0 10px 40px -10px rgba(199, 96, 58, 0.6); }
.btn:active { --press: 0.96; }
.btn.small { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--olive); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font: 600 12px/1 var(--body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--olive);
  background: rgba(20, 22, 19, 0.6);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.dot.live { box-shadow: 0 0 0 0 rgba(199, 96, 58, 0.7); animation: live 1.8s var(--ease-out) infinite; }
@keyframes live { to { box-shadow: 0 0 0 10px rgba(199, 96, 58, 0); } }

/* ── The logo ─────────────────────────────────────────────────────────── */

.mark path { fill: var(--accent); stroke: var(--accent); }
.mark .check { fill: none; }
/* The check in the "A" draws itself, like a habit being ticked in the app. */
.mark.draw .check { stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 0.9s var(--ease-draw) 0.35s forwards; }
.mark.draw .leg { opacity: 0; transform: translateY(40px); animation: rise 0.6s var(--ease-out) forwards; }
.mark.draw .leg + .leg { animation-delay: 0.12s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* On the home page the header logo draws itself once, as the page opens. */
.home .nav .mark .check { stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 0.9s var(--ease-draw) 0.5s forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── Header ───────────────────────────────────────────────────────────── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: background var(--base) var(--ease-out), border-color var(--base) var(--ease-out), transform var(--base) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(20, 22, 19, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  backdrop-filter: saturate(140%) blur(18px);
  border-bottom-color: var(--border);
}
.nav-in { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 22px/1 var(--heading); letter-spacing: -0.02em; }
.brand .mark { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  position: relative;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font: 500 15px/1 var(--body);
  transition: color var(--quick) var(--ease-out), background var(--quick) var(--ease-out);
}
.nav-links a:hover { color: var(--text); background: rgba(237, 232, 220, 0.05); }
.nav-links a[aria-current="page"] { color: var(--text); }
.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}
.menu-btn { display: none; }

/* The reading bar along the header's bottom edge (legal pages). */
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

@media (max-width: 860px) {
  .nav.scrolled { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav-links, .nav .btn { display: none; }
  .menu-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }
  .menu-btn span, .menu-btn span::before, .menu-btn span::after {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--base) var(--ease-out), opacity var(--quick);
    content: "";
  }
  .menu-btn span { position: relative; }
  .menu-btn span::before { position: absolute; top: -5px; }
  .menu-btn span::after { position: absolute; top: 5px; }
  .menu-open .menu-btn span { background: transparent; }
  .menu-open .menu-btn span::before { transform: translateY(5px) rotate(45deg); }
  .menu-open .menu-btn span::after { transform: translateY(-5px) rotate(-45deg); }
}

/* The full-screen phone menu. Items come in one after another. */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 96px var(--gutter) max(32px, env(safe-area-inset-bottom));
  background: #0f110e;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--base) var(--ease-out), visibility 0s linear var(--base);
}
.menu-open .sheet { opacity: 1; visibility: visible; transition: opacity var(--base) var(--ease-out); }
.sheet a:not(.btn) {
  font: 600 24px/1.3 var(--heading);
  letter-spacing: -0.02em;
  text-decoration: none;
  padding: 6px 0;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--base) var(--ease-out), transform var(--slow) var(--ease-pop);
}
.sheet a.small { font: 500 16px/1.3 var(--body); color: var(--muted); }
.sheet .btn { opacity: 0; transform: translateY(18px); transition: opacity var(--base) var(--ease-out), transform var(--slow) var(--ease-pop); width: 100%; }
.sheet hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.menu-open .sheet a, .menu-open .sheet .btn { opacity: 1; transform: none; transition-delay: calc(var(--i) * 50ms + 60ms); }
.sheet .btn { margin-top: auto; }
.menu-open { overflow: hidden; }

/* ── Scroll reveals ──────────────────────────────────────────────────────
   Anything with data-reveal starts a little low and faded, then eases in
   when it scrolls into view. --d staggers siblings. */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--slow) var(--ease-out), transform 900ms var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.js [data-reveal="pop"] { transform: scale(0.86); transition-timing-function: var(--ease-out), var(--ease-pop); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ── Footer ───────────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--border); margin-top: 40px; padding: 56px 0 40px; color: var(--muted); font-size: 15px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.foot h4 { margin: 0 0 14px; font: 600 12px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--olive); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.foot a { text-decoration: none; transition: color var(--quick); }
.foot a:hover { color: var(--text); }
.foot .brand { color: var(--text); margin-bottom: 14px; }
.foot-note { margin: 0; max-width: 22em; }
.foot-base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; }
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid > :first-child { grid-column: 1 / -1; }
}

/* ── Legal + support pages ────────────────────────────────────────────── */

.doc-head { padding-top: 136px; padding-bottom: 32px; }
.doc-head .h-lg { margin: 16px 0 12px; }
.seg {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.seg a {
  position: relative;
  z-index: 1;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font: 600 14px/1 var(--heading);
  color: var(--muted);
  transition: color var(--base) var(--ease-out);
}
.seg a[aria-current="page"] { color: var(--accent-ink); }
.seg-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 999px;
  background: var(--accent);
  transition: left var(--slow) var(--ease-pop), width var(--slow) var(--ease-pop);
}

/* Legal + support pages: a centred column with room at the sides. */
.doc-page main .wrap { max-width: 1080px; padding-left: max(24px, 6vw); padding-right: max(24px, 6vw); }
.doc-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding-bottom: 40px; }
.toc { position: sticky; top: 104px; align-self: start; max-height: calc(100vh - 128px); overflow: auto; font-size: 14px; }
.toc p { margin: 0 0 12px; font: 600 12px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--olive); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  transition: color var(--quick), border-color var(--base) var(--ease-out);
}
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); border-left-color: var(--accent); }
@media (max-width: 900px) {
  .doc-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
}

.legal { min-width: 0; overflow-wrap: break-word; max-width: 740px; font-size: 16.5px; line-height: 1.7; }
.legal > h1:first-child { display: none; }
.legal h2 { font: 700 26px/1.2 var(--heading); letter-spacing: -0.02em; margin: 56px 0 14px; }
.legal h3 { font: 600 19px/1.3 var(--heading); margin: 32px 0 8px; }
.legal a { color: var(--accent); }
.legal strong { color: var(--text); font-weight: 600; }
.legal p, .legal li { color: #cfcabf; }
.legal hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.legal blockquote { margin: 20px 0; padding: 16px 20px; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--border); }
.legal blockquote p { margin: 0; }
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; }
.legal li::marker { color: var(--accent); }
.legal .table { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--r-md); }
.legal table { border-collapse: collapse; width: 100%; font-size: 14px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.legal tr:last-child td { border-bottom: 0; }
.legal th { color: var(--olive); font-weight: 600; background: var(--surface); }

/* Support page */
.contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 64px; }
.contact a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: transform var(--base) var(--ease-out), border-color var(--base);
}
.contact a:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.contact b { font: 600 20px/1.2 var(--heading); }
.contact span { color: var(--muted); font-size: 15px; }
.contact .go { color: var(--accent); font-weight: 600; margin-top: 8px; }
@media (max-width: 640px) { .contact { grid-template-columns: 1fr; } }

/* Small pages (unsubscribe, 404) */
.solo { min-height: 72vh; display: grid; place-items: center; text-align: center; padding: 140px 0 40px; }
.solo .mark { width: 72px; height: 72px; margin: 0 auto 28px; }
.solo .lead { margin: 12px auto 28px; }
.solo .card { max-width: 30em; margin: 0 auto 28px; padding: 18px 20px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 15px; }

/* ── Less motion when the visitor asks for it ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
