/* Case Studies (case-studies/index.html). Loaded after style.css, whose tokens and .noir, .stamp,
   .verdict and .mugshot pieces it builds on. The folders are the desk's manila. The last file
   (John/Joan) is plain on purpose: no tilt, no stamp, no marker, no vote. */

.noir.cases {
  padding-top: 8rem;
  padding-bottom: 10rem;
  background: linear-gradient(180deg,
    var(--paper) 0, #3a332b 3.5rem, #15120f 6.5rem, var(--noir) 9rem,
    var(--noir) calc(100% - 8.5rem), #15120f calc(100% - 6rem), #3a332b calc(100% - 3rem), var(--paper) 100%);
}
.cases h1 {
  margin: 0 0 0.6rem;
  font-family: var(--type);
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  letter-spacing: 0.01em;
  color: var(--noir-ink);
}
.cases__filing {
  max-width: 34rem;
  margin: 0.8rem auto 0;
  font-family: var(--type);
  font-size: 0.82rem;
  color: var(--noir-soft);
}

/* A case file: tab, folder, paper */
.file {
  position: relative;
  max-width: 1040px;
  margin: clamp(3rem, 7vw, 4.6rem) auto 0;
  text-align: left;
  scroll-margin-top: 4.5rem;
}
.file__tab {
  display: inline-block;
  margin-left: clamp(0.8rem, 3vw, 1.6rem);
  position: relative;
  margin-bottom: -1px; /* no hairline where the tab meets its folder */
  padding: 0.4rem 1.2rem 0.3rem;
  border-radius: 0.6rem 0.6rem 0 0;
  background: #e2cb98; /* the folder's own top colour: one piece of card */
  color: #4d3a19;
  font-family: var(--type);
  font-size: 0.95rem;
  box-shadow: 0 -3px 7px -3px rgba(0, 0, 0, 0.55);
}
.file__folder {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.1rem, 2.6vw, 1.7rem);
  padding: clamp(0.9rem, 2.6vw, 1.7rem);
  border-radius: 0.3rem 0.6rem 0.6rem 0.6rem;
  background: linear-gradient(180deg, #e2cb98, #d0b177);
  box-shadow: 0 30px 55px -24px #000, 0 2px 5px rgba(0, 0, 0, 0.5);
}
@media (min-width: 940px) {
  .file:not(.file--plain) .file__folder:not(.file__folder--wide) {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    align-items: start;
  }
}
.file__side { display: grid; gap: clamp(1.1rem, 2.6vw, 1.5rem); min-width: 0; }

.file__sheet {
  position: relative;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: #f5f2ea;
  color: #2a261f;
  font-family: var(--type);
  font-size: 1rem;
  line-height: 1.6;
  box-shadow: 0 8px 16px -10px rgba(0, 0, 0, 0.7);
  transform: rotate(-0.3deg);
}
.file__sheet p { margin: 0 0 0.9em; }
.file__sheet > p:last-child { margin-bottom: 0; }
.file__clip {
  position: absolute;
  top: -0.9rem;
  right: 2rem;
  width: 1.2rem;
  height: 3.2rem;
  border: 0.2rem solid #a9aeb4;
  border-radius: 1rem;
  transform: rotate(8deg);
}
.noir .file__title {
  margin: 0 0 0.7rem;
  padding-bottom: 0.25rem;
  border-bottom: 0.12rem solid #2a261f;
  color: #2a261f;
  font-family: var(--type);
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.file__stamp {
  position: absolute;
  top: 5.2rem;
  right: 1.3rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.file__rows {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.1rem 1rem;
  margin: 0 0 1.3rem;
  padding-right: 12rem;
  font-size: 0.95rem;
}
.file__rows dt { color: #75684f; }
.file__rows dd { margin: 0; }
.file--longstamp .file__rows { padding-right: 15rem; }
@media (max-width: 620px) {
  .file__stamp { position: static; display: inline-block; margin: 0.3rem 0 1rem 0.3rem; }
  .file__rows, .file--longstamp .file__rows { padding-right: 0; }
}
.file__lede { font-size: 1.1rem; }
.file__scrawl {
  display: block;
  margin: 0.1rem 0 1rem;
  color: #c4121c;
  font-family: var(--marker);
  font-size: 1.3rem;
  line-height: 1.15;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.file__hand { color: #c4121c; font-family: var(--marker); }
.file__quote {
  margin: 1.2rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 0.3rem solid #b3121b;
  background: #fffdf3;
}
.file__quote p { margin: 0 0 0.5rem; }
.file__quote mark { padding: 0 0.1em; background: #ffe27a; color: inherit; }
.file__quote footer { color: #75684f; font-size: 0.8rem; }
.file__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 1.1rem 0 0;
  color: #75684f;
  font-size: 0.8rem;
}
.file__sources a { color: #c4121c; font-family: var(--marker); font-size: 0.95rem; }
.file .verdict { transform: rotate(0.5deg); }

/* The missing poster (002) */
.poster {
  padding: 0.9rem 1.1rem 1.1rem;
  background: #f1e9d4;
  color: #191919;
  font-family: var(--type);
  text-align: center;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
  transform: rotate(-1.2deg);
}
.poster p { margin: 0; }
.poster__head { font-family: var(--marker); font-size: 2.3rem; letter-spacing: 0.08em; line-height: 1.1; text-transform: uppercase; }
.poster__photo {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  margin: 0.5rem 0;
  border: 1px dashed #75684f;
  background: #dcd3c0;
  color: #5d5547;
  font-size: 0.8rem;
  line-height: 1.25;
}
.poster__what { font-size: 1.1rem; }
.poster__meta { margin-top: 0.35rem !important; color: #4b4438; font-size: 0.85rem; line-height: 1.45; }

/* A yellow sticky: the unconfirmed one */
.sticky {
  padding: 0.9rem 1.1rem 1rem;
  background: #ffe27a;
  color: #2a261f;
  font-family: var(--hand);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.18;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
  transform: rotate(1.2deg);
}
.sticky__head {
  display: block;
  margin-bottom: 0.3rem;
  color: #a20f18;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* The prescription (003) */
.rx {
  padding: 0.9rem 1.2rem 1.1rem;
  background: #fbf7ec;
  color: #2a261f;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
  transform: rotate(-1.3deg);
}
.rx p { margin: 0; }
.rx__head {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #c9bfa9;
  color: #75684f;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rx__sym { margin-top: 0.3rem !important; font-family: var(--serif); font-size: 2.2rem; line-height: 1; }
.rx__script { font-family: var(--hand); font-size: 1.55rem; font-weight: 600; line-height: 1.15; }

/* Sayre's theory, on cork (004) */
.cork {
  margin: 0;
  padding: 0.7rem 0.7rem 0.5rem;
  background:
    radial-gradient(circle at 20% 30%, rgba(60, 35, 10, 0.3) 0 1px, transparent 1.5px) 0 0 / 9px 9px,
    radial-gradient(circle at 70% 60%, rgba(255, 230, 190, 0.22) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    #a77b4c;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8), inset 0 0 0 0.35rem #5b3f22;
  transform: rotate(0.8deg);
}
.cork svg { display: block; width: 100%; height: auto; }
.cork text { fill: #191919; font-family: var(--marker); font-size: 21px; }
.cork figcaption { padding-bottom: 0.3rem; color: #241607; font-family: var(--hand); font-size: 1.35rem; font-weight: 700; text-align: center; }

/* Real photos. The doctors are suspects, so they get mugshots; a boy in a dress is evidence. */
.suspect {
  justify-self: center;
  width: min(100%, 15rem);
  margin: 0;
  padding: 0.55rem 0.55rem 0.5rem;
  background: #f1ede4;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
  transform: rotate(-1.6deg);
}
.suspect__shot { font-size: 0.62rem; }
.suspect__shot img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.suspect figcaption { padding-top: 0.4rem; color: #2a261f; font-family: var(--type); font-size: 0.85rem; line-height: 1.25; text-align: center; }
.suspect figcaption small { display: block; color: #5d5547; font-size: 0.76rem; }
.evidence { position: relative; margin: 0; padding: 0.35rem; background: #fbfaf6; box-shadow: 0 6px 12px -7px rgba(0, 0, 0, 0.75); }
.evidence img { display: block; width: 100%; height: 100%; object-fit: cover; }
.evidence .tape { top: -0.4rem; width: 104%; font-size: 0.62rem; }

/* The dress code (005): three dossiers, then the finding beside the verdict */
.dossiers { display: grid; gap: clamp(1.1rem, 2.6vw, 1.5rem); }
@media (min-width: 820px) { .dossiers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dossier {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem 1.1rem;
  background: #f5f2ea;
  color: #2a261f;
  font-family: var(--type);
  font-size: 0.93rem;
  line-height: 1.55;
  box-shadow: 0 8px 16px -10px rgba(0, 0, 0, 0.7);
}
.dossier:nth-child(1) { transform: rotate(-0.7deg); }
.dossier:nth-child(2) { transform: rotate(0.5deg); }
.dossier:nth-child(3) { transform: rotate(-0.3deg); }
.dossier p { margin: 0 0 0.7em; }
.dossier__head { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.8rem; align-items: end; margin-bottom: 0.7rem; }
.dossier__shot { aspect-ratio: 4 / 5; font-size: 0.62rem; }
@media (min-width: 820px) {
  .dossier__head { grid-template-columns: minmax(0, 1fr); }
  .dossier__shot { font-size: 0.85rem; }
}
.dossier__name { margin: 0; color: #1f1c17; font-family: var(--serif); font-size: 1.18rem; line-height: 1.2; }
.dossier__by { margin: 0.15rem 0 0 !important; color: #75684f; font-size: 0.8rem; line-height: 1.3; }
.dossier__flag { color: #a20f18; }
.dossier__later { margin-top: auto !important; padding-top: 0.4rem; border-top: 1px dashed #c9bfa9; }
.dossier__later em { margin-right: 0.5em; color: #75684f; font-style: normal; }
.dossier .file__sources { margin: 0; }
.file__pair { display: grid; gap: clamp(1.1rem, 2.6vw, 1.5rem); align-items: start; }
@media (min-width: 820px) { .file__pair { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

/* 005-A: a thick stack of its own, clipped to folder 005. It's a link to its page. */
.supplement {
  position: relative;
  display: block;
  margin: 0.6rem 0 0.9rem;
  padding: 1.3rem clamp(1.1rem, 3vw, 1.8rem) 1.2rem;
  border-radius: 0.2rem 0.5rem 0.5rem 0.2rem;
  background: linear-gradient(180deg, #efdfb8, #e2cb98);
  color: #2a261f;
  font-family: var(--type);
  text-decoration: none;
  box-shadow:
    0 3px 0 #f5f2ea, 0 5px 0 #cdb27a,
    0 8px 0 #f5f2ea, 0 10px 0 #cdb27a,
    0 13px 0 #f5f2ea, 0 15px 0 #bfa268,
    0 28px 26px -14px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s ease;
}
.supplement:hover, .supplement:focus-visible { transform: translateY(-4px) rotate(-0.3deg); }
.supplement:focus-visible { outline: 3px solid #f2cf4a; outline-offset: 3px; }
.supplement__clip { /* a bulldog clip over the top edge, holding it to the folder */
  position: absolute;
  top: -0.75rem;
  left: 50%;
  width: 4.6rem;
  height: 1.7rem;
  margin-left: -2.3rem;
  border-radius: 0.2rem 0.2rem 0.45rem 0.45rem;
  background: linear-gradient(180deg, #3b3d40, #17181a);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.supplement__label { display: block; color: #8f2318; font-size: 0.8rem; letter-spacing: 0.04em; }
.supplement__title { display: block; margin-top: 0.15rem; font-size: clamp(1.25rem, 3.4vw, 1.8rem); letter-spacing: 0.04em; line-height: 1.2; text-transform: uppercase; }
.supplement__line { display: block; max-width: 34rem; margin-top: 0.3rem; color: #4d3a19; font-size: 0.95rem; }
.supplement__stamp { position: absolute; right: clamp(1rem, 4vw, 2.4rem); bottom: 1.1rem; font-size: clamp(0.85rem, 2.4vw, 1.15rem); }
@media (max-width: 620px) {
  .supplement__stamp { position: static; display: inline-block; margin-top: 0.7rem; }
}

/* John/Joan: the same paper in a black folder, with everything else taken away */
.file--plain .file__tab { background: #191817; color: #f5f2ea; }
.file--plain .file__folder { background: #191817; }
.file--plain .file__sheet {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  background: #fbfaf6;
  font-size: 1.05rem;
  line-height: 1.7;
  box-shadow: none;
  transform: none;
}
.file__noverdict { padding-top: 0.5rem; }
.file--plain .file__sources a { font-family: var(--type); font-size: 0.85rem; }
.file__help { margin-top: 1.2rem !important; padding-top: 0.9rem; border-top: 1px solid #d9d4c6; font-size: 0.9rem; }
.file__help a { color: inherit; }

/* The way out of 005 to its long version, and back */
.cases__filing a { color: inherit; }

/* =====================================================================
   The cabinet and the desk, on both pages. The drawer
   is a stack of real folders, back to front, each tab standing clear of
   the folder in front of it. A pulled folder keeps its tab in the same
   column, so it reads as the same piece of card leaving the drawer.
   script.js ("the file drawer") does the pulling.
   ===================================================================== */
.cabinet, .case-desk {
  --cols: 6;
  --tab-h: 3.3rem;
  --tab-gap: 0.35rem;
  --step: 0.62rem;
  --closed-h: clamp(13rem, 30vw, 19rem);
}
.slot-0 { --i: 0; --x: 0; }
.slot-1 { --i: 1; --x: 1; }
.slot-2 { --i: 2; --x: 2; }
.slot-3 { --i: 3; --x: 3; }
.slot-4 { --i: 4; --x: 4; }
.slot-5 { --i: 5; --x: 5; }
/* Fewer columns on narrower screens: tabs share a column, with enough steps between them to clear. */
@media (max-width: 939.98px) {
  .cabinet, .case-desk { --cols: 4; --step: 0.92rem; }
  .slot-4 { --x: 0; } .slot-5 { --x: 1; }
}
@media (max-width: 619.98px) {
  .cabinet, .case-desk { --cols: 3; --step: 1.2rem; }
  .slot-3 { --x: 0; } .slot-4 { --x: 1; } .slot-5 { --x: 2; }
}

.cabinet {
  --rows: 5;
  --lip: 3.4rem;
  position: relative;
  max-width: 1040px;
  margin: 2.4rem auto 0;
}
.cabinet__drawer {
  position: relative;
  height: calc(var(--tab-h) + var(--rows) * var(--step) + 0.9rem + var(--lip));
  margin: 0;
  padding: 0;
  list-style: none;
}
.cabinet__drawer li {
  position: absolute;
  top: calc(var(--i) * var(--step));
  left: 0;
  right: 0;
  pointer-events: none; /* only the tab is a target; the folder behind it is scenery */
  filter: brightness(calc(0.84 + var(--i) * 0.028)); /* further back is further from the lamp */
  transition: transform 0.15s ease, filter 0.9s ease;
}
.cabinet__drawer li::after { /* the folder behind the tab */
  content: "";
  display: block;
  height: calc((var(--rows) - var(--i)) * var(--step) + 0.9rem + var(--lip));
  margin-top: -1px;
  border-radius: 0.3rem 0.3rem 0 0;
  background: #e2cb98;
  box-shadow: 0 -2px 4px -1px rgba(50, 32, 8, 0.55);
}
.cabinet__drawer li:hover, .cabinet__drawer li:focus-within { transform: translateY(-0.4rem); }
.cabinet__drawer li.is-out { visibility: hidden; }

/* A tab, in the drawer or on a pulled folder: the same size, the same place */
.cabinet__drawer a, .case-desk .file__tab {
  display: block;
  box-sizing: border-box;
  width: calc(100% / var(--cols) - var(--tab-gap));
  height: var(--tab-h);
  margin-left: calc(var(--x) * 100% / var(--cols));
  padding: 0.36rem 0.55rem 0;
  overflow: hidden;
  border-radius: 0.55rem 0.55rem 0 0;
  background: #e2cb98;
  color: #4d3a19;
  font-family: var(--type);
  font-size: 0.78rem;
  line-height: 1.14;
  text-align: left;
  text-decoration: none;
}
.cabinet__drawer a { position: relative; pointer-events: auto; }
.cabinet__drawer a:focus-visible { outline: 2px solid #f2cf4a; outline-offset: -2px; }
.cabinet__drawer b, .case-desk .file__tab b { display: block; color: #8f2318; font-size: 0.72rem; font-weight: 400; }
.case-desk .file__tab { margin-bottom: -1px; }
/* John/Joan is the one black folder, in the drawer as on the desk. It stands at the front of the
   drawer and doesn't bounce. The hairline keeps its tab visible against the black behind it. */
.cabinet__drawer li.is-plain a, .cabinet__drawer li.is-plain::after, .case-desk .file--plain .file__tab { background: #191817; color: #f5f2ea; }
.cabinet__drawer li.is-plain b, .case-desk .file--plain .file__tab b { color: #f5f2ea; }
.cabinet__drawer li.is-plain { filter: none; }
.cabinet__drawer li.is-plain:hover, .cabinet__drawer li.is-plain:focus-within { transform: none; }
.cabinet__drawer li.is-plain a { box-shadow: inset 1px 0 0 #8d8880, inset -1px 0 0 #8d8880, inset 0 1px 0 #8d8880; }
/* Worn: uneven soft corners, and pale where a thumb keeps coming back to it */
.cabinet__drawer li.is-plain a, .case-desk .file--plain .file__tab {
  border-radius: 0.95rem 0.4rem 0 0;
  background:
    radial-gradient(ellipse 34% 48% at 72% 0, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0) 72%),
    radial-gradient(ellipse 26% 34% at 8% 4%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 70%),
    #191817;
}
/* The tab: the dates, and the doctors' name for the case overruled by hand */
.tab__dates { float: right; margin-left: 0.4em; color: #c4beb3; font-size: 0.68rem; line-height: 1.3; }
.tab__name { position: relative; display: block; }
.tab__name s { color: #9d978c; }
.tab__david {
  position: absolute;
  left: 3.45rem;
  top: -0.25rem;
  color: #fbf8f0;
  font-family: var(--hand);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-4deg);
}
/* Reaching for it: the rest of the drawer goes dark */
.cabinet__front { transition: filter 0.9s ease; }
.cabinet.is-hushed .cabinet__drawer li:not(.is-plain) { filter: brightness(0.4); }
.cabinet.is-hushed .cabinet__front { filter: brightness(0.55); }

/* The drawer's steel front */
.cabinet__front {
  position: absolute;
  left: -0.9rem;
  right: -0.9rem;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  height: var(--lip);
  border-radius: 0.2rem;
  background: linear-gradient(180deg, #55584e, #34362f 60%, #27291f);
  box-shadow: 0 16px 26px -12px #000, inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.cabinet__plate {
  padding: 0.2rem 0.8rem;
  border: 2px solid #a9aeb4;
  background: #f5f2ea;
  color: #2a261f;
  font-family: var(--type);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.cabinet__pull {
  width: clamp(4rem, 12vw, 7rem);
  height: 0.75rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #d3d6d9, #7f8387);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.8);
}

/* The desk: the homepage's wood, full-bleed under the cabinet */
.case-desk {
  position: relative;
  min-height: 21rem;
  margin: 0 calc(-1 * clamp(0.75rem, 3vw, 2rem));
  padding: clamp(1.6rem, 4vw, 2.6rem) clamp(0.75rem, 3vw, 2rem) clamp(2rem, 5vw, 3.2rem);
  background:
    radial-gradient(ellipse 58% 420px at 50% 180px, rgba(255, 190, 110, 0.26), rgba(255, 190, 110, 0) 72%),
    repeating-linear-gradient(91deg, rgba(0, 0, 0, 0) 0 9vw, rgba(0, 0, 0, 0.32) 9vw calc(9vw + 1px)),
    linear-gradient(170deg, #5a3820, #3a2313 55%, #29180c);
  box-shadow: inset 0 2.6rem 2.4rem -2rem #000, inset 0 -2.6rem 2.4rem -2rem #000;
}
/* While John/Joan is out, the lamp is off and the desk is cleared */
.case-desk::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #0b0908;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}
.case-desk.is-hushed::before { opacity: 0.86; }
.case-desk.is-hushed .case-prop { opacity: 0; }
.case-prop { position: absolute; z-index: 0; font-size: 0.5rem; pointer-events: none; transition: opacity 1.2s ease; }
.case-prop.ring { left: 27%; top: 11rem; width: clamp(4rem, 7vw, 5.5rem); }
.case-prop.mug { left: 9%; top: 3.2rem; width: clamp(4rem, 8vw, 6rem); }
.case-prop.pen { right: 8%; top: 6.5rem; width: clamp(9rem, 22vw, 15rem); transform: rotate(-9deg); }
.case-desk__hint {
  position: relative;
  z-index: 1;
  margin: 0;
  padding-top: 6.6rem;
  color: #e6d3a8;
  font-family: var(--marker);
  font-size: clamp(1.4rem, 4vw, 2rem);
  text-align: center;
  transform: rotate(-1.5deg);
}
/* It comes after the folders in the page, so with one out it sits underneath, once that has landed */
.case-desk.has-file .case-desk__hint { padding-top: 1.6rem; }
.case-desk .file.is-closed ~ .case-desk__hint, .case-desk .file.is-opening ~ .case-desk__hint { visibility: hidden; }
/* While John/Joan is the last file picked, the page stops joking */
.cases.is-sobered .case-desk__hint, .cases.is-sobered .cases__jokes { display: none; }
html:not(.js) .case-desk__hint, html:not(.js) .case-prop, html:not(.js) .shoebox, html:not(.js) .cases__status { display: none; }
.cases__status {
  margin: 1.6rem auto 0;
  color: var(--noir-soft);
  font-family: var(--type);
  font-size: 0.85rem;
}
.cases__status b { color: #e2483d; font-weight: 400; }

/* A folder on the desk. With script on, only the one that's out shows. */
.case-desk .file { position: relative; z-index: 1; transform-origin: 50% 0; }
.case-desk .file:first-of-type { margin-top: 0; }
.js .case-desk .file { display: none; margin-top: 0; perspective: 1500px; perspective-origin: 50% 0; }
.js .case-desk .file.is-out { display: block; }
.js .case-desk .file.is-flying { z-index: 40; }
.file__title:focus { outline: none; }
.js .case-desk .file.is-closed .file__folder { height: var(--closed-h); overflow: hidden; }
.js .case-desk .file.is-opening .file__folder { overflow: hidden; }

/* The cover: what's on top until it flips up off its top edge */
.file__cover {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  height: var(--closed-h);
  border-radius: 0.3rem 0.6rem 0.6rem 0.6rem;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.2), transparent 55%),
    linear-gradient(180deg, #e2cb98, #c6a367);
  box-shadow: 0 30px 55px -24px #000, inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: #5e4720;
  font-family: var(--type);
  transform-origin: 50% 0;
}
.js .case-desk .file.is-closed .file__cover, .js .case-desk .file.is-opening .file__cover { display: block; }
.file__coverlabel {
  position: absolute;
  top: 12%;
  left: 5%;
  padding: 0.7rem 1.1rem;
  background: #f5f2ea;
  color: #2a261f;
  box-shadow: 0 2px 5px rgba(60, 40, 10, 0.45);
  transform: rotate(-1deg);
}
.file__coverlabel b { display: block; font-weight: 400; color: #75684f; font-size: 0.8rem; }
.file__coverlabel span { font-size: clamp(1.1rem, 3vw, 1.6rem); letter-spacing: 0.04em; text-transform: uppercase; }
.file__coverstamp { position: absolute; right: 7%; bottom: 16%; font-size: clamp(1rem, 3.2vw, 1.8rem); }
.file__coverring {
  position: absolute;
  right: 26%;
  top: 8%;
  width: clamp(4rem, 11vw, 7rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 59%, rgba(70, 40, 10, 0.35) 62%, rgba(70, 40, 10, 0.12) 67%, transparent 72%);
}

/* John/Joan's cover: plain black, with nothing on it */
.file--plain .file__cover { background: #191817; box-shadow: 0 30px 55px -24px #000; }

/* File it away / next file */
.file__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 0.8rem; }
.js .case-desk .file.is-closed .file__actions, .js .case-desk .file.is-opening .file__actions { display: none; }

/* 001: the photo, taped, and its enlargements (the home page's crops of the same picture) */
.print {
  position: relative;
  margin: 0;
  padding: 0.7rem;
  background: #f6f3ec;
  font-size: 0.72rem;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
  transform: rotate(-1.4deg);
}
.print .tape { width: 104%; }
.snaps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; align-items: start; }
.snap { margin: 0; padding: 0.4rem 0.4rem 0; background: #f2efe7; box-shadow: 0 8px 14px -9px rgba(0, 0, 0, 0.8); }
.snap:nth-child(1) { transform: rotate(1.8deg); }
.snap:nth-child(2) { transform: rotate(-1.2deg); }
.snap:nth-child(3) { transform: rotate(1deg); }
.snap .crop { filter: grayscale(1) contrast(1.25) brightness(1.02); }
.snap figcaption { padding: 0.25rem 0 0.35rem; color: #222; font-family: var(--hand); font-size: 1.05rem; font-weight: 700; line-height: 1.05; text-align: center; }

/* 002: the report rows type themselves; the tally counts the churches */
.is-untyped { visibility: hidden; }
.sightings {
  position: absolute;
  top: 8.9rem;
  right: 1.3rem;
  width: 10.4rem;
  pointer-events: none;
}
.sightings svg { display: block; width: 100%; height: auto; overflow: visible; }
.sightings path {
  fill: none;
  stroke: #c4121c;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.07s linear;
}
.sightings.is-drawn path { stroke-dashoffset: 0; }
.sightings__n {
  position: absolute;
  right: 0.2rem;
  bottom: -0.2rem;
  color: #c4121c;
  font-family: var(--marker);
  font-size: 1.5rem;
  opacity: 0;
  transform: rotate(-7deg) scale(1.5);
  transition: opacity 0.14s ease, transform 0.18s cubic-bezier(0.2, 1.4, 0.35, 1);
}
.sightings.is-drawn .sightings__n { opacity: 1; transform: rotate(-7deg); }
@media (max-width: 620px) {
  .sightings { position: relative; top: auto; right: auto; margin: -0.5rem 0 1.2rem; }
}

/* 002: the shoebox. The lid props up against the back; the stage drops to make room for it. */
.shoebox { container-type: inline-size; }
.shoebox__stage { position: relative; aspect-ratio: 16 / 8.4; transition: margin-top 0.45s cubic-bezier(0.3, 0.8, 0.3, 1); }
.shoebox.is-open .shoebox__stage { margin-top: 26cqw; }
.shoebox__box {
  position: absolute;
  inset: 0;
  border: 0.5rem solid #b97e43;
  background: #3b2a1a;
  box-shadow: inset 0 0 1.6rem rgba(0, 0, 0, 0.8), 0 10px 18px -12px rgba(0, 0, 0, 0.8);
}
.shoebox__clean { /* where something sat, in the dust */
  position: absolute;
  left: 50%;
  top: 34%;
  width: 34%;
  height: 48%;
  border: 1px dashed rgba(240, 222, 190, 0.4);
  background: rgba(240, 222, 190, 0.07);
  transform: rotate(-3deg);
}
.shoebox__note {
  position: absolute;
  left: 7%;
  bottom: 13%;
  margin: 0;
  padding: 0.3rem 0.8rem;
  background: #f5f2ea;
  color: #2a261f;
  font-family: var(--hand);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  transform: rotate(-5deg);
}
.shoebox__lid {
  position: absolute;
  z-index: 2;
  inset: -3% -2%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(170deg, #cf9150, #a96a33);
  box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: #2b1a0a;
  font-family: var(--type);
  cursor: pointer;
  transition: transform 0.45s cubic-bezier(0.3, 0.8, 0.3, 1.1);
}
.shoebox:not(.is-open) .shoebox__lid:hover { transform: translateY(-5px) rotate(-0.7deg); }
.shoebox.is-open .shoebox__lid { transform: translate(3%, -60%) rotate(-4deg); }
.shoebox__lid:focus-visible { outline: 3px solid #f2cf4a; outline-offset: 2px; }
.shoebox__brand { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.shoebox__scrawl { color: #a20f18; font-family: var(--marker); font-size: 1.5rem; line-height: 1.2; transform: rotate(-3deg); }
.shoebox__cue { font-size: 0.72rem; text-decoration: underline; }
.shoebox__saturn {
  position: absolute;
  z-index: 1;
  left: 58%;
  top: 40%;
  width: clamp(4rem, 26cqw, 6rem);
  opacity: 0;
  pointer-events: none;
}
.shoebox.is-open .shoebox__saturn { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .shoebox.is-open .shoebox__saturn g { animation: saturn-bob 4.5s ease-in-out infinite; }
}
@keyframes saturn-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}

/* Case File 005-A (case-studies/breeching/): the rack, the motives, the witnesses, the chronology.
   Not .docket: that is the home page's, and script.js expects a <summary> inside it. */
@media (min-width: 621px) { .file__stamp + .file__lede { padding-right: 10rem; } }
.rack {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.1rem, 2.6vw, 1.5rem) 0.7rem;
  margin: 0;
  padding: 0;
}
@media (min-width: 820px) { .rack { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 819px) { .rack__item:last-child { grid-column: 1 / -1; } }
.rack__item {
  padding: 0 0.7rem 0.9rem;
  border-top: 0.32rem solid #6d7278;
  background: #f5f2ea;
  color: #2a261f;
  font-family: var(--type);
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 8px 16px -10px rgba(0, 0, 0, 0.7);
}
.rack__art {
  display: block;
  width: min(100%, 7rem);
  height: auto;
  margin: 0 auto 0.5rem;
  fill: #fffdf3;
  stroke: #2a261f;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.rack__art .d { fill: #5c5344; }
.noir .rack__age {
  margin: 0 0 0.25rem;
  color: #8f2318;
  font-family: var(--type);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.25;
}
.rack__item p { margin: 0; }

.motives { margin: 0 0 1rem; }
.motives dt { margin-top: 0.8rem; color: #8f2318; }
.motives dt:first-child { margin-top: 0; }
.motives dd { margin: 0; }

.file__quote--side { margin: 0; transform: rotate(0.5deg); box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8); color: #2a261f; font-family: var(--type); font-size: 0.93rem; line-height: 1.5; }
.file__quotehead { color: #8f2318; }

.sticky__links { display: flex; flex-wrap: wrap; gap: 0 0.9rem; margin-top: 0.4rem; }
.sticky__links a { color: #a20f18; }

.witnesses__scroll { overflow-x: auto; margin: 0 0 1rem; }
.witnesses { width: 100%; border-collapse: collapse; font-size: 0.9rem; line-height: 1.35; }
.witnesses th { padding: 0 0.7rem 0.3rem 0; border-bottom: 0.12rem solid #2a261f; color: #75684f; font-weight: 400; text-align: left; }
.witnesses td { padding: 0.35rem 0.7rem 0.35rem 0; border-bottom: 1px dashed #c9bfa9; vertical-align: top; }
.witnesses th:last-child, .witnesses td:last-child { padding-right: 0; }

.chrono {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.55rem 1rem;
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.chrono dt { color: #8f2318; }
.chrono dd { margin: 0; }
@media (max-width: 620px) {
  .chrono { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .chrono dd { margin-bottom: 0.65rem; }
}

/* Case File 002-A (case-studies/christian-perspective/): highlighted verses outside a blockquote,
   and a form with no stamp beside it to clear. */
.motives mark, .chrono mark { padding: 0 0.1em; background: #ffe27a; color: inherit; }
.file__scrawl--after { margin-top: 1rem; }
.file__rows--full { padding-right: 0; }
.file__quote--side b { color: #8f2318; font-weight: 400; }
.file__more { color: #c4121c; font-family: var(--marker); }
/* A supplement clipped to a two-column folder runs the full width under both columns. */
.file__folder > .supplement { grid-column: 1 / -1; }

/* Case File 002-B (case-studies/follow-the-foreskins/) has seven folders: a seventh slot, a seventh
   column on wide screens, and one more step back in the drawer. Narrower screens share columns as above. */
.slot-6 { --i: 6; --x: 6; }
.cabinet--seven, .case-desk--seven { --cols: 7; }
.cabinet--seven { --rows: 6; }
@media (max-width: 939.98px) {
  .cabinet--seven, .case-desk--seven { --cols: 4; }
  .slot-6 { --x: 2; }
}
@media (max-width: 619.98px) {
  .cabinet--seven, .case-desk--seven { --cols: 3; }
  .slot-6 { --x: 0; }
}

/* The highlighter: any <mark> on a folder's paper, in a quote, a list or the running text. On the
   desk it sweeps on, line by line, the first time it comes into view (script.js, "the highlighter"
   sets is-swept and a pace to suit its length), and only once its folder is open, so one that came
   into view under the cover sweeps when the cover flips up. Plain highlighting without script or
   with reduced motion. */
.file__sheet mark {
  padding: 0 0.1em;
  background: linear-gradient(#ffe27a, #ffe27a) 0 0 / 100% 100% no-repeat;
  color: inherit;
}
@media (prefers-reduced-motion: no-preference) {
  .js .case-desk .file__sheet mark { background-size: 0% 100%; transition: background-size 0.8s cubic-bezier(0.45, 0.05, 0.3, 1) 0.3s; }
  .js .case-desk .file.is-out:not(.is-closed):not(.is-opening) .file__sheet mark.is-swept { background-size: 100% 100%; }
}

/* =====================================================================
   THE NOIR LOOK (Noir button on): the cabinet and the desk in silver. The folders stay manila and the
   highlighter stays yellow.
   ===================================================================== */
.noir-mode .noir.cases {
  background: var(--noir-grain), linear-gradient(180deg,
    var(--paper) 0, #3b3c40 3.5rem, #17181b 6.5rem, var(--noir) 9rem,
    var(--noir) calc(100% - 8.5rem), #17181b calc(100% - 6rem), #3b3c40 calc(100% - 3rem), var(--paper) 100%);
}
.noir-mode .snap .crop { filter: contrast(1.25) brightness(1.02); }
.noir-mode .cabinet__front { background: linear-gradient(180deg, #4e5054, #303135 60%, #222327); }
.noir-mode .case-desk {
  background:
    radial-gradient(ellipse 58% 420px at 50% 180px, rgba(238, 238, 232, 0.2), rgba(238, 238, 232, 0) 72%),
    repeating-linear-gradient(91deg, rgba(0, 0, 0, 0) 0 9vw, rgba(0, 0, 0, 0.32) 9vw calc(9vw + 1px)),
    linear-gradient(170deg, #3d3e41, #27282b 55%, #18191b);
}
.noir-mode .case-desk__hint { color: #dededa; }
.noir-mode .sticky { background: #dcdad3; }
.noir-mode .shoebox__box { border-color: #77777a; background: #26272b; }
.noir-mode .shoebox__lid { background: linear-gradient(170deg, #97979a, #6f6f72); color: #141414; }
