/* Skoro hotovo - stranka ke stazeni.
   Barvy a pisma jsou prevzate z theme/ebook.css, at stranka a PDF vypadaji
   jako jedna vec. Jediny vyrazny prvek je checklist s neodskrtnutym poslednim
   radkem, vsechno okolo je tiche. */

:root {
  --ink: #17150f;
  --ink-soft: #4a463c;
  --ink-faint: #8a8578;
  --paper: #fbfaf7;
  --card: #ffffff;
  --rule: #ddd8cc;
  --accent: #9a3b1f;
  --accent-ink: #ffffff;
  --accent-soft: #f2ece2;
  --error: #8f1d12;

  --serif: "Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Helvetica, system-ui, Arial, sans-serif;

  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7dc;
    --ink-soft: #b3ac9d;
    --ink-faint: #8d867a;
    --paper: #14130f;
    --card: #1b1915;
    --rule: #33302a;
    --accent: #e08a5f;
    --accent-ink: #14130f;
    --accent-soft: #241f19;
    --error: #f0937c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- rozvrzeni ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px var(--gutter) 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "get" "story" "contents";
  row-gap: 40px;
}

.intro { grid-area: intro; }
.get { grid-area: get; }
.story { grid-area: story; }
.contents { grid-area: contents; }

@media (min-width: 960px) {
  .page {
    padding: 88px 40px 40px;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "intro get" "story get" "contents get";
    column-gap: 72px;
    row-gap: 36px;
  }
  .contents { padding-top: 36px; }
  .get {
    align-self: start;
    position: sticky;
    top: 40px;
    padding-top: 12px;
  }
}

/* ---------- uvod ---------- */

.title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(4.25rem, 19vw, 8.25rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
  max-width: 6ch;
}

.sub {
  font-size: 1.3125rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 6px;
  max-width: 30ch;
}

.byline {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-faint);
  margin: 0 0 36px;
}

/* ---------- checklist: jediny hlasity prvek ---------- */

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 1.375rem;
  line-height: 1.3;
  max-width: 34ch;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.checklist li:last-child { border-bottom: none; }

.checklist li.done { color: var(--ink-soft); }

.checklist li.open {
  color: var(--ink);
  font-weight: 700;
}

.box {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border: 2px solid var(--ink-soft);
  border-radius: 3px;
  display: grid;
  place-items: center;
}

.box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 0;
}

.checklist li.open .box {
  border-color: var(--accent);
  border-width: 2.5px;
}

.checklist li.open .box svg {
  stroke: var(--accent);
  stroke-dashoffset: 24;
}

.checklist li.open.ticked .box svg {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 420ms ease-out;
}

@media (prefers-reduced-motion: no-preference) {
  .checklist li.done .box svg {
    animation: tick 360ms ease-out both;
  }
  .checklist li.done:nth-child(1) .box svg { animation-delay: 250ms; }
  .checklist li.done:nth-child(2) .box svg { animation-delay: 550ms; }
  .checklist li.done:nth-child(3) .box svg { animation-delay: 850ms; }
}

@keyframes tick {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

/* ---------- text ---------- */

.prose { max-width: 36em; }

.prose p { margin: 0 0 1em; }

.prose p:last-child { margin-bottom: 0; }

.prose .aside {
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- formular ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  padding: 24px 20px 24px;
}

@media (min-width: 960px) {
  .panel { padding: 32px 32px 32px; }
}

.panel-title,
.hotovo-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}

.panel-lead {
  color: var(--ink-soft);
  margin: 0 0 22px;
  font-size: 1.0625rem;
}

.field-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.field {
  display: block;
  width: 100%;
  font: inherit;
  font-family: var(--sans);
  font-size: 1.125rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink-faint);
  border-radius: 3px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.field:focus-visible { border-color: var(--accent); }

.field[aria-invalid="true"] { border-color: var(--error); }

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 20px;
  cursor: pointer;
}

.consent input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.chyba {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--error);
  margin: 0 0 16px;
}

.button {
  display: block;
  width: 100%;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 3px;
  padding: 15px 20px;
  cursor: pointer;
}

.button:hover { filter: brightness(1.08); }

.button[disabled] {
  cursor: progress;
  opacity: 0.7;
}

.hotovo p { margin: 0 0 18px; }

.hint {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-faint);
  margin: 16px 0 0 !important;
}

/* ---------- obsah knihy ---------- */

.contents-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.125rem;
  margin: 0 0 12px;
}

.toc {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: kapitola;
  max-width: 40em;
}

.toc li {
  counter-increment: kapitola;
  display: grid;
  grid-template-columns: 2.25em 1fr;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.0625rem;
  line-height: 1.4;
}

.toc li::before {
  content: counter(kapitola);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 2px;
}

/* ---------- paticka ---------- */

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-faint);
}

@media (min-width: 960px) {
  .foot { padding: 32px 40px 64px; }
}

.foot p { margin: 0 0 6px; }

/* ---------- textove stranky (zasady, odpoved bez JS) ---------- */

.doc,
.fallback {
  max-width: 40rem;
  margin: 0 auto;
  padding: 40px var(--gutter) 64px;
}

.doc h1,
.fallback-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}

.doc h2 {
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 700;
  margin: 32px 0 8px;
}

.doc p,
.doc li { margin: 0 0 0.8em; }

.doc ul { padding-left: 1.2em; }

.doc .meta {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-faint);
}

.fallback .download { display: inline-block; width: auto; }
