/* Hvězdný posel – veřejný web */
:root {
  --night-0: #040b15;
  --night-1: #071526;
  --night-2: #0c1d33;
  --panel: rgba(255, 244, 220, .035);
  --line: rgba(243, 197, 98, .28);
  --gold: #f3c562;
  --gold-soft: #ffe2a0;
  --gold-deep: #c98d2c;
  --paper: #f6e7c8;
  --muted: rgba(246, 231, 200, .72);
  --danger: #ffb4a0;
  --display: Fraunces, Georgia, serif;
  --sans: Figtree, system-ui, sans-serif;
  /* Scéna: šířka podle okna, nejvýš 16:10; vyšší okno dostane nahoře víc nebe. */
  --sw: max(100vw, calc(100svh * 1.6));
  --sh: calc(var(--sw) * 941 / 1672);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--night-0); color: var(--paper); font-family: var(--sans); }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--gold-soft); }
img { max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hlavička ---------- */
.site-header { position: absolute; z-index: 5; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
               padding: 22px clamp(16px, 4vw, 64px); }
.site-header::before { content: ""; position: absolute; inset: 0 0 -60px 0; z-index: -1; pointer-events: none;
                       background: linear-gradient(180deg, rgba(4, 10, 21, .85), rgba(4, 10, 21, .45) 55%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font-family: var(--display); font-size: 20px; letter-spacing: .04em; }
.brand svg { width: 26px; height: 26px; color: var(--gold); flex: none; }
.nav { display: flex; gap: clamp(14px, 2.4vw, 34px); align-items: center; font-weight: 600; font-size: 15px; }
.nav a { color: var(--paper); text-decoration: none; opacity: .9; }
.nav a:hover { opacity: 1; color: var(--gold-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 24px; border-radius: 999px; border: 0;
       font: 700 16px/1.2 var(--sans); text-decoration: none; cursor: pointer; }
.btn-gold { background: linear-gradient(180deg, #ffd983, #eab04a); color: #1b1606; box-shadow: 0 8px 26px rgba(240, 180, 70, .3), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { color: var(--paper); border: 1px solid rgba(246, 231, 200, .45); background: rgba(6, 12, 26, .35); }
.btn-ghost:hover { border-color: var(--gold); }
.btn[disabled] { opacity: .6; cursor: wait; }
.nav .btn { padding: 10px 18px; font-size: 14px; color: #1b1606; opacity: 1; }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }

/* ---------- Úvodní scéna ---------- */
.hero { position: relative; height: 100svh; min-height: 560px; overflow: hidden; isolation: isolate; background: var(--night-0); }
.sky { position: absolute; inset: 0;
       background: linear-gradient(180deg, #040b15 0%, #061424 45%, #0a1b2d 75%, #10243a 100%); }
.stars { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; border-radius: 50%; background: #fff6dc; box-shadow: 0 0 4px rgba(255, 236, 190, .9);
        animation: scint var(--d) ease-in-out var(--dl) infinite; }
.spark { position: absolute; width: var(--s); height: var(--s); animation: scint var(--d) ease-in-out var(--dl) infinite; }
.spark::before { content: ""; position: absolute; inset: -60%; border-radius: 50%;
                 background: radial-gradient(circle, rgba(255, 214, 120, .55), transparent 62%); }
.spark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, #fff3c4, var(--gold));
                clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); }
@keyframes scint {
  0%   { opacity: .9;  transform: scale(1) rotate(0deg); }
  11%  { opacity: .35; transform: scale(.78); }
  23%  { opacity: 1;   transform: scale(1.18) rotate(4deg); }
  36%  { opacity: .55; transform: scale(.92); }
  51%  { opacity: .95; transform: scale(1.04) rotate(-3deg); }
  64%  { opacity: .28; transform: scale(.8); }
  79%  { opacity: .85; transform: scale(1.08) rotate(2deg); }
  100% { opacity: .9;  transform: scale(1) rotate(0deg); }
}

.stage { position: absolute; width: var(--sw); height: var(--sh);
         left: calc((100vw - var(--sw)) * .28);
         top: max(calc(100svh - var(--sh)), calc((100svh - var(--sh)) * .35));
         transform: scale(1.04); transform-origin: 50% 60%; }
.layer { position: absolute; left: calc(var(--x) / 1672 * 100%); top: calc(var(--y) / 941 * 100%);
         width: calc(var(--w) / 1672 * 100%); will-change: transform; }
.rise, .sway { position: relative; }
.layer img, .layer svg.win { display: block; width: 100%; height: auto; }
.layer img { filter: var(--f, none); user-select: none; -webkit-user-drag: none; }
.layer svg.win { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 2.5s ease; }
.lights-on .layer svg.win { opacity: 1; }
.win rect { fill: #ffd27a; stroke: #ffcc66; stroke-opacity: .35; stroke-width: 3; opacity: 0; }
.win rect.always { opacity: .95; }
.win rect.cycle { animation: winA var(--d) linear var(--dl) infinite; }
.win rect.cycle.b { animation-name: winB; }
@keyframes winA { 0%, 46% { opacity: 0 } 47.5%, 96% { opacity: .95 } 97.5%, 100% { opacity: 0 } }
@keyframes winB { 0%, 18% { opacity: .95 } 19.5%, 63% { opacity: 0 } 64.5%, 100% { opacity: .95 } }

/* Úvod jako pop-up kniha: vrstvy se postaví odzadu dopředu. */
.rise { transform-origin: 50% 100%; transform: perspective(1400px) rotateX(82deg); opacity: 0;
        transition: transform 1.5s cubic-bezier(.34, 1.4, .5, 1) var(--dl), opacity .5s ease var(--dl); }
.intro-done .rise { transform: none; opacity: 1; }

.sway { animation: sway var(--sd, 14s) ease-in-out infinite alternate; }
@keyframes sway { from { transform: translate3d(calc(var(--sx, 1px) * -1), 0, 0); }
                  to   { transform: translate3d(var(--sx, 1px), var(--sy, 0px), 0); } }
.messenger .sway { animation: bob 5.5s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0) rotate(-.4deg); } to { transform: translateY(calc(var(--sh) * -.006)) rotate(.4deg); } }

/* Modravá záře oblohy pod celou kometou (ohon i hvězda); je součástí vrstvy komety, takže se posouvá s ní. */
.halo { position: absolute; z-index: -1; left: 50%; top: 50%; width: 190%; aspect-ratio: 1.7; translate: -50% -50%; border-radius: 50%; pointer-events: none;
        background: radial-gradient(closest-side, rgba(52, 86, 124, .34), rgba(40, 70, 100, .14) 45%, transparent 75%); }
.glow { position: absolute; border-radius: 50%; pointer-events: none; translate: -50% -50%;
        background: radial-gradient(circle, rgba(255, 226, 150, .75), rgba(255, 190, 80, .25) 35%, transparent 68%);
        animation: pulse var(--pd, 3.2s) ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; transform: scale(.85); } to { opacity: 1; transform: scale(1.12); } }

.grain { position: absolute; inset: 0; pointer-events: none; background: url(../scene/grain.png); opacity: .55; }
.vignette { position: absolute; inset: 0; pointer-events: none;
            background: radial-gradient(130% 95% at 50% 40%, transparent 55%, rgba(3, 6, 14, .7) 100%); }
.paused * { animation-play-state: paused !important; }

.copy { position: absolute; z-index: 4; left: 50%; top: calc(33svh + clamp(21px, 3.75vw - 10px, 48px)); width: min(720px, calc(100vw - 32px)); translate: -50% -50%; text-align: center;
        opacity: 0; transform: translateY(14px); transition: opacity 1.2s ease, transform 1.2s ease; }
.copy::before { content: ""; position: absolute; inset: -40px -70px; z-index: -1; opacity: .8;
                background: radial-gradient(closest-side, rgba(4, 10, 21, .72), rgba(4, 10, 21, .35) 60%, transparent); }
.eyebrow { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.copy h1 { font-family: var(--display); font-weight: 600; font-size: clamp(42px, 5vw, 78px); line-height: .98; margin: 14px 0 0; color: #fff4dc;
           text-shadow: 0 2px 30px rgba(255, 200, 100, .25); }
.plaque { position: absolute; z-index: 4; left: 50%; bottom: 4.5svh; translate: -50% 0; display: flex; align-items: center; gap: 22px;
          padding: 12px 12px 12px 26px; border-radius: 999px; background: rgba(6, 11, 24, .82); border: 1px solid rgba(243, 197, 98, .4);
          backdrop-filter: blur(8px); box-shadow: 0 18px 50px rgba(0, 0, 0, .5); white-space: nowrap; font-size: 16px;
          opacity: 0; transform: translateY(14px); transition: opacity 1.2s ease .3s, transform 1.2s ease .3s; }
.plaque strong { color: var(--gold-soft); }
.plaque .sep { opacity: .45; }
.site-header { opacity: 0; transform: translateY(-10px); transition: opacity 1s ease, transform 1s ease; }
.text-ready .copy, .text-ready .plaque, .text-ready .site-header { opacity: 1; transform: none; }

/* ---------- Obsah ---------- */
main.content { position: relative; background:
  url(../scene/grain.png),
  linear-gradient(180deg, #0a1628 0%, #0b1a30 40%, #0a1628 100%); background-blend-mode: soft-light, normal; }
.section { max-width: 1100px; margin: 0 auto; padding: clamp(64px, 9vw, 110px) clamp(16px, 5vw, 48px); }
.section + .section { border-top: 1px solid rgba(243, 197, 98, .12); }
.section-index { display: flex; align-items: center; gap: 14px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 18px; }
.section-index::before { content: ""; width: 34px; height: 1px; background: var(--gold); opacity: .7; }
.section h2 { font-family: var(--display); font-weight: 500; font-size: clamp(32px, 4vw, 52px); line-height: 1.08; margin: 0 0 22px; color: #fff4dc; }
.section h2 em { font-style: italic; color: var(--gold-soft); }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 720px; margin: 0 0 18px; }
.two-col { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: start; }
.story p { margin: 0 0 16px; color: var(--muted); font-size: 18px; }
.story .highlight { font-family: var(--display); font-size: 24px; color: var(--gold-soft); }

.timeline { list-style: none; margin: 10px 0 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 26px 30px; }
.timeline li::before { content: "✦"; position: absolute; left: -8px; top: 2px; color: var(--gold); font-size: 15px; line-height: 1; background: #0b1a30; }
.timeline time, .timeline .when { display: block; font-family: var(--display); font-size: 24px; color: #fff4dc; }
.timeline p { margin: 4px 0 0; color: var(--muted); }
.timeline .tbd { color: var(--gold); font-size: 14px; letter-spacing: .04em; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 10px; }
.fact { border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--panel); }
.fact span { display: block; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; font-weight: 700; }
.fact strong { display: block; font-size: 19px; line-height: 1.4; font-weight: 600; color: #fff4dc; }
.fact p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.fact a { font-size: 15px; }

.donate { display: flex; gap: 28px; align-items: center; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--panel); }
.donate img { width: 168px; height: 168px; border-radius: 10px; flex: none; background: #fff8ea; }
.donate h3 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0 0 6px; color: #fff4dc; }
.donate p { margin: 0 0 12px; color: var(--muted); }
.donate dl { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 10px; }
.donate dt { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.donate dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; color: #fff4dc; font-variant-numeric: tabular-nums; }
.donate .hint { font-size: 14px; margin: 0; }
.notice { border: 1px dashed var(--line); border-radius: 14px; padding: 26px; background: var(--panel); color: var(--muted); max-width: 760px; }
.notice strong { color: #fff4dc; }

/* ---------- Formulář ---------- */
.form-card { border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 4vw, 42px); background: rgba(6, 13, 28, .6);
             box-shadow: 0 30px 80px rgba(0, 0, 0, .35); max-width: 860px; }
.form-card h3 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0 0 4px; color: #fff4dc; }
.form-card .hint { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
fieldset { border: 0; margin: 0 0 30px; padding: 0; min-width: 0; }
legend { padding: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.grid .span-2 { grid-column: span 2; }
.grid .span-3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 14px; font-weight: 600; color: var(--paper); }
.field .req { color: var(--gold); }
input[type=text], input[type=email], input[type=tel], input[type=number], textarea, select {
  width: 100%; font: 16px/1.4 var(--sans); color: #fff8ea; background: rgba(255, 248, 234, .06); border: 1px solid rgba(246, 231, 200, .25);
  border-radius: 10px; padding: 12px 14px; }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; cursor: pointer; padding-right: 40px;
         background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
         background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { color: #1b1606; background: #fff8ea; }
input::placeholder, textarea::placeholder { color: rgba(246, 231, 200, .4); }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(243, 197, 98, .2); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: 13px; min-height: 0; }
.field .err:empty { display: none; }

.child { position: relative; border: 1px solid rgba(246, 231, 200, .16); border-radius: 14px; padding: 18px; margin-bottom: 14px; background: rgba(255, 248, 234, .025); }
.child-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.child-head strong { font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--gold-soft); }
.link-btn { background: none; border: 0; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; padding: 4px 0; text-decoration: underline; }
.link-btn:hover { color: var(--danger); }
.add-child { margin-top: 2px; }

.stepper { display: inline-flex; align-self: flex-start; align-items: center; border: 1px solid rgba(246, 231, 200, .25); border-radius: 999px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: rgba(255, 248, 234, .06); color: var(--paper); font-size: 22px; cursor: pointer; }
.stepper button:hover { background: rgba(243, 197, 98, .2); }
.stepper output { min-width: 56px; text-align: center; font-size: 18px; font-weight: 700; }

.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--muted); }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 26px; }
.form-error { color: var(--danger); font-weight: 600; }
.form-error:empty { display: none; }

.result { border: 1px solid var(--gold); border-radius: 20px; padding: clamp(22px, 4vw, 40px); background: rgba(243, 197, 98, .07); max-width: 860px; }
.result h3 { font-family: var(--display); font-weight: 500; font-size: 30px; margin: 0 0 10px; color: #fff4dc; }
.result p { color: var(--muted); }
.result .manage-link { word-break: break-all; }

/* ---------- Patička ---------- */
.site-footer { border-top: 1px solid rgba(243, 197, 98, .18); background: #050d1a; }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 42px clamp(16px, 5vw, 48px); display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; font-size: 15px; color: var(--muted); }
.footer-inner h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.footer-inner p { margin: 0 0 6px; }
.footer-inner a { color: var(--paper); }
.footer-brand { font-family: var(--display); font-size: 22px; color: #fff4dc; margin-bottom: 6px; }

/* ---------- Podstránky (úprava registrace, souhlas) ---------- */
.page { min-height: 100svh; background:
  radial-gradient(80% 50% at 70% 0%, rgba(40, 70, 100, .3), transparent 70%),
  linear-gradient(180deg, #040b15, #0b1a30); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px clamp(16px, 4vw, 64px); border-bottom: 1px solid rgba(243, 197, 98, .15); }
.page-main { max-width: 900px; margin: 0 auto; padding: clamp(40px, 6vw, 80px) clamp(16px, 5vw, 48px); }
.page-main h1 { font-family: var(--display); font-weight: 500; font-size: clamp(32px, 4.5vw, 50px); line-height: 1.1; margin: 0 0 14px; color: #fff4dc; }
.prose h2 { font-family: var(--display); font-weight: 500; font-size: 24px; color: #fff4dc; margin: 34px 0 10px; }
.prose p, .prose li { color: var(--muted); }
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.status-badge.active { background: rgba(120, 200, 140, .18); color: #a8e6b8; }
.status-badge.cancelled { background: rgba(255, 140, 120, .16); color: var(--danger); }

/* ---------- Úzké obrazovky ---------- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-inner > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  /* Telefon na výšku: scéna se posune tak, aby byl vidět posel i Špilberk. */
  :root { --sw: max(100vw, calc(100svh * 1.45)); }
  .stage { left: calc((100vw - var(--sw)) * .08); }
  /* Na telefonu posel zůstává na původním místě (na počítači je o 15 px vpravo). */
  .layer.messenger { --x: 158 !important; }
  .nav a:not(.btn) { display: none; }
  .brand { font-size: 17px; }
  .copy { top: calc(24svh + 67px); }
  .copy h1 { font-size: clamp(40px, 11vw, 56px); }
  .eyebrow { font-size: 11px; letter-spacing: .16em; }
  .plaque { flex-direction: column; gap: 10px; width: calc(100vw - 32px); white-space: normal; text-align: center; border-radius: 20px; padding: 16px; bottom: 16px; }
  .plaque .btn { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .grid .span-2 { grid-column: auto; }
  .footer-inner { grid-template-columns: 1fr; }
  .donate { flex-direction: column; align-items: flex-start; }
}

/* Scéna se přehrává celá i při omezení animací v systému (rozhodnutí Jana); vypíná se jen plynulé posouvání stránky. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
