:root {
  --paper: #F3EDE1;
  --paper-2: #EAE1CF;
  --sheet: #FBF8F2;
  --manila: #E3CC9A;
  --manila-2: #D8BD84;
  --ink: #1A242B;
  --ink-2: #3D4A52;
  --muted: #6E716B;
  --navy: #14232D;
  --gold: #B8862F;
  --red: #A33B2B;
  --rule: #CBBFA8;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --serif: "Newsreader", Georgia, "Palatino Linotype", serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 19px/1.55 var(--serif);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.typed { font: 400 .8rem/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }

/* Strip + masthead */
.strip { background: var(--navy); color: #E9E1D0; font: .74rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.strip-inner { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 16px; }
.lang { display: inline-flex; align-items: center; gap: 6px; }
.lang button { background: none; border: 0; padding: 4px 2px; color: inherit; font: inherit; letter-spacing: inherit; cursor: pointer; opacity: .55; }
.lang button[aria-pressed="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.masthead { border-bottom: 3px double var(--ink); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 84px; gap: 24px; }
.brand img { width: 168px; }
.nav { display: flex; gap: 28px; font: .82rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }

/* Buttons */
.btn { display: inline-block; font: 700 .82rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; padding: 15px 20px; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); }
.btn:hover { background: var(--red); border-color: var(--red); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.arrow { font: .9rem var(--mono); }
.arrow::before { content: "→ "; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; gap: 40px; align-items: center; padding: 64px 0 72px; }
.hero h1 { font-family: var(--display); font-size: clamp(3rem, 6.6vw, 5.6rem); line-height: .98; letter-spacing: -.01em; margin: 18px 0 26px; }
.hero h1 span { display: block; }
.hero h1 em { display: block; font-family: var(--serif); font-style: italic; color: var(--red); font-size: .86em; margin-top: 6px; }
.lead { font-size: 1.18rem; color: var(--ink-2); max-width: 30em; }
.hero-links { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 22px; margin-top: 30px; }

.collage { position: relative; height: 560px; }
.sheet { position: absolute; width: 46%; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 14px 30px rgba(40,30,15,.22); }
.s1 { left: 2%; top: 4%; transform: rotate(-5deg); }
.s2 { left: 30%; top: 0; transform: rotate(3deg); z-index: 1; }
.s3 { left: 12%; top: 34%; transform: rotate(2deg); z-index: 2; }
.s4 { left: 50%; top: 30%; transform: rotate(-3.5deg); z-index: 3; }
.s3::after { content: none; }
.note { position: absolute; right: 2%; bottom: 0; z-index: 4; width: 210px; padding: 16px 16px 18px; background: #F4E27A; font: 700 .95rem/1.35 var(--mono); color: #2B2A1F; transform: rotate(4deg); box-shadow: 0 10px 18px rgba(40,30,15,.25); }
.note::before { content: ""; position: absolute; top: -12px; left: 50%; width: 70px; height: 22px; margin-left: -35px; background: rgba(255,255,255,.55); transform: rotate(-3deg); }

/* Ledger line */
.ledger { border-block: 1px solid var(--ink); background: var(--paper-2); }
.ledger-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 14px 0; font: .8rem var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.ledger-inner span::before { content: "■ "; color: var(--red); }

/* Sections */
.section { padding: 88px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1.5px solid var(--ink); padding-bottom: 14px; }
.section-head h2 { font-family: var(--display); font-size: clamp(2.2rem, 4.4vw, 3.4rem); }

/* Case index */
.entry { display: grid; grid-template-columns: 90px 150px 1fr 230px; gap: 32px; padding: 34px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.entry-no { font: 700 .9rem var(--mono); color: var(--red); padding-top: 8px; }
.entry-thumb { width: 150px; transform: rotate(-2deg); box-shadow: 0 8px 18px rgba(40,30,15,.22); transition: transform .25s ease; }
.entry:hover .entry-thumb { transform: rotate(0) scale(1.03); }
.entry h3 { font-family: var(--display); font-size: 2.1rem; line-height: 1.05; margin-bottom: 12px; }
.alt { display: block; font: italic 1.05rem var(--serif); color: var(--muted); margin-top: 4px; }
.entry-main > p { color: var(--ink-2); max-width: 34em; }
.meta { display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 4px 0 0; }
.meta dt { font: .7rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.meta dd { margin: 0; font-size: .98rem; }
.entry-actions { display: grid; gap: 10px; padding-top: 6px; }
.entry-actions .btn { text-align: center; }
.fine { font: .74rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 2px 0 0; }
.stamp { justify-self: start; font: 700 .9rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--red); border: 2.5px solid var(--red); padding: 9px 14px; transform: rotate(-4deg); opacity: .85; }

/* Book */
.book { background: var(--navy); padding: 88px 0; }
.book-inner { display: grid; grid-template-columns: 320px 1fr; gap: 64px; align-items: center; }
.book-cover { box-shadow: -7px 0 0 #0B151B inset, 0 30px 50px rgba(0,0,0,.45); transform: rotate(-2deg); }
.card { background: var(--sheet); padding: 34px 38px 30px; border-top: 6px solid var(--red); box-shadow: 0 20px 40px rgba(0,0,0,.35);
  background-image: repeating-linear-gradient(to bottom, transparent 0 29px, rgba(70,110,150,.18) 29px 30px); background-position: 0 120px; }
.card-head { border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 18px; }
.card h2 { font-family: var(--display); font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: 1; }
.subtitle { font: italic 1.25rem var(--serif); color: var(--muted); margin: 8px 0 16px; }
.card-table { border-collapse: collapse; width: 100%; font: .9rem var(--mono); margin-top: 6px; }
.card-table th { text-align: left; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; width: 9em; padding: 6px 0; vertical-align: top; }
.card-table td { padding: 6px 0; }
.card-table tr:last-child td { color: var(--red); font-weight: 700; }

/* Free file folder */
.folder { position: relative; margin-top: 30px; }
.folder-tab { position: absolute; top: -34px; left: 0; margin: 0; background: var(--manila); padding: 9px 22px 8px; font: 700 .8rem var(--mono); text-transform: uppercase; letter-spacing: .08em; border-radius: 8px 8px 0 0; }
.folder-body { background: var(--manila); padding: 44px 44px 40px; border-radius: 0 8px 8px 8px; box-shadow: 0 2px 0 var(--manila-2), 0 22px 40px rgba(60,40,10,.18); }
.folder-head h2 { font-family: var(--display); font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 10px; }
.folder-head p { max-width: 40em; font-size: 1.08rem; }
.evidence { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 30px 0 28px; }
.doc { position: relative; background: var(--sheet); padding: 18px 18px 16px; box-shadow: 0 6px 14px rgba(60,40,10,.2); }
.doc:nth-child(1) { transform: rotate(-1.2deg); }
.doc:nth-child(2) { transform: rotate(.8deg); background: #DDE5E8; }
.doc:nth-child(3) { transform: rotate(-.4deg); }
.doc:nth-child(4) { transform: rotate(1.4deg); background: #FFF9D9; }
.doc-id { position: absolute; top: 12px; right: 14px; margin: 0; font: 700 .72rem var(--mono); color: var(--red); border: 1px solid var(--red); padding: 2px 5px; }
.doc h4 { font: 700 .72rem/1.35 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding-right: 36px; margin-bottom: 12px; }
.doc p { font: .92rem/1.5 var(--mono); margin-bottom: .4em; }
.doc table { width: 100%; border-collapse: collapse; font: .92rem var(--mono); }
.doc td { padding: 4px 0; border-bottom: 1px dashed var(--rule); }
.doc td:first-child { width: 4.4em; color: var(--muted); }
.doc .doc-note { font: italic .85rem var(--serif); color: var(--muted); margin-top: 8px; }
.receipt { border-bottom: 3px dotted var(--rule); }
.doc .hand { font: italic 1.12rem/1.4 var(--serif); }

.transcript { background: var(--sheet); padding: 22px 26px 12px; border-left: 4px solid var(--ink); }
.transcript .typed { margin-bottom: 14px; color: var(--muted); }
.transcript p:not(.typed) { font-size: 1.05rem; }
.transcript b { font: 700 .82rem var(--mono); text-transform: uppercase; letter-spacing: .04em; margin-right: 8px; }

.question { margin-top: 30px; }
.question h3 { font-family: var(--display); font-size: 1.9rem; margin-bottom: 14px; }
.answers { display: flex; flex-wrap: wrap; gap: 14px; }
.answer { font: 700 1rem var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 12px 20px 12px 16px; border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink); cursor: pointer; }
.answer::before { content: "[ ] "; }
.answer:hover { background: var(--ink); color: var(--sheet); }
.answer.is-right { background: var(--ink); color: var(--sheet); }
.answer.is-right::before { content: "[x] "; }
.answer.is-wrong { text-decoration: line-through; opacity: .6; }
.result { position: relative; margin-top: 22px; background: var(--sheet); padding: 22px 24px 18px; max-width: 46em; }
.result strong { display: block; font-family: var(--display); font-size: 1.5rem; font-weight: 400; margin-bottom: 8px; }
.result p:last-child { margin-bottom: 0; }
.result.solved::after { content: attr(data-stamp); position: absolute; top: 14px; right: 18px; font: 700 .85rem var(--mono); letter-spacing: .14em; color: var(--red); border: 2.5px solid var(--red); padding: 6px 10px; transform: rotate(6deg); }
.after-file { margin-top: 28px; font-style: italic; color: var(--ink-2); }

/* Follow + footer */
.follow { padding: 10px 0 80px; }
.follow p { font: italic clamp(1.4rem, 2.6vw, 2rem)/1.35 var(--serif); max-width: 30em; margin: 0; }
.follow a { text-decoration-color: var(--red); }
.follow a:hover { color: var(--red); }
.footer { border-top: 3px double var(--ink); padding: 26px 0 34px; }
.footer-inner { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner p:last-child { margin-left: auto; }
.footer img { width: 120px; }

/* Links page */
.links-page { min-height: 100vh; display: flex; justify-content: center; padding: 48px 16px; }
.links-box { width: min(460px, 100%); text-align: center; }
.links-box .avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 18px; background: var(--sheet); border: 1.5px solid var(--ink); padding: 8px; }
.links-box h1 { font-family: var(--display); font-size: 2.3rem; }
.links-box > p { color: var(--ink-2); margin: 4px 0 14px; }
.links-box .lang { font: .8rem var(--mono); margin-bottom: 26px; }
.link-list { display: grid; gap: 12px; text-align: left; }
.link-list a { display: block; text-decoration: none; padding: 15px 18px; background: var(--sheet); border: 1.5px solid var(--ink); font: 700 .88rem var(--mono); text-transform: uppercase; letter-spacing: .03em; }
.link-list a:hover { background: var(--ink); color: var(--sheet); }
.link-list a.primary { background: var(--ink); color: var(--sheet); }
.link-list a.primary:hover { background: var(--red); border-color: var(--red); }
.link-list a small { display: block; font: italic .95rem var(--serif); text-transform: none; letter-spacing: 0; opacity: .8; margin-top: 3px; }
.links-social { display: flex; justify-content: center; gap: 18px; margin-top: 28px; font: .8rem var(--mono); text-transform: uppercase; }

/* Responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .collage { height: 460px; max-width: 560px; }
  .entry { grid-template-columns: 70px 120px 1fr; }
  .entry-thumb { width: 120px; }
  .entry-actions { grid-column: 3; }
  .evidence { grid-template-columns: repeat(2, 1fr); }
  .book-inner { grid-template-columns: 240px 1fr; gap: 40px; }
}
@media (max-width: 680px) {
  body { font-size: 17px; }
  .strip-inner > span:first-child { display: none; }
  .strip-inner { justify-content: flex-end; }
  .nav { display: none; }
  .masthead-inner { min-height: 68px; }
  .brand img { width: 140px; }
  .collage { height: 360px; }
  .note { width: 170px; font-size: .82rem; }
  .ledger-inner { flex-direction: column; }
  .section { padding: 64px 0; }
  .section-head { flex-direction: column; gap: 4px; }
  .entry { grid-template-columns: 96px 1fr; gap: 18px; }
  .entry-no { grid-column: 1 / -1; padding: 0; }
  .entry-thumb { width: 96px; }
  .entry-main, .entry-actions { grid-column: 1 / -1; }
  .entry h3 { font-size: 1.8rem; }
  .book { padding: 64px 0; }
  .book-inner { grid-template-columns: 1fr; }
  .book-cover { width: 220px; }
  .card { padding: 26px 22px 22px; }
  .folder-body { padding: 30px 18px 26px; }
  .evidence { grid-template-columns: 1fr; }
  .footer-inner p:last-child { margin-left: 0; }
}
/* Motion — only with JS and when the visitor has not asked for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: headline inks in, documents are dealt onto the desk */
  .js .hero h1 span { animation: rise .7s cubic-bezier(.2,.7,.2,1) .15s both; }
  .js .hero h1 em { animation: ink 1.1s cubic-bezier(.6,0,.2,1) .55s both; }
  .js .lead { animation: rise .7s ease .75s both; }
  .js .hero-links { animation: rise .7s ease .9s both; }
  .js .sheet { animation: deal .9s cubic-bezier(.2,.8,.25,1.05) both; }
  .js .s1 { animation-delay: .25s; }
  .js .s2 { animation-delay: .45s; }
  .js .s3 { animation-delay: .65s; }
  .js .s4 { animation-delay: .85s; }
  .js .note { animation: stick .6s cubic-bezier(.3,1.6,.5,1) 1.35s both; }

  .collage .sheet { transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease; }
  .collage .sheet:hover { box-shadow: 0 2px 3px rgba(0,0,0,.2), 0 26px 50px rgba(40,30,15,.32); z-index: 5; }
  .s1:hover { transform: rotate(-2deg) translateY(-12px); }
  .s2:hover { transform: rotate(1deg) translateY(-12px); }
  .s3:hover { transform: rotate(0) translateY(-12px); }
  .s4:hover { transform: rotate(-1deg) translateY(-12px); }
  .collage { transition: transform .5s ease-out; }
  .note { transition: transform .3s ease; }
  .note:hover { transform: rotate(1deg) scale(1.04); }

  /* Typewriter caret */
  .typing::after { content: "▌"; margin-left: 2px; animation: caret .9s steps(1) infinite; color: var(--red); }

  /* Scroll reveals */
  .js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  .js .section-head { border-bottom-color: transparent; position: relative; }
  .js .section-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1.5px; height: 1.5px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 1.1s cubic-bezier(.6,0,.2,1) .1s; }
  .js .section-head.is-in::after { transform: scaleX(1); }
  .js .entry .stamp { opacity: 0; transform: rotate(-4deg) scale(2.2); }
  .js .entry.is-in .stamp { animation: thump .45s cubic-bezier(.3,1.4,.5,1) .5s forwards; }
  .js .evidence .doc { opacity: 0; translate: 0 -30px; transition: opacity .5s ease, translate .6s cubic-bezier(.2,.8,.3,1.1); }
  .js .evidence.is-in .doc { opacity: 1; translate: 0 0; }
  .js .evidence.is-in .doc:nth-child(2) { transition-delay: .12s; }
  .js .evidence.is-in .doc:nth-child(3) { transition-delay: .24s; }
  .js .evidence.is-in .doc:nth-child(4) { transition-delay: .36s; }
  .doc { transition: transform .3s ease; }
  .evidence .doc:hover { transform: rotate(0) scale(1.03); }
  .js .book-cover { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
  .book-cover:hover { transform: rotate(0) translateY(-8px); }
  .js .card-table tr { opacity: 0; transform: translateX(-10px); transition: opacity .4s ease, transform .4s ease; }
  .js .card.is-in .card-table tr { opacity: 1; transform: none; }
  .js .card.is-in .card-table tr:nth-child(2) { transition-delay: .15s; }
  .js .card.is-in .card-table tr:nth-child(3) { transition-delay: .3s; }
  .js .card.is-in .card-table tr:nth-child(4) { transition-delay: .45s; }

  /* Mini-case answers */
  .result:not([hidden]) { animation: rise .45s ease both; }
  .result.solved::after { animation: thump .45s cubic-bezier(.3,1.4,.5,1) .15s both; }
  .answer.is-wrong { animation: shake .4s ease; }
  .btn { transition: background .2s ease, color .2s ease, transform .2s ease; }
  .btn:hover { transform: translateY(-2px); }
  .arrow::before { display: inline-block; transition: transform .2s ease; }
  .arrow:hover::before { transform: translateX(4px); }
}

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ink { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes deal { from { opacity: 0; translate: 140px -60px; rotate: 14deg; } to { opacity: 1; translate: 0 0; rotate: 0deg; } }
@keyframes stick { from { opacity: 0; transform: rotate(14deg) scale(1.5); } to { opacity: 1; transform: rotate(4deg) scale(1); } }
@keyframes thump { 0% { opacity: 0; transform: rotate(6deg) scale(2.2); } 70% { opacity: .9; transform: rotate(-5deg) scale(.94); } 100% { opacity: .85; transform: rotate(-4deg) scale(1); } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -6px; } 50% { translate: 5px; } 75% { translate: -3px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .entry-thumb { transition: none; }
}
