/* Sleep Tiles site. Tokens mirror the app's Dusk theme (design/DESIGN.md). */
:root {
  --bg: #F5F4FB;
  --surface: #FFFFFF;
  --surface-raised: #ECEBF6;
  --hairline: rgba(20, 21, 43, 0.10);
  --text: #14152B;
  --text-2: #4C4E6E;
  --text-3: #6B6D8C;
  --accent: #4B57D8;
  --on-accent: #FFFFFF;
  --l0: #E3E4F0;
  --l1: #CC4B48;
  --l2: #DDB65C;
  --l3: #30A14E;
  --l4: #216E39;
  --radius-card: 20px;
  --radius-control: 14px;
  --page: 720px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0D1A;
    --surface: #141730;
    --surface-raised: #1D2142;
    --hairline: rgba(255, 255, 255, 0.09);
    --text: #F3F2FF;
    --text-2: #A9ABCB;
    --text-3: #8487AD;
    --accent: #9AA6FF;
    --on-accent: #0B0D1A;
    --l0: #222647;
    --l1: #C4504A;
    --l2: #B9923B;
    --l3: #2EA043;
    --l4: #56D364;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { padding: 20px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: 18px; font-size: 15px; }
.nav a { color: var(--text-2); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* Hero */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(34px, 7vw, 52px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 14px; }
.hero p.lede { font-size: 19px; color: var(--text-2); margin: 0 0 24px; max-width: 34em; }

.button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; text-decoration: none;
  padding: 14px 22px; border-radius: var(--radius-control);
}
.button:hover { filter: brightness(1.06); }
.button svg { width: 18px; height: 18px; fill: currentColor; }

/* Decorative grid */
.grid-art {
  margin: 36px 0 8px;
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  overflow: hidden;
  justify-content: end;
}
.grid-art span { width: 14px; height: 14px; border-radius: 3px; background: var(--l0); }
.grid-art .l1 { background: var(--l1); }
.grid-art .l2 { background: var(--l2); }
.grid-art .l3 { background: var(--l3); }
.grid-art .l4 { background: var(--l4); }
.legend { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Sections */
section { padding: 28px 0; }
h2 { font-size: 26px; letter-spacing: -0.01em; margin: 0 0 14px; }
h3 { font-size: 18px; margin: 0 0 6px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 18px;
}
.card p { margin: 0; color: var(--text-2); font-size: 15px; }

/* Long-form pages */
.doc { padding: 24px 0 40px; }
.doc h1 { font-size: clamp(30px, 6vw, 40px); letter-spacing: -0.02em; margin: 0 0 6px; }
.doc .meta { color: var(--text-3); font-size: 14px; margin: 0 0 28px; }
.doc h2 { font-size: 21px; margin: 32px 0 10px; }
.doc p, .doc li { color: var(--text-2); }
.doc strong { color: var(--text); }
.doc ul { padding-left: 22px; }
.doc li { margin: 4px 0; }
.callout {
  background: var(--surface-raised);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin: 20px 0;
}
.callout p { margin: 0; color: var(--text); }

details { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 14px 18px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--text); }
details p, details ol, details ul { margin: 10px 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); padding: 24px 0 40px; color: var(--text-3); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--text-2); text-decoration: none; margin-right: 16px; }
.site-footer a:last-child { margin-right: 0; }

@media (max-width: 480px) {
  .nav { gap: 14px; font-size: 14px; }
  .grid-art span { width: 11px; height: 11px; }
  .grid-art { gap: 3px; }
}
