/* Layout inspired by callistabuchen.com: ink-wash masthead, centred caps nav,
   framed two-column body (monogram + about on the left, feature + book panel on the right).
   Palette and type come from the book cover: fog greys, sodium-lamp yellow, condensed caps. */

@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("fonts/bebas-neue.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Great Vibes"; src: url("fonts/great-vibes.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #e6e6e3;
  --frame: #fbfbfa;
  --frame-line: #dcdcd8;
  --panel: #f0f0ee;
  --about: #ede6cf;
  --feature: #232427;
  --ink: #1d1e21;
  --muted: #55575c;
  --on-dark: #ecebe7;
  --on-dark-muted: #a9aaad;
  --accent: #e3b11f;          /* sodium-lamp yellow from the cover, used as a fill */
  --accent-ink: #735600;      /* same hue darkened for text on light surfaces (AA) */
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --script: "Great Vibes", "Snell Roundhand", cursive;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --frame-max: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121315;
    --frame: #1a1b1e;
    --frame-line: #2b2c30;
    --panel: #212226;
    --about: #2a2619;
    --feature: #0e0f11;
    --ink: #e8e7e3;
    --muted: #a3a4a8;
    --accent-ink: #e3b11f;
  }
}

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

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  /* faint paper grain, like the reference's textured background */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; touch-action: manipulation; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--accent); color: #1d1e21; padding: .5rem .9rem; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 1rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Masthead ---------- */

.masthead {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  padding: clamp(2.75rem, 6vw, 4.25rem) 1rem 0;
  color: #f4f3ef;
  text-align: center;
  overflow-x: clip;
}

/* the ink-wash band: the cover's fog, blurred so no lettering survives, feathered at every edge.
   Mask lives on the wrapper and blur on the child, so the blur can't bleed past the feathering. */
.masthead-ink {
  position: absolute;
  z-index: -1;
  inset: -1.5rem max(-2rem, calc((100% - 1240px) / 2)) -1rem;
  overflow: hidden;
  /* a wide band feathered on every side, like the reference's brush-stroke wash */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent), linear-gradient(180deg, transparent, #000 22%, #000 84%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent), linear-gradient(180deg, transparent, #000 22%, #000 84%, transparent);
  mask-composite: intersect;
}
.masthead-ink::before {
  content: "";
  position: absolute;
  inset: -40px;
  background:
    linear-gradient(180deg, rgb(20 21 23 / .1), rgb(20 21 23 / .3)),
    url("images/cover.jpg") 40% 3% / cover no-repeat;
  filter: blur(22px) saturate(.55) brightness(.62);
}

.wordmark {
  display: grid;
  justify-items: center;
  text-decoration: none;
  animation: rise .9s var(--ease-out) both;
}

.wordmark-first {
  display: flex;
  align-items: center;
  gap: clamp(.75rem, 2vw, 1.25rem);
  font-family: var(--script);
  font-size: clamp(3.4rem, 7vw, 5.25rem);
  line-height: .9;
  /* Great Vibes sits low; nudge so the rules meet the x-height */
  padding-top: .1em;
}
.wordmark-first::before,
.wordmark-first::after {
  content: "";
  width: clamp(2.5rem, 7vw, 5.5rem);
  height: 1px;
  background: currentColor;
  opacity: .85;
  transform: translateY(.12em);
}

.wordmark-last {
  font-family: var(--display);
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: .85;
  letter-spacing: .06em;
  padding-left: .06em; /* optically re-centre after tracking */
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem clamp(1.25rem, 4vw, 3.25rem);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  padding-bottom: 1.1rem;
  animation: rise .9s .12s var(--ease-out) both;
}

.nav a {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .6rem 0;
  color: #f4f3ef;
  transition: color .2s var(--ease-out);
}
.nav a:last-child { color: var(--accent); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Frame ---------- */

.frame {
  max-width: var(--frame-max);
  margin: 0 auto;
  padding: 1.25rem;
  background: var(--frame);
  border: 1px solid var(--frame-line);
  display: grid;
  grid-template-columns: minmax(260px, 318px) 1fr;
  gap: .625rem;
  align-items: start;
}

.side, .content { display: grid; gap: .625rem; min-width: 0; }
.side, .content { align-self: stretch; grid-template-rows: auto 1fr; }
.side { grid-template-rows: auto 1fr auto; }
.blurb { align-content: start; }

.panel-title {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--accent-ink);
}

/* ---------- Monogram tile ---------- */

.monogram {
  position: relative;
  aspect-ratio: 318 / 225;
  overflow: hidden;
  background: url("images/cover.jpg") 0% 15% / 303% auto no-repeat var(--feature);
}
.monogram span {
  position: absolute;
  right: 12%;
  bottom: -.14em;
  font-family: var(--display);
  font-size: clamp(9rem, 16vw, 13.5rem);
  line-height: 1;
  color: var(--accent);
  mix-blend-mode: screen;
  opacity: .92;
}

/* ---------- About ---------- */

.about {
  background: var(--about);
  padding: 1.5rem 1.25rem 2rem;
}
.about-photo {
  float: left;
  width: 88px;
  height: 88px;
  margin: 0 1rem .5rem 0;
  border-radius: 50%;          /* the one round shape on the page: portrait, as in the reference */
  box-shadow: 0 0 0 4px var(--frame);
  object-fit: cover;
}
.about-photo--empty {
  display: grid;
  place-items: center;
  background: var(--feature);
  color: var(--accent);
  font-family: var(--display);
  font-size: 2.6rem;
  line-height: 1;
  padding-top: .1em;
}
.about p { margin: 0 0 1rem; color: var(--ink); font-weight: 300; }
.about cite { font-style: italic; }

/* ---------- Contact ---------- */

.contact {
  background: var(--feature);
  color: var(--on-dark);
  padding: 1.5rem 1.25rem 1.75rem;
}
.contact .panel-title { color: var(--accent); margin-bottom: .6rem; }
.contact p { margin: 0 0 .35rem; font-weight: 300; color: var(--on-dark-muted); }
.contact-email {
  display: inline-block;
  padding: .2rem 0;
  font-weight: 600;
  font-size: 1.125rem;
  color: #f4f3ef;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .3em;
  overflow-wrap: anywhere;
  transition: color .2s var(--ease-out);
}
.contact-email:active { opacity: .75; }

/* ---------- Feature (book) ---------- */

.feature {
  background: var(--feature);
  color: var(--on-dark);
  display: grid;
  grid-template-columns: 1fr minmax(220px, 42%);
  align-items: center;
  gap: 1rem;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  min-height: 500px;
  overflow: hidden;
}

.feature-copy { text-align: center; padding: 0 .5rem; }

.tagline {
  margin: 0 0 1.1rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
}
.tagline span { color: var(--accent); }

.feature-title {
  margin: 0 auto;
  max-width: 10ch;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 5.6vw, 4.6rem);
  line-height: .95;
  letter-spacing: .02em;
  color: #f4f3ef;
  text-wrap: balance;
}
.feature-title span { color: var(--accent); }

.feature-sub {
  margin: 1.1rem 0 1.6rem;
  font-weight: 300;
  font-size: 1.125rem;
  color: var(--on-dark-muted);
}

.button {
  display: inline-block;
  padding: .85rem 1.6rem;
  background: var(--accent);
  color: #1d1e21;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s var(--ease-out), background-color .2s var(--ease-out);
}
.button:active { transform: scale(.97); }

.feature-book {
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 380px;
}
.feature-cover {
  width: min(100%, 300px);
  box-shadow: 0 24px 50px -18px rgb(0 0 0 / .8);
  transition: opacity .2s var(--ease-out);
}
.feature-book canvas {
  position: absolute;
  inset: -1.5rem;
  width: calc(100% + 3rem) !important;
  height: calc(100% + 3rem) !important;
  opacity: 0;
  transition: opacity .6s .15s var(--ease-out); /* flat cover leaves first, so the two never double up */
  cursor: grab;
  touch-action: pan-y;
}
.feature-book canvas:active { cursor: grabbing; }
.feature-book.is-3d canvas { opacity: 1; }
.feature-book.is-3d .feature-cover { opacity: 0; }

/* ---------- Blurb ---------- */

.blurb {
  background: var(--panel);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: grid;
  grid-template-columns: 11rem 1fr;
  column-gap: 1.5rem;
}
.blurb .panel-title { padding-top: .35rem; }

.blurb-body { max-width: 62ch; }
.blurb-body p { margin: 0 0 1rem; font-weight: 300; }
.blurb-lede {
  font-family: var(--display);
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: .02em;
  font-weight: 400 !important;
  margin-bottom: 1.1rem !important;
  text-wrap: balance;
}
.blurb-close {
  font-style: italic;
  font-weight: 400 !important;
  color: var(--accent-ink);
}

.facts {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--frame-line);
}
.facts dt {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.45; }
.nowrap { white-space: nowrap; }

/* ---------- Reader questions (visible twin of the FAQPage JSON-LD; keep them in sync) ---------- */

.faq {
  border: 1px solid var(--frame-line);
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.faq-list { max-width: 68ch; }
.faq details { border-top: 1px solid var(--frame-line); }
.faq details:last-child { border-bottom: 1px solid var(--frame-line); }
.faq summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .9rem 0;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent-ink);
  transition: transform .25s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1.1rem; font-weight: 300; }
.faq details a { color: var(--accent-ink); text-underline-offset: .2em; }
.faq summary:active { opacity: .7; }

/* ---------- Footer ---------- */

.footer {
  display: grid;
  justify-items: center;
  gap: .5rem;
  padding: 3.5rem 1rem calc(3rem + env(safe-area-inset-bottom));
  text-align: center;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration: none;
  padding: .5rem;
}
.footer-meta { margin: 0; font-size: .875rem; color: var(--muted); }
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem 1.5rem;
  margin: .25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .875rem;
}
.footer-legal a,
.footer-legal button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: .4rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .25em;
  text-decoration-color: var(--frame-line);
  touch-action: manipulation;
}

/* ---------- Legal pages (privacy, terms) ---------- */

.legal {
  background: var(--panel);
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 5vw, 4rem);
}
.legal-body { max-width: 68ch; }
.legal h1 {
  margin: 0 0 .25rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: .02em;
}
.legal .updated { margin: 0 0 2rem; color: var(--muted); font-size: .9375rem; }
.legal h2 {
  margin: 2.25rem 0 .6rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  scroll-margin-top: 1rem;
}
.legal p, .legal li { font-weight: 300; }
.legal p { margin: 0 0 1rem; }
.legal ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.legal li { margin-bottom: .4rem; }
.legal strong { font-weight: 600; }
.legal a { color: var(--accent-ink); text-underline-offset: .2em; }

/* ---------- Cookie banner ---------- */

.consent {
  position: fixed;
  z-index: 20;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  max-width: 34rem;
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.25rem 1.25rem;
  background: var(--feature);
  color: var(--on-dark);
  border: 1px solid rgb(255 255 255 / .08);
  box-shadow: 0 18px 40px -12px rgb(0 0 0 / .55);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.consent.is-in { opacity: 1; transform: none; }
.consent-text { margin: 0; font-size: .9375rem; line-height: 1.55; font-weight: 300; color: var(--on-dark); }
.consent-text a { color: var(--accent); margin-left: .25rem; white-space: nowrap; text-underline-offset: .2em; }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .625rem; }
/* equal weight on purpose: rejecting must be as easy as accepting */
.consent-btn {
  font: inherit;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: .8rem 1rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--on-dark);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .16s var(--ease-out), background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.consent-btn[data-choice="accept"] { background: var(--accent); color: #1d1e21; }
.consent-btn:active { transform: scale(.97); }

/* ---------- Hover, gated so it never sticks on touch ---------- */

@media (hover: hover) and (pointer: fine) {
  .nav a:hover { color: var(--accent); }
  .nav a:last-child:hover { color: #f4f3ef; }
  .button:hover { background: #f0c43a; }
  .footer-link:hover { text-decoration: underline; text-underline-offset: .25em; }
  .faq summary:hover { color: var(--accent-ink); }
  .contact-email:hover { color: var(--accent); }
  .footer-legal a:hover, .footer-legal button:hover { color: var(--ink); }
  .consent-btn[data-choice="reject"]:hover { background: rgb(227 177 31 / .12); }
  .consent-btn[data-choice="accept"]:hover { background: #f0c43a; }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  .frame {
    grid-template-columns: 1fr;
    margin: 0 .625rem;
    padding: .625rem;
  }
  /* book first, like the reference's mobile layout; monogram is decorative so it goes */
  .content { order: 1; }
  .side { order: 2; }
  .monogram { display: none; }

  .feature { grid-template-columns: 1fr; min-height: 0; text-align: center; }
  .feature-book { order: -1; min-height: 340px; }
  .feature-cover { width: min(62%, 240px); }

  .blurb { grid-template-columns: 1fr; }
  .faq { padding: 1.5rem 1.25rem; }
  .facts { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .nav { gap: .25rem 1.1rem; }
  .nav a { font-size: .75rem; letter-spacing: .12em; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .button:active, .consent-btn:active { transform: none; }
  .consent { transform: none; }
}

/* 404 and any future single-column page */
.frame--single { grid-template-columns: 1fr; }
.link-button {
  font: inherit;
  color: var(--accent-ink);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}
.legal code { font-size: .9em; background: var(--frame); padding: .05em .3em; }
