/* ============================================================
   Ramjan Diaries · Vol. I
   Editorial Manuscript — a designed literary object.
   ============================================================ */

:root {
  --ink:        #0b0908;   /* deep ink — page */
  --ink-2:      #14110d;   /* slightly lifted ink */
  --cream:      #ede5d3;   /* warm off-white — primary text */
  --cream-dim:  #a89d88;   /* faded ink — secondary text */
  --cream-mute: #6b6358;   /* marginalia */
  --rule:       rgba(237, 229, 211, 0.14);
  --rule-dim:   rgba(237, 229, 211, 0.08);
  --rust:       #c14a2e;   /* single accent — sparingly */
  --rust-dim:   #8a3520;

  --serif:  'EB Garamond', 'Cormorant Garamond', 'Source Serif 4', Georgia, serif;
  --display:'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --mono:   'JetBrains Mono', ui-monospace, monospace;

  --measure: 36rem;          /* ~580px reading width */
  --measure-wide: 44rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.7;
  color: var(--cream);
  background: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "onum" 1;
}

/* Linen paper texture overlay — barely there */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 0.94 0 0 0 0 0.85 0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Top edge vignette — like an open book's gutter shadow */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.45) 0, transparent 8%),
    radial-gradient(120% 80% at 50% 100%, rgba(0,0,0,0.4) 0, transparent 50%);
}

::selection { background: var(--rust); color: var(--cream); }

/* ============================================================
   Typography rhythm
   ============================================================ */

h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 500;
  font-style: normal;
  line-height: 1.05;
  letter-spacing: -0.012em;
  color: var(--cream);
}

h1 { font-size: clamp(3rem, 8vw, 6.4rem); font-weight: 500; }
h2 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); margin-bottom: 0.5em; }
h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin-bottom: 0.4em; }
h4 { font-size: 1.2rem; }

p { color: var(--cream); margin-bottom: 1.2em; }
p + p { text-indent: 1.6em; }    /* classical paragraph indent */
p strong { font-weight: 600; }
p em { font-style: italic; color: var(--cream); }

a { color: inherit; text-decoration: none; }
a.link {
  color: var(--cream);
  background-image: linear-gradient(var(--rust), var(--rust));
  background-position: 0 100%;
  background-size: 100% 1px;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease);
  padding-bottom: 1px;
}
a.link:hover { background-size: 100% 100%; color: var(--cream); padding-bottom: 0; }

strong { font-weight: 600; }

/* Mono details */
.smallcaps, .mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-mute);
  font-feature-settings: normal;
}
.smallcaps.accent, .mono.accent { color: var(--rust); }

/* ============================================================
   Page chrome — masthead and footer
   ============================================================ */

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 24px 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 9, 8, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.masthead-inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.masthead .title-block {
  font-family: var(--display);
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--cream);
}
.masthead .vol {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--cream-mute);
  text-transform: uppercase;
}
.masthead nav {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.masthead nav a {
  color: var(--cream-dim);
  transition: color 0.25s var(--ease);
  position: relative;
}
.masthead nav a:hover { color: var(--cream); }
.masthead nav a.active { color: var(--rust); }
.masthead nav a.active::before {
  content: '·';
  position: absolute;
  left: -14px;
  color: var(--rust);
}
@media (max-width: 760px) {
  .masthead-inner { flex-wrap: wrap; }
  .masthead nav { width: 100%; gap: 18px; justify-content: flex-start; flex-wrap: wrap; }
}

/* ============================================================
   Reading container
   ============================================================ */

.page {
  padding: 80px 0 120px;
}
.col {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 32px;
}
.col-wide {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 32px;
}

/* ============================================================
   Cover page (home)
   ============================================================ */

.cover {
  min-height: calc(100vh - 76px);
  padding: 100px 0 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cover-inner {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 32px;
  text-align: center;
}
.cover .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 18px;
}
.cover .label::before,
.cover .label::after {
  content: '';
  width: 32px; height: 1px;
  background: var(--cream-mute);
}
.cover h1 {
  font-size: clamp(3.4rem, 9vw, 8rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.cover h1 em {
  font-style: italic;
  color: var(--rust);
  font-weight: 400;
}
.cover .subtitle {
  font-style: italic;
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  color: var(--cream-dim);
  margin: 32px auto 0;
  max-width: 38ch;
  line-height: 1.6;
}
.cover .byline {
  margin-top: 56px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cover .byline span:not(:last-child)::after {
  content: '·';
  margin-left: 24px;
  color: var(--cream-mute);
}

/* Asterism — section divider */
.asterism {
  text-align: center;
  margin: 80px 0;
  color: var(--cream-mute);
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 1em;
  padding-left: 1em;
  user-select: none;
}
.asterism::before { content: '✻ ✻ ✻'; }

/* Single-rule divider */
.rule {
  width: 80px;
  height: 1px;
  background: var(--cream-mute);
  margin: 60px auto;
}

/* ============================================================
   Table of contents (cover page)
   ============================================================ */
.contents {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 32px;
}
.contents h2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cream-mute);
  text-align: center;
  margin-bottom: 50px;
  font-weight: 400;
  letter-spacing: 0.4em;
}
.contents h2::before,
.contents h2::after {
  content: '— ';
  color: var(--cream-mute);
}
.contents h2::after { content: ' —'; }

.contents ol { list-style: none; }
.contents .entry {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule-dim);
  text-decoration: none;
  color: var(--cream);
  transition: padding 0.4s var(--ease), color 0.35s var(--ease);
}
.contents .entry:first-child { border-top: 1px solid var(--rule-dim); }
.contents .entry:hover { padding-left: 14px; }
.contents .entry:hover .entry-title { color: var(--rust); }
.contents .entry .ix {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--cream-mute);
  font-feature-settings: "tnum" 1;
}
.contents .entry-title {
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1.2;
  transition: color 0.35s var(--ease);
}
.contents .entry-title small {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--cream-dim);
  font-weight: 400;
  margin-top: 8px;
  line-height: 1.5;
}
.contents .entry .page-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cream-mute);
  white-space: nowrap;
}

/* ============================================================
   Article (chapter page)
   ============================================================ */

.article-head {
  text-align: center;
  padding: 80px 0 70px;
  border-bottom: 1px solid var(--rule-dim);
  margin-bottom: 70px;
  max-width: var(--measure-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: 32px;
  padding-right: 32px;
}
.article-head .chapter-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.article-head .chapter-num::before,
.article-head .chapter-num::after {
  content: '';
  width: 24px; height: 1px;
  background: var(--rust);
}
.article-head h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 400;
  line-height: 1.05;
  margin-bottom: 28px;
}
.article-head h1 em { font-style: italic; color: var(--cream); }
.article-head .lede {
  font-style: italic;
  font-size: clamp(1.15rem, 1.7vw, 1.35rem);
  color: var(--cream-dim);
  max-width: 38ch;
  margin: 0 auto;
  line-height: 1.5;
}

.article {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 32px;
}

.article p {
  font-size: clamp(1.1rem, 1.3vw, 1.22rem);
  line-height: 1.7;
  color: var(--cream);
}
.article h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 80px 0 28px;
  line-height: 1.15;
  color: var(--cream);
}
.article h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem;
  margin: 50px 0 16px;
  color: var(--cream);
}

/* Drop cap on first paragraph after lede */
.article > p.dropcap::first-letter,
.article p.dropcap::first-letter {
  float: left;
  font-family: var(--display);
  font-weight: 500;
  font-size: 5.2em;
  line-height: 0.8;
  padding: 0.06em 0.12em 0 0;
  color: var(--rust);
  margin-right: 0.06em;
}

/* Pull quote — breaks out of column */
.pullquote {
  margin: 60px calc(50% - 50vw);
  max-width: 100vw;
  padding: 0 8vw;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 3.6vw, 3rem);
  line-height: 1.25;
  color: var(--cream);
  letter-spacing: -0.005em;
}
.pullquote::before, .pullquote::after {
  content: '“';
  color: var(--rust);
  font-size: 1.2em;
  vertical-align: -0.15em;
  margin-right: 0.05em;
}
.pullquote::after { content: '”'; margin-left: 0.05em; margin-right: 0; }
.pullquote cite {
  display: block;
  margin-top: 24px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-mute);
}

/* Marginalia — side notes */
.marginalia {
  position: relative;
}
.marginalia .note {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.05em;
  color: var(--cream-mute);
  border-left: 1px solid var(--rust);
  padding-left: 14px;
  margin: 28px 0;
}
@media (min-width: 1100px) {
  .marginalia .note {
    position: absolute;
    right: calc(-22rem - 32px);
    top: 0;
    width: 18rem;
    margin: 0;
    padding-left: 18px;
  }
}

/* Captioned figure block (no images, but reserves layout) */
.figure {
  margin: 60px 0;
}
.figure .ornament {
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  color: var(--rust);
  font-size: 1.4rem;
  margin: 20px 0;
}
.figure figcaption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-mute);
  text-align: center;
  margin-top: 12px;
}

/* Inline list — manuscript register */
.register {
  list-style: none;
  margin: 40px 0 50px;
  padding: 0;
  border-top: 1px solid var(--rule-dim);
  border-bottom: 1px solid var(--rule-dim);
}
.register li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-dim);
  font-size: 1rem;
}
.register li:last-child { border-bottom: none; }
.register li .name {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--cream);
}
.register li .meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-mute);
  flex-shrink: 0;
}
.register li .dots {
  flex: 1;
  border-bottom: 1px dotted var(--cream-mute);
  margin: 0 14px;
  position: relative;
  top: -5px;
  opacity: 0.5;
}

/* The case file — numbered annotated cases (Events) */
.case {
  padding: 50px 0;
  border-bottom: 1px solid var(--rule-dim);
}
.case:last-of-type { border-bottom: none; }
.case .case-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 14px;
  display: flex;
  gap: 24px;
}
.case h3 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 16px;
  font-weight: 500;
}
.case p {
  font-size: 1.08rem;
  color: var(--cream);
  line-height: 1.7;
  margin: 0;
}
.case p + p { text-indent: 0; margin-top: 0.8em; }

/* The affair — annotated three-part personal life */
.affair {
  padding: 60px 0;
  border-bottom: 1px solid var(--rule-dim);
}
.affair:last-of-type { border-bottom: none; }
.affair .num {
  font-family: var(--display);
  font-style: italic;
  font-size: 4rem;
  font-weight: 400;
  color: var(--rust);
  line-height: 1;
  margin-bottom: 14px;
  display: block;
}
.affair h3 {
  font-family: var(--display);
  font-style: italic;
  font-size: 2rem;
  font-weight: 400;
  margin: 0 0 24px;
}
.affair p {
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--cream);
  margin-bottom: 1em;
}
.affair p + p { text-indent: 1.6em; }

/* Declaration — short emphatic standalone line */
.declaration {
  text-align: center;
  margin: 100px 0;
  padding: 60px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.declaration .small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-bottom: 24px;
  display: block;
}
.declaration .big {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-style: italic;
  line-height: 1.2;
  color: var(--cream);
}
.declaration .big em {
  color: var(--rust);
  font-style: italic;
}

/* ============================================================
   Chapter footer navigation
   ============================================================ */
.chapter-foot {
  max-width: var(--measure-wide);
  margin: 100px auto 0;
  padding: 50px 32px 0;
  border-top: 1px solid var(--rule-dim);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}
.chapter-foot a {
  display: block;
  text-decoration: none;
  color: var(--cream);
  transition: color 0.3s var(--ease);
}
.chapter-foot a:hover { color: var(--rust); }
.chapter-foot a:hover .step { color: var(--rust); }
.chapter-foot .prev { text-align: left; }
.chapter-foot .next { text-align: right; }
.chapter-foot .home { text-align: center; }
.chapter-foot .step {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-bottom: 8px;
  transition: color 0.3s var(--ease);
}
.chapter-foot .label {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
}
.chapter-foot .home a {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
}
.chapter-foot .home a:hover { color: var(--rust); }
@media (max-width: 700px) {
  .chapter-foot { grid-template-columns: 1fr; text-align: center !important; }
  .chapter-foot .prev, .chapter-foot .next { text-align: center; }
}

/* ============================================================
   Resume — literary CV
   ============================================================ */

.cv-head {
  text-align: center;
  padding: 80px 0 50px;
  border-bottom: 1px solid var(--rule-dim);
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}
.cv-head .small {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 24px;
}
.cv-head h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 400;
  margin-bottom: 20px;
}
.cv-head .role {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  color: var(--cream-dim);
}
.cv-head .contacts {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cv-head .contacts a { color: var(--cream-dim); transition: color 0.25s var(--ease); }
.cv-head .contacts a:hover { color: var(--rust); }
.cv-head .contacts span:not(:last-child)::after {
  content: '·';
  margin-left: 24px;
  color: var(--cream-mute);
}

.cv {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 60px 32px 0;
}
.cv section { margin-bottom: 90px; }
.cv h2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 36px;
  text-align: center;
}
.cv h2::before, .cv h2::after {
  content: '— ';
  color: var(--cream-mute);
}
.cv h2::after { content: ' —'; }

.cv .about {
  max-width: var(--measure);
  margin: 0 auto;
}
.cv .about p {
  font-size: 1.15rem;
  line-height: 1.75;
  font-style: italic;
}
.cv .about p:first-of-type::first-letter {
  float: left;
  font-family: var(--display);
  font-weight: 500;
  font-style: normal;
  font-size: 4.4em;
  line-height: 0.85;
  padding: 0.04em 0.12em 0 0;
  color: var(--rust);
  margin-right: 0.04em;
}

/* Project entries — like a publication list */
.cv .work {
  max-width: var(--measure);
  margin: 0 auto;
  list-style: none;
}
.cv .work > li {
  padding: 36px 0;
  border-bottom: 1px solid var(--rule-dim);
}
.cv .work > li:first-child { border-top: 1px solid var(--rule-dim); }
.cv .work .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cv .work .head h3 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
  color: var(--cream);
  flex: 1 1 auto;
}
.cv .work .head .when {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-mute);
}
.cv .work .role {
  font-family: var(--display);
  font-style: italic;
  font-size: 1rem;
  color: var(--cream-dim);
  margin-bottom: 14px;
}
.cv .work .summary {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--cream);
  margin-bottom: 14px;
}
.cv .work .stack {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--cream-mute);
  margin-top: 10px;
}
.cv .work .stack span:not(:last-child)::after {
  content: ' · ';
  margin: 0 4px;
}

/* Skills & details — two-column register */
.cv .grid {
  max-width: var(--measure-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 60px;
}
@media (max-width: 700px) { .cv .grid { grid-template-columns: 1fr; gap: 30px; } }
.cv .grid h4 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-bottom: 16px;
}
.cv .grid ul {
  list-style: none;
}
.cv .grid li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-dim);
  font-size: 1rem;
}
.cv .grid li:last-child { border-bottom: none; }
.cv .grid li .k { color: var(--cream-dim); font-style: italic; }
.cv .grid li .v { color: var(--cream); }

.cv .closing {
  max-width: var(--measure);
  margin: 0 auto;
  text-align: center;
}
.cv .closing p {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--cream-dim);
  margin-bottom: 24px;
}
.cv .closing a.cta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rust);
  border: 1px solid var(--rust);
  padding: 16px 28px;
  display: inline-block;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.cv .closing a.cta:hover { background: var(--rust); color: var(--ink); }

/* ============================================================
   Cover: signoff + connect
   ============================================================ */
.signoff {
  max-width: 36rem;
  margin: 100px auto 0;
  padding: 0 32px;
  text-align: center;
}
.signoff p {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--cream-dim);
  margin-bottom: 30px;
}
.signoff .links {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.signoff .links a {
  color: var(--cream);
  transition: color 0.25s var(--ease);
  position: relative;
  padding-bottom: 4px;
}
.signoff .links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 100%;
  height: 1px;
  background: var(--rust);
  transition: right 0.35s var(--ease);
}
.signoff .links a:hover { color: var(--rust); }
.signoff .links a:hover::after { right: 0; }

/* ============================================================
   Bottom colophon
   ============================================================ */
.colophon {
  max-width: 60rem;
  margin: 120px auto 0;
  padding: 40px 32px;
  border-top: 1px solid var(--rule-dim);
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-mute);
  line-height: 2;
}
.colophon .name {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--cream);
  margin-bottom: 8px;
  display: block;
}

/* ============================================================
   Reveal-on-scroll (subtle, editorial)
   Applied only to specific sub-sections via the `.reveal-soft` class.
   The plain `.reveal` keeps the markup hook but no longer hides content,
   so chapter articles remain readable even if IntersectionObserver
   misses them on initial paint.
   ============================================================ */
.reveal { opacity: 1; transform: none; }
.reveal-soft {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.reveal-soft.in { opacity: 1; transform: translateY(0); }

/* Reading progress — single hairline at top */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--rust);
  width: 0;
  z-index: 100;
  transition: width 0.1s linear;
}

/* ============================================================
   INTERACTIVE LAYER
   ============================================================ */

/* --- Paper mode (the cream alternate) ------------------- */
[data-theme="paper"] {
  --ink:        #f3ede0;
  --ink-2:      #ebe3d2;
  --cream:      #1a1612;
  --cream-dim:  #5a504a;
  --cream-mute: #8a7e72;
  --rule:       rgba(26, 22, 18, 0.18);
  --rule-dim:   rgba(26, 22, 18, 0.10);
  --rust:       #a8311b;
  --rust-dim:   #c14a2e;
}
[data-theme="paper"] .masthead { background: rgba(243, 237, 224, 0.94); }
[data-theme="paper"] body::after {
  background:
    linear-gradient(180deg, rgba(80, 60, 40, 0.18) 0, transparent 8%),
    radial-gradient(120% 80% at 50% 100%, rgba(80, 60, 40, 0.15) 0, transparent 50%);
}
[data-theme="paper"] body::before { opacity: 0.06; mix-blend-mode: multiply; }
/* Theme swap is instant — CSS transitions don't fire on var() changes
   without @property registration, and a snappy swap suits a reading app. */

/* Theme toggle button (in masthead) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--cream-dim);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  flex-shrink: 0;
  padding: 0;
  margin-left: 18px;
}
.theme-toggle:hover { color: var(--rust); border-color: var(--rust); transform: rotate(20deg); }
.theme-toggle svg { width: 14px; height: 14px; }
.masthead-inner { align-items: center; }

/* --- Focus reading mode --------------------------------- */
.focus-active .article p,
.focus-active .article h2,
.focus-active .article h3,
.focus-active .article .pullquote,
.focus-active .article .case,
.focus-active .article .affair,
.focus-active .article .register,
.focus-active .article .declaration,
.focus-active .cv .work > li,
.focus-active .cv .about p {
  opacity: 0.18;
  filter: blur(0.4px);
  transition: opacity 0.45s var(--ease), filter 0.45s var(--ease);
}
.focus-active .focused,
.focus-active .focused * { opacity: 1 !important; filter: none !important; }
.focus-active .focused {
  position: relative;
}
.focus-active .focused::before {
  content: '';
  position: absolute;
  left: -28px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--rust);
  border-radius: 1px;
  animation: focus-bar 0.4s var(--ease);
}
@keyframes focus-bar {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}

/* Hint that paragraphs are focusable */
.article p, .cv .about p, .cv .work > li, .case, .affair {
  cursor: pointer;
  transition: opacity 0.45s var(--ease), filter 0.45s var(--ease);
}

/* Floating focus-mode badge */
.focus-badge {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 90;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
  background: var(--ink);
  border: 1px solid var(--rule);
  padding: 10px 18px;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  backdrop-filter: blur(6px);
}
.focus-badge.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.focus-badge kbd {
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 6px;
  margin: 0 4px;
  color: var(--rust);
  font-size: 9px;
}

/* --- Margin footnotes (dagger notes) -------------------- */
.note {
  position: relative;
  cursor: pointer;
  border-bottom: 1px dashed var(--rust);
  color: var(--cream);
  transition: color 0.25s var(--ease);
}
.note:hover { color: var(--rust); }
.note::after {
  content: '†';
  display: inline-block;
  margin-left: 2px;
  font-size: 0.75em;
  vertical-align: super;
  color: var(--rust);
  font-family: var(--display);
}

/* Inline expansion (default + mobile) */
.note .note-body {
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--cream-mute);
  border-left: 2px solid var(--rust);
  padding: 12px 0 12px 14px;
  margin: 18px 0;
  font-style: normal;
  text-transform: none;
  text-indent: 0;
}
.note.open .note-body {
  display: block;
  animation: note-in 0.4s var(--ease);
}
@keyframes note-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Margin float on wide screens */
@media (min-width: 1100px) {
  .note .note-body {
    position: absolute;
    left: calc(100% + 32px);
    top: -4px;
    width: 14rem;
    margin: 0;
    background: var(--ink);
    z-index: 5;
  }
}

/* --- Reading time stamp --------------------------------- */
.read-time {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-top: 28px;
}
.read-time::before {
  content: '';
  width: 16px; height: 1px;
  background: var(--cream-mute);
}
.read-time::after {
  content: '';
  width: 16px; height: 1px;
  background: var(--cream-mute);
}

/* --- Quote selection tooltip ---------------------------- */
.quote-tip {
  position: fixed;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--cream);
  color: var(--ink);
  border-radius: 100px;
  padding: 0;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.22s var(--ease);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  overflow: hidden;
}
.quote-tip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.quote-tip button {
  background: transparent;
  border: 0;
  padding: 10px 16px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s var(--ease);
}
.quote-tip button:hover { background: rgba(0,0,0,0.08); }
.quote-tip button + button { border-left: 1px solid rgba(0,0,0,0.12); }
.quote-tip svg { width: 12px; height: 12px; }
.quote-tip.copied button { color: var(--rust); }

/* Keyboard nav hint (briefly shown on chapter pages) */
.kbd-hint {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 88;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-mute);
  background: var(--ink);
  border: 1px solid var(--rule);
  padding: 10px 16px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  backdrop-filter: blur(6px);
}
.kbd-hint.show { opacity: 1; transform: translateY(0); }
.kbd-hint kbd {
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--rust);
  font-size: 9px;
}

/* ============================================================
   CASE FILE — dossier trigger + overlay
   ============================================================ */

/* Trigger button on each case */
.case-open {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--cream-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  padding: 11px 18px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}
.case-open::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--rust);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 var(--rust);
  animation: case-pulse 2.6s var(--ease) infinite;
}
@keyframes case-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(193,74,46,0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(193,74,46,0); }
  100% { box-shadow: 0 0 0 0 rgba(193,74,46,0); }
}
.case-open:hover {
  border-color: var(--rust);
  color: var(--cream);
}
.case-open .x {
  transition: transform 0.3s var(--ease);
}
.case-open:hover .x { transform: translateX(4px); }

/* Overlay scrim */
.dossier-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 24px 24px;
  overflow-y: auto;
  background: rgba(4, 3, 2, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.dossier-overlay.open { opacity: 1; pointer-events: auto; }

/* The dossier document */
.dossier {
  position: relative;
  width: 100%;
  max-width: 44rem;
  background:
    linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--rule);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.8);
  transform: translateY(30px) scale(0.98);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.dossier-overlay.open .dossier { transform: translateY(0) scale(1); opacity: 1; }

/* Perforated top edge — like a torn folder */
.dossier::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--rust);
}

.dossier-inner { padding: 48px 48px 56px; }
@media (max-width: 640px) { .dossier-inner { padding: 36px 24px 40px; } }

/* Header */
.dossier-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.dossier-head .file-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cream-mute);
  margin-bottom: 14px;
}
.dossier-head .ref {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--rust);
}
.dossier-head h2 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  margin: 12px 0 0;
  line-height: 1.05;
}
/* CASE FILE stamp */
.dossier-stamp {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rust);
  border: 2px solid var(--rust);
  border-radius: 4px;
  padding: 8px 12px;
  text-align: center;
  line-height: 1.4;
  transform: rotate(7deg);
  opacity: 0.85;
  margin-top: 6px;
}
.dossier-stamp b { display: block; font-size: 13px; letter-spacing: 0.12em; }

/* Field grid */
.dossier-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 30px 0 10px;
  border: 1px solid var(--rule-dim);
}
@media (max-width: 540px) { .dossier-fields { grid-template-columns: 1fr; } }
.dossier-fields .field {
  padding: 16px 18px;
  border-right: 1px solid var(--rule-dim);
  border-bottom: 1px solid var(--rule-dim);
}
.dossier-fields .field:nth-child(2n) { border-right: none; }
@media (max-width: 540px) { .dossier-fields .field { border-right: none; } }
.dossier-fields .field.full { grid-column: 1 / -1; }
.dossier-fields .k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cream-mute);
  display: block;
  margin-bottom: 7px;
}
.dossier-fields .v {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--cream);
}
.dossier-fields .v.status {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--rust);
}

/* Sections */
.dossier-section { margin: 36px 0; }
.dossier-section .sec-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.dossier-section .sec-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-dim);
}
.dossier-section p {
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--cream);
  margin-bottom: 1em;
}
.dossier-section p:first-of-type { text-indent: 0; }
.dossier-section p + p { text-indent: 1.4em; }

/* Persons list */
.dossier-persons { list-style: none; }
.dossier-persons li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-dim);
}
.dossier-persons li:last-child { border-bottom: none; }
.dossier-persons .role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-mute);
}
.dossier-persons .who {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--cream);
}

/* Exhibits */
.dossier-exhibits { list-style: none; }
.dossier-exhibits li {
  position: relative;
  padding: 8px 0 8px 30px;
  font-size: 1.02rem;
  color: var(--cream);
  border-bottom: 1px dotted var(--rule-dim);
}
.dossier-exhibits li:last-child { border-bottom: none; }
.dossier-exhibits li::before {
  content: 'EX. ' counter(exhibit);
  counter-increment: exhibit;
  position: absolute;
  left: 0; top: 11px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--rust);
}
.dossier-exhibits { counter-reset: exhibit; }

/* Verdict / findings box */
.dossier-verdict {
  margin: 36px 0;
  padding: 24px 26px;
  border: 1px solid var(--rust);
  background: rgba(193, 74, 46, 0.06);
}
.dossier-verdict .sec-label { color: var(--rust); }
.dossier-verdict p { margin: 0; font-style: italic; font-size: 1.1rem; }

/* Subject's remark — handwritten feel */
.dossier-remark {
  margin: 36px 0 0;
  padding-left: 22px;
  border-left: 2px solid var(--rust);
}
.dossier-remark .sec-label { color: var(--cream-mute); }
.dossier-remark p {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--cream);
  margin: 0;
}

/* ---- CONFIDENTIAL banner across the dossier head ---- */
.dossier-confidential {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 4px;
  padding: 9px 16px;
  border: 1px solid var(--rust);
  background: repeating-linear-gradient(
    -45deg,
    rgba(193, 74, 46, 0.10) 0, rgba(193, 74, 46, 0.10) 10px,
    transparent 10px, transparent 20px
  );
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--rust);
  font-weight: 500;
}
.dossier-confidential::before {
  content: '';
  width: 9px; height: 9px;
  background: var(--rust);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--rust);
}
.dossier-confidential .spacer { flex: 1; }
.dossier-confidential .eyes { letter-spacing: 0.2em; opacity: 0.7; }

/* ---- Photographic evidence gallery ---- */
.dossier-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 6px;
}
@media (max-width: 560px) { .dossier-photos { grid-template-columns: 1fr; } }

.evidence {
  position: relative;
  background: #f3ede0;
  padding: 10px 10px 0;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: 0 14px 30px -12px rgba(0,0,0,0.7);
  transform: rotate(var(--tilt, -1deg));
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.evidence:nth-child(even) { --tilt: 1.2deg; }
.evidence:nth-child(3n)   { --tilt: -1.6deg; }
.evidence:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 24px 50px -14px rgba(0,0,0,0.8);
  z-index: 2;
}
/* tape strip on top */
.evidence::before {
  content: '';
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 84px; height: 20px;
  background: rgba(232, 224, 200, 0.55);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.evidence .shot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #15110c;
}
.evidence .shot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(1.04) brightness(0.96);
}
/* per-photo CONFIDENTIAL corner stamp */
.evidence .stamp {
  position: absolute;
  top: 8px; right: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c14a2e;
  border: 1.5px solid #c14a2e;
  border-radius: 3px;
  padding: 3px 6px;
  transform: rotate(8deg);
  background: rgba(243, 237, 224, 0.8);
  font-weight: 600;
  pointer-events: none;
}
/* exhibit letter tab */
.evidence .ex {
  position: absolute;
  bottom: 8px; left: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f3ede0;
  background: #1a1612;
  padding: 4px 8px;
  font-weight: 600;
}
.evidence .cap {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #2a241d;
  padding: 12px 6px 14px;
}
/* placeholder when the photo file isn't present yet */
.evidence.empty .shot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.evidence.empty .shot span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #6b6358;
  padding: 0 20px;
  line-height: 1.8;
}
.evidence.empty .shot span::before {
  content: '▢';
  display: block;
  font-size: 22px;
  color: #c14a2e;
  margin-bottom: 10px;
}

/* Awaiting testimony placeholder */
.awaiting {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream-mute);
  opacity: 0.7;
  font-style: normal;
}
.awaiting::before { content: '⋯ '; color: var(--rust); }

/* Close button */
.dossier-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  margin-bottom: -44px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  border: 1px solid var(--rule);
  color: var(--cream-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  z-index: 5;
  transition: all 0.3s var(--ease);
}
.dossier-close:hover { border-color: var(--rust); color: var(--cream); }

/* Footer of dossier */
.dossier-foot {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--rule-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-mute);
  gap: 16px;
  flex-wrap: wrap;
}

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