/* ============================================================
   EUGENIO SHAPOVAL — Full Portfolio
   Dark · Apple-like · Mobile-first · Zero dependencies
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --c-bg:      #faf9f6;
  --c-alt:     #f2f0ea;
  --c-surface: #fbfbfb;
  --c-surface-hover: #ececE4;
  --c-border:  rgba(10,10,10,0.09);
  --c-border-strong: rgba(10,10,10,0.35);
  --c-text:    #17150f;
  --c-sub:     #6b675e;
  --c-muted:   #a19c8f;
  --c-accent:  #8a6a42;
  --c-white:   #0a0a0a;
  --c-btn-bg:   #17150f;
  --c-btn-text: #faf9f6;
  --c-nav-bg:      rgba(250,249,246,0.88);
  --c-menu-bg:     rgba(250,249,246,0.98);
  --c-menu-text:   rgba(10,10,10,0.85);
  --c-menu-border: rgba(10,10,10,0.07);
  --nav-h:     60px;
  --ease:      cubic-bezier(.16, 1, .3, 1);
  --r-sm:      8px;
  --r-md:      16px;
  --r-lg:      24px;
  color-scheme: light;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* Home (intro) view is a single, non-scrolling screen; the series
   sub-page below still needs normal document scrolling. */
body.is-home { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
img    { max-width: 100%; display: block; }
a      { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
ul     { list-style: none; }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.container         { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 680px; }
.section           { padding: 100px 0; background: var(--c-bg); }
.section--alt      { background: var(--c-alt); }

.section__label {
  display: block; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c-muted); margin-bottom: 20px;
}
.section__title {
  font-size: clamp(32px, 5vw, 60px); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.06; margin-bottom: 32px; max-width: 860px;
}
.section__text {
  font-size: clamp(16px, 1.3vw, 19px); line-height: 1.72;
  color: var(--c-sub); max-width: 640px; margin-bottom: 16px;
}
.section__muted { color: var(--c-muted); }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION
══════════════════════════════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 200;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.nav.is-scrolled {
  background: var(--c-nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--c-border);
}
.nav__inner {
  padding: 0 clamp(24px, 4vw, 56px);
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.nav__logo {
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--c-text); position: relative; z-index: 210; white-space: nowrap;
  transition: color 0.2s ease;
}

.nav__right { display: flex; align-items: center; gap: 28px; }
.nav__menu { display: flex; align-items: center; gap: 28px; }
.nav__menu a {
  font-size: 13px; color: var(--c-sub);
  transition: color 0.2s ease; white-space: nowrap;
}
.nav__menu a:hover { color: var(--c-text); }
.nav__menu a.is-active { color: var(--c-text); font-weight: 600; }
/* "Gallery" only exists as a tab on the mobile bottom bar — the
   gallery is already the always-visible right column on desktop. */
.nav__gallery-link { display: none; }

.lang      { display: flex; align-items: center; gap: 5px; }
.lang__sep { color: var(--c-muted); font-size: 12px; transition: color 0.2s ease; }
.lang__btn {
  font-size: 12px; letter-spacing: 0.06em; color: var(--c-muted);
  transition: color 0.2s ease; padding: 4px 2px; min-width: 28px; text-align: center;
}
.lang__btn.is-active { color: var(--c-text); font-weight: 600; }
.lang__btn:hover     { color: var(--c-text); }

/* ══════════════════════════════════════════════════════════════
   INTRO — first screen: text (left) + all series (right)
══════════════════════════════════════════════════════════════ */
.intro {
  --intro-pad: clamp(24px, 4vw, 56px);
  --intro-pad-top: calc(var(--intro-pad) * 0.6);
  position: relative;
  height: 100svh; min-height: 560px;
  /* top clears the fixed header, then adds a (smaller) gap before the first strip */
  padding: calc(var(--nav-h) + var(--intro-pad-top)) var(--intro-pad) var(--intro-pad);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr;
  gap: var(--intro-pad);
  background: var(--c-bg);
  overflow: hidden;
}

.intro__text {
  position: relative;
}

/* Panels stack on top of each other; only .is-active is shown.
   Switching sections hides the current panel first, then fades
   the next one in — an animated swap instead of a page navigation. */
.intro-panel {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  max-width: 640px;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  pointer-events: none;
}
/* JS measures real overflow and flags it here — centering only holds
   while everything fits; a panel taller than its box (e.g. the CV)
   aligns to the top instead, so it scrolls from its own start rather
   than clipping the beginning under a false center. */
.intro-panel.is-overflowing {
  justify-content: flex-start;
}
.intro-panel.is-active {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
/* Every panel but the quote can grow taller than the viewport (e.g.
   the CV), so it scrolls internally — the page itself never scrolls.
   The native scrollbar is hidden; the pulsing hint below is the only
   affordance that the panel can be scrolled. */
.intro-panel:not([data-panel="home"]) {
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.intro-panel:not([data-panel="home"])::-webkit-scrollbar {
  display: none;
}

/* Sits as the last item in the scrolling content, pinned to the
   bottom of the visible area via position:sticky. JS toggles
   .is-visible only when the panel actually has more to scroll to
   (the hint's own height is excluded from that measurement, so it
   can never falsely trigger its own visibility). */
.intro-panel__scroll-hint {
  position: sticky; bottom: 0; left: 0; right: 0;
  display: block; height: 36px; margin-top: 6px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--c-bg) 65%);
  opacity: 0; transition: opacity 0.3s ease;
}
.intro-panel__scroll-hint.is-visible { opacity: 1; }
.intro-panel__scroll-hint::after {
  content: ''; position: absolute; bottom: 8px; left: 2px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--c-text);
  animation: scroll-bounce 1.6s ease-in-out infinite;
}
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0);    opacity: 0.35; }
  50%      { transform: translateY(6px);  opacity: 1; }
}

.intro__quote {
  font-size: clamp(16px, 1.5vw, 21px); font-weight: 500; font-style: italic;
  line-height: 1.5; letter-spacing: -0.01em; color: #000;
  max-width: 440px; margin: 0; padding-left: 22px;
  border-left: 2px solid #000;
}

.intro-panel__label {
  display: block; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c-muted); margin-bottom: 16px;
}
.intro-panel__title {
  font-size: clamp(24px, 2.6vw, 36px); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.12; margin-bottom: 20px;
}
.intro-panel__text {
  font-size: clamp(14px, 1.1vw, 16px); line-height: 1.7;
  color: var(--c-sub); margin-bottom: 12px;
}
.intro-panel__muted { color: var(--c-muted); }

.intro-panel .form         { margin-top: 8px; }
.intro-panel .form input,
.intro-panel .form textarea{ padding: 12px 0; font-size: 15px; }
.intro-panel .btn          { margin-top: 16px; padding: 13px 32px; min-height: 44px; font-size: 14px; }
.intro-panel .contact-links{ margin-top: 16px; }

/* Right column: all series, evenly filling the viewport height */
.intro__series {
  display: flex; flex-direction: column; min-height: 0;
}

/* ══════════════════════════════════════════════════════════════
   SERIES STRIPS (inside .intro__series, right half)
══════════════════════════════════════════════════════════════ */
.series-strips { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }

.series-strip {
  --delay: 0ms;
  position: relative; flex: 1 1 0; min-height: 0; width: 100%;
  overflow: hidden; cursor: pointer; background: var(--c-alt);
  border-radius: var(--r-sm);
  opacity: 0; transform: translateX(100%);
  animation: strip-in 1.15s var(--ease) both;
  animation-delay: var(--delay);
}
@keyframes strip-in { to { opacity: 1; transform: translateX(0); } }

/* Everything inside rides rigidly with the container's slide (no transform
   of its own) and only dissolves from blur, so the whole card — frame,
   image, overlay, text — arrives as a single physical piece. */
.series-strip img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 2.6s var(--ease), filter 1.2s ease;
  filter: blur(20px) brightness(0.8) saturate(0.92);
  animation: strip-img-in 1.15s var(--ease) both;
  animation-delay: var(--delay);
}
@keyframes strip-img-in { to { filter: blur(0) brightness(0.8) saturate(0.92); } }
.series-strip:hover img { transform: scale(1.045); filter: blur(0) brightness(0.95) saturate(1.05); }

.series-strip__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.36) 0%, rgba(0,0,0,0.15) 42%, rgba(0,0,0,0.04) 75%);
  transition: opacity 1s ease;
  opacity: 0; filter: blur(16px);
  animation: strip-overlay-in 1.15s var(--ease) both;
  animation-delay: var(--delay);
}
@keyframes strip-overlay-in { to { opacity: 1; filter: blur(0); } }
/* Hover: the darkening fully clears, letting the zoomed image show through. */
.series-strip:hover .series-strip__overlay { opacity: 0; }

/* Text sits at its final position from the start — only the card
   (frame/image/overlay) animates. */
.series-strip__info {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; gap: clamp(16px, 3vw, 40px);
  padding: 0 clamp(20px, 6vw, 64px);
}

.series-strip__title {
  font-size: clamp(26px, 4.4vw, 54px); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1; color: #fbfbfb;
  /* Reappearing (mouse-out) runs 30% faster than the 2.6s dissolve-in. */
  transition: filter 1.82s var(--ease), opacity 1.82s var(--ease);
  flex-shrink: 0;
}
/* Hover: the title dissolves — blurs and fades to fully transparent,
   at the same 2.6s pace as the rest of the hover effect. */
.series-strip:hover .series-strip__title {
  opacity: 0; filter: blur(14px);
  transition: filter 2.6s var(--ease), opacity 2.6s var(--ease);
}

/* ══════════════════════════════════════════════════════════════
   CV
══════════════════════════════════════════════════════════════ */
.cv { display: flex; flex-direction: column; gap: 24px; margin-top: 4px; }
.cv__group h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--c-muted); margin-bottom: 10px;
}
.cv__group li {
  display: flex; flex-direction: column; gap: 3px; padding: 9px 0;
  border-top: 1px solid var(--c-border);
}
.cv__date { font-size: 11px; letter-spacing: 0.03em; color: var(--c-muted); }
.cv__desc { font-size: 13px; line-height: 1.5; color: var(--c-sub); }

/* ══════════════════════════════════════════════════════════════
   FORM & CONTACTS
══════════════════════════════════════════════════════════════ */
.form { margin-top: 48px; }
.form__row { margin-bottom: 4px; }
.form input, .form textarea {
  width: 100%; padding: 18px 0; border: 0;
  border-bottom: 1px solid var(--c-border); background: transparent;
  font-size: 17px; font-family: inherit; color: var(--c-text); outline: none;
  transition: border-color 0.3s ease; resize: vertical;
  -webkit-appearance: none; appearance: none; border-radius: 0;
}
.form input:focus, .form textarea:focus { border-color: var(--c-border-strong); }
.form input::placeholder, .form textarea::placeholder { color: var(--c-muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 28px; padding: 15px 40px; border-radius: 980px;
  background: var(--c-btn-bg); color: var(--c-btn-text); font-size: 15px; font-weight: 500;
  min-height: 50px; transition: transform 0.25s var(--ease), background 0.2s ease;
}
.btn:hover { background: var(--c-accent); transform: translateY(-2px); }
.form__status { margin-top: 20px; font-size: 14px; color: var(--c-muted); min-height: 20px; }

.contact-links { display: flex; flex-direction: column; gap: 18px; margin: 20px 0 4px; }
.contact-links__item { display: flex; flex-direction: column; gap: 4px; }
.contact-links__label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted);
}
.contact-links__value {
  font-size: clamp(17px, 1.8vw, 21px); font-weight: 600;
  letter-spacing: -0.01em; color: var(--c-text); transition: color 0.2s ease;
}
.contact-links__item:hover .contact-links__value { color: var(--c-accent); }

/* ══════════════════════════════════════════════════════════════
   SERIES PAGE — full-screen works list
══════════════════════════════════════════════════════════════ */
.series-page {
  min-height: 100svh;
  background: var(--c-bg);
  padding-top: var(--nav-h);
  /* Entrance animation */
  animation: page-in 0.55s var(--ease) both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

.series-page__header {
  max-width: 1200px; margin: 0 auto;
  padding: 48px 24px 56px;
  display: flex; flex-direction: column; gap: 32px;
  border-bottom: 1px solid var(--c-border);
}
.series-page__back {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--c-muted);
  transition: color 0.2s ease; min-height: 44px; align-self: flex-start;
}
.series-page__back:hover { color: var(--c-text); }
.series-page__back svg { flex-shrink: 0; }

.series-page__label {
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c-muted); margin-bottom: 12px;
}
.series-page__title {
  font-size: clamp(36px, 6vw, 72px); font-weight: 600;
  letter-spacing: -0.035em; line-height: 1.04; color: var(--c-white);
}

.series-page__statement {
  max-width: 640px;
  display: flex; flex-direction: column; gap: 16px;
}
.series-page__statement p {
  font-size: clamp(15px, 1.2vw, 17px); line-height: 1.75; color: var(--c-sub);
}

/* Works list — one work per row, card layout */
.works-list {
  max-width: 1200px; margin: 0 auto;
  padding: 56px 24px 100px;
  display: flex; flex-direction: column; gap: 2px;
}

.work-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  cursor: pointer;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface);
  transition: background 0.3s ease, transform 0.4s var(--ease);
  /* Stagger reveal */
  opacity: 0;
  transform: translateY(24px);
  animation: rise-in 0.7s var(--ease) both;
}
.work-card:hover { background: var(--c-surface-hover); transform: translateY(-2px); }

/* Thumbnail */
.work-card__thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--c-alt);
  flex-shrink: 0;
}
.work-card__thumb img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.6s ease, transform 0.8s var(--ease);
}
.work-card__thumb img.is-loaded { opacity: 1; }
.work-card:hover .work-card__thumb img { transform: scale(1.04); }

/* Photo count badge */
.work-card__count {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  color: rgba(251,251,251,0.85); font-size: 11px;
  letter-spacing: 0.06em; padding: 4px 10px; border-radius: 20px;
}

/* Info panel */
.work-card__info {
  padding: 28px 32px;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.work-card__title {
  font-size: clamp(18px, 2vw, 24px); font-weight: 600;
  letter-spacing: -0.02em; color: var(--c-white);
}
.work-card__year  { font-size: 13px; color: var(--c-muted); }
.work-card__medium{ font-size: 14px; color: var(--c-sub); }
.work-card__size  { font-size: 13px; color: var(--c-muted); }
.work-card__cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--c-accent); margin-top: 12px;
  transition: gap 0.2s ease;
}
.work-card:hover .work-card__cta { gap: 10px; }

/* ══════════════════════════════════════════════════════════════
   WORK LIGHTBOX — photo viewer + info panel
══════════════════════════════════════════════════════════════ */
.wlb {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(4,4,4,0.98);
  display: flex; align-items: stretch;
  opacity: 0; transition: opacity 0.35s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.wlb[hidden] { display: none; }
.wlb.is-open { opacity: 1; }

.wlb__close {
  position: absolute; top: 20px; right: 20px; z-index: 10;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: rgba(251,251,251,0.6);
  transition: background 0.2s ease, color 0.2s ease;
}
.wlb__close:hover { background: rgba(251,251,251,0.1); color: #fbfbfb; }

/* Inner: viewer (left) + info (right) */
.wlb__inner {
  display: flex; width: 100%; height: 100%;
}

/* ── Viewer (left 65%) ── */
.wlb__viewer {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  padding: 64px 16px 16px;
  min-width: 0;
}

.wlb__img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 0;
}
.wlb__img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 4px;
  user-select: none; pointer-events: none;
  transition: opacity 0.3s ease;
}
.wlb__img.is-loading { opacity: 0.4; }

/* Arrows */
.wlb__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: rgba(251,251,251,0.55);
  transition: background 0.2s ease, color 0.2s ease;
  z-index: 5;
}
.wlb__arrow:hover { background: rgba(251,251,251,0.1); color: #fbfbfb; }
.wlb__arrow--prev { left: 12px; }
.wlb__arrow--next { right: 12px; }

/* Thumbnails strip */
.wlb__thumbs {
  display: flex; gap: 8px; padding: 12px 0 4px;
  overflow-x: auto; max-width: 100%;
  scrollbar-width: thin; scrollbar-color: var(--c-muted) transparent;
}
.wlb__thumbs::-webkit-scrollbar { height: 3px; }
.wlb__thumbs::-webkit-scrollbar-thumb { background: var(--c-muted); border-radius: 2px; }

.wlb__thumb {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 6px; overflow: hidden;
  cursor: pointer; opacity: 0.45;
  border: 2px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.wlb__thumb img { width: 100%; height: 100%; object-fit: cover; }
.wlb__thumb:hover { opacity: 0.75; transform: translateY(-2px); }
.wlb__thumb.is-active { opacity: 1; border-color: var(--c-accent); }

/* ── Info panel (right 35%) ── */
.wlb__info {
  width: 340px; flex-shrink: 0;
  background: #0f0f0f;
  border-left: 1px solid var(--c-border);
  padding: 80px 36px 40px;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
}
.wlb__info-series {
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c-muted);
}
.wlb__info-title {
  font-size: clamp(22px, 2.5vw, 32px); font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.1; color: var(--c-white);
  margin-top: 4px;
}
.wlb__info-year   { font-size: 13px; color: var(--c-muted); }
.wlb__info-medium { font-size: 15px; color: var(--c-sub); margin-top: 4px; }
.wlb__info-size   { font-size: 13px; color: var(--c-muted); }
.wlb__info-counter {
  font-size: 12px; letter-spacing: 0.08em; color: var(--c-muted);
  margin-top: auto; padding-top: 24px;
}

/* ══════════════════════════════════════════════════════════════
   SCROLL-DRIVEN ANIMATIONS
══════════════════════════════════════════════════════════════ */
.split { display: inline; }
.split .char {
  display: inline-block; opacity: 0; filter: blur(12px);
  transform: translateY(0.5em) rotate(1.5deg);
  animation: char-in 0.85s var(--ease) both;
  animation-timeline: view(); animation-range: entry 15% cover 50%;
  animation-delay: calc(var(--ci, 0) * 25ms);
}
.split .char.space { width: 0.28em; filter: none; transform: none; opacity: 1; }
@keyframes char-in { to { opacity: 1; filter: blur(0); transform: translateY(0) rotate(0); } }

.rise {
  opacity: 0; transform: translateY(32px); filter: blur(8px);
  animation: rise-in 0.95s var(--ease) both;
  animation-timeline: view(); animation-range: entry 15% cover 52%;
}
.rise.delay-1 { animation-delay:  80ms; }
.rise.delay-2 { animation-delay: 160ms; }
.rise.delay-3 { animation-delay: 240ms; }
@keyframes rise-in { to { opacity: 1; transform: translateY(0); filter: blur(0); } }

/* Intro (first screen) entrance — same blur/rise language as .rise,
   but plays immediately on load instead of on scroll-into-view. */
.intro-in {
  opacity: 0; transform: translateY(24px); filter: blur(10px);
  animation: rise-in 0.7s var(--ease) both;
}
.intro-in.delay-1 { animation-delay:  90ms; }
.intro-in.delay-2 { animation-delay: 180ms; }

@supports not (animation-timeline: view()) {
  .split .char, .rise, .work-card {
    opacity: 1 !important; filter: none !important;
    transform: none !important; animation: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .split .char, .rise, .series-strip, .series-strip img, .series-strip__info,
  .series-strip__overlay, .work-card, .intro-in {
    animation: none !important; opacity: 1 !important;
    filter: none !important; transform: none !important;
  }
  .series-strip img { filter: brightness(0.8) saturate(0.92) !important; }
  html { scroll-behavior: auto; }
  .intro-panel { transition: none !important; }
  .intro-panel__scroll-hint::after { animation: none; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET ≤ 900px
══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --nav-h: 56px; }
  .section         { padding: 80px 0; }

  /* Intro: stack text above series, series list scrolls internally
     if the two don't both fit within one screen on shorter tablets */
  .intro {
    --intro-pad: clamp(20px, 4vw, 40px);
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .intro__text   { min-height: 300px; }
  .intro-panel   { max-width: 100%; }
  .intro__quote  { max-width: 100%; }
  .intro__series { overflow-y: auto; }

  /* Series page */
  .work-card { grid-template-columns: 220px 1fr; }

  /* Lightbox: stack on tablet */
  .wlb__inner  { flex-direction: column; }
  .wlb__info   {
    width: 100%; border-left: 0;
    border-top: 1px solid var(--c-border);
    padding: 24px; flex-direction: row;
    flex-wrap: wrap; gap: 8px 24px;
    flex-shrink: 0; max-height: 200px; overflow-y: auto;
  }
  .wlb__info-counter{ margin-top: 0; padding-top: 0; }
  .wlb__viewer { padding: 56px 8px 8px; }
  .wlb__thumb  { width: 52px; height: 52px; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 640px
══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  :root { --nav-h: 52px; --tabbar-h: 62px; }

  /* Nav: the link list becomes a fixed tab bar pinned to the bottom
     of the screen (position:fixed takes it out of .nav__right's flow,
     so the header is left showing just the logo and language switcher).
     All 5 buttons share the width equally so they never overlap,
     shrinking/truncating instead of wrapping. */
  .nav__menu {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 205;
    background: var(--c-menu-bg);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--c-menu-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    gap: 0;
  }
  .nav__menu a {
    flex: 1 1 0; min-width: 0;
    display: flex; align-items: center; justify-content: center;
    height: 46px; padding: 0 2px;
    font-size: 11px; font-weight: 500; letter-spacing: -0.01em;
    color: var(--c-menu-text); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .nav__menu a.is-active { color: var(--c-text); font-weight: 700; }
  /* "Gallery" (hidden on desktop) becomes the first tab here, since
     the gallery is the default screen on load; "Thoughts" drops out
     of the bar to keep five tabs total. */
  .nav__menu a.nav__thoughts-link { display: none; }

  /* Intro */
  .intro          { --intro-pad: 20px; padding-bottom: var(--tabbar-h); }
  .intro__quote   { font-size: clamp(18px, 6vw, 24px); padding-left: 18px; }
  .series-strip   { min-height: 76px; border-radius: 10px; }

  /* The series grid is the default full-screen content; opening a
     nav tab swaps it out for that panel, full-screen, and back again
     via the logo (which targets the "home" panel). */
  .intro { grid-template-rows: 1fr; }
  .intro__text, .intro__series { grid-row: 1; grid-column: 1; }
  .intro__text   { display: none; }
  .intro__series { display: flex; }
  body.panel-open .intro__text   { display: flex; }
  body.panel-open .intro__series { display: none; }

  /* Panels */
  .intro-panel__title { font-size: clamp(22px, 7vw, 30px); margin-bottom: 16px; }
  .intro-panel__text  { font-size: 15px; }
  .cv__group li { padding: 8px 0; }

  /* Form */
  .intro-panel .form { margin-top: 8px; }
  .intro-panel .form input,
  .intro-panel .form textarea { font-size: max(16px, 1em); padding: 13px 0; }
  .intro-panel .btn { width: 100%; margin-top: 18px; padding: 15px; font-size: 15px; }
  .intro-panel .contact-links { margin-top: 16px; }
  .contact-links__value { font-size: 19px; }

  /* Series page */
  .series-page__header { padding: 32px 16px 40px; }
  .series-page__title  { font-size: clamp(28px, 8vw, 44px); }
  .works-list { padding: 32px 16px 80px; gap: 2px; }
  .work-card  { grid-template-columns: 1fr; }
  .work-card__thumb { aspect-ratio: 16 / 9; }
  .work-card__info  { padding: 20px; }

  /* Lightbox mobile */
  .wlb__info { max-height: 160px; padding: 16px; }
  .wlb__arrow--prev { left: 4px; }
  .wlb__arrow--next { right: 4px; }
  .wlb__close { top: 12px; right: 12px; }
  .wlb__thumb { width: 44px; height: 44px; }
}

@media (max-width: 390px) {
  .intro__quote       { font-size: 18px; }
  .intro-panel__title { font-size: 24px; }
  .nav__menu a        { font-size: 10px; padding: 0 1px; }
}

/* ══════════════════════════════════════════════════════════════
   SPA VIEW SWITCHING — явное управление видимостью
══════════════════════════════════════════════════════════════ */

/* По умолчанию — показываем главную, скрываем страницу серии */
#siteView {
  display: block;
}

#seriesPage {
  display: none;
}

/* Когда hidden убран с seriesPage — показываем */
#seriesPage:not([hidden]) {
  display: block;
}

/* Когда hidden добавлен на siteView — скрываем */
#siteView[hidden] {
  display: none !important;
}
