/* Sacred Pattern — base stylesheet */

:root {
  /* Palette — deep indigo night, cyan signal, aged gold */
  --bg:            #070a14;
  --bg-raised:     #0d1223;
  --bg-inset:      #10162b;
  --line:          #1e2743;
  --line-soft:     #171f36;
  --text:          #e6e8f0;
  --text-muted:    #a3aac4;
  --text-faint:    #6f7794;
  --cyan:          #6bd5e8;
  --cyan-dim:      #3f9dad;
  --gold:          #d8b072;
  --gold-dim:      #9a7c4d;

  /* Type */
  --font-display: 'Zodiak', Georgia, serif;
  --font-body:    'Work Sans', system-ui, sans-serif;
  --font-prose:   'Source Serif 4', Georgia, serif;

  --text-xs:   0.8125rem;
  --text-sm:   0.9375rem;
  --text-base: 1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   clamp(1.5rem, 2.4vw, 2rem);
  --text-2xl:  clamp(2rem, 4.4vw, 3.1rem);
  --text-hero: clamp(2.6rem, 7vw, 5rem);

  /* Space */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;   --s-8: 2rem;     --s-12: 3rem;    --s-16: 4rem;
  --s-24: 6rem;    --s-32: 8rem;

  --wrap: 1120px;
  --measure: 66ch;
  --radius: 3px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

::selection { background: var(--cyan-dim); color: #04070f; }

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

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s-6); }
/* .narrow keeps the page's left gutter, but caps line length on its children */
.wrap.narrow > * { max-width: 720px; }
.lede.narrow, p.narrow { max-width: 640px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--cyan); color: #04070f; padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm); z-index: 100;
}
.skip-link:focus { left: var(--s-4); top: var(--s-4); }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 10, 20, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-6); min-height: 68px;
}

.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  text-decoration: none; color: var(--text);
}
.brand svg { width: 26px; height: 26px; color: var(--cyan); flex: none; }
.brand__name {
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase;
}

.nav { display: flex; align-items: center; gap: var(--s-6); }
.nav a {
  font-size: var(--text-sm); font-weight: 400; color: var(--text-muted);
  text-decoration: none; letter-spacing: 0.02em;
  transition: color 0.25s var(--ease);
}
.nav a:hover, .nav a[aria-current='page'] { color: var(--text); }
.nav a[aria-current='page'] { color: var(--cyan); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius);
  padding: var(--s-2) var(--s-3); font-size: var(--text-xs);
  font-family: inherit; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg-raised); border-bottom: 1px solid var(--line);
    padding: var(--s-2) var(--s-6) var(--s-4);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: var(--s-3) 0; width: 100%; border-bottom: 1px solid var(--line-soft); }
  .nav a:last-child { border-bottom: none; }
  .nav-toggle { display: block; }
  .site-header__inner { position: relative; }
}

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; margin: 0; }
h1 { font-size: var(--text-2xl); letter-spacing: -0.015em; }
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; margin-bottom: var(--s-5); }
h3 { font-family: var(--font-body); font-size: var(--text-lg); font-weight: 500; line-height: 1.3; }
p { margin: 0 0 1.05em; }

.eyebrow {
  font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cyan-dim); margin: 0 0 var(--s-4);
}
.lede { font-size: var(--text-lg); line-height: 1.55; color: var(--text-muted); font-weight: 300; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: var(--text-sm); }

.rule {
  border: 0; height: 1px; background: var(--line);
  margin: var(--s-16) 0;
}

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

.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}
.hero__bg {
  position: absolute; inset: 0;
  background: url('../img/sp_hero.jpg') center right / cover no-repeat;
  opacity: 0.85;
}
.hero__veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(100deg, var(--bg) 8%, rgba(7,10,20,0.86) 42%, rgba(7,10,20,0.35) 72%, rgba(7,10,20,0.6) 100%),
    linear-gradient(to bottom, rgba(7,10,20,0.5), rgba(7,10,20,0.15) 40%, var(--bg) 99%);
}
.hero__inner {
  position: relative;
  padding-block: clamp(var(--s-24), 15vw, 11rem);
  max-width: 640px;
}
.hero h1 {
  font-size: var(--text-hero);
  letter-spacing: -0.02em;
  margin-bottom: var(--s-6);
}
.hero h1 em { font-style: italic; color: var(--cyan); }
.hero .lede { max-width: 30rem; }

@media (max-width: 720px) {
  .hero__veil {
    background: linear-gradient(to bottom, rgba(7,10,20,0.72), rgba(7,10,20,0.88) 55%, var(--bg) 99%);
  }
  .hero__inner { padding-block: var(--s-24) var(--s-16); }
}

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

.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--text-sm); font-weight: 500; letter-spacing: 0.04em;
  text-decoration: none; padding: 0.7rem 1.35rem;
  border-radius: var(--radius); border: 1px solid var(--cyan-dim);
  color: var(--bg); background: var(--cyan);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { background: #8ee2f1; transform: translateY(-1px); }
.btn--ghost {
  background: transparent; color: var(--text); border-color: var(--line);
}
.btn--ghost:hover { background: var(--bg-raised); border-color: var(--cyan-dim); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-8); }

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

.section { padding-block: clamp(var(--s-16), 9vw, var(--s-32)); }
.section--tight { padding-block: clamp(var(--s-12), 6vw, var(--s-24)); }
.section + .section--tight { padding-top: var(--s-4); }
.section--tight + .section--tight { padding-top: var(--s-4); }
.section__head { max-width: 40rem; margin-bottom: var(--s-12); }

/* ---------- Feature split ---------- */

.split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(var(--s-8), 5vw, var(--s-16)); align-items: center;
}
.split--flip .split__media { order: -1; }
.split__media img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--line);
}
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split--flip .split__media { order: 0; }
}

/* ---------- Cards ---------- */

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-6);
}
.card {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: var(--s-8);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.card h3 { margin-bottom: var(--s-3); }
.card p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: 0; }
.card__num {
  font-family: var(--font-display); font-size: var(--text-lg);
  color: var(--gold-dim); display: block; margin-bottom: var(--s-4);
}

a.card { text-decoration: none; display: block; }
a.card:hover { border-color: var(--cyan-dim); transform: translateY(-2px); }

/* ---------- Chapter list ---------- */

.toc { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line-soft); }
.toc li { border-bottom: 1px solid var(--line-soft); }
.toc a {
  display: flex; align-items: baseline; gap: var(--s-6);
  padding: var(--s-6) var(--s-2); text-decoration: none;
  transition: background 0.25s var(--ease), padding-left 0.25s var(--ease);
}
.toc a:hover { background: var(--bg-raised); padding-left: var(--s-4); }
.toc__num {
  font-family: var(--font-display); font-size: var(--text-sm);
  color: var(--gold-dim); min-width: 2.4rem; flex: none;
  letter-spacing: 0.08em;
}
.toc__title { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.3; }
.toc a:hover .toc__title { color: var(--cyan); }

/* ---------- Prose (book reading) ---------- */

.prose {
  font-family: var(--font-prose);
  font-size: 1.15rem;
  line-height: 1.72;
  max-width: var(--measure);
  color: #dfe2ee;
}
.prose p { margin: 0 0 1.35em; }
.prose p:first-of-type::first-letter {
  font-family: var(--font-display);
  float: left; font-size: 3.6em; line-height: 0.82;
  padding: 0.06em 0.1em 0 0; color: var(--gold);
}
.prose em { color: #eef0f7; }

.chapter-head { margin-bottom: var(--s-12); }
.chapter-head h1 { font-size: var(--text-2xl); margin-bottom: var(--s-4); }

.chapter-nav {
  display: flex; justify-content: space-between; gap: var(--s-6);
  border-top: 1px solid var(--line); padding-top: var(--s-8); margin-top: var(--s-16);
  font-size: var(--text-sm);
}
.chapter-nav a { color: var(--text-muted); text-decoration: none; max-width: 46%; }
.chapter-nav a:hover { color: var(--cyan); }
.chapter-nav span { display: block; font-size: var(--text-xs); color: var(--text-faint); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: var(--s-1); }
.chapter-nav .is-next { text-align: right; margin-left: auto; }

/* ---------- Tools / resources ---------- */

.tool {
  display: grid; grid-template-columns: 1fr auto;
  gap: var(--s-6) var(--s-8); align-items: start;
  padding: var(--s-8) 0; border-bottom: 1px solid var(--line-soft);
}
.tool:first-of-type { border-top: 1px solid var(--line-soft); }
.tool__body { max-width: 42rem; }
.tool__body h3 { margin-bottom: var(--s-2); }
.tool__kind {
  font-size: var(--text-xs); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-dim); display: block; margin-bottom: var(--s-3);
}
.tool__body p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--s-3); }
.tool__note {
  font-size: var(--text-xs); color: var(--text-faint);
  border-left: 2px solid var(--line); padding-left: var(--s-3); margin-bottom: 0;
}
.tool__cta { align-self: center; }
.tool__soon {
  font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint); border: 1px dashed var(--line);
  padding: 0.7rem 1.1rem; border-radius: var(--radius); white-space: nowrap;
}
@media (max-width: 720px) {
  .tool { grid-template-columns: 1fr; }
  .tool__cta { justify-self: start; }
}

/* ---------- Callout ---------- */

.callout {
  background: var(--bg-inset); border: 1px solid var(--line);
  border-left: 2px solid var(--gold-dim);
  border-radius: var(--radius); padding: var(--s-8);
}
.callout h2, .callout h3 { margin-bottom: var(--s-3); }
.callout { max-width: 720px; }
.callout p:last-child { margin-bottom: 0; }
.callout p { color: var(--text-muted); font-size: var(--text-sm); }

.pullquote {
  font-family: var(--font-display); font-size: var(--text-xl);
  line-height: 1.35; color: var(--text); font-style: italic;
  border-left: 2px solid var(--cyan-dim); padding-left: var(--s-6);
  margin: var(--s-12) 0;
}
.pullquote cite { display: block; font-family: var(--font-body); font-style: normal; font-size: var(--text-sm); color: var(--text-faint); margin-top: var(--s-4); letter-spacing: 0.1em; text-transform: uppercase; }

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

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding-block: var(--s-16) var(--s-12);
  margin-top: var(--s-16);
  font-size: var(--text-sm); color: var(--text-faint);
}
.site-footer__grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--s-12); margin-bottom: var(--s-12);
}
.site-footer h4 {
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted);
  margin: 0 0 var(--s-4);
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: var(--s-2); }
.site-footer a { color: var(--text-faint); text-decoration: none; }
.site-footer a:hover { color: var(--cyan); }
.site-footer__legal { border-top: 1px solid var(--line-soft); padding-top: var(--s-6); font-size: var(--text-xs); line-height: 1.6; }
.site-footer__legal p { max-width: 60ch; }
@media (max-width: 720px) {
  .site-footer__grid { grid-template-columns: 1fr; gap: var(--s-8); }
}

/* ---------- Reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
