/* Father Mark Aziz — library of books and translations
   Palette: Coptic manuscript. Paper and vellum, oxblood wine, gold leaf, night ink. */

:root {
  --paper: #f5efe4;
  --paper-2: #ece3d3;
  --vellum: #e4d7bf;
  --cream: #f6ecda;
  --ink: #1d1614;
  --ink-2: #3f3531;
  --muted: #6b5f58;
  --line: #dcd0bc;
  --line-strong: #bfae92;
  --wine: #5e1f2a;
  --wine-2: #7a2f3b;
  --wine-deep: #3a1119;
  --night: #1a0d10;
  --gold: #c99f58;
  --gold-2: #e2bf7a;
  --gold-text: #7d5c25;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --arabic: 'Amiri', 'Noto Naskh Arabic', 'Geeza Pro', serif;
  --arabic-text: 'Noto Naskh Arabic', 'Amiri', 'Geeza Pro', serif;
  --content: 1360px;
  --gutter: clamp(20px, 5vw, 88px);
  --header-h: 80px;
  --radius: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow-book: -14px 22px 40px -8px rgba(20, 8, 10, .55), -2px 6px 14px rgba(20, 8, 10, .35);
  --shadow-book-paper: 10px 18px 36px -10px rgba(50, 30, 20, .45), 2px 6px 12px rgba(50, 30, 20, .18);
}

@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: var(--ease); }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); overflow-x: clip; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.65 var(--sans); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; overflow-x: clip; min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a, button, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 2px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, blockquote, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 400; font-family: var(--serif); line-height: 1.05; letter-spacing: -.012em; text-wrap: balance; }
h2 { font-size: clamp(2.25rem, 1.4rem + 2.8vw, 3.5rem); }
[lang=ar] { font-family: var(--arabic-text); letter-spacing: 0; }
h1[lang=ar], h2[lang=ar], h3[lang=ar], .subtitle[lang=ar], .detail-subtitle[lang=ar], .arabic-name, .shelf-title[lang=ar] { font-family: var(--arabic); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
::selection { background: var(--gold-2); color: var(--ink); }
.i { width: 1.1em; height: 1.1em; flex: none; }
.cross { width: 2rem; height: 2rem; color: var(--gold); flex: none; }

.wrap { width: min(var(--content), 100% - var(--gutter) * 2); margin-inline: auto; }
.skip { position: fixed; top: -100px; left: 20px; z-index: 100; background: var(--wine); color: #fff; padding: 12px 20px; border-radius: var(--radius); }
.skip:focus { top: 12px; }

/* Scroll reveal: only when JS is present, so content never stays hidden. */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Type helpers ---------- */
.eyebrow { display: flex; align-items: center; gap: 14px; font: 600 .8125rem/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); }
.eyebrow::before { content: ''; width: 28px; height: 1px; background: currentColor; opacity: .8; }
.eyebrow-light { color: var(--gold-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px; font: 500 .75rem/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--ink-2); }
.tag [lang=ar] { font-size: .95rem; text-transform: none; letter-spacing: 0; line-height: 1; }
.tag-lang::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--wine); margin-right: 7px; }
.tag-lang.is-ar::before { background: var(--gold); }
.tag-kind { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.tag-year { border-color: transparent; background: var(--paper-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 12px 24px; border-radius: var(--radius); border: 1px solid transparent; font: 500 1rem/1.3 var(--sans); letter-spacing: .01em; transition: transform .25s var(--ease), background .25s, color .25s, border-color .25s, box-shadow .25s; }
.btn .i { transition: transform .25s var(--ease); }
.btn:hover { transform: translateY(-2px); }
.btn:hover .i { transform: translateX(3px); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--ink); box-shadow: 0 10px 24px -12px rgba(201, 159, 88, .8); }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); color: var(--ink); }
.btn-gold:hover .i { transform: translateY(3px); }
.btn-ghost { border-color: rgba(246, 236, 218, .4); color: var(--cream); }
.btn-ghost:hover { border-color: var(--cream); background: rgba(246, 236, 218, .08); color: #fff; }
.btn-wine { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.btn-wine:hover { background: var(--wine-2); border-color: var(--wine-2); color: #fff; }
.btn-outline { border-color: var(--line-strong); color: var(--wine); background: transparent; }
.btn-outline:hover { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.more { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 500 .9375rem/1.3 var(--sans); color: var(--ink-2); }
.more .i { transition: transform .25s var(--ease); }
.more:hover { color: var(--wine); }
.more:hover .i { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h); color: var(--cream); transition: background .35s, color .35s, box-shadow .35s, border-color .35s; border-bottom: 1px solid transparent; }
.site-header.is-solid { background: rgba(245, 239, 228, .86); color: var(--ink); border-bottom-color: var(--line); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 100%; }
.wordmark { display: inline-flex; align-items: center; gap: 14px; font: 400 1.5rem/1 var(--serif); letter-spacing: -.01em; }
.wordmark-text { display: flex; flex-direction: column; gap: 5px; }
.wordmark small { font: 500 .75rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.wordmark small[lang=ar] { font: 400 1rem/1.3 var(--arabic); text-transform: none; letter-spacing: 0; text-align: start; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; font: 500 .9375rem/1 var(--sans); position: relative; transition: background .25s; }
.site-nav a { white-space: nowrap; }
.site-nav .short { display: none; }
.site-nav a:hover { background: rgba(255, 255, 255, .12); }
.is-solid .site-nav a:hover { background: var(--paper-2); }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; color: var(--cream); background: var(--night); padding: calc(var(--header-h) + clamp(32px, 6vh, 72px)) 0 clamp(56px, 8vh, 96px); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: -1; background:
    radial-gradient(60% 70% at 78% 40%, rgba(201, 159, 88, .22), transparent 70%),
    radial-gradient(55% 60% at 12% 85%, rgba(122, 47, 59, .55), transparent 70%),
    radial-gradient(40% 50% at 50% 0%, rgba(122, 47, 59, .35), transparent 70%),
    linear-gradient(180deg, #24121a 0%, var(--night) 60%, #140a0d 100%); }
.hero-bg::before { content: ''; position: absolute; inset: 0; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23e2bf7a' stroke-width='1'%3E%3Cpath d='M28 8v12M28 36v12M8 28h12M36 28h12'/%3E%3Ccircle cx='28' cy='28' r='5'/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 56px; mask-image: radial-gradient(70% 80% at 50% 50%, #000 20%, transparent 100%); -webkit-mask-image: radial-gradient(70% 80% at 50% 50%, #000 20%, transparent 100%); }
.hero-bg::after { content: ''; position: absolute; inset: auto 0 0 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(226, 191, 122, .5), transparent); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: clamp(32px, 5vw, 80px); min-height: calc(100svh - var(--header-h) - 120px); }
.hero h1 { font-size: clamp(3.4rem, 2rem + 6.2vw, 7.25rem); font-weight: 300; line-height: .98; letter-spacing: -.025em; margin: 26px 0 24px; }
.hero h1 em { font-style: italic; font-weight: 300; color: var(--gold-2); }
.lede { font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); line-height: 1.6; max-width: 30em; color: rgba(246, 236, 218, .78); text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.hero-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 36px; font-size: .9375rem; color: rgba(246, 236, 218, .7); }
.hero-note [lang=ar] { font: 400 1.5rem/1.2 var(--arabic); color: var(--gold-2); }
.hero-note .sep { opacity: .5; }
.hero-feature { display: flex; flex-direction: column; align-items: center; justify-self: center; width: 100%; max-width: 520px; }
.hero-stage { position: relative; display: grid; place-items: center; width: 100%; padding: 36px 0 24px; perspective: 1400px; }
.arch { position: absolute; inset: 0 8% 0; border: 1px solid rgba(226, 191, 122, .35); border-radius: 999px 999px 0 0; background: radial-gradient(70% 60% at 50% 60%, rgba(226, 191, 122, .14), transparent 70%); }
.arch::before { content: ''; position: absolute; inset: 12px; border: 1px solid rgba(226, 191, 122, .14); border-radius: inherit; }
.arch::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: -2px; height: 46px; background: radial-gradient(50% 100% at 50% 100%, rgba(0, 0, 0, .7), transparent 70%); filter: blur(6px); }
.book3d { position: relative; display: block; transform-style: preserve-3d; transform: rotateY(var(--ry, -14deg)) rotateX(var(--rx, 3deg)); transition: transform .6s var(--ease); will-change: transform; }
.book3d::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .06) 4%, rgba(0, 0, 0, .12) 5%, transparent 9%, transparent 70%, rgba(255, 255, 255, .06) 100%); }
.book3d img { width: 100%; height: auto; box-shadow: var(--shadow-book); border-radius: 2px 6px 6px 2px; }
.hero-book { width: min(62%, 300px); z-index: 1; }
.hero-book:hover { --ry: -6deg; --rx: 1deg; transform: rotateY(var(--ry)) rotateX(var(--rx)) translateY(-8px); }
.feature-caption { text-align: center; margin-top: 18px; max-width: 440px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(226, 191, 122, .45); color: var(--gold-2); font: 600 .75rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.feature-caption h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem); line-height: 1.12; margin-top: 14px; }
.feature-caption h2 a { background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px; transition: background-size .35s var(--ease); }
.feature-caption h2 a:hover { background-size: 100% 1px; }
.feature-caption p { margin-top: 10px; font-size: .9375rem; color: rgba(246, 236, 218, .7); }

.js .hero-copy, .js .hero-feature { animation: rise 1s var(--ease) both; }
.js .hero-feature { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }

/* ---------- Ribbon ---------- */
.ribbon { background: var(--wine-deep); color: var(--cream); border-top: 1px solid rgba(226, 191, 122, .25); border-bottom: 1px solid rgba(226, 191, 122, .25); }
.ribbon-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 28px; padding: 12px 0; min-height: 58px; font: 500 .875rem/1.3 var(--sans); letter-spacing: .04em; }
.ribbon-inner > span { display: inline-flex; align-items: center; gap: 8px; }
.ribbon-inner > span + span::before { content: '✣'; color: var(--gold); margin-right: 20px; font-size: .9rem; }
.ribbon strong { font: 400 1.25rem/1 var(--serif); color: var(--gold-2); }
.ribbon [lang=ar] { font-size: 1.05rem; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 120px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 36px; }
.section-head h2 { margin-top: 16px; }
.section-lede { max-width: 34em; font-size: 1.125rem; color: var(--muted); text-wrap: pretty; }

/* ---------- Library toolbar ---------- */
.toolbar { position: sticky; top: var(--header-h); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 14px 0; border-block: 1px solid var(--line); background: rgba(245, 239, 228, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent; background: transparent; font: 500 .9375rem/1.2 var(--sans); color: var(--ink-2); transition: background .2s, color .2s, border-color .2s; }
.filters button [lang=ar] { font-size: 1.1rem; line-height: 1; }
.filters button .count { font: 500 .75rem/1 var(--sans); padding: 4px 7px; border-radius: 999px; background: var(--paper-2); color: var(--muted); }
.filters button:hover { background: var(--paper-2); color: var(--ink); }
.filters button[aria-pressed=true] { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.filters button[aria-pressed=true] .count { background: rgba(255, 255, 255, .16); color: var(--cream); }
.search { display: flex; align-items: center; gap: 10px; flex: 0 1 340px; min-width: 240px; padding-inline: 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fffdf8; color: var(--muted); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(94, 31, 42, .14); color: var(--ink); }
.search input { width: 100%; min-width: 0; min-height: 44px; border: 0; background: transparent; color: var(--ink); outline: none; appearance: none; -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.result-count { margin: 20px 0 28px; font-size: .9375rem; color: var(--muted); }

/* ---------- Book grid ---------- */
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 5vw, 64px) clamp(24px, 3vw, 40px); }
.book-card { display: flex; flex-direction: column; min-width: 0; }
.cover-stage { position: relative; display: grid; place-items: center; height: clamp(300px, 26vw, 380px); padding: 28px; border-radius: var(--radius); background: radial-gradient(110% 90% at 50% 10%, #fbf7ef 0%, var(--paper-2) 60%, var(--vellum) 100%); border: 1px solid var(--line); overflow: hidden; transition: background .35s, border-color .35s; }
.cover-stage::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 40% at 50% 100%, rgba(80, 50, 30, .22), transparent 70%); opacity: 0; transition: opacity .4s; }
.cover-stage::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: 20px; height: 22px; background: radial-gradient(50% 100% at 50% 100%, rgba(50, 30, 20, .35), transparent 70%); filter: blur(5px); transition: transform .4s var(--ease), opacity .4s; }
.book-obj { position: relative; display: block; height: 100%; max-width: 100%; }
.book-obj img { height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: 2px 5px 5px 2px; box-shadow: var(--shadow-book-paper); transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.book-obj::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 2px 5px 5px 2px; background: linear-gradient(100deg, rgba(255, 255, 255, .25) 0%, rgba(255, 255, 255, .06) 3%, rgba(0, 0, 0, .1) 4%, transparent 8%); transition: transform .45s var(--ease); }
.cover-stage .book-obj { height: 100%; perspective: 900px; }
.cover-stage:hover { border-color: var(--line-strong); }
.cover-stage:hover::before { opacity: 1; }
.cover-stage:hover::after { transform: translateY(6px) scaleX(1.05); opacity: .8; }
.cover-stage:hover .book-obj img, .cover-stage:hover .book-obj::after { transform: translateY(-10px) rotateY(-8deg) rotateX(2deg); }
.cover-stage:hover .book-obj img { box-shadow: 18px 28px 44px -12px rgba(50, 30, 20, .5), 3px 8px 14px rgba(50, 30, 20, .2); }
.book-info { display: flex; flex-direction: column; flex: 1; padding-top: 22px; }
.book-card h3 { font-size: clamp(1.5rem, 1.2rem + .9vw, 1.875rem); line-height: 1.15; margin: 14px 0 8px; overflow-wrap: anywhere; }
.book-card h3[lang=ar] { font-size: 1.875rem; line-height: 1.5; text-align: start; }
.book-card h3 a { background: linear-gradient(var(--wine), var(--wine)) no-repeat 0 100% / 0 1px; transition: background-size .35s var(--ease), color .2s; }
.book-card h3 a:hover { color: var(--wine); background-size: 100% 1px; }
.subtitle { font: italic 400 1.125rem/1.4 var(--serif); color: var(--muted); margin-bottom: 12px; text-wrap: pretty; }
.subtitle[lang=ar] { font: 400 1.25rem/1.6 var(--arabic); font-style: normal; text-align: start; }
.description { color: var(--muted); font-size: 1.0625rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { margin-top: auto; padding-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.card-actions .btn-outline { justify-content: space-between; min-height: 50px; }
.card-actions .more { justify-content: space-between; border-bottom: 1px solid var(--line); min-height: 46px; }
.empty-state { padding: 64px 16px; text-align: center; }
.empty-state h3 { font-size: 2rem; }
.empty-state p { margin: 12px 0 24px; color: var(--muted); }

/* ---------- Quote band ---------- */
.quote-band { padding-block: clamp(56px, 8vw, 96px); background: linear-gradient(180deg, var(--paper-2), var(--paper)); border-top: 1px solid var(--line); }
.quote-band figure { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 820px; margin-inline: auto; }
.quote-band .cross { width: 2.5rem; height: 2.5rem; margin-bottom: 28px; }
.quote-band blockquote p { font: italic 300 clamp(1.75rem, 1.2rem + 2.2vw, 3rem)/1.25 var(--serif); letter-spacing: -.01em; color: var(--wine); text-wrap: balance; }
.quote-band figcaption { margin-top: 22px; font: 500 .8125rem/1.5 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); }
.quote-band cite { font-style: normal; }

/* ---------- About ---------- */
.about { position: relative; isolation: isolate; color: var(--cream); background: var(--wine-deep); padding-block: clamp(64px, 9vw, 120px); overflow: hidden; }
.about::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(55% 70% at 22% 50%, rgba(226, 191, 122, .18), transparent 70%), radial-gradient(50% 60% at 90% 10%, rgba(122, 47, 59, .6), transparent 70%), linear-gradient(180deg, var(--wine-deep), #2b0d14); }
.about-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(40px, 7vw, 110px); align-items: center; }
.portrait { max-width: 420px; margin-inline: auto; width: 100%; }
.portrait-frame { position: relative; padding: 14px; border: 1px solid rgba(226, 191, 122, .5); border-radius: 999px 999px 12px 12px; }
.portrait-frame::before { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(226, 191, 122, .22); border-radius: inherit; pointer-events: none; }
.portrait-frame img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; object-position: center 28%; border-radius: 999px 999px 6px 6px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.about h2 { margin: 18px 0 8px; color: var(--cream); }
.arabic-name { font: 400 2rem/1.3 var(--arabic); color: var(--gold-2); text-align: left; margin-bottom: 22px; }
.about-copy > p:not(.eyebrow):not(.arabic-name) { margin-block: 16px; font-size: 1.125rem; line-height: 1.7; color: rgba(246, 236, 218, .82); max-width: 36em; text-wrap: pretty; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 28px 0 32px; max-width: 560px; }
.facts li { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid rgba(226, 191, 122, .3); border-radius: var(--radius); background: rgba(0, 0, 0, .18); }
.facts strong { font: 400 1.75rem/1.1 var(--serif); color: var(--gold-2); }
.facts span { font-size: .8125rem; line-height: 1.4; color: rgba(246, 236, 218, .72); }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: var(--cream); padding-block: 48px 36px; border-top: 1px solid rgba(226, 191, 122, .2); }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px 48px; align-items: center; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; font: 500 .9375rem/1.3 var(--sans); }
.footer-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: rgba(246, 236, 218, .8); }
.footer-nav a:hover { color: var(--gold-2); }
.footer-note { font-size: .9375rem; color: rgba(246, 236, 218, .6); max-width: 46em; }
.site-credit { grid-column: 1 / -1; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(246, 236, 218, .12); font-size: 12px; color: rgba(246, 236, 218, .5); }
.site-credit a { color: inherit; }
.site-credit a:hover { color: var(--gold-2); }

/* ---------- Book page ---------- */
.book-page { padding-top: var(--header-h); }
.detail-split { display: grid; grid-template-columns: minmax(320px, 42%) minmax(0, 1fr); }
.detail-stage { position: relative; isolation: isolate; color: var(--cream); background: var(--night); }
.detail-stage::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(70% 55% at 50% 42%, rgba(201, 159, 88, .22), transparent 70%), radial-gradient(60% 50% at 20% 100%, rgba(122, 47, 59, .55), transparent 70%), linear-gradient(180deg, #24121a, var(--night)); }
.detail-stage-inner { position: sticky; top: var(--header-h); display: flex; flex-direction: column; align-items: center; min-height: calc(100svh - var(--header-h)); padding: 28px clamp(24px, 4vw, 56px) 40px; perspective: 1400px; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 500 .9375rem/1 var(--sans); color: rgba(246, 236, 218, .75); margin-bottom: auto; }
.back-link .i { transform: rotate(180deg); transition: transform .25s var(--ease); }
.back-link:hover { color: var(--gold-2); }
.back-link:hover .i { transform: rotate(180deg) translateX(3px); }
.cover-zoom { width: min(100%, 340px); margin-block: 32px; padding: 0; border: 0; background: none; cursor: zoom-in; --ry: -10deg; --rx: 2deg; }
.cover-zoom:hover { --ry: -3deg; --rx: 0deg; transform: rotateY(var(--ry)) rotateX(var(--rx)) translateY(-6px); }
.zoom-hint { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; font-size: .875rem; color: rgba(246, 236, 218, .6); }
.detail-copy { display: flex; justify-content: center; padding: clamp(40px, 6vw, 88px) var(--gutter) clamp(56px, 7vw, 96px); }
.detail-copy-inner { width: min(100%, 640px); }
.detail-copy h1 { font-size: clamp(2.5rem, 1.6rem + 3.2vw, 4.5rem); line-height: 1.02; margin: 20px 0 14px; overflow-wrap: anywhere; }
.detail-copy h1[lang=ar] { font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem); line-height: 1.45; }
.detail-subtitle { font: italic 300 clamp(1.375rem, 1.1rem + 1vw, 1.875rem)/1.3 var(--serif); color: var(--muted); text-wrap: pretty; }
.detail-subtitle[lang=ar] { font: 400 1.625rem/1.6 var(--arabic); }
.credit { margin-block: 22px; font-size: 1.0625rem; color: var(--gold-text); font-weight: 500; }
.credit[lang=ar] { font-size: 1.25rem; }
.detail-description { font-size: 1.1875rem; line-height: 1.7; color: var(--ink-2); max-width: 56ch; text-wrap: pretty; }
.buy-links { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 32px; }
.metadata { display: grid; gap: 0; border-top: 1px solid var(--line); }
.metadata > div { display: grid; grid-template-columns: minmax(140px, .8fr) 1.2fr; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
.metadata dt { color: var(--muted); }
.metadata dd { overflow-wrap: anywhere; }
.seller-note { margin-top: 22px; max-width: 52ch; font-size: .9375rem; line-height: 1.6; color: var(--muted); }
.more-books { padding-block: clamp(56px, 7vw, 88px); border-top: 1px solid var(--line); background: var(--paper-2); }
.more-books .section-head { margin-bottom: 32px; }
.shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.shelf-item { display: flex; flex-direction: column; gap: 16px; padding: 22px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.shelf-item:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 24px 40px -24px rgba(50, 30, 20, .35); }
.shelf-item .book-obj { height: 190px; align-self: center; }
.shelf-text { display: flex; flex-direction: column; gap: 6px; }
.shelf-meta { font: 600 .6875rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); }
.shelf-title { font: 400 1.25rem/1.2 var(--serif); overflow-wrap: anywhere; }
.shelf-title[lang=ar] { font-size: 1.375rem; line-height: 1.5; text-align: start; }

/* ---------- 404 ---------- */
.not-found { padding: calc(var(--header-h) + 80px) 0 120px; text-align: center; }
.not-found h1 { font-size: clamp(2.5rem, 1.6rem + 4vw, 5rem); margin: 20px auto 16px; max-width: 14em; }
.not-found h1 em { color: var(--wine); }
.not-found p { color: var(--muted); font-size: 1.125rem; margin-bottom: 28px; }
.not-found .eyebrow { justify-content: center; }

/* ---------- Dialog ---------- */
#cover-dialog { max-width: min(96vw, 1000px); max-height: 94dvh; padding: 0; border: 0; border-radius: 6px; background: transparent; overflow: visible; }
#cover-dialog::backdrop { background: rgba(20, 8, 10, .82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#cover-dialog[open] { animation: dialog-in .35s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: scale(.94); } }
#cover-dialog img { width: auto; max-width: 100%; max-height: 86dvh; margin: auto; object-fit: contain; border-radius: 3px; box-shadow: 0 40px 100px rgba(0, 0, 0, .7); }
.dialog-close { position: absolute; top: -56px; right: 0; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(246, 236, 218, .35); border-radius: 50%; background: rgba(26, 13, 16, .7); color: var(--cream); transition: background .2s, border-color .2s; }
.dialog-close:hover { background: var(--wine); border-color: var(--wine); }
.dialog-close .i { width: 1.25rem; height: 1.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero-grid { gap: 36px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-stage { height: clamp(300px, 36vw, 380px); }
  .about-grid { gap: 48px; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-split { grid-template-columns: minmax(300px, 40%) minmax(0, 1fr); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --header-h: 68px; }
  .wordmark { font-size: 1.3rem; }
  .cross { width: 1.6rem; height: 1.6rem; }
  .hero-grid { grid-template-columns: 1fr; min-height: 0; gap: 44px; }
  .hero { padding-top: calc(var(--header-h) + 36px); }
  .hero-feature { max-width: 440px; }
  .hero-stage { padding-top: 28px; }
  .hero-book { width: min(58%, 250px); }
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .toolbar { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 340px; }
  .arabic-name { text-align: left; }
  .footer-grid { grid-template-columns: 1fr; }
  .detail-split { grid-template-columns: 1fr; }
  .detail-stage-inner { position: static; min-height: 0; padding: 20px var(--gutter) 36px; }
  .cover-zoom { width: min(68%, 280px); margin-block: 20px 24px; }
  .back-link { margin-bottom: 0; }
  .zoom-hint { margin-top: 0; }
  .detail-copy { padding-top: 40px; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-nav a { padding: 0 10px; font-size: .9375rem; }
  .site-nav .short { display: inline; }
  .site-nav .long { display: none; }
  .wordmark { font-size: 1.25rem; white-space: nowrap; }
  .wordmark small { display: none; }
  .hero h1 { font-size: clamp(3.1rem, 13vw, 4.2rem); margin: 20px 0 18px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .ribbon-inner { gap: 6px 18px; padding: 14px 0; text-align: center; }
  .ribbon-inner > span + span::before { content: none; }
  .ribbon-inner > span:last-child { flex-basis: 100%; justify-content: center; opacity: .8; }
  .filters { width: 100%; }
  .filters button { padding-inline: 14px; }
  .search { flex-basis: 100%; min-width: 0; }
  .book-grid { grid-template-columns: 1fr; gap: 28px; }
  .book-card { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 18px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
  .book-card:last-child { border-bottom: 0; }
  .book-info { display: contents; }
  .cover-stage { grid-column: 1; grid-row: 1 / span 3; height: auto; aspect-ratio: 3 / 4.2; padding: 14px; align-self: start; }
  .cover-stage::after { bottom: 10px; }
  .cover-stage .book-obj { height: 100%; width: 100%; display: grid; place-items: center; }
  .cover-stage .book-obj img { max-height: 100%; }
  .tags, .book-card h3, .subtitle { grid-column: 2; }
  .book-card .tags { grid-row: 1; }
  .book-card h3 { grid-row: 2; font-size: 1.5rem; margin: 10px 0 6px; align-self: start; }
  .book-card h3[lang=ar] { font-size: 1.625rem; }
  .subtitle { grid-row: 3; font-size: 1.0625rem; margin-bottom: 0; align-self: start; }
  .subtitle[lang=ar] { font-size: 1.125rem; }
  .description { grid-column: 1 / -1; margin-top: 18px; font-size: 1rem; display: block; -webkit-line-clamp: none; }
  .tag { min-height: 22px; font-size: .6875rem; padding: 1px 8px; }
  .card-actions { grid-column: 1 / -1; padding-top: 16px; gap: 6px; }
  .card-actions .btn-outline { min-height: 48px; }
  .card-actions .more { min-height: 44px; border-bottom: 0; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts li:last-child { grid-column: 1 / -1; }
  .buy-links { flex-direction: column; }
  .buy-links .btn { width: 100%; }
  .metadata > div { grid-template-columns: 1fr; gap: 2px; }
  .shelf { grid-template-columns: 1fr; gap: 14px; }
  .shelf-item { flex-direction: row; align-items: center; padding: 14px; }
  .shelf-item .book-obj { height: 110px; flex: none; }
  .dialog-close { top: auto; bottom: -60px; right: 50%; transform: translateX(50%); }
}
@media (max-width: 400px) {
  .book-card { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); column-gap: 14px; }
  .hero-book { width: min(60%, 220px); }
}
@media (hover: none) {
  .book3d, .cover-stage .book-obj img, .cover-stage .book-obj::after { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
  .book3d { transform: none; }
}
@media print {
  .site-header, .toolbar, .hero-bg, .ribbon, .quote-band, .card-actions, .more-books, #cover-dialog { display: none !important; }
  .hero, .about, .site-footer, .detail-stage { background: #fff !important; color: #000 !important; }
  .book-page { padding-top: 0; }
}
