/* ==========================================================================
   OnCore Pilates on 72 | styles.css
   Mobile-first: base styles target phones, then min-width media queries
   layer on tablet (48em / 768px) and desktop (60em / 960px, 64em / 1024px).

   Contents
   1.  Design tokens
   2.  Base & reset
   3.  Utilities
   4.  Buttons
   5.  Frame motif (the logo's double gold rule)
   6.  Header & navigation
   7.  Hero
   8.  Membership options
   9.  Visit / map
   10. Footer
   11. Motion
   ========================================================================== */


/* 1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Brand palette (from the style guide) */
  --porcelain: #FAF8F2;   /* main backgrounds */
  --charcoal:  #3A3A3A;   /* body text, footer */
  --taupe:     #DCD2C5;   /* membership band */
  --gold:      #E0B161;   /* frames, rules, primary buttons */
  --sage:      #A3ADA0;   /* single quiet accent: the map frame */
  --black:     #000000;   /* wordmark, headlines */
  --bronze:    #76501D;   /* links & gold-toned text on light backgrounds (6.7:1) */

  /* Derived tones */
  --ink-soft:  #5F5A54;                    /* secondary text, 5.9:1 on porcelain */
  --rule:      rgba(58, 58, 58, .16);      /* hairline dividers */
  --sage-wash: #DFE2D9;                    /* sage blended into porcelain */
  --header-bg: rgba(250, 248, 242, .86);   /* frosted header */
  /* Metallic gold is reserved for the logo wordmark (style guide note) */
  --gold-metal: linear-gradient(180deg, #CF9E45 0%, #B07E2B 55%, #8A5F1F 100%);

  /* Typography: Cinzel's lowercase letters are small capitals, so
     "OnCore" typed normally renders like the logo (large O and C). */
  --font-display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --font-body: "Jost", "Futura", "Century Gothic", "Avenir Next", sans-serif;

  /* Fluid type scale: roughly 1.2 on phones, opening to 1.333 on desktop */
  --step--1: clamp(.8125rem, .79rem + .1vw, .875rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.25rem + 1vw, 2rem);
  --step-3:  clamp(1.85rem, 1.45rem + 2vw, 2.9rem);
  --step-4:  clamp(2.25rem, 1.55rem + 3.4vw, 4.25rem);

  /* Spacing */
  --space-xs:  .5rem;
  --space-s:   .75rem;
  --space-m:   1.25rem;
  --space-l:   2rem;
  --space-xl:  clamp(2.5rem, 2rem + 2.5vw, 3.75rem);
  --space-2xl: clamp(4rem, 2.5rem + 6vw, 7.5rem);

  /* Layout */
  --container: 74rem;
  --gutter: clamp(1.25rem, .6rem + 3vw, 3rem);
  --header-h: 4.25rem;
  --radius: 2px;
  --ease-out: cubic-bezier(.22, .61, .36, 1);

  color-scheme: light;   /* the brand palette is light-only */

  /* iPhone safe areas: keep content clear of the notch / home bar */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 60em) {
  :root { --header-h: 5.25rem; }
}


/* 2. BASE & RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* Anchor jumps land below the sticky header */
  scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 1rem);
}

body {
  margin: 0;
  background: var(--porcelain);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fills the strip behind the iPhone status bar so it matches the header */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

img, iframe { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--black);
  text-wrap: balance;
}

p { margin: 0 0 1em; }

a {
  color: var(--bronze);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: color .2s ease;
}
a:hover { color: var(--black); }

address { font-style: normal; }

:focus-visible {
  outline: 2px solid var(--bronze);
  outline-offset: 3px;
}

::selection { background: var(--gold); color: var(--black); }


/* 3. UTILITIES
   ========================================================================== */
/* Centered column; min() keeps side gutters on small screens */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

/* Text for screen readers only (e.g. "opens in a new tab") */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--black);
  color: var(--porcelain);
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + .5rem); }


/* 4. BUTTONS
   Hover: a charcoal fill sweeps in from the left (background-size
   transition), and the label turns porcelain.
   ========================================================================== */
.btn {
  --btn-bg: transparent;
  --btn-border: var(--charcoal);
  --btn-fill: var(--charcoal);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 3rem;
  padding: .8em 1.6em;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background-color: var(--btn-bg);
  background-image: linear-gradient(var(--btn-fill), var(--btn-fill));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  color: var(--black);
  font: 500 .9375rem/1.2 var(--font-body);
  letter-spacing: .05em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-size .45s var(--ease-out), color .3s ease, border-color .3s ease;
}
.btn:hover {
  background-size: 100% 100%;
  border-color: var(--btn-fill);
  color: var(--porcelain);
}
.btn:active { transform: translateY(1px); }

.btn--gold { --btn-bg: var(--gold); --btn-border: var(--gold); }   /* black on gold: 9.7:1 */
.btn--line { --btn-border: var(--charcoal); }
.btn--sm   { min-height: 2.5rem; padding: .55em 1.05em; font-size: .875rem; letter-spacing: .03em; white-space: nowrap; }


/* 5. FRAME MOTIF
   The logo sits inside a heavier outer gold rule and a fine inner rule.
   We recreate it with two absolutely positioned pseudo-elements so the
   frame never affects layout.
   ========================================================================== */
.frame {
  position: relative;
  padding: .875rem;
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.frame::before { inset: 0;   border: 2px solid var(--gold); }
.frame::after  { inset: 6px; border: 1px solid var(--gold); }

/* Drawn variant (hero only): each side of each rule is its own
   background layer, so the line can "draw" around the photo by growing
   the layers one after another (keyframes in section 11). */
.frame--draw::before,
.frame--draw::after {
  border: 0;
  background-image:
    linear-gradient(var(--gold), var(--gold)),   /* top    */
    linear-gradient(var(--gold), var(--gold)),   /* right  */
    linear-gradient(var(--gold), var(--gold)),   /* bottom */
    linear-gradient(var(--gold), var(--gold));   /* left   */
  background-repeat: no-repeat;
  background-position: top left, top right, bottom right, bottom left;
  background-size: 100% var(--w), var(--w) 100%, 100% var(--w), var(--w) 100%;
}
.frame--draw::before { --w: 2px; }
.frame--draw::after  { --w: 1px; }

.frame__clip { overflow: hidden; }


/* 6. HEADER & NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, box-shadow .3s ease;
}
/* Added by script.js once the page scrolls */
.site-header.is-scrolled {
  border-bottom-color: var(--rule);
  box-shadow: 0 10px 24px -20px rgba(0, 0, 0, .35);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  min-height: var(--header-h);
}

/* --- Logo lockup --- */
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-right: auto;          /* pushes nav + actions to the right */
  color: var(--black);
  text-decoration: none;
}
.brand__mark { width: auto; height: 2.5rem; }

.brand__word {
  display: grid;
  justify-items: center;
  line-height: 1;
  font-family: var(--font-display);
  font-weight: 700;
}
.brand__name {
  font-size: 1.3rem;
  letter-spacing: .01em;
}
/* "PILATES" and "ON 72" sit between short gold rules, as in the logo */
.brand__pilates,
.brand__on72 {
  display: flex;
  align-items: center;
  gap: .3em;
  width: 100%;
  text-transform: uppercase;
}
.brand__pilates::before, .brand__pilates::after,
.brand__on72::before,   .brand__on72::after {
  content: "";
  flex: 1;
  min-width: .35em;
  height: 1px;
  background: var(--gold);
}
.brand__pilates { margin-top: .22rem; font-size: .58rem; letter-spacing: .36em; }
.brand__pilates > span {
  padding-left: .36em;          /* balances letter-spacing after the last letter */
  background: var(--gold-metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__on72 { margin-top: .2rem; padding-inline: .45em; font-size: .5rem; letter-spacing: .22em; }
.brand__on72 > span { padding-left: .22em; }

/* --- Header actions (Purchase Now + menu toggle) --- */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -.6rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--black);
  cursor: pointer;
}
/* Two-line icon that turns into an X.
   Whole-pixel sizes on purpose: a fractional line (e.g. 1.5px) gets
   rounded differently depending on where it lands on the pixel grid,
   which made the top line render thicker than the bottom one. */
.nav-toggle__bars {
  position: relative;
  width: 22px;
  height: 10px;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform .3s var(--ease-out);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after  { bottom: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: translateY(-4px) rotate(-45deg); }

/* --- Mobile menu: a panel that drops below the header --- */
.site-nav__list {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  display: grid;
  margin: 0;
  padding: var(--space-xs) var(--gutter) var(--space-l);
  list-style: none;
  background: var(--porcelain);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 18px 30px -24px rgba(0, 0, 0, .4);
  /* hidden until .is-open; visibility keeps closed links out of tab order */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-.5rem);
  transition: opacity .25s ease, transform .3s var(--ease-out), visibility 0s linear .3s;
}
.site-nav__list.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .25s ease, transform .3s var(--ease-out), visibility 0s;
}
.site-nav__list li + li { border-top: 1px solid var(--rule); }

.site-nav__link {
  display: flex;
  align-items: center;
  gap: .4em;
  padding: .95rem 0;
  color: var(--charcoal);
  font-size: 1.0625rem;
  letter-spacing: .03em;
  text-decoration: none;
}
.site-nav__link:hover { color: var(--black); }

.icon-ext { width: .65em; height: .65em; flex: none; opacity: .7; }

/* Small phones (≤ 384px): tighten the lockup so logo, Purchase Now
   and the menu button share one row without wrapping */
@media (max-width: 24em) {
  .site-header__inner { gap: .5rem; }
  .brand { gap: .35rem; }
  .brand__mark { height: 2rem; }
  .brand__name { font-size: 1.08rem; }
  .brand__pilates { font-size: .5rem; }
  .brand__on72 { font-size: .45rem; }
  .btn--sm { padding-inline: .7em; font-size: .8125rem; letter-spacing: .02em; }
}

/* Desktop navigation: inline links, no toggle */
@media (min-width: 60em) {
  .site-header__inner { gap: clamp(1.5rem, 3vw, 2.75rem); }

  .brand { gap: .7rem; }
  .brand__mark { height: 3.1rem; }
  .brand__name { font-size: 1.6rem; }
  .brand__pilates { font-size: .7rem; }
  .brand__on72 { font-size: .6rem; }

  .nav-toggle,
  .site-nav__phone { display: none; }

  .site-nav__list {
    position: static;
    display: flex;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .site-nav__list li + li { border: 0; }

  /* Gold underline grows from the left on hover */
  .site-nav__link {
    padding: .35rem 0;
    font-size: .9375rem;
    background: linear-gradient(var(--gold), var(--gold)) left bottom / 0 1px no-repeat;
    transition: background-size .35s var(--ease-out), color .2s ease;
  }
  .site-nav__link:hover { background-size: 100% 1px; }

  .btn--sm { min-height: 2.75rem; padding-inline: 1.35em; font-size: .9rem; }
}


/* 7. HERO
   ========================================================================== */
.hero {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  padding-block: var(--space-xl) var(--space-2xl);
}

.hero__copy { max-width: 38rem; }

.hero__title {
  margin-bottom: var(--space-m);
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1.06;
}

/* Tagline: set in Cinzel, led by a short gold rule like the logo's */
.hero__tagline {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  margin-bottom: var(--space-l);
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.35;
  color: var(--bronze);
}
.hero__tagline::before {
  content: "";
  flex: 0 0 2.25rem;
  height: 1px;
  background: var(--gold);
  transform: translateY(-.32em);
}

.hero__copy > p { max-width: 34em; }   /* keeps lines under ~75 characters */

.hero__offer {
  margin-top: var(--space-l);
  font-weight: 500;
  color: var(--black);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

.hero__call {
  font-size: var(--step--1);
  color: var(--ink-soft);
}

.hero__media {
  justify-self: center;
  width: min(100%, 30rem);
}
.hero__media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--taupe);    /* shows while the photo loads */
}
/* Phones: a square crop keeps the photo from pushing the page too long */
@media (max-width: 35.9375em) {
  .hero__media img { aspect-ratio: 1 / 1; }
}

@media (min-width: 60em) {
  /* Text gets the wider column; the framed portrait echoes the tall logo */
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: clamp(3rem, 6vw, 6rem);
    padding-block: var(--space-2xl);
  }
  .hero__media { justify-self: end; }
}


/* 8. MEMBERSHIP OPTIONS
   ========================================================================== */
.membership {
  padding-block: var(--space-2xl);
  background: var(--taupe);
}

.section-head {
  max-width: 40rem;
  margin-bottom: var(--space-xl);
}
.section-head h2,
.visit h2 {
  margin-bottom: var(--space-m);
  font-size: var(--step-3);
}

/* --- Featured introductory offer --- */
.offer {
  display: grid;
  gap: var(--space-m);
  align-items: center;
  margin-bottom: var(--space-l);
  padding: clamp(1.75rem, 1rem + 3vw, 2.75rem);   /* overrides .frame padding */
  background: var(--porcelain);
}
.offer h3 {
  margin-bottom: .4rem;
  font-size: var(--step-2);
}
.offer__text p {
  margin: 0;
  color: var(--ink-soft);
}
.offer__price {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1;
  color: var(--black);
}
.offer .btn { justify-self: start; }

@media (min-width: 48em) {
  .offer {
    grid-template-columns: 1fr auto auto;
    gap: var(--space-l);
  }
}

/* --- Rate card: one porcelain sheet, three columns on desktop --- */
.rate-card {
  display: grid;
  gap: var(--space-xl);
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem);
  background: var(--porcelain);
  box-shadow: 0 24px 48px -36px rgba(58, 58, 58, .55);
}

.rate-group h3 {
  margin-bottom: var(--space-xs);
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--gold);
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: .02em;
}
.rate-group h4 {
  margin: var(--space-l) 0 .25rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--bronze);
}

.rates { margin: 0; }

/* One price row: name, dotted leader, price.
   The leader is .rate::after, re-ordered between <dt> and <dd>. An empty
   flex item's baseline is its bottom edge, so the dots sit on the text
   baseline; translateY lifts them to mid-letter height. */
.rate {
  display: flex;
  align-items: baseline;
  padding-block: .55rem;
}
.rate dt { order: 1; }
.rate::after {
  content: "";
  order: 2;
  flex: 1 1 1.5rem;
  min-width: 1.5rem;
  margin-inline: .6rem;
  border-bottom: 1px dotted rgba(58, 58, 58, .45);
  transform: translateY(-.3em);
}
.rate dd {
  order: 3;
  margin: 0;
  font-weight: 500;
  color: var(--black);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}
.rate__note {
  display: block;
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--ink-soft);
}

/* Tablet: Specials | Packages side by side; Private Sessions spans
   the full width and splits Privates | Duets into two columns. */
@media (min-width: 44em) {
  .rate-card { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-xl); }
  .rate-group--wide { grid-column: 1 / -1; }
  .rate-group__split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-xl);
  }
  .rate-group__split h4 { margin-top: .55rem; }
}

/* Desktop: three equal columns divided by hairlines */
@media (min-width: 64em) {
  /* Every column gets the same inner padding (and the sheet's own side
     padding shrinks to match), so all three columns are equally wide. */
  .rate-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding-inline: clamp(.5rem, 1vw, 1rem);
  }
  .rate-group { padding-inline: clamp(1.5rem, 2.5vw, 2.25rem); }
  .rate-group + .rate-group { border-left: 1px solid var(--rule); }
  .rate-group--wide { grid-column: auto; }
  .rate-group__split { display: block; }
  .rate-group__split h4 { margin-top: var(--space-l); }
}

.membership__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s) var(--space-m);
  margin-top: var(--space-l);
}
.membership__note {
  margin: 0;
  font-size: var(--step--1);
  color: var(--ink-soft);
}


/* 9. VISIT / MAP
   ========================================================================== */
.visit {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  padding-block: var(--space-2xl);
}
.visit__text > p { max-width: 34em; }

.contact {
  display: grid;
  gap: var(--space-m);
  margin-block: var(--space-l);
}
.contact p { margin: 0; }
.contact strong { font-weight: 500; color: var(--black); }

/* Map: aspect-ratio reserves the space before the iframe loads (no CLS).
   A light grayscale keeps Google's bright map colors calm on the palette. */
.visit__map {
  aspect-ratio: 4 / 3;
  padding: 6px;
  border: 1px solid var(--sage);
  background: var(--sage-wash);
}
.visit__map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  filter: grayscale(.35) contrast(.97);
}

@media (min-width: 30em) {
  .contact { grid-template-columns: auto auto; justify-content: start; column-gap: var(--space-xl); }
}
@media (min-width: 60em) {
  .visit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(3rem, 6vw, 6rem);
  }
}


/* 10. FOOTER
   ========================================================================== */
.site-footer {
  padding-block: var(--space-xl) var(--space-l);
  background: var(--charcoal);
  color: var(--porcelain);
  font-size: .9375rem;
}
.site-footer a { color: var(--gold); }            /* 5.2:1 on charcoal */
.site-footer a:hover { color: var(--porcelain); }
.site-footer :focus-visible { outline-color: var(--gold); }

.site-footer__inner {
  display: grid;
  gap: var(--space-l);
}
.site-footer__brand img {
  width: auto;
  height: 3.5rem;
  margin-bottom: var(--space-m);
}
.site-footer__nap p { margin-bottom: .35rem; }

.site-footer__nav ul {
  display: grid;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-footer__nav a { text-decoration: none; }
.site-footer__nav a:hover { text-decoration: underline; }

.site-footer__base {
  margin-top: var(--space-l);
  padding-top: var(--space-m);
  border-top: 1px solid rgba(250, 248, 242, .16);
  font-size: var(--step--1);
  color: rgba(250, 248, 242, .78);
}
.site-footer__base p { margin: 0; }

@media (min-width: 48em) {
  .site-footer__inner {
    grid-template-columns: 2fr 1fr;
    align-items: end;
  }
  .site-footer__nav ul { justify-items: end; }
}


/* 11. MOTION
   One deliberate moment: the hero frame draws itself around the photo.
   Below the fold, sections fade in as they scroll into view using
   CSS scroll-driven animations (no JavaScript). Browsers without support
   simply show everything. All motion is off for reduced-motion users.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .frame--draw::before { animation: frame-draw 1.5s linear .3s both; }
  .frame--draw::after  { animation: frame-draw 1.5s linear .65s both; }

  /* Transform only (no opacity), so the photo still counts for LCP right away */
  .frame__clip img { animation: settle 1.6s var(--ease-out) both; }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal-fade linear both;
      animation-timeline: view();
      animation-range: entry 0 entry 12rem;   /* fully visible once 12rem inside the viewport */
    }
  }
}

/* Top → right → bottom → left, one side per quarter */
@keyframes frame-draw {
  0%   { background-size: 0 var(--w),    var(--w) 0,    0 var(--w),    var(--w) 0; }
  25%  { background-size: 100% var(--w), var(--w) 0,    0 var(--w),    var(--w) 0; }
  50%  { background-size: 100% var(--w), var(--w) 100%, 0 var(--w),    var(--w) 0; }
  75%  { background-size: 100% var(--w), var(--w) 100%, 100% var(--w), var(--w) 0; }
  100% { background-size: 100% var(--w), var(--w) 100%, 100% var(--w), var(--w) 100%; }
}

@keyframes settle {
  from { transform: scale(1.04); }
  to   { transform: none; }
}

@keyframes reveal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
