:root {
  --pearl: #d4cfc2;
  --ink: #11110e;
  --mute: #5a564c;
  --desk: #2c2b28;
  --bezel: #141412;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--pearl);
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.grain::before,
body.grain::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  opacity: 0.11;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.dither {
  filter: grayscale(1) contrast(1.35) brightness(1.04);
  mix-blend-mode: multiply;
}

.sketches {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 90;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
}
.sketches:hover { opacity: 1; }

.flash { animation: eink-flash 0.42s steps(3, end); }
@keyframes eink-flash {
  0% { filter: invert(1) contrast(1.8); }
  35% { filter: brightness(2.2); }
  100% { filter: none; }
}

/* ---------- Device: the actual reader ---------- */
body.device {
  background: var(--desk);
  display: grid;
  place-items: center;
  padding: 28px 16px;
}
body.device .sketches { color: #cfc8b8; }
.bezel {
  background: var(--bezel);
  width: min(440px, 100%);
  padding: 16px 14px 22px;
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px #000, 0 18px 50px rgba(0,0,0,0.4);
}
.hw {
  height: 5px;
  width: 42px;
  margin: 0 auto 12px;
  background: #2a2a26;
  border-radius: 99px;
}
.screen {
  background: var(--pearl);
  color: var(--ink);
  min-height: 720px;
  padding: 12px 16px 16px;
  position: relative;
  overflow: hidden;
}
body.device.invert .screen {
  background: #14140f;
  color: var(--pearl);
}
body.device.invert .dither { mix-blend-mode: screen; filter: grayscale(1) invert(1) contrast(1.2); }
body.device.invert .bar,
body.device.invert .foot { border-color: var(--pearl); }
body.device.invert .ghost { color: #8a8578; }
body.device.invert .fill { background: var(--pearl); color: #14140f; }

.bar {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-bottom: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--ink);
}
.foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 28px;
  padding-top: 10px;
  border-top: 1px solid var(--ink);
}
.ghost { color: var(--mute); }
.device h1 {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 8px 0 14px;
}
.device .lede { color: var(--mute); margin-bottom: 20px; }
.device img { width: 72%; margin: 8px auto 22px; }
.fill {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--ink);
  color: var(--pearl);
  padding: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}

/* ---------- Folio: paper, louder ---------- */
body.folio { background: #ebe6d8; }
.folio-wrap { max-width: 1080px; margin: 0 auto; padding: 56px 24px 100px; }
.folio .mast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  border-top: 3px solid #111;
  border-bottom: 1px solid #111;
  padding: 8px 0 10px;
  margin-bottom: 28px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.folio h1 {
  font-family: Newsreader, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(72px, 16vw, 168px);
  line-height: 0.82;
  letter-spacing: -0.05em;
  margin: 0 0 8px;
}
.folio .tag {
  font-family: Newsreader, serif;
  font-size: clamp(22px, 3vw, 34px);
  margin: 0 0 36px;
}
.folio .spread {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: start;
}
.folio .col p { max-width: 38ch; margin: 0 0 18px; color: #3d3a32; }
.folio .num {
  font-family: Newsreader, serif;
  font-size: clamp(90px, 14vw, 160px);
  line-height: 0.8;
  letter-spacing: -0.06em;
}
.folio .num span {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 10px;
}
.folio img { width: 100%; }
.folio .rule { border-top: 1px solid #111; margin: 48px 0 0; padding-top: 18px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; }
.folio .cta {
  display: inline-block;
  border: 1px solid #111;
  padding: 10px 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
}
.folio .cta.solid { background: #111; color: #ebe6d8; }

/* ---------- After: night, louder ---------- */
body.after {
  background: #0d0d0b;
  color: #e7e2d4;
  overflow-x: hidden;
}
.after .sketches { color: #e7e2d4; }
.after-wrap { min-height: 100dvh; padding: 72px 24px 80px; max-width: 1100px; margin: 0 auto; }
.after .wall {
  font-family: Newsreader, "Times New Roman", serif;
  font-size: clamp(64px, 14vw, 150px);
  line-height: 0.84;
  letter-spacing: -0.05em;
  margin: 0 0 28px;
}
.after .row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: end;
}
.after img { width: 100%; filter: grayscale(1) contrast(1.15); }
.after .copy { max-width: 36ch; color: #b7b19f; margin-bottom: 22px; }
.after .cta {
  display: inline-block;
  border: 1px solid #e7e2d4;
  padding: 12px 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.after .meta {
  margin-top: 56px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8b8676;
}

/* ---------- One: single page, more play ---------- */
body.one { background: var(--pearl); }
body.one.invert { background: #12120e; color: var(--pearl); }
body.one.invert .status,
body.one.invert .chap,
body.one.invert .buy,
body.one.invert .cell { border-color: var(--pearl); }
body.one.invert .mute { color: #a39c8c; }
body.one.invert .solid { background: var(--pearl); color: #12120e; }
body.one.invert .dither { mix-blend-mode: screen; filter: grayscale(1) invert(1) contrast(1.15); }
.status {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 20px;
  background: inherit;
  border-bottom: 1px solid var(--ink);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.status .clock {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
}
.one-wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px 100px; }
.one h1 {
  font-family: Newsreader, serif;
  font-weight: 400;
  font-size: clamp(48px, 10vw, 92px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 20px 0 16px;
}
.mute { color: var(--mute); }
.one .hero-img { width: min(300px, 70%); margin: 28px 0; }
.chap {
  border-top: 1px solid var(--ink);
  padding: 28px 0;
}
.chap .n { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.cell { padding: 16px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.cell:nth-child(2n) { border-right: none; }
.buy { border: 1px solid var(--ink); padding: 18px; margin-top: 8px; }
.plan {
  display: flex;
  justify-content: space-between;
  border: 1px solid currentColor;
  padding: 10px 12px;
  margin: 8px 0;
}
.plan.on { background: var(--ink); color: var(--pearl); }
body.one.invert .plan.on { background: var(--pearl); color: #12120e; }
.solid {
  display: inline-block;
  margin-top: 12px;
  background: var(--ink);
  color: var(--pearl);
  padding: 12px 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.clock {
  font-family: Newsreader, serif;
  font-size: clamp(40px, 8vw, 72px);
  letter-spacing: -0.04em;
}

/* ---------- Panel: e-ink home ---------- */
body.panel { background: #cfcab8; }
body.panel.invert {
  background: #11110e;
  color: #d8d3c4;
}
body.panel.invert .panel-shell { background: #16160f; border-color: #d8d3c4; }
body.panel.invert .top,
body.panel.invert .lib,
body.panel.invert .doc,
body.panel.invert section,
body.panel.invert .buy,
body.panel.invert .plan { border-color: #d8d3c4; }
body.panel.invert .doc:hover,
body.panel.invert .doc:focus { background: #d8d3c4; color: #16160f; }
body.panel.invert .solid { background: #d8d3c4; color: #16160f; }
body.panel.invert .dither { mix-blend-mode: screen; filter: grayscale(1) invert(1) contrast(1.15); }
body.panel.invert .mute,
body.panel.invert .doc i { color: #9a9484; }
.panel-shell {
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 0 80px;
  border-left: 1px solid #111;
  border-right: 1px solid #111;
  background: #d8d3c4;
}
.panel .top {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #111;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.panel h1 {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 22px 16px 10px;
}
.panel .lib { border-top: 1px solid #111; }
.panel section { display: none; }
.panel section:target { display: block; }
body.panel:has(section:target) .lib,
body.panel:has(section:target) .panel-shell > h1 { display: none; }
.panel .doc {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #111;
  align-items: baseline;
}
.panel .doc:hover,
.panel .doc:focus { background: #111; color: #d8d3c4; }
.panel .doc b { font-weight: 400; }
.panel .doc i { font-style: normal; color: var(--mute); font-size: 11px; }
.panel .doc:hover i { color: inherit; }
.panel section { padding: 28px 16px; border-top: 1px solid #111; }
.panel h2 {
  font-family: Newsreader, serif;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.panel .tube { width: 56%; margin: 12px auto 20px; }
.panel .back {
  display: inline-block;
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
}

@media (max-width: 720px) {
  .folio .spread,
  .folio .mast,
  .after .row,
  .grid2 { grid-template-columns: 1fr; }
  .cell:nth-child(2n) { border-right: none; }
  .panel-shell { border-left: none; border-right: none; }
  body.device { padding: 12px 8px 28px; }
  .device .screen { min-height: 0; }
  .device h1 { font-size: 22px; }
  .device img { width: 58%; }
}
