/* Emmanuel's Design System, component stylesheet.
   Loaded after tokens.css, so every custom property below exists already.
   Motion cannot be a token family in this format, so these four durations and
   two curves are the authoritative copies. tokens.json mirrors them for
   reference; change both together. */

:root {
  --dur-quick: 200ms;
  --dur-settle: 450ms;
  --dur-drift: 900ms;
  --dur-dwell: 5600ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out-slow: cubic-bezier(0.16, 0.84, 0.28, 1);
}

/* ---------- section head ---------- */
.em-sechead { display: flex; flex-direction: column; gap: var(--space-3); }
/* line-height 1 is right for the single line a label should be, but a longer
   one then collides with itself when it wraps. 1.4 costs nothing on one line. */
.em-eyebrow {
  margin: 0; font-family: var(--font-text); font-size: 11px; line-height: 1.4;
  font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--brass-000);
}
.em-sechead__h {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: 44px; line-height: 1.05; letter-spacing: -0.01em;
  color: var(--bone-000); text-wrap: balance;
}
.em-sechead__h--l { font-size: 64px; line-height: 0.98; letter-spacing: -0.015em; }
.em-sechead__h--xl { font-size: 88px; line-height: 0.94; letter-spacing: -0.02em; }
.em-sechead__sub {
  margin: 0; max-width: 56ch; font-family: var(--font-text); font-size: 15px;
  line-height: 1.6; color: var(--bone-200);
}
@media (max-width: 820px) {
  .em-sechead__h--xl { font-size: 56px; }
  .em-sechead__h--l { font-size: 40px; }
  .em-sechead__h { font-size: 32px; }
}

/* ---------- buttons ---------- */
.em-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 14px 22px; border-radius: var(--radius-hair);
  font-family: var(--font-text); font-size: 11px; font-weight: 500;
  line-height: 1; letter-spacing: 0.16em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background-color var(--dur-quick) var(--ease-out),
              color var(--dur-quick) var(--ease-out),
              border-color var(--dur-quick) var(--ease-out);
}
.em-btn--solid { background: var(--bone-000); color: var(--ink-000); border-color: var(--bone-000); }
.em-btn--solid:hover { background: var(--brass-000); border-color: var(--brass-000); color: var(--ink-000); }
.em-btn--outline { background: transparent; color: var(--bone-000); border-color: var(--brass-000); }
.em-btn--outline:hover { background: var(--brass-000); color: var(--ink-000); }
.em-btn--link {
  padding: 0; border: 0; background: none; color: var(--brass-000);
  letter-spacing: 0.1em; text-transform: none; font-size: 14px;
}
.em-btn--link:hover { color: var(--bone-000); }
.em-btn__arrow { transition: transform var(--dur-quick) var(--ease-out); }
.em-btn--link:hover .em-btn__arrow { transform: translateX(4px); }

/* ---------- look card ---------- */
.em-look { margin: 0; display: flex; flex-direction: column; }
.em-look__img {
  width: 100%; max-width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  object-position: center 18%; display: block; border-radius: var(--radius-0);
  background: var(--ink-100);
  transition: opacity var(--dur-drift) var(--ease-out-slow);
}
.em-look__meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); margin-top: var(--space-3);
  padding-top: var(--space-3); border-top: 1px solid var(--brass-200);
}
.em-look__name {
  font-family: var(--font-text); font-size: 15px; line-height: 1.3;
  color: var(--bone-000);
}
.em-look__price {
  font-family: var(--font-accent); font-size: 17px; font-weight: 500;
  line-height: 1; color: var(--brass-000); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- carousel ---------- */
.em-car { position: relative; }
.em-car__rail {
  display: flex; gap: var(--space-3); overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
  /* drift mode turns snapping off: a snap point fights a constant crawl and
     produces the stepping this replaced */
  scrollbar-color: var(--brass-200) transparent;
  cursor: grab; padding-bottom: var(--space-4);
  overscroll-behavior-x: contain;
}
.em-car__rail.is-grabbing { cursor: grabbing; scroll-snap-type: none; }
.em-car__rail.is-grabbing .em-look__img { pointer-events: none; }
.em-car__rail::-webkit-scrollbar { height: 5px; }
.em-car__rail::-webkit-scrollbar-thumb { background: var(--brass-200); }
.em-car__rail::-webkit-scrollbar-track { background: transparent; }
.em-car__slide { flex: 0 0 clamp(200px, 24vw, 272px); scroll-snap-align: start; }
.em-car__nav { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.em-car__arrow {
  width: 40px; height: 40px; display: inline-flex; align-items: center;
  justify-content: center; background: transparent; cursor: pointer;
  border: 1px solid var(--brass-200); border-radius: var(--radius-hair);
  color: var(--bone-000); font-family: var(--font-text); font-size: 15px;
  transition: border-color var(--dur-quick) var(--ease-out),
              color var(--dur-quick) var(--ease-out);
}
.em-car__arrow:hover { border-color: var(--brass-000); color: var(--brass-000); }


/* ---------- carousel, drift mode ---------- */
.em-car--drift .em-car__rail { scroll-snap-type: none; scroll-behavior: auto; }
.em-car--drift .em-car__rail::-webkit-scrollbar { height: 0; }
.em-car--drift .em-car__rail { scrollbar-width: none; }
.em-car__progress { height: 1px; background: var(--brass-200); margin-top: var(--space-2); position: relative; overflow: hidden; }
.em-car__progress i { position: absolute; inset: 0 auto 0 0; width: 22%; background: var(--brass-000); display: block; }

/* ---------- lightbox ---------- */
/* A class selector beats the UA stylesheet's [hidden] rule, so display:flex
   here would leave a full screen invisible overlay eating every click on the
   page. This line is load bearing. */
.em-lb[hidden] { display: none; }
.em-lb {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center;
  justify-content: center; padding: var(--space-5);
  background: rgba(8, 11, 9, 0.93);
  opacity: 0; transition: opacity var(--dur-settle) var(--ease-out);
}
.em-lb.is-open { opacity: 1; }
.em-lb__panel {
  display: grid; grid-template-columns: 1fr; gap: var(--space-5);
  background: var(--ink-100); max-width: 940px; width: 100%;
  max-height: 100%; overflow: auto; padding: var(--space-5);
  transform: translateY(10px); transition: transform var(--dur-drift) var(--ease-out-slow);
}
.em-lb.is-open .em-lb__panel { transform: none; }
@media (min-width: 760px) {
  .em-lb__panel { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); padding: var(--space-6); align-items: start; }
}
.em-lb__img { width: 100%; max-height: 74vh; object-fit: contain; background: var(--ink-000); }
.em-lb__side { display: flex; flex-direction: column; gap: var(--space-3); }
.em-lb__name { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.12; color: var(--bone-000); }
.em-lb__price { margin: 0; font-family: var(--font-accent); font-size: 28px; font-weight: 500; line-height: 1; color: var(--brass-000); font-variant-numeric: tabular-nums; }
.em-lb__meta { margin: 0; font-size: 13px; line-height: 1.6; color: var(--bone-200); }
.em-lb__note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--bone-200); }
.em-lb__acts { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.em-lb__close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 42px; height: 42px; background: transparent; cursor: pointer;
  border: 1px solid var(--brass-200); border-radius: var(--radius-hair);
  color: var(--bone-000); font-family: var(--font-text); font-size: 17px; line-height: 1;
  transition: border-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out);
}
.em-lb__close:hover { border-color: var(--brass-000); color: var(--brass-000); }
.em-look[data-em-open] { cursor: zoom-in; }
body.em-lb-open { overflow: hidden; }

/* ---------- the shape field: massive dim triangles behind everything ---------- */
.em-shapes {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.em-shapes svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.em-shapes polygon { fill: var(--ink-300); }
.em-shapes .s-brass { fill: var(--brass-000); }
.em-shapes g { opacity: 0.085; }
.em-shapes g.g-2 { opacity: 0.06; }
.em-shapes g.g-3 { opacity: 0.045; }

/* ---------- reveal variants: a bar that draws, and words that form ---------- */
.em-bar { height: 1px; background: var(--brass-200); border: 0; margin: 0; transform-origin: left center; }
.em-words > span { display: inline-block; }

/* ---------- the accent face at its text optical size ----------
   Bodoni Moda is a variable font with an opsz axis, and its DISPLAY optical
   sizes thin the hairlines to nothing. Set at 40px, the hyphen in
   (321) 352-7760 disappears completely and the number reads as two numbers
   with a space between them. Checked at 3x device pixel ratio to be sure it
   was the font and not the screenshot. Forcing the text optical size keeps
   the Bodoni voice and brings the hairline back.

   Put this on any accent-font string holding a hyphen, a period or a comma
   that has to be read. A price does not need it: $375 is all thick strokes. */
.em-accent-text { font-variation-settings: "opsz" 12, "wght" 500; }

/* ---------- store card ---------- */
.em-store {
  background: var(--ink-100); padding: var(--space-5);
  border-radius: var(--radius-0); display: flex; flex-direction: column;
  gap: var(--space-2);
}
.em-store__n {
  margin: 0; font-family: var(--font-text); font-size: 10px; line-height: 1;
  font-weight: 500; letter-spacing: 0.3em; color: var(--brass-000);
  font-variant-numeric: tabular-nums;
}
.em-store__name {
  margin: 0; font-family: var(--font-display); font-size: 22px;
  font-weight: 600; line-height: 1.14; color: var(--bone-000);
}
.em-store__ad {
  margin: 0; font-family: var(--font-text); font-size: 13px; line-height: 1.6;
  color: var(--bone-200);
}
.em-store__suite {
  margin: var(--space-1) 0 0; font-family: var(--font-text); font-size: 12px;
  font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bone-000); font-variant-numeric: tabular-nums;
}
/* The whole card is the target when it has a map link, not just the address
   line: a thumb on a phone deserves the whole plate. */
.em-store--link {
  text-decoration: none; color: inherit;
  transition: background-color var(--dur-quick) var(--ease-out);
}
/* ink-200, NOT ink-300. brass-000 measures 5.00:1 on ink-200 and 4.28:1 on
   ink-300, so the hover state of a card carrying brass text has to stop at
   ink-200. This is the rule in the brand book about brass never landing on a
   hovered surface, and it is why the hover is one step rather than two. */
.em-store--link:hover { background: var(--ink-200); }
.em-store__go {
  margin: auto 0 0; display: flex; align-items: center; gap: var(--space-2);
  padding-top: var(--space-3); font-family: var(--font-text); font-size: 11px;
  font-weight: 500; line-height: 1; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--brass-000);
  transition: color var(--dur-quick) var(--ease-out);
}
.em-store--link:hover .em-store__go { color: var(--bone-000); }
.em-store--link:hover .em-btn__arrow { transform: translateX(4px); }

/* ---------- spec list ---------- */
.em-spec { margin: 0; display: flex; flex-direction: column; }
.em-spec__row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-5); padding: 13px 0;
  border-bottom: 1px solid var(--brass-200);
}
.em-spec__row:last-child { border-bottom: 0; }
.em-spec__k {
  margin: 0; font-family: var(--font-text); font-size: 15px;
  color: var(--bone-200);
}
.em-spec__v {
  margin: 0; font-family: var(--font-text); font-size: 15px;
  color: var(--bone-000); text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- to confirm ---------- */
.em-tbc {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding-bottom: 2px; border-bottom: 1px dashed var(--brass-000);
  font-family: var(--font-text); font-size: 11px; line-height: 1.5;
  font-weight: 500; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--brass-000);
}
.em-tbc__mark {
  width: 5px; height: 5px; flex: none; background: var(--brass-000);
  transform: rotate(45deg);
}
.em-tbc--inline { border-bottom: 0; }

/* ---------- parallax band ---------- */
.em-plx { display: flex; flex-direction: column; gap: var(--space-3); }
.em-plx__inner {
  position: relative; overflow: hidden; height: clamp(240px, 42vh, 420px);
  border-radius: var(--radius-0); background: var(--ink-100);
}
.em-plx__img {
  position: absolute; inset: -12% 0 -12% 0; width: 100%; height: 124%;
  max-width: 100%; object-fit: cover; object-position: center 30%;
  display: block; will-change: transform;
}
.em-plx__cap {
  margin: 0; font-family: var(--font-text); font-size: 12px; line-height: 1.5;
  color: var(--bone-200);
}

/* ---------- reveals and parallax: scroll driven, progressive ----------
   Firefox does not support animation-timeline at all, so everything here is an
   enhancement on top of a visible resting state. Never move opacity 0 or a
   transform out of this block. */
.em-reveal { opacity: 1; transform: none; }
/* Composition: a box arrives from one side while the words and numbers inside
   arrive against it, so the section assembles instead of simply appearing.
   Resting state first, and it is the whole section, visible and in place. */
.em-cmp { opacity: 1; transform: none; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    @keyframes em-rise {
      from { opacity: 0; transform: translateY(16px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    @keyframes em-fade {
      from { opacity: 0; }
      to   { opacity: 1; }
    }
    @keyframes em-drift {
      from { transform: translate3d(0, -6%, 0); }
      to   { transform: translate3d(0, 6%, 0); }
    }
    .em-reveal {
      animation: em-rise var(--dur-settle) var(--ease-out) both;
      animation-timeline: view();
      animation-range: entry 8% cover 26%;
    }
    .em-reveal--slow {
      animation-name: em-rise;
      animation-duration: var(--dur-drift);
      animation-timing-function: var(--ease-out-slow);
      animation-range: entry 4% cover 32%;
    }
    .em-reveal--fade { animation-name: em-fade; }

    /* a rule that draws itself left to right */
    @keyframes em-draw {
      from { transform: scaleX(0); opacity: 0.4; }
      to   { transform: scaleX(1); opacity: 1; }
    }
    .em-bar {
      animation: em-draw var(--dur-drift) var(--ease-out-slow) both;
      animation-timeline: view();
      animation-range: entry 10% cover 30%;
    }

    /* words forming in sequence. Scroll timelines ignore animation-delay, so
       the stagger is a per-word animation-range start, set inline as --i.
       em-cmp-in rather than em-rise so that a word inherits whatever direction
       an ancestor sets, and behaves exactly like em-rise when none does. */
    .em-words > span {
      animation: em-cmp-in var(--dur-settle) var(--ease-out) both;
      animation-timeline: view();
      animation-range: entry calc(6% + (var(--i, 0) * 2.2%)) cover calc(24% + (var(--i, 0) * 2.2%));
    }

    /* a figure that slides up out of its own line */
    @keyframes em-lift {
      from { transform: translateY(0.5em); opacity: 0; }
      to   { transform: translateY(0); opacity: 1; }
    }
    .em-store__n {
      animation: em-lift var(--dur-settle) var(--ease-out) both;
      animation-timeline: view();
      animation-range: entry 12% cover 30%;
    }

    /* the background triangles, driven by the whole document rather than by
       their own time in view, because they never leave the viewport */
    @keyframes em-drift-1 { from { transform: translate3d(0, -7vh, 0) rotate(0deg); } to { transform: translate3d(0, 7vh, 0) rotate(-3deg); } }
    @keyframes em-drift-2 { from { transform: translate3d(0, 12vh, 0); } to { transform: translate3d(0, -12vh, 0); } }
    @keyframes em-drift-3 { from { transform: translate3d(-3vw, 6vh, 0); } to { transform: translate3d(3vw, -6vh, 0); } }
    .em-shapes .g-1 { animation: em-drift-1 linear both; animation-timeline: scroll(root); }
    .em-shapes .g-2 { animation: em-drift-2 linear both; animation-timeline: scroll(root); }
    .em-shapes .g-3 { animation: em-drift-3 linear both; animation-timeline: scroll(root); }

    .em-plx__img {
      animation: em-drift linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }

    /* ---------- composition: two halves closing on each other ----------
       One keyframe for the whole mechanic. Direction is not baked into it: it
       reads two inherited custom properties, so a class that sets nothing but
       --from-x on a container steers every .em-cmp beneath it, words included.
       With neither set this is identical to em-rise, which is why it can also
       drive .em-words.

       This block sits last in the @supports on purpose. .em-cmp and
       .em-store__n are both single class selectors, so source order is what
       lets an element carrying both compose instead of lift. */
    @keyframes em-cmp-in {
      from { opacity: 0; transform: translate3d(var(--from-x, 0px), var(--from-y, 16px), 0); }
      to   { opacity: 1; transform: translate3d(0, 0, 0); }
    }
    .em-cmp {
      animation: em-cmp-in var(--dur-settle) var(--ease-out) both;
      animation-timeline: view();
      /* Two things are tuned into these ranges.

         One: a scroll timeline ignores animation-duration, so the separation
         between a box and its contents has to live in the range. The box
         lands first and the type then travels against something already
         still, which is the only way a counter direction reads at all.
         Opposing a parent that is still moving simply cancels out: a box
         coming 26px from the right with type coming 14px from the left inside
         it nets to a 12px slide and no opposition. Measured that the hard way.

         Two: the phase is cover, not entry. An entry percentage is a slice of
         the subject's own height, so for a short block it is spent in the
         bottom sliver of the screen and the movement is over before anyone
         has really seen it: entry 2% to cover 22% put 91% of the box travel
         into the first 100px of scroll, with the cards still half below the
         fold. Cover is measured against the viewport plus the subject, so a
         cover percentage lands the motion at a predictable height on screen
         whatever the block is: 34% leaves a box settled with its top around
         the middle of the lower half, and the type finishes as the block
         reaches the center. */
      animation-range: cover calc(18% + (var(--i, 0) * 2.4%)) cover calc(46% + (var(--i, 0) * 2.4%));
    }
    .em-cmp--box {
      animation-timing-function: var(--ease-out-slow);
      animation-range: cover 6% cover 34%;
    }

    /* ABOVE THE FOLD THERE IS NO SCROLL TO DRIVE ANYTHING. The first screen is
       already in view at scroll 0, so a view() range that starts at 14% or 29%
       catches those elements part way through and the page LOADS with its own
       intro half finished: measured the hero paragraph at 0.33 opacity and
       9px off its mark before this rule existed. Anything in the first screen
       gets .em-intro on its container instead, which keeps the identical
       keyframe and direction but runs it once on the document timeline. The
       stagger can be a real delay here, which a scroll timeline cannot use. */
    .em-intro .em-cmp,
    .em-intro .em-words > span {
      animation-timeline: auto;
      animation-range: normal;
    }
    .em-intro .em-cmp {
      animation-duration: var(--dur-settle);
      animation-delay: calc(var(--i, 0) * 80ms);
    }
    .em-intro .em-words > span { animation-delay: calc(var(--i, 0) * 45ms); }
    .em-intro .em-cmp--box { animation-duration: var(--dur-drift); }

    /* THE LAST SCREEN OF A DOCUMENT CANNOT REACH A HIGH COVER PERCENTAGE. The
       page stops scrolling before it gets there, so an animation ranged into
       the upper half of its cover phase never finishes, and on a taller
       footer never starts. Measured on the closing line: on a 1440 by 900
       screen it topped out at 32% of its own cover phase and held at a
       quarter opacity for good, and on a 390 by 844 phone, where the footer
       wraps to nearly twice the height, the phone number never appeared at
       all. Nothing in the console, nothing in the layout, just a missing
       number.

       The fix is to stop measuring against the viewport. A tail block names
       its own view timeline and its contents run on ENTRY percentages against
       that block, which complete the moment the block is fully in view. At
       the bottom of a document that always happens, whatever the footer does.
       Entry against the block rather than against each little element also
       keeps the timing readable: the range is a share of the block's height,
       not of a 40px link's.

       If the name ever fails to resolve, the animation has no timeline, so it
       simply does not apply and the resting state shows. That is the right
       way round for this one. */
    .em-tail { view-timeline-name: --em-tail; view-timeline-axis: block; }
    .em-cmp--tail {
      animation-timeline: --em-tail;
      animation-range: entry calc(4% + (var(--i, 0) * 7%)) entry calc(58% + (var(--i, 0) * 7%));
    }
    .em-tail .em-words > span {
      animation-timeline: --em-tail;
      animation-range: entry calc(4% + (var(--i, 0) * 4%)) entry calc(46% + (var(--i, 0) * 4%));
    }

    /* The directions exist only where the layout has two halves to close.
       Below this width the columns stack, opposing horizontal travel reads as
       jitter rather than assembly, and a sideways shift inside a padded
       wrapper can push a horizontal scrollbar onto a phone. So narrow
       screens keep the plain rise. */
    @media (min-width: 900px) {
      .em-from-l { --from-x: -14px; --from-y: 0px; }
      .em-from-r { --from-x: 14px; --from-y: 0px; }
      .em-cmp--box.em-from-l { --from-x: -26px; }
      .em-cmp--box.em-from-r { --from-x: 26px; }
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .em-reveal, .em-words > span, .em-store__n, .em-cmp { opacity: 1 !important; transform: none !important; }
  .em-cmp--tail { opacity: 1 !important; transform: none !important; }
  .em-bar { transform: none !important; opacity: 1 !important; }
  .em-plx__img { transform: none !important; }
  .em-shapes g { transform: none !important; }
  .em-lb { transition: none !important; }
  .em-lb__panel { transform: none !important; }
  .em-btn--link:hover .em-btn__arrow { transform: none; }
  .em-store--link:hover .em-btn__arrow { transform: none; }
}

/* ---------- focus ---------- */
.em-btn:focus-visible,
.em-store--link:focus-visible,
.em-car__arrow:focus-visible,
.em-car__rail:focus-visible,
.em-look a:focus-visible,
.em-lb__close:focus-visible,
.em-look[data-em-open]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
