/* ==========================================================================
   Corelyn — an unbroken chain of permanence
   ========================================================================== */

:root {
  --bg: #F7F2E8;
  --bg-deep: #EFE6D3;
  --bg-dark: #11131B;
  --bg-dark-deep: #171A26;

  --ink: #1B1B1E;
  --ink-soft: #514C46;
  --ink-inverse: #F5F1E6;
  --ink-inverse-soft: rgba(245, 241, 230, 0.68);

  --grey: #B7AE9C;
  --grey-line: #E1D7BE;
  --grey-line-dark: rgba(245, 241, 230, 0.14);

  --burgundy: #6E2A36;
  --burgundy-soft: rgba(110, 42, 54, 0.08);
  --gold: #A9834E;
  --gold-soft: rgba(169, 131, 78, 0.1);

  --accent: var(--burgundy);

  --serif: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max: 1180px;
  --edge: clamp(24px, 6vw, 96px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  animation: fadeIn 0.6s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  color: inherit;
  margin: 0;
  letter-spacing: 0.005em;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--burgundy); color: var(--ink-inverse); }
img, svg { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

.container { max-width: var(--max); margin: 0 auto; padding-left: var(--edge); padding-right: var(--edge); }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

/* ==========================================================================
   Header / Navigation
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 3vw, 34px) var(--edge);
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  z-index: -1;
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(6px);
}

.site-header.is-scrolled::before { opacity: 0.88; border-bottom: 1px solid var(--grey-line); }

.logo {
  font-family: var(--serif);
  font-size: 1.28rem;
  letter-spacing: 0.03em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.logo::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 1px;
  background: var(--burgundy);
  transform: rotate(45deg);
  opacity: 0.85;
}

.nav-desktop { display: flex; gap: clamp(28px, 3vw, 52px); }

.nav-desktop a {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 4px;
}

.nav-desktop a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--gold);
  transition: width 0.4s var(--ease);
}

.nav-desktop a:hover::after, .nav-desktop a.is-active::after { width: 100%; }
.nav-desktop a.is-active { color: var(--burgundy); }

/* Hamburger / close */
.menu-toggle {
  display: none;
  position: relative;
  z-index: 210;
  width: 26px;
  height: 26px;
  color: var(--ink);
  transition: color 0.4s var(--ease);
}

.menu-toggle .icon-burger,
.menu-toggle .icon-close {
  position: absolute;
  inset: 0;
  transition: opacity 0.35s var(--ease), transform 0.4s var(--ease);
}

.menu-toggle .icon-burger { opacity: 1; transform: rotate(0deg) scale(1); }
.menu-toggle .icon-close { opacity: 0; transform: rotate(-45deg) scale(0.6); }

.menu-toggle.is-open { color: var(--gold); }
.menu-toggle.is-open .icon-burger { opacity: 0; transform: rotate(45deg) scale(0.6); }
.menu-toggle.is-open .icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

.nav-mobile {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 20% 25%, rgba(110,42,54,0.22), transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 26px;
  padding: var(--edge);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), visibility 0.5s;
}

.nav-mobile.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-mobile a {
  font-family: var(--serif);
  font-size: 2.15rem;
  font-weight: 500;
  color: var(--ink-inverse);
  position: relative;
}

.nav-mobile a.is-active { color: var(--gold); }

.nav-mobile .nav-mobile-foot {
  margin-top: 24px;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-inverse-soft);
  letter-spacing: 0.04em;
}

@media (max-width: 780px) {
  .nav-desktop { display: none; }
  .menu-toggle { display: block; }
}

/* ==========================================================================
   Ambient backgrounds — signature: the prism & the ledger
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

.hero-field { position: absolute; inset: 0; z-index: 0; }

.hero-field .facet { position: absolute; border-radius: 50%; filter: blur(64px); will-change: transform, opacity; }

.facet-a {
  width: 54vw; height: 54vw; top: -16vw; left: -12vw;
  background: radial-gradient(circle at 40% 40%, rgba(110,42,54,0.07), rgba(110,42,54,0) 68%);
  animation: driftA 34s var(--ease) infinite;
}
.facet-b {
  width: 46vw; height: 46vw; bottom: -18vw; right: -10vw;
  background: radial-gradient(circle at 60% 60%, rgba(27,27,30,0.03), rgba(27,27,30,0) 70%);
  animation: driftB 40s var(--ease) infinite;
}
.facet-c {
  width: 34vw; height: 34vw; top: 26%; left: 58%;
  background: radial-gradient(circle, rgba(169,131,78,0.04), rgba(169,131,78,0) 72%);
  animation: driftC 46s var(--ease) infinite;
}
.facet-d {
  width: 26vw; height: 26vw; top: 55%; left: 8%;
  background: radial-gradient(circle, rgba(27,27,30,0.02), rgba(27,27,30,0) 72%);
  animation: driftD 52s var(--ease) infinite;
}

@keyframes driftA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(4vw,3vw) scale(1.08); } }
@keyframes driftB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-3vw,-4vw) scale(1.05); } }
@keyframes driftC { 0%,100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(-2vw,3vw) rotate(20deg); } }
@keyframes driftD { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(3vw,-2vw) scale(1.1); } }

/* the gem — a faceted signature motif standing in for the "digital twin" */
.gem {
  position: absolute;
  z-index: 1;
  top: 50%; left: 50%;
  width: min(60vw, 620px);
  height: min(60vw, 620px);
  transform: translate(-50%, -50%);
  opacity: 0.9;
  animation: gemSpin 90s linear infinite;
}

@keyframes gemSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.gem svg { width: 100%; height: 100%; overflow: visible; }

.gem-sheen {
  position: absolute;
  inset: 0;
  z-index: 1;
  mix-blend-mode: overlay;
  background: linear-gradient(115deg, transparent 30%, rgba(169,131,78,0.35) 50%, transparent 70%);
  background-size: 260% 260%;
  animation: sheenSweep 9s ease-in-out infinite;
  clip-path: polygon(50% 4%, 88% 26%, 88% 74%, 50% 96%, 12% 74%, 12% 26%);
  transform: translate(0,0);
  width: min(60vw, 620px);
  height: min(60vw, 620px);
  margin: auto;
  top: 0; left: 0; right: 0; bottom: 0;
}

@keyframes sheenSweep {
  0%, 100% { background-position: 0% 0%; opacity: 0.15; }
  50% { background-position: 100% 100%; opacity: 0.32; }
}

/* the ledger — a constellation of nodes, quietly pulsing, echoing lineage */
.ledger {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  pointer-events: none;
}

.ledger circle { animation: nodePulse 6s ease-in-out infinite; }
.ledger line { stroke-dasharray: 4 6; animation: linePulse 10s linear infinite; }

@keyframes nodePulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }
@keyframes linePulse { to { stroke-dashoffset: -100; } }

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--edge);
  max-width: 800px;
}

.hero-mark {
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 28px;
  opacity: 0;
  animation: rise 1.4s var(--ease) 0.2s forwards;
}

.hero-title {
  font-size: clamp(3.4rem, 10vw, 6.6rem);
  line-height: 1;
  opacity: 0;
  background: linear-gradient(100deg, var(--ink) 30%, var(--burgundy) 55%, var(--ink) 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 1.4s var(--ease) 0.4s forwards;
}

.hero-line {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  color: var(--ink-soft);
  margin-top: 30px;
  opacity: 0;
  animation: rise 1.4s var(--ease) 0.65s forwards;
}

.hero-sub {
  font-size: 0.96rem;
  color: var(--ink-soft);
  margin-top: 18px;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: rise 1.4s var(--ease) 0.85s forwards;
}

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.scroll-cue {
  position: absolute;
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  width: 1px; height: 54px;
  background: linear-gradient(to bottom, transparent, var(--grey) 30%, var(--grey) 70%, transparent);
  opacity: 0;
  animation: rise 1.4s var(--ease) 1.1s forwards;
  z-index: 2;
}

.scroll-cue::after {
  content: "";
  position: absolute;
  top: 0; left: -1.5px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
  animation: cueMove 3s ease-in-out infinite;
}

@keyframes cueMove { 0% { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 46px; opacity: 0; } }

/* ==========================================================================
   Section rhythm
   ========================================================================== */

section { position: relative; padding: clamp(90px, 14vw, 180px) 0; }

.section-dark {
  background: var(--bg-dark);
  color: var(--ink-inverse);
}

.section-dark .eyebrow { color: var(--gold); }
.section-dark h2, .section-dark h3 { color: var(--ink-inverse); }
.section-dark p, .section-dark .process-step p { color: var(--ink-inverse-soft); }
.section-dark .process-step + .process-step { border-left-color: var(--grey-line-dark); }
.section-dark .divider { background: var(--gold); }

.section-narrow { max-width: 760px; margin: 0 auto; padding-left: var(--edge); padding-right: var(--edge); }

.section-title { font-size: clamp(2.1rem, 5vw, 3rem); text-align: center; margin-bottom: clamp(40px, 6vw, 64px); }
.section-title.left { text-align: left; }

.lede { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.85; color: var(--ink); text-align: center; font-weight: 400; }
.lede strong, .lede b { font-weight: 600; color: var(--burgundy); }

.divider { width: 44px; height: 1px; background: var(--burgundy); margin: 0 auto; }
.divider.left { margin-left: 0; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Chain motif
   ========================================================================== */

.chain { display: flex; flex-direction: column; align-items: center; }

.chain-link { width: 1px; height: 64px; background: linear-gradient(to bottom, var(--grey-line), var(--grey)); position: relative; }

.chain-link::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--bg);
  transform: translate(-50%, -50%);
}

.section-dark .chain-link { background: linear-gradient(to bottom, var(--grey-line-dark), rgba(245,241,230,0.3)); }
.section-dark .chain-link::before { background: var(--bg-dark); border-color: var(--gold); }

/* ==========================================================================
   Process — three steps (home) and four steps (process page)
   ========================================================================== */

.process-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--edge);
}

.process-step { padding: 0 40px; text-align: center; position: relative; }
.process-step + .process-step { border-left: 1px solid var(--grey-line); }

.process-number {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 1px solid var(--grey-line-dark, var(--grey-line));
}

.process-step:nth-child(1) .process-number,
.process-step:nth-child(2) .process-number,
.process-step:nth-child(3) .process-number { color: var(--burgundy); border-color: var(--burgundy-soft); }

.process-step h3 { font-size: 1.5rem; margin-bottom: 16px; }
.process-step p { color: var(--ink-soft); font-size: 0.98rem; max-width: 320px; margin: 0 auto; }

@media (max-width: 900px) {
  .process-grid { grid-template-columns: 1fr; gap: 56px; }
  .process-step + .process-step { border-left: none; border-top: 1px solid var(--grey-line); padding-top: 56px; }
  .section-dark .process-step + .process-step { border-top-color: var(--grey-line-dark); }
}

/* ==========================================================================
   CTA
   ========================================================================== */

.cta-wrap { text-align: center; margin-top: clamp(56px, 8vw, 90px); }

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--burgundy);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--burgundy);
  transition: gap 0.4s var(--ease), opacity 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.cta-link:hover { gap: 20px; color: var(--gold); border-color: var(--gold); }
.section-dark .cta-link { color: var(--gold); border-color: var(--gold); }
.section-dark .cta-link:hover { color: var(--ink-inverse); border-color: var(--ink-inverse); }

.cta-link .arrow { transition: transform 0.4s var(--ease); }
.cta-link:hover .arrow { transform: translateX(4px); }

/* ==========================================================================
   Essay sections (Philosophy)
   ========================================================================== */

.essay-section { padding: clamp(60px, 10vw, 110px) 0; border-top: 1px solid var(--grey-line); }
.essay-section:first-of-type { border-top: none; }

.essay-index { font-family: var(--serif); font-style: italic; font-size: 1rem; margin-bottom: 18px; display: inline-block; padding-bottom: 4px; border-bottom: 1px solid currentColor; }

.essay-section:nth-of-type(1) .essay-index,
.essay-section:nth-of-type(2) .essay-index,
.essay-section:nth-of-type(3) .essay-index { color: var(--burgundy); }

.essay-section h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 26px; max-width: 620px; }
.essay-section p { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-soft); max-width: 620px; line-height: 1.9; }

/* ==========================================================================
   Process page — vertical sequence
   ========================================================================== */

.sequence { max-width: 760px; margin: 0 auto; padding: 0 var(--edge); }

.sequence-item { display: grid; grid-template-columns: 88px 1fr; gap: 32px; padding: 48px 0; }
.sequence-item:first-child { padding-top: 0; }

.sequence-index { font-family: var(--serif); font-size: 1.6rem; font-style: italic; }
.sequence-item .sequence-index { color: var(--burgundy); }

.sequence-item h3 { font-size: 1.5rem; margin-bottom: 14px; }
.sequence-item p { color: var(--ink-soft); font-size: 1.02rem; max-width: 480px; }

@media (max-width: 620px) {
  .sequence-item { grid-template-columns: 40px 1fr; gap: 20px; }
  .sequence-index { font-size: 1.2rem; }
  .sequence .chain { margin-left: 18px !important; }
}

/* ==========================================================================
   Introduction page
   ========================================================================== */

.intro-hero { padding-top: clamp(140px, 20vw, 220px); text-align: center; position: relative; }

.intro-body { max-width: 640px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.intro-body p { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--ink-soft); margin-top: 22px; }

.email-link {
  display: inline-block;
  margin: 44px 0;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  color: var(--burgundy);
  border-bottom: 1px solid var(--grey-line);
  transition: opacity 0.4s var(--ease), border-color 0.4s var(--ease);
}

.email-link:hover { opacity: 0.7; border-color: var(--burgundy); }

.guidelines {
  max-width: 560px;
  margin: 56px auto 0;
  text-align: left;
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--grey-line);
  padding-top: 40px;
}

.guidelines li { position: relative; padding-left: 28px; margin-bottom: 20px; color: var(--ink-soft); font-size: 1rem; line-height: 1.75; }

.guidelines li::before {
  content: "";
  position: absolute;
  left: 0; top: 11px;
  width: 5px; height: 5px;
  border-radius: 50%;
  border: 1px solid var(--burgundy);
}

.closing-statement {
  margin-top: 64px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  color: var(--ink);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--grey-line); padding: 48px var(--edge) 56px; background: var(--bg); }

.footer-inner { max-width: var(--max); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }

.footer-logo { font-family: var(--serif); font-size: 1.05rem; }

.footer-meta { font-size: 0.78rem; color: var(--ink-soft); letter-spacing: 0.03em; display: flex; gap: 28px; flex-wrap: wrap; }
.footer-meta a:hover { color: var(--burgundy); }

@media (max-width: 560px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}