/* Illustrated Tales: picture-book pages (hub, story landing, chapter book). Text is always real HTML; pictures stay clean.
   Desktop: text over the picture's calm area (per-chapter layout-*.css sets each page's box); phone: text below the picture.
   Fonts: Cormorant Garamond (text) and Cinzel (title words), Latin subsets, SIL OFL (static/fonts/OFL-tale-*.txt). */
@font-face { font-family: "Tale Serif"; src: url("/static/fonts/tale-serif.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Tale Serif"; src: url("/static/fonts/tale-serif-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Tale Display"; src: url("/static/fonts/tale-display.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }

.public-archive main:has(> .tales) { padding-top: 0; }
.public-archive .shell:has(> main > .tales) { width: 100%; }  /* the night band runs edge to edge */
/* Arabic text uses Naskh everywhere in the tales (no Latin display faces). */
html[lang="ar"] .tales, .tales [lang="ar"] { --tb-serif: var(--tb-arabic); --tb-display: var(--tb-arabic); }
.tales {
  --tb-night: #0c1d22; --tb-night-2: #122a30; --tb-deep: #071216;
  --tb-cream: #fbf4e6; --tb-soft: #d8cfbf; --tb-gold: #deba76; --tb-gold-2: #ecd39f;
  --tb-line: rgba(222, 186, 118, .3);
  --tb-teal: #35655f; --tb-teal-2: #427d75;   /* the site's brand teal: main buttons; gold stays for ornaments */
  --tb-serif: "Tale Serif", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --tb-display: "Tale Display", "Cinzel", "Trajan Pro", Georgia, serif;
  --tb-arabic: "Noto Naskh Arabic", "IBM Plex Sans Arabic", serif;
  --tb-halo: 0 0 2px rgba(0, 0, 0, .85), 0 1px 3px rgba(0, 0, 0, .9), 0 0 14px rgba(0, 0, 0, .78), 0 0 30px rgba(0, 0, 0, .55);
  background: radial-gradient(120% 60% at 50% 0%, #143038 0%, var(--tb-night) 55%) var(--tb-night);
  color: var(--tb-cream); padding-bottom: 3rem; font-size: 1.125rem;
}
.tales a { color: var(--tb-gold-2); }
.tales a:hover { color: #fff; }
.tales :focus-visible { outline: 3px solid var(--tb-gold); outline-offset: 3px; }
.tales [hidden] { display: none !important; }
.tb-wrap { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.15rem; }
.tb-wrap-head { padding-bottom: .6rem; }

.tb-crumbs { font-size: .95rem; color: var(--tb-soft); display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.2rem; }
.tb-crumbs a { color: var(--tb-soft); text-decoration: none; border-bottom: 1px solid var(--tb-line); }
.tb-crumbs a:hover { color: var(--tb-cream); }
.tb-preview { background: rgba(222, 186, 118, .14); border: 1px solid var(--tb-line); color: var(--tb-gold-2); padding: .55rem .9rem; border-radius: 4px; margin: 0 0 1rem; font-size: 1rem; }
.tb-kicker { font-family: var(--tb-display); text-transform: uppercase; letter-spacing: .12em; color: var(--tb-gold); font-size: .95rem; font-weight: 600; margin: 0 0 .5rem; }
html .public-archive .tales.tales h1 { font-family: var(--tb-serif); font-weight: 600; font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1.1; color: var(--tb-cream); margin: 0 0 .7rem; }
.tb-summary { font-family: var(--tb-serif); font-size: clamp(1.3rem, 1.9vw, 1.5rem); line-height: 1.5; color: var(--tb-soft); max-width: 50rem; margin: 0 0 1rem; }
.tb-note { font-size: 1.05rem; color: var(--tb-gold-2); border-inline-start: 3px solid var(--tb-gold); padding: .2rem .8rem; margin: .4rem 0 1rem; max-width: 50rem; }
.tb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; margin: .8rem 0 0; }
.tb-hint { color: var(--tb-soft); font-size: 1rem; }
.tales .tb-btn { display: inline-flex; align-items: center; gap: .5rem; background: var(--tb-teal); color: var(--tb-cream) !important; border: 1px solid rgba(251, 244, 230, .18); text-decoration: none; font-weight: 600; font-size: 1.1rem; padding: .7rem 1.3rem; border-radius: 999px; }
.tales .tb-btn:hover { background: var(--tb-teal-2); }
.tales .tb-btn-big { font-size: 1.25rem; padding: .85rem 1.7rem; }
.tb-link { font-size: 1.1rem; text-decoration: none; border-bottom: 1px solid var(--tb-line); }
.tb-small { font-size: .98rem; color: var(--tb-soft); }
.tb-ai { font-size: 1rem; color: var(--tb-soft); font-style: italic; border-top: 1px solid var(--tb-line); padding-top: .9rem; margin-top: 2rem; max-width: 50rem; }
html .public-archive .tales :is(.tb-sec, h2:not(.tb-heading)) { font-family: var(--tb-display); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tb-gold); font-size: 1.15rem; margin: 2.6rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--tb-line); }

/* ---------------------------------------------------------------- the book */
.tb-book { position: relative; padding: .4rem 0 1rem; scroll-margin-top: calc(var(--tb-top, 7.5rem) + .4rem); }
.tb-page { max-width: 1280px; margin: 0 auto 2.4rem; padding: 0 1rem; }
.tb-stage { position: relative; margin: 0 auto; aspect-ratio: 16 / 9; container-type: inline-size; background: var(--tb-deep); border-radius: 4px; overflow: hidden; box-shadow: 0 22px 60px rgba(0, 0, 0, .5); }
.tb-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tb-text { position: absolute; left: 0; bottom: 0; width: 100%; height: 34%; display: flex; flex-direction: column; justify-content: center; margin: 0; padding: 2.4cqw 3cqw; box-sizing: border-box; }
.tb-inner { position: relative; isolation: isolate; color: var(--tb-cream); text-shadow: var(--tb-halo);
  font-family: var(--tb-serif); font-weight: 600; font-size: calc(clamp(22px, 2.5cqw, 38px) * var(--tb-scale, 1)); line-height: 1.3; text-align: start; }
.tb-inner::before { content: ""; position: absolute; inset: -1.2em -1.8em; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(3, 9, 12, .62), rgba(3, 9, 12, .38) 62%, rgba(3, 9, 12, 0)); }
.tb-inner p { margin: 0; }
.tb-wide .tb-inner { text-align: center; max-width: 36em; margin-inline: auto; }
html .public-archive .tales .tb-page .tb-heading { font-family: var(--tb-display); font-weight: 700; color: var(--tb-gold); font-size: clamp(30px, 4.4cqw, 76px); letter-spacing: .05em; line-height: 1.02; margin: 0 0 .32em; text-transform: uppercase; }
.tb-heading::after { content: ""; display: block; width: min(60%, 8em); height: 2px; background: var(--tb-gold); opacity: .9; margin: .28em 0 0; font-size: 1rem; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.tb-wide .tb-heading::after { margin-inline: auto; }
.tb-title .tb-inner p, .tb-sky .tb-inner p, .tb-whisper .tb-inner p { font-style: italic; font-weight: 500; }
.tb-whisper .tb-inner { font-size: calc(clamp(22px, 2.4cqw, 36px) * var(--tb-scale, 1)); }
.tb-sky .tb-inner p::after { content: ""; display: block; width: 6em; max-width: 50%; height: 2px; background: var(--tb-gold); opacity: .85; margin: .55em 0 0; }
.tb-wide.tb-sky .tb-inner p::after { margin-inline: auto; }
/* 19 Nov 2026: the big first letter only opens a chapter (the first text page, or the page right after a title page), never every caption (owner: it read like "G ilgamesh"). */
.tb-pages > .tb-dropcap:first-child .tb-inner p::first-letter, .tb-title + .tb-dropcap .tb-inner p::first-letter { font-family: var(--tb-display); color: var(--tb-gold); font-weight: 700; float: inline-start; font-size: 3.05em; line-height: .86; margin: .06em .1em 0 0; }
html .public-archive .tales .tb-page.tb-tight .tb-heading { font-size: clamp(26px, 2.9cqw, 46px); margin-bottom: .18em; }
.tb-tight .tb-text { padding-top: 1.2cqw; padding-bottom: 1.2cqw; }
.tb-folio { text-align: center; color: var(--tb-gold); font-family: var(--tb-display); font-size: 1rem; margin: .7rem 0 0; }

/* Arabic text (no italics, no drop cap, Naskh). */
.tb-book[lang="ar"] .tb-inner { font-family: var(--tb-arabic); font-weight: 600; font-style: normal; font-size: calc(clamp(23px, 2.5cqw, 38px) * var(--tb-scale, 1)); line-height: 1.7; }
.tb-book[lang="ar"] .tb-inner p { font-style: normal; font-weight: 600; }
.tb-book[lang="ar"] .tb-dropcap .tb-inner p::first-letter { font: inherit; color: inherit; float: none; margin: 0; }
html .public-archive .tb-book[lang="ar"] .tb-page .tb-heading { font-family: var(--tb-arabic); letter-spacing: 0; font-size: clamp(30px, 3.9cqw, 64px); line-height: 1.35; }
html[lang="ar"] .public-archive .tales h1, .public-archive .tales h1[lang="ar"], html[lang="ar"] .tb-summary, html[lang="ar"] .tb-intro, .tb-summary[lang="ar"] { font-family: var(--tb-arabic); }
html[lang="ar"] .tb-kicker, html[lang="ar"] .public-archive .tales :is(.tb-sec, h2:not(.tb-heading)) { font-family: var(--tb-arabic); letter-spacing: 0; text-transform: none; }

/* Book mode (set by tales.js): one page at a time, sized to the screen height. */
.tb-book.is-book .tb-page { display: none; margin-bottom: 0; }
.tb-book.is-book .tb-page.is-current { display: block; animation: tb-turn .45s ease both; }
.tb-book.is-book .tb-stage { width: min(100%, calc((100svh - var(--tb-top, 7.5rem) - 6.4rem) * 16 / 9)); min-width: min(100%, 680px); }
.tb-book.is-book .tb-folio { display: none; }
@keyframes tb-turn { from { opacity: 0; } to { opacity: 1; } }
.tb-nav { display: flex; align-items: center; justify-content: center; gap: 1.1rem; max-width: 1280px; margin: 1rem auto 0; padding: 0 1rem; }
.tales .tb-turn { display: inline-grid; place-items: center; min-width: 3.5rem; height: 3.5rem; border-radius: 999px; border: 1px solid var(--tb-line);
  background: rgba(255, 255, 255, .06); color: var(--tb-cream); font-size: 2.1rem; line-height: 1; cursor: pointer; padding: 0 .2rem 0; }
.tales .tb-turn:hover:not(:disabled) { background: var(--tb-teal); color: var(--tb-cream); }
.tales .tb-turn:disabled { opacity: .3; cursor: default; }
.tales .tb-next-chapter { font-size: 1.1rem; font-weight: 600; text-decoration: none; padding: 0 1.2rem; display: inline-flex; gap: .4rem; align-items: center; background: var(--tb-teal); color: var(--tb-cream) !important; }
/* ‹ and › are mirrored by the browser in right-to-left text, so Arabic needs no flip. */
.tb-progress { flex: 1; max-width: 24rem; text-align: center; }
.tb-count { margin: 0 0 .45rem; font-family: var(--tb-serif); font-size: 1.2rem; font-weight: 600; color: var(--tb-soft); font-variant-numeric: lining-nums; }
.tb-book[lang="ar"] .tb-count { font-family: var(--tb-arabic); font-size: 1.05rem; }
.tb-bar { height: 4px; background: rgba(246, 238, 221, .14); border-radius: 2px; overflow: hidden; }
.tb-bar span { display: block; height: 100%; width: 0; background: var(--tb-gold); transition: width .3s ease; }

/* Too much text for a page's calm area at a readable size (tales.js): the text goes below the picture. */
.tb-page.tb-below .tb-stage { aspect-ratio: auto; overflow: visible; container-type: normal; background: none; box-shadow: none; }
.tb-page.tb-below .tb-stage img { position: static; height: auto; aspect-ratio: 16 / 9; border-radius: 4px; box-shadow: 0 22px 60px rgba(0, 0, 0, .5); }
.tb-page.tb-below .tb-text { position: static; width: auto !important; height: auto !important; display: block; padding: 1.3rem .2rem .4rem; max-width: 46rem; margin: 0 auto; }
.tb-page.tb-below .tb-inner { text-shadow: none; font-size: calc(1.5rem * var(--tb-scale, 1)); text-align: start; max-width: none; }
.tb-page.tb-below .tb-inner::before { display: none; }
.tb-book[lang="ar"] .tb-page.tb-below .tb-inner { font-size: calc(1.35rem * var(--tb-scale, 1)); line-height: 1.9; font-weight: 400; }
html .public-archive .tales .tb-page.tb-below .tb-heading { font-size: 2.3rem; }
.tb-page.tb-below .tb-heading::after, .tb-page.tb-below.tb-sky .tb-inner p::after { margin-inline: 0; }

/* ---------------------------------------------------------------- end of chapter, contents, sources */
.tb-end { margin-top: 1.6rem; padding: 1.6rem 0 0; border-top: 1px solid var(--tb-line); }
.tb-next-card { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 1.2rem; align-items: center; text-decoration: none; background: var(--tb-night-2); border: 1px solid var(--tb-line); border-radius: 6px; padding: .8rem; margin: .4rem 0 1.2rem; max-width: 46rem; }
.tb-next-card img { width: 100%; height: auto; border-radius: 4px; display: block; }
.tb-next-card.is-coming { grid-template-columns: 1fr; border-style: dashed; }
.tb-next-text { display: flex; flex-direction: column; gap: .3rem; }
.tb-next-text small { font-family: var(--tb-display); color: var(--tb-gold); letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; }
html[lang="ar"] .tb-next-text small, html[lang="ar"] .tb-chapter-text small { font-family: var(--tb-arabic); letter-spacing: 0; text-transform: none; }
.tb-next-text strong { font-family: var(--tb-serif); font-size: 1.7rem; color: var(--tb-cream); font-weight: 600; }
html[lang="ar"] .tb-next-text strong, html[lang="ar"] .tb-chapter-text strong { font-family: var(--tb-arabic); font-size: 1.4rem; }
.tb-next-text em, .tb-chapter-text em { font-style: normal; color: var(--tb-soft); }
.tb-thumbs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.tb-thumbs a { position: relative; display: block; border-radius: 4px; overflow: hidden; border: 2px solid transparent; }
.tb-thumbs a[aria-current] { border-color: var(--tb-gold); }
.tb-thumbs img { width: 100%; height: auto; display: block; }
.tb-thumbs span { position: absolute; bottom: .3rem; inset-inline-start: .3rem; background: rgba(0, 0, 0, .7); color: #fff; font-size: .9rem; padding: .05rem .45rem; border-radius: 3px; }
.tb-chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.tb-chips a { display: inline-block; padding: .45rem .95rem; border: 1px solid var(--tb-line); border-radius: 999px; text-decoration: none; font-size: 1.05rem; color: var(--tb-cream); background: rgba(255, 255, 255, .04); }
.tb-chips a:hover { background: var(--tb-teal); color: var(--tb-cream); }
.tb-sources-body { font-size: 1.06rem; line-height: 1.7; color: var(--tb-soft); max-width: 50rem; }
html .public-archive .tales .tb-sources-body h3 { font-family: var(--tb-serif); font-size: 1.35rem; color: var(--tb-cream); margin: 1.4rem 0 .5rem; }
.tb-editions { padding-inline-start: 1.2rem; }
.tb-editions li { margin: .35rem 0; }
.tb-anchors { margin-top: 1.4rem; border: 1px solid var(--tb-line); border-radius: 4px; padding: .7rem 1rem; }
.tb-anchors summary { cursor: pointer; color: var(--tb-cream); font-size: 1.12rem; }
.tb-anchors ol { padding-inline-start: 2.2rem; }
.tb-anchors li { margin: .45rem 0; }

/* ---------------------------------------------------------------- story landing and hub */
.tb-cover { position: relative; min-height: min(78vh, 56.25vw); display: grid; align-items: end; justify-items: center; overflow: hidden; background: var(--tb-deep); }
.tb-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tb-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 29, 34, 0) 35%, rgba(12, 29, 34, .55) 68%, var(--tb-night) 100%); }
.tb-cover-text { position: relative; z-index: 1; text-align: center; padding: 2rem 1.2rem 2.6rem; max-width: 60rem; text-shadow: var(--tb-halo); }
.tb-cover-text::before { content: ""; position: absolute; inset: 0 -4rem; z-index: -1; background: radial-gradient(closest-side, rgba(3, 9, 12, .55), rgba(3, 9, 12, .3) 60%, rgba(3, 9, 12, 0)); }
html .public-archive .tales.tales .tb-cover h1 { font-family: var(--tb-display); font-weight: 700; color: var(--tb-gold); font-size: clamp(2.4rem, 6vw, 5.2rem); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 .3rem; }
html[lang="ar"] .public-archive .tales .tb-cover h1 { font-family: var(--tb-arabic); text-transform: none; letter-spacing: 0; }
.tb-subtitle { font-family: var(--tb-serif); font-style: italic; font-weight: 500; font-size: clamp(1.45rem, 2.6vw, 2.2rem); color: var(--tb-cream); margin: 0 0 1.3rem; }
html[lang="ar"] .tb-subtitle { font-family: var(--tb-arabic); font-style: normal; }
.tales .tb-cover .tb-btn { text-shadow: none; }
.tb-cover .tb-kicker { color: var(--tb-cream); letter-spacing: .22em; font-size: 1.05rem; }
.tb-intro { font-family: var(--tb-serif); font-size: clamp(1.35rem, 2vw, 1.6rem); line-height: 1.6; max-width: 48rem; margin: .4rem 0 0; }
html[lang="ar"] .tb-intro { font-size: 1.3rem; line-height: 1.95; }
.tb-chapter-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.1rem; }
.tb-chapter-card { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--tb-night-2); border: 1px solid var(--tb-line); border-radius: 6px; overflow: hidden; color: var(--tb-cream); }
a.tb-chapter-card:hover { border-color: var(--tb-gold); }
.tb-chapter-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.tb-chapter-text { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem 1.2rem; flex: 1; }
.tb-chapter-text small { font-family: var(--tb-display); color: var(--tb-gold); letter-spacing: .08em; text-transform: uppercase; font-size: .88rem; }
.tb-chapter-text strong { font-family: var(--tb-serif); font-size: 1.65rem; line-height: 1.15; font-weight: 600; }
.tb-chapter-text > span { color: var(--tb-soft); font-size: 1.08rem; line-height: 1.55; }
.tb-read { margin-top: auto; padding-top: .4rem; color: var(--tb-gold-2) !important; font-weight: 600; }
.tb-coming-list { list-style: none; padding: 0; margin: 1.1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .6rem; }
.tb-coming-list li { display: flex; align-items: center; gap: .4rem; border: 1px dashed var(--tb-line); border-radius: 6px; padding: .2rem 1rem .2rem .2rem; color: var(--tb-soft); }
.tb-coming-list .tb-chapter-text { padding: .7rem .4rem; }
.tb-coming-list .tb-chapter-text strong { font-size: 1.35rem; color: var(--tb-cream); }
.tb-coming-list em { font-style: normal; font-size: .98rem; color: var(--tb-soft); white-space: nowrap; }
.tb-roman { font-family: var(--tb-display); font-size: 2.2rem; color: var(--tb-gold); opacity: .55; min-width: 4rem; text-align: center; }
.tb-story-list .tb-chapter-text strong { font-size: 2rem; }

/* ---------------------------------------------------------------- phones and small tablets: picture on top, text below */
@media (max-width: 760px) {
  .tales { font-size: 1.1rem; }
  .tb-page { padding: 0; margin-bottom: 2rem; }
  .tb-stage { aspect-ratio: auto; overflow: visible; container-type: normal; border-radius: 0; box-shadow: none; background: none; }
  .tb-stage img { position: static; height: auto; aspect-ratio: 16 / 9; }
  .tb-book.is-book .tb-stage { width: 100%; min-width: 0; }
  .tb-text { position: static; width: auto; height: auto; display: block; padding: 1.15rem 1.15rem .6rem; }
  .tb-inner { text-shadow: none; font-size: calc(1.45rem * var(--tb-scale, 1)); line-height: 1.5; font-weight: 600; }
  .tb-whisper .tb-inner { font-size: calc(1.45rem * var(--tb-scale, 1)); }
  .tb-inner::before { display: none; }
  .tb-wide .tb-inner { text-align: start; max-width: none; }
  html .public-archive .tales .tb-page .tb-heading { font-size: 2.1rem; }
  .tb-heading::after, .tb-wide .tb-heading::after, .tb-wide.tb-sky .tb-inner p::after { margin-inline: 0; }
  .tb-book[lang="ar"] .tb-inner { font-size: calc(1.32rem * var(--tb-scale, 1)); line-height: 1.95; font-weight: 400; }
  .tb-book[lang="ar"] .tb-inner p { font-weight: 400; }
  html .public-archive .tb-book[lang="ar"] .tb-page .tb-heading { font-size: 2rem; font-weight: 600; }
  .tb-book.is-book .tb-nav { position: sticky; bottom: 0; z-index: 5; margin: .6rem 0 0; padding: .55rem .8rem calc(.55rem + env(safe-area-inset-bottom)); background: rgba(10, 25, 30, .95); border-top: 1px solid var(--tb-line); gap: .7rem; }
  .tales .tb-turn { min-width: 3.3rem; height: 3.3rem; }
  .tales .tb-next-chapter { font-size: 1rem; padding: 0 .9rem; }
  .tb-next-card { grid-template-columns: 1fr; }
  .tb-chapter-list, .tb-coming-list { grid-template-columns: 1fr; }
  .tb-cover { min-height: 72vw; }
  .tb-cover-text { padding-bottom: 1.6rem; }
  .tb-thumbs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
/* ---------------------------------------------------------------- fullscreen reader (tales_reader.js) */
.tb-icon { width: 1.25em; height: 1.25em; flex: none; }
.tales button.tb-btn { border: 0; cursor: pointer; font-family: inherit; line-height: 1.2; }
.tales .tb-btn-ghost { background: rgba(8, 20, 24, .6); color: var(--tb-cream) !important; border: 1px solid var(--tb-gold) !important; }
.tales .tb-btn-ghost:hover { background: var(--tb-teal); color: var(--tb-cream) !important; }
.tb-cover-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin: 0; }
.tales .tb-full-icon { font-size: 1rem; }
.tales .tb-full-icon .tb-icon { width: 1.5rem; height: 1.5rem; }
.tb-count-line { color: var(--tb-gold-2); font-size: 1.02rem; }
html.tb-reader-open, html.tb-reader-open body { overflow: hidden; }
.tales.tb-reader { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 0;
  background: #05090b; color: var(--tb-cream); }
.tales.tb-reader[hidden] { display: none !important; }
.tb-reader::backdrop { background: #05090b; }
.tb-r-top { display: flex; align-items: center; gap: .8rem; padding: .45rem .8rem; background: rgba(5, 9, 11, .92); border-bottom: 1px solid var(--tb-line); min-height: 3.6rem; }
.tales .tb-r-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3rem; min-width: 3rem; padding: 0 .9rem;
  border-radius: 999px; border: 1px solid var(--tb-line); background: rgba(255, 255, 255, .06); color: var(--tb-cream); font-family: inherit; font-size: 1.05rem; cursor: pointer; }
.tales .tb-r-btn:hover, .tales .tb-r-btn[aria-expanded="true"] { background: var(--tb-teal); color: var(--tb-cream); }
.tales .tb-r-close { padding: 0; }
.tales .tb-r-close .tb-icon { width: 1.5rem; height: 1.5rem; }
.tb-r-title { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.25; text-align: center; }
.tb-r-kicker { font-family: var(--tb-display); color: var(--tb-gold); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
.tb-r-title strong { font-family: var(--tb-serif); font-size: 1.35rem; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ar"] .tb-r-kicker { letter-spacing: 0; text-transform: none; font-size: .95rem; }
.tb-r-main { position: relative; min-height: 0; }
.tales.tb-reader .tb-r-scroll { position: absolute; inset: 0; overflow: auto; display: grid; place-items: center; padding: 0; overscroll-behavior: contain; }
.tb-reader .tb-page { max-width: none; width: 100%; margin: 0; padding: 0; }
/* Desktop: margins beside the picture hold the big arrows, so they never cover the text. */
.tb-reader .tb-stage { width: min(calc(100vw - 11.5rem), calc((100vh - 7.4rem) * 16 / 9)); width: min(calc(100vw - 11.5rem), calc((100dvh - 7.4rem) * 16 / 9)); border-radius: 0; box-shadow: none; }
.tb-reader .tb-page.is-turning { animation: tb-turn .3s ease both; }
.tb-reader .tb-page.tb-below .tb-text { padding-inline: 1.2rem; }
.tales .tb-r-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; display: grid; place-items: center; width: 4.2rem; height: 4.2rem;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); background: rgba(5, 9, 11, .55); color: #fff; font-size: 2.8rem; line-height: 1; cursor: pointer; }
.tales .tb-r-prev { inset-inline-start: 1rem; }
.tales .tb-r-next { inset-inline-end: 1rem; }
.tales .tb-r-arrow:hover:not(:disabled) { background: var(--tb-teal); color: var(--tb-cream); }
.tales .tb-r-arrow:disabled, .tales .tb-r-arrow-small:disabled { opacity: 0; pointer-events: none; }
.tb-r-bottom { display: flex; align-items: center; gap: .8rem; padding: .45rem 1rem .6rem; padding-bottom: calc(.6rem + env(safe-area-inset-bottom)); background: rgba(5, 9, 11, .92); border-top: 1px solid var(--tb-line); }
.tb-r-progress { flex: 1; max-width: 42rem; margin: 0 auto; }
.tb-r-count { margin: 0 0 .35rem; text-align: center; color: var(--tb-soft); font-size: 1.02rem; }
.tb-reader .tb-bar { height: 3px; }
.tales .tb-r-arrow-small { display: none; place-items: center; width: 3.3rem; height: 3.3rem; border-radius: 999px; border: 1px solid var(--tb-line);
  background: rgba(255, 255, 255, .07); color: var(--tb-cream); font-size: 2.1rem; line-height: 1; cursor: pointer; flex: none; }
.tb-r-drawer { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; z-index: 5; width: min(460px, 92vw); overflow: auto; padding: 1rem 1rem 2rem;
  background: #0c1d22; border-inline-start: 1px solid var(--tb-line); box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
.tb-r-drawer-title { font-family: var(--tb-display); color: var(--tb-gold); letter-spacing: .1em; text-transform: uppercase; margin: .2rem 0 .4rem; }
html[lang="ar"] .tb-r-drawer-title { letter-spacing: 0; text-transform: none; }
html .public-archive .tales.tb-reader .tb-r-group h3 { font-family: var(--tb-serif); font-size: 1.25rem; font-weight: 600; color: var(--tb-cream); margin: 1.1rem 0 .55rem; line-height: 1.3; }
.tb-r-thumbs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.tales .tb-r-thumbs button { position: relative; display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: none; cursor: pointer; }
.tales .tb-r-thumbs button[aria-current] { border-color: var(--tb-gold); }
.tb-r-thumbs img { width: 100%; height: auto; display: block; }
.tb-r-thumbs span { position: absolute; bottom: .2rem; inset-inline-start: .2rem; background: rgba(0, 0, 0, .72); color: #fff; font-size: .8rem; padding: 0 .35rem; border-radius: 3px; }
.tb-reader.is-loading .tb-r-scroll::after { content: ""; width: 2.6rem; height: 2.6rem; border: 3px solid var(--tb-line); border-top-color: var(--tb-gold); border-radius: 50%; animation: tb-spin 1s linear infinite; }
@keyframes tb-spin { to { transform: rotate(360deg); } }
.tb-r-error { color: var(--tb-gold-2); font-size: 1.25rem; padding: 2rem; text-align: center; }
@media (max-width: 760px) {
  .tb-r-top { gap: .5rem; padding: .4rem .5rem; }
  .tales .tb-r-pick span { display: none; }
  .tales .tb-r-pick { padding: 0; }
  .tb-r-title strong { font-size: 1.12rem; }
  .tb-r-kicker { font-size: .78rem; }
  .tales.tb-reader .tb-r-scroll { display: flex; flex-direction: column; }
  .tb-reader .tb-page { margin-block: auto; }   /* centred when short, scrolls from the top when long */
  .tb-reader .tb-stage { width: 100%; }
  .tb-reader .tb-text { padding: 1.1rem 1.15rem 1.6rem; }
  .tales .tb-r-arrow { display: none; }
  .tales .tb-r-arrow-small { display: inline-grid; }
  .tb-r-bottom { padding-inline: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-reader .tb-page.is-turning { animation: none; }
}
/* Resume, share, toast */
.tb-resume { margin: .9rem 0 0; }
.tb-resume a { display: inline-flex; gap: .4rem; align-items: center; font-size: 1.12rem; padding: .55rem 1rem; border: 1px solid var(--tb-gold); border-radius: 999px; text-decoration: none; }
.tales .tb-resume-link { display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; margin-top: .8rem; padding: .5rem 1.2rem; border-radius: 12px;
  background: rgba(8, 20, 24, .66); color: var(--tb-cream); text-decoration: none; font-size: 1.12rem; text-shadow: none; border: 1px solid var(--tb-line); }
.tales .tb-resume-link small { color: var(--tb-gold-2); font-size: .95rem; }
.tales .tb-resume-link[hidden] { display: none; }
.tales .tb-share .tb-icon { width: 1.4rem; height: 1.4rem; }
.tb-toast { position: fixed; z-index: 1100; left: 50%; bottom: 5.5rem; transform: translateX(-50%); margin: 0; padding: .6rem 1.1rem; border-radius: 999px;
  background: var(--tb-teal); color: var(--tb-cream); font-weight: 600; font-size: 1.02rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.tb-offscreen { position: fixed; top: -1000px; left: 0; opacity: 0; }
.tales .tb-r-share { padding: 0; }
@media (max-width: 760px) {
  .tales .tb-book.is-book .tb-nav { gap: .45rem; }
  .tales .tb-nav .tb-turn { min-width: 3rem; height: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-book.is-book .tb-page.is-current { animation: none; }
  .tb-bar span { transition: none; }
}
@media print {
  .tb-nav, .tb-thumbs, .tb-crumbs { display: none !important; }
  .tb-book.is-book .tb-page { display: block !important; }
}

/* ---------------------------------------------------------------- chapter cards: time, read mark, film; text size */
.tb-chapter-item { display: flex; flex-direction: column; gap: .5rem; }
.tb-chapter-item > .tb-chapter-card { flex: 1; }
.tb-thumb-wrap { position: relative; display: block; }
.tb-meta { color: var(--tb-gold-2) !important; font-size: 1rem !important; font-variant-numeric: lining-nums; }
.tb-done { position: absolute; top: .6rem; inset-inline-end: .6rem; display: inline-flex; gap: .3rem; align-items: center; padding: .2rem .7rem;
  border-radius: 999px; background: rgba(5, 9, 11, .78); color: var(--tb-cream); font-size: .98rem; font-weight: 600; border: 1px solid var(--tb-gold); }
.tb-done span { color: var(--tb-gold); }
.tales .tb-film-link { display: inline-flex; align-items: center; gap: .45rem; align-self: flex-start; padding: .45rem 1rem; border-radius: 999px;
  background: var(--tb-teal); color: var(--tb-cream); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.tales .tb-film-link:hover { background: var(--tb-teal-2); color: var(--tb-cream); }
.tales .tb-film-link .tb-icon, .tales .tb-r-film .tb-icon { width: 1.15rem; height: 1.15rem; }
.tb-size { display: inline-flex; gap: .3rem; }
.tales .tb-size-btn, .tales .tb-r-size { font-family: var(--tb-serif); font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.tales .tb-size-btn:disabled, .tales .tb-r-size:disabled { opacity: .4; cursor: default; }
.tales .tb-r-film { text-decoration: none; }
.tales.tb-reader { grid-template-columns: minmax(0, 1fr); }   /* the top bar never widens the reader past the screen */
@media (max-width: 760px) {
  .tales .tb-r-film span, .tales .tb-r-pick span { display: none; }
  .tales .tb-r-film, .tales .tb-r-pick { padding: 0; }
  .tb-r-top { gap: .35rem; padding-inline: .45rem; }
  .tales .tb-r-top .tb-r-btn { min-width: 2.75rem; min-height: 2.75rem; padding: 0 .35rem; }
  .tales .tb-r-top .tb-r-size { font-size: 1.05rem; }
}

/* ---------------------------------------------------------------- the /tales index is light like /articles; covers stay dark windows */
.tales.tb-hub { background: var(--paper, #f4f2e9); color: var(--ink, #192d34); }
html .public-archive .tales.tales.tb-hub h1 { color: var(--ink, #192d34); }
.tales.tb-hub .tb-summary, .tales.tb-hub .tb-crumbs, .tales.tb-hub .tb-ai { color: var(--ink-soft, #65716e); }
.tales.tb-hub .tb-crumbs a { color: var(--clay, #35655f); }
.tales.tb-hub .tb-ai { border-top-color: var(--line, #d6d4c9); }
.tales.tb-hub .tb-preview { color: #5d4410; background: #f7eed9; border-color: #e3cf9c; }
.tales.tb-hub :focus-visible { outline-color: var(--clay, #35655f); }
.tales.tb-hub .tb-chapter-card { border-color: transparent; box-shadow: 0 12px 34px rgba(25, 45, 52, .2); }
.tales.tb-hub a.tb-chapter-card:hover { border-color: var(--clay, #35655f); }
/* /tales on phones: a compact two-column grid, so many stories show at once (cover, title, chapter count); the
   subtitle, the long introduction and the "read" line stay on the story page. */
@media (max-width: 40rem) {
  .tb-story-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: .7rem; }
  .tb-story-list .tb-chapter-text { padding: .55rem .6rem .7rem; gap: .2rem; }
  .tb-story-list .tb-chapter-text strong { font-size: 1.1rem; line-height: 1.25; }
  html[lang="ar"] .tb-story-list .tb-chapter-text strong { font-size: 1.05rem; }
  .tb-story-list .tb-chapter-text small, .tb-story-list .tb-chapter-text > span:not(.tb-count-line), .tb-story-list .tb-read { display: none; }
  .tb-story-list .tb-count-line { font-size: .82rem; }
}

/* 19 Nov 2026: tales hub count + pager */
.tb-count { font-weight: 600; letter-spacing: .02em; color: var(--ink-soft, #65716e); margin: -.2rem 0 1.6rem; font-size: 1.05rem; }
.tb-pager { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; align-items: center; margin: 2.2rem 0 .5rem; }
.tb-pager a, .tb-pager span { min-width: 2.75rem; padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--line, #d6ddd9); text-align: center; font-weight: 600; text-decoration: none; color: inherit; line-height: 1.2; }
.tb-pager a:hover, .tb-pager a:focus-visible { border-color: var(--tb-gold, #b8893a); }
.tb-pager [aria-current="page"] { background: var(--tb-gold, #b8893a); border-color: transparent; color: #fff; }
/* 19 Nov 2026: tales hub culture tabs */
.tb-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
.tb-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.05rem; border-radius: 999px; border: 1px solid var(--line, #d6ddd9); font-weight: 600; text-decoration: none; color: inherit; line-height: 1.2; }
.tb-tabs a:hover, .tb-tabs a:focus-visible { border-color: var(--tb-gold, #b8893a); }
.tb-tabs a[aria-current="page"] { background: var(--tb-gold, #b8893a); border-color: transparent; color: #fff; }
.tb-tab-n { font-size: .82em; font-weight: 500; opacity: .75; }
@media (max-width: 760px) { .tb-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: thin; } .tb-tabs a { flex: 0 0 auto; } }

/* 19 Nov 2026 ~21:45 UTC: light hub hover fix (owner: tab text vanished on hover). `.tales a:hover { color: #fff }` above is meant for the dark story/chapter pages. */
.tales.tb-hub .tb-tabs a:hover, .tales.tb-hub .tb-tabs a:focus-visible,
.tales.tb-hub .tb-pager a:hover, .tales.tb-hub .tb-pager a:focus-visible { color: var(--clay, #35655f); background: rgba(184, 137, 58, .12); }
.tales.tb-hub .tb-tabs a[aria-current="page"]:hover, .tales.tb-hub .tb-pager a[aria-current="page"]:hover { color: #fff; background: #cfa65e; }
.tales.tb-hub .tb-crumbs a:hover { color: var(--ink, #192d34); }
