/* ===========================================================
   عبد حجازي — Design System
   Style: Minimalism & Swiss  |  Scholarly navy + citation gold
   Density: spacious (24–96)  |  Motion: subtle
   =========================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --color-primary: #1E3A5F;
  --color-primary-hover: #16304F;
  --color-on-primary: #FFFFFF;
  --color-secondary: #334155;
  --color-accent: #B45309;
  --color-accent-hover: #92400E;
  --color-on-accent: #FFFFFF;
  /* Darker accent reserved for TEXT: #B45309 is only 4.35:1 on the alt
     surface, so small accent text uses this instead (>=4.87:1 everywhere). */
  --color-accent-text: #A34B08;

  /* Surfaces — warm paper ground for a literary catalogue */
  --color-background: #FAF7F2;
  --color-background-alt: #F3EEE5;
  --color-foreground: #14181F;
  --color-card: #FFFFFF;
  --color-muted: #EFE9DE;
  --color-muted-foreground: #55606F;
  --color-border: #E0D7C8;
  --color-border-strong: #CDBFA9;
  --color-ring: #1E3A5F;
  --color-destructive: #B91C1C;

  --font-display: "Amiri", "Frank Ruhl Libre", Georgia, serif;
  --font-body: "IBM Plex Sans Arabic", "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-prose: "Amiri", "Frank Ruhl Libre", Georgia, serif;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-5xl: 4rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .06);
  --shadow: 0 2px 8px rgba(20, 24, 31, .07), 0 1px 2px rgba(20, 24, 31, .05);
  --shadow-lg: 0 12px 32px rgba(20, 24, 31, .12), 0 2px 8px rgba(20, 24, 31, .06);
  --shadow-book: 0 14px 30px rgba(20, 24, 31, .18);

  --container: 1180px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: 220ms;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --color-primary: #8FB3DC;
  --color-primary-hover: #A8C6E8;
  --color-on-primary: #0B1220;
  --color-secondary: #94A3B8;
  --color-accent: #E9A94A;
  --color-accent-hover: #F2BC69;
  --color-on-accent: #16120A;
  --color-accent-text: #E9A94A;

  --color-background: #0F141C;
  --color-background-alt: #141B25;
  --color-foreground: #E9EEF5;
  --color-card: #18202B;
  --color-muted: #1E2733;
  --color-muted-foreground: #A3B0C0;
  --color-border: #2A3543;
  --color-border-strong: #3B4757;
  --color-ring: #8FB3DC;
  --color-destructive: #F87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, .55);
  --shadow-book: 0 14px 30px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 90px;
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 6vw, var(--text-5xl)); line-height: 1.2; }
h2 { font-size: clamp(1.75rem, 4vw, var(--text-3xl)); }
h3 { font-size: var(--text-xl); }
p { margin: 0 0 var(--space-2); text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

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

::selection { background: var(--color-accent); color: var(--color-on-accent); }

html[lang="he"] {
  --font-display: "Frank Ruhl Libre", "Amiri", Georgia, serif;
  --font-body: "Heebo", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-prose: "Frank Ruhl Libre", Georgia, serif;
}

/* ---------- 3. Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-3);
}
.section { padding-block: var(--space-6); }
.section--tight { padding-block: var(--space-5); }
.section--alt { background: var(--color-background-alt); }

.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--space-2);
  z-index: 60;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: inset-block-start var(--dur) var(--ease);
}
.skip-link:focus { inset-block-start: var(--space-1); }

.section-head { margin-block-end: var(--space-4); max-width: 60ch; }
.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--color-accent-text);
  margin-block-end: var(--space-1);
}
.section-head p { color: var(--color-muted-foreground); font-size: var(--text-lg); margin: 0; }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--color-background) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-block-end: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.site-header[data-scrolled="true"] {
  border-block-end-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 72px;
}

.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand-mark {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  padding-block-start: 2px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; white-space: nowrap; }
.brand-role { font-size: var(--text-xs); color: var(--color-muted-foreground); }

.nav { display: flex; align-items: center; gap: var(--space-1); }
.nav a {
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-muted-foreground);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav a:hover { color: var(--color-foreground); background: var(--color-muted); }
.nav a[aria-current="page"] { color: var(--color-foreground); font-weight: 600; }

.header-tools { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-foreground);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--color-muted); border-color: var(--color-border-strong); }
.icon-btn svg { width: 20px; height: 20px; }

.lang-switch {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--color-foreground);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.lang-switch:hover { background: var(--color-muted); border-color: var(--color-border-strong); }
.lang-switch svg { width: 18px; height: 18px; }

.nav-toggle { display: none; }

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--accent { background: var(--color-accent); color: var(--color-on-accent); }
.btn--accent:hover { background: var(--color-accent-hover); }

.btn--outline {
  background: transparent;
  color: var(--color-foreground);
  border-color: var(--color-border-strong);
}
.btn--outline:hover { background: var(--color-muted); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: gap var(--dur) var(--ease), color var(--dur) var(--ease);
}
.link-arrow svg { width: 18px; height: 18px; }
/* Forward arrows follow the reading flow (left in RTL); a "back" arrow opposes it. */
html[dir="rtl"] .link-arrow svg { transform: scaleX(-1); }
html[dir="rtl"] .link-arrow--back svg { transform: none; }
.link-arrow:hover { color: var(--color-accent-text); gap: 13px; }

/* ---------- 6. Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(var(--space-5), 8vw, var(--space-7));
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .5;
  pointer-events: none;
  background-size: 132px 132px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 8%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 8%, transparent 72%);
}
.hero .container { position: relative; z-index: 1; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--space-6);
  align-items: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-text);
  margin-block-end: var(--space-2);
}
.hero-eyebrow::before {
  content: "";
  width: 34px; height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
}
.hero h1 { margin-block-end: var(--space-1); }
.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, var(--text-2xl));
  color: var(--color-primary);
  margin-block-end: var(--space-3);
  font-weight: 400;
}
.hero-lead {
  font-size: var(--text-lg);
  color: var(--color-muted-foreground);
  max-width: 54ch;
  line-height: 1.9;
  margin-block-end: var(--space-4);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-muted);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
/* Scrim guarantees the caption stays legible over any portrait, light or dark. */
.portrait-frame::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  height: 38%;
  background: linear-gradient(to top, rgba(12, 16, 22, .78), rgba(12, 16, 22, .30) 45%, transparent);
  pointer-events: none;
}
.portrait-frame:not(:has(.portrait-caption))::after { content: none; }
.portrait-caption {
  position: absolute;
  z-index: 2;
  inset-block-end: var(--space-2);
  inset-inline-start: var(--space-2);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0,0,0,.75);
}

/* ---------- 7. Quote strip ---------- */
.quote-strip {
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding-block: var(--space-5);
}
:root[data-theme="dark"] .quote-strip {
  background: var(--color-background-alt);
  color: var(--color-foreground);
  border-block: 1px solid var(--color-border);
}
.quote-strip blockquote {
  margin: 0;
  max-width: 46ch;
  margin-inline: auto;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  line-height: 1.7;
}
.quote-strip cite {
  display: block;
  margin-block-start: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: normal;
  opacity: .85;
}
.quote-mark { display: block; width: 38px; height: 38px; margin-inline: auto; margin-block-end: var(--space-2); opacity: .45; }
.quote-mark svg { width: 100%; height: 100%; }

/* ---------- 8. Book cards ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4) var(--space-3);
}
.book-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform var(--dur) var(--ease);
}
.book-card:hover { transform: translateY(-4px); }
.book-card:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 6px; }

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-muted);
  box-shadow: var(--shadow-book);
  transition: box-shadow var(--dur) var(--ease);
}
.book-card:hover .book-cover { box-shadow: 0 20px 40px rgba(20,24,31,.25); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 9px;
  background: linear-gradient(to right, rgba(0,0,0,.30), rgba(255,255,255,.13) 55%, rgba(0,0,0,.08));
  z-index: 2;
}

.book-meta { display: flex; flex-direction: column; gap: 4px; }
.book-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  transition: color var(--dur) var(--ease);
}
.book-card:hover .book-title { color: var(--color-accent-text); }
.book-sub {
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; flex: none; }
.book-blurb {
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  line-height: 1.75;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-muted);
  color: var(--color-muted-foreground);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- 8b. Placeholder cover art ---------- */
.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;
}

.cover-art {
  --c1: #1E3A5F;
  --c2: #12253D;
  --foil: #D9B168;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12% 11%;
  text-align: center;
  background: linear-gradient(160deg, var(--c1) 0%, var(--c2) 100%);
  color: #F6EFE2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
/* thin foil frame */
.cover-art::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid var(--foil);
  opacity: .5;
  pointer-events: none;
}
.cover-orn { color: var(--foil); opacity: .85; }
.cover-orn svg { width: 34px; height: 34px; }
.cover-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 9cqw, 2rem);
  line-height: 1.45;
  text-wrap: balance;
}
.cover-rule { width: 34px; height: 1px; background: var(--foil); opacity: .7; }
.cover-author {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: .02em;
  opacity: .82;
}

.book-cover { container-type: inline-size; }
.cover-orn svg, .book-hero .cover-orn svg { width: 11cqw; height: 11cqw; max-width: 46px; max-height: 46px; min-width: 22px; min-height: 22px; }

.cover-art[data-palette="navy"]  { --c1: #1E3A5F; --c2: #101F35; --foil: #D9B168; }
.cover-art[data-palette="olive"] { --c1: #3F4A2A; --c2: #232B16; --foil: #CBBE86; }
.cover-art[data-palette="wine"]  { --c1: #5A2233; --c2: #33121D; --foil: #D9A66C; }
.cover-art[data-palette="teal"]  { --c1: #1E4A4A; --c2: #102A2A; --foil: #C9BC7E; }
.cover-art[data-palette="amber"] { --c1: #7A4718; --c2: #45260C; --foil: #E5C58C; }
.cover-art[data-palette="slate"] { --c1: #33404E; --c2: #1B242E; --foil: #C3C9CE; }

/* ---------- 9. Filters ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-block-end: var(--space-4);
  padding-block-end: var(--space-3);
  border-block-end: 1px solid var(--color-border);
}
.search-field { position: relative; flex: 1 1 280px; max-width: 380px; }
.search-field svg {
  position: absolute;
  inset-inline-start: 14px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  width: 19px; height: 19px;
  color: var(--color-muted-foreground);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  min-height: 48px;
  padding-block: 12px;
  padding-inline: 44px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  color: var(--color-foreground);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-field input::placeholder { color: var(--color-muted-foreground); }
.search-field input:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 22%, transparent);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted-foreground);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { background: var(--color-muted); color: var(--color-foreground); }
.chip[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
.results-count { font-size: var(--text-sm); color: var(--color-muted-foreground); margin-inline-start: auto; }
.empty-state { padding-block: var(--space-6); text-align: center; color: var(--color-muted-foreground); }

/* ---------- 10. Book detail ---------- */
.book-hero { padding-block: var(--space-5) var(--space-4); }
.book-hero-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-5);
  align-items: start;
}
.book-hero .book-cover { box-shadow: var(--shadow-lg); }
.book-hero h1 { font-size: clamp(2rem, 5vw, var(--text-4xl)); margin-block-end: var(--space-1); }
.book-lead {
  font-family: var(--font-prose);
  font-size: var(--text-xl);
  line-height: 1.9;
  color: var(--color-muted-foreground);
  margin-block-end: var(--space-3);
  max-width: 52ch;
}
.spec-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-2);
  padding-block: var(--space-3);
  margin-block: var(--space-3);
  border-block: 1px solid var(--color-border);
}
.spec-list dt { font-size: var(--text-xs); color: var(--color-muted-foreground); margin-block-end: 4px; }
.spec-list dd { margin: 0; font-weight: 600; font-size: var(--text-base); }

.prose {
  font-family: var(--font-prose);
  font-size: 1.1875rem;
  line-height: 2;
  max-width: 68ch;
}
.prose p { margin-block-end: var(--space-2); }

.pull-quote {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--color-accent);
  background: var(--color-background-alt);
  border-radius: var(--radius);
  font-family: var(--font-prose);
  font-size: var(--text-xl);
  line-height: 1.95;
  max-width: 62ch;
}
.pull-quote p:last-child { margin: 0; }

/* ---------- 11. About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: var(--space-6);
  align-items: center;
}
.timeline { display: grid; gap: var(--space-3); margin-block-start: var(--space-3); }
.timeline li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: var(--space-2);
  align-items: baseline;
  padding-block-end: var(--space-3);
  border-block-end: 1px solid var(--color-border);
}
.timeline li:last-child { border-block-end: 0; padding-block-end: 0; }
.timeline .t-year {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-accent-text);
}
.timeline .t-text { color: var(--color-muted-foreground); }

.tag-list { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: var(--space-2); }

/* ---------- 12. Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--space-6);
  align-items: start;
}
.contact-list { display: grid; gap: var(--space-2); }
.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  min-height: 64px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.contact-item:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.contact-icon {
  width: 44px; height: 44px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--color-muted);
  color: var(--color-primary);
}
.contact-icon svg { width: 21px; height: 21px; }
.contact-text { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.contact-text span:first-child { font-size: var(--text-xs); color: var(--color-muted-foreground); }
.contact-text span:last-child { font-weight: 600; overflow-wrap: anywhere; }

.form-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 8px; margin-block-end: var(--space-3); }
.field label { font-size: var(--text-sm); font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.6;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field textarea { min-height: 148px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--color-muted-foreground); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 22%, transparent);
}
.field-hint { font-size: var(--text-xs); color: var(--color-muted-foreground); }
.field-error { font-size: var(--text-sm); color: var(--color-destructive); font-weight: 600; display: none; }
.field[data-invalid="true"] input,
.field[data-invalid="true"] textarea { border-color: var(--color-destructive); }
.field[data-invalid="true"] .field-error { display: block; }

/* ---------- 13. Footer ---------- */
.site-footer {
  background: var(--color-background-alt);
  border-block-start: 1px solid var(--color-border);
  padding-block: var(--space-5) var(--space-3);
  margin-block-start: var(--space-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-4);
  padding-block-end: var(--space-4);
}
.footer-grid h4 { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 700; margin-block-end: var(--space-2); }
.footer-links { display: grid; gap: 4px; }
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.footer-links a:hover { color: var(--color-accent-text); }
.footer-about { color: var(--color-muted-foreground); font-size: var(--text-sm); max-width: 42ch; line-height: 1.85; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  align-items: center;
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
}
.footer-bottom a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.footer-bottom a:hover { color: var(--color-accent-text); }
.social-row { display: flex; gap: 8px; }
.social-row a {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted-foreground);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.social-row a:hover { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-muted); }
.social-row svg { width: 20px; height: 20px; }

/* ---------- 14. Motion (subtle) ---------- */
/* Scoped to .js so content stays visible if the script fails to load. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

.toast {
  position: fixed;
  inset-block-end: var(--space-3);
  inset-inline-start: 50%;
  transform: translate(-50%, 20px);
  background: var(--color-foreground);
  color: var(--color-background);
  padding: 14px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .book-card:hover { transform: none; }
}

/* ---------- 15. Responsive ---------- */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .portrait-frame { max-width: 380px; margin-inline: auto; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .book-hero-grid { grid-template-columns: 240px 1fr; gap: var(--space-4); }
}

@media (max-width: 768px) {
  :root { --space-6: 3rem; --space-7: 4rem; }
  .nav-toggle { display: grid; }
  .nav {
    position: fixed;
    inset-block-start: 72px;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--color-background);
    border-block-end: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-3) var(--space-3);
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  }
  .nav[data-open="true"] { transform: none; opacity: 1; visibility: visible; }
  .nav a { min-height: 52px; font-size: var(--text-lg); }
  .brand-role { display: none; }
  /* header must fit 3 controls + the name at 375px */
  .lang-switch span { display: none; }
  .lang-switch { width: 44px; padding: 0; justify-content: center; }
  .header-tools { gap: 6px; }
  .book-hero-grid { grid-template-columns: 1fr; }
  .book-hero .book-cover { max-width: 240px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3) var(--space-2); }
  .book-title { font-size: var(--text-lg); }
  .book-blurb { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-3); }
  .results-count { margin-inline-start: 0; width: 100%; }
  .search-field { max-width: none; }
  .prose { font-size: 1.0625rem; }
}

@media (max-width: 420px) {
  .hero-actions .btn { width: 100%; }
  .timeline li { grid-template-columns: 70px 1fr; }
}

@media print {
  .site-header, .site-footer, .hero-actions, .filter-bar, .toast { display: none; }
  body { background: #fff; color: #000; }
}
