/* ============================================================================
   HOUSE UX LAYER — template 42 "Nadya" (navy & gold exclusive-07)
   Natural continuous scroll + derived navigation, on top of the existing
   navy/gold aesthetic. Loaded LAST (after exclusive-07.css and refined.css).

   Geometry tokens — real chrome never drifts from these:
     --header-h        header height (enforced on .site-header)
     --header-offset   header + breathing room, used for cover cap,
                       scroll-padding-top and scroll-margin-top
     --dock-space      body padding reserved for the floating dock (<1024px)

   Contents
     1. tokens & base geometry
     2. sticky header (brand · desktop pills · burger · progress hairline)
     3. mobile slide-down sheet + backdrop
     4. floating icon dock (<1024px)
     5. gate (top-cover) interplay
     6. cover = exactly one screen (cap + decoration trim ladder)
     7. scenes & free pages
     8. empty-state (.is-empty — visual only, print restores)
     9. unified zoom lightbox (images + placeholder video)
    10. scrollbars styled to the palette
    11. click-to-open OFF switch  (html[data-media-lightbox="off"])
    12. print — chrome hidden, everything visually hidden restored
    13. reduced motion
   ============================================================================ */

/* ── 1. Tokens & base geometry ─────────────────────────────────────────── */
:root {
  --header-h: clamp(52px, 7.2vw, 64px);
  --anchor-gap: 10px;
  --header-offset: calc(var(--header-h) + var(--anchor-gap));
  --dock-space: calc(76px + env(safe-area-inset-bottom, 0px));

  /* house chrome palette — derived from body.nadya.original */
  --house-navy: #050D29;
  --house-navy-rgb: 5, 13, 41;
  --house-gold: #fcb765;
  --house-gold-soft: rgba(252, 183, 101, 0.85);
  --house-line: rgba(252, 183, 101, 0.28);
  --house-chrome-bg: rgba(5, 13, 41, 0.88);
}

html {
  /* anchor offsets live on the sections themselves (scroll-margin-top),
     so a native jump is shifted exactly once */
  scroll-padding-top: 0;
}

body.nadya {
  padding-top: var(--header-h); /* reserve room for the fixed header */
}

body.nadya.gate-open {
  padding-bottom: var(--dock-space); /* end-of-page content clears the dock */
}

@media (min-width: 1024px) {
  body.nadya.gate-open {
    padding-bottom: 0; /* no dock on desktop */
  }
}

[data-section] {
  scroll-margin-top: var(--header-offset);
}

/* ── 2. Sticky header ──────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--header-h);
  background: var(--house-chrome-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--house-line);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

body.gate-open .site-header {
  transform: translateY(0);
  opacity: 1;
}

body:not(.gate-open) .site-header {
  visibility: hidden; /* never tabbable while the gate is up */
}

.site-header-inner {
  height: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  margin-right: auto;
}

.brand-mono {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  line-height: 1;
  color: var(--house-gold);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop pill nav (≥1024px) */
.head-nav {
  display: none;
}

@media (min-width: 1024px) {
  .head-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: min(62vw, 860px);
  }
  .head-nav::-webkit-scrollbar { display: none; }

  .menu-btn { display: none !important; } /* force-close burger on desktop */
}

.head-nav .pill {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(var(--text-primary-rgb), 0.78);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.head-nav .pill:hover {
  color: var(--house-gold);
}

.head-nav .pill.active {
  color: var(--house-gold);
  background: rgba(252, 183, 101, 0.1);
  border-color: var(--house-line);
}

/* Burger */
.menu-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--house-line);
  background: rgba(252, 183, 101, 0.08);
  color: var(--house-gold);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.menu-btn:active { transform: scale(0.94); }

/* Progress hairline */
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: transparent;
  pointer-events: none;
}

.scroll-progress .bar {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(252, 183, 101, 0.35), var(--house-gold));
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ── 3. Mobile slide-down sheet ────────────────────────────────────────── */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 930;
  background: rgba(var(--house-navy-rgb), 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.menu-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 940;
  max-height: min(72dvh, 560px);
  background: linear-gradient(180deg, rgba(var(--house-navy-rgb), 0.98), rgba(var(--house-navy-rgb), 0.94));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--house-line);
  border-radius: 0 0 20px 20px;
  transform: translateY(-102%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0.24, 1), visibility 0s linear 0.38s;
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
}

.menu-sheet.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0.24, 1), visibility 0s;
}

.menu-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
}

.menu-sheet-title {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  color: var(--house-gold);
  letter-spacing: 0.04em;
}

.menu-sheet-close {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--house-line);
  background: transparent;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 6px 12px calc(14px + env(safe-area-inset-top, 0px));
}

.menu-list li + li { margin-top: 2px; }

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.menu-row:active { background: rgba(252, 183, 101, 0.1); }

.menu-row .row-num {
  font-family: 'Instrument Serif', serif;
  font-size: 13px;
  color: rgba(252, 183, 101, 0.65);
  min-width: 20px;
}

.menu-row .row-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-right: auto;
}

.menu-row .row-icon {
  color: rgba(252, 183, 101, 0.55);
  font-size: 17px;
}

.menu-row.active {
  background: rgba(252, 183, 101, 0.1);
}

.menu-row.active .row-label { color: var(--house-gold); }

@media (min-width: 1024px) {
  .menu-sheet, .menu-backdrop { display: none !important; } /* force-close */
}

/* ── 4. Floating icon dock (<1024px) ───────────────────────────────────── */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 920;
  display: none;
  align-items: center;
  gap: 1px;
  max-width: calc(100vw - 16px);
  padding: 4px 5px;
  border-radius: 999px;
  background: var(--house-chrome-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--house-line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  scrollbar-width: none;
}

.dock::-webkit-scrollbar { display: none; }

@media (max-width: 1023.98px) {
  body.gate-open .dock { display: flex; }
}

.dock .dock-btn {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(var(--text-primary-rgb), 0.62);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.dock .dock-btn.active {
  color: var(--house-navy);
  background: var(--house-gold);
  transform: translateY(-2px);
}

/* ── 5. Gate interplay ─────────────────────────────────────────────────── */
/* While the opening gate is up the page beneath must not scroll — body.nadya
   { overflow: hidden } from exclusive-07.css already does this; the gate
   itself keeps its designed full-screen splash. */

/* ── 6. Cover = exactly one screen ─────────────────────────────────────── */
body.nadya section.cover .inner {
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  min-height: 0;
  padding: 18px 0 12px;
}

/* the cover filigree must live INSIDE the one-screen cap (it used to be
   min-height: 800px at top:12vh — the main source of cover overflow) */
body.nadya section.cover .inner::before {
  top: 0;
  height: 100%;
  min-height: 0;
}

/* fluid sizing stops growing on short viewports */
body.nadya section.cover .inner .details h1 {
  font-size: clamp(34px, 9.5vw, 44px);
}

@media (min-width: 1024px) {
  body.nadya section.cover .inner .details h1 {
    font-size: clamp(38px, 4.2vw, 50px);
  }
}

body.nadya section.cover .inner .highlight {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  margin-top: 6px;
  margin-bottom: 0; /* legacy auto-margin ate the flex space — the hero
                       photo collapsed to its min-height on phones */
}

body.nadya section.cover .inner .highlight .preview-container {
  width: min(88vw, 440px);
  height: auto;
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(120vw, 613px);
}

/* legacy engine markup nests preview-container twice — the inner one must
   fill the outer, or it becomes a min-height-sized containing block and the
   absolute hero picture collapses to 180px */
body.nadya section.cover .inner .highlight .preview-container .preview-container {
  position: absolute;
  inset: 0;
  width: auto;
  flex: none;
  min-height: 0;
  max-height: none;
}

@media (min-width: 1024px) {
  body.nadya section.cover .inner .highlight .preview-container {
    width: min(44vw, 640px);
    max-height: 576px;
    max-height: min(52dvh, 576px);
  }
}

/* the hero photo is content — make it openable (§6) */
body.gate-open section.cover .inner .highlight {
  pointer-events: auto;
}

/* Decoration trim ladder — applied stepwise by js/house.js when the
   one-screen cap would overflow. Peripheral first, primary content last. */
section.cover.trim-1 .bird-outer { display: none; }
section.cover.trim-2 .inner::before { display: none; }
section.cover.trim-3 .preview-container::before,
section.cover.trim-3 .preview-container::after { display: none; }
section.cover.trim-4 .details .top-text { display: none; }
section.cover.trim-5 .details .date { display: none; }

/* last-resort valve for extreme viewports */
section.cover .inner.is-overflow {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── 7. Scenes & free pages ────────────────────────────────────────────── */
/* Poster-like sections read as one-screen scenes; dense sections keep their
   natural rhythm (a forced 100vh everywhere opened dead gaps in this
   template's art-directed backgrounds — documented trade-off). */
body.nadya section.save-date .inner,
body.nadya section.live-streaming .inner {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 0;
}

body.nadya section.footnote .inner {
  min-height: calc(80vh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

section.couple,
section.love-story,
section.gallery,
section.video-gallery,
section.event-outer,
section.gift,
section.rsvp-wrap,
section.guestbook-section {
  scroll-margin-top: var(--header-offset);
}

/* Free pages — stacked scenes like every other section */
section.free-page {
  position: relative;
  background-color: var(--background-primary);
  padding: 64px 20px;
  overflow: hidden;
}

section.free-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--bg-main);
  background-size: cover;
  background-position: center;
  opacity: 0.5;
  pointer-events: none;
}

section.free-page .inner {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

section.free-page .head { margin-bottom: 1.4em; }

section.free-page .eyebrow {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--house-gold-soft);
  margin-bottom: 0.6em;
}

section.free-page .free-page-title {
  color: var(--text-primary);
}

section.free-page .free-body p {
  color: var(--text-secondary);
}

section.free-page .free-figure {
  margin: 1.4em auto 0;
  max-width: 460px;
  border: 1px solid var(--house-line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

section.free-page .free-figure img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

section.free-page .free-card {
  margin: 1.4em auto 0;
  max-width: 520px;
  border: 1px solid var(--house-line);
  border-radius: 16px;
  padding: 22px 20px;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

section.free-page .free-card p + p { margin-top: 0.9em; }

/* ── 8. Empty states ───────────────────────────────────────────────────── */
.is-empty, .fit-hidden { display: none !important; }

/* ── 9. Unified zoom lightbox ──────────────────────────────────────────── */
.zoomable-media {
  cursor: zoom-in;
  cursor: -webkit-zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(var(--house-navy-rgb), 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox.is-open { display: flex; }

.lightbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.lightbox img,
.lightbox video {
  max-width: min(94vw, 1200px);
  max-height: 82dvh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-select: none;
}

.lightbox img { transition: transform 0.2s ease; }
.lightbox.is-panning img,
.lightbox.is-panning video { transition: none; cursor: grabbing; }
.lightbox video { cursor: default; }

.lightbox-cap,
.lightbox-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(var(--text-primary-rgb), 0.85);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-align: center;
  max-width: 86vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-cap { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.lightbox-hint {
  bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  font-size: 11px;
  color: rgba(var(--text-primary-rgb), 0.45);
  pointer-events: none;
}

.lightbox-btn {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--house-line);
  background: rgba(var(--house-navy-rgb), 0.72);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  z-index: 2;
}

.lightbox-btn:hover { color: var(--house-gold); }

.lightbox-close { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
.lightbox-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-open-original {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--house-line);
  background: rgba(var(--house-navy-rgb), 0.72);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lightbox-open-original:hover { color: var(--house-gold); }

.lightbox-btn[hidden],
.lightbox-open-original[hidden] { display: none; }

/* expand chip on inline videos */
.media-expand {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  border: 1px solid var(--house-line);
  background: rgba(var(--house-navy-rgb), 0.78);
  color: var(--house-gold);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* inline placeholder video (media/placeholder.mp4) fits the preview frame */
.video-gallery .preview video.inline-video,
.live-streaming .preview video.inline-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: var(--house-navy);
}

/* ── 10. Scrollbars in the palette ─────────────────────────────────────── */
body.nadya.gate-open { scrollbar-color: rgba(252, 183, 101, 0.5) rgba(5, 13, 41, 0.6); scrollbar-width: thin; }

body.nadya.gate-open::-webkit-scrollbar { width: 10px; }
body.nadya.gate-open::-webkit-scrollbar-track { background: rgba(5, 13, 41, 0.6); }
body.nadya.gate-open::-webkit-scrollbar-thumb {
  background: rgba(252, 183, 101, 0.45);
  border-radius: 8px;
  border: 2px solid rgba(5, 13, 41, 0.8);
}
body.nadya.gate-open::-webkit-scrollbar-thumb:hover { background: rgba(252, 183, 101, 0.7); }

.menu-sheet::-webkit-scrollbar { width: 6px; }
.menu-sheet::-webkit-scrollbar-thumb { background: rgba(252, 183, 101, 0.4); border-radius: 6px; }

.lightbox-stage::-webkit-scrollbar { width: 8px; }
.lightbox-stage::-webkit-scrollbar-thumb { background: rgba(252, 183, 101, 0.4); border-radius: 6px; }

/* ── 11. Click-to-open OFF switch ──────────────────────────────────────── */
/* <html data-media-lightbox="off"> renders media inline only — no zoom
   cursors, no expand chips, no lightbox. Anchors keep their native
   open-in-new-tab behaviour. */
html[data-media-lightbox="off"] .zoomable-media { cursor: default; }
html[data-media-lightbox="off"] .media-expand { display: none !important; }
html[data-media-lightbox="off"] .lightbox { display: none !important; }

/* ── 12. Print — chrome off, hidden content restored ───────────────────── */
@media print {
  :root { --header-h: 0px; }
  body.nadya { padding-top: 0 !important; padding-bottom: 0 !important; }
  .site-header, .dock, .menu-sheet, .menu-backdrop, .menu-btn,
  .scroll-progress, .lightbox, .media-expand { display: none !important; }
  .is-empty, .fit-hidden { display: revert !important; }
  body.nadya section.cover .inner,
  body.nadya section.save-date .inner,
  body.nadya section.live-streaming .inner {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  section.cover.trim-1 .bird-outer,
  section.cover.trim-2 .inner::before,
  section.cover.trim-3 .preview-container::before,
  section.cover.trim-3 .preview-container::after,
  section.cover.trim-4 .details .top-text,
  section.cover.trim-5 .details .date { display: revert; }
  section.top-cover { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── 13. Reduced motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .site-header, .menu-sheet, .menu-backdrop { transition: none; }
  .lightbox img { transition: none; }
}
