/* ==========================================================================
   QUIREN — single-title book site
   tokens.css · tokens, reset, base type, buttons, forms
   Oxblood ground, bone type, gilt accent — a hardback jacket, not a web page.
   ========================================================================== */

:root {
  /* ---- Oxblood ground --------------------------------------------------- */
  --wine:    #3b1420;
  --wine-2:  #4a1b29;
  --wine-3:  #5c2434;
  --ink:     #1e0a10;   /* deepest — jacket spine, footer */

  /* ---- Bone type ramp --------------------------------------------------- */
  --bone:    #f3ebe1;
  --bone-2:  #d9ccc0;
  --bone-3:  #a8968a;
  --bone-4:  #7d6c62;

  --rule:      rgba(243, 235, 225, 0.18);
  --rule-soft: rgba(243, 235, 225, 0.10);

  /* ---- Gilt accent ------------------------------------------------------ */
  --gilt:      #d8a657;
  --gilt-deep: #b8873f;
  --gilt-wash: rgba(216, 166, 87, 0.14);

  /* ---- Paper (the excerpt sets on real paper, not on the jacket) -------- */
  --paper:     #f6f1e8;
  --paper-2:   #ece5d9;
  --paper-ink: #2a1a18;

  /* ---- Type ------------------------------------------------------------- */
  --font-display: "Bodoni Moda", ui-serif, Georgia, serif;
  --font-body:    "Literata", ui-serif, Georgia, serif;
  --font-mono:    "Red Hat Mono", ui-monospace, "SF Mono", monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8438rem;
  --text-base: 0.9688rem;
  --text-md:   1.0938rem;
  --text-lg:   1.35rem;
  --text-xl:   1.75rem;
  --text-2xl:  clamp(1.9rem, 1.4rem + 1.9vw, 3rem);
  /* The title on the jacket. Bodoni has thin hairlines — big, but not so big
     the strokes disappear against the wine ground. */
  --text-title: clamp(2.4rem, 1.5rem + 3.6vw, 5rem);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;

  --gutter: clamp(1.15rem, 0.5rem + 2.6vw, 3.5rem);
  --maxw: 1220px;
  --measure: 34rem;      /* the reading column — roughly 66 characters */

  --r-sm: 3px;
  --r-md: 6px;
  --r-pill: 999px;

  --dur-fast: 150ms;
  --dur: 260ms;
  --dur-slow: 700ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-behavior: smooth; }

body {
  background: var(--wine);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Bookcloth tooth. One inline SVG, fixed, non-interactive. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.30;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
::selection { background: var(--gilt); color: var(--ink); }

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  /* Display serif — the memory rule floor is 1.15; Bodoni needs the air. */
  line-height: 1.22;
  letter-spacing: -0.012em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); font-family: var(--font-body); font-weight: 600; }

.title-mega {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-title);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gilt);
  line-height: 1.6;
}
.label--quiet { color: var(--bone-3); }

.lede {
  font-size: var(--text-md);
  line-height: 1.65;
  color: var(--bone-2);
  max-width: 46ch;
}

/* The reading column — used by the synopsis and the whole excerpt page. */
.measure { max-width: var(--measure); }
.prose { font-size: var(--text-md); line-height: 1.85; color: var(--bone-2); }
.prose p + p { margin-top: 1.3em; }
.prose em { font-style: italic; }

.muted { color: var(--bone-3); }
.gilt { color: var(--gilt); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--s-8); }
.section--tight { padding-block: var(--s-7); }

.rule-top { border-top: 1px solid var(--rule); }
.rule-bottom { border-bottom: 1px solid var(--rule); }

.grid { display: grid; gap: var(--s-6); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 48px;
  padding: 0 var(--s-6);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn--gilt { background: var(--gilt); color: var(--ink); }
.btn--gilt:hover { background: var(--bone); }

.btn--ghost { border-color: var(--rule); color: var(--bone-2); }
.btn--ghost:hover { border-color: var(--bone); color: var(--bone); }

.btn--sm { height: 40px; padding: 0 var(--s-4); font-size: 0.6875rem; }
.btn--block { width: 100%; }

/* Underline link with a gilt rule */
.tlink {
  position: relative;
  color: var(--bone);
  border-bottom: 1px solid var(--gilt);
  padding-bottom: 1px;
  transition: color var(--dur-fast) var(--ease);
}
.tlink:hover { color: var(--gilt); }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: grid; gap: var(--s-2); }
.field > label { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-3); }

.input, .textarea, .select {
  width: 100%;
  height: 48px;
  padding: 0 var(--s-4);
  background: rgba(243, 235, 225, 0.05);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.textarea { height: auto; padding: var(--s-3) var(--s-4); min-height: 120px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--bone-4); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--gilt);
  background: rgba(243, 235, 225, 0.08);
}
.select {
  appearance: none;
  cursor: pointer;
  padding-right: var(--s-6);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a8968a' stroke-width='1.6' stroke-linecap='round'><path d='M4 6.5 8 10.5 12 6.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  background-size: 16px;
}

/* ==========================================================================
   Reveal + motion preference
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-reveal][data-shown="true"] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
