/* feelingisthework.com
   Colors are the book repo's brand/tokens.json (house style v1.0); change them there first, never here.
   Mobile first. Breakpoint: 56rem (two-column front). Type is fluid with clamp(). */

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/ebgaramond-regular-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/ebgaramond-italic-latin.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/ebgaramond-medium-latin.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --paper: #F7F1E3;      /* paper-50 */
  --callout: #F1E4DA;    /* ember-100 */
  --ink: #1C2430;        /* night-900 */
  --ink-2: #2E3643;      /* night-800 */
  --muted: #5B6F7D;      /* mist-400 */
  --mist: #C9D1D8;       /* mist-200 */
  --heading: #304F71;    /* indigo-700 */
  --accent: #7E5A45;     /* ember-700, text-safe accent */
  --rule: #A57E65;       /* ember-500, decorative only */
  --cream: #F7F1E3;      /* type on the night panel */

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-2: var(--muted);
  --h: var(--heading);
  --card: #FFFFFF;
  --card-line: var(--mist);
  --focus: var(--heading);

  --gutter: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --measure: 34rem;
  --step-0: clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem);
  --step-1: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem);
  --space: clamp(2.5rem, 1.5rem + 5vw, 6rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --fg: var(--paper);
    --fg-2: var(--mist);
    --h: #DFD1BF;        /* gofun-200 */
    --card: var(--ink-2);
    --card-line: var(--muted);
    --focus: var(--paper);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  font-size: var(--step-0);
  line-height: 1.55;
  font-variant-numeric: oldstyle-nums;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2 { font-weight: 500; line-height: 1.15; color: var(--h); text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- The front: the book as an object ---------- */
.front { padding: var(--space) var(--gutter) calc(var(--space) * 0.75); }
.front-inner {
  max-width: 64rem; margin: 0 auto;
  display: grid; gap: clamp(2rem, 4vw, 4.5rem); justify-items: center; align-items: center;
}
.book {
  margin: 0; position: relative; width: min(100%, 22rem);
  aspect-ratio: 640 / 1024;
  container-type: inline-size;
  border-radius: 2px 6px 6px 2px; overflow: hidden;
  box-shadow: 0 1px 2px rgb(28 36 48 / 0.25), 0 18px 40px -12px rgb(28 36 48 / 0.45);
  background: var(--ink-2);
}
.book picture, .book img { width: 100%; height: 100%; }
.book img { object-fit: cover; }
/* Scrim behind the cover type: night at the top, fading out above the horizon. */
.book::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 46%;
  background: linear-gradient(to bottom, rgb(28 36 48 / 0.66), rgb(28 36 48 / 0.48) 55%, rgb(28 36 48 / 0));
  pointer-events: none;
}
.cover-type {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 9cqi 7cqi 6cqi; color: var(--cream);
}
.cover-title {
  margin: 0; color: var(--cream); font-size: 11.5cqi; font-weight: 500; letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgb(28 36 48 / 0.6);
}
.cover-sub {
  margin: 3cqi 0 0; font-style: italic; font-size: max(0.875rem, 4.6cqi); line-height: 1.3; max-width: 80cqi;
  text-wrap: balance;
  text-shadow: 0 1px 4px rgb(28 36 48 / 0.7);
}
.cover-author {
  margin: auto 0 0; font-size: 5cqi; letter-spacing: 0.12em; text-transform: uppercase;
  text-shadow: 0 1px 4px rgb(28 36 48 / 0.8);
}

.intro { max-width: var(--measure); text-align: center; }
.kicker { font-size: 0.85em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); font-variant-numeric: lining-nums; }
.small { font-size: 0.9em; color: var(--fg-2); }
.turn {
  display: inline-flex; align-items: center; gap: 0.5em; min-height: 2.75rem; margin-top: 0.5rem;
  padding: 0.55rem 1.4rem; border: 1px solid currentColor; border-radius: 999px;
  color: var(--h); text-decoration: none; font-size: var(--step-0);
}
.turn:hover { background: var(--callout); color: var(--ink); }
@media (prefers-color-scheme: dark) { .turn:hover { background: var(--ink-2); color: var(--paper); } }

@media (min-width: 56rem) {
  .front-inner { grid-template-columns: 24rem minmax(0, 30rem); justify-content: center; justify-items: start; }
  .book { width: 24rem; }
  .intro { text-align: left; }
}

/* ---------- The back cover ---------- */
.back {
  background: var(--ink); color: var(--cream);
  padding: var(--space) var(--gutter);
  border-top: 1px solid var(--ink-2); border-bottom: 1px solid var(--ink-2);
}
@media (prefers-color-scheme: dark) { .back { background: var(--ink-2); } }
.back-inner { max-width: var(--measure); margin: 0 auto; }
.hook {
  font-style: italic; font-size: var(--step-2); line-height: 1.25; margin-bottom: 1.2em;
  color: var(--cream); text-wrap: balance;
}
.back p:not(.hook) { color: var(--cream); }
.back .emblem { width: 4.5rem; margin: 2.5rem auto 0; opacity: 0.9; }

/* ---------- Questions ---------- */
.ask, .plain { padding: var(--space) var(--gutter); }
.plain { min-height: 70vh; min-height: 70svh; display: grid; align-content: center; }
.ask-inner { max-width: var(--measure); margin: 0 auto; width: 100%; }
.ask h2, .plain h1 {
  font-size: 0.95rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2);
  font-family: inherit; margin: 0 0 0.75rem; font-variant-numeric: lining-nums;
}
.thanks h1 { font-size: var(--step-2); letter-spacing: 0; text-transform: none; color: var(--h); }
.thanks .emblem { width: 6rem; margin: 0 0 1.5rem; }
fieldset { border: 0; margin: 0 0 1.5rem; padding: 0; min-width: 0; }
legend { font-size: var(--step-1); line-height: 1.3; color: var(--h); margin-bottom: 1rem; padding: 0; }
.choice { position: relative; margin-bottom: 0.6rem; }
.choice input {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--heading);
}
.choice label {
  display: block; min-height: 3rem; padding: 0.7rem 1rem 0.7rem 2.9rem;
  background: var(--card); border: 1px solid var(--card-line); border-radius: 8px; cursor: pointer;
  line-height: 1.35;
}
.choice label:hover { border-color: var(--h); }
.choice input:checked + label { border-color: var(--h); box-shadow: inset 0 0 0 1px var(--h); }
.choice input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.line-choice label { font-style: italic; font-size: var(--step-1); padding-top: 0.9rem; padding-bottom: 0.9rem; }
.why-label { display: block; margin-bottom: 0.35rem; }
.optional { color: var(--fg-2); font-size: 0.85em; }
textarea {
  width: 100%; font: inherit; font-size: max(1rem, 0.95em); color: var(--fg);
  background: var(--card); border: 1px solid var(--card-line); border-radius: 8px; padding: 0.6rem 0.75rem;
  resize: vertical;
}
.hint { font-size: 0.85em; color: var(--fg-2); margin-top: 0.35rem; }
button {
  font: inherit; font-size: var(--step-0); min-height: 3rem; padding: 0.6rem 2.2rem; margin: 0.5rem 0 1.5rem;
  background: var(--heading); color: #FFFFFF; border: 0; border-radius: 999px; cursor: pointer;
}
button:hover { background: var(--ink); }
@media (prefers-color-scheme: dark) {
  button { background: var(--paper); color: var(--ink); }
  button:hover { background: #DFD1BF; }
  .choice input { accent-color: #DFD1BF; }
}
.privacy { font-size: 0.85em; color: var(--fg-2); }
.error {
  padding: 0.75rem 1rem; border-left: 3px solid var(--accent); background: var(--callout); color: var(--ink);
}
.ages { margin-top: 1.5rem; }
.small-legend { font-size: var(--step-0); color: var(--fg); margin-bottom: 0.5rem; }
.age-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.5rem; }
.age-grid .choice { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Intro and launch list ---------- */
.lead { font-size: var(--step-1); line-height: 1.4; color: var(--fg); }
.later { padding: 0 var(--gutter) var(--space); }
.notify { margin-top: 2rem; padding: 1.25rem; border: 1px solid var(--card-line); border-radius: 8px; background: var(--card); }
.later .notify { margin-top: 0; }
.notify-heading { font-size: var(--step-1); margin: 0 0 0.35rem; color: var(--h); letter-spacing: 0; text-transform: none; }
.notify .hint { margin-top: 0; }
.notify-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.notify-row input {
  flex: 1 1 14rem; min-width: 0; min-height: 3rem; font: inherit; font-size: max(1rem, 0.95em); color: var(--fg);
  background: var(--bg); border: 1px solid var(--card-line); border-radius: 999px; padding: 0.5rem 1rem;
}
.notify-row button { margin: 0; flex: 0 0 auto; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; min-height: 2.75rem; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0.3rem 0 0; flex: none; accent-color: var(--heading); }
.check label { font-size: 0.95em; }
@media (prefers-color-scheme: dark) { .check input { accent-color: #DFD1BF; } }

/* ---------- Privacy page ---------- */
.prose h2 { font-size: var(--step-1); margin: 2rem 0 0.5rem; }
.prose code { font-size: 0.85em; }
.consent-controls { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--card-line); border-radius: 8px; background: var(--card); }
.consent-controls button { margin: 0.5rem 0.5rem 0 0; }

/* ---------- Consent banner: both choices equally easy, never a dark pattern ---------- */
.consent {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  padding: 1rem var(--gutter) max(1rem, env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper);
  box-shadow: 0 -8px 24px -12px rgb(28 36 48 / 0.5);
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: center;
}
.consent[hidden] { display: none; }
/* While the banner shows, leave room so it never covers the end of the page. */
body:has(.consent:not([hidden])) { padding-bottom: 9rem; }
.consent p { margin: 0; max-width: 34rem; font-size: 0.95em; }
@media (max-width: 400px) {
  .consent { padding-top: 0.75rem; gap: 0.5rem 1rem; }
  .consent p { font-size: 0.85em; line-height: 1.4; }
}
.consent a { color: var(--paper); }
.consent-actions { display: flex; gap: 0.75rem; }
.consent-actions button { margin: 0; padding: 0.5rem 1.4rem; background: var(--paper); color: var(--ink); }
.consent-actions button:hover { background: #DFD1BF; }
.consent :focus-visible { outline-color: var(--paper); }
@media (prefers-color-scheme: dark) { .consent { background: var(--ink-2); border-top: 1px solid var(--muted); } }

/* ---------- Footer ---------- */
.site-footer {
  padding: 2rem var(--gutter) max(2rem, env(safe-area-inset-bottom));
  text-align: center; font-size: 0.85em; color: var(--fg-2);
  border-top: 1px solid var(--card-line);
}
.site-footer p { margin: 0; }
.nowrap { white-space: nowrap; }

/* Windows high contrast and other forced-color modes */
@media (forced-colors: active) {
  .book::after { display: none; }
  .choice label, textarea, button, .turn { border: 1px solid CanvasText; }
}

@media print {
  .ask, .turn, .site-footer, .consent { display: none; }
  .back { background: none; color: #000; }
  .back p, .hook { color: #000 !important; }
}
