/* Shared styles for wakejoy.app/blog — index and posts.
   Values mirror the WakeJoy design system (Theme.swift → Paper "WakeJoy Design System"). */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --sans: 'Avenir', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --serif: 'Kalnia', 'Times New Roman', serif;

  /* Backgrounds */
  --evening-bg: oklch(0.08 0.03 290);
  --ink: #010204;

  /* Text */
  --text-primary: #D2C9BE;            /* warm parchment */
  --text-light: #F3F1EE;              /* near-white */
  --text-morning: oklch(0.26 0.14 42); /* dark warm brown, for the morning phase */
  --text-muted: oklch(0.71 0.03 245 / 0.74); /* blue-gray captions */
  --text-bronze: #99816E;             /* meta / secondary */

  /* Accents */
  --gold: #FFC573;
  --gold-glow: #F5AE39;
  --accent-optimal: oklch(0.74 0.105 235);
  --accent-optimal-bright: oklch(0.82 0.115 235);
  --accent-violet: oklch(0.78 0.13 286);

  /* Surfaces */
  --surface-card: #000103B8;
  --border-card: #69A0C02E;
  --surface-ward: oklch(0.11 0.035 245 / 0.58);
  --border-ward: #6DA0BE38;

  --radius-card: 22px;
  --radius-panel: 28px;
}

html { color-scheme: dark; background: var(--ink); }

/* No body background: html paints the ink, so the fixed sky wash below stays visible */
body {
  color: var(--text-primary);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Night-sky wash: the design-system header glows (blue-violet + gold), fixed behind the page */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 72% 0%, oklch(0.68 0.045 290 / 0.22), transparent 70%),
    radial-gradient(ellipse 50% 40% at 15% 8%, oklch(0.80 0.15 75 / 0.08), transparent 70%),
    linear-gradient(135deg, oklch(0.06 0.03 255), oklch(0.135 0.06 250) 45%, oklch(0.055 0.03 260));
}

a { color: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 16px 96px; }

/* ─── NAV ─── */
.top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 64px; }

/* GlassPill / ward fill */
.pill-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-primary);
  text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 9px 18px; border-radius: 999px;
  background: var(--surface-ward);
  border: 1px solid var(--border-ward);
  box-shadow: 0 6px 14px oklch(0.42 0.12 235 / 0.18);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.pill-link:hover { color: var(--text-light); border-color: oklch(0.74 0.105 235 / 0.5); }

.brand {
  font-family: var(--serif); font-size: 22px; font-weight: 300;
  color: var(--gold); text-decoration: none;
  text-shadow: 0 0 8px oklch(0.80 0.15 75 / 0.18);
}

/* ─── SECTION LABEL (design-system caps label) ─── */
.label {
  font-size: 13px; font-weight: 900; letter-spacing: 0.04em; line-height: 18px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ─── GOLD HEADING + ✦ DIVIDER (ScreenHeader) ─── */
.gold-heading {
  font-family: var(--serif); font-weight: 300;
  color: var(--gold);
  text-shadow: 0 0 24px oklch(0.80 0.15 75 / 0.28);
}

.star-divider {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--gold); font-size: 12px; font-weight: 900; line-height: 1;
}
.star-divider::before, .star-divider::after {
  content: ''; width: 56px; height: 1px;
  background: linear-gradient(90deg, transparent, oklch(0.80 0.15 75 / 0.58), transparent);
}

/* ─── INDEX HEADER ─── */
.blog-header { text-align: center; margin-bottom: 72px; }
.blog-header .label { color: var(--text-muted); }

.blog-title {
  margin-top: 14px;
  font-size: clamp(44px, 8vw, 78px);
  line-height: 1.08;
}
.blog-header .star-divider { margin-top: 18px; }

.blog-subtitle {
  max-width: 34ch; margin: 22px auto 0;
  font-size: clamp(16px, 2.2vw, 19px); line-height: 1.5;
  color: oklch(0.83 0.02 70 / 0.78);
}

/* ─── CARD GRID ─── */
.post-grid {
  display: grid;
  /* auto-fit + capped tracks + centering: one or two posts sit centered instead of left-aligned */
  grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  justify-content: center;
  gap: 56px 32px;
}

.post-card { text-decoration: none; display: block; }

.post-art {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-card);
  display: grid; place-items: center;
  padding: 16px;
  overflow: hidden;
  box-shadow: 0 18px 36px #00000038;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.post-card:hover .post-art {
  transform: translateY(-4px);
  border-color: oklch(0.74 0.105 235 / 0.45);
  box-shadow: 0 24px 48px #00000057, 0 0 28px oklch(0.20 0.075 250 / 0.6);
}

.post-art span {
  position: relative;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1; text-align: center;
}

/* Phase-background art. Pick one per post. */

/* CosmosBackground — night sky with gold four-point stars */
.art-cosmos {
  background:
    radial-gradient(ellipse at 30% 20%, oklch(0.36 0.08 250 / 0.55), transparent 60%),
    radial-gradient(ellipse at 70% 90%, oklch(0.30 0.06 290 / 0.45), transparent 60%),
    linear-gradient(180deg, oklch(0.14 0.04 260), oklch(0.07 0.03 270));
}
/* Gold four-point stars scattered around the edges, clear of the centered title */
.art-cosmos::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 250' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3Cpath id='s' d='M0-6Q0 0 6 0Q0 0 0 6Q0 0-6 0Q0 0 0-6Z' fill='%23FFC573'/%3E%3C/defs%3E%3Cuse href='%23s' x='48' y='42'/%3E%3Cuse href='%23s' x='318' y='34' transform='translate(318 34) scale(.7) translate(-318 -34)'/%3E%3Cuse href='%23s' x='356' y='118' transform='translate(356 118) scale(.55) translate(-356 -118)'/%3E%3Cuse href='%23s' x='70' y='196' transform='translate(70 196) scale(.6) translate(-70 -196)'/%3E%3Cuse href='%23s' x='292' y='206'/%3E%3Cuse href='%23s' x='160' y='28' transform='translate(160 28) scale(.45) translate(-160 -28)'/%3E%3C/svg%3E") center / cover no-repeat;
  filter: drop-shadow(0 0 4px oklch(0.80 0.15 75 / 0.8));
  opacity: 0.9;
}
.art-cosmos span { color: var(--gold); text-shadow: 0 0 24px oklch(0.80 0.15 75 / 0.35); }

/* MirrorCard — oracle violet material with inner frame */
.art-mirror {
  background:
    radial-gradient(circle at 50% 48%, oklch(0.68 0.13 285 / 0.22), transparent 58%),
    linear-gradient(135deg, oklch(0.135 0.035 260), oklch(0.075 0.02 260) 50%, oklch(0.044 0.014 260));
  border-color: oklch(0.78 0.13 286 / 0.32);
  box-shadow: 0 18px 36px #00000057, 0 0 22px #928BE42E;
}
.art-mirror::before {
  content: ''; position: absolute; inset: 8px;
  border-radius: 16px;
  border: 1px solid oklch(0.78 0.13 286 / 0.32);
  background: linear-gradient(135deg, oklch(1 0 0 / 0.075), transparent 50%, oklch(0.68 0.13 285 / 0.18));
}
.art-mirror span {
  color: var(--text-primary);
  text-shadow: 0 0 18px oklch(0.78 0.13 286 / 0.45);
}

/* BlobBackground morning — lavender → pink → peach → gold */
.art-morning {
  background: linear-gradient(180deg,
    oklch(0.92 0.06 295), oklch(0.88 0.12 330) 33%, oklch(0.90 0.13 40) 67%, oklch(0.95 0.12 80));
  border-color: oklch(0.80 0.11 50 / 0.24);
}
.art-morning span { color: var(--text-morning); }

.post-meta { padding: 0 4px; }
.post-meta .label { display: block; margin-top: 22px; }
.post-card h2 {
  margin-top: 10px;
  font-family: var(--serif); font-weight: 400;
  font-size: 22px; line-height: 1.3;
  color: var(--text-light);
  transition: color 0.2s ease;
}
.post-card:hover h2 { color: var(--gold); }
.post-readtime { display: block; margin-top: 12px; font-size: 14px; color: var(--text-bronze); }

/* ─── POST PAGE ─── */
.article { max-width: 680px; margin: 0 auto; }

.article .post-art { margin-bottom: 44px; aspect-ratio: 16 / 8; }

.article-header { text-align: center; }
.article h1 {
  margin-top: 14px;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.12;
}
.article-header .star-divider { margin-top: 18px; }
.article-byline {
  margin-top: 16px;
  font-size: 14px; color: var(--text-bronze);
}

.article-body {
  margin-top: 44px;
  font-size: 18px; line-height: 1.75;
  color: var(--text-primary);
}
.article-body > * + * { margin-top: 1.2em; }
.article-body h2 {
  margin-top: 2.2em;
  font-family: var(--serif); font-weight: 300;
  font-size: 28px; line-height: 1.25;
  color: var(--gold);
  text-shadow: 0 0 8px oklch(0.80 0.15 75 / 0.18);
}
.article-body h3 {
  margin-top: 2em;
  font-size: 19px; font-weight: 900; letter-spacing: 0.01em; line-height: 1.4;
  color: var(--text-light);
}
.article-body strong { color: var(--text-light); }

/* Comparison tables — card surface, scrolls sideways on narrow phones */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-card);
  background: var(--surface-card);
}
.article-body table {
  width: 100%; min-width: 520px;
  border-collapse: collapse;
  font-size: 15px; line-height: 1.45;
}
.article-body th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--border-card);
}
.article-body td { padding: 13px 16px; vertical-align: top; }
.article-body td:first-child { color: var(--text-light); font-weight: 600; white-space: nowrap; }
.article-body tbody tr + tr td,
.article-body tbody tr + tr th { border-top: 1px solid oklch(1 0 0 / 0.06); }
/* Row headers (<th scope="row">) read like the first-column cells, not the caps column labels */
.article-body tbody th {
  padding: 13px 16px; vertical-align: top;
  font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--text-light);
  border-bottom: 0;
}
.article-body caption {
  padding: 14px 16px 4px;
  text-align: left;
  font-size: 14px; color: var(--text-bronze);
}
/* Many-column tables: scroll sideways instead of crushing cells */
.table-wide table { min-width: 960px; }

/* Freshness / disclosure note above the body copy */
.article-note { font-size: 15px; line-height: 1.6; color: var(--text-bronze); }
.article-body a {
  color: var(--accent-optimal-bright);
  text-decoration-color: oklch(0.74 0.105 235 / 0.4);
  text-underline-offset: 3px;
}
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li + li { margin-top: 0.4em; }
.article-body li::marker { color: var(--gold); }

/* ZoneQuoteCard */
.article-body blockquote {
  padding: 18px 20px;
  border-radius: 12px;
  background: oklch(0.50 0.12 235 / 0.08);
  box-shadow: inset 2px 0 0 oklch(0.65 0.15 235 / 0.55);
  font-family: var(--serif); font-weight: 300;
  font-size: 21px; line-height: 1.5;
  color: oklch(0.83 0.02 70 / 0.9);
}

/* Material card — purple sheet with gold hairline */
.article-cta {
  margin-top: 72px; padding: 36px 24px;
  border-radius: var(--radius-panel);
  background: linear-gradient(180deg, oklch(0.18 0.045 300 / 0.92), oklch(0.12 0.035 300 / 0.94));
  border: 1px solid #FFC57338;
  box-shadow: 0 18px 36px #00000038;
  text-align: center;
}
.article-cta p {
  font-family: var(--serif); font-weight: 300;
  font-size: 24px; line-height: 1.3;
  color: var(--text-light);
  margin-bottom: 22px;
}
.article-cta img { height: 48px; }

/* AppCTAButton — glass blue pill */
.cta-button {
  display: flex; align-items: center; justify-content: center;
  width: min(100%, 320px); height: 56px; margin: 72px auto 0;
  border-radius: 32px;
  border: 1px solid #2580C185;
  background: linear-gradient(180deg, oklch(0.78 0.11 236 / 0.55), oklch(0.55 0.105 240 / 0.30));
  box-shadow:
    inset 0 1px 0 #FFFFFF38,
    inset 0 -8px 8px #00000038,
    0 10px 24px oklch(0.20 0.075 250 / 0.38);
  color: var(--text-light);
  font-size: 16px; font-weight: 900; letter-spacing: 0.018em;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.2s ease;
}
.cta-button:hover { filter: brightness(1.12); }
.cta-button:active { transform: scale(0.98); }
