/*
 * Edgar Alitto — author site.
 *
 * Palette taken from the books themselves: the dusk teal and saffron sky of
 * Light in the East, the celadon of northern Thai pottery for quiet sections,
 * the candle-lit brown of Janelas. Saffron always means "go to Amazon".
 *
 * Type: Literata (a typeface designed for reading books) for everything you read;
 * the system sans for controls, labels and small print.
 */

@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/literata.woff2') format('woff2');
}
@font-face {
  font-family: 'Literata';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/literata-italic.woff2') format('woff2');
}

:root {
  --ink: #13262A;
  --ink-raised: #1C3337;
  --paper: #FBFAF6;
  --white: #FFFFFF;
  --celadon: #E3EBE4;
  --line: #D3DDD6;
  --muted: #4A5E62;
  --saffron: #E8892B;
  --saffron-hover: #F29E4C;
  --saffron-text: #9C500E;
  --dusk-text: #C3D2CF;
  --window: #1D1A17;
  --window-text: #F3EBDD;
  --window-muted: #CDBFA8;
  --candle: #E2AE64;

  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --gutter: 20px;
  --radius: 8px;
  --shadow-cover: 0 2px 4px rgb(10 20 22 / 0.18), 0 18px 40px -8px rgb(10 20 22 / 0.45);

  /* Per-section colours; the tone classes below reassign them. */
  --fg: var(--ink);
  --fg-soft: var(--muted);
  --accent-text: var(--saffron-text);
  --buy: var(--saffron);
  --buy-hover: var(--saffron-hover);
  --focus: var(--ink);
  --rule: var(--line);
}

@media (min-width: 640px) { :root { --gutter: 32px; } }

/* ── Base ─────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); }
h3 { font-size: 1.375rem; font-weight: 600; line-height: 1.25; letter-spacing: 0; }
p { margin: 0 0 1em; text-wrap: pretty; }

.wrap { width: min(1160px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.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;
}

.skip-link {
  position: fixed; top: -100px; left: var(--gutter); z-index: 50;
  padding: 12px 16px; background: var(--ink); color: var(--paper);
  font: 600 0.9375rem/1.3 var(--sans); border-radius: var(--radius); min-height: 44px;
}
.skip-link:focus { top: 12px; }

.icon { flex: none; width: 1.1em; height: 1.1em; }
/* 国旗是 10:7 不是正方形，所以不走 .icon 的 1.1em；高度跟着字号走，宽度自己算。 */
.flag { flex: none; width: auto; height: 0.95em; border-radius: 1px; }
/* 笑脸标比线条图标视觉重量轻（细弧），所以画得比 .icon 大一点才压得住。 */
.amazon-mark { flex: none; width: 1.35em; height: 1.35em; }

/* Small labels: sans, spaced capitals. Used only where they name a real thing. */
.kicker, .label {
  margin: 0 0 1rem;
  font: 650 0.8125rem/1.4 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.lead { font-size: 1.25rem; line-height: 1.55; color: var(--fg-soft); max-width: 40em; }

/* ── Tones: each book's section takes its cover's colours ── */

.tone-dusk {
  --fg: var(--paper);
  --fg-soft: var(--dusk-text);
  --accent-text: var(--saffron);
  --focus: var(--saffron);
  --rule: rgb(255 255 255 / 0.16);
  background: var(--ink);
  color: var(--fg);
}
.tone-window {
  --fg: var(--window-text);
  --fg-soft: var(--window-muted);
  --accent-text: var(--candle);
  --buy: var(--candle);
  --buy-hover: #EBC07F;
  --focus: var(--candle);
  --rule: rgb(255 255 255 / 0.14);
  background: var(--window);
  color: var(--fg);
}
.tone-lotus {
  --rule: #C6D3C9;
  background: var(--celadon);
  color: var(--fg);
}

/* ── Buttons and links ────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { text-decoration: none; }
.btn { text-align: center; text-wrap: balance; }
.btn:active { transform: translateY(1px); }
.btn-buy { background: var(--buy); color: var(--ink); }
.btn-buy:hover { background: var(--buy-hover); }
.btn-ghost { border-color: currentColor; color: var(--fg); background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.btn-small { min-height: 44px; padding: 0.55rem 1rem; font-size: 0.9375rem; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.5rem; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 44px;
  font: 600 1rem/1.3 var(--sans);
  text-decoration: none;
  color: var(--fg);
}
.link-arrow .icon { transition: transform 0.15s; }
.link-arrow:hover { text-decoration: underline; }
.link-arrow:hover .icon { transform: translateX(3px); }

.buy { display: grid; justify-items: start; gap: 0.25rem; margin-top: 1.5rem; }
.buy .btn { min-width: 220px; }
.buy-alt { margin: 0; font: 0.9375rem/1.4 var(--sans); color: var(--fg-soft); }
.buy-alt a { display: inline-block; padding-block: 0.6rem; color: var(--fg); font-weight: 600; }

.facts { margin: 1rem 0 0; font: 0.9375rem/1.5 var(--sans); color: var(--fg-soft); }
.also { margin: 0.5rem 0 0; font: 0.9375rem/1.5 var(--sans); color: var(--fg-soft); }
.also a { display: inline-block; padding-block: 0.6rem; color: var(--fg); font-weight: 600; }

.cover { border-radius: 2px; box-shadow: var(--shadow-cover); background: var(--white); }

/* ── Header ───────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-bar { display: flex; align-items: center; gap: 0.5rem; min-height: 64px; }

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 44px; margin-right: auto;
  font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.brand-sun { color: var(--saffron); }

.nav { display: none; }
.nav ul { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem;
  font: 500 0.9375rem/1 var(--sans); text-decoration: none; color: var(--ink);
  border-radius: var(--radius);
}
.nav a:hover { background: var(--celadon); }
.nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--saffron); border-radius: 0; }

.lang-switch {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 44px; min-width: 44px; padding: 0 0.6rem;
  font: 600 0.9375rem/1 var(--sans); text-decoration: none; color: var(--ink);
  border-radius: var(--radius);
}
.lang-switch:hover { background: var(--celadon); }
/* Phones show "PT"; the full name stays in the accessible name. */
.lang-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.header-shop { display: none; }

@media (max-width: 374px) {
  .header-bar { gap: 0.25rem; }
  .brand { font-size: 1.25rem; gap: 0.45rem; }
  .lang-switch, .menu summary { padding-inline: 0.45rem; }
}

@media (min-width: 900px) {
  .header-bar { min-height: 72px; gap: 1rem; }
  .nav { display: block; }
  .lang-long { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .lang-short { display: none; }
  .header-shop { display: inline-flex; }
}

/* ── Breadcrumbs ──────────────────────────────────────── */

.breadcrumbs ol {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem;
  margin: 0 0 1.5rem; padding: 0; list-style: none;
  font: 0.9375rem/1.4 var(--sans); color: var(--fg-soft);
}
.breadcrumbs li + li::before { content: '/'; margin-right: 0.5rem; opacity: 0.6; }
@media (max-width: 479px) {
  .breadcrumbs ol { flex-wrap: nowrap; white-space: nowrap; }
  .breadcrumbs li:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
.breadcrumbs a { display: inline-block; min-width: 44px; padding: 0.8rem 0.25rem; margin-inline: -0.25rem; text-align: center; color: var(--fg); }

/* ── Home: hero ───────────────────────────────────────── */

.hero { position: relative; overflow: hidden; border-bottom: 3px solid var(--saffron); }
.hero-grid { display: grid; gap: 0; padding-top: 2.5rem; }
.hero-copy { position: relative; z-index: 4; }
.hero-title {
  margin: 0 0 1.25rem;
  font-size: clamp(3.25rem, 11vw, 6.75rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.035em;
}
@media (max-width: 479px) {
  .hero-kicker .sep { display: none; }
  .hero-kicker span { display: block; }
  .hero .actions .btn { flex: 1 1 100%; }
}
.hero-lead { max-width: 34em; font-size: 1.25rem; line-height: 1.55; color: var(--fg-soft); }

/* The sun rises behind the books — the title of the first one, and its cover. */
.shelf { position: relative; height: clamp(250px, 70vw, 380px); margin-inline: calc(-1 * var(--gutter)); }
.sun {
  position: absolute; left: 50%; bottom: 0;
  width: min(118vw, 620px); aspect-ratio: 1;
  translate: -50% 50%;
  border-radius: 50%;
  background: var(--saffron);
}
.fan { position: absolute; inset: 0 auto 0 50%; width: min(100%, 560px); translate: -50% 0; margin: 0; padding: 0; list-style: none; }
.fan li {
  position: absolute; bottom: 9%; left: var(--x);
  width: var(--w);
  translate: -50% 0;
  rotate: var(--r);
  transform-origin: 50% 100%;
  transition: translate 0.25s ease;
}
.fan li:hover { translate: -50% -10px; }
.fan a { display: block; border-radius: 2px; }
.fan-1 { --x: 15%; --w: 24%; --r: -10deg; z-index: 1; }
.fan-2 { --x: 32%; --w: 27%; --r: -5deg; z-index: 2; }
.fan-3 { --x: 85%; --w: 24%; --r: 10deg; z-index: 1; }
.fan-4 { --x: 68%; --w: 27%; --r: 5deg; z-index: 2; }
.fan-5 { --x: 50%; --w: 32%; --r: 0deg; z-index: 3; }
.fan-1, .fan-3 { bottom: 13%; }
.fan-2, .fan-4 { bottom: 11%; }

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1fr 1fr; align-items: end; gap: 2rem; padding-top: 0; min-height: min(640px, 82vh); }
  .hero-copy { align-self: center; padding-block: 4rem; }
  .shelf { height: 100%; min-height: 520px; margin-inline: 0 calc(-1 * var(--gutter)); }
  .sun { width: 600px; }
  .fan li { bottom: 14%; }
  .fan-1, .fan-3 { bottom: 19%; }
  .fan-2, .fan-4 { bottom: 16.5%; }
}

/* ── Home: book features ──────────────────────────────── */

.feature { padding-block: 4rem; }
.feature-grid { display: grid; gap: 2.5rem; align-items: start; }
.feature-cover { justify-self: center; width: min(62vw, 300px); }
.feature-copy { max-width: 36rem; }
.feature-title { margin-bottom: 0.25rem; font-size: clamp(2.25rem, 5vw, 3.25rem); }
.feature-title a { text-decoration: none; }
.feature-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.feature-sub { margin-bottom: 1.25rem; font-size: 1.25rem; line-height: 1.4; color: var(--fg-soft); }
.hook { font-size: 1.375rem; font-style: italic; line-height: 1.45; }
.feature-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.5rem; margin: 1rem 0 0; }
.feature-links .also { margin: 0; }

@media (min-width: 640px) {
  .feature { padding-block: 5.5rem; }
  .feature-grid { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 3.5rem; }
  .feature-cover { width: 100%; }
  .is-flipped .feature-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); }
  .is-flipped .feature-cover { order: 2; }
}
@media (min-width: 900px) {
  .feature-grid { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 5rem; }
  .is-flipped .feature-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); }
}

/* The four-line invitation from Light in the East: the page's one big typographic moment. */
.invitation { padding-block: 4rem; border-block: 1px solid var(--line); }
.invitation ul { margin: 0; padding: 0; list-style: none; }
.invitation li {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 450;
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.invitation li:last-child { font-style: italic; color: var(--saffron-text); }
@media (min-width: 900px) {
  .invitation { padding-block: 5.5rem; }
  .invitation .wrap { display: grid; grid-template-columns: 360px minmax(0, 1fr); column-gap: 5rem; align-items: start; }
  .invitation .kicker { padding-top: 1.1rem; }
}

/* ── Meet Edgar / follow ──────────────────────────────── */

.portrait { border-radius: 50%; background: var(--white); }

.meet { padding-block: 4rem; }
.meet-grid { display: grid; gap: 1.5rem; align-items: center; }
.meet .portrait { width: 168px; }
.meet .lead { color: var(--fg); }
@media (min-width: 900px) {
  .meet { padding-block: 5.5rem; }
  .meet-grid { grid-template-columns: 360px minmax(0, 1fr); gap: 5rem; }
  .meet .portrait { width: 240px; }
}

.follow { padding-block: 3.5rem; background: var(--celadon); }
.follow-inner { display: grid; gap: 1.5rem; align-items: center; justify-items: start; }
.follow h2 { margin-bottom: 0.25rem; font-size: clamp(1.75rem, 3.5vw, 2.25rem); }
.follow p { margin: 0; color: var(--fg-soft); }
@media (min-width: 900px) { .follow-inner { grid-template-columns: 1fr auto; gap: 3rem; } }

/* ── Inner pages ──────────────────────────────────────── */

.page-head { padding-block: 1.5rem 3rem; }
.page-head h1 { margin-bottom: 0.75rem; }
@media (min-width: 900px) { .page-head { padding-block: 2rem 4rem; } }

/* Books list */
.book-list { display: grid; gap: 0; padding-bottom: 3rem; }
.book-row { display: grid; gap: 1.75rem; padding-block: 3rem; border-top: 1px solid var(--line); }
.book-row-cover { width: min(44vw, 200px); }
.book-row h2 { margin-bottom: 0.25rem; }
.book-row h2 a { text-decoration: none; }
.book-row h2 a:hover { text-decoration: underline; }
.book-row-sub { font-size: 1.25rem; line-height: 1.4; color: var(--fg-soft); }
.book-row .label { margin-top: 1.5rem; margin-bottom: 0.5rem; }

.edition-mini { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.edition-mini li {
  display: grid; gap: 0 1rem; align-items: center;
  padding-block: 0.6rem; border-bottom: 1px solid var(--line);
  font: 0.9375rem/1.4 var(--sans);
}
.edition-mini-name { font: 600 1.0625rem/1.35 var(--serif); }
.edition-mini-facts { color: var(--fg-soft); }
.edition-mini-buy { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.edition-mini-buy a {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 44px;
  font-weight: 600; color: var(--saffron-text);
}
@media (min-width: 640px) {
  .book-row { grid-template-columns: 200px 1fr; gap: 3rem; }
  .book-row-cover { width: 100%; }
  .edition-mini li { grid-template-columns: 1fr auto; }
  .edition-mini-buy { grid-column: 2; grid-row: 1 / span 2; }
}
@media (min-width: 900px) { .book-row { grid-template-columns: 260px 1fr; gap: 4.5rem; padding-block: 4rem; } }

/* Book page */
.book-hero { padding-block: 1rem 3rem; }
.book-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
  grid-template-areas: "cover head" "body body";
  gap: 1.25rem 1.25rem;
  align-items: start;
}
.book-hero-cover { grid-area: cover; }
.book-hero-head { grid-area: head; align-self: center; }
.book-hero-body { grid-area: body; }
.book-hero h1 { margin-bottom: 0.4rem; font-size: clamp(1.875rem, 6.5vw, 4rem); }
.book-hero .kicker { margin-bottom: 0.5rem; }
.book-sub { margin-bottom: 0.75rem; font-size: clamp(1.0625rem, 2.6vw, 1.5rem); line-height: 1.35; color: var(--fg-soft); }
.byline { margin: 0; font: 600 0.9375rem/1.4 var(--sans); }
.book-hero .hook { margin-bottom: 0; }

@media (min-width: 900px) {
  .book-hero { padding-block: 1.5rem 5rem; }
  .book-hero-grid {
    grid-template-columns: 380px minmax(0, 1fr);
    grid-template-areas: "cover head" "cover body";
    grid-template-rows: auto 1fr;
    gap: 0 5rem;
  }
  .book-hero-head { align-self: end; padding-top: 2rem; }
  .book-hero-body { padding-top: 1.75rem; }
  .byline { font-size: 1rem; }
}

.book-about { padding-block: 4rem; }
.book-about-grid { display: grid; gap: 3rem; }
.prose { max-width: 40rem; }
.prose h2 { margin-top: 0; }
.prose p { font-size: 1.125rem; line-height: 1.7; }
.prose .note { font: italic 1rem/1.6 var(--serif); color: var(--fg-soft); padding-left: 1rem; border-left: 3px solid var(--saffron); }
.tagline { font-style: italic; font-size: 1.25rem; color: var(--saffron-text); }
.book-lists { display: grid; gap: 2rem; align-content: start; }
.ticks { margin: 0; padding: 0; list-style: none; }
.ticks li { position: relative; padding: 0.55rem 0 0.55rem 1.6rem; border-bottom: 1px solid var(--line); line-height: 1.45; }
.ticks li::before {
  content: ''; position: absolute; left: 0.1rem; top: 1.05rem;
  width: 0.7rem; height: 0.35rem; border-radius: 0.7rem 0.7rem 0 0; background: var(--saffron);
}
@media (min-width: 900px) {
  .book-about { padding-block: 5.5rem; }
  .book-about-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 5rem; }
}

.editions { padding-block: 4rem; background: var(--celadon); }
.edition-grid { display: grid; gap: 1.25rem; margin-top: 2rem; }
.edition-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas: "cover title" "specs specs" "buy buy";
  grid-template-rows: auto 1fr auto;
  gap: 1rem 1.25rem; align-items: start;
  padding: 1.25rem; background: var(--white); border-radius: 12px;
  box-shadow: 0 1px 2px rgb(19 38 42 / 0.08);
}
.edition-cover { grid-area: cover; width: 72px; }
.edition-card h3 { grid-area: title; align-self: center; margin: 0; }
.edition-card .specs { grid-area: specs; }
.edition-buy { grid-area: buy; }
.specs { display: grid; align-content: start; gap: 0; margin: 0; font: 0.9375rem/1.4 var(--sans); }
.specs div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.75rem; padding-block: 0.4rem; border-bottom: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; overflow-wrap: anywhere; }
.edition-buy { display: flex; flex-wrap: wrap; gap: 0.6rem; }
@media (max-width: 479px) {
  .specs div { grid-template-columns: 7.25rem 1fr; }
  .edition-buy .btn { flex: 1 1 100%; }
}
@media (min-width: 480px) { .edition-buy .btn { min-width: 232px; } }
@media (min-width: 640px) {
  .edition-card {
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-areas: "cover title" "cover specs" "cover buy";
    padding: 1.75rem; gap: 1rem 1.75rem;
  }
  .edition-cover { width: 120px; }
  .edition-card h3 { align-self: start; }
}
@media (min-width: 1000px) { .edition-grid { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); } }
@media (min-width: 900px) { .editions { padding-block: 5.5rem; } }

.author-review { padding-block: 4rem; }
.author-review-grid { display: grid; gap: 3rem; }
.author-box { display: grid; grid-template-columns: 96px 1fr; gap: 1.25rem; align-items: start; }
.author-box .portrait { width: 96px; }
.author-box h2, .review-box h2 { font-size: 1.75rem; }
.review-box { padding: 1.75rem; border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 479px) {
  .author-box { grid-template-columns: 1fr; }
  .author-box .portrait { width: 80px; }
  .review-box, .contact-card { padding: 1.25rem; }
}
.review-box > .icon { width: 28px; height: 28px; margin-bottom: 0.75rem; color: var(--saffron); fill: var(--saffron); }
@media (min-width: 900px) {
  .author-review { padding-block: 5.5rem; }
  .author-review-grid { grid-template-columns: 1.4fr 1fr; gap: 5rem; align-items: start; }
  .author-box { grid-template-columns: 140px 1fr; gap: 2rem; }
  .author-box .portrait { width: 140px; }
}

.more { padding-block: 4rem; border-top: 1px solid var(--line); }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.25rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.more-grid li:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 0.625rem); }
.more-grid a { display: grid; gap: 0.25rem; text-decoration: none; }
.more-cover { display: flex; align-items: flex-end; aspect-ratio: 971 / 1500; margin-bottom: 0.75rem; }
.more-cover .cover { width: 100%; }
.more-grid .cover { transition: translate 0.2s; }
.more-grid a:hover .cover { translate: 0 -4px; }
.more-grid a:hover .more-title { text-decoration: underline; }
.more-title { font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
.more-kicker { font: 0.9375rem/1.4 var(--sans); color: var(--muted); }
@media (min-width: 640px) {
  .more-grid { grid-template-columns: repeat(auto-fill, 180px); gap: 2.5rem; }
  .more-grid li:last-child:nth-child(odd) { grid-column: auto; justify-self: stretch; width: auto; }
}
@media (min-width: 900px) {
  .more > .wrap { display: grid; grid-template-columns: 360px minmax(0, 1fr); column-gap: 5rem; align-items: start; }
  .more-grid { margin-top: 0; grid-template-columns: repeat(auto-fill, 200px); }
}

/* About */
.about-head-grid { display: grid; gap: 1.5rem; align-items: center; }
.portrait-large { width: 200px; }
.about-bio { padding-bottom: 3rem; }
.about-bio .prose p:first-child { font-size: 1.375rem; line-height: 1.55; }
@media (min-width: 900px) {
  .about-head-grid { grid-template-columns: 300px 1fr; gap: 4rem; }
  .portrait-large { width: 300px; }
}

.timeline-section { padding-block: 4rem; border-top: 1px solid var(--line); }
.timeline { margin: 2rem 0 0; padding: 0; list-style: none; max-width: 52rem; }
.timeline li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding-block: 1.5rem; border-top: 1px solid var(--line); }
.timeline-year { font-size: 1.375rem; font-weight: 600; color: var(--saffron-text); line-height: 1.25; }
.timeline h3 { margin-bottom: 0.4rem; }
.timeline p { margin: 0; color: var(--fg-soft); }
@media (max-width: 479px) { .timeline li { grid-template-columns: 1fr; gap: 0.25rem; } }
@media (min-width: 640px) { .timeline li { grid-template-columns: 7rem 1fr; gap: 2rem; } .timeline-year { font-size: 1.75rem; } }

.ministry { padding-block: 4rem; }
.ministry-inner { display: grid; gap: 1.5rem; align-items: center; }
.ministry p { max-width: 40rem; color: var(--fg-soft); }
@media (min-width: 900px) { .ministry-inner { grid-template-columns: 1fr auto; gap: 4rem; } }

/* Contact */
.contact-grid { display: grid; gap: 1.25rem; padding-bottom: 5rem; }
.contact-card { padding: 1.75rem; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.contact-card h2 { font-size: 1.625rem; }
/* The last card spans both columns when the count is odd (see below), and without
   a measure its single paragraph ran the full 1102px — about 130 characters a
   line, against ~70 in the half-width cards beside it. */
.contact-card p { max-width: 60ch; color: var(--fg-soft); }
.contact-card .actions { margin-top: 1rem; }
.email { font-weight: 600; font-size: 1.25rem; }
@media (min-width: 900px) {
  .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
  .contact-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Privacy */
.privacy { padding-bottom: 5rem; }
.privacy h2 { margin-top: 2.5rem; font-size: 1.625rem; }
.privacy h2:first-child { margin-top: 0; }
.consent { margin: 1.5rem 0 0.5rem; padding: 1.5rem; background: var(--celadon); border-radius: 12px; }
.consent .actions { margin-top: 0; }
#consent-status { margin: 1rem 0 0; font: 0.9375rem/1.5 var(--sans); }
.privacy .outbound { display: inline-block; padding-block: 0.6rem; }

/* Error */
.error-page { padding-block: 3rem 5rem; }
.error-books { max-width: 640px; }

/* ── Footer ───────────────────────────────────────────── */

.site-footer { padding-block: 3.5rem 2rem; background: var(--ink); color: var(--dusk-text); --focus: var(--saffron); }
.site-footer .brand { color: var(--paper); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { margin: 0.5rem 0 0; }
.site-footer h2 { margin: 0 0 0.5rem; font: 650 0.8125rem/1.4 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--saffron); }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
/* flex, not inline-flex: inline-flex makes the tap target as narrow as the word,
   and "About" measures 41px — under the 44px minimum. Filling the column costs
   nothing visually (the underline still sits under the text only) and gives every
   footer link a full-width target. */
.site-footer nav a {
  display: flex; align-items: center; gap: 0.35rem; min-height: 44px;
  font: 0.9375rem/1.3 var(--sans); color: var(--paper); text-decoration: none;
}
.site-footer nav a:hover { text-decoration: underline; }
.footer-base {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 2rem;
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid rgb(255 255 255 / 0.14);
  font: 0.9375rem/1.4 var(--sans);
}
.footer-base p { margin: 0; }
.powered { display: flex; align-items: center; gap: 0.4rem; }
.powered a { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; color: var(--paper); font-weight: 600; text-decoration: none; }
.powered a:hover { text-decoration: underline; }
.powered img { width: 20px; height: 20px; border-radius: 4px; }
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; }
  .footer-brand { grid-column: auto; }
}

/* ── Phone buy bar on book pages ──────────────────────── */

.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper);
  box-shadow: 0 -8px 24px rgb(10 20 22 / 0.25);
  translate: 0 110%;
  transition: translate 0.25s ease;
  --focus: var(--saffron);
}
.buybar.is-visible { translate: 0 0; }
.buybar img { width: 32px; border-radius: 2px; outline: 1px solid rgb(255 255 255 / 0.2); }
.page-tone-window .buybar { background: var(--window); --buy: var(--candle); --buy-hover: #EBC07F; --focus: var(--candle); }
.buybar p { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buybar .btn { flex: none; }
/* Too narrow for title and button side by side: the cover says which book it is. */
@media (max-width: 479px) { .buybar p { display: none; } .buybar .btn { flex: 1; } }
@media (max-width: 899px) {
  .has-buybar .site-footer { padding-bottom: 6rem; }
  html:has(.buybar.is-visible) { scroll-padding-bottom: 88px; }
}
@media (min-width: 900px) { .buybar { display: none; } }

/* ── Bottom tab bar (phones and tablets) ──────────────── */

/*
 * Replaces the header hamburger below 900px. Fixed, so it has to pay for its own
 * space: the footer gets the height back as padding (not body, or the paper
 * background would show as a pale strip under the dark footer), and the sticky
 * buy bar on book pages moves up to sit on top of it rather than behind it.
 */
.tabbar { display: none; }

@media (max-width: 899px) {
  :root { --tabbar-h: 56px; }

  .tabbar {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--line);
    /* 深色/暖色页面也用浅色底栏，所以这里把配色变量拉回默认，
       否则 .page-tone-* 会把图标和文字染成页面色，在浅底上看不见。 */
    --fg: var(--ink);
    --fg-soft: var(--muted);
    --focus: var(--ink);
  }
  .tabbar ul { display: flex; margin: 0; padding: 0; list-style: none; }
  .tabbar li { flex: 1; min-width: 0; }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: var(--tabbar-h); padding: 0 2px;
    font: 600 0.6875rem/1.1 var(--sans); color: var(--fg-soft);
    text-decoration: none;
  }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .icon { width: 22px; height: 22px; }
  /* Shop is accented too (it is the point of the site), so colour alone cannot say
     which tab you are on. The rule above the current tab does. */
  .tabbar a { position: relative; }
  .tabbar a[aria-current] { color: var(--saffron-text); }
  .tabbar a[aria-current] .icon { stroke-width: 2.1; }
  .tabbar a[aria-current]::before {
    content: ''; position: absolute; top: 0; left: 50%; translate: -50% 0;
    width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--saffron);
  }
  .tabbar .tab-shop { color: var(--saffron-text); }

  .site-footer { padding-bottom: calc(2rem + var(--tabbar-h) + env(safe-area-inset-bottom)); }

  .buybar {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: 0.6rem;
  }
  .has-buybar .site-footer { padding-bottom: calc(6rem + var(--tabbar-h) + env(safe-area-inset-bottom)); }
  html:has(.buybar.is-visible) { scroll-padding-bottom: calc(88px + var(--tabbar-h)); }
}

/* ── Motion ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
