/* Svět v dětských barvách — první návrh */

:root {
  --paper: #FCF6F2;
  --white: #FFFFFF;
  --plum: #705D6F;      /* nadpisy (DynaPuff) */
  --ink: #3B3234;       /* odstavce (DM Sans) */
  --slate: #647A8C;     /* psací písmo (Playwrite CZ) */
  --peach: #EEC5B5;
  --lavender: #ECE1E9;

  /* barvy slova „barvách" */
  --coral: #E79586;
  --mint: #83B7AC;
  --honey: #E4AE4F;
  --lilac: #A599D3;
  --pink: #D889AA;
  --sky: #8FA6CC;

  --f-display: "DynaPuff", "Arial Rounded MT Bold", system-ui, sans-serif;
  --f-script: "Playwrite CZ", "Segoe Script", cursive;
  --f-body: "DM Sans", system-ui, -apple-system, sans-serif;

  --stage: min(100vw, 1560px);   /* šířka plátna s kresbičkami */
  --gutter: clamp(18px, 4vw, 40px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--f-body);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1.1em; text-wrap: pretty; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); color: var(--plum); text-wrap: balance; }
h2 { font-weight: 600; font-size: clamp(1.75rem, 3.4vw, 2.75rem); line-height: 1.12; }
:focus-visible { outline: 3px solid var(--lilac); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100%, 1200px + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.script { font-family: var(--f-script); font-weight: 300; color: var(--slate); line-height: 1.9; }
.lead { font-size: 1.2rem; line-height: 1.6; }

.bar { display: block; width: 120px; height: 10px; border-radius: 99px; background: var(--peach); margin: 22px auto; }
.bar--mint { background: var(--mint); margin-inline: 0; }
.bar--lilac { background: var(--lilac); }
.bar--left { margin-inline: 0; }

.btn {
  display: inline-flex; align-items: center; gap: .6em;
  padding: .85em 1.7em; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--plum); color: var(--paper);
  font: 500 1.0625rem/1.2 var(--f-display); text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgb(112 93 111 / .6); }
.btn:active { transform: translateY(0) scale(.98); }

/* ───────── Hlavička: čmáraný rám + kresbičky z PSD ───────── */

.top { position: relative; overflow-x: clip; isolation: isolate; }

.top::before {            /* čmáraný rám, pokračuje i pod úvodní text a dole se rozplyne */
  content: ""; position: absolute; z-index: -2; top: 0; left: 0; width: 100%; aspect-ratio: 1;
  background: url(assets/hero/ram.webp) center top / 100% 100% no-repeat;
  opacity: .55;           /* síla čmáranic: 1 = jako v PSD, menší číslo = světlejší */
  -webkit-mask-image: linear-gradient(#000 62%, transparent 96%);
          mask-image: linear-gradient(#000 62%, transparent 96%);
}

.hero {                    /* první obrazovka: text uprostřed, kresbičky po stranách až dolů */
  position: relative; text-align: center;
  display: grid; place-items: center;
  min-height: max(100svh, var(--stage) * .6);
  padding: 11svh var(--gutter) 0;   /* text sedí kousek pod středem, ať má odstup od kresbiček nahoře */
}

.top {
  --s: .75;                          /* velikost kresbiček (1 = jako v PSD) */
  --u: calc(var(--stage) / 100);     /* jednotka pro --dx: 1 % šířky plátna */
}
.stage { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.stage img {
  position: absolute; max-width: none;
  left: calc(var(--dx) * var(--u)); top: calc(var(--dy) * 1%); width: calc(var(--w) * var(--s) * var(--k, 1) * var(--u));
  animation: bob 3.6s ease-in-out infinite alternate;
}
.stage img.c { left: calc(50% + var(--dx) * var(--u)); }
.stage img.r { left: auto; right: calc(var(--dx) * var(--u)); }

.stage img:nth-child(3n)   { animation-duration: 4.4s; animation-delay: -2s; --r: -4.5deg; }
.stage img:nth-child(3n+1) { animation-duration: 3s; animation-delay: -1.3s; --r: 3deg; }
.stage img:nth-child(4n)   { animation-delay: -.7s; --lift: 13px; }
@keyframes bob {
  from { transform: rotate(calc(var(--r, 4deg) * -1)); }
  to   { transform: translateY(calc(var(--lift, 9px) * -1)) rotate(var(--r, 4deg)); }
}

.hero__text > * { animation: rise .9s var(--ease) backwards; }
.hero__text > :nth-child(2) { animation-delay: .08s; }
.hero__text > :nth-child(3) { animation-delay: .16s; }
.hero__text > :nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.hero__kicker, .hero__tagline { margin: 0; font-size: calc(var(--stage) * .0215); }
.hero__tagline { margin-top: .5em; }
.hero .btn { margin-top: calc(var(--stage) * .045); }

.title { font-weight: 700; line-height: .98; font-size: calc(var(--stage) * .05); letter-spacing: -.01em; margin-top: .1em; }
.title span { display: block; }
.title__colors { font-size: 1.62em; line-height: .95; letter-spacing: -.015em; }
.title__colors i { font-style: normal; }
.title__colors i:nth-child(1), .title__colors i:nth-child(7) { color: var(--coral); }
.title__colors i:nth-child(2) { color: var(--mint); }
.title__colors i:nth-child(3) { color: var(--honey); }
.title__colors i:nth-child(4) { color: var(--lilac); }
.title__colors i:nth-child(5) { color: var(--pink); }
.title__colors i:nth-child(6) { color: var(--sky); }

/* ───────── Úvodní text ───────── */

.intro { position: relative; max-width: calc(44rem + 2 * var(--gutter)); text-align: center; padding-block: clamp(24px, 4vw, 56px) clamp(40px, 5vw, 72px); }
.intro h2 { margin-bottom: .8em; }.intro__punch { font-size: clamp(1.1rem, 2vw, 1.45rem); margin: 1.4em 0 0; }

.accent { position: absolute; pointer-events: none; }

/* duplikáty kresbiček po stranách úvodního textu — navazují na hero, drží se krajů stránky */
.side {
  position: absolute; max-width: none; pointer-events: none;
  top: calc(var(--dy) * 1%); left: calc(50% - 50vw + var(--dx) * var(--u));
  width: calc(var(--w) * var(--s) * var(--u));
  animation: bob 4s ease-in-out infinite alternate;
}
.side.r { left: auto; right: calc(50% - 50vw + var(--dx) * var(--u)); }
.side.near { left: calc(100% + var(--dx) * var(--u)); }
.side:nth-of-type(odd) { animation-duration: 3.2s; animation-delay: -1.5s; --r: -4deg; }
@media (max-width: 1099px) { .side { display: none; } }   /* vedle textu už na ně není místo */
.accent--heart { width: 120px; left: -150px; top: 40px; rotate: -8deg; }
.accent--star { width: 96px; right: -140px; bottom: 110px; rotate: 10deg; }

/* ───────── O výstavě ───────── */

.about__card {
  display: grid; grid-template-columns: 4fr 7fr; gap: clamp(24px, 5vw, 80px);
  background: var(--white); border-radius: clamp(28px, 4vw, 56px);
  padding: clamp(28px, 6vw, 88px);
}
.about__head { position: sticky; top: 40px; align-self: start; }
.about__doodle { width: min(100%, 250px); margin-top: 36px; rotate: -4deg; }
.about__text > :last-child { margin-bottom: 0; }
.window {
  margin: 1.6em 0; padding: 1.1em 1.3em; border-radius: 22px;
  background: color-mix(in srgb, var(--sky) 18%, var(--white));
  font: 500 1.3rem/1.4 var(--f-display); color: var(--plum);
}

/* ───────── Galerie ───────── */

.gallery { padding-block: 0 clamp(72px, 10vw, 140px); scroll-margin-top: 24px; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(10px, 1.3vw, 18px);
}
.tile {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 210 / 297; overflow: hidden; background: var(--white);   /* A4 na výšku jako skeny kreseb */
  border-radius: clamp(12px, 1.4vw, 20px);
  box-shadow: 0 0 0 1px rgb(112 93 111 / .12);                            /* ať je vidět okraj bílého papíru */
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.tile__cap {
  position: absolute; left: 10px; bottom: 10px; padding: .35em .9em; border-radius: 99px;
  background: var(--paper); color: var(--plum); font: 500 .9rem/1.3 var(--f-display);
  opacity: 0; transform: translateY(6px); transition: .3s var(--ease);
}
.grid li:nth-child(odd) .tile:is(:hover, :focus-visible) { transform: translateY(-4px) rotate(-1.2deg); }
.grid li:nth-child(even) .tile:is(:hover, :focus-visible) { transform: translateY(-4px) rotate(1.2deg); }
.tile:is(:hover, :focus-visible) { box-shadow: 0 18px 34px -18px rgb(112 93 111 / .55); z-index: 1; }
.tile:is(:hover, :focus-visible) img { transform: scale(1.04); }
.tile:is(:hover, :focus-visible) .tile__cap { opacity: 1; transform: none; }

.thought {                         /* stejné písmo jako zvýrazněná věta v „O výstavě" */
  margin: clamp(48px, 7vw, 96px) auto; text-align: center; text-wrap: balance;
  font: 500 1.3rem/1.4 var(--f-display); color: var(--plum);
}
.thought span { display: block; }  /* na širokém displeji dva řádky, druhý začíná „na které se díváme" */
@media (max-width: 999px) { .thought span { display: inline; } }   /* užší displej: zalomit rovnoměrně podle šířky */

/* ───────── Formulář ───────── */

.feedback__card {
  position: relative; text-align: center; overflow: hidden;   /* overflow kvůli animaci výšky při odeslání */
  background: var(--lavender); border-radius: clamp(28px, 4vw, 56px);
  padding: clamp(40px, 7vw, 96px) clamp(20px, 6vw, 88px);
}
.feedback__kicker { margin: 0; font-size: 1.25rem; }
.feedback__intro { max-width: 34rem; margin: 1em auto 0; }
.accent--flower { width: 92px; left: 5%; top: 48px; rotate: -10deg; }
.accent--rainbow { width: 120px; right: 5%; top: 40px; rotate: 6deg; }

form { max-width: 34rem; margin: 36px auto 0; display: grid; gap: 22px; text-align: left; }
.field { display: grid; gap: 8px; }
.field > span, legend { font: 500 1.0625rem/1.3 var(--f-display); color: var(--plum); }
.field small { font: 400 .875rem var(--f-body); color: var(--ink); opacity: .7; }
input[type=text], textarea {
  width: 100%; padding: .9em 1.1em; border: 2px solid transparent; border-radius: 18px;
  background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.5 var(--f-body);
  transition: border-color .2s;
}
textarea { resize: vertical; min-height: 8em; }
::placeholder { color: var(--ink); opacity: .45; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--lilac); }
.invalid textarea { border-color: var(--coral); }

.rating { border: 0; margin: 0; padding: 0; min-width: 0; text-align: center; }
legend { padding: 0; margin: 0 auto 10px; }
.hearts { display: inline-flex; gap: 4px; }
.hearts label { position: relative; cursor: pointer; padding: 6px; border-radius: 50%; }
.hearts input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.hearts svg { display: block; width: 40px; height: 40px; fill: transparent; stroke: var(--c); stroke-width: 1.8; stroke-linejoin: round; transition: fill .2s, transform .25s var(--ease); }
.hearts label:has(input:checked) svg,
.hearts label:has(~ label input:checked) svg,
.hearts label:hover svg,
.hearts label:has(~ label:hover) svg { fill: var(--c); }
.hearts label:hover svg { transform: scale(1.15) rotate(-6deg); }
.hearts label:has(input:focus-visible) { outline: 3px solid var(--plum); }

form .btn { justify-self: center; margin-top: 6px; }
form .btn:disabled { opacity: .6; cursor: progress; }
.form__note { margin: -8px 0 0; text-align: center; font-size: .875rem; opacity: .7; }
.form__err { margin: 0; text-align: center; font-size: .9375rem; font-weight: 500; color: #A8402F; }

.thanks:focus { outline: none; }
.thanks__title { font: 700 clamp(2.4rem, 6vw, 3.6rem)/1.1 var(--f-display); color: var(--plum); margin-bottom: .3em; }
.thanks .btn { margin-top: 12px; }

/* ───────── Patička ───────── */

.footer { padding-block: clamp(48px, 7vw, 88px); text-align: center; font-size: .9375rem; }
.footer p { margin: 0; }
.footer__name { font: 600 1.25rem/1.4 var(--f-display); color: var(--plum); }

/* ───────── Detail kresby ───────── */

/* Okno má PEVNOU velikost (nezávisí na kresbě ani délce textu) a samo nescrolluje:
   křížek i šipky jsou pořád na stejném místě, kresba se vejde do svého pole
   a když je text dlouhý, scrolluje jen on. */
.detail {
  --gap: 16px;                          /* odstup okna od kraje obrazovky */
  --pad: clamp(16px, 3vw, 40px);        /* okraj kolem kresby */
  --cap: 760px;                         /* nejvyšší výška okna */
  --h: min(var(--cap), 100vh - 2 * var(--gap));
  width: min(1060px, 100vw - 2 * var(--gap)); height: var(--h);
  max-width: none; max-height: none;    /* vypnout výchozí strop prohlížeče, velikost určují --gap a --h */
  padding: 0; border: 0; overflow: hidden;
  border-radius: clamp(24px, 3vw, 40px); background: var(--paper); color: var(--ink);
  box-shadow: 0 40px 80px -30px rgb(59 50 52 / .5);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .3s var(--ease), transform .3s var(--ease), overlay .3s allow-discrete, display .3s allow-discrete;
}
@supports (height: 100dvh) { .detail { --h: min(var(--cap), 100dvh - 2 * var(--gap)); } }   /* dvh počítá s lištou prohlížeče na telefonu */
.detail[open] { display: flex; opacity: 1; transform: none; }
@starting-style { .detail[open] { opacity: 0; transform: translateY(14px) scale(.98); } }
.detail::backdrop { background: rgb(112 93 111 / .55); backdrop-filter: blur(6px); }

.detail__img { flex: 1.1 1 0; min-width: 0; display: grid; place-items: center; padding: var(--pad); background: var(--white); }
.detail__img img {
  width: auto; max-height: calc(var(--h) - 2 * var(--pad));
  border-radius: 14px; box-shadow: 0 14px 30px -18px rgb(59 50 52 / .5); rotate: -1deg;
}
.detail__body { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: clamp(24px, 4vw, 56px); }
.detail__text { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 12px; }  /* místo pro posuvník a křížek */
.detail__text.has-more {             /* text pokračuje níž → dole se ztrácí do ztracena */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 44px), transparent);
          mask-image: linear-gradient(#000 calc(100% - 44px), transparent);
}
.detail__author { margin: 0; font-size: 1.15rem; }
.detail h3 { font-weight: 700; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1; margin-top: .15em; }
.detail__text > p:not(.script) { margin: 0; font-size: 1.0625rem; line-height: 1.6; }
.detail h4 { margin: 1.5em 0 .35em; font: 500 1.2rem/1.25 var(--f-display); color: var(--plum); }
.detail h4.detail__label { font-size: .8125rem; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); }
.detail blockquote { margin: 0; font-size: 1.125rem; line-height: 1.65; }
.detail blockquote.is-note { font-style: italic; opacity: .8; }   /* poznámka místo slov dítěte */
.detail__nav { flex: none; display: flex; align-items: center; gap: 10px; padding-top: 24px; }
.detail__count { margin: 0 0 0 auto; font: 500 .875rem var(--f-display); color: var(--slate); letter-spacing: .06em; }
.detail__nav button, .detail__close {
  width: 52px; height: 52px; border: 0; border-radius: 50%; cursor: pointer;
  font: 500 1.35rem/1 var(--f-display); color: var(--plum); background: var(--lavender);
  transition: transform .2s var(--ease), background .2s;
}
.detail__nav button:hover, .detail__close:hover { background: var(--peach); transform: scale(1.06); }
.detail__close { position: absolute; top: 16px; right: 16px; font-size: 1.7rem; z-index: 1; }

/* ───────── Menší obrazovky ───────── */

@media (max-width: 1320px) {
  .accent--heart, .accent--star { display: none; }
}

@media (max-width: 999px) {
  /* plátno zvětšíme a necháme z něj vidět jen prostřední pás kresbiček */
  .top::before { left: -30.5%; width: 161%; }
  .stage { inset: 0 auto auto -30%; width: 161%; aspect-ratio: 1; }
  .stage img, .stage img.c, .stage img.r { left: calc(var(--x) * 1%); right: auto; top: calc(var(--y) * 1%); width: calc(var(--w) * 1%); }
  .stage .m-hide { display: none; }
  .hero { display: block; min-height: 0; padding: 47vw var(--gutter) clamp(48px, 7vw, 96px); }
  .hero .btn { margin-top: 32px; }  .hero__kicker, .hero__tagline { font-size: clamp(1rem, 3.4vw, 1.6rem); }
  .title { font-size: clamp(2.1rem, 9.4vw, 4.4rem); }

  .about__card { grid-template-columns: 1fr; }
  .about__head { position: static; }
  .about__doodle { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); max-width: 640px; margin-inline: auto; }
  .accent--flower { width: 64px; top: 20px; }
  .accent--rainbow { width: 84px; top: 16px; }
}

@media (max-width: 720px) and (orientation: portrait) {
  /* telefon na výšku: kresba nahoře v poli s pevnou výškou (--img), text pod ní, šipky přišpendlené dole */
  .detail { --cap: 820px; --img: calc(var(--h) * .44); }
  .detail[open] { flex-direction: column; }
  .detail__img { flex: none; height: calc(var(--img) + 2 * var(--pad)); }
  .detail__img img { max-height: var(--img); }
  .detail__body { flex: 1 1 auto; }
}

@media (max-width: 720px), (max-height: 520px) {
  /* malý displej (i telefon naležato): úspornější detail */
  .detail { --gap: 12px; }
  .detail__body { padding: 18px 22px 16px; }
  .detail__author { font-size: 1.05rem; }
  .detail h3 { font-size: 1.6rem; }
  .detail .bar { margin-block: 14px; }
  .detail blockquote { font-size: 1.0625rem; line-height: 1.6; }
  .detail__nav { padding-top: 14px; }
  .detail__nav button { width: 48px; height: 48px; }
  .detail__close { width: 44px; height: 44px; top: 10px; right: 10px; }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .lead { font-size: 1.1rem; }
  .accent--flower, .accent--rainbow { display: none; }  .hearts svg { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
