:root {
  --paper: #f7f5ef;
  --white: #ffffff;
  --ink: #18191b;
  --muted: #62666a;
  --line: #d9d8d2;
  --cyan: #42afc5;
  --coral: #ff5962;
  --yellow: #f3c95d;
  --fic-red: #b72f35;
  --reader-size: 1.18rem;
  --max: 1180px;
  --shadow: 0 18px 50px rgba(20, 24, 28, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.6; }
a { color: inherit; }
button, input, select { font: inherit; }
button, .button { min-height: 44px; }
img { display: block; max-width: 100%; }
.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: absolute; left: -9999px; top: 0; z-index: 100; padding: .75rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: .72rem max(1.25rem, calc((100vw - var(--max))/2)); background: rgba(255,255,255,.97); border-top: 8px solid var(--cyan); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.site-header::after { content: ""; position: absolute; top: -8px; right: 0; width: 55%; height: 8px; background: linear-gradient(90deg, var(--coral) 0 56%, var(--yellow) 56%); }
.brand { display: flex; align-items: center; gap: .85rem; min-width: 325px; text-decoration: none; }
.brand-symbol { position: relative; width: 58px; height: 55px; flex: 0 0 auto; overflow: hidden; background: var(--cyan); }
.brand-symbol::before { content: ""; position: absolute; inset: 0 63% 0 0; background: var(--coral); }
.brand-symbol::after { content: ""; position: absolute; width: 24px; height: 24px; right: -7px; top: -7px; border-radius: 50%; background: var(--yellow); }
.brand-symbol img { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 17%; filter: drop-shadow(2px 2px 0 rgba(23,23,23,.2)); }
.brand-copy strong { display: block; font-size: 1.22rem; font-weight: 900; line-height: 1.05; letter-spacing: -.035em; }
.brand-copy strong span { color: var(--cyan); }
.brand-copy small { display: block; margin-top: .17rem; color: var(--muted); font-size: .7rem; line-height: 1.25; }
.site-header nav { display: flex; align-items: center; gap: 1.35rem; }
.site-header nav a { text-decoration: none; font-size: .92rem; font-weight: 650; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 7px; text-decoration-color: var(--coral); }
.menu-button { display: none; border: 1px solid var(--line); background: var(--white); padding: .45rem .8rem; font-weight: 750; }

main { min-height: 72vh; }
.shell { width: min(var(--max), calc(100% - 2.5rem)); margin-inline: auto; }
.eyebrow { display: flex; align-items: center; gap: .7rem; margin: 0 0 1rem; text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 850; }
.eyebrow::before { content: ""; width: 46px; height: 7px; background: var(--coral); }
h1, h2, h3 { line-height: 1.07; margin: 0 0 1rem; }
h1 { font-size: clamp(3.2rem, 8vw, 7.2rem); letter-spacing: -.065em; }
h2 { font-size: clamp(1.9rem, 4vw, 3.25rem); letter-spacing: -.045em; }
h3 { font-size: 1.32rem; }
p { margin-top: 0; }
.lead { max-width: 62ch; color: #404347; font-size: clamp(1.08rem, 2vw, 1.34rem); }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1.1rem; border: 2px solid var(--ink); background: var(--ink); color: white; text-decoration: none; font-weight: 800; cursor: pointer; }
.button.secondary { background: transparent; color: var(--ink); }
.button.coral { border-color: var(--coral); background: var(--coral); color: var(--ink); }
.button:hover { transform: translateY(-1px); box-shadow: 4px 4px 0 var(--ink); }
.text-link { display: inline-flex; gap: .5rem; align-items: center; font-weight: 800; text-underline-offset: 5px; text-decoration-color: var(--coral); }

.hero { min-height: 620px; display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(360px, .94fr); gap: 4rem; align-items: center; padding-block: 4.5rem 5rem; overflow: hidden; }
.hero h1 span { color: var(--cyan); }
.hero-copy { position: relative; z-index: 2; }
.hero-art { position: relative; min-height: 520px; isolation: isolate; }
.shape { position: absolute; display: block; }
.shape-cyan { inset: 9% 2% 5% 14%; background: var(--cyan); transform: rotate(1.8deg); z-index: -3; }
.shape-yellow { width: 58%; aspect-ratio: 1; right: -7%; top: -2%; border-radius: 50%; background: var(--yellow); z-index: -2; }
.shape-coral { width: 32%; height: 50%; right: -1%; bottom: 0; background: var(--coral); transform: rotate(-3deg); z-index: -1; }
.hero-portrait { position: absolute; inset: -3% 2% 0 6%; width: 94%; height: 103%; object-fit: contain; object-position: center bottom; filter: drop-shadow(17px 20px 0 rgba(23,23,23,.14)); z-index: 2; }
.hero-note { position: absolute; left: 7%; bottom: 6%; z-index: 3; padding: .55rem .72rem; background: var(--ink); color: white; font-size: .76rem; font-weight: 850; letter-spacing: .11em; writing-mode: vertical-rl; transform: rotate(180deg); }

.section { padding-block: 4.8rem; }
.section.white { background: var(--white); border-block: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; gap: 3rem; align-items: end; margin-bottom: 2rem; }
.section-head > p { max-width: 56ch; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature { min-height: 190px; padding: 1.5rem; background: var(--paper); border-top: 8px solid var(--cyan); }
.feature:nth-child(2) { border-color: var(--coral); }
.feature:nth-child(3) { border-color: var(--yellow); }
.feature .number { display: block; margin-bottom: 1.2rem; color: var(--muted); font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
.split-intro { display: grid; grid-template-columns: 1.08fr .92fr; gap: 1rem; }
.split-intro article { padding: 2.3rem; background: var(--white); border: 1px solid var(--line); }
.split-intro .bio-card { color: white; background: var(--ink); border-color: var(--ink); }
.bio-card .eyebrow::before { background: var(--yellow); }
.bio-card .text-link { text-decoration-color: var(--cyan); }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: 1.4rem; color: var(--muted); font-size: .88rem; }
.breadcrumbs a { text-underline-offset: 3px; }
.page-head { padding-block: 4rem 3rem; }
.page-head.compact { padding-bottom: 1.8rem; }
.page-head h1 { font-size: clamp(3rem, 7vw, 5.8rem); }

.filters { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin: 0 0 1.25rem; padding: 1.15rem 0; border-block: 1px solid var(--line); }
.filters h2 { margin: 0 0 .75rem; font-size: .78rem; letter-spacing: .11em; text-transform: uppercase; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: .55rem; }
.filter-buttons button, .filter-chip { border: 1px solid var(--ink); background: var(--white); padding: .5rem .8rem; cursor: pointer; font-weight: 750; }
.filter-buttons button.active { background: var(--ink); color: white; }
.active-filters { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; color: var(--muted); font-size: .86rem; }
.filter-chip { min-height: 36px; border-color: var(--coral); color: var(--ink); }
.collection-summary { margin: 1.25rem 0 .7rem; color: var(--muted); font-size: .9rem; }
.work-list { margin-bottom: 5rem; border-top: 1px solid var(--line); }
.work-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 220px 30px; gap: 1rem; align-items: center; min-height: 76px; padding: 1rem .6rem; border-bottom: 1px solid var(--line); text-decoration: none; }
a.work-row:hover { background: var(--white); box-shadow: inset 8px 0 0 var(--coral); }
.work-row.unavailable { color: var(--muted); background: rgba(255,255,255,.32); }
.year { font-variant-numeric: tabular-nums; font-weight: 900; }
.work-title { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; }
.language-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.language-badge, .unavailable-label { display: inline-flex; width: max-content; padding: .28rem .55rem; background: #e4f5f8; color: #1b6371; font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.unavailable-label { background: #e8e6df; color: #696b6d; }
.row-arrow { text-align: right; font-size: 1.35rem; }
.empty-state { padding: 3rem; margin-bottom: 5rem; text-align: center; background: var(--white); border: 1px solid var(--line); }
.empty-state h2 { font-size: 1.8rem; }

.work-hero { max-width: 920px; padding-block: 3.6rem 2.7rem; }
.work-hero h1, .version-head h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.3rem, 8vw, 6.7rem); letter-spacing: -.055em; }
.work-layout { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(0, 1.15fr); gap: 1rem; align-items: start; padding-bottom: 5rem; }
.panel { padding: 1.65rem; background: var(--white); border: 1px solid var(--line); }
.panel h2 { font-size: clamp(1.55rem, 3vw, 2.25rem); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.35rem; margin: 0; }
.facts.one-column { grid-template-columns: 1fr; }
.facts dt { color: var(--muted); font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.facts dd { margin: .12rem 0 0; }
.versions-panel > p:not(.eyebrow), .contents-panel > p { color: var(--muted); }
.version-card { display: grid; grid-template-columns: 54px 1fr auto; gap: 1rem; align-items: center; padding: 1.15rem 0; border-top: 1px solid var(--line); text-decoration: none; }
.version-card:hover strong { text-decoration: underline; text-decoration-color: var(--coral); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.version-card strong, .version-card small { display: block; }
.version-card small { color: var(--muted); }
.version-card > span:last-child { font-size: 1.35rem; }
.lang-code { display: grid; place-items: center; width: 50px; height: 50px; background: var(--ink); color: white; font-weight: 900; }

.version-head { padding-block: 3.5rem 2rem; }
.version-layout { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr); gap: 1rem; align-items: start; padding-bottom: 5rem; }
.version-data { position: sticky; top: 100px; }
.toc { columns: 2; column-gap: 2.3rem; padding-left: 1.4rem; }
.toc li { break-inside: avoid; margin: 0 0 .6rem; padding-left: .2rem; }
.toc a { text-underline-offset: 4px; text-decoration-color: var(--cyan); }
.toc a:hover { text-decoration-color: var(--coral); text-decoration-thickness: 3px; }

.reader-page { background: #fbf9f3; }
.reader-page .site-header { display: none; }
.reader-toolbar { position: sticky; top: 0; z-index: 25; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 64px; padding: .55rem max(1rem, calc((100vw - 1120px)/2)); background: rgba(255,255,255,.97); border-top: 7px solid var(--cyan); border-bottom: 1px solid var(--line); }
.reader-toolbar::after { content: ""; position: absolute; top: -7px; right: 0; width: 58%; height: 7px; background: linear-gradient(90deg, var(--coral) 0 56%, var(--yellow) 56%); }
.reader-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { display: flex; gap: .35rem; }
.icon-button { min-width: 42px; height: 42px; padding: .35rem; border: 1px solid var(--line); background: var(--white); color: var(--ink); cursor: pointer; }
.text-tool { font-weight: 800; }
.reader-wrap { width: min(1120px, calc(100% - 2.5rem)); margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 710px); gap: 4rem; padding-block: 2.8rem 5rem; }
.reader-nav { align-self: start; position: sticky; top: 90px; max-height: calc(100vh - 115px); overflow: auto; padding-right: .75rem; }
.reader-nav h2 { margin-top: 1.2rem; font-size: 1.1rem; letter-spacing: 0; }
.reader-nav ol { margin: 0; padding-left: 0; list-style-position: inside; }
.reader-nav li { margin: .42rem 0; }
.reader-nav a { color: var(--muted); font-size: .88rem; text-underline-offset: 3px; }
.reader-nav a.active { color: var(--ink); font-weight: 850; text-decoration-color: var(--coral); text-decoration-thickness: 3px; }
.back-link { font-weight: 800; }
.reading { max-width: 710px; min-width: 0; }
.reading .breadcrumbs { padding-top: 0; }
.reading .kicker { margin: 2.2rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .13em; font-size: .75rem; font-weight: 800; }
.reading h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.7rem, 6vw, 4.6rem); letter-spacing: -.045em; }
.reading article { font-family: Georgia, "Times New Roman", serif; font-size: var(--reader-size); line-height: 1.88; }
.reading article p { margin: 0 0 1.35em; }
.reading article p:first-child::first-letter { float: left; margin: .11rem .5rem 0 0; color: var(--coral); font-size: 4.25rem; line-height: .78; }
.reader-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; margin-top: 3.3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.reader-pager a { text-underline-offset: 4px; }
.reader-pager a:last-child { text-align: right; }
body.night { --paper: #181b1d; --white: #24282b; --ink: #f4f0e5; --muted: #bbbcb7; --line: #42474a; background: var(--paper); color: var(--ink); }
body.night .reader-toolbar { background: rgba(36,40,43,.97); }

.about-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr); gap: 1rem; padding-bottom: 5rem; }
.about-main { padding: 2.2rem; background: var(--white); border-left: 9px solid var(--cyan); }
.about-main h2 { font-size: 2rem; }
.about-stat { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; align-content: center; padding: 2rem; background: var(--ink); color: white; }
.about-stat strong { color: var(--yellow); font-size: 3rem; line-height: 1; }
.about-stat span { align-self: center; }
.author-page { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); gap: 4rem; align-items: center; padding-block: 4rem 5rem; }
.author-page h1 { font-family: Georgia, "Times New Roman", serif; }
.author-image { position: relative; min-height: 570px; isolation: isolate; }
.author-image span { position: absolute; inset: 10% 1% 2% 13%; background: var(--cyan); transform: rotate(1.8deg); z-index: -2; }
.author-image::before { content: ""; position: absolute; z-index: -1; width: 55%; aspect-ratio: 1; right: -4%; top: 2%; border-radius: 50%; background: var(--yellow); }
.author-image::after { content: ""; position: absolute; z-index: -1; width: 31%; height: 44%; right: 0; bottom: 0; background: var(--coral); transform: rotate(-3deg); }
.author-image img { position: absolute; inset: 0 3% 0 3%; width: 94%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(14px 18px 0 rgba(23,23,23,.13)); }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 3rem; min-height: 150px; padding: 2rem max(1.25rem, calc((100vw - var(--max))/2)); background: var(--ink); color: white; }
.site-footer p { margin: 0; font-size: 1.02rem; }
.site-footer a { text-underline-offset: 4px; text-decoration-color: var(--coral); }
.byblos-logo { flex: 0 0 auto; }
.byblos-logo img { width: 128px; max-height: 92px; object-fit: contain; }

@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; }
  .menu-button { display: block; margin-left: auto; }
  .site-header nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: .65rem; padding-bottom: .5rem; }
  .site-header nav.open { display: flex; }
  .hero { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .work-layout, .version-layout, .about-layout { grid-template-columns: 1fr; }
  .version-data { position: static; }
  .reader-wrap { grid-template-columns: 230px minmax(0, 1fr); gap: 2rem; }
}

@media (max-width: 720px) {
  .brand { min-width: 0; }
  .brand-copy small { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding-block: 3rem; }
  .hero-art { min-height: 420px; }
  .feature-grid, .split-intro, .author-page { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; gap: .5rem; }
  .filters { align-items: start; flex-direction: column; gap: .85rem; }
  .active-filters { justify-content: start; }
  .work-row { grid-template-columns: 66px minmax(0, 1fr) 26px; }
  .work-row .language-list { grid-column: 2; }
  .work-row .row-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .facts { grid-template-columns: 1fr; }
  .toc { columns: 1; }
  .reader-wrap { grid-template-columns: 1fr; }
  .reader-nav { position: static; display: none; max-height: 55vh; padding: 1rem; background: var(--white); border: 1px solid var(--line); }
  .reader-nav.open { display: block; }
  .reader-title { display: none; }
  .author-page { gap: 2rem; }
  .author-image { min-height: 440px; }
  .site-footer { align-items: start; flex-direction: column; gap: 1.5rem; }
}

@media (max-width: 470px) {
  .shell, .reader-wrap { width: min(var(--max), calc(100% - 1.5rem)); }
  .site-header { padding-inline: .75rem; }
  .brand-symbol { width: 48px; height: 46px; }
  .hero-art { min-height: 340px; }
  .portrait-frame { inset: 2% 9% 0 15%; }
  .feature, .split-intro article, .panel, .about-main { padding: 1.2rem; }
  .filter-buttons { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filter-buttons button { width: 100%; }
  .work-row { padding-inline: .2rem; }
  .work-title { font-size: 1.12rem; }
  .language-badge, .unavailable-label { font-size: .66rem; }
  .reader-toolbar { padding-inline: .55rem; }
  .reader-pager { grid-template-columns: 1fr 1fr; }
  .reader-pager a:nth-child(2) { display: none; }
  .about-stat { grid-template-columns: 1fr; }
}
