/* ==========================================================================
   Apex Gear — premium outdoor sports equipment (portfolio demo)
   Typography-first, dark, athletic. Vanilla CSS, no framework.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------ */
:root {
  /* Palette: near-black ground, off-white type, one signal accent. */
  --ink:        #0A0A0B;
  --ink-raise:  #101012;
  --ink-line:   #1F1F23;
  --paper:      #F2F2EF;
  --paper-dim:  #A2A2A0;  /* 7.7:1 on --ink */
  --paper-mute: #808082;  /* 5.0:1 on --ink — quietest text still clears AA */
  --accent:     #FF4A1C;
  --accent-hot: #FF6A42;

  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Vertical rhythm — generous, fluid. */
  --section-y: clamp(6rem, 12vw, 12rem);
  --shell-max: 1360px;
  --shell-pad: clamp(1.25rem, 5vw, 4rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 76px;
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1; }
p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

/* --- Focus / a11y ------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: fixed; top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 200;
  padding: 0.85rem 1.5rem;
  background: var(--accent); color: var(--ink);
  font-weight: 600; font-size: 0.875rem;
  border-radius: 0 0 8px 8px;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* --- Layout primitives -------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--shell-pad);
}

.eyebrow {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow--light { color: var(--accent-hot); }

/* No cap on the head itself: a `ch` limit here is measured in the body font and
   would wrap the much larger display title in the wrong places. The note below
   carries its own measure instead. */
.section-head__title {
  margin-top: 1.25rem;
  font-size: clamp(2.25rem, 5.5vw, 4.25rem);
  letter-spacing: -0.035em;
}
.section-head__note {
  margin-top: 1.5rem;
  max-width: 46ch;
  color: var(--paper-dim);
  font-size: clamp(1rem, 1.4vw, 1.0625rem);
}

/* --- Wordmark ----------------------------------------------------------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wordmark__mark {
  width: 12px; height: 12px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.wordmark__thin { font-weight: 500; color: var(--paper-dim); }
.wordmark--footer { font-size: 1.25rem; }

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease),
              backdrop-filter 0.35s var(--ease);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-h);
}

/* Solid/blurred once scrolled off the hero. */
.site-header.is-scrolled {
  background: rgba(10, 10, 11, 0.82);
  border-bottom-color: var(--ink-line);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-scrolled { background: rgba(10, 10, 11, 0.97); }
}

.nav__list { display: flex; gap: clamp(1.25rem, 2.5vw, 2.5rem); }
.nav__list a {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--paper);
}
.nav__list a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav__list a:hover::after,
.nav__list a:focus-visible::after { transform: scaleX(1); transform-origin: left; }

@media (max-width: 860px) { .nav { display: none; } }

/* --- Burger ------------------------------------------------------------- */
.burger {
  display: none;
  padding: 0.5rem;
  margin-right: -0.5rem;
  background: none;
  border: 0;
  cursor: pointer;
}
@media (max-width: 860px) { .burger { display: block; } }

.burger__box {
  position: relative;
  display: block;
  width: 26px; height: 12px;
}
.burger__bar, .burger__bar::before {
  content: '';
  position: absolute;
  left: 0;
  width: 26px; height: 2px;
  background: var(--paper);
  transition: transform 0.3s var(--ease), opacity 0.2s linear;
}
.burger__bar { top: 0; }
.burger__bar::before { top: 10px; }

.burger[aria-expanded="true"] .burger__bar { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] .burger__bar::before { transform: translateY(-10px) rotate(-90deg); }

/* --- Mobile nav overlay ------------------------------------------------- */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--ink);
  padding: calc(var(--header-h) + 3rem) var(--shell-pad) 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mobile-nav[hidden] { display: none; }

.mobile-nav__inner ul { display: flex; flex-direction: column; gap: 0.25rem; }
.mobile-nav__inner a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 11vw, 3rem);
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--ink-line);
}
.mobile-nav__idx {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
}
.mobile-nav__foot {
  margin-top: 3rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-mute);
}

/* Staggered entrance for the overlay links. */
.motion .mobile-nav.is-open .mobile-nav__inner li {
  animation: navIn 0.5s var(--ease) backwards;
}
.motion .mobile-nav.is-open .mobile-nav__inner li:nth-child(1) { animation-delay: 0.06s; }
.motion .mobile-nav.is-open .mobile-nav__inner li:nth-child(2) { animation-delay: 0.12s; }
.motion .mobile-nav.is-open .mobile-nav__inner li:nth-child(3) { animation-delay: 0.18s; }
.motion .mobile-nav.is-open .mobile-nav__inner li:nth-child(4) { animation-delay: 0.24s; }
@keyframes navIn { from { opacity: 0; transform: translateY(14px); } }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
              border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn--ghost {
  border-color: rgba(242, 242, 239, 0.45);
  color: var(--paper);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--paper);
  background: rgba(242, 242, 239, 0.1);
  transform: translateY(-2px);
}
/* Ink on hi-vis orange, not white: white on this orange is only 3.4:1, while
   ink clears AA at 5.9:1 — and it reads more like technical safety kit. */
.btn--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.btn--solid:hover {
  background: var(--accent-hot);
  border-color: var(--accent-hot);
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* --- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: min(100svh, 940px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: calc(var(--header-h) + 4rem);
  padding-bottom: clamp(4rem, 9vw, 7rem);
  overflow: hidden;
}

.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__img {
  width: 100%;
  /* Overscan gives the parallax transform room to travel without gapping. */
  height: 118%;
  object-fit: cover;
  object-position: 50% 42%;
  will-change: transform;
}

/* Scrim: dark at the bottom for type contrast, dark at the top for the nav. */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(10,10,11,0.94) 0%, rgba(10,10,11,0.72) 32%,
                    rgba(10,10,11,0.28) 62%, rgba(10,10,11,0.45) 100%);
}

.hero__body { position: relative; }
.hero__title {
  margin-top: 1.5rem;
  font-size: clamp(2.75rem, 9.5vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
  text-wrap: balance;
}
.hero__lede {
  margin-top: 1.75rem;
  max-width: 52ch;
  font-size: clamp(1rem, 1.6vw, 1.1875rem);
  line-height: 1.6;
  color: rgba(242, 242, 239, 0.82);
}

.hero__scroll {
  position: absolute;
  right: var(--shell-pad);
  bottom: clamp(4rem, 9vw, 7rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.hero__scroll-line {
  width: 1px; height: 56px;
  background: linear-gradient(to bottom, transparent, var(--accent));
}
.hero__scroll-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-dim);
  writing-mode: vertical-rl;
}
@media (max-width: 860px) { .hero__scroll { display: none; } }

/* --- Intro -------------------------------------------------------------- */
.intro { padding-block: var(--section-y); }
.intro__inner {
  /* Sized for the display-font lead, not the body copy — a `ch` measure here
     would be far too narrow and stack the lead into five short lines. */
  max-width: 60rem;
  margin-inline: auto;
  text-align: center;
}
.intro__lead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.intro__body {
  margin-top: 2rem;
  margin-inline: auto;
  max-width: 56ch;
  color: var(--paper-dim);
  font-size: clamp(1rem, 1.4vw, 1.0625rem);
}

/* --- Product grid ------------------------------------------------------- */
.products { padding-bottom: var(--section-y); }

.grid {
  display: grid;
  /* minmax(0,1fr) so long words can never blow the track out on mobile. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.75rem);
  margin-top: clamp(3rem, 6vw, 5rem);
}
@media (max-width: 800px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* Tall enough that the text block never climbs out of the scrim: on narrow
     screens the copy is ~300px, so a short card would push the label up into
     the bright part of the photo. */
  min-height: clamp(500px, 46vw, 620px);
  padding: clamp(1.5rem, 3vw, 2.75rem);
  overflow: hidden;
  border-radius: 4px;
  background: var(--ink-raise);
}

.card__media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.card:hover .card__media img { transform: scale(1.055); }
@media (prefers-reduced-motion: reduce) {
  .card:hover .card__media img { transform: none; }
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Weighted to stay dense through the whole text block, not just the last
     inch. The small orange label is the binding constraint — mid-luminance
     type needs a genuinely dark backdrop to clear AA over a bright sky. */
  background: linear-gradient(to top,
                              rgba(10,10,11,0.97) 0%,
                              rgba(10,10,11,0.93) 50%,
                              rgba(10,10,11,0.78) 72%,
                              rgba(10,10,11,0.30) 88%,
                              rgba(10,10,11,0.08) 100%);
  transition: opacity 0.5s var(--ease);
}
.card:hover::after { opacity: 0.92; }

/* Wider cards are taller relative to their copy, so the text already sits low.
   Tighten the dark zone to the bottom and give the photograph back its top half
   — same AA margin on the label, considerably more image. */
@media (min-width: 800px) {
  .card::after {
    background: linear-gradient(to top,
                                rgba(10,10,11,0.96) 0%,
                                rgba(10,10,11,0.91) 52%,
                                rgba(10,10,11,0.50) 68%,
                                rgba(10,10,11,0.12) 84%,
                                rgba(10,10,11,0) 100%);
  }
}

.card__body { position: relative; }
.card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-hot);
}
.card__title {
  margin-top: 0.75rem;
  font-size: clamp(1.875rem, 3.4vw, 2.75rem);
  letter-spacing: -0.035em;
}
.card__copy {
  margin-top: 1rem;
  max-width: 40ch;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: rgba(242, 242, 239, 0.8);
}
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
}
.card__meta span { display: inline-flex; align-items: center; gap: 0.6rem; }
.card__meta span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--paper-mute);
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
@media (max-width: 460px) {
  .card__actions { flex-direction: column; align-items: stretch; }
}

/* --- Pillars ------------------------------------------------------------ */
.pillars {
  padding-block: var(--section-y);
  border-top: 1px solid var(--ink-line);
}
.pillars__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem);
  margin-top: clamp(3rem, 6vw, 4.5rem);
}
@media (max-width: 860px) { .pillars__grid { grid-template-columns: minmax(0, 1fr); } }

.pillar__icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border: 1px solid var(--ink-line);
  border-radius: 50%;
  color: var(--accent);
}
.pillar__icon svg { width: 22px; height: 22px; }

.pillar__title {
  margin-top: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.pillar__copy {
  margin-top: 0.875rem;
  color: var(--paper-dim);
  font-size: 0.9375rem;
}

.pillars__figure {
  margin: clamp(3.5rem, 7vw, 5.5rem) 0 0;
  border-radius: 4px;
  overflow: hidden;
}
.pillars__figure img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: 50% 50%;
}
.pillars__figure figcaption {
  margin-top: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--paper-mute);
}

/* --- Newsletter --------------------------------------------------------- */
.signup {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-top: 1px solid var(--ink-line);
}
.signup__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  filter: grayscale(0.4);
}
.signup::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to right, rgba(10,10,11,0.95) 0%, rgba(10,10,11,0.86) 55%,
                              rgba(10,10,11,0.7) 100%);
}
.signup__inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(2.5rem, 5vw, 5rem);
  padding-block: var(--section-y);
}
@media (max-width: 860px) { .signup__inner { grid-template-columns: minmax(0, 1fr); } }

.signup__title {
  margin-top: 1.25rem;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.035em;
}
.signup__copy {
  margin-top: 1.25rem;
  max-width: 44ch;
  color: var(--paper-dim);
  font-size: clamp(1rem, 1.4vw, 1.0625rem);
}

.field {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid rgba(242, 242, 239, 0.28);
  transition: border-color 0.25s var(--ease);
}
.field:focus-within { border-bottom-color: var(--accent); }
@media (max-width: 520px) { .field { flex-direction: column; align-items: stretch; } }

.field__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  font-size: 1.0625rem;
}
.field__input::placeholder { color: var(--paper-mute); }
.field__input:focus { outline: none; }

.btn--submit { flex: none; }

.field__msg {
  margin-top: 0.875rem;
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: var(--paper-dim);
}
.field__msg.is-error { color: var(--accent-hot); }
.field__msg.is-ok { color: var(--paper); }
.field.is-error { border-bottom-color: var(--accent-hot); }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  padding-block: clamp(4rem, 8vw, 6rem) 2.5rem;
  border-top: 1px solid var(--ink-line);
  background: var(--ink);
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--ink-line);
}
.site-footer__pitch {
  max-width: 34ch;
  font-size: 0.875rem;
  color: var(--paper-dim);
}

/* Desktop: 4 categories across. Tablet (≤860px): 2 per row — unchanged from
   the original design. Mobile inherits that same 2-per-row rule rather than
   collapsing further to a single stacked column, so only mobile's behavior
   actually changes here; desktop and tablet are exactly as before.
   minmax(0,1fr) keeps long lines (email, address) wrapping safely inside
   their track instead of overflowing at small widths. */
.site-footer__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
@media (max-width: 860px) { .site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.fcol__title {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-mute);
}
.fcol ul { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
/* overflow-wrap: anywhere so unbreakable tokens (the email address) wrap
   inside a halved 2-column track at narrow widths instead of overflowing. */
.fcol li { font-size: 0.875rem; color: var(--paper-dim); overflow-wrap: anywhere; }
.fcol a { transition: color 0.2s var(--ease); }
.fcol a:hover { color: var(--paper); }

.social { margin-top: 1.75rem !important; }
.social a { color: var(--paper); font-weight: 500; }
.social a:hover { color: var(--accent); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ink-line);
  font-size: 0.75rem;
  color: var(--paper-mute);
}
.legal { display: flex; gap: 1.5rem; }
.legal a:hover { color: var(--paper); }

/* --- Scroll reveal ------------------------------------------------------ */
/* Gated on .motion: without JS, or with reduced motion, content is never hidden. */
.motion [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.motion [data-reveal-delay="1"] { transition-delay: 0.09s; }
.motion [data-reveal-delay="2"] { transition-delay: 0.18s; }
.motion [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .motion [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero__img { transform: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Product modal ------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 7, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.modal.is-open .modal__backdrop { opacity: 1; }

.modal__dialog {
  position: relative;
  width: min(1040px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  background: var(--ink-raise);
  border: 1px solid var(--ink-line);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  -webkit-overflow-scrolling: touch;
}
.modal.is-open .modal__dialog { opacity: 1; transform: none; }

.modal__close {
  position: absolute;
  top: 0.85rem; right: 0.85rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--ink-line);
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.6);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.modal__close svg { width: 18px; height: 18px; }
.modal__close:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .modal__close:hover { transform: none; } }

.modal__grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 780px) { .modal__grid { grid-template-columns: minmax(0, 1fr); } }

.modal__media { margin: 0; position: relative; }
.modal__media img {
  width: 100%; height: 100%;
  min-height: 260px;
  object-fit: cover;
  object-position: 50% 45%;
  border-radius: 8px 0 0 8px;
}
@media (max-width: 780px) {
  .modal__media img { max-height: 240px; border-radius: 8px 8px 0 0; }
}

.modal__body { padding: clamp(1.5rem, 3.5vw, 2.75rem); }

.modal__label {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent-hot);
}
.modal__title {
  margin-top: 0.6rem;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -0.035em;
}
.modal__price {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--paper-dim);
}
.modal__price-from { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; }
#modal-price { color: var(--paper); }

.modal__desc {
  margin-top: 1.1rem;
  color: var(--paper-dim);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.modal__subhead {
  font-family: var(--font-body);
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--paper-mute);
  margin: 0;
}

.modal__specs { margin-top: 1.75rem; }
.modal__specs dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem 1.5rem;
  margin: 0.9rem 0 0;
}
.modal__specs dt { color: var(--paper-mute); font-size: 0.8125rem; }
.modal__specs dd {
  margin: 0;
  text-align: right;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--paper);
}

/* --- Configurator ------------------------------------------------------- */
.config { margin-top: 2rem; }
.config__group {
  border: 0;
  padding: 0;
  margin: 0 0 1.4rem;
  min-width: 0;
}
.config__group legend { padding: 0; margin-bottom: 0.7rem; }

.config__options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.config__options--stack { flex-direction: column; }

.chip {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 1rem;
  min-width: 3rem;
  background: transparent;
  border: 1px solid var(--ink-line);
  border-radius: 8px;
  color: var(--paper-dim);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.config__options--stack .chip { width: 100%; }
.chip:hover { border-color: var(--paper-mute); color: var(--paper); }
.chip[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(255, 74, 28, 0.1);
  color: var(--paper);
}
.chip__main { font-weight: 600; }
.chip__sub { font-size: 0.75rem; font-weight: 400; color: var(--paper-mute); }
.chip[aria-checked="true"] .chip__sub { color: var(--paper-dim); }

.config__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink-line);
}
.config__total { display: flex; flex-direction: column; gap: 0.15rem; }
.config__total-label {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--paper-mute);
}
.config__total-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--paper);
}
@media (max-width: 460px) {
  .config__foot { flex-direction: column; align-items: stretch; }
  .config__foot .btn { width: 100%; }
}

.config__msg {
  margin-top: 1rem;
  min-height: 1.1rem;
  font-size: 0.8125rem;
  color: var(--paper-dim);
}
.config__msg.is-ok { color: var(--paper); }

/* --- Toast -------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vw, 2.5rem);
  transform: translate(-50%, 140%);
  z-index: 200;
  max-width: calc(100vw - 2rem);
  padding: 0.9rem 1.4rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
  opacity: 0;
}
.toast[hidden] { display: none; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
