/* Nineteen Eighty-Four — its own look. Condensed poster type, typewriter records, newsprint grey and Party red.
   Loaded on top of style.css; everything is scoped to html[data-book="1984"]. */
@import url('/fonts/book-1984.css');

html[data-book="1984"] {
  --display: 'Oswald', 'Arial Narrow', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --party: #d0201f;
}
html[data-book="1984"] body[data-theme='paper']  { --bg: #e7e4dc; --ink: #151514; --muted: #67645d; --accent: #c41a1a; --card: #f2f0ea; --line: rgba(21, 21, 20, .16); }
html[data-book="1984"] body[data-theme='screen'] { --bg: #0c100f; --ink: #d3dbd6; --muted: #7d8a84; --accent: #e1483d; --card: rgba(14, 19, 18, .92); --line: rgba(211, 219, 214, .14); }
html[data-book="1984"] body[data-theme='shop']   { --bg: #1d140d; --ink: #f2e5cd; --muted: #b19a7c; --accent: #e89a52; --card: rgba(36, 25, 16, .92); --line: rgba(242, 229, 205, .15); }
html[data-book="1984"] body[data-theme='love']   { --bg: #f7f7f3; --ink: #0e0e0e; --muted: #6d6f6a; --accent: #c41a1a; --card: #ffffff; --line: rgba(14, 14, 14, .14); }
html[data-book="1984"] body[data-theme='void']   { --bg: #000; --ink: #f3f3f0; --muted: #7c7c74; --accent: #d74a49; --card: #0b0b0b; --line: rgba(243, 243, 240, .14); }
html[data-book="1984"] body[data-theme='cafe']   { --bg: #23251f; --ink: #dcdccd; --muted: #8f9182; --accent: #b9b48c; --card: rgba(34, 36, 30, .94); --line: rgba(220, 220, 205, .14); }

/* ---------- type ---------- */
html[data-book="1984"] .brand { font-family: 'EB Garamond', Georgia, serif; }
html[data-book="1984"] .kicker,
html[data-book="1984"] .note .k { font-family: var(--mono); font-weight: 500; letter-spacing: .18em; }
html[data-book="1984"] .cover h1 { font-family: var(--display); font-style: normal; font-weight: 700; text-transform: uppercase; letter-spacing: -.01em; font-size: clamp(52px, 10.5vw, 168px); line-height: .88; }
html[data-book="1984"] .cover .tag { font-family: var(--body); font-style: normal; font-size: clamp(17px, 1.05rem + .4vw, 22px); max-width: 40ch; }
html[data-book="1984"] .meta i { font-family: var(--mono); font-style: normal; font-size: 13px; }
html[data-book="1984"] .cover::after { background: linear-gradient(to top, var(--bg) 6%, rgba(12, 16, 15, .8) 38%, rgba(12, 16, 15, 0) 72%); }

/* part headers: posters, not chapter titles */
html[data-book="1984"] .part { min-height: 100vh; justify-content: flex-end; align-items: flex-start; text-align: start; padding: 20vh clamp(20px, 7vw, 120px) 14vh; }
html[data-book="1984"] .part-n {
  inset: auto auto 50% clamp(20px, 7vw, 120px); transform: translateY(40%);
  font-family: var(--display); font-weight: 700; font-size: clamp(260px, 46vw, 720px); line-height: .8;
  color: var(--accent); -webkit-text-stroke: 0; opacity: .95;
}
html[data-book="1984"] .part .kicker { background: var(--ink); color: var(--bg); padding: .45em .8em; }
html[data-book="1984"] .part h2 { font-family: var(--display); font-style: normal; font-weight: 700; text-transform: uppercase; font-size: clamp(46px, 11vw, 176px); line-height: .9; margin: .25em 0 .2em; overflow-wrap: anywhere; letter-spacing: -.01em; }
html[data-book="1984"] .part p { font-family: var(--mono); font-style: normal; font-size: clamp(14px, .8rem + .4vw, 18px); line-height: 1.5; max-width: 44ch; color: var(--ink); background: var(--bg); padding: .2em 0; }

html[data-book="1984"] .h { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .01em; font-size: clamp(30px, 1.3rem + 1.8vw, 48px); }
html[data-book="1984"] .h::before { width: 56px; height: 8px; background: var(--accent); }
html[data-book="1984"] .p.drop::first-letter { font-family: var(--display); font-weight: 700; font-size: 4.6em; line-height: .82; padding: .04em .12em 0 0; }

/* quotes are transmissions: typed, uppercase, in mono */
html[data-book="1984"] .q { text-align: start; max-width: 44rem; }
html[data-book="1984"] .q blockquote { font-family: var(--mono); font-style: normal; font-weight: 500; font-size: clamp(20px, .9rem + 1.3vw, 32px); line-height: 1.38; border-inline-start: 8px solid var(--accent); padding: .1em 0 .1em .9em; }
html[data-book="1984"] .q blockquote::before { content: none; }
html[data-book="1984"] .q.hero blockquote { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: clamp(34px, 1.2rem + 3.6vw, 76px); line-height: 1.02; border: 0; padding: 0; }
html[data-book="1984"] .q.hero.in blockquote::after { content: '▍'; color: var(--accent); animation: o84caret 1s steps(1) infinite; }
@keyframes o84caret { 50% { opacity: 0; } }

html[data-book="1984"] .note { border-radius: 0; border: 1px solid var(--line); border-inline-start: 8px solid var(--accent); background: var(--card); }
html[data-book="1984"] .note h3 { font-family: var(--display); text-transform: uppercase; font-weight: 600; letter-spacing: .01em; }

/* scene captions: teleprinter strips */
html[data-book="1984"] .card { font-family: var(--mono); font-size: .86em; line-height: 1.6; border-radius: 0; background: var(--card); border: 0; border-inline-start: 6px solid var(--accent); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }

html[data-book="1984"] .block-h h3 { font-family: var(--display); font-style: normal; font-weight: 700; text-transform: uppercase; font-size: clamp(36px, 1.6rem + 2.6vw, 68px); }
html[data-book="1984"] .more-i { border-top: 8px solid var(--accent); }
html[data-book="1984"] .more-i h4 { font-family: var(--display); font-style: normal; text-transform: uppercase; font-weight: 600; }
html[data-book="1984"] .more-i .a { font-family: var(--mono); }
html[data-book="1984"] .fin h2 { font-family: var(--display); font-style: normal; text-transform: uppercase; font-weight: 700; }
html[data-book="1984"] .fin .orn { font-family: var(--mono); letter-spacing: .3em; }
html[data-book="1984"] .btn { border-radius: 0; font-family: var(--mono); }
html[data-book="1984"] .progress { height: 4px; background: var(--party); }
html[data-book="1984"] .dots a i { border-radius: 0; }
html[data-book="1984"] .dots a span { font-family: var(--mono); }
html[data-book="1984"] .bar-mid { font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }

/* ---------- the telescreen chip and its messages ---------- */
.tele { position: fixed; z-index: 45; inset-inline-start: 14px; bottom: 14px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; font: 500 11px var(--mono); letter-spacing: .14em; color: var(--muted); background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--line); transition: color 1.4s, background 1.4s; }
.tele i { width: 8px; height: 8px; border-radius: 50%; background: var(--party); animation: o84rec 1.6s steps(2) infinite; }
.tele b { font-weight: 600; color: var(--ink); }
@keyframes o84rec { 50% { opacity: .15; } }
.tele-toast { position: fixed; z-index: 80; top: 70px; left: 50%; transform: translate(-50%, -16px); max-width: calc(100vw - 28px); width: max-content; padding: 12px 18px; font: 600 13px/1.4 var(--mono); letter-spacing: .06em; color: #fff; background: var(--party); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.tele-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- files (characters) ---------- */
.x-files { max-width: 68rem; margin: 6em auto; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.file { position: relative; padding: 1.1em 1.2em 1.3em; background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--ink); font-size: .9em; overflow: hidden; }
.file.main { grid-column: span 2; border-top-color: var(--accent); }
@media (max-width: 560px) { .file.main { grid-column: auto; } }
.file-top { display: flex; justify-content: space-between; gap: 1em; font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.file h4 { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 28px; line-height: 1; margin: .45em 0 .5em; }
.file.main h4 { font-size: 40px; }
.file dl { display: grid; grid-template-columns: auto 1fr; gap: .15em .9em; margin: 0 0 .8em; font: 12px/1.45 var(--mono); }
.file dt { color: var(--muted); letter-spacing: .1em; }
.file dd { margin: 0; }
.file p { margin: 0; line-height: 1.6; }
.rd { position: relative; cursor: pointer; background: var(--ink); color: transparent; border-radius: 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background .5s, color .5s; user-select: none; }
.rd:hover { background: color-mix(in srgb, var(--ink) 82%, var(--accent)); }
.rd.open { background: color-mix(in srgb, var(--accent) 16%, transparent); color: inherit; cursor: auto; user-select: text; }
.rd:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.unperson { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: center; align-items: center; gap: .5em; text-align: center; padding: 1em; background: var(--card); }
.unperson b { font: 700 30px var(--display); letter-spacing: .12em; color: var(--accent); border: 4px solid var(--accent); padding: .1em .5em; transform: rotate(-6deg); }
.unperson span { font: 12px var(--mono); color: var(--muted); }
[class*='vapor-syme'] .file[data-id='syme'] .unperson { display: flex; animation: o84in .9s both; }
@keyframes o84in { from { opacity: 0; transform: scale(1.06); } }

/* ---------- rewrite (The Times) ---------- */
.x-rewrite { max-width: 40rem; margin: 4em auto; }
.clip { position: relative; padding: 1.6em 1.8em 2em; background: #f1ede2; color: #1a1a18; box-shadow: 0 20px 60px rgba(0,0,0,.18); font-size: .95em; transform: rotate(-.6deg); }
.clip-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 3px double #1a1a18; padding-bottom: .4em; margin-bottom: 1em; font: 12px var(--mono); }
.clip-head b { font: 700 30px var(--display); letter-spacing: .06em; }
.clip p { margin: 0 0 .7em; line-height: 1.7; }
.ed s { text-decoration: none; background-image: linear-gradient(var(--party), var(--party)); background-repeat: no-repeat; background-position: 0 55%; background-size: 0 2px; transition: background-size .5s, opacity .5s; }
.ed ins { text-decoration: none; display: inline-block; max-width: 0; overflow: hidden; vertical-align: bottom; white-space: nowrap; color: var(--party); font: 600 .95em var(--mono); transition: max-width .9s .35s steps(24); }
.ed.on s { background-size: 100% 2px; opacity: .5; }
.ed.on ins { max-width: 20em; margin-inline-start: .35em; }
.stamp { position: absolute; inset-inline-end: 1.2em; bottom: .8em; font: 700 22px var(--display); letter-spacing: .14em; color: var(--party); border: 3px solid var(--party); padding: .05em .45em; transform: rotate(-8deg) scale(1.6); opacity: 0; transition: opacity .3s, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.x-rewrite.done .stamp { opacity: .9; transform: rotate(-8deg) scale(1); }
.hole { display: flex; align-items: center; gap: 12px; margin: 2.2em auto 0; width: max-content; font: 500 11px var(--mono); letter-spacing: .2em; color: var(--muted); }
.hole i { width: 120px; height: 14px; background: #0b0b0b; border-radius: 3px; box-shadow: inset 0 -4px 10px rgba(255, 120, 40, .0); transition: box-shadow 1s; }
.x-rewrite.done .hole i { box-shadow: inset 0 -4px 12px rgba(255, 120, 40, .9); }

/* ---------- newspeak ---------- */
.x-newspeak { max-width: 48rem; margin: 4em auto; }
.ns-lead, .ns-end { max-width: 37rem; margin: 0 auto 1.6em; }
.ns-end { margin: 1.8em auto 0; font-style: italic; }
.ns-grid { display: grid; grid-template-columns: 1fr auto; gap: 1.5em; align-items: center; padding: 1.4em; background: var(--card); border: 1px solid var(--line); }
@media (max-width: 560px) { .ns-grid { grid-template-columns: 1fr; } .ns-count { order: -1; } }
.ns-row { padding: .7em 0; border-bottom: 1px dashed var(--line); }
.ns-row:last-child { border: 0; }
.ns-old { display: flex; flex-wrap: wrap; gap: .3em .7em; font: 18px var(--mono); }
.ns-old span { transition: opacity .5s, color .5s, letter-spacing .5s; }
.ns-old span.x { opacity: .28; text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.ns-new { font: 600 18px var(--mono); color: var(--accent); max-height: 0; opacity: 0; overflow: hidden; transition: max-height .6s, opacity .6s, margin .6s; }
.ns-row.done .ns-new { max-height: 3em; opacity: 1; margin-top: .4em; }
.ns-new::before { content: '→ '; }
.ns-count { text-align: center; min-width: 7em; }
.ns-count b { display: block; font: 700 96px/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.ns-count span { font: 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Julia's note ---------- */
.x-note { margin: 3.5em auto; display: flex; justify-content: center; perspective: 900px; --f: 1; }
.scrap { position: relative; width: min(320px, 80vw); height: 180px; }
.fold { position: absolute; inset-inline: 0; height: 50%; overflow: hidden; background: #f4efe2; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.fold span { position: absolute; inset-inline: 0; height: 180px; display: grid; place-items: center; font: 700 52px var(--hand, 'Caveat'), cursive; color: #1f2c4d; transform: rotate(-3deg); }
.fold.top { top: 0; transform-origin: 50% 100%; transform: rotateX(calc(var(--f) * 178deg)); background: #ebe5d5; z-index: 2; }
.fold.top span { top: 0; }
.fold.bot { bottom: 0; }
.fold.bot span { bottom: 0; }

/* ---------- notice board ---------- */
.x-notice { max-width: 26rem; margin: 3.5em auto; text-align: center; }
.board { padding: 1.2em 1.6em 1.4em; background: var(--card); border: 1px solid var(--line); text-align: start; }
.board-h { font: 600 13px var(--mono); letter-spacing: .2em; border-bottom: 2px solid var(--ink); padding-bottom: .5em; margin-bottom: .5em; }
.board ol { margin: 0; padding-inline-start: 1.6em; font: 16px/2 var(--mono); }
.board li { overflow: hidden; max-height: 2em; transition: max-height .8s .9s, opacity .8s .9s; }
.board li.er { position: relative; }
.board li.er::after { content: ''; position: absolute; inset: .45em 0 .45em -1.6em; background: var(--ink); transform: scaleX(0); transform-origin: 0 50%; transition: transform .5s; }
.x-notice.gone li.er::after { transform: scaleX(1); }
.x-notice.gone li.er { max-height: 0; opacity: 0; }
.board-cap { font: 13px/1.6 var(--mono); color: var(--muted); margin-top: 1.2em; opacity: 0; transition: opacity 1s 1.6s; }
.x-notice.gone .board-cap { opacity: 1; }

/* ---------- the enemy ---------- */
.x-enemy { margin: 4em calc(-1 * clamp(20px, 5vw, 40px)); padding: 12vh clamp(20px, 6vw, 80px); background: var(--party); color: #fff; text-align: center; overflow: hidden; }
.war-pre { font: 600 clamp(18px, 1rem + 1vw, 30px) var(--display); letter-spacing: .14em; }
.war-w { position: relative; display: grid; font: 700 clamp(64px, 15vw, 220px)/1 var(--display); letter-spacing: -.01em; margin: .1em 0; }
.war-w span { grid-area: 1 / 1; transition: opacity .15s, transform .4s; }
.war-w .b { opacity: 0; transform: translateY(12%); color: #111; }
.x-enemy.flip .war-w .a { opacity: 0; transform: translateY(-12%); animation: o84glitch .3s steps(2) 2; }
.x-enemy.flip .war-w .b { opacity: 1; transform: none; transition-delay: .25s; }
@keyframes o84glitch { 50% { transform: translateX(-3%); opacity: 1; } }
.war-after { font: 500 clamp(14px, .8rem + .5vw, 19px) var(--mono); opacity: 0; transition: opacity .8s .8s; }
.x-enemy.flip .war-after { opacity: 1; }

/* ---------- fingers ---------- */
.x-fingers { max-width: 44rem; margin: 4em auto; --t: 0; }
.fing { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'q q' 'hand n' 'dial dial'; gap: 1.2em 2em; align-items: center; padding: 2em; background: var(--card); border: 1px solid var(--line); border-top: 8px solid var(--accent); }
.fing-q { grid-area: q; font: 500 18px var(--mono); }
.hand { grid-area: hand; display: flex; align-items: flex-end; gap: 12px; height: 180px; }
.hand i { display: block; width: 34px; border-radius: 17px 17px 6px 6px; background: var(--ink); height: calc(110px + (2 - (var(--i) - 2) * (var(--i) - 2) / 2) * 24px); }
.hand i:nth-child(5) { height: 92px; opacity: calc(var(--t) * var(--t)); filter: blur(calc((1 - var(--t)) * 6px)); }
.fing-n { grid-area: n; position: relative; display: grid; font: 700 160px/1 var(--display); min-width: 1ch; text-align: center; }
.fing-n span { grid-area: 1 / 1; }
.fing-n .to { color: var(--accent); opacity: 0; }
.x-fingers.shake .fing-n .from { animation: o84shake .18s steps(2) infinite; }
.x-fingers.shake .fing-n .to { animation: o84ghost .5s steps(2) infinite; }
.x-fingers.five .fing-n .from { opacity: 0; }
.x-fingers.five .fing-n .to { opacity: 1; animation: none; }
@keyframes o84shake { 50% { transform: translateX(4px); } }
@keyframes o84ghost { 50% { opacity: .7; transform: translateX(-6px); } }
.dial { grid-area: dial; display: flex; align-items: center; gap: 1em; color: var(--muted); font: 600 12px var(--mono); letter-spacing: .2em; }
.dial svg { width: 160px; height: 88px; color: var(--ink); }
@media (max-width: 560px) { .fing { padding: 1.3em; gap: 1em; } .hand { height: 140px; gap: 8px; } .hand i { width: 24px; } .fing-n { font-size: 110px; } }

/* ---------- dust ---------- */
.x-dust { max-width: 40rem; margin: 3em auto; }
.table { background: linear-gradient(160deg, #6e6a5e, #4e4b42); box-shadow: inset 0 0 80px rgba(0,0,0,.45), 0 20px 50px rgba(0,0,0,.35); }
.table svg { display: block; width: 100%; height: auto; }

/* ---------- the end ---------- */
.x-end { min-height: 160vh; margin: 0 calc(-1 * clamp(20px, 5vw, 40px)); }
.end { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; padding: 0 6vw; }
.end p { margin: 0; text-align: center; font: 700 clamp(48px, 9vw, 150px)/.95 var(--display); text-transform: uppercase; letter-spacing: -.01em; }
.end span { opacity: 0; transition: opacity .12s; }
.end span.on { opacity: 1; }
body.o84-off .tele i { animation: none; background: var(--muted); }
body.o84-off .tele { opacity: .4; }

/* ---------- slogans (themes) ---------- */
.x-slogans { max-width: 68rem; margin: 6em auto; }
.slogans { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0; border: 1px solid var(--line); }
.slogan { padding: 1.8em 1.6em; border: 1px solid var(--line); background: var(--card); }
.slogan h4 { font: 700 clamp(30px, 1.4rem + 1.2vw, 42px)/1 var(--display); text-transform: uppercase; margin: 0 0 .5em; position: relative; display: inline; background-image: linear-gradient(var(--accent), var(--accent)); background-repeat: no-repeat; background-size: 0 100%; transition: background-size .7s .3s, color .7s .3s; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 .08em; }
.slogan.in h4 { background-size: 100% 100%; color: #fff; }
.slogan p { margin: .9em 0 0; font-size: .92em; line-height: 1.65; }

/* ---------- lexicon ---------- */
.x-lexicon { max-width: 56rem; margin: 6em auto; }
.lex { columns: 2 22rem; column-gap: 3em; margin: 0; }
.lex-i { break-inside: avoid; padding: 0 0 1.3em; }
.lex dt { font: 700 26px var(--display); text-transform: none; }
.lex dt i { font: italic 15px var(--body); color: var(--muted); margin-inline-start: .3em; }
.lex dd { margin: .2em 0 0; font-size: .92em; line-height: 1.6; }
.lex-foot { font: 13px/1.6 var(--mono); color: var(--muted); border-top: 1px solid var(--line); padding-top: 1em; margin-top: 1em; }

@media (prefers-reduced-motion: reduce) {
  .ed ins { max-width: 20em; }
  .x-note { --f: 0 !important; }
}

/* scripts that IBM Plex Mono does not cover: use the language's own UI font;
   Arabic and Devanagari letters join, so no letter-spacing there */
html[data-book="1984"]:is([lang=ar], [lang=hi], [lang=zh], [lang=ja], [lang=ko]) { --mono: var(--ui); }
html[data-book="1984"]:is([lang=ar], [lang=hi]) :is(body, body *) { letter-spacing: 0 !important; }
