/* Bastlířská dílna – veřejný web. Barvy podle materiálu z dílny:
   modrý obal špaget, žluté špagety, barevná plastelína, karton. */
:root {
  color-scheme: light;
  --wall: #EDF1F4;
  --paper: #FFFFFF;
  --ink: #1B2B4B;
  --ink-soft: #4A5875;
  --spaghetti: #E9B425;
  --spaghetti-deep: #B98510;
  --blue: #2F6FE0;
  --pink: #E8487A;
  --teal: #13A39A;
  --orange: #F08A24;
  --cardboard: #B98A57;
  --line: #CBD4DE;
  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-optical-sizing: auto;
  font-size: 1.125rem;
  line-height: 1.55;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* Horní lišta */
.bar { padding: 22px 0; }
.bar .wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.125rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand::before {
  content: ""; display: inline-block; width: 0.8em; height: 0.66em; margin-right: 0.45em;
  background: var(--pink); border-radius: 48% 52% 45% 55%; transform: rotate(-12deg) translateY(0.05em);
}
.bar nav { display: flex; gap: 20px; font-size: 1rem; }
.bar nav a { color: var(--ink-soft); text-decoration: none; }
.bar nav a:hover { color: var(--ink); text-decoration: underline; }

/* Úvod s věží */
.hero { padding: 24px 0 72px; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: end; }
.hero h1 {
  font-size: clamp(3.4rem, 10vw, 8.6rem);
  font-weight: 800;
  font-stretch: 82%;
  font-variation-settings: "wdth" 82;
  line-height: 0.9;
  letter-spacing: -0.012em;
  margin: 0 0 32px;
}
.hero h1 span { display: block; }
.hero h1 span + span { color: var(--blue); }
.hero .lead { font-size: clamp(1.2rem, 2.1vw, 1.45rem); line-height: 1.45; max-width: 30ch; margin: 0 0 18px; }
.hero .facts { color: var(--ink-soft); max-width: 44ch; margin: 0; }
.tower { width: 100%; max-width: 440px; justify-self: end; overflow: visible; }

.tower .s {
  stroke: var(--spaghetti); stroke-width: 5; stroke-linecap: round; fill: none;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 0.42s ease-out forwards; animation-delay: calc(var(--i) * 55ms + 150ms);
}
.tower .b {
  transform-box: fill-box; transform-origin: center;
  scale: 0; animation: pop 0.35s cubic-bezier(.3, 1.6, .5, 1) forwards;
  animation-delay: calc(var(--i) * 190ms + 300ms);
}
.tower .top { scale: 0; transform-box: fill-box; transform-origin: 50% 100%;
  animation: pop 0.5s cubic-bezier(.3, 1.6, .5, 1) 1.9s forwards; }
.tower .ruler { stroke: var(--ink); stroke-width: 1.5; }
.tower .ruler-label { font: 700 15px "Bricolage Grotesque", sans-serif; fill: var(--ink); }
.tower .ruler-note { font: 400 13px "Bricolage Grotesque", sans-serif; fill: var(--ink-soft); }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { scale: 1; } }

@media (prefers-reduced-motion: reduce) {
  .tower .s, .tower .b, .tower .top { animation: none; stroke-dashoffset: 0; scale: 1; }
}

/* Sekce na úvodní stránce */
.section { padding: 72px 0; }
.section h2 {
  font-size: clamp(2rem, 4.6vw, 3.2rem); font-weight: 800; font-stretch: 80%;
  font-variation-settings: "wdth" 80; letter-spacing: -0.02em; line-height: 1; margin: 0 0 12px;
}
.section .intro { color: var(--ink-soft); max-width: 52ch; margin: 0 0 40px; }

.done { background: var(--paper); }

/* Odučená lekce na úvodní stránce */
.lesson {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  align-items: center; padding: 40px 0; border-top: 2px solid var(--wall);
}
.lesson:first-of-type { border-top: 0; padding-top: 8px; }
.lesson-photos { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }
.lesson-photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; aspect-ratio: 4 / 3; }
.lesson-photos img:first-child { grid-row: span 2; aspect-ratio: auto; min-height: 100%; }
.lesson-no { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); margin: 0 0 10px; font-size: 1rem; }
.lesson h3 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 14px; font-weight: 800; }
.lesson p { margin: 0 0 14px; max-width: 46ch; }
.lesson .when { color: var(--ink-soft); font-size: 1rem; }

.blob {
  display: inline-grid; place-items: center; flex: none;
  width: 2.3rem; height: 2rem; color: #fff; font-weight: 800; font-size: 1rem;
  border-radius: 52% 48% 55% 45% / 58% 50% 50% 42%; background: var(--c, var(--blue));
  transform: rotate(-8deg);
}
.blob > span { transform: rotate(8deg); }

.button {
  display: inline-block; margin-top: 6px; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 700;
}
.button:hover { background: var(--blue); color: #fff; }

/* Co chystáme */
.plans { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; max-width: 760px; }
.plans li { display: grid; grid-template-columns: 3rem 1fr; gap: 16px; padding: 20px 0; border-top: 2px dashed var(--line); }
.plans li:last-child { border-bottom: 2px dashed var(--line); }
.plans h3 { margin: 0 0 4px; font-size: 1.35rem; line-height: 1.2; }
.plans p { margin: 0; color: var(--ink-soft); }
.plans .blob { background: transparent; color: var(--ink); border: 2px dashed var(--ink-soft); }

/* Patička */
.foot { padding: 48px 0 64px; color: var(--ink-soft); font-size: 1rem; }
.foot p { max-width: 62ch; margin: 0 0 10px; }

/* ---------- Stránka s návodem ---------- */
.guide-head { padding: 24px 0 40px; }
.guide-head .lesson-no { margin-bottom: 16px; }
.guide-head h1 {
  font-size: clamp(2.8rem, 8vw, 6rem); font-weight: 800; font-stretch: 75%;
  font-variation-settings: "wdth" 82; line-height: 0.95; letter-spacing: -0.01em; margin: 0 0 24px; max-width: 14ch;
}
.guide-head .lead { font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.45; max-width: 46ch; margin: 0 0 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 1rem; }
.meta strong { color: var(--ink); font-weight: 700; }

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 190px; gap: 10px; }
.gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: 8px; background: var(--paper); }
.gallery figure:first-child { grid-column: span 2; grid-row: span 2; }
.gallery a { display: block; height: 100%; cursor: zoom-in; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.gallery a:hover img { transform: scale(1.03); }
.gallery figcaption {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  background: var(--paper); color: var(--ink); font-size: 0.85rem; line-height: 1.3; padding: 4px 9px; border-radius: 6px;
  pointer-events: none;
}

.principle {
  margin: 56px 0 0; padding: 28px clamp(20px, 3vw, 36px); background: var(--ink); color: #fff; border-radius: 10px;
  display: grid; grid-template-columns: minmax(0, 14rem) 1fr; gap: 12px 32px; align-items: start;
}
.principle h2 { margin: 0; font-size: 1.5rem; line-height: 1.15; color: var(--spaghetti); }
.principle p { margin: 0 0 10px; max-width: 58ch; }
.principle p:last-child { margin-bottom: 0; }

.howto { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); padding: 64px 0 24px; align-items: start; }
.howto h2, .after h2 { font-size: 1.9rem; letter-spacing: -0.015em; line-height: 1.1; margin: 0 0 18px; font-weight: 800; }

.materials { position: sticky; top: 20px; background: var(--paper); border-radius: 10px; padding: 24px; }
.materials h2 { font-size: 1.5rem; }
.materials ul { list-style: none; padding: 0; margin: 0; }
.materials li { padding: 9px 0 9px 30px; border-top: 1px solid var(--wall); position: relative; line-height: 1.35; font-size: 1.05rem; }
.materials li::before {
  /* prázdný čtvereček na odškrtnutí, potřeby jsou seznam k přípravě */
  content: ""; position: absolute; left: 1px; top: 12px; width: 14px; height: 14px;
  border: 2px solid var(--ink-soft); border-radius: 4px;
}
.materials .note { font-size: 0.95rem; color: var(--ink-soft); margin: 14px 0 0; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: krok; }
.steps > li { counter-increment: krok; display: grid; grid-template-columns: 2.6rem 1fr; gap: 18px; padding: 0 0 30px; }
.steps > li::before {
  content: counter(krok); display: grid; place-items: center; width: 2.6rem; height: 2.3rem; color: #fff; font-weight: 800;
  border-radius: 52% 48% 55% 45% / 58% 50% 50% 42%; background: var(--blue); transform: rotate(-6deg);
}
.steps > li:nth-child(5n+2)::before { background: var(--pink); transform: rotate(5deg); }
.steps > li:nth-child(5n+3)::before { background: var(--teal); transform: rotate(-3deg); }
.steps > li:nth-child(5n+4)::before { background: var(--orange); transform: rotate(8deg); }
.steps > li:nth-child(5n+5)::before { background: #E0402B; }
.steps h3 { margin: 0.15em 0 6px; font-size: 1.25rem; line-height: 1.25; }
.steps p { margin: 0 0 8px; max-width: var(--measure); }
.steps .tip { color: var(--ink-soft); font-size: 1rem; }
.steps img { border-radius: 6px; margin-top: 10px; max-height: 360px; width: auto; }

.after { padding: 40px 0 24px; }
.fixes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 40px; margin: 0; }
.fixes div { padding: 16px 0; border-top: 2px solid var(--line); }
.fixes dt { font-weight: 700; margin: 0 0 4px; }
.fixes dd { margin: 0; color: var(--ink-soft); }

.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.story p { max-width: var(--measure); margin: 0 0 14px; }
.story figure { margin: 0; }
.story img { border-radius: 6px; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.story figcaption { font-size: 0.95rem; color: var(--ink-soft); padding-top: 8px; }
.big-number { font-size: clamp(3rem, 7vw, 5rem); font-weight: 800; font-stretch: 75%; font-variation-settings: "wdth" 75;
  line-height: 1; color: var(--blue); margin: 0; letter-spacing: -0.02em; }

.more { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.more li { padding: 10px 0 10px 30px; position: relative; }
.more li::before { content: ""; position: absolute; left: 0; top: 1.05em; width: 14px; height: 12px; background: var(--teal);
  border-radius: 52% 48% 55% 45% / 58% 50% 50% 42%; }

.next {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px 24px;
  padding: 40px 0 0; border-top: 2px solid var(--line); margin-top: 48px;
}
.next .prev, .next .nxt { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.next .nxt { justify-self: end; flex-direction: row-reverse; text-align: right; }
.next svg {
  width: 44px; height: 44px; flex: none; padding: 10px; border-radius: 50%; background: var(--c);
  fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s;
}
.next .prev svg { transform: scaleX(-1); }
.next .prev:hover svg { transform: scaleX(-1) translateX(4px); }
.next .nxt:hover svg { transform: translateX(4px); }
.next span { display: grid; line-height: 1.25; }
.next small { font-size: 0.88rem; color: var(--ink-soft); }
.next strong { font-size: 1.15rem; font-weight: 700; }
.next a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.next .home { font-size: 0.95rem; color: var(--ink-soft); }
@media (max-width: 820px) {
  .next { grid-template-columns: minmax(0, 1fr); }
  .next > span:empty { display: none; }
  .next .nxt { justify-self: start; flex-direction: row; text-align: left; }
  .next .home { order: 1; }
}

/* Mobil */
@media (max-width: 820px) {
  .hero .wrap, .lesson, .howto, .story, .principle { grid-template-columns: minmax(0, 1fr); }
  .tower { justify-self: center; max-width: 300px; order: -1; margin-bottom: -8px; }
  .materials { position: static; }
  .lesson-photos { grid-template-columns: 1fr 1fr; }
  .lesson-photos img:first-child { grid-column: span 2; grid-row: auto; aspect-ratio: 4 / 3; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 140px; }
  .gallery figcaption { font-size: 0.78rem; }
  .section { padding: 56px 0; }
}

/* Schematické nákresy u kroků */
.diagram { margin: 12px 0 6px; max-width: 460px; background: var(--paper); border-radius: 8px; padding: 10px 10px 8px; }
.diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagram figcaption { font-size: 0.9rem; color: var(--ink-soft); padding: 6px 4px 0; line-height: 1.35; }
.diagram .old { opacity: 0.32; }
.diagram .dim line { stroke: var(--ink-soft); stroke-width: 1.2; }
.diagram .lead { stroke: var(--ink); stroke-width: 1; }
.diagram .dot { fill: var(--ink); }
.diagram .ground { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 2 4; }
.diagram .lbl { font: 600 12px "Bricolage Grotesque", sans-serif; fill: var(--ink); }
.diagram .hint { font: 500 11px "Bricolage Grotesque", sans-serif; fill: #7D6040; }

/* Modely ke stažení */
.section-lead { max-width: var(--measure); margin: 0 0 24px; }
.prints { list-style: none; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.prints li { background: var(--paper); border-radius: 10px; padding: 14px 16px 18px; }
.prints img { width: 100%; height: auto; border-radius: 6px; margin-bottom: 10px; }
.prints h3 { margin: 0; font-size: 1.4rem; line-height: 1.2; }
.prints p { margin: 2px 0 10px; color: var(--ink-soft); font-size: 1rem; }
.prints a { font-weight: 700; }
code { font-size: 0.92em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }

.downloads { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 8px; }
.dl {
  display: inline-flex; align-items: center; gap: 14px; padding: 14px 22px 14px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; text-decoration: none; min-width: min(100%, 300px);
  transition: background-color .15s ease, transform .15s ease;
}
.dl:hover { background: var(--blue); color: #fff; transform: translateY(-1px); }
.dl:active { transform: translateY(0); }
.dl svg { width: 34px; height: 34px; flex: none; padding: 6px; border-radius: 50%; background: var(--pink);
  fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dl span { display: grid; line-height: 1.25; }
.dl strong { font-size: 1.05rem; }
.dl small { font-size: 0.88rem; opacity: .78; }
.dl-alt { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.dl-alt svg { background: var(--teal); }
.dl-alt:hover { background: var(--ink); color: #fff; }
@media (prefers-reduced-motion: reduce) { .dl { transition: none; } .dl:hover { transform: none; } }

/* Prohlížeč fotek */
.lightbox { border: 0; padding: 0; background: rgba(14, 22, 40, 0.94); max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(14, 22, 40, 0.6); }
.lightbox-inner { position: relative; height: 100%; display: grid; place-items: center; padding: 56px 64px 72px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); width: auto; height: auto; border-radius: 6px; }
.lightbox p { position: absolute; left: 0; right: 0; bottom: 22px; margin: 0; text-align: center; color: #fff; font-size: 1rem; padding: 0 64px; }
.lightbox button {
  position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--paper); color: var(--ink); font: 700 1.4rem/1 "Bricolage Grotesque", sans-serif;
  display: grid; place-items: center;
}
.lightbox button:hover { background: var(--spaghetti); }
.lightbox .lb-close { top: 14px; right: 14px; }
.lightbox .lb-prev { left: 12px; top: 50%; translate: 0 -50%; }
.lightbox .lb-next { right: 12px; top: 50%; translate: 0 -50%; }
@media (max-width: 820px) {
  .lightbox-inner { padding: 60px 10px 80px; }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 14px; translate: none; }
  .lightbox p { bottom: 74px; padding: 0 16px; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) { .gallery img { transition: none; } .gallery a:hover img { transform: none; } }

/* Velký otazník u vysvětlení principu: vedle nadpisu, svisle na střed */
.principle { align-items: center; }
.principle h2 { display: flex; align-items: center; gap: 14px; }
.principle h2::before {
  content: "?"; flex: none;
  font-size: 8.5rem; font-weight: 800; font-stretch: 82%; font-variation-settings: "wdth" 82;
  line-height: 0.8; color: var(--pink);
}
@media (max-width: 820px) {
  .principle h2::before { font-size: 5rem; }
}

/* Tlačítko PDF v hlavičce návodu */
.guide-head .dl { margin-top: 22px; }
.jen-tisk { display: none; }

/* ---------- Tisk a PDF: jen to, co je potřeba u stolu, bez fotek a tmavých ploch ---------- */
@page {
  size: A4; margin: 13mm 15mm 15mm;
  @bottom-right { content: counter(page) " / " counter(pages); font: 9pt "Bricolage Grotesque", sans-serif; color: #4A5875; }
}
@media print {
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.42; }
  .wrap { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  .bar, .foot, .gallery, .guide-head .dl, .next, #kola, .after:has(.story), .lightbox { display: none !important; }
  .jen-tisk { display: block; }

  .guide-head { padding: 0 0 5mm; }
  .guide-head .lesson-no { margin-bottom: 2mm; font-size: 9.5pt; }
  .guide-head h1 { font-size: 30pt; max-width: none; margin: 0 0 3mm; }
  .guide-head .lead { font-size: 12pt; max-width: none; margin: 0 0 2mm; }
  .meta { font-size: 9.5pt; }
  .guide-head .jen-tisk { font-size: 9pt; color: var(--ink-soft); margin: 2mm 0 0; }

  .principle { margin: 0; padding: 4mm 5mm; background: none; color: var(--ink); border: 1.5pt solid var(--ink);
    grid-template-columns: 34mm 1fr; gap: 5mm; break-inside: avoid; }
  .principle h2 { color: var(--ink); font-size: 13pt; gap: 3mm; }
  .principle h2::before { font-size: 44pt; }
  .principle p { max-width: none; }

  .howto { display: block; padding: 6mm 0 0; }
  .howto h2, .after h2 { font-size: 15pt; margin: 0 0 3mm; }
  .materials { position: static; padding: 0; margin: 0 0 6mm; }
  .materials h2 { font-size: 15pt; }
  .materials ul { columns: 2; column-gap: 8mm; }
  .materials li { font-size: 10pt; padding: 1.6mm 0 1.6mm 6mm; break-inside: avoid; border-top-color: var(--line); }
  .materials li::before { top: 2.3mm; width: 3.2mm; height: 3.2mm; border-width: 1.2pt; border-radius: 0.8mm; }
  .materials .note { font-size: 9pt; margin-top: 2mm; }

  .steps > li { grid-template-columns: 8mm 1fr; gap: 4mm; padding: 0 0 5mm; break-inside: avoid; }
  .steps > li::before { width: 8mm; height: 7mm; font-size: 10pt; }
  /* krok s nákresem nebo fotkou: text vlevo, obrázek vpravo */
  .steps > li > div:has(> .diagram, > img) { display: grid; grid-template-columns: minmax(0, 1fr) 68mm; column-gap: 7mm; align-content: start; }
  .steps > li > div > * { grid-column: 1; }
  .steps > li > div > .diagram, .steps > li > div > img { grid-column: 2; grid-row: 1 / span 6; align-self: start; }
  .steps h3 { font-size: 11.5pt; margin-top: 0.6mm; }
  .steps p { max-width: none; margin: 0 0 1.5mm; }
  .steps .tip { font-size: 9.5pt; }
  .steps .diagram { width: 100%; margin: 0; padding: 0; }
  .steps .diagram figcaption { font-size: 8pt; padding-top: 1mm; }
  .steps img { max-height: 46mm; margin: 0 0 0 auto; }

  .after { padding: 4mm 0 0; }
  .fixes { grid-template-columns: 1fr 1fr; gap: 0 8mm; }
  .fixes div { padding: 2mm 0; border-top-width: 1pt; break-inside: avoid; }
  .fixes dd { font-size: 9.5pt; }
  .more { max-width: none; }
  .more li { padding: 1mm 0 1mm 6mm; }
  .more li::before { top: 2.4mm; width: 3mm; height: 2.6mm; }
}
