/* =========================================================
   30 év Henkel — Ági búcsú-foalbum
   Brand: Henkel Red #E1000F · oval logo · GT Flexa-szerű tipo
   ========================================================= */

:root {
  --red: #E1000F;
  --red-deep: #A8000B;
  --black: #0A0A0A;
  --white: #FFFFFF;
  --warm-grey: #DED7D6;
  --soft-blue: #BDCDDA;
  --sage: #BFCFBE;
  --bg: #F4F1EF;
  --ink: #0A0A0A;

  --font-display: "Archivo Black", "Space Grotesk", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--ink);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body { min-height: 100vh; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ============== LOADER ============== */
.loader {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: grid; place-items: center;
  gap: 32px; grid-auto-flow: row;
  transition: opacity .8s var(--ease), visibility .8s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader__logo { width: clamp(140px, 16vw, 220px); height: auto; display: block; }
.loader__bar {
  width: 220px; height: 2px; background: rgba(0,0,0,.1); overflow: hidden;
}
.loader__bar span {
  display: block; height: 100%; width: 0%;
  background: var(--red);
  animation: load 1.4s var(--ease) forwards;
}
@keyframes load { to { width: 100%; } }

/* ============== TOP NAV ============== */
.topnav {
  position: fixed; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px 32px;
  z-index: 100;
  pointer-events: none;
}
.topnav > * { pointer-events: auto; }
.topnav__brand {
  display: inline-block;
  width: max-content;
}
.brand-oval { width: 72px; height: auto; display: block; }
.topnav__title {
  justify-self: center;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.18em;
  white-space: nowrap;
  color: var(--white);
  mix-blend-mode: difference;
}
.topnav__counter {
  justify-self: end;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--white);
  mix-blend-mode: difference;
}
.topnav__counter .sep { opacity: .4; margin: 0 4px; }

/* ============== SIDE YEAR NAV ============== */
.yearnav {
  position: fixed; left: 24px; top: 50%; transform: translateY(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 14px;
  color: var(--white);
  text-shadow: 0 1px 4px rgba(0,0,0,.7), 0 0 12px rgba(0,0,0,.4);
}
.yearnav__item {
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 0.12em;
  cursor: pointer;
  opacity: .7;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  padding: 4px 0; display: flex; align-items: center; gap: 10px;
}
.yearnav__item::before {
  content: ""; display: inline-block;
  width: 18px; height: 2px; background: rgba(255,255,255,.85);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: width .3s var(--ease), background .3s var(--ease);
}
.yearnav__item:hover { opacity: 1; }
.yearnav__item.is-active { opacity: 1; transform: translateX(4px); }
.yearnav__item.is-active::before { width: 32px; background: var(--red); }

/* on light outro page */
.page--outro ~ .yearnav, .yearnav { /* fallback handled in JS via body class */ }
body.is-light-bg .yearnav { color: var(--ink); text-shadow: 0 1px 3px rgba(255,255,255,.6); }
body.is-light-bg .yearnav__item::before { background: rgba(0,0,0,.7); box-shadow: none; }

/* ============== PROGRESS BAR ============== */
.progress {
  position: fixed; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(0,0,0,.06); z-index: 100;
}
.progress span {
  display: block; height: 100%; width: 0%;
  background: var(--red);
  transition: width .15s linear;
}

/* ============== PAGE BASE ============== */
.page {
  position: relative;
  height: 100vh; min-height: 600px;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  display: grid;
}

/* ============== INTRO ============== */
.page--intro {
  background: var(--ink);
  color: var(--white);
  place-items: center;
  text-align: center;
}
.intro__bg {
  position: absolute; inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(225,0,15,.35), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(225,0,15,.18), transparent 60%),
    var(--ink);
  filter: blur(0px);
  z-index: 0;
}
.intro__layer { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.intro__layer--back { }
.intro__layer--mid { padding: 0 6vw; text-align: center; pointer-events: none; }
.intro__layer--front { justify-content: flex-end; padding-bottom: 48px; pointer-events: none; }

.big30 {
  font-family: var(--font-display);
  font-size: clamp(280px, 56vw, 900px);
  line-height: 0.78;
  color: var(--red);
  letter-spacing: -0.04em;
  user-select: none;
  will-change: transform;
  animation: big30Float 6s var(--ease) infinite;
}
@keyframes big30Float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
}

/* word-by-word entrance for chapter headlines */
.chapter__headline .word,
.intro__title .word,
.outro__title .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-top: 0.22em;
  margin-top: -0.22em;
}
.chapter__headline .word > span,
.intro__title .word > span,
.outro__title .word > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform .9s var(--ease-out);
}
.page.is-visible .chapter__headline .word > span,
.is-loaded .intro__title .word > span,
.page--outro.is-visible .outro__title .word > span {
  transform: translateY(0);
}
.page.is-visible .chapter__headline .word:nth-child(2) > span,
.is-loaded .intro__title .word:nth-child(2) > span,
.page--outro.is-visible .outro__title .word:nth-child(2) > span { transition-delay: .1s; }
.page.is-visible .chapter__headline .word:nth-child(3) > span,
.is-loaded .intro__title .word:nth-child(3) > span,
.page--outro.is-visible .outro__title .word:nth-child(3) > span { transition-delay: .2s; }
.page.is-visible .chapter__headline .word:nth-child(4) > span,
.is-loaded .intro__title .word:nth-child(4) > span,
.page--outro.is-visible .outro__title .word:nth-child(4) > span { transition-delay: .3s; }
.page.is-visible .chapter__headline .word:nth-child(5) > span,
.is-loaded .intro__title .word:nth-child(5) > span,
.page--outro.is-visible .outro__title .word:nth-child(5) > span { transition-delay: .4s; }
.page.is-visible .chapter__headline .word:nth-child(6) > span,
.is-loaded .intro__title .word:nth-child(6) > span,
.page--outro.is-visible .outro__title .word:nth-child(6) > span { transition-delay: .5s; }

.intro__kicker {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--white);
  margin-bottom: 28px;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.intro__title {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--white);
}
.intro__sub {
  margin-top: 24px;
  font-size: clamp(15px, 1.4vw, 19px);
  font-weight: 300;
  letter-spacing: 0.02em;
  max-width: 640px;
  line-height: 1.5;
  opacity: .85;
}

.intro__hint {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: .8;
}
.intro__hint-dot { animation: scrollDot 1.8s var(--ease) infinite; }
@keyframes scrollDot {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(12px); opacity: 0; }
}

/* ============== CHAPTER ============== */
.page--chapter {
  background: transparent;
  color: var(--white);
}

.chapter__bg {
  position: fixed; inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform, opacity;
  transform: scale(1.08);
  opacity: 0;
  pointer-events: none;
}
.chapter__bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.05) 45%, rgba(0,0,0,.55) 85%, rgba(0,0,0,.75) 100%);
}

/* placeholder when no photo loaded yet */
.chapter__bg--placeholder {
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}
.chapter__bg--placeholder::before {
  content: attr(data-fallback);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,.06);
  font-family: var(--font-display);
  font-size: clamp(180px, 30vw, 480px);
  letter-spacing: -0.03em;
  z-index: 1;
}

.chapter__year {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(220px, 38vw, 620px);
  line-height: 0.78;
  color: var(--red);
  z-index: 2;
  letter-spacing: -0.04em;
  user-select: none;
  pointer-events: none;
  will-change: transform;
  white-space: nowrap;
}

.chapter__content {
  position: relative;
  z-index: 3;
  align-self: end;
  padding: 0 6vw 12vh;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  will-change: transform;
}

.chapter__kicker {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--white);
  text-transform: uppercase;
  margin-bottom: 18px;
  display: inline-block;
  padding: 10px 14px 6px 0;
  border-top: 2px solid var(--red);
}
.chapter__headline {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--white);
  max-width: 18ch;
}
.chapter__caption {
  margin-top: 22px;
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 300;
  line-height: 1.5;
  max-width: 56ch;
  color: rgba(255,255,255,.85);
}

.chapter__pagenum {
  position: absolute;
  bottom: 32px; right: 32px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,.5);
  z-index: 4;
}


/* ============== OUTRO ============== */
.page--outro {
  background: var(--bg);
  color: var(--ink);
  place-items: center;
  text-align: center;
  padding: 80px 6vw;
  position: relative;
}
.outro__confetti {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
.page--outro > *:not(.outro__confetti) { position: relative; z-index: 2; }
.outro__oval {
  width: clamp(140px, 16vw, 220px);
  margin-bottom: 40px;
}
.outro__oval img,
.outro__oval svg { width: 100%; height: auto; display: block; }
.outro__kicker {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--red);
  margin-bottom: 32px;
  text-transform: uppercase;
}
.outro__title {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 130px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: pre-line;
  max-width: 14ch;
}
.outro__title .red { color: var(--red); }
.outro__signature {
  margin-top: 48px;
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-display);
}
.outro__ps {
  margin-top: 32px;
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 300;
  font-style: italic;
  max-width: 560px;
  line-height: 1.5;
  opacity: .7;
}

.credits {
  position: absolute;
  bottom: 32px; left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-display);
  opacity: .4;
}

/* ============== TRANSITION HOOKS ============== */
.chapter__content > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.page.is-visible .chapter__content > * { opacity: 1; transform: translateY(0); }
.page.is-visible .chapter__content > *:nth-child(1) { transition-delay: .15s; }
.page.is-visible .chapter__content > *:nth-child(2) { transition-delay: .3s; }
.page.is-visible .chapter__content > *:nth-child(3) { transition-delay: .45s; }

/* intro entrance */
.intro__kicker, .intro__title, .intro__sub {
  opacity: 0; transform: translateY(30px);
  transition: opacity 1s var(--ease-out) .6s, transform 1s var(--ease-out) .6s;
}
.is-loaded .intro__kicker { opacity: 1; transform: none; transition-delay: .8s; }
.is-loaded .intro__title { opacity: 1; transform: none; transition-delay: 1s; }
.is-loaded .intro__sub { opacity: 1; transform: none; transition-delay: 1.2s; }

/* chapter bg opacity driven by JS for crossfade between chapters */

.page--chapter .chapter__year {
  opacity: 0;
  transition: opacity 1s var(--ease-out) .2s;
}
.page--chapter.is-visible .chapter__year { opacity: 1; }

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
  .topnav { padding: 16px 20px; }
  .brand-oval { width: 56px; }
  .topnav__title { font-size: 10px; letter-spacing: 0.12em; }
  .topnav__counter { font-size: 10px; }
  .yearnav { display: none; }
  .chapter__content { padding: 0 24px 80px; }
  .chapter__pagenum, .chapter__corner { right: 16px; }
  .chapter__corner { top: 16px; width: 44px; height: 44px; }

  .intro__kicker { font-size: 10px; letter-spacing: 0.18em; }
  .intro__title { font-size: clamp(40px, 12vw, 64px); }
  .intro__sub { font-size: 14px; padding: 0 8vw; }

  .big30 { font-size: clamp(220px, 70vw, 340px); }

  .chapter__year { font-size: clamp(140px, 44vw, 220px); }
  .chapter__headline { font-size: clamp(34px, 9vw, 56px); }
  .chapter__caption { font-size: 15px; }

  .outro__title { font-size: clamp(38px, 10vw, 64px); max-width: 16ch; }
  .outro__signature { font-size: 13px; letter-spacing: 0.14em; }
  .outro__ps { font-size: 14px; }
  .page--outro { padding: 80px 6vw 120px; }
  .credits { font-size: 10px; bottom: 20px; }
}

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