@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
  color-scheme: dark;
  --paper: #f4f0e7;
  --muted: rgba(244, 240, 231, .68);
  --line: rgba(255, 255, 255, .2);
  --accent: #f0a83a;
  --ink: #101512;
}

* { box-sizing: border-box; }
html { margin: 0; width: 100%; min-height: 100%; background: #101512; overflow-x: hidden; overscroll-behavior-x: none; }
body { margin: 0; width: 100%; min-height: 100%; color: var(--paper); font-family: "DM Sans", system-ui, sans-serif; overflow-x: clip; overflow-y: auto; overscroll-behavior-x: none; overscroll-behavior-y: auto; }
button, a { color: inherit; font: inherit; }
button { border: 0; }

.story, .stage { width: 100%; height: 100vh; height: 100svh; }
.stage { position: relative; isolation: isolate; max-width: 100vw; overflow: hidden; background: #182019; touch-action: pan-y pinch-zoom; }
.photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: var(--photo-fit, cover);
  object-position: var(--photo-position, center); opacity: 1; transform: translateX(var(--drag-x, 0px)) scale(1.005);
  transition: opacity .28s ease, transform .44s cubic-bezier(.22,.75,.22,1);
  user-select: none; -webkit-user-drag: none; will-change: transform, opacity;
}
.photo.dragging { transition: none; }
.photo.exit-left { opacity: 0; transform: translateX(-10vw) scale(1.015); }
.photo.exit-right { opacity: 0; transform: translateX(10vw) scale(1.015); }
.photo.enter-right { opacity: 0; transform: translateX(10vw) scale(1.015); }
.photo.enter-left { opacity: 0; transform: translateX(-10vw) scale(1.015); }
.shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 10, 7, .7) 0%, transparent 27%),
    linear-gradient(90deg, rgba(6, 11, 8, .9) 0%, rgba(6, 11, 8, .45) 37%, transparent 68%),
    linear-gradient(0deg, rgba(5, 9, 6, .8) 0%, transparent 29%);
  pointer-events: none;
}

.topbar { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) clamp(22px, 4vw, 64px) 0; pointer-events: none; }
.topbar a, .topbar button { pointer-events: auto; }
.brand { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
.eyebrow-link { width: fit-content; text-decoration: none; }
.eyebrow-link:hover, .eyebrow-link:focus-visible { color: var(--paper); outline: none; }
.title { color: inherit; text-decoration: none; font-family: "Playfair Display", Georgia, serif; font-size: clamp(20px, 2vw, 29px); letter-spacing: -.02em; }
.title:hover, .title:focus-visible, .author-name:hover, .author-name:focus-visible { color: var(--accent); outline: none; }
.author { display: block; color: rgba(244, 240, 231, .58); font-size: 13px; font-weight: 500; }
.stage.cinema-mode .title { margin-bottom: 8px; }
.stage.cinema-mode .author { margin: 0; letter-spacing: .07em; text-transform: uppercase !important; }
.stage.cinema-mode .author-label,
.stage.cinema-mode .author-name { text-transform: uppercase !important; }
.stage.cinema-mode .author-label { color: rgba(244, 240, 231, .62); }
.stage.cinema-mode .author-name { color: #fff3dc; font-weight: 600; text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.overview-button, .view-button, .home-button, .close-button { background: rgba(10, 14, 11, .42); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; }
.overview-button, .view-button, .home-button { display: flex; align-items: center; gap: 10px; border-radius: 999px; padding: 11px 16px; font-size: 12px; letter-spacing: .04em; }
.home-button { color:inherit; text-decoration:none; }
.home-icon { font-size: 17px; line-height: 1; transform: translateY(-1px); }
.overview-button:hover, .overview-button:focus-visible, .view-button:hover, .view-button:focus-visible, .home-button:hover, .home-button:focus-visible, .close-button:hover, .close-button:focus-visible { background: rgba(255,255,255,.16); outline: none; }
.view-icon { width: 14px; height: 10px; border: 1px solid currentColor; box-shadow: inset 0 0 0 2px rgba(10,14,11,.65); }
.grid-icon { display: grid; grid-template-columns: repeat(2, 4px); gap: 3px; }
.grid-icon i { width: 4px; height: 4px; background: currentColor; border-radius: 1px; }

.caption-card { position: absolute; z-index: 2; left: clamp(22px, 6vw, 92px); top: 50%; transform: translateY(-48%); width: min(570px, 44vw); }
.count { display: flex; gap: 7px; align-items: baseline; margin-bottom: 24px; font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.count #currentNumber { color: var(--paper); font-family: "Playfair Display", Georgia, serif; font-size: clamp(34px, 4vw, 58px); letter-spacing: -.04em; line-height: 1; }
.slash { color: var(--accent); }
.caption-copy { border-left: 2px solid var(--accent); padding-left: clamp(20px, 2.4vw, 36px); }
.caption-copy p { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: clamp(20px, 2.15vw, 34px); line-height: 1.34; white-space: pre-line; text-wrap: pretty; text-shadow: 0 2px 20px rgba(0,0,0,.3); }

.navigation { position: absolute; z-index: 2; left: clamp(22px, 4vw, 64px); right: clamp(22px, 4vw, 64px); bottom: max(25px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 18px; }
.nav-button { display: flex; gap: 9px; align-items: center; padding: 8px 0; background: transparent; cursor: pointer; color: rgba(255,255,255,.82); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.nav-button:hover, .nav-button:focus-visible { color: #fff; outline: none; }
.nav-button:disabled { opacity: .3; cursor: default; }
.progress { flex: 1; height: 1px; background: var(--line); overflow: hidden; }
.progress div { width: 5%; height: 100%; background: var(--accent); transform-origin: left; transition: width .45s ease; }
.hint { position: absolute; right: clamp(22px, 4vw, 64px); bottom: 69px; z-index: 2; font-size: 10px; letter-spacing: .09em; color: var(--muted); transition: opacity .5s; }
.hint.hidden { opacity: 0; }

@media (min-width: 761px) {
  .stage:is(.caption-right-middle, .caption-right-top, .caption-right-bottom):not(.fit-mode) .caption-card {
    left: auto;
    right: clamp(22px, 6vw, 92px);
  }
  .stage:is(.caption-right-middle, .caption-right-top, .caption-right-bottom):not(.fit-mode) .count { justify-content: flex-end; }
  .stage:is(.caption-right-middle, .caption-right-top, .caption-right-bottom):not(.fit-mode) .shade {
    background:
      linear-gradient(180deg, rgba(5, 10, 7, .7) 0%, transparent 27%),
      linear-gradient(270deg, rgba(6, 11, 8, .9) 0%, rgba(6, 11, 8, .45) 37%, transparent 68%),
      linear-gradient(0deg, rgba(5, 9, 6, .8) 0%, transparent 29%);
  }
  .stage:is(.caption-left-top, .caption-right-top):not(.fit-mode) .caption-card {
    top: clamp(118px, 15vh, 168px);
    bottom: auto;
    transform: none;
  }
  .stage:is(.caption-left-bottom, .caption-right-bottom):not(.fit-mode) .caption-card {
    top: auto;
    bottom: clamp(92px, 12vh, 132px);
    transform: none;
  }
}
.stage.no-captions .caption-copy { display: none; }
.stage.no-captions.fit-mode { grid-template-columns: 1fr; }
.stage.no-captions.fit-mode .photo { grid-column: 1; }
.stage.no-captions.fit-mode .caption-card { position: absolute; left: auto; right: clamp(22px, 4vw, 64px); top: auto; bottom: 72px; width: auto; height: auto; padding: 0; background: transparent; }
.stage.no-captions.fit-mode .count { margin: 0; }
.stage.no-captions.fit-mode .navigation { left: clamp(22px, 4vw, 64px); right: clamp(22px, 4vw, 64px); width: auto; }
.stage.no-captions.fit-mode .hint { right: clamp(22px, 4vw, 64px); }

/* Vágás nélküli, szerkesztőségi nézet */
.stage.fit-mode { display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 30vw, 480px); background: #090c0a; }
.stage.fit-mode .photo {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  align-self: stretch;
  justify-self: stretch;
  padding: clamp(118px, 11vh, 150px) clamp(24px, 4vw, 64px) clamp(70px, 8vh, 100px);
  object-fit: contain;
  object-position: center;
}
.stage.fit-mode .shade { display: none; }
.stage.fit-mode .topbar { color: var(--paper); }
.stage.fit-mode .author { margin-top: 0; margin-bottom: 0; letter-spacing: .07em; text-transform: uppercase !important; }
.stage.fit-mode .author-label,
.stage.fit-mode .author-name { text-transform: uppercase !important; }
.stage.fit-mode .author-label { color: rgba(244, 240, 231, .58); }
.stage.fit-mode .author-name { color: rgba(244, 240, 231, .9); text-decoration: none; }
.stage.fit-mode .caption-card { position: relative; grid-column: 2; grid-row: 1; left: auto; top: auto; transform: none; width: auto; height: 100%; padding: clamp(105px, 14vh, 155px) clamp(28px, 3vw, 52px) 100px; display: flex; flex-direction: column; justify-content: center; background: #182019; }
.stage.fit-mode .count { margin-bottom: 20px; }
.stage.fit-mode .count #currentNumber { font-size: clamp(30px, 3vw, 46px); }
.stage.fit-mode .caption-copy { border-left-width: 1px; padding-left: clamp(18px, 2vw, 28px); max-height: min(58vh, 620px); overflow: auto; scrollbar-width: thin; }
.stage.fit-mode .caption-copy p { font-family: "DM Sans", system-ui, sans-serif; font-size: clamp(14px, 1.15vw, 17px); line-height: 1.62; text-shadow: none; }
.stage.fit-mode .navigation { left: auto; right: clamp(28px, 3vw, 52px); width: calc(clamp(330px, 30vw, 480px) - clamp(56px, 6vw, 104px)); }
.stage.fit-mode .hint { right: calc(clamp(330px, 30vw, 480px) + clamp(22px, 4vw, 64px)); }
.stage.fit-mode .view-button { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.overview { width: 100vw; max-width: 100vw; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: #111713; color: var(--paper); overflow-x: hidden; overflow-y: auto; overscroll-behavior-x: none; touch-action: pan-y pinch-zoom; }
.overview::backdrop { background: #111713; }
.overview[open] { animation: reveal .3s ease; }
.overview-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 26px clamp(22px, 4vw, 64px) 20px; background: linear-gradient(#111713 70%, transparent); }
.overview h2 { margin: 4px 0 0; font: 600 clamp(28px, 4vw, 54px)/1.1 "Playfair Display", Georgia, serif; }
.close-button { width: 45px; height: 45px; border-radius: 50%; font-size: 28px; line-height: 1; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; min-width: 0; gap: 12px; padding: 14px clamp(22px, 4vw, 64px) 64px; }
.thumb { position: relative; min-width: 0; border: 1px solid transparent; padding: 0; background: #1a211c; cursor: pointer; overflow: hidden; aspect-ratio: 3 / 2; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .76; transition: opacity .2s, transform .35s; }
.thumb span { position: absolute; left: 12px; bottom: 9px; font: 600 17px "Playfair Display", Georgia, serif; text-shadow: 0 1px 8px #000; }
.thumb:hover img, .thumb:focus-visible img { opacity: 1; transform: scale(1.03); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb.active { border-color: var(--accent); }
.rights-note { margin: -30px clamp(22px, 4vw, 64px) 50px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

@keyframes reveal { from { opacity: 0; } }

@media (max-width: 760px) {
  body { height: 100svh; }
  .story {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100svh;
    overflow: hidden;
  }
  .shade { background: linear-gradient(180deg, rgba(5,9,6,.72) 0%, transparent 24%), linear-gradient(0deg, rgba(5,9,6,.96) 0%, rgba(5,9,6,.64) 48%, transparent 76%); }
  .overview-button, .view-button { width: 43px; height: 43px; justify-content: center; padding: 0; border-radius: 50%; }
  .home-button { width: 43px; height: 43px; justify-content: center; padding: 0; border-radius: 50%; }
  .home-label { display: none; }
  .overview-label { display: none; }
  .view-button > :last-child { display: none; }
  .caption-card { left: 22px; right: 22px; top: auto; bottom: 89px; width: auto; transform: none; }
  .count { margin-bottom: 12px; }
  .count #currentNumber { font-size: 31px; }
  .caption-copy { max-height: min(35vh, 280px); overflow: auto; padding-left: 17px; padding-right: 2px; scrollbar-width: thin; }
  .caption-copy p { font-family: "DM Sans", system-ui, sans-serif; font-size: clamp(14px, 3.7vw, 18px); line-height: 1.48; }
  .navigation { gap: 12px; }
  .nav-label, .hint { display: none; }
  .navigation {
    left: 18px;
    right: 18px;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px));
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    align-items: center;
  }
  .nav-button { width: 36px; height: 36px; justify-content: center; font-size: 23px; padding: 0; }
  .nav-button.next { justify-self: end; }
  .progress { width: 100%; transform: translateY(2px); }
  .thumbs { grid-template-columns: repeat(2, 1fr); gap: 7px; }

  .stage.fit-mode { display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, calc(100svh - var(--mobile-caption-height, 34svh))) minmax(0, var(--mobile-caption-height, 34svh)); }
  .stage.fit-mode .photo { grid-column: 1; grid-row: 1; height: 100%; padding: 104px 14px 12px; }
  .stage.fit-mode .caption-card {
    grid-column: 1;
    grid-row: 2;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    height: 100%;
    padding: 20px 22px 68px;
    justify-content: flex-start;
  }
  .stage.no-captions.fit-mode .caption-card {
    position: relative;
    grid-column: 1;
    grid-row: 2;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    height: 100%;
    padding: 14px 22px 56px;
    background: #182019;
  }
  .stage.no-captions.fit-mode .count { margin: 0; }
  .stage.fit-mode .count { margin-bottom: 10px; }
  .stage.fit-mode .count #currentNumber { font-size: 27px; }
  .stage.fit-mode .caption-copy { min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; padding-left: 15px; }
  .stage.fit-mode .caption-copy p { font-size: 13px; line-height: 1.52; }
  .stage.fit-mode .navigation {
    left: 18px;
    right: 18px;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px));
    width: auto;
  }
  .stage.fit-mode .hint { display: none; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .topbar { padding-top: 14px; }
  .caption-card { top: 47%; width: min(640px, 60vw); }
  .count { margin-bottom: 9px; }
  .count #currentNumber { font-size: 30px; }
  .caption-copy p { font-family: "DM Sans", system-ui, sans-serif; font-size: 15px; line-height: 1.4; }
  .navigation { bottom: 12px; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.stage.image-only { display: block; background: #090c0a; }
.stage.image-only .photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  padding: 0;
}
.stage.image-only .shade,
.stage.image-only .topbar,
.stage.image-only .caption-card,
.stage.image-only .navigation,
.stage.image-only .hint { display: none !important; }
