/* =========================================================================
   Frank Matranga — author site
   Paper-and-ink identity. Restrained, procedural, adult.
   One accent (slate). Type: Zodiak (display) over Supreme (body), via Fontshare.
   ========================================================================= */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
:where(section[id], [id="top"]) { scroll-margin-top: 2rem; }

body,
h1, h2, h3, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }

ul[role="list"] { list-style: none; padding: 0; }

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

button,
input { font: inherit; color: inherit; }

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --bone:       #EDE8DF;   /* page ground — warm uncoated paper            */
  --bone-raise: #F4F0E9;   /* lifted surface (the conversion panel)        */
  --bone-sink:  #E4DED3;   /* recessed / secondary panel                   */
  --ink:        #16181C;   /* primary text, the conversion button          */
  --graphite:   #565A61;   /* secondary text                               */
  --ash:        #CDC6B9;   /* hairlines and rules                          */
  --slate:      #2E4756;   /* the one accent — links, active marker, focus */
  --slate-deep: #213542;   /* accent, pressed                              */

  --font-display: "Zodiak", Georgia, "Times New Roman", serif;
  --font-body:    "Supreme", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 40rem;        /* ~62ch reading column                         */
  --rail-w:  12rem;

  --step--1: clamp(0.82rem, 0.79rem + 0.12vw, 0.9rem);
  --step-0:  clamp(1.0625rem, 1.02rem + 0.22vw, 1.1875rem);
  --step-1:  clamp(1.28rem, 1.2rem + 0.4vw, 1.5rem);
  --step-2:  clamp(1.7rem, 1.5rem + 1vw, 2.25rem);
  --step-3:  clamp(2.6rem, 2rem + 3vw, 4.4rem);

  --gap-section: clamp(5rem, 3.5rem + 7vw, 9rem);
}

/* ---- Base -------------------------------------------------------------- */
body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { font-variant-numeric: oldstyle-nums; }

a {
  color: var(--slate);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--slate) 45%, transparent);
  transition: text-decoration-color 160ms ease, color 160ms ease;
}
a:hover { text-decoration-color: var(--slate); }

::selection { background: color-mix(in srgb, var(--slate) 22%, var(--bone)); }

/* ---- Focus (visible, keyboard) ---------------------------------------- */
:focus-visible {
  outline: 2px solid var(--slate);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Skip link --------------------------------------------------------- */
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--bone);
  padding: 0.65rem 1rem;
  border-radius: 3px;
  text-decoration: none;
  transition: top 140ms ease;
}
.skip:focus { top: 1rem; }

/* =======================================================================
   The margin rail — the signature. A slim operational-document margin:
   ghosted tabular numerals mark position; the label reveals on hover.
   Narrow by design so it lives in the gutter and never fights content.
   ======================================================================= */
.rail {
  position: fixed;
  top: 0;
  left: clamp(1rem, 1.6vw, 2rem);
  height: 100vh;
  width: 3rem;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
  z-index: 10;
}

.rail__brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}

.rail__list { display: flex; flex-direction: column; gap: 0.1rem; }
.rail__list li { display: block; }

.rail__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--ash);
  transition: color 160ms ease;
}
.rail__link::before {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
  transition: width 200ms cubic-bezier(.2,.7,.2,1), background 160ms ease;
  flex: none;
}
.rail__link .n {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.rail__link .lbl {
  position: absolute;
  left: calc(100% + 0.6rem);
  white-space: nowrap;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bone);
  padding: 0.15rem 0.4rem;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.rail__link:hover { color: var(--graphite); }
.rail__link:hover .lbl,
.rail__link:focus-visible .lbl { opacity: 1; transform: none; }

.rail__link.is-active { color: var(--slate); }
.rail__link.is-active::before { width: 24px; background: var(--slate); }

@media (min-width: 1160px) {
  .rail { display: flex; }
}

/* =======================================================================
   Layout containers
   ======================================================================= */
.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: 1.5rem; }
.wrap--wide { max-width: 60rem; }

main > section { padding-block: var(--gap-section); }

/* Section eyebrow: "01 / The Book" — echoes the rail */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--graphite);
}
.eyebrow::before {
  content: attr(data-n);
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ash);
}

h2.h {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-2);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
}

.prose p { max-width: var(--measure); }
.prose p + p { margin-top: 1.2rem; }
.lead { font-size: var(--step-1); line-height: 1.5; }

/* =======================================================================
   Hero
   ======================================================================= */
.hero { padding-top: clamp(4.5rem, 3rem + 8vw, 8rem); padding-bottom: var(--gap-section); }
.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 1rem + 5vw, 5.5rem);
  align-items: center;
}

.hero__kicker {
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 1.4rem;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin-bottom: 0.9rem;
}
.hero__byline {
  font-size: var(--step-1);
  color: var(--ink);
  margin-bottom: 2rem;
}
.hero__byline .by { color: var(--graphite); }
.hero__byline .name { font-weight: 500; }

.hero__hook {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-1);
  line-height: 1.4;
  color: var(--ink);
  max-width: 30rem;
  margin-bottom: 2.2rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ash);
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--graphite);
}
.hero__status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--slate);
  flex: none;
}
.jump {
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.jump .arr { transition: transform 200ms ease; }
.jump:hover { color: var(--slate); }
.jump:hover .arr { transform: translateY(3px); }

/* The cover as a physical object: real cast shadow + ground contact */
.cover {
  position: relative;
  justify-self: center;
  width: min(100%, 27rem);
}
.cover__img {
  position: relative;
  width: 100%;
  border-radius: 2px;
  box-shadow:
    0 1px 1px rgba(20, 22, 26, 0.04),
    0 2px 4px rgba(20, 22, 26, 0.06),
    0 12px 22px rgba(20, 22, 26, 0.10),
    0 34px 60px rgba(20, 22, 26, 0.20);
  transition: transform 400ms cubic-bezier(.2,.7,.2,1), box-shadow 400ms ease;
}
.cover__contact {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -26px;
  height: 40px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(20,22,26,0.28), rgba(20,22,26,0) 72%);
  filter: blur(3px);
  z-index: -1;
}
@media (hover: hover) {
  .cover:hover .cover__img {
    transform: translateY(-6px);
    box-shadow:
      0 1px 1px rgba(20, 22, 26, 0.04),
      0 3px 6px rgba(20, 22, 26, 0.07),
      0 18px 30px rgba(20, 22, 26, 0.12),
      0 46px 74px rgba(20, 22, 26, 0.24);
  }
}

/* =======================================================================
   Epigraph band
   ======================================================================= */
.epigraph { padding-block: clamp(3.5rem, 2rem + 6vw, 6.5rem); }
.epigraph__inner { max-width: 34rem; margin-inline: auto; text-align: center; }
.epigraph p {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.28;
  letter-spacing: -0.005em;
}
.epigraph .rule { width: 46px; height: 1px; background: var(--slate); margin: 0 auto 2rem; }

/* =======================================================================
   Cal Mercer
   ======================================================================= */
.dossier .prose p:first-of-type { }
.pull {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-1);
  line-height: 1.4;
  color: var(--ink);
  border-left: 1px solid var(--slate);
  padding-left: 1.4rem;
  margin: 2.2rem 0 0;
  max-width: 34rem;
}

/* =======================================================================
   Chapter One — the conversion block (the most important on the page)
   ======================================================================= */
.offer { }
.offer__panel {
  background: var(--bone-raise);
  border: 1px solid var(--ash);
  border-radius: 4px;
  padding: clamp(1.75rem, 1rem + 4vw, 3.5rem);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 18px 40px rgba(20,22,26,0.06);
}
.offer__lead {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-1);
  line-height: 1.4;
  margin-bottom: 0.9rem;
  max-width: 30rem;
}
.offer__sub { color: var(--graphite); max-width: 32rem; margin-bottom: 2rem; }

.form { display: flex; flex-direction: column; gap: 0.9rem; max-width: 30rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite);
}
.field input {
  width: 100%;
  background: var(--bone);
  border: 1px solid var(--ash);
  border-radius: 3px;
  padding: 0.85rem 0.95rem;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field input::placeholder { color: color-mix(in srgb, var(--graphite) 70%, transparent); }
.field input:hover { border-color: var(--graphite); }
.field input:focus-visible {
  outline: none;
  border-color: var(--slate);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--slate) 20%, transparent);
}

.btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bone);
  padding: 0.95rem 1.4rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: var(--step-0);
  letter-spacing: 0.01em;
  text-align: center;
  transition: background 160ms ease, transform 120ms ease;
}
.btn:hover { background: var(--slate-deep); border-color: var(--slate-deep); }
.btn:active { transform: translateY(1px); }

.form__note { font-size: var(--step--1); color: var(--graphite); margin-top: 0.4rem; }
.form__error {
  font-size: var(--step--1);
  color: #7a2e2e;
  min-height: 1.1em;
}

/* Mocked success state */
.offer__done { display: none; }
.offer.is-sent .form,
.offer.is-sent .offer__lead,
.offer.is-sent .offer__sub { display: none; }
.offer.is-sent .offer__done { display: block; }
.offer__done .check {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--slate);
  display: grid; place-items: center;
  color: var(--slate);
  margin-bottom: 1.2rem;
}
.offer__done h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-1);
  margin-bottom: 0.6rem;
}
.offer__done p { color: var(--graphite); max-width: 30rem; }

/* =======================================================================
   The Series
   ======================================================================= */
.series__list { border-top: 1px solid var(--ash); margin-top: 0.5rem; }
.book {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--ash);
}
.book__n {
  font-variant-numeric: tabular-nums;
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  color: var(--slate);
  padding-top: 0.3rem;
}
.book__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-1);
  line-height: 1.2;
}
.book__title.tbd { color: var(--graphite); font-style: italic; font-weight: 300; }
.book__desc { color: var(--graphite); font-size: var(--step--1); margin-top: 0.25rem; }
.book__when {
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite);
  white-space: nowrap;
  text-align: right;
}
.book__when.now { color: var(--slate); }
.series__note { margin-top: 1.5rem; font-size: var(--step--1); color: var(--graphite); }

/* =======================================================================
   The Author
   ======================================================================= */
.author__grid {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: clamp(1.75rem, 1rem + 4vw, 3.5rem);
  align-items: start;
}
.author__photo {
  width: 100%;
  border-radius: 3px;
  border: 1px solid var(--ash);
  box-shadow: 0 14px 30px rgba(20,22,26,0.12);
}
.author__body .h { margin-bottom: 1.2rem; }

/* =======================================================================
   Footer
   ======================================================================= */
.footer { border-top: 1px solid var(--ash); padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
}
.footer h3 {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--graphite);
  font-weight: 500;
  margin-bottom: 1rem;
}
.footer__privacy p { color: var(--graphite); font-size: var(--step--1); line-height: 1.6; max-width: 34rem; }
.footer__contact a { color: var(--ink); }
.footer__pub { display: flex; flex-direction: column; gap: 0.9rem; }
.footer__pub img { width: 148px; opacity: 0.72; }
.footer__legal {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ash);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--step--1);
  color: var(--graphite);
}

/* =======================================================================
   Scroll reveal (progressive enhancement). Hidden state applies ONLY when
   JS has taken over (html.js-anim), so with no JS, a failed script, or a
   silent observer, all content stays fully visible. Never stuck blank.
   ======================================================================= */
.js-anim .reveal { opacity: 0; transform: translateY(16px); transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.7,.2,1); }
.js-anim .reveal.in { opacity: 1; transform: none; }

/* =======================================================================
   Responsive
   ======================================================================= */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: clamp(2.5rem, 1rem + 8vw, 3.5rem); }
  .cover { grid-row: 1; width: min(72%, 20rem); }
  .hero__text { grid-row: 2; }
  .author__grid { grid-template-columns: 1fr; }
  .author__photo { width: min(60%, 14rem); }
  .footer__grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 460px) {
  .book { grid-template-columns: 2.5rem 1fr; }
  .book__when { grid-column: 2; text-align: left; margin-top: 0.35rem; }
  .cover { width: min(78%, 17rem); }
}

/* =======================================================================
   Reduced motion
   ======================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .cover:hover .cover__img { transform: none; }
}
