/* ===== Colors — change these to restyle the whole site ===== */
:root {
  --paper: #f7f2e8;
  --card: #fffdf8;
  --ink: #2a2420;
  --muted: #6e645b;
  --line: #e2d8c6;
  --accent: #b5452b;      /* rust */
  --poem: #7a4e8c;        /* plum */
  --essay: #2f6a6a;       /* teal */
  --story: #b5452b;       /* rust */
  --novel: #2f5a8a;       /* ink blue */
  --craft: #8a6a1f;       /* ochre */
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1714;
    --card: #25201c;
    --ink: #efe7da;
    --muted: #a99d8f;
    --line: #3a322b;
    --accent: #e0805f;
    --poem: #c19ad2;
    --essay: #7cc1bf;
    --story: #e0805f;
    --novel: #8fb3e0;
    --craft: #d9b45a;
    --shadow: none;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 "Source Sans 3", system-ui, sans-serif;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; line-height: 1.15; margin: 0; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.masthead { padding: 56px 0 40px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.eyebrow {
  margin: 0 0 12px; color: var(--accent);
  font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.masthead h1 { font-size: clamp(2.6rem, 8vw, 4.5rem); font-weight: 700; letter-spacing: -.02em; }
.lede { max-width: 38rem; margin: 16px 0 0; font-size: 1.2rem; color: var(--muted); }

/* ===== Trio ===== */
.trio-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.trio-head h2 { font-size: 1.5rem; font-weight: 600; }
.controls { display: flex; gap: 8px; }

.btn {
  font: 600 .95rem "Source Sans 3", sans-serif;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
}
.btn:hover { opacity: .85; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  --tone: var(--accent);
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--tone);
  border-radius: 10px; padding: 22px; box-shadow: var(--shadow);
}
.card--poem  { --tone: var(--poem); }
.card--essay { --tone: var(--essay); }
.card--story { --tone: var(--story); }
.kind {
  color: var(--tone, var(--accent));
  font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.card h3 { font-size: 1.45rem; margin: 10px 0 4px; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-color: var(--tone); }
.author { margin: 0; color: var(--muted); }
.note { margin: 12px 0 0; font-style: italic; }
.read { margin-top: auto; padding-top: 18px; color: var(--tone); font-weight: 600; text-decoration: none; }
.read:hover { text-decoration: underline; }

/* ===== Bradbury quote ===== */
.quote { margin: 56px auto; max-width: 46rem; padding: 0 8px; text-align: center; }
.quote blockquote { margin: 0; position: relative; }
.quote blockquote::before {
  content: "\201C"; display: block; height: .55em;
  font: 700 4.5rem/1 "Fraunces", Georgia, serif; color: var(--accent); opacity: .6;
}
.quote p {
  margin: 0;
  font: italic 400 clamp(1.3rem, 3.2vw, 1.75rem)/1.45 "Fraunces", Georgia, serif;
  color: var(--ink);
}
.quote figcaption { margin-top: 18px; color: var(--muted); font-size: .92rem; }
.quote figcaption::before { content: ""; display: block; width: 40px; height: 2px; margin: 0 auto 14px; background: var(--accent); }
.quote figcaption a { color: inherit; text-decoration-color: var(--accent); }

/* ===== The bookshelf ===== */
.shelf { margin: 48px 0 36px; }
.shelf__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 16px; }
.shelf__head h2 { font-size: 1.5rem; font-weight: 600; }
.shelf__head p { margin: 0; color: var(--muted); }
.shelf__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.book {
  --tone: var(--accent);
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px; border-radius: 10px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--tone);
}
.book:hover { border-color: var(--tone); }
.book--poem  { --tone: var(--poem); }
.book--essay { --tone: var(--essay); }
.book--story { --tone: var(--story); }
.book--novel { --tone: var(--novel); }
.book--craft { --tone: var(--craft); }
.book .kind { font-size: .68rem; }
.book strong { font-family: "Fraunces", Georgia, serif; font-size: 1.08rem; line-height: 1.2; margin-top: 4px; }
.book .by { color: var(--muted); font-size: .9rem; }
.book .why { font-size: .88rem; line-height: 1.45; margin-top: 6px; }
.disclosure { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }

/* ===== Ads & sponsors ===== */
.ad, .sponsors { margin: 36px 0; }
.ad__label { display: block; margin-bottom: 6px; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ad__box {
  min-height: 100px; display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .9rem;
}
.sponsor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sponsor {
  display: block; padding: 18px; border-radius: 10px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
}
.sponsor strong { display: block; margin-bottom: 4px; }
.sponsor span { color: var(--muted); font-size: .95rem; }
.sponsor:hover { border-color: var(--accent); }
.sponsor .ad__label { margin-bottom: 8px; font-size: .7rem; }
.sponsor--free { border-left: 3px solid var(--essay); }
.sponsor--free .ad__label { color: var(--essay); font-weight: 600; }
.sponsor--free:hover { border-color: var(--essay); }

/* ===== About ===== */
.about { max-width: 42rem; margin: 48px 0; }
.about h2 { font-size: 1.6rem; margin-bottom: 12px; }
.pull { margin: 24px 0 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); }
.pull blockquote { margin: 0; }
.pull p { margin: 0; font: italic 400 1.2rem/1.5 "Fraunces", Georgia, serif; }
.pull figcaption { margin-top: 8px; color: var(--muted); font-size: .9rem; }
.pull figcaption::before { content: "\2014\00a0"; }
.pull figcaption a { color: inherit; text-decoration-color: var(--accent); }

/* ===== Footer ===== */
.footer { padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer p { margin: 4px 0; }

/* ===== Suggestion popup ===== */
.dialog {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialog::backdrop { background: rgba(20, 15, 10, .55); }
.dialog__body { position: relative; display: flex; flex-direction: column; padding: 26px 24px 22px; }
.dialog h2 { font-size: 1.5rem; padding-right: 32px; }
.dialog__intro { margin: 8px 0 18px; color: var(--muted); font-size: .95rem; }
.dialog__close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.dialog__close:hover { background: var(--line); color: var(--ink); }
.dialog label { font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }
.dialog .optional { font-weight: 400; color: var(--muted); }
.dialog input, .dialog select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 400 1rem "Source Sans 3", sans-serif;
}
.dialog input:focus, .dialog select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.dialog__status { min-height: 1.4em; margin: 14px 0 0; font-size: .92rem; }
.dialog__status[data-kind="ok"] { color: var(--essay); }
.dialog__status[data-kind="error"] { color: var(--accent); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ===== Phones ===== */
@media (max-width: 760px) {
  .masthead { padding: 40px 0 28px; margin-bottom: 28px; }
  .trio, .sponsor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shelf__grid { grid-template-columns: repeat(2, 1fr); }
  .book--craft { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .shelf__grid { grid-template-columns: 1fr; }
}
