/* /dissertation: the cover, the scroll-told opening, and the contents. Paper, pencil and one blue. */

.opening {
  --paper: #fffff0;
  --sheet: #fffdf6;
  --ink: #1b1b20;
  --ink-2: #4a4a55;
  --ink-3: #8a8a93;
  --rule: rgba(20, 20, 30, 0.1);
  --accent: #1f3fd0;
  --warm: #b4461f;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.3  0 0 0 0 0.2  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  color: var(--ink);
  background: var(--grain);
}
.dark .opening {
  --paper: #1f2022;
  --sheet: #25262a;
  --ink: #ecedf1;
  --ink-2: #b2b3bc;
  --ink-3: #7c7d86;
  --rule: rgba(255, 255, 255, 0.12);
  --accent: #8fb0ff;
  --warm: #ee8a5e;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.opening a { color: inherit; }

/* ---------------------------------------------------------------- the cover */
.cover { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
.cover .shocks { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--ink); }
.cover .shocks path { fill: none; stroke: currentColor; stroke-linecap: round; }
.cover .shocks path.accent { stroke: var(--accent); }
.cover-text { position: relative; z-index: 1; width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding-top: 3rem; }
.cover .eyebrow { font: 0.74rem ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 1.2rem; }
.cover .big { font-family: Newsreader, "Iowan Old Style", Georgia, serif; font-weight: 400; font-size: clamp(3.4rem, 11vw, 9.5rem);
  line-height: 0.92; letter-spacing: -0.035em; margin: 0 0 1.8rem; max-width: 11ch; }
.cover .big span { display: inline-block; opacity: 0; transform: translateY(0.35em) rotate(var(--r, 0deg)); transition: opacity 0.9s ease, transform 1.1s cubic-bezier(.2,.7,.2,1); }
.cover.in .big span { opacity: 1; transform: none; }
.cover .big span:nth-child(1) { --r: -4deg; transition-delay: 0.05s; }
.cover .big span:nth-child(2) { --r: 3deg; transition-delay: 0.3s; }
.cover .big span:nth-child(3) { --r: -2deg; transition-delay: 0.55s; }
.cover .big span:nth-child(4) { --r: 5deg; transition-delay: 0.85s; }
.cover .title { font-family: Newsreader, Georgia, serif; font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.3; max-width: 30ch; margin: 0 0 0.35rem;
  opacity: 0; transition: opacity 1s 1.4s; }
.cover .by { font: 0.95rem ui-sans-serif, system-ui, sans-serif; color: var(--ink-2); margin: 0 0 1.8rem; opacity: 0; transition: opacity 1s 1.6s; }
.cover .cta { display: flex; flex-wrap: wrap; gap: 10px; opacity: 0; transition: opacity 1s 1.8s; }
.cover.in .title, .cover.in .by, .cover.in .cta { opacity: 1; }
.cover .cta a { font: 600 0.9rem ui-sans-serif, system-ui, sans-serif; padding: 0.6rem 1.05rem; border-radius: 999px; border: 1px solid var(--rule);
  text-decoration: none; background: color-mix(in srgb, var(--sheet) 80%, transparent); backdrop-filter: blur(4px); }
.cover .cta a:hover { border-color: var(--accent); color: var(--accent); }
.cover .cta a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dark .cover .cta a.primary { color: #10131f; }
.cover .scrollhint { position: absolute; left: 50%; bottom: 1.4rem; transform: translateX(-50%); font: 0.72rem ui-monospace, Menlo, monospace;
  letter-spacing: 0.2em; color: var(--ink-3); margin: 0; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translate(-50%, 0); opacity: 0.5; } 50% { transform: translate(-50%, 6px); opacity: 1; } }

/* ---------------------------------------------------------------- the story: text on the left, a drawing that stays */
.story { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.stage { grid-column: 2; grid-row: 1; position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: center; justify-content: center; }
.stage > svg { width: min(100%, 78vh); height: auto; overflow: visible; }
.steps { grid-column: 1; grid-row: 1; padding: 30vh 0 40vh; }
.step { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; max-width: 30rem; opacity: 0.22; transition: opacity 0.5s; }
.step.on { opacity: 1; }
.step p { font-family: Newsreader, Georgia, serif; font-size: clamp(1.45rem, 2.6vw, 2.05rem); line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 0.8rem; }
.step p.small { font-size: clamp(1.05rem, 1.7vw, 1.25rem); color: var(--ink-2); }
.step p.src { font: 0.8rem ui-sans-serif, system-ui, sans-serif; color: var(--ink-3); letter-spacing: 0.02em; }
.step em { font-style: italic; color: var(--accent); }

/* the drawing's inks */
:is(#stage, #stage2) { color: var(--ink); font-family: Newsreader, Georgia, serif; }
:is(#stage, #stage2) .pencil { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
:is(#stage, #stage2) .soft { opacity: 0.35; }
:is(#stage, #stage2) .accent { stroke: var(--accent); }
:is(#stage, #stage2) .warm { stroke: var(--warm); }
:is(#stage, #stage2) .fillacc { fill: var(--accent); }
:is(#stage, #stage2) .fillwarm { fill: var(--warm); }
:is(#stage, #stage2) text { fill: currentColor; font-size: 17px; }
:is(#stage, #stage2) text.label { font-size: 15px; }
:is(#stage, #stage2) text.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; letter-spacing: 0.08em; fill: var(--ink-3); }
:is(#stage, #stage2) text.acc { fill: var(--accent); }
:is(#stage, #stage2) text.warmt { fill: var(--warm); }
:is(#stage, #stage2) text.halo { paint-order: stroke; stroke: var(--paper); stroke-width: 6px; stroke-linejoin: round; }
:is(#stage, #stage2) .box { fill: var(--sheet); }
:is(#stage, #stage2) .headfill { fill: var(--sheet); }
:is(#stage, #stage2) .sunmid { fill: #f6b53d; }
:is(#stage, #stage2) .suncore { fill: #fff6d8; }

/* ---------------------------------------------------------------- contents */
.contents { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 6rem 0 2rem; }
.contents h2 { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.02em; margin: 0 0 0.8rem; }
.contents .lede { font-size: 1.08rem; color: var(--ink-2); max-width: 40rem; margin: 0 0 2.4rem; }
.contents .lede a { color: var(--accent); text-decoration: none; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card a { position: relative; display: flex; flex-direction: column; gap: 0.35rem; height: 100%; padding: 1.2rem 1.25rem 1.3rem;
  background: var(--sheet) var(--grain); border: 1px solid var(--rule); border-radius: 4px; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 10px 26px -18px rgba(40, 30, 10, 0.3); transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s; }
.card a:hover { transform: translateY(-3px) rotate(-0.25deg); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 16px 34px -18px rgba(31, 63, 208, 0.35); }
.card .num { position: absolute; right: 1rem; top: 0.4rem; font-family: Newsreader, Georgia, serif; font-size: 3.4rem; line-height: 1; color: var(--rule); }
.card.chapter .num { color: color-mix(in srgb, var(--accent) 22%, transparent); }
.card .what { font: 600 0.7rem ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.card .t { font-family: Newsreader, Georgia, serif; font-size: 1.28rem; line-height: 1.22; padding-right: 2.2rem; }
.card .d { font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }
.cite { margin-top: 2.2rem; font: 0.9rem ui-sans-serif, system-ui, sans-serif; color: var(--ink-2); }
.cite summary { cursor: pointer; }
.cite pre { background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.8rem; margin-top: 0.8rem; }

/* ---------------------------------------------------------------- phones: the drawing on top, the text scrolls under it */
@media (max-width: 820px) {
  .story { grid-template-columns: 1fr; width: 100%; }
  .stage { grid-column: 1; height: 52vh; height: 52svh; top: 3.5rem; z-index: 1; background: linear-gradient(var(--paper) 88%, transparent); }
  .dark .stage { background: linear-gradient(#1f2022 88%, transparent); }
  .stage > svg { width: min(92vw, 46vh); }
  .steps { grid-column: 1; grid-row: 1; padding: 58vh 20px 30vh; position: relative; z-index: 2; pointer-events: none; }
  .step { min-height: 70vh; justify-content: flex-end; padding-bottom: calc(6vh + 3rem); }
  .step p { font-size: 1.3rem; background: color-mix(in srgb, var(--paper) 92%, transparent); padding: 0.4rem 0.2rem; border-radius: 4px; }
  .step p.small { font-size: 1.02rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cover .big span, .cover .title, .cover .by, .cover .cta { transition: none; opacity: 1; transform: none; }
  .cover .scrollhint { animation: none; }
}

/* ---------------------------------------------------------------- a chapter told as a story (the afterword) */
.told { padding-top: 5.5rem; }
.told .toldhead, .told .toldfoot { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.told .kicker { font: 0.72rem ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.told .kicker a { text-decoration: none; }
.told .story { display: grid; }
.told .toldbody { grid-column: 1; grid-row: 1; font-family: Newsreader, Georgia, serif; }
/* the fragment is <section><h1/><div.steps/>footnotes</section>; the section is laid out as the story's left column */
.told .toldbody section { padding: 0; margin: 0; }
.told .toldbody h1 { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: clamp(3rem, 8vw, 6rem); letter-spacing: -0.03em; line-height: 1; margin: 3rem 0 0; }
.told .toldbody .steps { padding: 18vh 0 20vh; }
.told .step p { font-size: clamp(1.2rem, 1.75vw, 1.45rem); line-height: 1.5; letter-spacing: 0; }
.told .step a { color: var(--accent); text-decoration: none; font-size: 0.85em; }
.told .step .footnote-ref { vertical-align: super; font-size: 0.6em; }
.told aside.footnotes { font: 0.9rem ui-sans-serif, system-ui, sans-serif; color: var(--ink-2); max-width: 30rem; }
.told aside.footnotes hr { width: 5rem; border: 0; border-top: 1px solid var(--rule); margin: 0 0 0.8rem; }
.told aside.footnotes a { color: var(--accent); text-decoration: none; }
.told .pager { margin: 4rem 0 0; }
@media (max-width: 820px) {
  .told .toldbody { position: relative; z-index: 2; padding: 0 20px; }
  .told .toldbody h1 { position: relative; z-index: 3; }
  .told .toldbody .steps { padding: 58vh 0 20vh; }
  .told .step p { font-size: 1.12rem; }
}

/* ---------------------------------------------------------------- /dissertation/idea */
.idea .ideahead { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 8rem 0 0; }
.idea .ideahead .eyebrow { font: 0.74rem ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 1rem; }
.idea .ideahead .eyebrow a { text-decoration: none; }
.idea .ideahead h1 { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: clamp(2.6rem, 6.5vw, 5.2rem); line-height: 1; letter-spacing: -0.03em;
  max-width: 14ch; margin: 0 0 1.4rem; }
.idea .ideahead .lede { font-family: Newsreader, Georgia, serif; font-size: 1.3rem; line-height: 1.5; color: var(--ink-2); max-width: 36rem; margin: 0; }
.idea .fx { margin: 0.4rem 0 1rem; color: var(--ink); }
.idea .fx svg { display: block; max-width: 100%; height: auto; width: 23rem; }
.idea .step a { color: var(--accent); text-decoration: none; }
.idea .ideafoot { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 2rem 0 3rem; max-width: 44rem; }
.idea .ideafoot > p:first-child { font-family: Newsreader, Georgia, serif; font-size: 1.3rem; line-height: 1.5; }
.idea .ideafoot a { color: var(--accent); text-decoration: none; }
.idea .ideafoot .cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.4rem 0 2rem; }
.idea .ideafoot .cta a { font: 600 0.9rem ui-sans-serif, system-ui, sans-serif; padding: 0.6rem 1.05rem; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink); }
.idea .ideafoot .cta a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dark .idea .ideafoot .cta a.primary { color: #10131f; }
.idea .ideafoot .note { font: 0.84rem/1.55 ui-sans-serif, system-ui, sans-serif; color: var(--ink-3); }
.idea .progress { background: var(--accent); }
@media (max-width: 820px) {
  .idea .ideahead { padding-top: 6rem; }
  .idea .fx { background: color-mix(in srgb, var(--paper) 92%, transparent); padding: 0.3rem; border-radius: 4px; }
  .idea .fx svg { width: 100%; }
}
.idea ~ .progress, .progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: #1f3fd0; z-index: 60; }
.dark .progress { background: #8fb0ff; }
.idea .solvestate { display: block; margin-top: 0.8rem; font: 0.82rem ui-monospace, Menlo, monospace; color: var(--ink-3); }
.idea .solvestate.ok { color: var(--accent); }

/* ---------------------------------------------------------------- the detour map (detour.js) */
.detour { position: relative; }
.detour.js { height: 720vh; }
.dt-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center;
  width: min(1180px, calc(100% - 24px)); margin: 0 auto; padding: 3.2rem 0 3.6rem; box-sizing: border-box; }
.dt-map { width: 100%; flex: 1 1 0; min-height: 0; color: var(--ink); font-family: Newsreader, Georgia, serif; overflow: visible; }
.dt-caps { position: relative; flex: 0 0 auto; display: grid; max-width: 40rem; margin: 0 auto; width: 100%; }
.dt-cap { font-family: Newsreader, Georgia, serif; font-size: clamp(1.25rem, 2.3vw, 1.75rem); line-height: 1.3; letter-spacing: -0.01em;
  margin: 0; text-align: center; }
.detour.js .dt-cap { grid-area: 1 / 1; opacity: 0; transform: translateY(6px); transition: opacity 0.5s, transform 0.5s; }
.detour.js .dt-cap.on { opacity: 1; transform: none; }
.dt-map .pn { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.dt-map .soft { opacity: 0.35; }
.dt-map .soft2 { opacity: 0.4; }
.dt-map .dash { stroke-dasharray: 3 5 !important; }
.dt-map .hatch { color: var(--ink-3); opacity: 0; }
.dt-map .road { color: var(--ink-2); }
.dt-map .acc { stroke: var(--accent); }
.dt-map .dot { fill: var(--warm); }
.dt-map text { fill: var(--ink-2); }
.dt-map .lab { font: 12.5px ui-sans-serif, system-ui, sans-serif; fill: var(--ink-3); }
.dt-map .lab .who { font: 15px Newsreader, Georgia, serif; fill: var(--ink); }
.dt-map .accl, .dt-map .accl .who { fill: var(--accent); }
.dt-map .bandname { font-size: 19px; font-style: italic; fill: var(--ink); }
.dt-map .mono { font: 11px ui-monospace, Menlo, monospace; letter-spacing: 0.2em; fill: var(--ink-3); }
.dt-map .halo { paint-order: stroke; stroke: var(--paper); stroke-width: 7px; stroke-linejoin: round; }
@media (max-width: 760px) {
  .dt-sticky { width: 100%; padding: 3.6rem 12px 3.4rem; }
  .dt-caps { padding: 0 8px; }
  .dt-cap { font-size: 1.02rem; line-height: 1.35; }
  .dt-map .lab { font-size: 11px; } .dt-map .lab .who { font-size: 15px; }
}
