:root {
  --ground: #FBFAF7;
  --ink: #201E19;
  --ink-soft: #6E6A5F;
  --accent: #3E6B5A;
  --accent-soft: #3E6B5A26;
  --rule: #E4E1D8;
  --breath: 4.8s;
  --card: #201E190D;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #171612;
    --ink: #E8E5DC;
    --ink-soft: #94907F;
    --accent: #7FAE9B;
    --accent-soft: #7FAE9B2E;
    --rule: #2C2A23;
    --card: #E8E5DC12;
  }
}
:root[data-theme="dark"] {
  --ground: #171612;
  --ink: #E8E5DC;
  --ink-soft: #94907F;
  --accent: #7FAE9B;
  --accent-soft: #7FAE9B2E;
  --rule: #2C2A23;
  --card: #E8E5DC12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

main {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 0 auto;
  padding: 6rem 1.4rem 4rem;
}

header { text-align: center; }

header h1 {
  font-size: 2.3rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: .01em;
  margin: 0 0 2.4rem;
  text-wrap: balance;
}
header h1 a { color: inherit; text-decoration: none; }

.target {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6.5rem;
  height: 6.5rem;
  border: 5px solid var(--ink);
  border-radius: 50%;
  margin: 0 auto 2rem;
  cursor: crosshair;
}

.breath {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--dot, var(--ink));
  flex: none;
  animation: breathe var(--breath) ease-in-out infinite;
  transition: background .45s ease;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .55; }
  40%      { transform: scale(1.45); opacity: 1; }
}

nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.2rem;
  padding-bottom: .6rem;
  margin-bottom: 2.6rem;
}
nav a {
  font-style: italic;
  font-size: 1.18rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .5s ease, opacity .5s ease, font-size .5s ease;
}
nav a:hover { color: var(--ink); }
/* The chosen section grows, moves to the middle, and floats there;
   the others fade to whispers. */
nav[aria-label="Sections"]:has(a[aria-current="page"]) {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  column-gap: 2.2rem;
  align-items: center;
}
nav[aria-label="Sections"]:has(a[aria-current="page"]) a { grid-row: 1; }
nav[aria-label="Sections"] a[aria-current="page"] {
  font-size: 1.5rem;
  grid-column: 2;
  justify-self: center;
  animation: floaty var(--breath) ease-in-out infinite;
}
nav[aria-label="Sections"]:has(a:nth-child(1)[aria-current="page"]) a:nth-child(2),
nav[aria-label="Sections"]:has(a:nth-child(2)[aria-current="page"]) a:nth-child(1),
nav[aria-label="Sections"]:has(a:nth-child(3)[aria-current="page"]) a:nth-child(1) {
  grid-column: 1;
  justify-self: end;
}
nav[aria-label="Sections"]:has(a:nth-child(1)[aria-current="page"]) a:nth-child(3),
nav[aria-label="Sections"]:has(a:nth-child(2)[aria-current="page"]) a:nth-child(3),
nav[aria-label="Sections"]:has(a:nth-child(3)[aria-current="page"]) a:nth-child(2) {
  grid-column: 3;
  justify-self: start;
}
nav[aria-label="Sections"]:has(a[aria-current="page"]) a:not([aria-current="page"]) { opacity: .15; }
nav[aria-label="Sections"]:has(a[aria-current="page"]) a:not([aria-current="page"]):hover { opacity: .8; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

nav a[aria-current="page"] {
  color: var(--dot, var(--ink));
  font-weight: 600;
}
nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.content p { margin: 0 0 1.1rem; }
.content .quiet { color: var(--ink-soft); font-style: italic; }

/* Links wear ink, not blue. Titles carry no underline at all;
   inline source links keep a faint one so you can still find them. */
.content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .3s ease, color .3s ease;
}
.content a:hover { text-decoration-color: var(--dot, var(--ink)); }
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { color: var(--dot, var(--ink)); }
.entry .when {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: .9rem;
  margin-left: .45rem;
  white-space: nowrap;
}

.content h2 {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0 0 .6rem;
  text-wrap: balance;
}
.content section > h2 { text-align: center; }
.lede {
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
  margin: 0 0 2.4rem;
}
.content section { margin-bottom: 2.6rem; }
.timeline { margin-top: 1.8rem; }
.timeline .entry { margin: 0 0 1.7rem; }
.timeline .entry:last-child { margin-bottom: 0; }

/* Flow: entries drift down the page like beads on an invisible thread. */
.timeline .entry:not(.now)::after,
.content section > .entry:not(:last-child)::after {
  content: "";
  display: block;
  width: .32rem;
  height: .32rem;
  border-radius: 50%;
  background: var(--rule);
  margin: 1.7rem auto 0;
}
.timeline .entry:has(+ .entry.now)::after { display: none; }
.timeline .entry.now {
  text-align: center;
  margin-top: 2.6rem;
}
.timeline .entry.now::before {
  content: "";
  display: block;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: var(--dot, var(--ink));
  margin: 0 auto .6rem;
  animation: breathe var(--breath) ease-in-out infinite;
}
.entry { margin: 1.5rem 0 0; }
.entry h3 {
  font-size: 1.12rem;
  font-weight: 600;
  font-style: italic;
  margin: 0 0 .25rem;
}
.entry p { margin: 0; }
.entry .people {
  margin-top: .6rem;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  font-size: .95rem;
  color: var(--ink);
}
.person {
  cursor: pointer;
  background: var(--card);
  padding: .32rem .85rem;
  border-radius: .9rem;
  transition: background .3s ease, color .3s ease;
}
.person:hover {
  background: var(--dot, var(--ink));
  color: var(--ground);
}
.person-card {
  margin: .9rem 0 0;
  padding: .95rem 1.15rem;
  background: var(--card);
  border-radius: 10px;
  font-size: 1.02rem;
  font-style: normal;
  color: var(--ink);
  line-height: 1.55;
  animation: rise-in .45s ease;
}
.person-card b { font-weight: 600; }
.person-card .src { color: var(--ink-soft); font-style: italic; }
.subnav {
  display: flex;
  justify-content: center;
  gap: 1.6rem;
  margin: -1rem 0 2.2rem;
}
.subnav a {
  font-style: italic;
  font-size: .98rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .5s ease, border-color .5s ease;
}
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] {
  color: var(--dot, var(--ink));
  font-weight: 600;
}
.content section:last-child { margin-bottom: 0; }

.range-wrap {
  margin: 0 0 1.8rem;
}
#range {
  display: block;
  width: 100%;
  height: 360px;
  touch-action: none;
  cursor: crosshair;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
#arrow-reveal:not([hidden]) { animation: rise-in .9s ease; }
.big-quote {
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-wrap: balance;
  margin: 2.4rem 0 .7rem;
}
.quote-src {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  font-size: .98rem;
}
.again-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .9rem;
  margin-top: 1.5rem;
}
#try-again {
  font-family: inherit;
  font-size: .98rem;
  font-style: italic;
  color: var(--ink);
  background: var(--card);
  border: none;
  border-radius: .9rem;
  padding: .4rem 1.05rem;
  cursor: pointer;
  transition: background .3s ease, color .3s ease;
}
#try-again:hover {
  background: var(--dot, var(--ink));
  color: var(--ground);
}

/* A piece of writing: the full page, poems centered, images breathing. */
.piece-title {
  font-size: 1.9rem;
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  margin: .4rem 0 .3rem;
}
.piece-sub {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1rem;
  margin: 0 0 3rem;
}
.piece .piece-h {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  margin: 0 0 .2rem;
}
.piece .credit {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  font-size: .95rem;
  margin: 0 0 1.4rem;
}
.piece .poem {
  text-align: center;
  white-space: pre-line;
  line-height: 1.75;
}
.piece .foot {
  color: var(--ink-soft);
  font-style: italic;
  font-size: .9rem;
  text-align: center;
  margin-top: 1.2rem;
}
.piece .rq {
  font-style: italic;
  text-align: center;
  white-space: pre-line;
  color: var(--ink);
  max-width: 32rem;
  margin: 1.6rem auto 1.1rem;
}
.piece .bigq {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  margin: 2.2rem 0;
}
.piece img {
  display: block;
  margin: 0 auto;
  max-width: min(100%, 30rem);
  height: auto;
  border-radius: 6px;
}
.piece img.small { max-width: min(100%, 17rem); }
.piece figure { margin: 1.8rem 0 .4rem; }
.piece figure figcaption { margin: .5rem 0 0; }
.piece .pair {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 1.8rem 0 .4rem;
}
.piece .pair figure { flex: 1 1 14rem; margin: 0; min-width: 0; }
.piece .pair img { max-width: 100%; }
.piece .sep {
  width: .32rem;
  height: .32rem;
  border-radius: 50%;
  background: var(--rule);
  margin: 2.6rem auto;
}
.piece .tglyph {
  text-align: center;
  color: var(--dot, var(--ink));
  margin: 1.4rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .breath { animation: none; }
  nav a[aria-current="page"] { animation: none; }
  .timeline .entry.now::before { animation: none; }
  #arrow-reveal:not([hidden]) { animation: none; }
}
