/* Jasny motyw = lager, ciemny = stout */
:root {
  --bg: #f2a900;
  --bg-deep: #e08d00;
  --ink: #2a1703;
  --foam: #fff8e8;
  --sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b120b;
    --bg-deep: #120b06;
    --ink: #f4dca8;
    --foam: #d9b98a;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 55%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 1.6rem 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

header span:last-child {
  opacity: 0.6;
}

main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 10vh;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 10.5vw, 9.5rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.big {
  position: relative;
  display: inline-block;
}

.scribble {
  position: absolute;
  left: -1%;
  bottom: -0.12em;
  width: 102%;
  height: 0.28em;
  overflow: visible;
}

.scribble path {
  fill: none;
  stroke: var(--foam);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw 0.9s 0.4s ease-out forwards;
}

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

main p {
  margin: 2.4rem 0 0;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  font-weight: 500;
  opacity: 0.8;
}

/* Napis składany z pikseli (app.js). Bez JS zwykły tekst. */
#px {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.js #px.on {
  opacity: 1;
}

.js h1 {
  color: transparent;
}

.js main p {
  opacity: 0;
  transform: translateY(8px);
}

.js .scribble path {
  animation: none;
}

.ready h1 {
  color: var(--ink);
  transition: color 0.5s;
}

.ready #px,
.js.ready #px.on {
  opacity: 0;
  transition: opacity 0.6s;
}

.ready main p {
  opacity: 0.8;
  transform: none;
  transition: opacity 0.7s 0.35s, transform 0.7s 0.35s;
}

.ready .scribble path {
  animation: draw 0.9s 0.3s ease-out forwards;
}

/* Bąbelki — powoli, bez przesady */
.bubbles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bubbles i {
  position: absolute;
  bottom: -20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--foam);
  opacity: 0;
  animation: rise linear infinite;
}

.bubbles i:nth-child(1) { left: 8%; animation-duration: 14s; animation-delay: 0s; }
.bubbles i:nth-child(2) { left: 17%; width: 5px; height: 5px; animation-duration: 11s; animation-delay: 3s; }
.bubbles i:nth-child(3) { left: 29%; width: 10px; height: 10px; animation-duration: 17s; animation-delay: 6s; }
.bubbles i:nth-child(4) { left: 41%; width: 6px; height: 6px; animation-duration: 12s; animation-delay: 1s; }
.bubbles i:nth-child(5) { left: 53%; animation-duration: 15s; animation-delay: 8s; }
.bubbles i:nth-child(6) { left: 62%; width: 4px; height: 4px; animation-duration: 10s; animation-delay: 4s; }
.bubbles i:nth-child(7) { left: 71%; width: 9px; height: 9px; animation-duration: 16s; animation-delay: 2s; }
.bubbles i:nth-child(8) { left: 79%; width: 5px; height: 5px; animation-duration: 13s; animation-delay: 7s; }
.bubbles i:nth-child(9) { left: 86%; animation-duration: 18s; animation-delay: 5s; }
.bubbles i:nth-child(10) { left: 93%; width: 6px; height: 6px; animation-duration: 12s; animation-delay: 9s; }
.bubbles i:nth-child(11) { left: 36%; width: 4px; height: 4px; animation-duration: 9s; animation-delay: 11s; }
.bubbles i:nth-child(12) { left: 66%; width: 7px; height: 7px; animation-duration: 14s; animation-delay: 12s; }

@keyframes rise {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.45;
  }
  50% {
    transform: translate(10px, -50vh);
  }
  90% {
    opacity: 0.35;
  }
  100% {
    transform: translate(-6px, -105vh);
    opacity: 0;
  }
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

@media (max-width: 600px) {
  header,
  main {
    padding-left: 1.3rem;
    padding-right: 1.3rem;
  }
  header {
    padding-top: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubbles {
    display: none;
  }
  .scribble path {
    animation: none;
    stroke-dashoffset: 0;
  }
}
