/* Loop web — the app's design system, translated for the browser.
   Tokens mirror Packages/LoopKit/Sources/LoopDesignSystem/Tokens: graphite ground, cream type,
   a single amber accent, and a serif display face against a plain sans for reading. */

:root {
  --bg: #0d0c0b;
  --surface: #171614;
  --surface-raised: #1f1d1a;
  --line: rgba(244, 239, 232, 0.10);
  --text: #f4efe8;
  --muted: #a9a39b;
  --dim: #6f6b66;
  --accent: #e8a24a;
  --cta: #f3efe8;

  --display: "Newsreader", "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;

  --gutter: 24px;
  --measure: 1120px;
  --radius: 20px;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

img { max-width: 100%; display: block; }
a { color: inherit; }

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

/* Type -------------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7.5vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.4rem); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 46ch; }
.muted { color: var(--muted); }

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--dim);
  margin: 0 0 14px;
}

/* Header ------------------------------------------------------------------ */

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  background: rgba(13, 12, 11, 0.72);
  border-bottom: 1px solid transparent;
}
.site-head.is-scrolled { border-bottom-color: var(--line); }

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand { display: inline-flex; align-items: center; }
.brand img { height: 22px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 22px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--text); }

/* Narrower than any phone, but the header is the one place where wrapping looks broken rather than
   merely tight, so give it somewhere to go. */
@media (max-width: 400px) {
  :root { --gutter: 18px; }
  .site-nav { gap: 14px; font-size: 0.88rem; }
}
@media (max-width: 330px) {
  .site-nav a[href="/#how"] { display: none; }
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 26px;
  border-radius: 999px;
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--cta); color: #0d0c0b; }
.btn-primary:hover { background: #fff; }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: rgba(244, 239, 232, 0.28); }

/* Hero -------------------------------------------------------------------- */

.hero { position: relative; isolation: isolate; }

.hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.62; }

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(13,12,11,0.55) 0%, rgba(13,12,11,0.30) 38%, rgba(13,12,11,0.94) 88%, var(--bg) 100%);
}

.hero .wrap {
  min-height: min(92svh, 860px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-block: 120px 72px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-note { margin-top: 18px; font-size: 0.85rem; color: var(--dim); }

/* Sections ---------------------------------------------------------------- */

section { padding-block: clamp(64px, 9vw, 112px); }
.section-head { max-width: 52ch; margin-bottom: 44px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.card h3 { margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 0.97rem; }

.step-n {
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 14px;
  display: block;
}

/* Pack tiles -------------------------------------------------------------- */

.pack {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--line);
}
.pack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pack::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13,12,11,0) 30%, rgba(13,12,11,0.9) 100%);
}
.pack-body { position: relative; z-index: 1; padding: 24px; }
.pack-body p { color: rgba(244,239,232,0.78); font-size: 0.95rem; margin: 6px 0 0; }

/* Legal pages ------------------------------------------------------------- */

.legal { padding-block: clamp(56px, 8vw, 96px); }
.legal .wrap { max-width: 760px; }
.legal h1 { font-size: clamp(2.2rem, 5.4vw, 3.2rem); margin-bottom: 12px; }
.legal .updated { color: var(--dim); font-size: 0.9rem; margin-bottom: 44px; }
.legal h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.7rem);
  margin: 44px 0 14px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.legal h2:first-of-type { border-top: 0; padding-top: 0; }
.legal h3 { font-size: 1.1rem; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--muted); }
.legal strong { color: var(--text); font-weight: 600; }
.legal ul { padding-left: 1.15em; margin: 0 0 1em; }
.legal li { margin-bottom: 0.5em; }
.legal a { color: var(--accent); text-decoration-color: rgba(232, 162, 74, 0.4); text-underline-offset: 3px; }

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 40px;
}
.toc ol { margin: 0; padding-left: 1.2em; columns: 2; column-gap: 28px; }
.toc li { margin-bottom: 6px; font-size: 0.93rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }

@media (max-width: 560px) {
  .toc ol { columns: 1; }
}

/* Footer ------------------------------------------------------------------ */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 44px;
  color: var(--dim);
  font-size: 0.9rem;
}
.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: center;
  justify-content: space-between;
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); }
.foot-links { display: flex; flex-wrap: wrap; gap: 20px; }

/* Utilities --------------------------------------------------------------- */

.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: absolute;
  left: -9999px;
  top: 8px;
  background: var(--cta);
  color: #0d0c0b;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 50;
}
.skip-link:focus { left: 16px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
