/* orejarena.org — the paper edition. Always light, by decision.
   Brand rule: the sienna accent appears only on the hero rule and on hover/focus — nowhere else. */

:root {
  --paper: #F2EEE7;
  --paper-raised: #F8F5EF;
  --ink: #2E2B28;
  --ink-soft: #4E4A44;
  --muted: #6E695F;
  --warm-ink: #715A5A;
  --warm-line: #715A5A;
  --rule: #D9D2C4;
  --sienna: #8B3A2F;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;
  --pad-x: clamp(1.25rem, 4vw, 2rem);
  --grain-opacity: 0.05;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain — the page as physical document */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256' viewBox='0 0 256 256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: #715A5A;
  color: var(--paper);
}

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

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--pad-x);
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus {
  top: 0.5rem;
}

/* ── Header ── */

.site-header {
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--sienna);
}

/* ── Hero ── */

.hero {
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: clamp(4rem, 12vh, 8rem);
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

/* Constellation: interactive map living behind the hero.
   The text sits above it; pointer interaction happens in the open space. */
.constellation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  touch-action: pan-y; /* node drag must not trap page scroll on touch */
  animation: constellation-in 2.2s ease 0.9s both;
}

@keyframes constellation-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm-ink);
  margin: 0 0 2.4rem;
  animation: hero-in 0.9s ease both;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 7.5vw, 5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.6rem;
  animation: hero-in 0.9s ease 0.15s both;
}

.hero-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 2.6rem;
  animation: hero-in 0.9s ease 0.3s both;
}

.hero-rule {
  width: 64px;
  height: 2px;
  background: var(--sienna);
  margin: 0 0 2.4rem;
  transform-origin: left;
  animation: rule-in 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.45s both;
}

.hero-intro {
  max-width: 620px;
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0;
  text-wrap: pretty;
  animation: hero-in 0.9s ease 0.6s both;
}

/* ── Sections: mobile head, wide-screen marginalia ── */

.section {
  padding-top: clamp(3.5rem, 9vh, 6rem);
  padding-bottom: clamp(3.5rem, 9vh, 6rem);
  scroll-margin-top: 1.2rem;
}
.section-last {
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

.section-marker {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.6rem;
}
.section-no {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--warm-ink);
  margin: 0;
}
.section-marker h2 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm-ink);
  margin: 0;
}
.section-marker::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

@media (min-width: 1080px) {
  .section {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    column-gap: 2.5rem;
  }
  .section-marker {
    display: block;
    position: sticky;
    top: 2.2rem;
    align-self: start;
    margin: 0.35rem 0 0;
  }
  .section-no {
    margin: 0 0 0.45rem;
  }
  .section-marker::after {
    content: '';
    display: block;
    flex: none;
    width: 2rem;
    height: 1px;
    margin-top: 1.1rem;
    background: var(--rule);
  }
  .section-body {
    grid-column: 2;
    min-width: 0;
  }
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 2rem;
  max-width: 680px;
  text-wrap: balance;
}
#research .lede { margin-bottom: 2.2rem; }
#essays .lede { margin-bottom: 2.4rem; }
#correspondence .lede { margin-bottom: 1.6rem; }

/* ── Trajectory ── */

.trajectory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem 3.5rem;
}
.trajectory-grid p {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0;
}

/* ── Research ── */

.doc-card {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: clamp(1.6rem, 4vw, 2.5rem);
}
.doc-card + .doc-card {
  margin-top: 1.5rem;
}

.doc-kicker {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warm-ink);
  margin: 0 0 1rem;
}

.doc-title {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 1rem;
  text-wrap: pretty;
}

.doc-abstract {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0;
  max-width: 640px;
}

.doc-link {
  display: inline-block;
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--warm-line);
  padding-bottom: 2px;
}
.doc-link:hover,
.doc-link:focus-visible {
  color: var(--sienna);
  border-bottom-color: var(--sienna);
}

/* ── Essays ── */

.essay-groups {
  display: flex;
  flex-direction: column;
  gap: 2.8rem;
}

.essay-axis {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

.essay-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: clamp(1.4rem, 3.5vw, 2.2rem);
  transition: border-color 0.3s;
}
.essay-card:hover,
.essay-card:focus-visible {
  border-color: var(--sienna);
}

.essay-card h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.essay-meta {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--warm-ink);
  margin: 0 0 1rem;
}

.essay-excerpt {
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
  max-width: 620px;
}

.substack-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--warm-ink);
  margin: 2.4rem 0 0;
  max-width: 620px;
}
.substack-note a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--warm-line);
  padding-bottom: 1px;
}
.substack-note a:hover,
.substack-note a:focus-visible {
  color: var(--sienna);
  border-bottom-color: var(--sienna);
}

/* ── Correspondence ── */

.contact-prose {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  max-width: 620px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2.5rem;
}
.contact-links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--warm-line);
  padding-bottom: 2px;
}
.contact-links a:hover,
.contact-links a:focus-visible {
  color: var(--sienna);
  border-bottom-color: var(--sienna);
}

/* ── Shared prose niceties ── */

.trajectory-grid p,
.doc-abstract,
.essay-excerpt,
.contact-prose {
  font-variant-numeric: oldstyle-nums;
  text-wrap: pretty;
}

/* ── Footer & the zamuro vigil, perched on the footer line ── */

.site-footer {
  position: relative;
  border-top: 1px solid var(--rule);
}

.vigil-mark {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -26px);
  pointer-events: none;
  opacity: 0;
  color: var(--warm-line);
  transition: opacity 2.4s ease, transform 2.4s ease;
}
.vigil-mark.visible {
  opacity: 1;
  transform: translate(-50%, -14px);
}

.footer-inner {
  padding-top: 2.2rem;
  padding-bottom: 2.2rem;
  text-align: center;
}

.footer-line {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.footer-colophon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--warm-ink);
  margin: 0;
}

/* ── Motion: one orchestrated moment on load, then stillness ── */

@keyframes hero-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rule-in {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

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

/* ── Print ── */

@media print {
  body::before { display: none; }
  .skip-link, .site-nav { display: none; }
  .vigil-mark { opacity: 1; }
}
