/* The site's own styles. Every colour, radius and font is a Miha UI token (except --font-reading, below) from miha-ui-tokens.css
   (preset audio-knjige); ops/check_colors.py fails the build on a colour written out. See DESIGN.md. */
/* Pravljice's type (Miha, 3 Nov 2026): Sentient for titles (--font-heading, from the preset) and Literata for
   reading text (--font-reading, below). Both copied from the Pravljice repo with their licences: Sentient is under the
   ITF Free Font License (self-host only, never modify or subset), Literata under the OFL, split by Google Fonts' ranges. */
@font-face { font-family: "Sentient"; font-style: normal; font-weight: 200 700; font-display: swap;
  src: url("/fonts/sentient/Sentient-Variable.woff2") format("woff2"); }
@font-face { font-family: "Sentient"; font-style: italic; font-weight: 200 700; font-display: swap;
  src: url("/fonts/sentient/Sentient-VariableItalic.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-latin-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-latin-ext-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-cyrillic-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-latin-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-latin-ext-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata/Literata-cyrillic-italic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3/SourceSans3VF-Upright.ttf.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
/* Miha UI has no reading-font dial, so the book text's face is set here, once. */
:root { --font-reading: "Literata", "Iowan Old Style", Georgia, serif; }
html, body { margin: 0; background: var(--background); color: var(--foreground); }
body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-text); text-underline-offset: 0.15em; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 0.75rem; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 4vw, 1.75rem); margin: 2.5rem 0 1rem; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }
p { margin: 0 0 0.9rem; }
.small { font-size: 0.9rem; }
.muted { color: var(--muted-foreground); }
.caption { font-size: 0.85rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.lead { font-family: var(--font-reading); font-size: 1.25rem; line-height: 1.45; }
[hidden] { display: none !important; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
main { min-height: 60vh; }

/* ---------------------------------------------------------------- header and footer */
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.wordmark {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.3rem;
  color: var(--foreground); text-decoration: none; letter-spacing: -0.01em;
}
.wordmark img { border-radius: var(--radius-md); }
.site-footer {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem;
  margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid var(--border);
}
.site-footer h2 { font-family: var(--font-sans); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted-foreground); margin: 0 0 0.75rem; }
.site-footer nav a { display: block; color: var(--foreground); text-decoration: none; padding: 0.2rem 0; }
.site-footer nav a:hover { color: var(--brand-text); }
.footer-brand p { margin: 0.6rem 0 0; }
@media (max-width: 720px) {
  .site-footer { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: var(--control-md); padding: 0 1rem; border-radius: var(--radius-button);
  border: 1px solid transparent; background: var(--secondary); color: var(--secondary-foreground);
  font: inherit; font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
}
.btn-lg { min-height: var(--control-lg); padding: 0 1.25rem; font-size: 1rem; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--foreground); }
.btn-outline:hover { background: var(--hover); }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--control-touch); height: var(--control-touch);
  border: 0; border-radius: var(--radius-full); background: transparent; color: var(--foreground); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.pill {
  display: inline-block; padding: 0.35rem 0.9rem; border-radius: var(--radius-badge);
  background: var(--brand-soft); color: var(--brand-text); font-weight: 600; font-size: 0.95rem;
}

/* ---------------------------------------------------------------- home */
.intro { max-width: 40rem; padding: 2.5rem 0 1.5rem; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.book-card { display: block; color: var(--foreground); text-decoration: none; }
.book-card .cover { transition: box-shadow var(--duration-fast) var(--ease-move), transform var(--duration-fast) var(--ease-move); }
.book-card:hover .cover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.book-card .body { padding: 0.75rem 0.1rem 0; }
.book-card .title { font-family: var(--font-heading); font-weight: 500; font-size: 1.15rem; line-height: 1.2; }
.book-card .meta { font-size: 0.9rem; color: var(--muted-foreground); }

/* A typographic cover: the brand green, the author small, the title large, the tile at the foot. */
.cover {
  display: flex; flex-direction: column; justify-content: space-between; gap: 0.75rem;
  aspect-ratio: 2 / 3; padding: 1.25rem 1.1rem; border-radius: var(--radius-card);
  background: var(--brand-strong); color: var(--brand-foreground); box-shadow: var(--shadow-card);
  overflow: hidden;
}
.cover-author { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.cover-title { font-family: var(--font-heading); font-weight: 500; font-size: 1.55rem; line-height: 1.1; margin-bottom: auto; }
.cover img { border-radius: var(--radius-sm); align-self: flex-start; }

.features { margin-top: 3.5rem; }
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature-list h3 { margin-top: 0.6rem; }
.feature-list p { color: var(--muted-foreground); }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-full);
  background: var(--brand-soft); color: var(--brand-text); }
@media (max-width: 720px) { .feature-list { grid-template-columns: 1fr; } }

.faq { max-width: var(--content-width); }
.faq-item { border-bottom: 1px solid var(--border); padding: 0.9rem 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 0.6rem 0 0; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- book page */
.book-head { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; padding-top: 1rem; }
.book-head .cover-title { font-size: 1.9rem; }
.byline { margin: 0 0 0.35rem; font-weight: 600; }
.facts { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0.75rem; }
.credit { max-width: 34rem; }
@media (max-width: 720px) {
  .book-head { grid-template-columns: 1fr; gap: 1.25rem; }
  .book-head > .cover { width: 150px; }
  .book-head .cover-title { font-size: 1.2rem; }
  .actions .btn { flex: 1 1 auto; }
}
.chapters { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2rem; }
.chapters li { break-inside: avoid; }
.chapters a {
  display: flex; align-items: baseline; gap: 0.5rem; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--border-subtle);
  color: var(--foreground); text-decoration: none;
}
.chapters a:hover { color: var(--brand-text); }
.chapters a[aria-current="page"] { color: var(--brand-text); font-weight: 600; }
.chapters .n { min-width: 1.9rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.chapters .name { flex: 1; }
.chapters .dur { font-size: 0.85rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chapters .lock { color: var(--muted-foreground); }
@media (max-width: 720px) { .chapters { columns: 1; } }

.prose { max-width: var(--content-width); }
.school { margin-top: 1rem; }
.about-book { margin-top: 2.5rem; }
.facts-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 1rem; }
.facts-table th, .facts-table td { text-align: left; vertical-align: top; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.facts-table th { width: 38%; padding-right: 1rem; font-weight: 600; color: var(--muted-foreground); }
.facts-table td { font-variant-numeric: tabular-nums; }
.attribution { color: var(--muted-foreground); font-size: 0.95rem; }
.characters, .questions { padding-left: 1.2rem; }
.characters li, .questions li { margin-bottom: 0.45rem; }

/* ---------------------------------------------------------------- chapter page */
.chapter { max-width: var(--content-width); margin: 0 auto; }
.crumbs a { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 600; text-decoration: none; }
.player {
  margin: 1rem 0 2rem; padding: 1.25rem 1.25rem 1rem; border-radius: var(--radius-card);
  background: var(--card); color: var(--card-foreground); box-shadow: var(--shadow-card);
}
.player .sub { color: var(--muted-foreground); font-size: 0.95rem; }
.player h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 0.15rem 0 0.75rem; }
.seek input { width: 100%; accent-color: var(--brand); height: 28px; margin: 0; }
.times { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted-foreground);
  font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin: 0.5rem 0 1rem; }
.play {
  display: inline-grid; place-items: center; width: 68px; height: 68px; border: 0; border-radius: var(--radius-full);
  background: var(--primary); color: var(--primary-foreground); cursor: pointer; box-shadow: var(--shadow-float);
}
.play:hover { background: var(--primary-hover); }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: inline-flex; }
.options { display: grid; gap: 0.6rem; border-top: 1px solid var(--border-subtle); padding-top: 0.9rem; }
.option { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.option .label { display: inline-flex; align-items: center; gap: 0.3rem; min-width: 5.5rem; font-size: 0.9rem;
  font-weight: 600; color: var(--muted-foreground); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
.seg button {
  min-height: var(--control-sm); padding: 0 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-badge);
  background: transparent; color: var(--foreground); font: inherit; font-size: 0.85rem; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.seg button[aria-checked="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); font-weight: 600; }
.note { display: flex; gap: 0.4rem; align-items: flex-start; margin: 0.9rem 0 0; padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand-text); font-size: 0.95rem; }

.text { font-family: var(--font-reading); font-size: var(--type-reading-size, 1.2rem); line-height: 1.65; }
.text h2 { margin-top: 0; }
.text p { margin: 0 0 1.1rem; hyphens: auto; }
.text .attribution { font-family: var(--font-sans); font-size: 0.9rem; }
.report { display: flex; align-items: center; gap: 0.35rem; margin-top: 2rem; font-family: var(--font-sans);
  font-size: 0.9rem; color: var(--muted-foreground); }
.chapter-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 2rem 0 1rem; }
.all-chapters summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
.all-chapters .chapters { columns: 1; }

.mini {
  position: fixed; left: 0.75rem; right: 0.75rem; bottom: max(0.75rem, env(safe-area-inset-bottom));
  max-width: 34rem; margin: 0 auto; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.9rem 0.5rem 0.5rem; border-radius: var(--radius-full); background: var(--popover);
  color: var(--popover-foreground); box-shadow: var(--shadow-menu); cursor: pointer; overflow: hidden; z-index: 10;
}
.mini .play { width: 44px; height: 44px; box-shadow: none; flex: none; }
.mini-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mini-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--track); }
.mini-bar div { height: 100%; width: 0; background: var(--brand); }

.plain { padding-top: 1.5rem; }

/* ---------------------------------------------------------------- owner opt-out note (?ne-stej, build.py OWN_DEVICE) */
.own-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: 90vw; padding: 0.75rem 1.1rem; border-radius: var(--radius-md);
  background: var(--foreground); color: var(--background); text-align: center; font-size: 1rem;
}
