/* ---------- Zmienne ---------- */
:root {
  --cream: #f3e9d0;
  --light-cream: #f0ede6;
  --ink: #2F2A22;

  /* czas przejścia pasa z sekcjami (rusza dopiero, gdy litery zaczną odlatywać) */
  --slide-delay: 420ms;
  --slide-time: 1000ms;
  --slide-ease: cubic-bezier(0.77, 0, 0.18, 1);
}

/* ---------- Baza ---------- */
html, body {
  height: 100%;
  overflow: hidden;            /* brak scrollowania */
  background: var(--cream);
  overscroll-behavior: none;
  touch-action: none;
}

body {
  font-family: "Passion One", Impact, "Arial Black", sans-serif;
  color: var(--ink);
}

h1 {
  font-size: 28px;
}

p, button {
    font-size: 20px;
}

/* ---------- Nagłówek ---------- */
.site-header {
  background: transparent;
  padding: 1rem 8em;
}

.site-logo {
  display: inline-block;
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: clamp(1rem, 4vw, 2.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  position: relative;
  padding: 0.25rem 0;
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] { opacity: 1; }
.site-nav a[aria-current="true"]::after { transform: scaleX(1); }

.site-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.25s ease;
}

.site-cart:hover { transform: translateY(-2px); }

.site-logo:focus-visible,
.site-nav a:focus-visible,
.site-cart:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* ---------- Sekcje ---------- */
.viewport {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* pas z sekcjami (n sekcji = n * 100% wysokości ekranu) */
.slider {
  --i: 0;                      /* numer aktualnej sekcji */
  --n: 4;                      /* liczba sekcji */
  height: calc(var(--n) * 100%);
  transform: translateY(calc(var(--i) * -100% / var(--n)));
  transition: transform var(--slide-time) var(--slide-ease) var(--slide-delay);
  will-change: transform;
}

.section {
  --dir: 1;                    /* 1 = w dół strony, -1 = z powrotem */
  --fly: calc(var(--dir) * -80vh);
  height: calc(100% / var(--n));
  background: radial-gradient(var(--light-cream), transparent);
  position: relative;
  display: block;
}

.section__content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    position: absolute;
    bottom: 0;
    z-index: 1;                  /* tekst i przyciski nad modelem 3D */
    padding:  4em 8em;
}

.product__buttons {
    display: flex;
    gap: 1em;
    align-items: flex-end;
}

.product__button {
    padding: .5em 1em;
    background: none;
    border: none;
    color: var(--ink);
    border: 2px solid var(--ink);
}

.product__content, .product__content p {
  max-width: 60%;
}


.buy-now {
    background-color: var(--ink);
    color: var(--cream);
}

.section h1 {
  margin: 0 0 .2em;
  font-size: clamp(3rem, 10vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.word { display: inline-block; white-space: nowrap; }

/* ---------- Model 3D (product__presentation) ---------- */
.product__presentation {
  position: absolute;
  inset: 0;                    /* kontener na całą sekcję, model w jej środku */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;        /* nie zasłania przycisków */
  perspective: 800px;       /* potrzebne do pochylenia modelu */
}

/* grafika w sekcji 1: na środku ekranu, maksymalnie 800 px szerokości */
.product__presentation img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(800px, 90vw);
  max-height: 80vh;            /* na niskich ekranach nie wchodzi pod nagłówek */
  object-fit: contain;
}

.product__presentation model-viewer {
  width: min(60vw, 560px);
  height: min(52vh, 560px);
  background: transparent;
  --poster-color: transparent;
  pointer-events: auto;        /* model można obracać myszą / palcem */
  --model-tilt: 14deg;         /* pochylenie: góra odchylona do tyłu, dół wysunięty do przodu */
  rotate: 1 0 0 var(--model-tilt);
  animation: modelFloat 5s ease-in-out infinite;
}

/* lekkie unoszenie i opadanie (pętla bez skoku: 100% = 0%) */
@keyframes modelFloat {
  0%, 100% { translate: 0 10px; }
  50%      { translate: 0 -10px; }
}

/* komunikat, gdy model lub biblioteka się nie wczytają */
.product__presentation[data-state="error"]::after {
  content: attr(data-msg);
  max-width: 24ch;
  text-align: center;
  font-size: 18px;
  opacity: 0.7;
}

/* ---------- Litery ---------- */
.ch {
  --x: calc(var(--k) * 0.14em);    /* rozsunięcie na boki od środka napisu */
  --y: calc(var(--ry) * 0.3em);    /* losowo wyżej lub niżej */
  --de: calc(var(--enter-base, 800ms) + var(--i) * 28ms);
  display: inline-block;
  opacity: 0;
  will-change: transform, opacity;
}

.section.active .ch { opacity: 1; }

/* wejście: litery wpływają od dołu na swoje miejsce */
.section.entering .ch {
  animation: letterEnter 800ms cubic-bezier(0.16, 1, 0.3, 1) var(--de) both;
}

/* wyjście: najpierw delikatne rozsunięcie, potem wszystkie lecą w górę */
.section.leaving .ch {
  animation: letterLeave 1200ms linear var(--dl) both;
}

@keyframes letterEnter {
  from { transform: translateY(calc(var(--dir) * 70px)); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes letterLeave {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  38% {
    transform: translate(var(--x), var(--y)) rotate(var(--rot));
    opacity: 1;
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.35);
  }
  100% {
    transform: translate(var(--x), calc(var(--y) + var(--fly))) rotate(var(--rot));
    opacity: 0;
  }
}

/* ---------- Akapity i przyciski (product__content, product__buttons) ---------- */
.product__content p,
.product__button {
  --bo: 180ms;                 /* opóźnienie wejścia względem początku napisu */
  --lo: 260ms;                 /* opóźnienie wyjścia (po starcie liter nagłówka) */
  --leave-time: 1400ms;        /* czas animacji wyjścia */
  --leave-drop: 22px;          /* o ile tekst najpierw opada */
  --leave-lift: 0.3;           /* jak wysoko potem wypływa (ułamek 80vh), zawsze w górę */
  opacity: 0;
  will-change: transform, opacity;
}

.product__button { --bo: 300ms; --lo: 340ms; }
.product__button + .product__button { --bo: 380ms; --lo: 420ms; }

.section.active .product__content p,
.section.active .product__button { opacity: 1; }

.section:not(.active) .product__button { pointer-events: none; }

/* wejście: wpływają od dołu, tak jak litery nagłówka */
.section.entering .product__content p,
.section.entering .product__button {
  animation: blockEnter 700ms cubic-bezier(0.16, 1, 0.3, 1)
             calc(var(--enter-base, 800ms) + var(--bo)) both;
}

/* wyjście: lekko opadają, potem wypływają do góry */
.section.leaving .product__content p,
.section.leaving .product__button {
  animation: blockLeave var(--leave-time) linear var(--lo) both,
             blockFade  var(--leave-time) linear var(--lo) both;
}

@keyframes blockEnter {
  from { transform: translateY(calc(var(--dir) * 70px)); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes blockLeave {
  0% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  30% {
    transform: translateY(var(--leave-drop));
    animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6);
  }
  100% {
    transform: translateY(calc(var(--leave-lift) * -80vh));
  }
}

/* zanikanie dopiero pod koniec, żeby tekst był widoczny jak najdłużej */
@keyframes blockFade {
  0%, 65% { opacity: 1; animation-timing-function: ease-in; }
  100%    { opacity: 0; }
}

/* ---------- Animacja nagłówka: element po elemencie, od lewej do prawej ---------- */
.hd-item { opacity: 0; }

.site-header.is-in .hd-item {
  opacity: 1;
  animation: headerIn 800ms cubic-bezier(0.16, 1, 0.3, 1) calc(150ms + var(--hi) * 120ms) backwards;
}

@keyframes headerIn {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ---------- Kropki nawigacji ---------- */
.dots {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  z-index: 10;
}

.dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s ease;
}

.dot[aria-current="true"] { background: var(--ink); }
.dot:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------- Ograniczenie ruchu ---------- */
@media (prefers-reduced-motion: reduce) {
  .slider { transition-duration: 1ms; transition-delay: 0s; }
  .section .ch,
  .section .product__content p,
  .section .product__button { animation: none !important; }
  .site-header.is-in .hd-item { animation: none; }
  .product__presentation model-viewer { animation: none; }
}

/* ---------- WordPress: pasek administratora (dla zalogowanych) ---------- */
.admin-bar .site-header { top: 32px; }

.admin-bar .viewport {
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
  .admin-bar .viewport {
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
  }
}
