/* ── Fazio Car Design System ──────────────────────────────
   Palette: Rosso #EC1B24, Bianco, Grigi neutri
   Type: Outfit (headings) + Inter (body)
   Scale: 4–8–12–16–24–32–48–64–96
   ──────────────────────────────────────────────────────── */

@layer reset, base, components, utilities;

/* ── Reset ─────────────────────────────────────────────── */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  html {
    -webkit-text-size-adjust: 100%;
  }
  img,
  svg,
  video {
    display: block;
    max-width: 100%;
    height: auto;
  }
  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }
  button {
    cursor: pointer;
    border: 0;
    background: none;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  ul,
  ol {
    list-style: none;
  }
  table {
    border-collapse: collapse;
  }
}

/* ── Design Tokens ─────────────────────────────────────── */
@layer base {
  :root {
    --color-red-500: #ec1b24;
    --color-red-600: #d4141c;
    --color-red-700: #b81018;
    --color-gray-50: #1a1a1a;
    --color-gray-100: #2d2d2d;
    --color-gray-200: #333333;
    --color-gray-300: #3d3d3d;
    --color-gray-400: #666666;
    --color-gray-500: #888888;
    --color-gray-600: #a0a0a0;
    --color-gray-700: #cccccc;
    --color-gray-800: #e0e0e0;
    --color-gray-900: #0d0d0d;
    --color-white: #ffffff;
    --color-black: #1a1a1a;

    --font-heading: "Outfit", sans-serif;
    --font-body: "Inter", sans-serif;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    --text-7xl: 4.5rem;

    --leading-tight: 1.1;
    --leading-snug: 1.35;
    --leading-normal: 1.6;
    --leading-relaxed: 1.75;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(236, 27, 36, 0.25);

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 200ms;
    --duration-base: 350ms;
    --duration-slow: 500ms;

    --max-width: 80rem;
    --max-width-narrow: 64rem;
    --max-width-text: 48rem;

    --header-height: 4rem;
  }

  @media (width <= 48rem) {
    :root {
      --header-height: 3.5rem;
    }
  }
}

/* ── Base Typography & Body ────────────────────────────── */
@layer base {
  html {
    font-size: 100%;
  }
  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-gray-700);
    background: var(--color-gray-900);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-white);
  }

  h1 {
    font-size: clamp(var(--text-3xl), 4vw, var(--text-6xl));
  }
  h2 {
    font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  }
  h3 {
    font-size: clamp(var(--text-xl), 2vw, var(--text-2xl));
  }
  h4 {
    font-size: var(--text-lg);
  }

  p {
    margin-bottom: var(--space-4);
  }
  p:last-child {
    margin-bottom: 0;
  }

  ::selection {
    background: var(--color-red-500);
    color: var(--color-gray-900);
  }

  :focus-visible {
    outline: 2px solid var(--color-red-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
  }

  .skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: var(--color-gray-800);
    color: var(--color-white);
    border-radius: var(--radius-sm);
    z-index: 10000;
    font-weight: 500;
    transition: top var(--duration-fast) var(--ease-out-cubic);
  }
  .skip-link:focus {
    top: var(--space-4);
  }
}

/* ── Container ─────────────────────────────────────────── */
@layer utilities {
  .container {
    width: 100%;
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: clamp(var(--space-4), 3vw, var(--space-8));
  }
  .container--narrow {
    max-width: var(--max-width-narrow);
  }
  .container--text {
    max-width: var(--max-width-text);
  }
}

/* ── Header / Navigation ───────────────────────────────── */
@layer components {
  .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
  }
  .header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
  }
  .header__logo {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-gray-900);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: opacity var(--duration-fast) var(--ease-out-cubic);
  }
  .header__logo img {
    display: block;
    height: 3.25rem;
    width: auto;
  }
  .header__logo:hover {
    opacity: 0.85;
  }
  .header__logo-accent {
    color: var(--color-red-500);
  }

  .nav-desktop {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
  }
  .nav-desktop a {
    position: relative;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-gray-400);
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) var(--ease-out-cubic);
  }
  .nav-desktop a::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: var(--space-3);
    right: var(--space-3);
    height: 2px;
    background: var(--color-red-500);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--duration-base) var(--ease-out-expo);
  }
  .nav-desktop a:hover {
    color: var(--color-white);
  }
  .nav-desktop a[aria-current="page"] {
    color: var(--color-white);
    font-weight: 600;
  }
  .nav-desktop a[aria-current="page"]::after {
    transform: scaleX(1);
  }
  .nav-desktop a:not([aria-current="page"]):hover::after {
    transform: scaleX(0.6);
  }

  /* Language toggle */
  .lang-toggle {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-white);
    background: color-mix(in srgb, var(--color-red-500) 85%, transparent);
    border: 1.5px solid var(--color-red-500);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.625rem;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out-cubic);
    line-height: 1;
    letter-spacing: 0.04em;
  }
  .lang-toggle:hover {
    background: var(--color-red-500);
  }

  @media (width <= 48rem) {
    .lang-toggle {
      margin-right: calc(2rem + var(--space-4));
    }
  }

  /* Hamburger */
  .hamburger {
    display: none;
    width: 2rem;
    height: 2rem;
    position: fixed;
    top: calc((var(--header-height) - 2rem) / 2);
    right: var(--space-6);
    z-index: 1100;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .hamburger__line {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: var(--color-white);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all var(--duration-fast) var(--ease-out-cubic);
  }
  .hamburger__line:nth-child(1) {
    top: 6px;
  }
  .hamburger__line:nth-child(2) {
    top: calc(50% - 1px);
  }
  .hamburger__line:nth-child(3) {
    bottom: 6px;
  }
  .hamburger[aria-expanded="true"] .hamburger__line:nth-child(1) {
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
  }
  .hamburger[aria-expanded="true"] .hamburger__line:nth-child(2) {
    opacity: 0;
  }
  .hamburger[aria-expanded="true"] .hamburger__line:nth-child(3) {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  @media (width <= 48rem) {
    .nav-desktop {
      display: none;
    }
    .hamburger {
      display: block;
    }
  }

  /* Mobile menu */
  .mobile-menu {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    background: var(--color-gray-900);
    padding: var(--header-height) var(--space-8) var(--space-8);
    overflow-y: auto;
  }
  .mobile-menu[aria-hidden="false"] {
    display: flex;
    animation: menuIn var(--duration-base) var(--ease-out-expo) both;
  }
  .mobile-menu.is-closing {
    display: flex;
    animation: menuOut var(--duration-base) var(--ease-out-expo) both;
  }
  @keyframes menuIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes menuOut {
    from { opacity: 1; }
    to   { opacity: 0; }
  }
  .mobile-menu__inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 24rem;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    gap: var(--space-2);
    padding-bottom: var(--space-16);
  }
  .mobile-menu a {
    display: block;
    padding: var(--space-5) var(--space-6);
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--color-gray-500);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all var(--duration-fast) var(--ease-out-cubic);
  }
  .mobile-menu a:hover,
  .mobile-menu a:focus-visible {
    color: var(--color-white);
    background: color-mix(in srgb, var(--color-gray-50) 70%, transparent);
  }
  .mobile-menu a[aria-current="page"] {
    color: var(--color-red-500);
    font-weight: 700;
  }
  .mobile-menu a[aria-current="page"]:hover {
    color: var(--color-red-500);
  }
}

/* ── Hero ──────────────────────────────────────────────── */
@layer components {
  .hero {
    position: relative;
    min-height: clamp(60vh, 70vh, 90vh);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
  }
  .hero__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      135deg,
      rgba(0, 0, 0, 0.7) 0%,
      rgba(0, 0, 0, 0.45) 50%,
      rgba(0, 0, 0, 0.65) 100%
    );
    z-index: 1;
  }
  .hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  @media (width <= 48rem) {
    .hero {
      min-height: 70vh;
    }
    .hero__image {
      object-fit: contain;
      object-position: center;
    }
    .hero__bg {
      background: var(--color-gray-950);
    }
    .hero__bg::after {
      background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.45) 50%,
        rgba(0, 0, 0, 0.65) 100%
      );
    }
  }
  .hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: var(--max-width-narrow);
    padding: var(--space-8);
  }
  .hero__title {
    color: var(--color-white);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-6);
    opacity: 0;
    transform: translateY(24px);
    animation: heroIn 0.8s var(--ease-out-expo) 0.2s forwards;
  }
  .hero__subtitle {
    font-size: clamp(var(--text-base), 1.5vw, var(--text-xl));
    color: color-mix(in srgb, var(--color-white) 80%, transparent);
    line-height: var(--leading-relaxed);
    max-width: 42rem;
    margin-inline: auto;
    margin-bottom: var(--space-8);
    opacity: 0;
    transform: translateY(16px);
    animation: heroIn 0.8s var(--ease-out-expo) 0.35s forwards;
  }
  .hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: center;
    opacity: 0;
    transform: translateY(12px);
    animation: heroIn 0.8s var(--ease-out-expo) 0.5s forwards;
  }

  @keyframes heroIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .hero__scroll {
    position: absolute;
    bottom: var(--space-8);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: var(--color-white);
    opacity: 0.6;
    animation: scrollBounce 2s ease-in-out infinite;
  }
  @keyframes scrollBounce {
    0%,
    100% {
      transform: translateX(-50%) translateY(0);
    }
    50% {
      transform: translateX(-50%) translateY(8px);
    }
  }

  /* Hero small variant for inner pages */
  .hero--sm {
    min-height: 32vh;
  }
}

/* ── Buttons ───────────────────────────────────────────── */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.75rem 1.75rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-full);
    transition: all var(--duration-base) var(--ease-out-expo);
    transform: translateY(0);
    white-space: nowrap;
    min-height: 3rem;
  }
  .btn:hover {
    transform: translateY(-2px);
  }
  .btn:active {
    transform: scale(0.97) translateY(0);
  }
  .btn--primary {
    background: var(--color-red-500);
    color: var(--color-white);
    box-shadow: 0 4px 14px rgba(236, 27, 36, 0.35);
  }
  .btn--primary:hover {
    background: var(--color-red-600);
    box-shadow: 0 6px 20px rgba(236, 27, 36, 0.4);
  }
  .btn--outline {
    border: 2px solid var(--color-white);
    color: var(--color-white);
    background: transparent;
  }
  .btn--outline:hover {
    background: var(--color-white);
    color: var(--color-red-500);
  }
  .btn--ghost {
    color: var(--color-white);
    background: var(--color-gray-100);
  }
  .btn--ghost:hover {
    background: var(--color-gray-200);
  }
  .btn--block {
    width: 100%;
  }
}

/* ── Cards ─────────────────────────────────────────────── */
@layer components {
  .card {
    background: var(--color-gray-100);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    transition: all var(--duration-base) var(--ease-out-expo);
    border: 1px solid var(--color-gray-200);
    color: var(--color-gray-700);
  }
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--color-gray-300) 50%, transparent);
  }

  .card--glass {
    background: color-mix(in srgb, var(--color-gray-100) 80%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-lg);
  }
  .card--glass:hover {
    background: color-mix(in srgb, var(--color-gray-100) 95%, transparent);
  }

  .card--car {
    overflow: hidden;
    padding: 0;
    border-radius: var(--radius-lg);
  }
  .card--car .card__img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-out-expo);
  }
  .card--car:hover .card__img {
    transform: scale(1.05);
  }
  .card--car .card__body {
    padding: var(--space-6);
  }
  .card--car .card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
  }
  .card--car .card__tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.25rem 0.625rem;
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--color-gray-100);
    color: var(--color-gray-600);
    border-radius: var(--radius-full);
  }
  .card--car .card__price {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-white);
  }
  .card--car .card__price-unit {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--color-gray-600);
  }
}

/* ── Section ───────────────────────────────────────────── */
@layer components {
  .section {
    padding-block: clamp(var(--space-16), 6vw, var(--space-24));
  }
  .section__label {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-red-500);
    margin-bottom: var(--space-3);
  }
  .section__title {
    margin-bottom: var(--space-4);
  }
  .section__subtitle {
    font-size: var(--text-lg);
    color: var(--color-gray-500);
    max-width: 36rem;
    line-height: var(--leading-relaxed);
  }
  .section--alt {
    background: var(--color-gray-100);
  }
  .section--dark {
    background: var(--color-gray-900);
    color: color-mix(in srgb, var(--color-white) 85%, transparent);
  }
  .section--dark .section__title {
    color: var(--color-white);
  }
}

/* ── Value Props Grid ──────────────────────────────────── */
@layer components {
  .grid-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: var(--space-8);
  }
  .value-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-red-500) 12%, transparent);
    color: var(--color-red-500);
    margin-bottom: var(--space-4);
    transition: all var(--duration-base) var(--ease-out-expo);
  }
  .card:hover .value-icon {
    background: var(--color-red-500);
    color: var(--color-white);
    transform: scale(1.1) rotate(-4deg);
  }
  .value-icon svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* ── Stats ─────────────────────────────────────────────── */
@layer components {
  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: var(--space-8);
    text-align: center;
  }
  .stat__number {
    font-family: var(--font-heading);
    font-size: clamp(var(--text-4xl), 4vw, var(--text-6xl));
    font-weight: 700;
    color: var(--color-white);
    line-height: 1;
    margin-bottom: var(--space-2);
  }
  .stat__label {
    font-size: var(--text-sm);
    color: color-mix(in srgb, var(--color-white) 60%, transparent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

/* ── Features grid (why choose us) ─────────────────────── */
@layer components {
  .grid-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: var(--space-6);
  }
  .feature-item {
    text-align: center;
    padding: var(--space-6) var(--space-4);
  }
  .feature-item__icon {
    width: 3rem;
    height: 3rem;
    margin-inline: auto;
    margin-bottom: var(--space-4);
    color: var(--color-red-500);
    transition: transform var(--duration-base) var(--ease-out-expo);
  }
  .feature-item:hover .feature-item__icon {
    transform: scale(1.15) rotate(-6deg);
  }
  .feature-item__icon svg {
    width: 100%;
    height: 100%;
  }
  .feature-item__title {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: var(--space-2);
  }
  .feature-item__desc {
    font-size: var(--text-sm);
    color: var(--color-gray-500);
    line-height: var(--leading-relaxed);
  }
}

/* ── Filter buttons ────────────────────────────────────── */
@layer components {
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-10);
  }
  .filter-btn {
    padding: 0.5rem 1.25rem;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-gray-200);
    background: var(--color-white);
    color: var(--color-gray-600);
    transition: all var(--duration-base) var(--ease-out-expo);
    cursor: pointer;
    min-height: 2.5rem;
  }
  .filter-btn:hover {
    border-color: var(--color-gray-300);
    color: var(--color-white);
    background: var(--color-gray-100);
  }
  .filter-btn.is-active {
    background: var(--color-gray-800);
    border-color: var(--color-gray-800);
    color: var(--color-white);
    box-shadow: 0 0 0 3px rgba(212, 165, 71, 0.2);
  }
  .filter-btn.is-active:hover {
    background: var(--color-red-700);
  }
}

/* ── Skeleton ──────────────────────────────────────────── */
@layer components {
  .skeleton {
    background: linear-gradient(
      90deg,
      var(--color-gray-200) 25%,
      var(--color-gray-100) 50%,
      var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
  }
  @keyframes shimmer {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }
  .skeleton--text {
    height: 1rem;
    margin-bottom: var(--space-2);
  }
  .skeleton--title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--space-3);
  }
  .skeleton--image {
    aspect-ratio: 3/2;
    width: 100%;
    border-radius: var(--radius-lg);
  }
}

/* ── Grid auto ─────────────────────────────────────────── */
@layer utilities {
  .grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: var(--space-8);
  }
  .grid-auto--wide {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  }
  .flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .gap-2 {
    gap: var(--space-2);
  }
  .gap-3 {
    gap: var(--space-3);
  }
  .gap-4 {
    gap: var(--space-4);
  }
  .gap-6 {
    gap: var(--space-6);
  }
  .gap-8 {
    gap: var(--space-8);
  }
  .mt-6 {
    margin-top: var(--space-6);
  }
  .mt-8 {
    margin-top: var(--space-8);
  }
  .mt-12 {
    margin-top: var(--space-12);
  }
  .mb-4 {
    margin-bottom: var(--space-4);
  }
  .mb-6 {
    margin-bottom: var(--space-6);
  }
  .mb-8 {
    margin-bottom: var(--space-8);
  }
  .text-center {
    text-align: center;
  }
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* ── FAQ Accordion ─────────────────────────────────────── */
@layer components {
  .faq-item {
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-gray-100);
    overflow: hidden;
    transition: box-shadow var(--duration-base) var(--ease-out-cubic);
  }
  .faq-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-gray-300);
  }
  .faq-item.is-open {
    box-shadow: var(--shadow-md);
    border-color: var(--color-red-500);
  }
  .faq-item + .faq-item {
    margin-top: var(--space-4);
  }
  .faq-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-6);
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 500;
    text-align: left;
    color: var(--color-white);
    background: none;
    border: 0;
    cursor: pointer;
    gap: var(--space-6);
  }
  .faq-trigger:focus-visible {
    outline-offset: -2px;
  }
  .faq-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-red-500);
    transition: transform var(--duration-base) var(--ease-out-expo);
  }
  .is-open .faq-icon {
    transform: rotate(45deg);
  }
  .faq-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--duration-base) var(--ease-out-expo);
  }
  .faq-panel.is-open {
    grid-template-rows: 1fr;
  }
  .faq-panel > div {
    overflow: hidden;
  }
  .faq-answer {
    padding: 0 var(--space-6) var(--space-8);
    color: var(--color-gray-500);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    max-width: 48rem;
  }
}

/* ── Multi-step Form ──────────────────────────────────── */
@layer components {
  .step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-10);
  }
  .step-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: var(--radius-full);
    background: var(--color-gray-300);
    transition: all var(--duration-base) var(--ease-out-expo);
  }
  .step-dot.is-active {
    background: var(--color-red-500);
    box-shadow: var(--shadow-glow);
    width: 1.5rem;
    border-radius: var(--radius-full);
  }
  .step-dot.is-done {
    background: var(--color-gray-800);
  }
  .step-line {
    width: 2rem;
    height: 2px;
    background: var(--color-gray-200);
    transition: background var(--duration-base) var(--ease-out-expo);
  }
  .step-line.is-done {
    background: var(--color-gray-800);
  }

  .form-step {
    display: none;
    animation: stepIn 0.4s var(--ease-out-expo) forwards;
  }
  .form-step.is-active {
    display: block;
  }
  @keyframes stepIn {
    from {
      opacity: 0;
      transform: translateX(16px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .form-group {
    margin-bottom: var(--space-5);
  }
  .form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
  }
  .form-label .required {
    color: var(--color-red-500);
  }
  .form-input,
  .form-select,
  .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    background: var(--color-gray-900);
    border: 1.5px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out-cubic);
    color: var(--color-white);
  }
  select.form-select option {
    background: var(--color-gray-900);
    color: var(--color-white);
  }
  .form-input:focus,
  .form-select:focus,
  .form-textarea:focus {
    border-color: var(--color-red-500);
    box-shadow: 0 0 0 3px rgba(212, 165, 71, 0.15);
    outline: none;
  }
  .form-input.has-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  }
  .form-error {
    font-size: var(--text-xs);
    color: #dc2626;
    margin-top: var(--space-1);
    display: none;
  }
  .form-error.is-visible {
    display: block;
  }
  .form-textarea {
    resize: vertical;
    min-height: 6rem;
  }
  .form-input::placeholder,
  .form-textarea::placeholder {
    color: var(--color-gray-500);
  }
  .form-hint {
    font-size: var(--text-xs);
    color: var(--color-gray-400);
    margin-top: var(--space-1);
  }

  /* Checkbox custom */
  .form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
  }
  .form-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--color-gray-300);
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    transition: all var(--duration-fast) var(--ease-out-cubic);
    cursor: pointer;
  }
  .form-check input[type="checkbox"]:checked {
    background: var(--color-red-500);
    border-color: var(--color-red-500);
  }
  .form-check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid var(--color-gray-900);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  .form-check input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(212, 165, 71, 0.25);
  }

  /* Success animation */
  .success-state {
    display: none;
    text-align: center;
    padding: var(--space-12) var(--space-4);
  }
  .success-state.is-visible {
    display: block;
    animation: stepIn 0.6s var(--ease-out-expo) forwards;
  }
  .success-check {
    width: 5rem;
    height: 5rem;
    margin-inline: auto;
    margin-bottom: var(--space-6);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-red-500) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-red-500);
    animation: successPop 0.6s var(--ease-bounce) 0.2s both;
  }
  .success-check svg {
    width: 2.5rem;
    height: 2.5rem;
  }
  @keyframes successPop {
    0% {
      transform: scale(0);
    }
    60% {
      transform: scale(1.15);
    }
    100% {
      transform: scale(1);
    }
  }
  .success-title {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    color: var(--color-white);
    margin-bottom: var(--space-3);
  }
}

/* ── Footer ────────────────────────────────────────────── */
@layer components {
  .footer {
    background: var(--color-gray-900);
    color: color-mix(in srgb, var(--color-white) 65%, transparent);
    padding-block: var(--space-16);
  }
  .footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-10);
  }
  .footer__brand {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: var(--space-3);
  }
  .footer__brand span {
    color: var(--color-red-500);
  }
  .footer__desc {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    max-width: 20rem;
  }
  .footer__heading {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-4);
  }
  .footer__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .footer__links a {
    font-size: var(--text-sm);
    transition: color var(--duration-fast) var(--ease-out-cubic);
  }
  .footer__links a:hover {
    color: var(--color-red-500);
  }
  .footer__contact p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
  }
  .footer__contact a {
    transition: color var(--duration-fast) var(--ease-out-cubic);
  }
  .footer__contact a:hover {
    color: var(--color-red-500);
  }
  .footer__bottom {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid
      color-mix(in srgb, var(--color-white) 10%, transparent);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-xs);
  }

  @media (width <= 48rem) {
    .footer__grid {
      grid-template-columns: 1fr;
      gap: var(--space-8);
    }
    .footer__bottom {
      flex-direction: column;
      text-align: center;
    }
  }
}

/* ── Legal pages (privacy, termini) ────────────────────── */
@layer components {
  .legal {
    padding-block: var(--space-12);
  }
  .legal__meta {
    font-size: var(--text-sm);
    color: var(--color-gray-600);
    margin-bottom: var(--space-8);
  }
  .legal h2 {
    font-size: var(--text-2xl);
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-gray-200);
  }
  .legal h3 {
    font-size: var(--text-lg);
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
  }
  .legal p,
  .legal li {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-gray-600);
  }
  .legal ul {
    list-style: disc;
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
  }
  .legal li {
    margin-bottom: var(--space-2);
  }
}

/* ── 404 ───────────────────────────────────────────────── */
@layer components {
  .page-404 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: var(--space-8);
  }
  .page-404__code {
    font-family: var(--font-heading);
    font-size: clamp(6rem, 15vw, 12rem);
    font-weight: 800;
    line-height: 1;
    color: var(--color-white);
    position: relative;
  }
  .page-404__code::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 10%;
    width: 80%;
    height: 4px;
    background: linear-gradient(
      90deg,
      transparent,
      var(--color-red-500),
      transparent
    );
    border-radius: 2px;
  }
  .page-404__title {
    font-family: var(--font-heading);
    font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
    color: var(--color-gray-600);
    margin-top: var(--space-6);
    margin-bottom: var(--space-8);
  }
  .page-404__illustration {
    width: min(100%, 16rem);
    margin-bottom: var(--space-6);
    color: var(--color-gray-300);
  }
}

/* ── Responsive helpers ───────────────────────────────── */
@layer utilities {
  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
    align-items: center;
  }
  .two-col--swap .two-col__media {
    order: 2;
  }
  .two-col__media img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .two-col--media-right .two-col__media {
    order: 1;
  }

  @media (width <= 48rem) {
    .two-col {
      grid-template-columns: 1fr;
    }
    .two-col--swap .two-col__media {
      order: 0;
    }
    .two-col--media-right .two-col__media {
      order: 0;
    }
  }

  .stack > * + * {
    margin-top: var(--space-6);
  }
  .stack--compact > * + * {
    margin-top: var(--space-3);
  }

  .hidden-mobile {
    display: revert;
  }
  @media (width <= 48rem) {
    .hidden-mobile {
      display: none;
    }
  }

  .hidden-desktop {
    display: none;
  }
  @media (width <= 48rem) {
    .hidden-desktop {
      display: revert;
    }
  }
}
