/* The Church of Fable — shared styles */

/* ---------- type ---------- */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-var.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic-var.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  color-scheme: light dark;

  --paper: oklch(0.963 0.011 85);
  --paper-deep: oklch(0.936 0.015 83);
  --ink: oklch(0.26 0.022 55);
  --ink-soft: oklch(0.44 0.025 58);
  --accent: oklch(0.46 0.125 28);          /* sealing-wax red */
  --accent-strong: oklch(0.38 0.115 28);
  --rule: oklch(0.26 0.03 55 / 0.16);      /* alpha hairlines recede in light mode */
  --rule-strong: oklch(0.26 0.03 55 / 0.32);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.208 0.012 70);
    --paper-deep: oklch(0.178 0.012 70);
    --ink: oklch(0.895 0.015 80);
    --ink-soft: oklch(0.71 0.02 75);
    --accent: oklch(0.70 0.082 32);        /* desaturated for dark ground */
    --accent-strong: oklch(0.78 0.075 34);
    --rule: oklch(0.30 0.015 70);          /* solid hairlines sit quietly in dark mode */
    --rule-strong: oklch(0.37 0.018 70);
  }
}

/* ---------- base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.62;
  font-size: 1.125rem;
}

::selection {
  background: color-mix(in oklch, var(--accent) 22%, var(--paper));
  color: var(--ink);
}

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

/* ---------- the sign ---------- */

.sigil { display: block; color: var(--accent); }

.sigil-hero { margin: 0 auto 2.2rem; }

@media (prefers-reduced-motion: no-preference) {
  .sigil-hero .sigil-ring {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: sigil-draw 1.3s cubic-bezier(0.33, 1, 0.68, 1) 0.2s forwards;
  }
  .sigil-hero .sigil-seal {
    opacity: 0;
    transform: translateY(-32px);
    animation: sigil-descend 0.9s cubic-bezier(0.55, 0.05, 0.35, 1) 1.25s forwards;
  }
  .sigil-hero .sigil-ground {
    transform: scaleX(0);
    transform-box: fill-box;
    transform-origin: center;
    animation: sigil-ground 0.7s cubic-bezier(0.33, 1, 0.68, 1) 1.85s forwards;
  }
}

@keyframes sigil-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes sigil-descend {
  0% { opacity: 0; transform: translateY(-32px); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes sigil-ground {
  to { transform: scaleX(1); }
}

/* ---------- header ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklch, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark .sigil { flex: none; }

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: 1.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- layout ---------- */

main { display: block; }

.measure {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.prose { max-width: 62ch; }

section { padding: 4.5rem 0; }
section + section { border-top: 1px solid var(--rule); }
section.tinted { background: var(--paper-deep); }

.kicker {
  font-size: 0.74rem;
  font-weight: 550;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

h1, h2, h3 {
  font-weight: 430;
  line-height: 1.12;
  text-wrap: balance;
}

h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); letter-spacing: -0.01em; margin-bottom: 1.2rem; line-height: 1.18; }
h3 { font-size: 1.25rem; font-weight: 500; margin-bottom: 0.5rem; line-height: 1.3; }

p + p { margin-top: 1em; }

a {
  color: var(--accent-strong);
  text-decoration-thickness: from-font;
  text-underline-offset: 0.16em;
  text-decoration-skip-ink: auto;
  text-decoration-color: color-mix(in oklch, var(--accent) 45%, transparent);
  transition: text-decoration-color 150ms ease;
}

a:hover { text-decoration-color: var(--accent); }

.lede {
  font-size: 1.3rem;
  color: var(--ink-soft);
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------- hero ---------- */

.hero {
  padding: 5.5rem 0 5.5rem;
  text-align: center;
}

.hero .measure { max-width: 52rem; }

.hero .lede { margin: 1.6rem auto 0; max-width: 40ch; }

.hero-actions {
  margin-top: 2.6rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.8rem 1.7rem;
  border-radius: 2px;
  display: inline-block;
  transition: background-color 150ms ease, border-color 150ms ease, scale 150ms ease-out;
}

.btn:active { scale: 0.98; }

.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: var(--accent-strong); color: var(--paper); }

@media (prefers-color-scheme: dark) {
  .btn-primary { color: oklch(0.16 0.01 70); }
  .btn-primary:hover { color: oklch(0.16 0.01 70); }
}

.btn-quiet {
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  background: transparent;
}
.btn-quiet:hover { border-color: var(--accent); }

/* ---------- components ---------- */

.rule-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  margin: 0 auto 2rem;
  max-width: 22rem;
}

.rule-ornament::before,
.rule-ornament::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule-strong);
}

blockquote.scripture {
  border-inline-start: 2px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.6rem;
  margin: 2.2rem 0;
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

blockquote.scripture cite {
  display: block;
  margin-top: 0.8rem;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* the understandings */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.8rem 3rem;
  margin-top: 2.4rem;
}

.card {
  border-top: 1px solid var(--rule-strong);
  padding-top: 1.3rem;
}

.card h3 { margin-bottom: 0.4rem; }

.card .num {
  display: block;
  font-size: 1.5rem;
  font-weight: 430;
  font-style: italic;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.card p { font-size: 0.97rem; color: var(--ink-soft); text-wrap: pretty; }

/* creed */

.creed {
  text-align: center;
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  line-height: 1.9;
  font-style: italic;
  max-width: 44rem;
  margin: 0 auto;
}

/* schedule */

.schedule { margin-top: 2rem; border-top: 1px solid var(--rule-strong); }

.schedule-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.schedule-row .when {
  font-size: 0.74rem;
  font-weight: 550;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.7;
  color: var(--accent);
  padding-top: 0.4rem;
}

.schedule-row p { color: var(--ink-soft); font-size: 0.97rem; margin-top: 0.3rem; text-wrap: pretty; }

@media (max-width: 40rem) {
  .schedule-row { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* faq */

.faq-item {
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0;
}

.faq-item summary {
  cursor: pointer;
  font-size: 1.2rem;
  padding: 1rem 0;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  text-wrap: balance;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::before {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  transform: translateY(-0.05em);
  transition: background-color 150ms ease;
}

.faq-item[open] summary::before { background: var(--accent); }

.faq-item[open] summary { color: var(--accent-strong); }

.faq-item .answer {
  padding: 0 0 1.4rem 1.75em;
  color: var(--ink-soft);
  max-width: 58ch;
  text-wrap: pretty;
}

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 3rem 0 2.5rem;
}

footer .measure {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: baseline;
}

footer .foot-creed {
  font-style: italic;
  color: var(--ink-soft);
  max-width: 26rem;
}

footer nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

footer nav a { color: var(--ink-soft); text-decoration: none; transition: color 150ms ease; }
footer nav a:hover { color: var(--ink); }

.colophon {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: none;
}

/* page headers on interior pages */

.page-head {
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

.page-head .lede { margin: 1.2rem auto 0; max-width: 44ch; }

/* ---------- small screens & motion ---------- */

@media (max-width: 40rem) {
  .masthead-inner { flex-wrap: wrap; gap: 0.6rem 1.2rem; padding: 0.7rem 1.2rem; }
  .masthead nav { margin-left: 0; gap: 1rem; flex-wrap: wrap; }
  section { padding: 3rem 0; }
  .hero { padding: 3.5rem 0 4rem; }
}

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