/* ==========================================================================
   thomasflake.com - first draft, 2026-08-29
   Identity (A) author-first, per 01 SITE ARCHITECTURE.md Part IV.
   Type stack per Part V: Merkabah display / Spectral long-form / Plex Sans UI /
   Plex Mono telemetry.
   ========================================================================== */

@import url('../fonts/merkabah.css');

:root {
  --ink:        #14161a;
  --ink-soft:   #4a5058;
  --ink-faint:  #8b939c;
  --paper:      #f7f5f1;
  --paper-warm: #efece6;
  --rule:       #ddd8d0;
  --void:       #0d1015;   /* the hero ground */
  --void-ink:   #e8e6e1;
  --accent:     #8c2f24;   /* the verdict red */
  --serif: 'Spectral', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans:  'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --measure: 34rem;
  --gut: clamp(1.25rem, 4vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.02rem, 0.55vw + 0.9rem, 1.16rem);
  line-height: 1.62;
}

img, svg { max-width: 100%; height: auto; }
a { color: inherit; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: var(--gut); }

/* --- skip link ----------------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; font-family: var(--sans);
}
.skip:focus { left: .5rem; top: .5rem; }

/* --- masthead ------------------------------------------------------------ */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 40;
}
.masthead .wrap {
  display: flex; align-items: baseline; gap: 1.5rem;
  padding-block: .9rem; flex-wrap: wrap;
}

.wordmark {
  font-family: var(--merkabah);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.nav { margin-left: auto; }
.nav ul {
  list-style: none; display: flex; flex-wrap: wrap;
  gap: clamp(.85rem, 1.8vw, 1.7rem); margin: 0; padding: 0;
}
.nav a {
  font-family: var(--merkabah);
  font-size: .95rem;
  letter-spacing: .05em;
  text-decoration: none;
  padding-block: .25rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover, .nav a:focus-visible { border-bottom-color: var(--accent); }
.nav a[aria-current="page"] { border-bottom-color: var(--ink); }

.utility {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-warm);
  font-family: var(--sans); font-size: .82rem;
}
.utility .wrap {
  display: flex; gap: 1.4rem; padding-block: .45rem;
  justify-content: flex-end; color: var(--ink-soft);
}
.utility a { text-decoration: none; }
.utility a:hover { text-decoration: underline; }

/* ==========================================================================
   HERO - the drifting quote field
   ========================================================================== */
.hero {
  position: relative;
  background: var(--void);
  color: var(--void-ink);
  isolation: isolate;
  /* Height is driven by the CONTENT, not by a min-height. A fixed min-height
     plus overflow:hidden clipped the top of the hero line the moment the
     animated mark widened the row -- the grid centred content taller than its
     own box and the overflow ate the first line. #quotefield does its own
     clipping, so the hero does not need to. */
}

/* The field sits BEHIND everything and is inert to the pointer and to
   assistive technology - it is decoration, and the quotes it shows also
   appear as real text further down the page. */
#quotefield {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
  contain: strict;
}
/* Each quote is a BLOCK in a fixed-width invisible box, not a single endless
   line. A twenty-word sentence set nowrap at display size is several thousand
   pixels wide: the reader only ever sees a fragment of it sliding past. Give it
   a measure and it becomes a thing you can actually read. */
.qf-item {
  position: absolute;
  top: 0; left: 0;
  font-family: var(--merkabah);
  font-weight: 300;
  line-height: 1.22;
  text-align: center;          /* --- see ALIGN in quotefield.js --- */
  text-wrap: balance;          /* even line lengths where supported */
  will-change: transform;
  user-select: none;
}
.qf-item cite {
  display: block; margin-top: .45em;
  font-family: var(--sans); font-style: normal;
  font-size: .42em; letter-spacing: .16em; text-transform: uppercase;
  opacity: .72;
}
/* Three depth layers. Nearer = larger, faster, wider measure, slightly more
   present. Nothing goes above 13% opacity: this is a ground, not a message. */
/* Measure is deliberately WIDE relative to the type size: about thirty
   characters a line, so a quote lands in three or four lines instead of the
   seven-line slab the first attempt produced. */
.qf-l1 { font-size: clamp(0.9rem, 1.4vw, 1.2rem);   width: clamp(11rem, 23vw, 22rem); color: rgba(232,230,225,.055); }
.qf-l2 { font-size: clamp(1.05rem, 1.9vw, 1.65rem); width: clamp(13rem, 29vw, 28rem); color: rgba(232,230,225,.080); }
.qf-l3 { font-size: clamp(1.25rem, 2.5vw, 2.15rem); width: clamp(15rem, 36vw, 35rem); color: rgba(232,230,225,.100); }

.hero-inner { position: relative; z-index: 2; padding-block: clamp(3.25rem, 8vh, 5.5rem); }

.hero-quote {
  font-family: var(--merkabah);
  font-weight: 300;
  font-size: clamp(1.75rem, 3.9vw, 3.15rem);
  line-height: 1.15;
  letter-spacing: .005em;
  max-width: 22ch;
  margin: 0 0 1.4rem;
}
.hero-quote em { font-style: normal; color: #fff; }
.hero-attrib {
  font-family: var(--sans); font-size: .86rem; letter-spacing: .13em;
  text-transform: uppercase; color: rgba(232,230,225,.62); margin: 0 0 2.4rem;
}
.hero-tag {
  font-family: var(--merkabah); font-weight: 400;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  letter-spacing: .18em; text-transform: uppercase;
  color: rgba(232,230,225,.8); margin: 0;
}

/* Motion control. WCAG 2.2.2 requires a pause for anything that moves for
   more than five seconds. It is a real control, not an afterthought. */
.qf-toggle {
  position: absolute; right: var(--gut); bottom: 1.1rem; z-index: 3;
  font-family: var(--sans); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase;
  background: transparent; color: rgba(232,230,225,.55);
  border: 1px solid rgba(232,230,225,.28);
  border-radius: 2px; padding: .4rem .8rem; cursor: pointer;
}
.qf-toggle:hover, .qf-toggle:focus-visible { color: #fff; border-color: rgba(232,230,225,.7); }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
section { padding-block: clamp(3rem, 8vh, 5.5rem); }
section + section { border-top: 1px solid var(--rule); }

h1, h2, h3 { font-family: var(--merkabah); font-weight: 400; line-height: 1.14; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: .01em; margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: .03em; margin: 0 0 1.5rem; }
h3 { font-size: 1.16rem; letter-spacing: .04em; margin: 0 0 .4rem; }

.eyebrow {
  font-family: var(--sans); font-size: .76rem; letter-spacing: .19em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 .7rem;
}
.lede { font-size: 1.16em; color: var(--ink-soft); max-width: var(--measure); }
p { max-width: var(--measure); }

/* --- the three-door strip ------------------------------------------------ */
.doors { display: grid; gap: 1px; background: var(--rule); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.door {
  background: var(--paper); padding: 2rem 1.6rem 2.2rem;
  text-decoration: none; display: block; transition: background .18s;
}
.door:hover, .door:focus-visible { background: var(--paper-warm); }
.door .door-verb {
  font-family: var(--merkabah); font-weight: 400;
  font-size: clamp(1.3rem, 2.4vw, 1.75rem); letter-spacing: .02em;
  display: block; margin-bottom: .5rem;
}
.door p { font-size: .95rem; color: var(--ink-soft); margin: 0; }
.door .go { font-family: var(--sans); font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); display: inline-block; margin-top: 1rem; }

/* --- shelves ------------------------------------------------------------- */
.shelf { margin-bottom: 2.8rem; }
.shelf > h3 {
  font-size: .82rem; font-family: var(--sans); letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1px solid var(--rule); padding-bottom: .5rem; margin-bottom: 1.1rem;
}
.titles { list-style: none; margin: 0; padding: 0;
  display: grid; gap: .55rem 2rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); }
.titles li { display: flex; gap: .7rem; align-items: baseline; }
.titles .t { font-family: var(--merkabah); font-size: 1.06rem; }
.titles li { flex-wrap: wrap; }
/* nowrap was fine for "BOOK 1" and broke the moment a tier description landed
   in the same slot on a phone. */
.titles .meta { font-family: var(--sans); font-size: .74rem; color: var(--ink-faint);
  letter-spacing: .06em; text-transform: uppercase; min-width: 0; }

/* --- the engine panel ---------------------------------------------------- */
.engine { background: var(--void); color: var(--void-ink); }
.engine h2, .engine .eyebrow { color: var(--void-ink); }
.engine .eyebrow { color: rgba(232,230,225,.55); }
.engine p { color: rgba(232,230,225,.78); }
.verdict {
  font-family: var(--merkabah); font-weight: 700;
  font-size: clamp(1.4rem, 3.6vw, 2.5rem);
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); margin: 2rem 0 .6rem;
}
.telemetry {
  font-family: var(--mono); font-size: .84rem; line-height: 1.75;
  color: rgba(232,230,225,.6); white-space: pre; overflow-x: auto;
  border-left: 2px solid rgba(232,230,225,.2); padding-left: 1rem; margin: 0 0 1.6rem;
  max-width: none;
}

/* --- newsletter ---------------------------------------------------------- */
.news { background: var(--paper-warm); }
.news form { display: flex; gap: .6rem; flex-wrap: wrap; max-width: var(--measure); margin-top: 1.4rem; }
.news input[type=email] {
  flex: 1 1 16rem; font: inherit; font-family: var(--sans); font-size: .95rem;
  padding: .75rem .9rem; border: 1px solid var(--rule); background: var(--paper);
}
.btn {
  font-family: var(--merkabah); font-size: 1rem; letter-spacing: .1em;
  text-transform: uppercase; padding: .75rem 1.5rem; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }

/* --- footer -------------------------------------------------------------- */
footer { border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .84rem; color: var(--ink-soft); }
footer .wrap { padding-block: 2.4rem 3rem; display: grid; gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
footer h4 { font-family: var(--sans); font-size: .74rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .6rem; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }
.colophon { grid-column: 1 / -1; border-top: 1px solid var(--rule);
  padding-top: 1.3rem; color: var(--ink-faint); font-size: .78rem; }

/* --- draft banner -------------------------------------------------------- */
.draft {
  background: var(--accent); color: #fff; font-family: var(--sans);
  font-size: .78rem; letter-spacing: .08em; text-align: center; padding: .5rem 1rem;
}

/* --- inner pages --------------------------------------------------------- */
.page-head { padding-block: clamp(2.5rem, 7vh, 4.5rem) 1rem; }
.stub {
  border: 1px dashed var(--rule); padding: 1.6rem; margin-top: 2rem;
  font-family: var(--sans); font-size: .9rem; color: var(--ink-soft);
  max-width: var(--measure);
}
.stub strong { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --- hero: copy beside the animated author mark ------------------------- */
.hero-grid { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
@media (min-width: 60rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
}
.hero-copy { min-width: 0; }
.hero-mark { margin: 0; min-width: 0; display: flex; justify-content: center; }
.hero-mark svg {
  width: 100%;
  max-width: clamp(15rem, 30vw, 23rem);
  height: auto;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(232,230,225,.07);
}
/* The mark runs a 36-second SMIL cycle. CSS cannot stop SMIL, so it is paused
   in script instead -- by the same control that pauses the quote field, and
   automatically under prefers-reduced-motion. See quotefield.js. */

/* --- book pages: the free excerpt --------------------------------------- */
.book-head { padding-block: clamp(2.5rem, 7vh, 4.5rem) 0; }
.book-head .eyebrow a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.book-sub {
  font-family: var(--merkabah); font-weight: 300;
  font-size: clamp(1.05rem, 2.2vw, 1.5rem); letter-spacing: .02em;
  color: var(--ink-soft); margin: -.4rem 0 1.2rem; max-width: 30ch;
}
.buy { margin: 2rem 0 0; display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.buy-big { margin-top: 2.4rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.buy-soon {
  font-family: var(--sans); font-size: .9rem; color: var(--ink-soft);
  border-left: 2px solid var(--accent); padding-left: .9rem; margin: 0;
}

/* The excerpt is the product, so it is set like a page of the book: one
   column, generous measure, real indents, no decoration competing with it. */
.excerpt { max-width: 36rem; }
.excerpt p { margin: 0; text-indent: 1.4em; max-width: none; }
.excerpt p + p { margin-top: 0; }
.excerpt h3 + p, .excerpt blockquote + p, .excerpt p:first-child { text-indent: 0; }
.excerpt h3 {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 2.4rem 0 1rem; font-weight: 500;
}
.excerpt .epigraph {
  margin: 0 0 2rem; padding: 0 0 0 1.2rem; border-left: 2px solid var(--rule);
  font-style: italic; color: var(--ink-soft);
}
.excerpt .epigraph p { text-indent: 0; margin: 0; max-width: none; }
.excerpt .epigraph cite {
  display: block; margin-top: .7rem; font-style: normal;
  font-family: var(--sans); font-size: .8rem; letter-spacing: .04em;
  color: var(--ink-faint);
}
.excerpt-end {
  border: 0; border-top: 1px solid var(--rule); margin: 3rem 0 1.4rem; max-width: 36rem;
}
.excerpt-note {
  font-family: var(--sans); font-size: .88rem; color: var(--ink-soft); max-width: 36rem;
}
.titles .t a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.titles .t a:hover { border-bottom-color: var(--accent); }

/* --- covers ------------------------------------------------------------- */
.covers {
  list-style: none; margin: 0 0 2.8rem; padding: 0;
  display: grid; gap: clamp(1.2rem, 3vw, 2.2rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
}
.covers a { text-decoration: none; display: block; }
.covers img {
  display: block; width: 100%; aspect-ratio: 5 / 8; object-fit: cover;
  background: var(--paper-warm);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.13), 0 12px 30px rgba(0,0,0,.10);
  transition: transform .18s ease, box-shadow .18s ease;
}
.covers a:hover img, .covers a:focus-visible img {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,.16), 0 18px 40px rgba(0,0,0,.16);
}
.covers .t {
  display: block; font-family: var(--merkabah); font-size: 1rem;
  line-height: 1.2; margin-top: .7rem;
}
.covers .meta {
  display: block; font-family: var(--sans); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
  margin-top: .25rem;
}

/* the cover beside the title on a book page */
.book-head { display: grid; gap: clamp(1.4rem, 4vw, 2.8rem); align-items: start; }
@media (min-width: 46rem) {
  .book-head { grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); }
}
.book-cover { margin: 0; }
.book-cover img {
  display: block; width: 100%; max-width: 13rem; aspect-ratio: 5 / 8;
  object-fit: cover; border-radius: 2px;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 16px 40px rgba(0,0,0,.14);
}
.book-head > .book-body { min-width: 0; }

/* --- footer -------------------------------------------------------------- */
footer .wrap { padding-block: 2.6rem 3.2rem; display: grid; gap: 1.8rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
footer .colophon {
  grid-column: 1 / -1; border-top: 1px solid var(--rule);
  padding-top: 1.5rem; margin-top: .6rem;
  display: grid; gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 52rem) {
  footer .colophon { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 2.5rem; }
}
.type-note { font-size: .86rem; line-height: 1.6; color: var(--ink-soft); max-width: 44rem; margin: 0; }
.type-note strong { color: var(--ink); }
.type-note .glyph { font-family: var(--merkabah); font-size: 1.25em; line-height: 1; vertical-align: -.08em; }
.legal { font-size: .78rem; color: var(--ink-faint); margin: 0; max-width: none; }

/* --- the bio ------------------------------------------------------------- */
.bio { max-width: 36rem; }
.bio p { margin: 0 0 1.15em; max-width: none; }
.bio p:last-child { margin-bottom: 0; }
.bio a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.bio a:hover { border-bottom-color: var(--accent); }

/* --- the author portrait, beside the bio --------------------------------- */
.bio-wrap { display: grid; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
@media (min-width: 50rem) {
  .bio-wrap { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); }
}
.portrait { margin: 0; }
.portrait img {
  display: block; width: 100%; max-width: 11rem; aspect-ratio: 4 / 5;
  object-fit: cover; border-radius: 2px;
  box-shadow: 0 3px 8px rgba(0,0,0,.13), 0 16px 40px rgba(0,0,0,.12);
}

/* --- a line in his own voice --------------------------------------------- */
.pull { margin: 1.4rem 0 0; padding: 0 0 0 1.2rem; border-left: 2px solid var(--accent); }
.pull p {
  font-family: var(--merkabah); font-weight: 300;
  font-size: clamp(1.1rem, 2.1vw, 1.45rem); line-height: 1.3;
  color: var(--ink); margin: 0; max-width: 30ch;
}

/* --- contact form -------------------------------------------------------- */
.contact { max-width: 36rem; margin-top: 1.6rem; display: grid; gap: 1rem; }
.contact .row { display: grid; gap: 1rem; grid-template-columns: minmax(0,1fr); }
@media (min-width: 34rem) { .contact .row { grid-template-columns: 1fr 1fr; } }
.contact label {
  display: grid; gap: .35rem;
  font-family: var(--sans); font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.contact .opt { text-transform: none; letter-spacing: .04em; opacity: .8; }
.contact input, .contact textarea {
  font: inherit; font-family: var(--serif); font-size: 1rem; letter-spacing: normal;
  text-transform: none; color: var(--ink);
  padding: .65rem .8rem; border: 1px solid var(--rule); border-radius: 2px;
  background: var(--paper); width: 100%;
}
.contact input:focus, .contact textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(140,47,36,.12);
}
.contact textarea { resize: vertical; min-height: 9rem; line-height: 1.55; }
/* The honeypot is moved off-screen rather than display:none -- the bots worth
   catching check for display:none and skip the field. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact .actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.contact .btn { border: 0; }
.contact .btn[disabled] { opacity: .55; cursor: default; }
.form-msg { font-family: var(--sans); font-size: .86rem; margin: 0; max-width: none; color: var(--ink-soft); }
.form-msg.ok  { color: #2f6b45; }
.form-msg.err { color: var(--accent); }
