/* ============================================
   The Auto Trainer Palette
   ============================================ */
:root {
  --rosso-corsa: #D40000;
  --rosso-dark: #A80000;
  --rosso-hover: #E60000;
  /* #D40000 tops out at ~3.8:1 on black; use this for small red text (WCAG AA 4.5:1) */
  --rosso-text: #FF3B3B;
  --verde-italia: #008C45;
  /* Brighter sibling of the logo green (same hue, ~147°) for positive metrics;
     #008C45 only clears large-text contrast on dark, this clears AA at any size */
  --verde-text: #13B65C;
  --black: #000000;
  --charcoal: #141414;
  --graphite: #1E1E1E;
  --line: #2C2C2C;
  --gray: #9A9A9A;
  --silver: #C8C8C8;
  --white: #FFFFFF;
  --ivory: #F4F0E8;

  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

  --container: 1200px;
  --radius: 8px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Type scale — every size on the site comes from here */
  --text-xs: 0.85rem;       /* micro labels, legal, inline link cues */
  --text-sm: 0.95rem;       /* nav, footer links, captions */
  --text-base: 1rem;        /* card body copy */
  --text-lg: 1.0625rem;     /* section ledes, long-form prose */
  --text-xl: 1.125rem;      /* hero subhead */
  --h-card: 1.4rem;         /* card + list headings */
  --h-section: clamp(1.9rem, 4.2vw, 2.75rem);
  --h-page: clamp(3.25rem, 8vw, 6.25rem);
  --lh-body: 1.65;
  --lh-prose: 1.75;
  --lh-heading: 1.15;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
  transition-duration: 0.05s;
}

.btn-primary {
  background: var(--rosso-corsa);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--rosso-hover);
  box-shadow: 0 8px 24px rgba(212, 0, 0, 0.35);
}

.btn-outline {
  border-color: #5A5A5A;
  color: var(--white);
}

.btn-outline:hover {
  border-color: var(--rosso-corsa);
  background: rgba(212, 0, 0, 0.1);
}

.btn-small {
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  border-color: var(--rosso-corsa);
}

.btn-small:hover {
  background: var(--rosso-corsa);
  box-shadow: 0 6px 18px rgba(212, 0, 0, 0.3);
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ============================================
   Header / Nav
   ============================================ */
.site-header {
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 72px;
}

.logo {
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.logo span {
  color: var(--rosso-text);
}

.logo .logo-it {
  color: var(--verde-italia);
}

.nav-links {
  display: flex;
  gap: 2rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.nav-links a {
  position: relative;
  display: inline-block;
  padding: 0.35rem 0;
  color: var(--gray);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.2s ease;
}

/* Red underline that slides in from the left */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--rosso-corsa);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--white);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-cta-item {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-toggle-bar {
  width: 18px;
  height: 2px;
  background: var(--ivory);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Hero
   ============================================ */
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 3rem;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1.25rem;
  color: var(--gray);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 32px;
  height: 2px;
  background: var(--rosso-corsa);
  flex-shrink: 0;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-page);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.015em;
}

.hero-title .accent {
  display: block;
  color: var(--rosso-corsa);
}

.signature {
  margin: 0.75rem 0 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
  color: var(--silver);
}

.hero-sub {
  max-width: 34ch;
  margin: 0 0 2rem;
  color: var(--gray);
  font-size: var(--text-xl);
  line-height: var(--lh-prose);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

/* Photo + badge */
.hero-media {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 560px;
}

.hero-photo {
  position: absolute;
  top: 0;
  right: 0;
  width: 88%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.badge {
  position: absolute;
  left: 0;
  bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--rosso-corsa);
  border-radius: var(--radius);
}

.badge strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.05;
}

.badge span {
  display: block;
  margin-top: 0.25rem;
  color: var(--ivory);
  font-size: var(--text-xs);
}

/* ============================================
   Audience strip
   ============================================ */
.audience {
  background: var(--charcoal);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.audience-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audience-item {
  display: block;
  padding: 1.5rem 1.5rem 1.5rem 1.25rem;
  border-left: 3px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.audience-item + .audience-item {
  border-left-color: var(--line);
}

.audience-item:first-child {
  border-left-color: var(--line);
}

.audience-item:last-child {
  border-right: 3px solid var(--line);
}

.audience-item:hover {
  border-left-color: var(--rosso-corsa);
  background: var(--graphite);
}

.audience-item h2 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-card);
  font-weight: 600;
  line-height: 1.2;
}

.audience-item p {
  margin: 0.2rem 0 0;
  color: var(--gray);
  font-size: var(--text-sm);
  transition: color 0.2s ease;
}

.audience-item:hover p,
.audience-item:active p {
  color: var(--silver);
}

/* ============================================
   Program cards
   ============================================ */
.program-inner {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.program-intro {
  max-width: 56rem;
  margin: 0 auto 4rem;
  text-align: center;
}

.program-intro .eyebrow {
  justify-content: center;
}

.program-intro h2 {
  margin: 0 0 0.875rem;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-section);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.program-intro p:not(.eyebrow) {
  max-width: 52ch;
  margin: 0 auto;
  color: var(--gray);
  font-size: var(--text-lg);
  line-height: var(--lh-body);
}

.program-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3.5rem 1.75rem;
}

.program-card {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-top: 1.75rem;
  padding: 3.5rem 1.875rem 1.875rem;
  background: var(--graphite);
  border-radius: 6px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.program-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.program-card:has(a:focus-visible) {
  outline: 2px solid var(--rosso-corsa);
  outline-offset: 3px;
}

.program-card:has(a:focus-visible) a {
  outline: none;
}

.program-tile {
  position: absolute;
  top: -1.75rem;
  left: 1.5rem;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  background: var(--rosso-corsa);
  color: var(--white);
  border-radius: 6px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.program-card:hover .program-tile {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(212, 0, 0, 0.4);
}

.program-tile svg {
  display: block;
  width: 26px;
  height: 26px;
}

.program-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-card);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

.program-card p {
  margin: 0 0 1.5rem;
  color: var(--gray);
  font-size: var(--text-base);
  line-height: var(--lh-body);
}

.program-card a {
  margin-top: auto;
  align-self: flex-start;
  color: var(--rosso-text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-thickness 0.2s ease, text-underline-offset 0.2s ease;
}

/* Stretch the link over the whole card so the full surface is the click target */
.program-card a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.program-card:hover a {
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* ============================================
   Stats band
   ============================================ */
.stats {
  background: var(--charcoal);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 3rem;
  padding-bottom: 3rem;
  gap: 2rem;
}

.stat {
  text-align: center;
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  color: var(--verde-text);
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.stat span {
  display: block;
  margin-top: 0.6rem;
  color: var(--gray);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

/* ============================================
   Story
   ============================================ */
.story-inner {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.story-intro {
  max-width: 56rem;
  margin: 0 auto 3rem;
  text-align: center;
}

.story-intro .eyebrow {
  justify-content: center;
}

.story-intro h2 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-section);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.story-body {
  max-width: 62ch;
  margin: 0 auto;
}

/* Silver rather than gray: this is the page's primary long-form reading copy,
   one deliberate step up the hierarchy from supporting text */
.story-body p {
  margin: 0 0 1.5rem;
  color: var(--silver);
  font-size: var(--text-lg);
  line-height: var(--lh-prose);
}

.pull-quote {
  margin: 3rem 0 0;
  padding: 1.75rem 0 1.75rem 1.75rem;
  border-left: 3px solid var(--rosso-corsa);
}

.pull-quote p {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.3;
}

/* ============================================
   CTA band
   ============================================ */
.cta-band {
  background: var(--charcoal);
  border-top: 1px solid var(--line);
}

.cta-inner {
  padding-top: 4rem;
  padding-bottom: 4rem;
  text-align: center;
}

.cta-inner h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: var(--h-section);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.cta-inner p {
  max-width: 48ch;
  margin: 0 auto 2rem;
  color: var(--gray);
  font-size: var(--text-lg);
  line-height: var(--lh-body);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--charcoal);
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 3rem;
  padding-top: 4rem;
  padding-bottom: 3.5rem;
}

.footer-brand p {
  max-width: 30ch;
  margin: 1rem 0 1.5rem;
  color: var(--gray);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.social-links {
  display: flex;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--graphite);
  color: var(--silver);
  border-radius: 6px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.25s var(--ease-out);
}

.social-links svg {
  width: 20px;
  height: 20px;
}

.social-links a:hover {
  background: var(--rosso-corsa);
  color: var(--white);
  transform: translateY(-2px);
}

.footer-col h2 {
  margin: 0 0 1.1rem;
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col li + li {
  margin-top: 0.6rem;
}

.footer-col a {
  color: var(--gray);
  font-size: var(--text-sm);
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--white);
}

.footer-col address {
  font-style: normal;
}

.footer-col address p {
  margin: 0 0 0.75rem;
  color: var(--gray);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.footer-bottom {
  border-top: 1px solid var(--line);
}

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.footer-bottom p {
  margin: 0;
  color: var(--gray);
  font-size: var(--text-xs);
}

.footer-bottom a {
  color: var(--silver);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.footer-bottom a:hover {
  color: var(--white);
}

/* ============================================
   Page-load reveal (hero only)
   ============================================ */
.hero-text > * {
  animation: rise 0.7s ease-out both;
}

.hero-text > :nth-child(2) { animation-delay: 0.1s; }
.hero-text > :nth-child(3) { animation-delay: 0.25s; }
.hero-text > :nth-child(4) { animation-delay: 0.35s; }
.hero-text > :nth-child(5) { animation-delay: 0.45s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .nav {
    position: relative;
    justify-content: center;
  }

  .nav-toggle {
    display: flex;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
  }

  .nav-desktop-cta {
    display: none;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 6.5rem 1.5rem 2.5rem;
    gap: 0.25rem;
    background: var(--black);
    border-bottom: none;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    z-index: 50;
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
    text-align: center;
    font-size: 1.2rem;
  }

  .nav-cta-item {
    display: list-item;
    margin-top: 1.5rem;
  }

  .nav-cta-item a {
    border-bottom: none;
  }

  .nav-cta-item .btn {
    width: 100%;
    justify-content: center;
    padding: 1.1rem 1.5rem;
    font-size: 1.05rem;
  }

  .nav-links a.btn-primary {
    color: var(--white);
  }

  body.nav-open {
    overflow: hidden;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .hero-media {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
  }

  .hero-photo {
    left: 0;
    right: 0;
    width: 100%;
  }

  .program-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3.25rem 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem 2rem;
  }
}

@media (max-width: 640px) {
  .audience-grid {
    grid-template-columns: 1fr;
  }

  /* Every row gets both side edges so the stack reads as one box;
     border-left-color is left alone here so :hover/:active can still turn it red */
  .audience-item {
    border-left-color: var(--line);
    border-right: 3px solid var(--line);
  }

  .audience-item + .audience-item {
    border-top: 1px solid var(--line);
  }

  .audience-item:hover,
  .audience-item:active {
    border-left-color: var(--rosso-corsa);
    border-right-color: var(--rosso-corsa);
    background: var(--graphite);
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .logo {
    font-size: 1.05rem;
    letter-spacing: 0.05em;
  }

  .nav {
    gap: 1rem;
  }

  .hero-title {
    font-size: clamp(1.75rem, 8.5vw, 2.5rem);
  }

  .hero-title .accent {
    display: inline;
  }

  .hero-text {
    text-align: center;
  }

  .eyebrow {
    justify-content: center;
  }

  .hero-inner {
    padding-top: 4.5rem;
    padding-bottom: 3.5rem;
  }

  .signature {
    margin: 0.4rem 0 0.9rem;
  }

  .hero-sub {
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2.5rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .program-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .program-inner {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  .program-intro {
    margin-bottom: 3rem;
  }

  .program-card {
    text-align: center;
  }

  .program-tile {
    left: 0;
    right: 0;
    margin: 0 auto;
  }

  .program-card a {
    align-self: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-top: 3rem;
    padding-bottom: 2.5rem;
    text-align: center;
  }

  .footer-brand p {
    margin-left: auto;
    margin-right: auto;
  }

  .social-links {
    justify-content: center;
  }

  .footer-bottom-inner {
    justify-content: center;
    text-align: center;
  }

  .story-inner {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  .story-body p {
    font-size: 1rem;
  }

  .pull-quote {
    margin-top: 2.5rem;
    padding: 1.25rem 0 1.25rem 1.25rem;
  }

  .cta-inner {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .cta-inner .btn {
    width: 100%;
    justify-content: center;
  }
}
