/* ===========================================================================
   Matty's Becoming — site design system
   A single stylesheet shared by every page (static and database-rendered).
   Built around a small set of tokens so a color or spacing change here
   updates the whole site at once, the same way a real design system would.
   =========================================================================== */

:root {
  /* Color — light */
  --bg: #ffffff;
  --bg-raised: #f5f5f7;      /* Apple's classic pale gray — cards, footer, banner */
  --bg-nav: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #5b4fe0;         /* indigo-violet — "SoulWindow" */
  --accent-warm: #c8863a;    /* warm gold — "Becoming" */
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px;  --sp-7: 48px;  --sp-8: 72px;
  --sp-9: 112px;

  --radius: 16px;
  --radius-sm: 10px;
  --content-width: 1080px;
  --prose-width: 640px;
  --nav-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-raised: #1c1c1e;
    --bg-nav: rgba(0, 0, 0, 0.68);
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #8f85ff;
    --accent-warm: #e0a458;
    --accent-contrast: #0b0b0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }
a.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(91, 79, 224, 0.35);
}
a.text-link:hover { text-decoration-color: currentColor; }

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

::selection { background: var(--accent); color: var(--accent-contrast); }

/* ------------------------------------------------------------------------
   Layout helpers
   ------------------------------------------------------------------------ */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.prose {
  max-width: var(--prose-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.prose p, .prose ul, .prose ol { margin: 0 0 var(--sp-4); color: var(--text); }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: var(--sp-7) 0 var(--sp-3); }
.prose img { border-radius: var(--radius-sm); margin: var(--sp-5) 0; }
.content-section + .content-section { margin-top: var(--sp-6); display: block; }

.section { padding: var(--sp-8) 0; }
.section--tight { padding: var(--sp-6) 0; }
.section--raised { background: var(--bg-raised); }

/* Scroll-reveal — site.js adds .is-visible; without JS everything is
   already visible, so nothing ever depends on script running. */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ------------------------------------------------------------------------
   Nav — sticky, translucent, condenses slightly on scroll
   ------------------------------------------------------------------------ */
.site-nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-height);
  display: flex; align-items: center;
  background: var(--bg-nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: height 0.25s ease;
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.site-nav .brand { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.site-nav .links { display: flex; gap: var(--sp-6); font-size: 13px; }
.site-nav .links a { color: var(--text-secondary); transition: color 0.15s ease; }
.site-nav .links a:hover, .site-nav .links a.active { color: var(--text); }
.site-nav .menu-btn { display: none; background: none; border: none; padding: 8px; cursor: pointer; color: var(--text); }
.site-nav .menu-btn svg { display: block; }

@media (max-width: 700px) {
  .site-nav .links { display: none; }
  .site-nav .menu-btn { display: block; }
}

.mobile-menu {
  position: fixed; inset: 0; z-index: 199;
  background: var(--bg);
  display: none;
  flex-direction: column;
  padding: calc(var(--nav-height) + var(--sp-6)) var(--sp-5) var(--sp-6);
  gap: var(--sp-5);
}
.mobile-menu.is-open { display: flex; }
.mobile-menu a { font-family: var(--font-display); font-size: 28px; }

/* ------------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------------ */
.hero {
  padding: clamp(var(--sp-7), 10vw, var(--sp-9)) 0 var(--sp-8);
  text-align: center;
}
.hero .eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-warm);
  margin-bottom: var(--sp-4);
}
.hero h1 {
  font-size: clamp(2.75rem, 7vw, 5.25rem);
  line-height: 1.02;
  margin: 0 auto var(--sp-5);
  max-width: 16ch;
}
.hero .lede {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 auto var(--sp-7);
}
.hero .actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------------
   Buttons & forms
   ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  font-family: var(--font-body);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-raised); }

form.signup {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center;
  max-width: 480px; margin: 0 auto;
}
input[type="email"], input[type="text"] {
  flex: 1; min-width: 220px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}
input[type="email"]:focus, input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.consent-line { font-size: 13px; color: var(--text-tertiary); margin-top: var(--sp-3); max-width: 46ch; margin-left: auto; margin-right: auto; }
#signup-status { margin-top: var(--sp-3); font-size: 14px; color: var(--text-secondary); }

/* ------------------------------------------------------------------------
   Cards — news list, feature grid
   ------------------------------------------------------------------------ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-5); }
.card {
  background: var(--bg-raised);
  border-radius: var(--radius);
  padding: var(--sp-6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.news-item {
  padding: var(--sp-6) 0;
  border-bottom: 1px solid var(--border);
}
.news-item:first-of-type { padding-top: 0; }
.news-item:last-of-type { border-bottom: none; }
.news-item h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); margin-bottom: var(--sp-2); }
.news-item h2 a { transition: color 0.15s ease; }
.news-item h2 a:hover { color: var(--accent); }
.post-date { font-size: 13px; color: var(--text-tertiary); margin: 0 0 var(--sp-3); }

/* ------------------------------------------------------------------------
   Page header (for /pages/:slug and /news/:slug)
   ------------------------------------------------------------------------ */
.page-header { padding: var(--sp-8) 0 var(--sp-6); text-align: center; }
.page-header h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); margin-bottom: var(--sp-2); }

/* ------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-6) 0;
  margin-top: var(--sp-8);
}
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.site-footer, .site-footer a { font-size: 13px; color: var(--text-tertiary); }
.site-footer a:hover { color: var(--text-secondary); }
.site-footer .links { display: flex; gap: var(--sp-5); }

/* ------------------------------------------------------------------------
   Simple centered content (privacy, confirmed, unsubscribed) —
   kept out of .hero so it doesn't try to be a marketing moment.
   ------------------------------------------------------------------------ */
.notice {
  padding: var(--sp-9) var(--sp-5) var(--sp-8);
  text-align: center;
}
.notice h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: var(--sp-4); }
.notice .lede { color: var(--text-secondary); font-size: 18px; max-width: 44ch; margin: 0 auto; }
.notice .icon { font-size: 40px; margin-bottom: var(--sp-4); }

/* ------------------------------------------------------------------------
   Cookie banner
   ------------------------------------------------------------------------ */
#cookie-banner {
  position: fixed; left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4);
  background: var(--text); color: var(--bg);
  border-radius: var(--radius);
  padding: var(--sp-5); display: none; z-index: 300;
  box-shadow: var(--shadow);
}
#cookie-banner .inner {
  max-width: var(--content-width); margin: 0 auto;
  display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap;
}
#cookie-banner p { margin: 0; font-size: 14px; flex: 1; min-width: 240px; opacity: 0.9; }
#cookie-banner .btn-primary { background: var(--bg); color: var(--text); }
#cookie-banner .btn-secondary { border-color: rgba(128,128,128,0.4); color: inherit; }

/* ===========================================================================
   Marketing homepage components — book mockup, split hero, trilogy cards,
   pull-quote, author card, and the standalone pre-launch landing chrome.
   Built from the same tokens above, so they inherit both themes for free.
   =========================================================================== */

/* --- Book cover mockup (CSS-only placeholder, swappable for a real cover
   image later — see .book-mockup img rule at the bottom of this block) --- */
.book-mockup {
  --book-w: min(320px, 62vw);
  perspective: 1600px;
  display: flex;
  justify-content: center;
}
.book-mockup .book {
  position: relative;
  width: var(--book-w);
  aspect-ratio: 2 / 3;
  transform: rotateY(-18deg) rotateX(2deg);
  transform-style: preserve-3d;
  animation: book-float 7s ease-in-out infinite;
}
.book-mockup .book-cover {
  position: absolute; inset: 0;
  border-radius: 3px 10px 10px 3px;
  background:
    radial-gradient(120% 140% at 15% 0%, rgba(255,255,255,0.16), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, #392f9e 100%);
  box-shadow:
    10px 18px 40px rgba(0,0,0,0.35),
    0 2px 0 rgba(255,255,255,0.06) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12% 11%;
  color: #fff;
}
.book-mockup .book-cover::before {
  /* spine shadow */
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  background: linear-gradient(90deg, rgba(0,0,0,0.35), transparent);
  border-radius: 3px 0 0 3px;
}
.book-mockup .book-mark {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.55);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-4);
  font-family: var(--font-display); font-size: 15px;
}
.book-mockup .book-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.book-mockup .book-rule {
  width: 34px; height: 1.5px; background: var(--accent-warm);
  margin: var(--sp-3) 0;
}
.book-mockup .book-subtitle {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0.82;
}
.book-mockup .book-author {
  position: absolute; bottom: 10%; left: 0; right: 0;
  font-family: var(--font-display); font-size: 13px; letter-spacing: 0.03em;
  opacity: 0.85;
}
.book-mockup .book-pages {
  position: absolute; top: 2%; bottom: 2%; right: -8px; width: 10px;
  background: repeating-linear-gradient(180deg, #efe9da 0 2px, #e2dac8 2px 4px);
  border-radius: 0 3px 3px 0;
  transform: translateZ(-1px);
  box-shadow: 2px 0 6px rgba(0,0,0,0.25);
}
@keyframes book-float {
  0%, 100% { transform: rotateY(-18deg) rotateX(2deg) translateY(0); }
  50% { transform: rotateY(-18deg) rotateX(2deg) translateY(-10px); }
}
/* Drop-in for when a real cover image exists: <img> replaces book-cover's
   generated look while keeping the same shadow/perspective wrapper. */
.book-mockup .book img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 3px 10px 10px 3px;
  box-shadow: 10px 18px 40px rgba(0,0,0,0.35);
}

/* --- Split hero (text + book mockup side by side) --- */
.hero-split {
  padding: clamp(var(--sp-7), 8vw, var(--sp-9)) 0 var(--sp-8);
}
.hero-split .container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(var(--sp-6), 6vw, var(--sp-9));
}
.hero-split .eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-warm);
  margin-bottom: var(--sp-4);
}
.hero-split h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.1rem);
  line-height: 1.03;
  margin: 0 0 var(--sp-5);
}
.hero-split .lede {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 0 var(--sp-6);
}
.hero-split .actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.hero-split .stat-row { display: flex; gap: var(--sp-7); margin-top: var(--sp-7); }
.hero-split .stat-row .stat-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.hero-split .stat-row .stat-label { font-size: 12px; color: var(--text-tertiary); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

@media (max-width: 860px) {
  .hero-split .container { grid-template-columns: 1fr; text-align: center; }
  .hero-split .actions { justify-content: center; }
  .hero-split .stat-row { justify-content: center; }
  .hero-split h1, .hero-split .lede { margin-left: auto; margin-right: auto; }
  .hero-split .book-mockup { order: -1; margin-bottom: var(--sp-6); }
}

/* --- Pull-quote --- */
.quote-block { text-align: center; padding: var(--sp-6) 0; }
.quote-block blockquote {
  margin: 0 auto;
  max-width: 720px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  line-height: 1.28;
  color: var(--text);
  text-wrap: balance;
}
.quote-block blockquote::before { content: "\201C"; color: var(--accent); }
.quote-block blockquote::after { content: "\201D"; color: var(--accent); }
.quote-block cite { display: block; margin-top: var(--sp-5); font-style: normal; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }

/* --- Trilogy roadmap cards --- */
.trilogy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
@media (max-width: 780px) { .trilogy-grid { grid-template-columns: 1fr; } }
.trilogy-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.trilogy-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.trilogy-card .book-num {
  font-family: var(--font-display); font-size: 13px; color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
}
.trilogy-card h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); margin-bottom: var(--sp-2); }
.trilogy-card p { color: var(--text-secondary); font-size: 14.5px; margin-bottom: var(--sp-4); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.pill--live { background: rgba(91, 79, 224, 0.12); color: var(--accent); }
.pill--soon { background: var(--bg-raised); color: var(--text-tertiary); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --- Author card --- */
.author-card {
  display: flex; align-items: center; gap: var(--sp-6);
  background: var(--bg-raised);
  border-radius: var(--radius);
  padding: var(--sp-6);
}
.author-card .avatar {
  flex: none;
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 28px; font-weight: 600;
}
.author-card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.author-card p { color: var(--text-secondary); font-size: 14.5px; margin: 0; }
@media (max-width: 560px) { .author-card { flex-direction: column; text-align: center; } }

/* ------------------------------------------------------------------------
   Pre-launch landing page (title + email capture only) — its own
   full-bleed chrome, not the site nav/footer, since it's meant to stand
   completely alone before the rest of the site is public.
   ------------------------------------------------------------------------ */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.landing::before, .landing::after {
  content: "";
  position: absolute;
  width: 60vw; height: 60vw;
  max-width: 800px; max-height: 800px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: -1;
}
.landing::before { background: var(--accent); top: -20%; left: -15%; }
.landing::after { background: var(--accent-warm); bottom: -25%; right: -15%; opacity: 0.22; }

.landing-brand {
  padding: var(--sp-6) var(--sp-5) 0;
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
  text-align: center;
}
.landing-main {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--sp-6) var(--sp-5);
}
.landing-main .eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-warm); margin-bottom: var(--sp-5);
}
.landing-main h1 {
  font-size: clamp(2.75rem, 9vw, 6rem);
  line-height: 0.98;
  max-width: 18ch;
  margin: 0 0 var(--sp-5);
}
.landing-main .lede {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 42ch;
  margin: 0 0 var(--sp-7);
}
.landing-main form.signup { margin-bottom: var(--sp-3); }
.landing-footer {
  padding: var(--sp-5); text-align: center;
  font-size: 12.5px; color: var(--text-tertiary);
}
.landing-footer a { color: var(--text-tertiary); text-decoration: underline; text-underline-offset: 2px; }
.landing-footer a:hover { color: var(--text-secondary); }
