/* ============================================================
   BET X — styles
   Tokens follow DESIGN.md (Ferrari-derived): near-black canvas,
   Rosso Corsa used scarcely, single sans family, 8px spacing
   ladder, hairlines instead of shadows, photography as depth.
   Deviation from DESIGN.md by client request: soft corners
   (14px cards, 6px buttons) instead of 0px.
   ============================================================ */

:root {
  /* colors */
  --primary: #da291c;
  --primary-active: #b01e0a;
  --ink: #ffffff;
  --body: #969696;
  --muted: #666666;
  --muted-soft: #8f8f8f;
  --hairline: #303030;
  --canvas: #181818;
  --canvas-elevated: #303030;
  --canvas-light: #ffffff;
  --body-on-light: #181818;
  --hairline-on-light: #d2d2d2;
  --surface-soft-light: #f7f7f7;

  /* typography: Inter is the documented FerrariSans substitute */
  --sans: 'Inter', -apple-system, system-ui, 'Segoe UI', sans-serif;

  /* spacing ladder */
  --sp-xxxs: 4px;
  --sp-xxs: 8px;
  --sp-xs: 16px;
  --sp-sm: 24px;
  --sp-md: 32px;
  --sp-lg: 48px;
  --sp-xl: 64px;
  --sp-xxl: 96px;
  --sp-super: 128px;

  /* radii */
  --r-card: 14px;
  --r-btn: 6px;

  --maxw: 1280px;
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: inherit; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
figure { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; color: var(--ink); }
:focus-visible { outline: 2px solid #f6e500; outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* type roles */
.display-mega { font-size: clamp(36px, 6vw, 80px); line-height: 1.05; letter-spacing: -0.02em; }
.display-xl   { font-size: clamp(32px, 4.2vw, 56px); line-height: 1.1;  letter-spacing: -0.02em; }
.display-lg   { font-size: clamp(28px, 3vw, 36px);   line-height: 1.2;  letter-spacing: -0.01em; }
.display-md   { font-size: 26px; line-height: 1.4; letter-spacing: 0.0075em; }
.caption-upper {
  font-size: 11px; font-weight: 600; line-height: 1.4;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-soft);
}
.lead { font-size: 16px; line-height: 1.6; color: var(--body); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 32px;
  font-family: var(--sans); font-size: 14px; font-weight: 700; line-height: 1;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  border-radius: var(--r-btn); border: 1px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--ink); border-color: var(--primary); }
.btn-primary:hover { background: #e63a2d; border-color: #e63a2d; }
.btn-primary:active { background: var(--primary-active); border-color: var(--primary-active); }
.btn-outline { background: transparent; color: var(--ink); border-color: rgba(255, 255, 255, 0.7); }
.btn-outline:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.btn-sm { height: 40px; padding: 0 20px; font-size: 12px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(24, 24, 24, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap { display: flex; align-items: center; gap: var(--sp-md); height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 24px; height: 24px; }
.brand-name { font-size: 13px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; }
.site-nav { display: flex; gap: var(--sp-sm); margin-left: auto; }
.site-nav a {
  font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: 14px 0; opacity: 0.85;
}
.site-nav a:hover { opacity: 1; }
.lang-switch { display: flex; border: 1px solid var(--hairline); border-radius: var(--r-btn); overflow: hidden; }
.lang-switch button {
  appearance: none; border: 0; background: transparent; color: var(--body);
  padding: 8px 12px; cursor: pointer; font-family: var(--sans);
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }

/* ---------- hero (cinema band) ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(calc(100vh - 64px), 820px);
  display: flex; align-items: flex-end;
  background:
    radial-gradient(1200px 600px at 70% 30%, rgba(218, 41, 28, 0.10), transparent 65%),
    linear-gradient(180deg, #3c3c3c, #030303 64%);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: url("../assets/hero.jpg") center / cover no-repeat;
  opacity: 0.85;
  animation: hero-in 1.6s var(--ease) both;
}
@keyframes hero-in { from { transform: scale(1.06); opacity: 0; } to { transform: none; opacity: 0.85; } }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.15) 0%, rgba(24, 24, 24, 0.55) 55%, var(--canvas) 100%);
}
.hero-mark { display: none; }
.hero .wrap { position: relative; z-index: 1; width: 100%; padding-top: var(--sp-super); padding-bottom: var(--sp-xxl); }
.hero h1 { margin-top: var(--sp-sm); max-width: 14ch; }
.hero .lead { margin-top: var(--sp-sm); max-width: 560px; color: #d2d2d2; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-xs); margin-top: var(--sp-lg); }

/* ---------- spec strip ---------- */
.facts { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.facts .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.fact { padding: var(--sp-sm) var(--sp-sm) var(--sp-sm) 0; }
.fact + .fact { border-left: 1px solid var(--hairline); padding-left: var(--sp-sm); }
.fact dd { margin-top: var(--sp-xxs); font-size: 18px; font-weight: 500; color: var(--ink); letter-spacing: -0.005em; }

/* ---------- sections ---------- */
.section { padding: var(--sp-xxl) 0; border-bottom: 1px solid var(--hairline); }
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-lg); align-items: end; margin-bottom: var(--sp-xl);
}
.section-head h2 { margin-top: var(--sp-xs); }
.section-head .lead { max-width: 520px; }

/* photo cards (feature-card-photo) */
.media { position: relative; overflow: hidden; background: var(--canvas-elevated); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0) 55%, rgba(24, 24, 24, 0.6) 100%);
}

/* product */
.verticals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-sm); }
.vcard {
  background: var(--canvas-elevated); border-radius: var(--r-card); overflow: hidden;
  transition: transform 0.4s var(--ease);
}
.vcard:hover { transform: translateY(-4px); }
.vcard:hover .media img { transform: scale(1.04); }
.vcard .media { aspect-ratio: 16 / 10; }
.vcard-body { padding: var(--sp-md); }
.vcard h3 { margin-top: var(--sp-xs); }
.vcard .desc { margin-top: var(--sp-xs); color: #b4b4b4; }
.vcard ul { margin-top: var(--sp-sm); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.vcard li { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); font-size: 15px; font-weight: 500; color: var(--ink); display: flex; gap: 12px; align-items: baseline; }
.vcard li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); transform: translateY(-2px); }

.model { margin-top: var(--sp-xl); }
.model-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--hairline); margin-top: var(--sp-xs); }
.model-item { padding: var(--sp-sm) var(--sp-sm) var(--sp-sm) 0; }
.model-item + .model-item { border-left: 1px solid var(--hairline); padding-left: var(--sp-sm); }
.model-item .code { font-size: clamp(40px, 4vw, 56px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: lining-nums; }
.model-item h3 { font-size: 16px; font-weight: 500; margin-top: var(--sp-xs); }
.model-item p { margin-top: var(--sp-xxs); font-size: 14px; }

/* partnerships: light editorial band */
.section-light { background: var(--canvas-light); color: var(--body-on-light); border-bottom: 0; }
.section-light h2, .section-light h3 { color: var(--body-on-light); }
.section-light .lead { color: #444; }
.section-light .caption-upper { color: var(--muted); }
.groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-sm); }
.group {
  background: var(--surface-soft-light); border-radius: var(--r-card); overflow: hidden;
  display: flex; flex-direction: column; transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.group:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12); }
.group:hover .media img { transform: scale(1.04); }
.group .media { aspect-ratio: 3 / 2; }
.group-body { padding: var(--sp-sm); display: flex; flex-direction: column; flex: 1; }
.group h3 { font-size: 19px; line-height: 1.25; padding-bottom: var(--sp-xs); border-bottom: 1px solid var(--body-on-light); }
.group ul { flex: 1; }
.group li { padding: 11px 0; border-bottom: 1px solid var(--hairline-on-light); font-size: 14px; font-weight: 500; color: var(--body-on-light); }
.group .note { margin-top: var(--sp-xs); font-size: 12px; line-height: 1.5; color: var(--muted); }

/* timeline: race-position numerals */
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-sm); }
.step {
  padding: var(--sp-sm); border-radius: var(--r-card);
  background: linear-gradient(180deg, rgba(48, 48, 48, 0.6), rgba(24, 24, 24, 0));
  border: 1px solid var(--hairline);
}
.step .num { font-size: clamp(56px, 6vw, 80px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--primary); font-variant-numeric: lining-nums tabular-nums; }
.step .date { margin-top: var(--sp-xs); }
.step h3 { font-size: 20px; margin-top: var(--sp-xxs); }
.step p { margin-top: var(--sp-xxs); font-size: 14px; }

/* livery band */
.livery { background: linear-gradient(180deg, #a00c01, #da291c 64%); color: var(--ink); padding: var(--sp-xxl) 0; position: relative; overflow: hidden; }
.livery::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 60vw; aspect-ratio: 1;
  background: url("../assets/logo.svg") center / contain no-repeat; opacity: 0.08; filter: brightness(10);
  pointer-events: none;
}
.livery .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-lg); align-items: center; }
.livery h2 { color: var(--ink); }
.livery p { margin-top: var(--sp-xs); color: rgba(255, 255, 255, 0.85); font-size: 16px; }
.livery .btn-outline { border-color: var(--ink); }
.livery .btn-outline:hover { background: var(--ink); color: var(--primary); }

/* meeting */
.meet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-xl); align-items: center; }
.meet h2 { margin-top: var(--sp-xs); }
.meet .lead { margin-top: var(--sp-xs); max-width: 520px; }
.contacts { margin-top: var(--sp-md); display: grid; gap: var(--sp-xxs); }
.contact {
  display: flex; align-items: center; gap: var(--sp-xs);
  height: 48px; padding: 0 var(--sp-xs);
  border: 1px solid var(--hairline); border-radius: var(--r-btn); color: var(--ink);
  text-decoration: none; font-size: 14px; font-weight: 500; transition: border-color 0.2s var(--ease);
}
.contact:hover { border-color: var(--ink); }
.contact-key { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-soft); min-width: 84px; }
.contact-pending { padding: var(--sp-xs); border: 1px solid var(--hairline); border-radius: var(--r-btn); font-size: 14px; color: var(--body); }

.meet-visual { position: relative; border-radius: var(--r-card); overflow: hidden; aspect-ratio: 4 / 5; background: var(--canvas-elevated); }
.meet-visual > img { width: 100%; height: 100%; object-fit: cover; }
.meet-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(24, 24, 24, 0) 30%, rgba(24, 24, 24, 0.85) 100%); }
.meeting-card {
  position: absolute; left: var(--sp-sm); right: var(--sp-sm); bottom: var(--sp-sm); z-index: 1;
  background: rgba(24, 24, 24, 0.72); backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--r-card); padding: var(--sp-sm);
}
.meeting-card h3 { margin-top: var(--sp-xxs); }
.meeting-card dl { margin-top: var(--sp-xs); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.meeting-card dl > div { display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-xs); padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.meeting-card dt { align-self: center; }
.meeting-card dd { font-size: 14px; font-weight: 500; color: var(--ink); }
.meeting-card .logo { position: absolute; top: var(--sp-sm); right: var(--sp-sm); width: 24px; height: 24px; }

/* ---------- footer ---------- */
.site-footer { padding: var(--sp-xl) 0; font-size: 13px; color: var(--body); }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-lg); align-items: start; }
.site-footer .brand { margin-bottom: var(--sp-xs); }
.site-footer p { max-width: 720px; }
.site-footer p + p { margin-top: var(--sp-xxs); }
.legal { display: flex; align-items: center; gap: var(--sp-xs); white-space: nowrap; }
.age { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--hairline); border-radius: 50%; font-size: 11px; font-weight: 600; color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .groups { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .site-nav { display: none; }
  .hero .wrap { padding-top: var(--sp-xxl); padding-bottom: var(--sp-xl); }
  .facts .wrap { grid-template-columns: 1fr 1fr; }
  .fact:nth-child(3) { border-left: 0; padding-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--hairline); }
  .section-head, .verticals, .timeline, .meet, .livery .wrap { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }
  .model-item + .model-item { border-left: 0; padding-left: 0; border-top: 1px solid var(--hairline); }
  .meet-visual { aspect-ratio: auto; }
  .meet-visual > img { aspect-ratio: 16 / 10; }
  .meeting-card { position: static; margin: calc(-1 * var(--sp-xl)) var(--sp-xs) var(--sp-xs); }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header .wrap { gap: var(--sp-xs); }
  .brand-name { display: none; }
  .groups { grid-template-columns: 1fr; }
  .facts .wrap { grid-template-columns: 1fr; }
  .fact + .fact { border-left: 0; padding-left: 0; border-top: 1px solid var(--hairline); }
  .meeting-card dl > div { grid-template-columns: 1fr; gap: var(--sp-xxxs); }
  .meeting-card .logo { display: none; }
  .btn { width: 100%; }
  .btn-sm { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero::before { animation: none; }
  .media img, .vcard, .group, .btn { transition: none; }
}
