/* lukashev.online — a page with two readers.
   Human: paper, a serif for the voice, navy ink. Machine: the same page as the
   server hands it to an agent, set in mono on navy. The palette is the book
   cover's (BOOKS/2-edition/cover_design.py), so the two sites read as one hand. */

:root {
  --paper: #F5EEDF;
  --paper-hi: #FBF7EF;
  --ink: #10233F;
  --ink-2: #3F4D66;
  --ink-3: #5A6680;
  --navy: #163564;
  --red: #D6281E;
  --red-ink: #B21F16;
  --ochre: #E9A521;
  --blue: #1E56A0;
  --hair: rgba(16, 35, 63, .16);

  --night: #0B1830;
  --night-2: #12254A;
  --mist: #DDE6F4;
  --mist-2: #93A5C4;

  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --text: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --wrap: 1180px;
  --gutter: clamp(18px, 4.5vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: .2em; }
a:hover { color: var(--red-ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: var(--ochre); color: var(--ink); }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 50;
  padding: 10px 16px; background: var(--ink); color: var(--paper);
}
.skip:focus { left: 0; }

/* ── Header ─────────────────────────────────────────────────────────────── */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: clamp(12px, 3vw, 32px);
  padding: 12px var(--gutter);
  background: rgba(245, 238, 223, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
  transition: background-color .35s ease, border-color .35s ease;
}

.brand {
  font-family: var(--display); font-weight: 600; font-size: 1.25rem;
  letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
}
.brand i { font-style: normal; color: var(--red); }

.nav { display: flex; gap: clamp(14px, 2.4vw, 30px); margin-left: auto; }
.nav a {
  font-size: .8125rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a.on { color: inherit; border-bottom-color: var(--red); }

.reader {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: .75rem;
}
.reader-label { color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.reader-switch { display: flex; border: 1.5px solid currentColor; border-radius: 999px; padding: 2px; }
.reader-switch button {
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  padding: 5px 12px; border-radius: 999px; letter-spacing: .04em;
}
.reader-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.block { padding: clamp(56px, 9vw, 120px) 0; }
.hero + .block { padding-top: clamp(56px, 7.5vw, 104px); }
.hero + .block > .wrap { border-top: 0; padding-top: 0; }
.block > .wrap {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: clamp(20px, 5vw, 72px);
  border-top: 2px solid var(--ink); padding-top: clamp(34px, 4.6vw, 60px);
}

.label {
  margin: 0; align-self: start; position: sticky; top: 92px;
  font-family: var(--text); font-size: .8125rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
}
.label span { display: block; color: var(--red-ink); font-family: var(--mono); font-weight: 400; letter-spacing: .04em; margin-bottom: 4px; }

.big {
  margin: 0 0 1.1em; max-width: 24em;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem); line-height: 1.22; letter-spacing: -.012em;
}
.note { margin: 0; max-width: 34em; color: var(--ink-2); font-size: 1.125rem; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero > .wrap { padding-top: clamp(26px, 4vw, 54px); }
.kicker {
  margin: 0 0 clamp(14px, 2vw, 24px); max-width: 44em;
  font-size: .8125rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.kicker::before {
  content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); margin-right: 12px; vertical-align: .02em;
}
.hero h1 {
  margin: 0; font-family: var(--display); font-weight: 600;
  font-size: clamp(3.2rem, 11vw, 9rem); line-height: .9; letter-spacing: -.035em;
}
.hero h1 span { display: block; }
.hero h1 span + span { padding-left: .62em; font-style: italic; font-weight: 400; }

.field { position: relative; margin: clamp(24px, 3.4vw, 44px) 0 0; }
.field canvas {
  display: block; width: 100%; height: clamp(220px, 38vh, 400px);
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  touch-action: pan-y;
}
.field-band { position: relative; }

/* The page's span, as a running head right under the header. */
.reach {
  display: flex; align-items: center; gap: 16px;
  max-width: var(--wrap); margin: 0 auto; padding: 14px var(--gutter) 0;
  font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.reach .axis { flex: 1; height: 1px; background: currentColor; opacity: .4; position: relative; }
.reach .axis::after {
  content: ''; position: absolute; right: 0; top: -3px; width: 7px; height: 7px;
  border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg);
}
/* The pause control sits on the band's lower corner like a seal, as on the
   book's site; an icon, not a word. */
.motion {
  position: absolute; right: var(--gutter); bottom: -20px;
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 50%;
  cursor: pointer; transition: background-color .2s ease, color .2s ease;
}
.motion:hover { background: var(--ink); color: var(--paper); }
.motion svg { width: 14px; height: 14px; fill: currentColor; }
.motion .i-play, .motion[aria-pressed="true"] .i-pause { display: none; }
.motion[aria-pressed="true"] .i-play { display: block; }

/* ── Book ───────────────────────────────────────────────────────────────── */

.book-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
/* The cover starts level with the title, not with the edition line above it. */
.cover {
  display: block; margin-top: 60px; transform: rotate(-2.2deg); transform-origin: 30% 60%;
  box-shadow: 14px 18px 0 rgba(16, 35, 63, .14), 0 0 0 1px rgba(16, 35, 63, .25);
  transition: transform .35s ease, box-shadow .35s ease;
}
.cover:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 18px 24px 0 rgba(16, 35, 63, .12), 0 0 0 1px rgba(16, 35, 63, .25); }
.edition { margin: 0 0 10px; font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--red-ink); }
.book h3 { margin: 0 0 .3em; font-family: var(--display); font-weight: 600; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.02em; }
.book .sub { margin: 0 0 1.4em; font-family: var(--display); font-style: italic; font-size: 1.2rem; line-height: 1.35; color: var(--ink-2); max-width: 30em; }
.book p { max-width: 36em; }
.book .ai { font-size: .9375rem; color: var(--ink-2); padding-left: 14px; border-left: 3px solid var(--ochre); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 1.8em; }
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font: 600 .9375rem/1 var(--text); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  padding: 14px 22px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper);
  transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.btn:hover { background: var(--red-ink); border-color: var(--red-ink); color: #fff; transform: translateY(-2px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.more { font-weight: 600; white-space: nowrap; }

/* ── Background ─────────────────────────────────────────────────────────── */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); gap: clamp(14px, 3vw, 40px);
  padding: 26px 0; border-top: 1px solid var(--hair);
}
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline time { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; color: var(--red-ink); white-space: nowrap; }
.timeline h3 { margin: 0 0 .25em; font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.01em; }
.timeline p { margin: 0; max-width: 36em; }
.timeline .role { font-weight: 600; }
.timeline .detail { color: var(--ink-2); }
.timeline .detail a { font-weight: 600; white-space: nowrap; }

/* ── For machines (a navy band on the paper page) ───────────────────────── */

.machines { background: var(--night); color: var(--mist); }
.machines > .wrap { border-top-color: var(--mist); }
.machines .label span { color: var(--ochre); }
.machines .note { color: var(--mist-2); }
.machines a:hover { color: var(--ochre); }

.doors { list-style: none; margin: 2.2em 0 0; padding: 0; font-family: var(--mono); font-size: .875rem; max-width: 46rem; }
.doors li { display: grid; grid-template-columns: minmax(0, 15.5rem) minmax(0, 1fr); gap: 18px; padding: 12px 0; border-top: 1px solid rgba(221, 230, 244, .18); }
.doors li:last-child { border-bottom: 1px solid rgba(221, 230, 244, .18); }
.doors code { font: inherit; color: var(--ochre); }
.doors span { color: var(--mist-2); font-family: var(--text); font-size: .9375rem; }
.machines .btn { margin-top: 2em; background: var(--mist); border-color: var(--mist); color: var(--night); }
.machines .btn:hover { background: var(--ochre); border-color: var(--ochre); color: var(--night); }

/* ── Contact ────────────────────────────────────────────────────────────── */

.contact .note { margin-bottom: 1.2em; }
.mail {
  display: inline-block; max-width: 100%; overflow-wrap: anywhere;
  font-family: var(--display); font-weight: 600; font-style: italic;
  font-size: clamp(1.7rem, 6.2vw, 4.6rem); line-height: 1.05; letter-spacing: -.025em;
  text-decoration: none; background: linear-gradient(var(--red), var(--red)) 0 100% / 100% 3px no-repeat;
  padding-bottom: .08em; transition: background-size .3s ease;
}
.mail:hover { color: var(--ink); background-size: 100% .5em; }

footer { padding: 26px 0 34px; font-size: .875rem; color: var(--ink-2); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; border-top: 1px solid var(--hair); padding-top: 18px; }
footer a { font-family: var(--mono); font-size: .8125rem; }

/* ── Entrance ───────────────────────────────────────────────────────────── */

.js .rise { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .rise.in { opacity: 1; transform: none; }

/* ── Machine view ───────────────────────────────────────────────────────── */

html[data-reader="machine"] body { background: var(--night); color: var(--mist); }
html[data-reader="machine"] .top { background: rgba(11, 24, 48, .92); border-bottom-color: rgba(221, 230, 244, .16); }
html[data-reader="machine"] .nav { visibility: hidden; }
html[data-reader="machine"] .reader-label { color: var(--mist-2); }
html[data-reader="machine"] .reader-switch button[aria-pressed="true"] { background: var(--mist); color: var(--night); }
html[data-reader="machine"] a:hover { color: var(--ochre); }
html[data-reader="machine"] :focus-visible { outline-color: var(--ochre); }
html[data-reader="machine"] ::selection { background: var(--ochre); color: var(--night); }
html[data-reader="machine"] #main,
html[data-reader="machine"] footer { display: none; }

.machine { padding: clamp(28px, 5vw, 64px) 0 72px; font-family: var(--mono); font-size: .875rem; line-height: 1.65; }
.machine .wrap { max-width: 920px; }
.m-lead { margin: 0 0 1.6em; font-family: var(--display); font-size: clamp(1.5rem, 3.2vw, 2.3rem); line-height: 1.22; letter-spacing: -.012em; max-width: 24em; }
.m-cmd { margin: 0; color: var(--mist); overflow-wrap: anywhere; }
.m-cmd b { color: var(--ochre); font-weight: 400; margin-right: .6em; }
.m-headers, .m-body { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-headers { margin-top: 1em; color: var(--mist-2); }
.m-headers .k { color: #8EC1FF; }
.m-body { margin-top: 1.2em; padding: 22px clamp(16px, 3vw, 28px); background: var(--night-2); border-left: 3px solid var(--ochre); min-height: 12em; }
.m-body .h { color: #fff; font-weight: 700; }
.m-body .h::first-letter { color: var(--ochre); }
.m-body .li { color: var(--mist); }
.m-body .cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--ochre); vertical-align: -.18em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.m-note { margin: 1.6em 0 0; max-width: 46em; font-family: var(--text); font-size: .9375rem; color: var(--mist-2); }
.m-doors { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 1.6em 0 0; padding: 0; list-style: none; }
.m-doors a { display: block; padding: 6px 12px; border: 1px solid rgba(221, 230, 244, .3); border-radius: 999px; text-decoration: none; color: var(--mist); }
.m-doors a:hover { border-color: var(--ochre); }
.machine .btn { margin-top: 2.2em; background: var(--mist); border-color: var(--mist); color: var(--night); font-family: var(--text); }
.machine .btn:hover { background: var(--ochre); border-color: var(--ochre); color: var(--night); }

/* ── Small screens ──────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .nav { display: none; }
  .reader { margin-left: auto; }
  .block > .wrap { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .label { position: static; }
  .label span { display: inline; margin-right: 10px; }
}

@media (max-width: 640px) {
  .reader-label { display: none; }
  .book-grid { grid-template-columns: minmax(0, 1fr); }
  .cover { max-width: 230px; margin: 4px 0 18px 6px; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .doors li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hero h1 span + span { padding-left: .3em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .rise { opacity: 1; transform: none; }
}
