/* ==========================================================
   Web po krocích — sdílený styl
   Zenový styl: hodně prostoru, světlé pozadí, tmavý text,
   primární akcent Ferrari červená, sekundární břidlicová.
   ========================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1c1c1c;
  --muted: #7a776f;
  --faint: #b9b5ac;
  --line: #e9e6e0;
  --code-bg: #f4f2ee;

  --accent: #d40000;          /* Ferrari červená (Rosso Corsa) */
  --accent-soft: rgba(212, 0, 0, 0.06);
  --second: #3e5c6e;          /* sekundární akcent — břidlicová */

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --topbar: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

code { font-family: var(--mono); font-size: 0.88em; }

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

/* ---------- Zvýraznění syntaxe ---------- */

.t-tag  { color: var(--accent); }
.t-attr { color: var(--second); }
.t-str  { color: var(--ink); }
.t-punc { color: var(--faint); }
.t-sel  { color: var(--accent); }
.t-prop { color: var(--second); }
.t-val  { color: var(--ink); }
.t-com  { color: var(--faint); font-style: italic; }
.t-kw   { color: var(--accent); }
.t-fn   { color: var(--second); }
.t-num  { color: var(--second); }

/* ==========================================================
   Rejstřík (index.html)
   ========================================================== */

.home {
  max-width: 1040px;
  margin: 0 auto;
  padding: 140px 32px 160px;
}

.home-up {
  display: inline-block;
  margin-bottom: 48px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.home-up:hover { color: var(--accent); }

.home-hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 32px;
}

.home-hero h1 .dot { color: var(--accent); }

.home-hero p {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.15rem;
  margin: 0;
}

/* rozcestník částí kurzu pod úvodem */
.home-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin-top: 48px;
  font-size: 14px;
}

.home-jump a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.home-jump a::before { content: "↓ "; color: var(--faint); }
.home-jump a:hover { color: var(--accent); }

.part { scroll-margin-top: 48px; }

.part { margin-top: 160px; }

.part-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 8px;
}

.part-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.part-head h2 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.015em;
  margin: 0;
}

.part-lead {
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 34rem;
}

.category { margin-top: 80px; }

.category h3 {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 0 16px;
}

.elements {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  column-gap: 48px;
}

.elements li { border-top: 1px solid var(--line); }

.el {
  display: flex;
  flex-direction: column;
  padding: 18px 0 22px;
  text-decoration: none;
}

.el code {
  font-size: 1.1rem;
  background: none;
  padding: 0;
  transition: color 0.2s;
}

.el span {
  font-size: 14px;
  color: var(--muted);
}

a.el:hover code { color: var(--accent); }

/* položka bez značky (komponenty): název místo kódu */
.el strong {
  font-size: 1.05rem;
  font-weight: 500;
  transition: color 0.2s;
}

.el strong + span code {
  font-size: 0.9em;
  background: none;
  padding: 0;
}

a.el:hover strong { color: var(--accent); }

.el.is-soon { opacity: 0.38; }

/* ---------- Layouty: karty se schématem ---------- */

.layouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 48px;
}

.lay {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.lay strong {
  margin-top: 16px;
  font-weight: 500;
  transition: color 0.2s;
}

.lay > span:last-child {
  font-size: 14px;
  color: var(--muted);
}

a.lay:hover strong { color: var(--accent); }

.lay.is-soon { opacity: 0.38; }

/* Schéma rozvržení: h = hlavička, n = navigace, m = hlavní obsah,
   a = panel, f = patička, c = karta */
.wire {
  display: grid;
  gap: 4px;
  aspect-ratio: 16 / 10;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.wire i { border-radius: 3px; background: var(--line); }
.wire i.m { background: rgba(212, 0, 0, 0.16); }

.wire .h { grid-area: h; }
.wire .n { grid-area: n; }
.wire .m { grid-area: m; }
.wire .a { grid-area: a; }
.wire .f { grid-area: f; }

.wire-stack {
  grid-template-rows: 1fr 4fr 1fr;
  grid-template-areas: "h" "m" "f";
}

.wire-narrow {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 1fr 4fr 1fr;
  grid-template-areas: "h h h" ". m ." "f f f";
}

.wire-sidebar {
  grid-template-columns: 3fr 1fr;
  grid-template-rows: 1fr 4fr 1fr;
  grid-template-areas: "h h" "m a" "f f";
}

.wire-three {
  grid-template-columns: 1fr 3fr 1fr;
  grid-template-rows: 1fr 4fr 1fr;
  grid-template-areas: "h h h" "n m a" "f f f";
}

.wire-cards {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.wire-hero {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 3fr 2fr;
}

.wire-hero .m { grid-area: auto; grid-column: 1 / -1; }

.wire-areas {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 1fr 3fr 1.5fr 1fr;
  grid-template-areas: "h h h" "n m m" "n a a" "f f f";
}

.wire-mobile {
  padding: 10px 37%;          /* úzký sloupec uprostřed = telefon */
  grid-template-rows: 1fr 3fr 1.5fr 1fr;
  grid-template-areas: "h" "m" "a" "f";
}

.wire-calc {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1.4fr repeat(3, 1fr);
  padding: 10px 30%;          /* kalkulačka na výšku */
}

.wire-calc .m { grid-area: auto; grid-column: 1 / -1; }

.wire-memory {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.soon {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.next-all {
  margin: 24px 0 0;
  font-size: 15px;
}

.next-all a {
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.next-all a:hover { color: var(--accent); }

.home-foot {
  margin-top: 160px;
  font-size: 14px;
  color: var(--faint);
}

/* ==========================================================
   Zadání projektu (projekty/<slug>/index.html)
   ========================================================== */

.home-hero .project-kind {
  margin: 0 0 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.demo { margin: 96px 0 0; }

.demo .window { height: min(72vh, 640px); }

.demo iframe {
  flex: 1;
  width: 100%;
  border: 0;
}

.demo figcaption {
  margin-top: 16px;
  font-size: 14px;
}

.demo figcaption a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.demo figcaption a:hover { color: var(--accent); }

.ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.way {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s;
}

.way strong {
  font-weight: 500;
  transition: color 0.2s;
}

.way span {
  font-size: 15px;
  color: var(--muted);
}

.way:hover { border-color: var(--accent); }
.way:hover strong { color: var(--accent); }

.project-checks { max-width: 40rem; }

.project .category { margin-top: 48px; }

/* ==========================================================
   Lekce (skrolovací stránka elementu)
   ========================================================== */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 48px;
  background: rgba(251, 250, 247, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
  color: var(--muted);
}

.topbar .back { text-decoration: none; transition: color 0.2s; }
.topbar .back:hover { color: var(--accent); }

.topbar .counter {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  height: 2px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.4s ease;
}

.scrolly {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 80px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ---------- Levá část: kroky ---------- */

.steps { padding: var(--topbar) 0 30vh; }

.step {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 540px;
  padding: 64px 0;
  opacity: 0.22;
  transition: opacity 0.5s ease;
}

.step.is-active { opacity: 1; }

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 12px;
}

.step h1 {
  font-family: var(--mono);
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 40px;
}

.step h1 .t-punc { color: var(--faint); }
.step h1 .t-tag { color: var(--accent); }

/* Nadpis lekce, která není o jednom elementu (např. layouty) */
.step h1.title {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.step .wire {
  width: 200px;
  margin-bottom: 32px;
}

.step h2 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0 0 24px;
}

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

.step .lead {
  font-size: 1.2rem;
  color: var(--muted);
}

.snippet {
  margin: 24px 0;
  padding: 22px 26px;
  background: var(--code-bg);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: auto;
}

.snippet code { font-size: inherit; white-space: pre; }

.note {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--second);
  font-size: 15px;
  color: var(--muted);
}

.checks {
  list-style: none;
  margin: 8px 0 24px;
  padding: 0;
}

.checks li {
  position: relative;
  padding: 6px 0 6px 32px;
}

.checks li::before {
  position: absolute;
  left: 0;
  font-family: var(--mono);
}

.checks.yes li::before { content: "✓"; color: var(--second); }
.checks.no  li::before { content: "✕"; color: var(--accent); }

.step .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 32px 0 0;
}

.step .next {
  margin-top: 48px;
  font-size: 15px;
}

.step .next a {
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.step .next a:hover { color: var(--accent); }

/* ---------- Pravá část: náhled + kód ---------- */

.stage {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 0 48px;
}

.window {
  flex: 1.25 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 24px 60px -36px rgba(0, 0, 0, 0.18);
}

.window-bar {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.window-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e6e2dc;
}

.window-bar span {
  margin-left: 12px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  transition: background 0.3s;
}

.viewport.is-framed { background: var(--code-bg); }

.viewport iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
}

.viewport.is-framed iframe {
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line), 0 16px 40px -24px rgba(0, 0, 0, 0.2);
}

/* Konzole pod náhledem (lekce JavaScriptu) */

.console {
  flex: none;
  display: flex;
  flex-direction: column;
  height: 132px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.window.is-console .viewport { display: none; }
.window.no-console .console { display: none; }
.window.is-console .console { flex: 1; height: auto; border-top: 0; }

.console-bar {
  flex: none;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.console-run {
  margin-left: auto;
  font: inherit;
  border: 0;
  background: none;
  color: var(--faint);
  padding: 2px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.console-run:hover { color: var(--ink); background: var(--code-bg); }

.console-out {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}

.console-out li {
  padding: 2px 16px 2px 32px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-out li::before {
  content: "›";
  position: absolute;
  left: 16px;
  color: var(--faint);
}

.console-out .c-warn  { color: #8a5a00; }
.console-out .c-error { color: var(--accent); background: var(--accent-soft); }

.window.is-console .console-out { font-size: 15px; }

.vp-toggle {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.vp-toggle button {
  font: inherit;
  font-size: 12px;
  border: 0;
  background: none;
  color: var(--faint);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.vp-toggle button:hover { color: var(--ink); }

.vp-toggle button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--code-bg);
}

.source {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 20px 0;
  background: var(--code-bg);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.75;
}

.source code { font-size: inherit; }

.source .ln {
  display: block;
  min-height: 1.75em;
  padding: 0 24px;
  border-left: 3px solid transparent;
  white-space: pre;
  transition: background 0.4s;
}

.source .ln.is-new {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.keys-hint {
  position: fixed;
  right: 48px;
  bottom: 20px;
  font-size: 12px;
  color: var(--faint);
}

kbd {
  font-family: var(--mono);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--surface);
}

/* ---------- Úzké obrazovky ---------- */

@media (max-width: 900px) {
  body { font-size: 17px; }

  .home { padding: 96px 16px 120px; }
  .part { margin-top: 112px; }

  .topbar { padding: 0 16px; }
  .topbar .crumb { display: none; }

  .scrolly {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 16px;
  }

  .stage {
    order: -1;
    z-index: 5;
    height: 46vh;
    padding: 12px 0;
    background: var(--bg);
  }

  .source { display: none; }

  .steps { padding-top: 0; }

  .step {
    min-height: 75vh;
    padding: 48px 0;
  }

  .step h2 { font-size: 1.6rem; }

  .keys-hint { display: none; }
}
