:root {
  --paper: #eef0ec;
  --ink: #1b2230;
  --ink-2: #4a5468;
  --rule: #c9cec6;
  --blue: #3557a6;
  --plate-bg: transparent;
  --plate-ink: #1b2230;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "Spectral", Georgia, serif;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151b26;
    --ink: #e6e8e3;
    --ink-2: #9aa3b2;
    --rule: #2c3445;
    --blue: #93abe6;
    --plate-bg: #eef0ec;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .status.err { color: #f2b8b5; }
}
:root[data-theme="dark"] {
  --paper: #151b26;
  --ink: #e6e8e3;
  --ink-2: #9aa3b2;
  --rule: #2c3445;
  --blue: #93abe6;
  --plate-bg: #eef0ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; z-index: 10; background: var(--paper); padding: 6px 10px; }

/* Masthead */
.masthead {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mark {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink); text-decoration: none;
  font: 700 1.05rem/1 var(--display); font-stretch: 85%;
  letter-spacing: -.01em;
}
.mark img { display: block; border-radius: 50%; }
.masthead nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.masthead nav a {
  color: var(--ink); text-decoration: none;
  font: 500 .95rem/1 var(--display); font-stretch: 90%;
}
.masthead nav a:hover { color: var(--blue); }

/* Story: sticky plate beside scrolling chapters */
.story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(24px, 5vw, 80px);
  padding: 0 var(--gutter);
  max-width: 1440px; margin: 0 auto;
}
.plate {
  grid-column: 2; grid-row: 1;
  position: sticky; top: 64px;
  height: calc(100vh - 64px); height: calc(100svh - 64px);
  display: flex; flex-direction: column; justify-content: center;
}
/* The dots and the engraving share one square; the engraving shows while the dots hold the portrait. */
.art { position: relative; width: min(100%, calc(100svh - 150px)); aspect-ratio: 1; margin: 0 auto; background: var(--plate-bg); }
#dots { display: block; width: 100%; height: 100%; touch-action: pan-y; transition: opacity .9s ease; }
.engraving { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity .9s ease; }
.plate.engraved .engraving { opacity: 1; }
.plate.engraved #dots { opacity: 0; }
.caption {
  margin: 10px 0 0; text-align: center;
  font: italic 400 .95rem/1.4 var(--text); color: var(--ink-2);
  transition: opacity .3s;
}
.chapters { grid-column: 1; grid-row: 1; padding-bottom: 20vh; }

.chapter {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 34rem;
  padding: 12vh 0;
}
.chapter p { margin: 0 0 1em; }
.kicker {
  font: 500 .95rem/1.3 var(--display); font-stretch: 90%;
  color: var(--ink-2);
  margin-bottom: .9rem !important;
}
.chapter h2 {
  font: 800 clamp(2rem, 3.6vw, 3.1rem)/1.02 var(--display);
  font-stretch: 72%;
  letter-spacing: -.012em;
  margin: 0 0 1.4rem;
  text-wrap: balance;
}

/* The name: one word wide, one word condensed, set like stacked type */
.lead { justify-content: center; padding-top: 4vh; }
.lead h1 { margin: 0 0 1.6rem; font-family: var(--display); line-height: .84; }
.lead h1 span { display: block; }
.lead .first {
  font-weight: 300; font-stretch: 125%;
  font-size: clamp(4rem, 10vw, 8.6rem);
  letter-spacing: -.03em;
}
.lead .last {
  font-weight: 900; font-stretch: 62%;
  font-size: clamp(5rem, 13.4vw, 11.6rem);
  letter-spacing: -.02em;
  text-transform: uppercase;
}
/* Flagship quotes: one at a time in the same spot, swapped when its bar fills */
.creed { margin: 0 0 1.8rem; }
.creed-q { display: grid; padding: .2rem 0 .2rem 1.1rem; border-left: 6px solid var(--ink); }
/* Each quote prints in through a halftone screen: dots grow until the letters are solid ink. */
@property --dot { syntax: "<length>"; inherits: false; initial-value: 0px; }
.creed-q > blockquote {
  grid-area: 1 / 1; margin: 0; align-self: center;
  --dot: 0px; visibility: hidden;
  -webkit-mask-image: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + .6px));
  mask-image: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + .6px));
  -webkit-mask-size: 6px 6px; mask-size: 6px 6px;
  transition: --dot .5s ease-in, visibility 0s linear .5s;
}
.creed-q > blockquote.is-on { --dot: 5px; visibility: visible; transition: --dot 1.1s ease-out .45s; }
.creed p {
  margin: 0 !important;
  font: 800 clamp(1.7rem, 2.9vw, 2.6rem)/1.06 var(--display);
  font-stretch: 70%; letter-spacing: -.01em;
  text-wrap: balance;
}
.creed-nav { display: flex; align-items: center; gap: 8px; margin: .7rem 0 0 calc(1.1rem + 6px); }
.creed-nav button:not(.share) { position: relative; width: 48px; height: 15px; padding: 0; border: 0; background: none; cursor: pointer; }
.creed-nav button:not(.share)::before, .creed-nav button:not(.share)::after { content: ""; position: absolute; left: 0; top: 6px; height: 3px; border-radius: 2px; }
.creed-nav button:not(.share)::before { right: 0; background: var(--rule); }
.creed-nav button:not(.share)::after { width: 0; background: var(--ink); }
.creed-nav button:not(.share).is-on::after { animation: creed-fill 6s linear forwards; }
.creed:hover .creed-nav button:not(.share)::after, .creed:focus-within .creed-nav button:not(.share)::after { animation-play-state: paused; }
@keyframes creed-fill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .creed-q > blockquote { transition: none; -webkit-mask-image: none; mask-image: none; }
  .creed-nav button:not(.share).is-on::after { animation: none; width: 100%; }
}

/* Secondary quotes inside chapters */
.pull { margin: 1.4rem 0 0; padding-left: 1rem; border-left: 3px solid var(--blue); }
.pull p { margin: 0 !important; font: italic 400 clamp(1.25rem, 1.8vw, 1.5rem)/1.35 var(--text); }
.site-q { font-style: italic; color: var(--ink); padding-left: .8rem; border-left: 2px solid var(--blue); }
.site-q::before { content: "\201C"; }
.site-q::after { content: "\201D"; }
.pull p::before, .creed p::before { content: "\201C"; }
.pull p::after, .creed p::after { content: "\201D"; }
.hint { color: var(--ink-2); font-style: italic; margin-top: 1.5rem !important; }

/* Record */
/* Gopalan's Laws: the first chapter after the hero, beside the portrait */
.laws .law-item { margin: 0; padding: 1.1rem 0 1.5rem; border-top: 3px solid var(--ink); }
.laws .law-item + .law-item { border-top: 1px solid var(--rule); }
.laws .law-n { margin: 0 0 .4rem; font: italic 600 1.05rem/1.2 var(--text); color: var(--ink-2); }
.laws blockquote { margin: 0; }
.laws blockquote p {
  margin: 0; font: 800 clamp(2rem, 3.4vw, 3rem)/1.02 var(--display);
  font-stretch: 66%; letter-spacing: -.015em; text-wrap: balance;
}
.laws .first blockquote p { font-size: clamp(2.6rem, 5vw, 4.4rem); }
.laws blockquote p::before { content: "\201C"; }
.laws blockquote p::after { content: "\201D"; }
.laws .law-note { margin: .7rem 0 0; max-width: 40ch; color: var(--ink-2); }
.laws .share { margin-top: .7rem; }

.record, .shelf, .write {
  max-width: 1440px; margin: 0 auto;
  padding: clamp(64px, 10vw, 128px) var(--gutter) 0;
}
.record > h2, .shelf > h2 {
  font: 800 clamp(2.6rem, 6vw, 5rem)/1 var(--display);
  font-stretch: 62%; letter-spacing: -.015em;
  margin: 0 0 2.5rem;
  border-bottom: 3px solid var(--ink); padding-bottom: .9rem;
}
.roles { list-style: none; margin: 0; padding: 0; }
.roles li {
  display: grid; grid-template-columns: 9.5rem minmax(0, 46rem);
  gap: 24px;
  padding: 20px 0; border-bottom: 1px solid var(--rule);
}
.roles time {
  font: 600 1.05rem/1.5 var(--display); font-stretch: 80%;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.roles h3 { font: 700 1.3rem/1.2 var(--display); font-stretch: 85%; margin: 0; }
.roles .role { font-style: italic; color: var(--ink-2); margin: .15rem 0 .35rem; }
.roles p { margin: 0; }

/* Shelf: real covers, linked */
.record > h2, .shelf > h2, .building > h2 { scroll-margin-top: 72px; }
.series { margin-bottom: clamp(40px, 6vw, 72px); }
.series-head { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 34rem); gap: 8px 32px; align-items: baseline; margin-bottom: 24px; }
.series-head h3 { font: 800 clamp(1.6rem, 2.6vw, 2.2rem)/1.05 var(--display); font-stretch: 72%; margin: 0; }
.series-head p { margin: 0; }
.covers {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: clamp(20px, 3vw, 40px);
  max-width: 1120px;
}
.book { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.book img {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover;
  margin-bottom: 12px;
  box-shadow: 0 1px 0 var(--rule), 6px 8px 0 -2px color-mix(in srgb, var(--ink) 14%, transparent);
  transition: transform .2s ease;
}
.book:hover img { transform: translateY(-4px); }
.book-t { font: 700 1.15rem/1.15 var(--display); font-stretch: 85%; }
.book-s { font-style: italic; color: var(--ink-2); font-size: 1rem; line-height: 1.35; }
.book-a { margin-top: 6px; color: var(--blue); font: 600 .98rem/1.3 var(--display); font-stretch: 90%; }
.book:hover .book-a { text-decoration: underline; text-underline-offset: .18em; }

/* Building */
.building { max-width: 1440px; margin: 0 auto; padding: clamp(64px, 10vw, 128px) var(--gutter) 0; }
.building > h2 {
  font: 800 clamp(2.6rem, 6vw, 5rem)/1 var(--display);
  font-stretch: 62%; letter-spacing: -.015em;
  margin: 0 0 2rem;
  border-bottom: 3px solid var(--ink); padding-bottom: .9rem;
}
.sites { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; max-width: 72rem; }
.site { display: flex; flex-direction: column; gap: 6px; padding: 20px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.site-name { font: 800 clamp(1.5rem, 2.4vw, 2rem)/1.1 var(--display); font-stretch: 75%; color: var(--blue); }
.site:hover .site-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .15em; }

.notes { columns: 2 22rem; column-gap: 48px; max-width: 72rem; }
.notes p { margin: 0 0 1.1em; break-inside: avoid; }
.notes strong { font-family: var(--display); font-weight: 700; font-stretch: 85%; }

/* Contact */
.write {
  display: grid; grid-template-columns: auto minmax(0, 40rem);
  justify-content: start;
  gap: clamp(24px, 5vw, 64px); align-items: center;
  padding-bottom: clamp(64px, 10vw, 128px);
}
.write-mark { width: clamp(120px, 16vw, 200px); height: auto; border-radius: 50%; }
.write h2 {
  font: 800 clamp(2.6rem, 6vw, 5rem)/1 var(--display);
  font-stretch: 62%; margin: 0 0 1rem;
}
.contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 1.6rem 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide, .send, .status { grid-column: 1 / -1; }
.field label { font: 600 .95rem/1.2 var(--display); font-stretch: 90%; }
.field input, .field textarea {
  font: 400 1.05rem/1.45 var(--text); color: var(--ink);
  background: color-mix(in srgb, var(--paper) 70%, #fff);
  border: 1.5px solid var(--ink-2); border-radius: 4px; padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.send { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.send button, .reveal {
  appearance: none; cursor: pointer; border-radius: 999px;
  font: 600 1rem/1 var(--display); font-stretch: 90%;
}
.send button { border: 0; background: var(--ink); color: var(--paper); padding: 13px 22px; }
.send button:disabled { opacity: .55; cursor: progress; }
.status { margin: 0; min-height: 1.5em; font-size: 1rem; }
.status.err { color: #b3261e; }
.or { margin: 1.2rem 0 0; }
.reveal { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); padding: 7px 14px; margin-left: 4px; }
.reveal:hover { background: var(--ink); color: var(--paper); }
.links { list-style: none; padding: 0; margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.links a { font: 600 1.05rem/1.4 var(--display); font-stretch: 90%; }

.foot {
  border-top: 1px solid var(--rule);
  padding: 24px var(--gutter) 40px;
  color: var(--ink-2); font-size: .95rem;
}
.foot p { max-width: 60ch; margin: 0; }

/* Human / Agent switch */
.viewswitch {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 2px; padding: 4px;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px;
}
.viewswitch button {
  appearance: none; border: 0; cursor: pointer;
  padding: 8px 18px; border-radius: 999px;
  background: transparent; color: var(--ink);
  font: 600 .95rem/1 var(--display); font-stretch: 90%;
}
.viewswitch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.foot { padding-bottom: 96px; }

.agent-view { max-width: 60rem; margin: 0 auto; padding: 24px var(--gutter) 120px; }
.agent-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 8px 0 16px; border-bottom: 1px solid var(--rule); }
.agent-bar p { margin: 0; max-width: 46ch; color: var(--ink-2); font-size: 1rem; }
#copy-md {
  appearance: none; cursor: pointer; border: 1.5px solid var(--ink); border-radius: 999px;
  background: transparent; color: var(--ink); padding: 8px 16px;
  font: 600 .95rem/1 var(--display); font-stretch: 90%;
}
#copy-md:hover { background: var(--ink); color: var(--paper); }
#agent-md {
  margin: 24px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 400 .92rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
body.is-agent main, body.is-agent .foot { display: none; }

/* Share buttons and quote pages */
.share {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--blue); font: 600 .95rem/1.4 var(--display); font-stretch: 90%;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em;
}
.share:hover { text-decoration-thickness: 2px; }
.creed-nav .share { margin-left: 14px; }
.pull .share { margin-top: .35rem; }
.qpage { max-width: 1100px; margin: 0 auto; padding: clamp(48px, 10vh, 120px) var(--gutter) 96px; }
.qpage figure { margin: 0; padding-left: 1.2rem; border-left: 6px solid var(--ink); }
.qpage blockquote { margin: 0; }
.qpage blockquote p {
  margin: 0; max-width: 20ch;
  font: 800 clamp(2.4rem, 6vw, 5.2rem)/1 var(--display); font-stretch: 66%; letter-spacing: -.015em; text-wrap: balance;
}
.qpage blockquote p::before { content: "\201C"; }
.qpage blockquote p::after { content: "\201D"; }
.qpage figcaption { margin-top: 1rem; font: italic 600 clamp(1.2rem, 2vw, 1.6rem)/1.2 var(--text); }
.q-sub { margin: .5rem 0 0 calc(1.2rem + 6px); color: var(--ink-2); font-style: italic; }
.q-share { margin-top: 2.4rem; }
.q-share .share { font-size: 1.05rem; }
.qindex h1 { font: 800 clamp(2.6rem, 6vw, 5rem)/1 var(--display); font-stretch: 62%; margin: 0 0 1rem; padding-bottom: .9rem; border-bottom: 3px solid var(--ink); }
.qlist { list-style: none; margin: 0; padding: 0; }
.qlist a { display: block; padding: 18px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.q-t { display: block; font: 800 clamp(1.4rem, 2.6vw, 2rem)/1.1 var(--display); font-stretch: 72%; }
.q-n { display: block; margin-top: 4px; font-style: italic; color: var(--ink-2); }
.qlist a:hover .q-t { color: var(--blue); }

/* Narrow screens: the plate pins to the top, chapters slide beneath it */
@media (max-width: 860px) {
  body { font-size: 1.0625rem; }
  .story { display: block; padding: 0; }
  .plate {
    top: 56px; z-index: 2;
    height: auto;
    padding: 4px 16px 8px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .art { width: min(40svh, 100%); }
  .caption { margin-top: 4px; font-size: .85rem; }
  .chapters { padding: 0 16px 10vh; }
  .chapter { min-height: 62svh; padding: 8svh 0; }
  .lead { min-height: auto; padding-top: 5svh; }
  .lead .first { font-size: clamp(3.2rem, 17vw, 5.5rem); }
  .lead .last { font-size: clamp(4rem, 22vw, 7rem); }
  .creed p { font-size: clamp(1.55rem, 7.4vw, 2.1rem); }
  .chapter h2 { font-size: clamp(1.85rem, 8vw, 2.4rem); }
  .masthead { padding: 8px 16px; }
  .masthead nav a:not(:last-child) { display: none; }
  .mark span { display: none; }
  .record, .shelf, .write, .qpage { padding-left: 16px; padding-right: 16px; }
  .roles li { grid-template-columns: 1fr; gap: 4px; }
  .covers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
  .series-head { grid-template-columns: 1fr; }
  .sites { grid-template-columns: 1fr; }
  .building { padding-left: 16px; padding-right: 16px; }
  .write { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .foot { padding: 20px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caption, #dots, .engraving { transition: none; }
}

@media print {
  .masthead, .plate, .hint, .viewswitch, .agent-view { display: none; }
  .story { display: block; }
  .chapter { min-height: 0; padding: 0 0 1rem; }
  body { background: #fff; color: #000; }
}
