/* Slovenske pravljice: website and app shell. Values come from tokens.css (Miha UI preset). */

@font-face { font-family: Fraunces; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/fraunces-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Fraunces; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/fraunces-latin.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: Fraunces; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/fraunces-italic-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/fraunces-italic-latin.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; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); }
a:hover { color: var(--brand-hover); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.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; }
.muted { color: var(--muted-foreground); }
.caption { font-size: 12px; line-height: 18px; color: var(--muted-foreground); }
.small { font-size: 14px; line-height: 20px; }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }

/* Wordmark */
.wordmark { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); text-decoration: none; white-space: nowrap; }
.wordmark:hover { color: var(--foreground); }
.wordmark span { color: var(--brand); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--control-touch); padding: 0 18px; border-radius: var(--radius-button);
  border: 1px solid transparent; background: transparent; color: var(--foreground);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.btn:hover { color: var(--foreground); background: var(--hover); }
.btn-lg { height: var(--control-xl); padding: 0 24px; font-size: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-foreground); }
.btn-brand { background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); }
.btn-brand:hover { background: var(--brand-hover); color: var(--brand-foreground); }
.btn-outline { border-color: var(--border-strong); }
.btn[aria-pressed="true"], .btn[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn svg { flex-shrink: 0; }

.icon-btn {
  width: var(--control-touch); height: var(--control-touch); border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 0; background: transparent; color: var(--foreground); text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--foreground); }
.icon-btn.float { background: var(--surface-elevated); box-shadow: var(--shadow-menu); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-badge); background: var(--secondary); color: var(--foreground);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: 0; white-space: nowrap;
}

/* Website header and footer */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 20px 0; }
.site-header .wordmark { font-size: 22px; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 32px 0 48px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted-foreground); }
.site-footer .wordmark { font-size: 18px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 24px; }
@media (max-width: 560px) { .site-header .nav-secondary { display: none; } }

/* Landing */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; padding: clamp(24px, 6vw, 72px) 0 clamp(32px, 4vw, 48px); }
.hero h1 { max-width: 820px; font-size: clamp(40px, 6vw, 76px); line-height: 1.02; letter-spacing: -0.02em; }
.hero h1 em { color: var(--brand-text); }
.hero p { max-width: 560px; font-size: clamp(17px, 1.6vw, 18px); line-height: 1.6; color: var(--muted-foreground); }
.hero .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }
.hero-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: clamp(16px, 2vw, 24px); background: var(--surface-tertiary); }
.section { padding: clamp(64px, 8vw, 112px) 0 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.section-head h2, .cta h2 { font-size: clamp(30px, 3.4vw, 36px); line-height: 1.15; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: clamp(20px, 3vw, 36px); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(28px, 4vw, 56px); padding: clamp(64px, 8vw, 112px) 0; border-bottom: 1px solid var(--border); }
.features h3 { font-size: 24px; line-height: 28px; margin-bottom: 8px; }
.features p { line-height: 1.6; color: var(--muted-foreground); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(32px, 5vw, 72px); padding: clamp(64px, 8vw, 112px) 0; }
.cta img { flex: 1 1 320px; min-width: 0; max-width: 520px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-dialog); background: var(--surface-tertiary); }
.cta > div { flex: 1 1 320px; display: flex; flex-direction: column; gap: 18px; }
.cta .lead { font-size: 18px; line-height: 1.6; color: var(--muted-foreground); }
.cta .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }

/* Story card (cover + title) */
.card { display: flex; flex-direction: column; gap: 12px; color: var(--foreground); text-decoration: none; min-width: 0; }
.card:hover { color: var(--foreground); }
.card .cover { position: relative; }
.card .cover img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-card); background: var(--surface-tertiary); transition: transform var(--duration-enter) var(--ease-enter); }
.card:hover .cover img { transform: scale(1.01); }
.card .lock { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface-elevated); color: var(--foreground); box-shadow: var(--shadow-menu); display: flex; align-items: center; justify-content: center; }
.card .cover .badge { position: absolute; top: 10px; left: 10px; background: var(--surface-elevated); box-shadow: var(--shadow-menu); }
.card .title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .title { font-family: var(--font-heading); font-weight: 500; font-size: 22px; line-height: 28px; }
.card .meta { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.card.soon .cover img { filter: saturate(0.85); opacity: 0.85; }

/* App: library */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 24px calc(110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; }
.app-top { display: flex; flex-direction: column; gap: 6px; }
.app-top .wordmark { font-size: 17px; }
.app-top h1 { font-size: 32px; line-height: 38px; }
.continue { display: flex; flex-direction: column; gap: 12px; color: var(--foreground); text-decoration: none; max-width: 560px; }
.continue:hover { color: var(--foreground); }
.continue img { width: 100%; aspect-ratio: 342 / 250; object-fit: cover; object-position: center 60%; border-radius: var(--radius-card); background: var(--surface-tertiary); }
.continue .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.continue .name { font-family: var(--font-heading); font-weight: 500; font-size: 20px; line-height: 26px; }
.play-disc { width: 52px; height: 52px; border-radius: var(--radius-full); background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.progress { height: 4px; background: var(--track); border-radius: var(--radius-full); overflow: hidden; }
.progress > div { height: 4px; background: var(--primary); width: 0; }
.shelf h2 { font-size: 18px; line-height: 26px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.shelf-row { display: flex; gap: 14px; overflow-x: auto; margin: 0 -24px; padding: 0 24px 4px; scroll-snap-type: x mandatory; scroll-padding: 0 24px; scrollbar-width: none; }
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row .card { width: 140px; flex-shrink: 0; gap: 8px; scroll-snap-align: start; }
.shelf-row .card .title { font-size: 16px; line-height: 22px; }
.shelf-row .card .meta { font-size: 12px; line-height: 18px; }
.empty { display: flex; flex-direction: column; gap: 6px; padding: 32px 0; max-width: 420px; }
.empty h2 { font-size: 20px; line-height: 26px; }
@media (min-width: 768px) {
  .shelf-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px; margin: 0; padding: 0; overflow: visible; }
  .shelf-row .card { width: auto; }
  .shelf-row .card .title { font-size: 20px; line-height: 26px; }
  .shelf-row .card .meta { font-size: 14px; line-height: 20px; }
  .app-top h1 { font-size: 40px; line-height: 46px; }
}

/* Tab bar (phone) and top nav (wide) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(70px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface-secondary); border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 72px; min-height: var(--control-touch); color: var(--muted-foreground); font-size: 11px; font-weight: 500; text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--foreground); font-weight: 600; }
.tabbar .wordmark-slot { display: none; font-size: 20px; }
@media (min-width: 900px) {
  .tabbar { position: sticky; top: 0; bottom: auto; order: -1; height: 64px; padding: 0 max(24px, calc((100vw - 1200px) / 2 + 24px)); justify-content: flex-start; gap: 4px; background: var(--background); border-top: 0; border-bottom: 1px solid var(--border); }
  .tabbar .wordmark-slot { display: block; margin-right: auto; }
  .tabbar a { flex-direction: row; gap: 8px; font-size: 14px; min-width: 0; padding: 0 14px; border-radius: var(--radius-button); }
  .tabbar a:hover { background: var(--hover); color: var(--foreground); }
  .app-main { padding-bottom: 64px; }
  .app-top .wordmark { display: none; }
}

/* Player */
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: calc(14px + env(safe-area-inset-top)) 14px calc(30px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.stage { position: relative; flex-shrink: 0; }
.stage .frame { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 58vh; max-height: 58dvh; border-radius: var(--radius-dialog); overflow: hidden; background: var(--surface-tertiary); }
.stage .frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 700ms var(--ease-move); }
.stage .frame img.out { opacity: 0; }
.stage .top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; }
.dots { display: flex; justify-content: center; gap: 2px; min-height: 24px; }
.dots button { width: 24px; height: 24px; border: 0; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.dots span { display: block; height: 6px; width: 6px; border-radius: 3px; background: var(--track); transition: width var(--duration-enter) var(--ease-enter), background var(--duration-enter); }
.dots button[aria-current="true"] span { width: 18px; background: var(--brand); }
.player .heading { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.player h1 { font-size: 32px; line-height: 38px; }
.player .sub { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.seek { display: flex; flex-direction: column; gap: 6px; padding: 0 10px; }
.times { display: flex; justify-content: space-between; font-size: 12px; line-height: 18px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 36px; }
.controls .skip { width: 52px; height: 52px; border-radius: var(--radius-control); }
.play { width: 72px; height: 72px; border-radius: var(--radius-full); border: 0; background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); display: flex; align-items: center; justify-content: center; padding: 0; }
.play:hover { background: var(--brand-hover); }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.play[aria-busy="true"] { opacity: 0.85; }
.chips { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.note { font-size: 14px; line-height: 20px; color: var(--muted-foreground); text-align: center; padding: 0 10px; }
.note .btn { margin-top: 10px; }

/* Range slider: ink fill, cream thumb */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; --p: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--primary) var(--p), var(--track) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; border: 0; background: var(--surface-elevated); box-shadow: var(--shadow-thumb), 0 0 0 1px var(--border-strong); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; border: 0; background: var(--surface-elevated); box-shadow: var(--shadow-thumb), 0 0 0 1px var(--border-strong); }
input[type="range"]:disabled { opacity: 0.5; }

/* Story text */
.story-text { max-width: 640px; margin: 0 auto; padding: 8px 24px 64px; scroll-margin-top: 16px; }
.story-text > .lead { font-size: 18px; line-height: 28px; margin-bottom: 8px; }
.story-text > .facts { font-size: 14px; line-height: 20px; color: var(--muted-foreground); margin-bottom: 40px; }
.story-text h2 { font-size: 24px; line-height: 28px; margin-bottom: 4px; }
.story-text .attribution { font-size: 14px; line-height: 20px; color: var(--muted-foreground); margin-bottom: 24px; }
.story-text p { font-size: 16px; line-height: 28px; margin-bottom: 16px; }
.story-text .related { margin-top: 48px; }
@media (min-width: 768px) { .story-text .related .shelf-row { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Wide screens and iPad: illustration left, controls right */
@media (min-width: 900px) {
  .player { max-width: 1200px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto 1fr; column-gap: 56px; row-gap: 0; padding: 32px 40px; align-items: start; }
  .stage { grid-row: 1 / span 2; }
  .stage .frame { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); aspect-ratio: 4 / 5; }
  .panel { position: sticky; top: 32px; display: flex; flex-direction: column; gap: 22px; padding-top: 24px; }
  .player h1 { font-size: 40px; line-height: 46px; }
  .story-text { padding-top: 48px; }
}
@media (max-width: 899px) { .panel { display: contents; } }

/* Sheets and bedtime */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); opacity: 0; transition: opacity var(--duration-enter) var(--ease-enter); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 520px; margin: 0 auto;
  background: var(--surface-elevated); color: var(--foreground); border-radius: var(--radius-dialog) var(--radius-dialog) 0 0;
  box-shadow: var(--shadow-float); padding: 24px 24px calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; transform: translateY(100%); transition: transform var(--duration-enter) var(--ease-enter);
}
.sheet.open { transform: none; }
.sheet h2 { font-size: 20px; line-height: 26px; }
.sheet .price { font-family: var(--font-heading); font-size: 28px; line-height: 34px; }
@media (min-width: 640px) { .sheet { bottom: 50%; border-radius: var(--radius-dialog); transform: translateY(60%); opacity: 0; transition: transform var(--duration-enter) var(--ease-enter), opacity var(--duration-enter); } .sheet.open { transform: translateY(50%); opacity: 1; } }

.night {
  position: fixed; inset: 0; z-index: 60; background: var(--background); color: var(--foreground);
  display: flex; flex-direction: column; align-items: center; padding: calc(14px + env(safe-area-inset-top)) 24px calc(36px + env(safe-area-inset-bottom));
  opacity: 0; pointer-events: none; transition: opacity 400ms var(--ease-move); overflow-y: auto;
}
.night.open { opacity: 1; pointer-events: auto; }
.night .bar { align-self: stretch; display: flex; justify-content: space-between; align-items: center; max-width: 560px; width: 100%; margin: 0 auto; }
.night .moon-img { width: min(260px, 60vw); aspect-ratio: 1; object-fit: cover; object-position: center 70%; border-radius: var(--radius-full); margin-top: clamp(16px, 5vh, 44px); opacity: 0.9; background: var(--surface-elevated); }
.night h2 { font-size: 36px; line-height: 42px; margin-top: 32px; text-align: center; }
.night .left { font-size: 14px; line-height: 20px; color: var(--muted-foreground); text-align: center; margin-top: 8px; }
.night .left b { color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.night .timers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 32px; }
.night .grow { flex: 1; min-height: 24px; }
.night .play { width: 68px; height: 68px; background: transparent; color: var(--foreground); border: 1px solid var(--border-strong); box-shadow: none; }
.night .hint { font-size: 12px; line-height: 18px; color: var(--muted-foreground); margin-top: 18px; text-align: center; }

/* Plain pages */
.prose { max-width: 680px; padding: 24px 0 72px; }
.prose h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.1; margin-bottom: 24px; }
.prose h2 { font-size: 22px; line-height: 28px; margin: 32px 0 8px; }
.prose p, .prose li { line-height: 1.7; color: var(--foreground); }
.prose p + p { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
