/* ============================================================
   NGF · Mother's Day · Creative gallery (dark)
   Vertical scroll-snap. One creative per viewport, wrapped in a
   Facebook ad frame that adapts to the image's natural aspect.
   Never crops. Never overflows the viewport.
   ============================================================ */

:root {
  /* dark page palette — warm near-black */
  --bg:           #14110d;
  --bg-2:         #1a1611;
  --bg-3:         #221b14;
  --bg-warm:      #1f1812;
  --fg:           #f5f1e8;     /* cream text on dark */
  --fg-soft:      rgba(245,241,232,0.78);
  --fg-mute:      rgba(245,241,232,0.55);
  --fg-quiet:     rgba(245,241,232,0.38);

  --line:         rgba(245,241,232,0.08);
  --line-strong:  rgba(245,241,232,0.18);

  /* gold accents (lifted slightly for dark-bg legibility) */
  --gold:         #c9a875;
  --gold-2:       #dac08f;
  --gold-3:       #a8803c;
  --gold-glow:    rgba(201,168,117,0.16);
  --gold-glow-2:  rgba(201,168,117,0.30);
  --gold-line:    rgba(201,168,117,0.32);
  --gold-bg:      rgba(201,168,117,0.10);

  --velvet:       #d4506e;
  --velvet-soft:  rgba(212,80,110,0.12);
  --velvet-line:  rgba(212,80,110,0.32);

  --green:        #7faa78;
  --green-soft:   rgba(127,170,120,0.14);
  --green-line:   rgba(127,170,120,0.35);

  /* paper = cream, kept as-is for use ON gold tiles (avatar, logo) */
  --paper:        #f5f1e8;

  --serif:        'Fraunces', Georgia, serif;
  --sans:         'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, monospace;

  --ease:         cubic-bezier(0.22, 1, 0.36, 1);

  --shadow-soft:  0 4px 18px rgba(0,0,0,0.35);
  --shadow-mid:   0 14px 40px rgba(0,0,0,0.5);
  --shadow-strong:0 28px 64px rgba(0,0,0,0.6);

  --topbar-h:     48px;

  /* CHROME budget used to size the FB ad so it always fits viewport */
  /* topbar + section pad + creative head + gap + ad chrome + primary + bottom + buffer */
  --ad-chrome:    320px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ───── TOPBAR ───── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px;
  background: rgba(20,17,13,0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  height: var(--topbar-h);
}
.topbar__brand { display: flex; align-items: baseline; gap: 10px; }
.topbar__wordmark { font-weight: 800; letter-spacing: 0.18em; font-size: 11.5px; text-transform: uppercase; color: var(--fg); }
.topbar__divider { color: var(--gold); }
.topbar__client {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.topbar__chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 500;
  text-transform: uppercase;
}
.topbar__right {
  display: flex; align-items: center; gap: 16px;
}

/* ───── PRIMARY-TEXT TOGGLE (in topbar) ───── */
.text-toggle {
  display: flex; align-items: center; gap: 10px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
}
.text-toggle__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--fg-quiet);
  font-weight: 500;
  text-transform: uppercase;
}
.text-toggle__pills {
  display: flex; gap: 4px;
}
.text-toggle__pill {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-mute);
  cursor: pointer;
  transition: all .25s var(--ease);
  font-family: inherit;
}
.text-toggle__pill:hover {
  border-color: var(--gold-line);
  color: var(--gold);
}
.text-toggle__pill.is-active {
  border-color: var(--gold);
  background: var(--gold-bg);
  color: var(--gold);
  box-shadow: 0 0 14px -4px var(--gold-glow-2);
}
.text-toggle__num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.text-toggle__pill.is-active .text-toggle__num {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
.text-toggle__name {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Compact topbar — kicks in early so the toggle never overflows on tablets */
@media (max-width: 920px) {
  .text-toggle__label, .text-toggle__name { display: none; }
  .text-toggle { padding-right: 10px; gap: 6px; }
  .text-toggle__pills { gap: 4px; }
}

/* ───── DOT NAV ───── */
.dotnav {
  position: fixed;
  top: 50%; right: 24px;
  transform: translateY(-50%);
  z-index: 40;
  display: flex; flex-direction: column; gap: 9px;
}
.dotnav__dot {
  appearance: none; -webkit-appearance: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--fg-quiet);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all .25s var(--ease);
  padding: 0;
}
.dotnav__dot:hover { border-color: var(--gold); transform: scale(1.25); }
.dotnav__dot.is-active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.4);
  box-shadow: 0 0 14px -2px var(--gold-glow-2);
}
.dotnav__dot::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.dotnav__dot:hover::after,
.dotnav__dot.is-active::after { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ============================================================
   DECK · scroll-snap
   ============================================================ */
.deck {
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar { display: none; }

.section {
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--topbar-h) + 18px) 36px 36px;
  position: relative;
  overflow: hidden;
}

/* shared heading utilities */
.section__head {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 800px;
}
.section__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 500;
  text-transform: uppercase;
}
.section__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.022em;
  margin: 0;
  color: var(--fg);
}
.section__title em { font-style: italic; color: var(--gold); font-weight: 400; }
.section__sub {
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: 640px;
  margin: 0;
}

/* ============================================================
   COVER
   ============================================================ */
.section--cover { background: var(--bg); }
.cover {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  max-width: 1320px;
  height: 100%;
  gap: 24px;
}
.cover__topline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.cover__logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold-2) 0%, var(--gold) 60%, var(--gold-3) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 32px -8px var(--gold-glow-2), 0 0 0 1px rgba(255,255,255,0.4) inset;
}
.cover__logo-mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  color: var(--bg);
  line-height: 1;
}
.cover__chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  font-weight: 500;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}
.cover__center {
  display: flex; flex-direction: column; justify-content: center;
  gap: 22px;
  max-width: 1100px;
}
.cover__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 500;
  padding: 8px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--gold-bg);
  align-self: flex-start;
}
.cover__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.2rem, 8vw, 7rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--fg);
  text-shadow: 0 4px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
}
.cover__title em { font-style: italic; color: var(--gold); font-weight: 400; }
.cover__sub {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  color: var(--fg-soft);
  margin: 0;
  max-width: 760px;
  letter-spacing: -0.01em;
}
.cover__foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px;
}
.cover__credit {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--fg-quiet);
  text-transform: uppercase;
  font-weight: 500;
}
.scroll-cue {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  transition: all .25s var(--ease);
}
.scroll-cue:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -8px var(--gold-glow-2);
}
.scroll-cue__arrow { font-size: 14px; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}

/* ============================================================
   CREATIVE SECTION
   ============================================================ */
.section--creative:nth-of-type(even) { background: var(--bg-2); }

.creative {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 1080px;
  min-height: 0;
}

.creative__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.creative__counter {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 500;
  text-transform: uppercase;
}
.creative__label {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  color: var(--fg-mute);
}

/* ============================================================
   AD · the FB frame, aspect-aware
   The container width is bound by:
   1) An aesthetic max width (480px)
   2) The available viewport height converted to a width via the
      image's natural aspect ratio.
   So a 9:16 vertical image yields a narrower ad; a 1:1 fills wider.
   No image is ever cropped. Whole ad always fits viewport.
   ============================================================ */
.ad {
  /* set by JS once the image loads — defaults are 1:1 */
  --aspect-w: 1;
  --aspect-h: 1;
  --avail-h: calc(100dvh - var(--ad-chrome));
  width: 100%;
  max-width: min(480px, calc(var(--avail-h) * var(--aspect-w) / var(--aspect-h)));

  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  color: #050505;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  box-shadow:
    0 0 0 1px var(--gold-line),
    0 32px 72px -20px rgba(0,0,0,0.5),
    0 0 80px -24px var(--gold-glow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ad__chrome {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px 9px;
  flex-shrink: 0;
}
.ad__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-2) 0%, var(--gold) 60%, var(--gold-3) 100%);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1;
  overflow: hidden;
  flex-shrink: 0;
}
.ad__avatar--img {
  background: #000;
  padding: 0;
}
.ad__avatar--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.ad__meta { line-height: 1.2; }
.ad__name { font-weight: 600; font-size: 13.5px; color: #050505; }
.ad__check { color: #1877f2; font-size: 11px; }
.ad__sub { font-size: 11px; color: #65676b; margin-top: 1px; }
.ad__primary {
  margin: 0;
  padding: 4px 13px 11px;
  font-size: 13px;
  line-height: 1.4;
  color: #050505;
  white-space: pre-line;
  flex-shrink: 0;
}
.ad__media {
  position: relative;
  display: block;
  background: #1a0a12;
  overflow: hidden;
  /* aspect mirrors the loaded image — set by JS */
  aspect-ratio: var(--aspect-w) / var(--aspect-h);
  width: 100%;
  flex-shrink: 1;
  min-height: 0;
}
.ad__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;  /* matching aspect == no crop */
}
.ad__bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px;
  background: #f0f2f5;
  gap: 10px;
  flex-shrink: 0;
}
.ad__cta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.ad__domain { font-size: 10.5px; color: #65676b; text-transform: uppercase; letter-spacing: 0.04em; }
.ad__headline { font-size: 13px; font-weight: 600; color: #050505; line-height: 1.25; margin-top: 1px; }
.ad__cta-btn {
  background: #e4e6eb;
  color: #050505;
  border: none;
  padding: 9px 13px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================================
   APPROVAL · sign-off
   ============================================================ */
.section--approve { background: var(--bg); }
.approve {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 32px;
  text-align: center;
  align-content: center;
  height: 100%;
}
.section--approve .section__head { align-items: center; margin: 0 auto; text-align: center; }
.section--approve .section__sub { text-align: center; margin: 0 auto; }

.approve__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-self: center;
}
.approve__btn {
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  padding: 32px 28px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  text-decoration: none;
  cursor: pointer;
  transition: all .25s var(--ease);
}
.approve__btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-mid); }
.approve__btn--yes { border-color: var(--green-line); background: var(--green-soft); }
.approve__btn--no  { border-color: var(--velvet-line); background: var(--velvet-soft); }

.approve__btn-eyebrow { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.approve__btn--yes .approve__btn-eyebrow,
.approve__btn--yes .approve__btn-text { color: var(--green); }
.approve__btn--no .approve__btn-eyebrow,
.approve__btn--no .approve__btn-text { color: var(--velvet); }
.approve__btn-text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1;
  letter-spacing: -0.018em;
}
.approve__btn-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--fg-mute);
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 4px;
}
.approve__foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-quiet);
  text-transform: uppercase;
  font-weight: 500;
}

/* ============================================================
   ENTRANCE ANIMATIONS · IntersectionObserver-driven
   ============================================================ */
.is-revealing > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.is-visible > * { opacity: 1; transform: translateY(0); }
.is-visible > *:nth-child(2) { transition-delay: .08s; }
.is-visible > *:nth-child(3) { transition-delay: .16s; }
.is-visible > *:nth-child(4) { transition-delay: .24s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .section { padding: calc(var(--topbar-h) + 14px) 22px 22px; }
}
@media (max-width: 720px) {
  :root { --ad-chrome: 290px; }
  .section { padding: calc(var(--topbar-h) + 14px) 16px 20px; }
  .topbar { padding: 10px 16px; }
  .approve__actions { grid-template-columns: 1fr; }
  .approve__foot { flex-direction: column; gap: 8px; text-align: center; }
  .cover__title { font-size: clamp(2.6rem, 12vw, 5rem); }

  /* mobile: dotnav with 20+ dots is clutter — hide it, swipes work fine */
  .dotnav { display: none; }
}

@media (max-width: 640px) {
  /* Topbar: only the brand wordmark + the text-toggle survive at narrow widths */
  .topbar__divider, .topbar__client { display: none; }
  .topbar__chip { display: none; }
  .text-toggle {
    border-right: none;
    padding-right: 0;
    gap: 6px;
  }
  .text-toggle__pills { gap: 3px; }
  .text-toggle__pill {
    padding: 4px 8px;
    border-radius: 6px;
  }
  .text-toggle__num {
    padding: 1px 4px;
    font-size: 8.5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .is-revealing > * { opacity: 1; transform: none; }
}
