/* Real Solution — landing
   Paleta i jasność sterowane z main.js przez --t (0 = jasny hero, 1 = ciemna narracja).
   Wartości domyślne = motyw jasny, więc strona działa bez JS. */

:root {
  --t: 0;

  --bg: #f4f2ee;
  --ink: #0c0b12;
  --muted: #6f6c79;
  --line: #d9d5cd;
  --accent: #2a0cd0;

  --aurora: 0.35;
  --gx: 50vw;
  --gy: 40vh;

  --pad: clamp(1.5rem, 5vw, 5.5rem);
  --measure: min(1240px, 100% - 2 * var(--pad));

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;

  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Przewijanie pełnymi ekranami — jeden panel, jedna myśl. */
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Pola formularza muszą pozostać edytowalne mimo blokady zaznaczania. */
input,
textarea {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

a,
button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

/* Panele: każdy zatrzymuje się przy górnej krawędzi okna. */
.hero,
.chapter,
.contact {
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* ───────────────────────── tło ───────────────────────── */

.backdrop,
.glow,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.aurora {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(120px);
  opacity: var(--aurora);
  will-change: transform;
}

.aurora-a {
  width: 62vmax;
  height: 62vmax;
  top: -22vmax;
  right: -14vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 42%, transparent), transparent 66%);
  animation: drift-a 52s var(--ease-soft) infinite;
}

.aurora-b {
  width: 48vmax;
  height: 48vmax;
  bottom: -18vmax;
  left: -12vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 68%);
  animation: drift-b 68s var(--ease-soft) infinite;
}

.aurora-c {
  width: 34vmax;
  height: 34vmax;
  top: 42%;
  left: 46%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  animation: drift-c 44s var(--ease-soft) infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-6vw, 7vh, 0) scale(1.12); }
}

@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50%      { transform: translate3d(8vw, -5vh, 0) scale(0.94); }
}

@keyframes drift-c {
  0%, 100% { transform: translate3d(-50%, -50%, 0) scale(0.9); }
  50%      { transform: translate3d(-42%, -60%, 0) scale(1.15); }
}

/* światło podążające za kursorem — tylko urządzenia wskazujące */
.glow {
  opacity: 0;
  background: radial-gradient(
    22rem circle at var(--gx) var(--gy),
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 62%
  );
  transition: opacity 900ms var(--ease-soft);
}

@media (hover: hover) and (pointer: fine) {
  .glow.is-live { opacity: 1; }
}

.grain {
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ───────────────────────── szyna postępu ───────────────────────── */

.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  right: clamp(1rem, 2.2vw, 2rem);
  width: 1px;
  z-index: 3;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  pointer-events: none;
}

.rail-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleY(var(--p, 0));
  transform-origin: top;
  transition: transform 220ms var(--ease-soft);
}

@media (max-width: 760px) { .rail { display: none; } }

/* ───────────────────────── nagłówek ───────────────────────── */

/* Znak marki towarzyszy tylko na początku i na końcu — w środku ustępuje miejsca treści. */
.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: clamp(1.1rem, 2.6vw, 2.1rem) var(--pad);
  opacity: var(--head, 1);
  transition: opacity 600ms var(--ease-soft);
}

.masthead[data-hidden="true"] { pointer-events: none; }

.brand {
  position: relative;
  display: inline-block;
  width: clamp(104px, 11vw, 146px);
  opacity: 0;
  transform: translateY(-8px);
  animation: brand-in 1.2s var(--ease) 250ms forwards;
}

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

.brand-img-light {
  position: absolute;
  inset: 0;
  filter: brightness(0) invert(1);
  opacity: var(--t);
}

.brand-img-dark { opacity: calc(1 - var(--t)); }

@keyframes brand-in {
  to { opacity: 1; transform: none; }
}

/* ───────────────────────── hero ───────────────────────── */

main { position: relative; z-index: 2; }

.hero {
  min-height: 100svh;
  width: var(--measure);
  margin-inline: auto;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding-block: clamp(7rem, 16vh, 12rem) clamp(2rem, 6vh, 4rem);
}

.hero-title {
  margin: 0;
  opacity: var(--hero-op, 1);
  max-width: 15ch;
  font-family: var(--serif);
  font-weight: 250;
  font-size: clamp(2.6rem, 7.4vw, 6.6rem);
  line-height: 1.04;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.hero-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

/* maski słów — każde słowo wjeżdża osobno */
.w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.wi {
  display: inline-block;
  transform: translateY(112%);
  opacity: 0;
  will-change: transform;
}

[data-stagger].is-in .wi {
  transform: none;
  opacity: 1;
  transition:
    transform 1150ms var(--ease),
    opacity 800ms var(--ease-soft);
  transition-delay: calc(var(--i) * 62ms + 380ms);
}

/* Zaproszenie do scrolla: światło spadające wzdłuż nitki, bez strzałki i bez podpisu. */
.invite {
  justify-self: start;
  display: inline-block;
  padding: 0.5rem 1.25rem 0.5rem 0;
  opacity: 0;
  animation: invite-in 1.4s var(--ease) 1.5s forwards;
  transition: opacity 600ms var(--ease-soft);
}

.invite.is-gone {
  opacity: 0 !important;
  pointer-events: none;
}

.invite-track {
  position: relative;
  display: block;
  width: 1px;
  height: 4.5rem;
  overflow: hidden;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--muted) 45%, transparent),
    transparent
  );
}

.invite-spark {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.6rem;
  background: linear-gradient(to bottom, transparent, var(--accent));
  animation: spark-fall 3s var(--ease-soft) infinite;
}

.invite:hover .invite-spark { animation-duration: 1.7s; }

@keyframes invite-in {
  to { opacity: 1; }
}

@keyframes spark-fall {
  0%        { transform: translateY(-1.6rem); opacity: 0; }
  12%       { opacity: 1; }
  58%       { opacity: 1; }
  74%, 100% { transform: translateY(4.5rem); opacity: 0; }
}

/* ───────────────────────── rozdziały ───────────────────────── */

.chapters {
  width: var(--measure);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.chapter {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1.4rem, 3vw, 2.4rem);
}

/* delikatny dryf w poziomie buduje przestrzeń */
.chapter-1 { grid-column: 1 / 9; }
.chapter-2 { grid-column: 5 / 13; }
.chapter-3 { grid-column: 2 / 10; }
.chapter-4 { grid-column: 6 / 13; }

.chapter-mark {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.34em;
}

.chapter-rule {
  display: block;
  width: clamp(2.5rem, 7vw, 5.5rem);
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.4s var(--ease) 220ms;
}

[data-reveal].is-in .chapter-rule { transform: scaleX(1); }

.chapter-text {
  margin: 0;
  max-width: 19ch;
  font-family: var(--serif);
  font-weight: 250;
  font-size: clamp(1.7rem, 4vw, 3.15rem);
  line-height: 1.18;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}

/* ───────────────────────── kontakt ───────────────────────── */

.contact {
  width: var(--measure);
  margin-inline: auto;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  /* Górny prześwit trzyma treść poniżej powracającego znaku marki. */
  padding-top: clamp(6rem, 16vh, 9rem);
}

.contact-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1.4rem, 3.2vw, 2.4rem);
}

.contact-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.contact-title {
  margin: 0;
  max-width: 17ch;
  font-family: var(--serif);
  font-weight: 250;
  font-size: clamp(1.9rem, 4.6vw, 3.6rem);
  line-height: 1.14;
  letter-spacing: -0.022em;
}

.form {
  display: grid;
  gap: clamp(1.4rem, 3vw, 2rem);
  max-width: 30rem;
  margin-top: clamp(0.5rem, 2vw, 1.5rem);
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field label {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  padding: 0.55rem 0 0.7rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  transition: border-color 500ms var(--ease-soft);
}

.field input::placeholder {
  color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.field input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.send {
  position: relative;
  justify-self: start;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.send-underline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0.28);
  transform-origin: left;
  transition: transform 700ms var(--ease);
}

.send:hover .send-underline,
.send:focus-visible .send-underline { transform: scaleX(1); }

.send:focus-visible { outline: none; }

.form-note {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.85rem;
}

.contact-alt {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.contact-alt a {
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding-bottom: 1px;
  transition: color 400ms var(--ease-soft), border-color 400ms var(--ease-soft);
}

.contact-alt a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ───────────────────────── stopka ───────────────────────── */

.colophon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: clamp(1.5rem, 4vh, 2.5rem) 0 clamp(1.75rem, 5vh, 3rem);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.colophon-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

/* ───────────────────────── odsłanianie ───────────────────────── */

/* Ruch dotyczy zawartości, nie samego panelu: przesunięty panel przesuwałby
   też swój punkt zatrzymania i skok wypadałby obok. */
[data-reveal] > * {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(7px);
  transition:
    opacity 1100ms var(--ease-soft),
    transform 1300ms var(--ease),
    filter 1100ms var(--ease-soft);
}

[data-reveal].is-in > * {
  opacity: 1;
  transform: none;
  filter: none;
}

[data-reveal].is-in > *:nth-child(2) { transition-delay: 90ms; }
[data-reveal].is-in > *:nth-child(3) { transition-delay: 170ms; }
[data-reveal].is-in > *:nth-child(4) { transition-delay: 240ms; }

/* ───────────────────────── responsywność ───────────────────────── */

/* Na bardzo niskich oknach panel nie mieści treści — wtedy wolne przewijanie. */
@media (max-height: 540px) {
  html { scroll-snap-type: none; }
}

@media (max-width: 860px) {
  .chapter,
  .chapter-1,
  .chapter-2,
  .chapter-3,
  .chapter-4 { grid-column: 1 / -1; }

  .chapter-text { max-width: 100%; }
  .hero-title { max-width: 100%; }
}

/* ───────────────────────── mniej ruchu ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .brand,
  .invite { opacity: 1; }

  .wi { transform: none; opacity: 1; }
  .chapter-rule { transform: scaleX(1); }

  .invite-spark {
    animation: none;
    transform: translateY(1.45rem);
    opacity: 1;
  }

  [data-reveal] > * { opacity: 1; transform: none; filter: none; }

  .glow { display: none; }
}
