/* ==========================================================
   MIEN TREATS — site styles (Phase 2: nav, opening, hero, footer)
   Portrait layout is keyed to aspect ratio, not screen width, so it
   always matches the frame set the script chooses (see js/main.js).
   ========================================================== */

html.is-opening { overflow: hidden; }
html { scroll-behavior: auto; }

.skip {
  position: fixed; left: var(--space-2); top: -4rem; z-index: 200;
  background: var(--plum); color: var(--cream); padding: .7rem 1rem; text-decoration: none;
}
.skip:focus { top: var(--space-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .85rem 1.6rem; min-height: 2.9rem;
  border: 1px solid currentColor; border-radius: var(--radius);
  font-family: var(--font-body); font-weight: 400; font-size: var(--step--1);
  letter-spacing: .06em; text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.btn--solid { background: var(--plum); color: var(--cream); border-color: var(--plum); }
.btn--solid:hover, .btn--solid:focus-visible { background: var(--ink); border-color: var(--ink); }
.btn--ghost { color: var(--plum); }
.btn--ghost:hover, .btn--ghost:focus-visible { background: rgba(91, 21, 51, .08); }

/* ---------- navigation ---------- */
body { --nav-fg: var(--plum); }
body[data-tone="dark"], body[data-tone="plum"] { --nav-fg: var(--cream); }

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: calc(env(safe-area-inset-top, 0px) + .8rem) var(--gutter) .8rem;
  color: var(--nav-fg);
  transition: color var(--dur-med) ease, opacity var(--dur-med) ease;
}
.is-opening .nav { opacity: 0; pointer-events: none; }
/* a soft wash behind the nav keeps links readable over busy photos */
.nav::before {
  content: ""; position: absolute; inset: 0 0 -1.4rem 0; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(244, 234, 223, .82), rgba(244, 234, 223, 0));
  transition: opacity var(--dur-med) ease;
}
body[data-tone="dark"] .nav::before { background: linear-gradient(rgba(6, 3, 4, .55), rgba(6, 3, 4, 0)); }
body[data-tone="plum"] .nav::before { background: linear-gradient(rgba(91, 21, 51, .9), rgba(91, 21, 51, 0)); }
body.is-menu-open .nav::before { opacity: 0; }
.nav__brand { display: flex; align-items: center; min-height: 2.75rem; transition: opacity var(--dur-med) ease; }
.nav__brand img { height: 2.6rem; width: auto; }
body[data-tone="dark"] .nav__brand { opacity: 0; pointer-events: none; }  /* the apron carries the logo here */
.nav__end { display: flex; align-items: center; gap: clamp(.9rem, 3vw, 2rem); }
.nav__link {
  color: inherit; text-decoration: none; font-size: var(--step--1); letter-spacing: .05em;
  padding-block: .5rem; background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size var(--dur-fast) var(--ease-out);
}
.nav__link:hover, .nav__link:focus-visible { background-size: 100% 1px; }
.btn--nav { color: inherit; padding: .6rem 1.15rem; min-height: 2.5rem; white-space: nowrap; }
.btn--nav:hover, .btn--nav:focus-visible { background: var(--nav-fg); }
body[data-tone="dark"] .btn--nav:hover, body[data-tone="dark"] .btn--nav:focus-visible,
body[data-tone="plum"] .btn--nav:hover, body[data-tone="plum"] .btn--nav:focus-visible { color: var(--ink); }
body[data-tone="light"] .btn--nav:hover, body[data-tone="light"] .btn--nav:focus-visible { color: var(--cream); }

/* logo goes cream on the plum cakes section */
.nav__brand img { transition: filter var(--dur-med) ease; }
body[data-tone="plum"] .nav__brand img { filter: brightness(0) invert(1); }

/* small screens: links fold into a menu */
.nav__menu-btn { display: none; background: none; border: 0; color: inherit; cursor: pointer;
  font-size: var(--step--1); letter-spacing: .05em; padding: .5rem .3rem; min-height: 2.75rem; }
.menu { position: absolute; top: 0; left: 0; right: 0; height: 100vh; height: 100svh; z-index: -1; background: var(--cream);
  padding: calc(env(safe-area-inset-top, 0px) + 6rem) var(--gutter) 2rem; overflow-y: auto; }
.menu[hidden] { display: none; }
.menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.menu a { display: block; padding: .5rem 0; font-family: var(--font-display); font-size: var(--step-3); color: var(--plum); text-decoration: none; }
body.is-menu-open { --nav-fg: var(--plum); }
body.is-menu-open .nav__brand { opacity: 1 !important; pointer-events: auto !important; }
body.is-menu-open .nav__brand img { filter: none !important; }
@media (max-width: 899px) {
  .nav__link--wide { display: none; }
  .nav__menu-btn { display: inline-block; }
}
@media (min-width: 900px) { .menu { display: none !important; } }

/* touch screens: bigger tap areas for the nav links */
@media (pointer: coarse) { .nav__link { padding-block: .8rem; } }

/* the smallest phones: keep the nav on one line */
@media (max-width: 380px) {
  .nav { gap: .5rem; }
  .nav__end { gap: .5rem; }
  .nav__brand img { height: 2.3rem; }
  .btn--nav { padding: .5rem .75rem; font-size: .78rem; letter-spacing: .03em; }
}

/* ---------- opening ---------- */
#opening {
  position: fixed; inset: 0; z-index: 100; background: var(--cream);
  display: grid; place-items: center;
  transition: transform 1.15s var(--ease-soft);
}
#opening.is-lifting { transform: translateY(-100%); }
#opening > * { grid-area: 1 / 1; }
.opening__whisk { width: clamp(70px, 16vw, 108px); height: auto; overflow: visible; transition: opacity .7s ease; }
.opening__whisk path { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; }
.opening__whisk .rose { stroke: var(--rose); }
.opening__logo { width: min(74vw, 460px); height: auto; opacity: 0; transform: scale(.96);
  transition: opacity .9s ease .1s, transform 1.4s var(--ease-out) .1s; }
#opening.is-drawn .opening__whisk { opacity: 0; }
#opening.is-drawn .opening__logo { opacity: 1; transform: none; }

/* ---------- hero ---------- */
#hero { position: relative; height: 650vh; height: 650svh; }
.hero__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #060304; }
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.beats { position: absolute; inset: 0; pointer-events: none; }
.beat {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 var(--gutter); opacity: 0; will-change: opacity, transform;
  transform: translate3d(0, var(--y, 0px), 0);
}
.beat__in { max-width: 32rem; pointer-events: auto; }
.beat h1, .beat h2 { color: inherit; }
.beat h1 { font-size: var(--step-4); max-width: 10em; letter-spacing: -.01em; }
.beat h2 { font-size: var(--step-3); }
.beat p { margin-top: var(--space-2); font-size: var(--step-1); line-height: 1.5; font-weight: 400; }
.beat--light p { color: var(--ink); }
.beat--dark { color: var(--cream); }
.beat--light { color: var(--plum); }
.beat--left { justify-content: flex-start; }
.beat--right { justify-content: flex-end; }
.beat--center { justify-content: center; text-align: center; }
.beat--center .beat__in { max-width: 38rem; }

/* opening line rises once, after the curtain lifts */
.beat--intro .beat__in { opacity: 0; }
.is-ready .beat--intro .beat__in { animation: rise 1.4s var(--ease-out) .25s both; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* closing beat: soft cream wash so text stays legible over the frosting */
.beat--cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 55% at 50% 52%, rgba(244, 234, 223, .9), rgba(244, 234, 223, 0) 100%);
}
.beat__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.beat--center .beat__actions { justify-content: center; }
.beat__note { font-size: var(--step--1) !important; color: var(--plum-soft); }

.hero__cue {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1.6rem);
  transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .6rem;
  color: rgba(244, 234, 223, .7); font-size: .78rem; letter-spacing: .18em; transition: opacity var(--dur-med) ease;
}
.hero__cue i { width: 1px; height: 2.6rem; background: linear-gradient(rgba(228, 180, 108, .9), rgba(228, 180, 108, 0)); }
.hero__cue.is-hidden { opacity: 0; }

/* wide screens: keep the words clear of the cake in the middle of the frame */
@media (min-aspect-ratio: 17/20) {
  #b2 .beat__in { max-width: min(26rem, 30vw); }
  #b3 .beat__in { max-width: min(22rem, 26vw); }
}

/* portrait phones and tablets: text moves to the top or bottom, clear of the cake */
@media (max-aspect-ratio: 17/20) {
  .beat { align-items: flex-end; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 11svh); }
  .beat--top { align-items: flex-start; padding-top: 17svh; padding-bottom: 0; }
  .beat--left, .beat--right { justify-content: flex-start; }
  .beat--cta::before {
    background: linear-gradient(to top, rgba(244, 234, 223, .96) 8%, rgba(244, 234, 223, 0) 72%);
  }
  .beat--top.beat--light::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(to bottom, rgba(244, 234, 223, .85), rgba(244, 234, 223, 0) 45%);
  }
  .beat h1 { font-size: clamp(2.5rem, 11vw, 3.6rem); }
  #hero { height: 520vh; height: 520svh; }
}

/* ---------- footer ---------- */
.site-footer { background: var(--plum); color: var(--cream); padding: var(--space-5) 0 var(--space-4); }
.site-footer__grid { display: grid; gap: var(--space-4); }
.site-footer__brand img { width: min(60vw, 220px); height: auto; filter: brightness(0) invert(1); opacity: .92; }
.site-footer__brand p { margin-top: var(--space-2); font-family: var(--font-display); font-style: italic; font-size: var(--step-1); color: var(--blush); }
.site-footer h2 { font-family: var(--font-body); font-size: var(--step--1); letter-spacing: .12em; color: var(--gold-bright); margin-bottom: var(--space-1); font-weight: 400; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.site-footer__legal { margin-top: var(--space-4); padding-top: var(--space-2); border-top: 1px solid rgba(244, 234, 223, .2); font-size: var(--step--1); color: rgba(244, 234, 223, .7); }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; align-items: start; } }

/* no-JS: show the poster and the words, skip the choreography */
.no-js #opening { display: none; }
.no-js .beat { position: static; opacity: 1; padding-block: var(--space-3); }
.no-js #hero { height: auto; }
.no-js .hero__stage { position: static; height: auto; }
.no-js .beat__in { opacity: 1 !important; }

/* footer legal links */
.site-footer__legal a { color: inherit; text-underline-offset: 4px; }
.site-footer__legal a:hover, .site-footer__legal a:focus-visible { color: var(--cream); }
