/* ------------------------------------------------------------------
   Beautifully Wrong — site shell
   A lab journal. The shell stays quiet and bookish; each experiment
   ("entry") carries its own art direction inside its scene.
   Identity motif: the proofreader's mark. Something was marked wrong,
   and the editor wrote "stet" — let it stand.
------------------------------------------------------------------- */

:root {
  --paper: #fbfaf7;
  --ink: #1f1c17;
  --faded: #6e675c;
  --rule: #e2dcd0;
  --rule-dark: #1f1c17;
  --red: #bf3617; /* red pen */
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --ui-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(31, 28, 23, 0.4);
}

a:hover {
  text-decoration-color: var(--red);
  color: var(--red);
}

img { max-width: 100%; display: block; }

::selection { background: rgba(191, 54, 23, 0.16); }

/* ---- layout bands ------------------------------------------------ */

.band {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.prose {
  width: min(660px, calc(100% - 48px));
  margin-inline: auto;
}

/* ---- wordmark + the stet mark ------------------------------------ */

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark .wrong {
  position: relative;
  display: inline-block;
}

/* the red strike — drawn slightly askew, like a real pen */
.wordmark .wrong::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -3%;
  top: 54%;
  height: 0.075em;
  min-height: 1.5px;
  background: var(--red);
  border-radius: 2px;
  transform: rotate(-2.2deg);
  opacity: 0.85;
  pointer-events: none;
}

.stet {
  font-style: italic;
  color: var(--red);
  font-size: 0.32em;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: super;
  margin-left: 0.18em;
  white-space: nowrap;
}

/* ---- mini masthead (entry pages) --------------------------------- */

.masthead-mini {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--rule);
}

.masthead-mini .wordmark { font-size: 22px; }

.entry-pos {
  font-size: 14px;
  font-style: italic;
  color: var(--faded);
}

/* ---- entry header ------------------------------------------------- */

.entry-head {
  padding: 64px 0 40px;
  text-align: left;
}

.series-line {
  margin: 0 0 18px;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faded);
  font-weight: 500;
}

.series-line em {
  font-style: normal;
  color: var(--red);
}

.entry-head h1 {
  margin: 0 0 22px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.dek {
  margin: 0;
  font-size: clamp(20px, 2.1vw, 24px);
  line-height: 1.45;
  font-style: italic;
  color: var(--faded);
  max-width: 56ch;
  text-wrap: pretty;
}

/* ---- figure / scene ----------------------------------------------- */

.scene-figure {
  margin: 24px auto 0;
}

.scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--rule);
}

/* cinematic edge-darkening — add .scene-vignette inside dark scenes */
.scene-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.38);
}

/* ---- reveal on scroll (subtle rise; disabled for reduced motion) ---- */

[data-reveal] {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 700ms cubic-bezier(0.2, 0.6, 0.2, 1), translate 700ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

[data-reveal].revealed {
  opacity: 1;
  translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    translate: none;
    transition: none;
  }
}

/* film grain for cinematic scenes — add .scene-grain inside a scene */
.scene-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  opacity: 0.085;
  mix-blend-mode: overlay;
}

.scene-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 0;
  font-size: 14.5px;
  font-style: italic;
  color: var(--faded);
}

.scene-figure figcaption .fig-no {
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}

/* shared phone frame for device scenes */
.phone-frame {
  position: relative;
  width: min(390px, calc(100% - 48px));
  min-height: 640px;
  border: 9px solid #111;
  border-radius: 54px;
  background: #fbfbf8;
  padding: 34px 16px 18px;
  box-shadow: 0 28px 70px rgba(11, 11, 11, 0.18);
}

.phone-frame::before {
  content: "";
  position: absolute;
  inset: 9px 50% auto;
  width: 112px;
  height: 30px;
  border-radius: 999px;
  background: #050505;
  transform: translateX(-50%);
}

.phone-frame::after {
  content: "";
  position: absolute;
  inset: auto 50% 12px;
  width: 116px;
  height: 4px;
  border-radius: 999px;
  background: #0b0b0b;
  transform: translateX(-50%);
}

/* ---- framed photograph (curated image inside a soft card) ----------
   A reusable way to bring a real photo into a scene without letting it
   take over: the image is framed, shadowed, and captioned, like a print
   on the wall — never a full-bleed background. Drop curated images in
   assets/scene-photos/ (see the README there) and reference them with:
     <figure class="framed-photo" style="background-image:url(...)">
       <span class="framed-photo-label">caption</span>
     </figure>
*/
.framed-photo {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 28px;
  background: #d9d4ca center / cover no-repeat;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 40px 90px rgba(20, 16, 12, 0.35);
}

.framed-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.framed-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(10, 8, 6, 0.42) 100%);
}

.framed-photo .framed-photo-label {
  position: absolute;
  left: 18px;
  bottom: 15px;
  z-index: 2;
  font-family: var(--ui-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

/* unobtrusive photo attribution, bottom-right of a scene */
.scene-credit {
  position: absolute;
  right: 15px;
  bottom: 12px;
  z-index: 3;
  font-family: var(--ui-sans);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(228, 232, 240, 0.34);
  pointer-events: none;
}

.scene-credit.on-light { color: rgba(40, 36, 32, 0.36); }

/* ---- field notes --------------------------------------------------- */

.notes {
  padding: 56px 0 8px;
}

.notes > p {
  margin: 0 0 26px;
}

.runin {
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-size: 0.95em;
}

.question {
  position: relative;
  margin-top: 40px;
  padding-left: 22px;
  font-style: italic;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
}

.question::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--red);
  transform: rotate(-1deg);
}

/* ---- entry navigation ---------------------------------------------- */

.entry-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 24px;
  margin-top: 64px;
  padding: 20px 0 0;
  border-top: 1px solid var(--rule);
  font-size: 16px;
}

.entry-nav .idx { color: var(--faded); font-style: italic; }
.entry-nav span.off { color: var(--rule); text-decoration: none; }

/* ---- footer --------------------------------------------------------- */

.colophon {
  margin-top: 96px;
  border-top: 1px solid var(--rule-dark);
  position: relative;
}

.colophon::after {
  content: "";
  display: block;
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  border-top: 1px solid var(--rule-dark);
}

.colophon-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 32px;
  padding: 26px 0 56px;
  font-size: 15px;
  color: var(--faded);
  font-style: italic;
}

.colophon-inner .motto { color: var(--ink); }
.colophon-inner .motto .red { color: var(--red); }

@media (max-width: 640px) {
  body { font-size: 17.5px; }
  .entry-head { padding: 44px 0 28px; }
  .notes { padding: 40px 0 0; }
}
