:root {
  --bg: #050505;
  --bg-elevated: #0f0f0f;
  --bg-card: #121212;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --gold: #c9a227;
  --gold-hover: #e0b832;
  --cyan: #00d4ff;
  --border: rgba(255, 255, 255, 0.08);
  --max-width: 1200px;
  --header-height: 76px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Orbitron', 'Iceberg', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
.site-background {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-color: #050505;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
.site-background__overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.62) 0%, rgba(5, 5, 5, 0.78) 45%, rgba(5, 5, 5, 0.9) 100%),
    radial-gradient(circle at 50% 15%, rgba(201, 162, 39, 0.06), transparent 45%);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--gold); }

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-main { min-height: 60vh; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 5, 5, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
}
.site-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.custom-logo-link img { max-height: 52px; width: auto; }

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__list > li {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__list a {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-block;
  padding: 0.5rem 0;
}
.site-nav__list > li > a:hover { color: var(--gold); }

/* Dropdown sub-menus */
.site-nav__list .sub-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 260px;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 300;
}
.site-nav__list .sub-menu li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__list .sub-menu a {
  display: block;
  padding: 0.7rem 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
}
.site-nav__list .sub-menu a:hover {
  color: var(--gold);
  background: rgba(201, 162, 39, 0.08);
}

.site-nav__list > li:hover > .sub-menu,
.site-nav__list > li:focus-within > .sub-menu,
.site-nav__list > li.is-open > .sub-menu {
  display: block;
}

.menu-item-has-children > a::after {
  content: '▾';
  margin-left: 0.35rem;
  font-size: 0.75em;
  opacity: 0.7;
}

.site-header__cta {
  display: flex;
  gap: 0.75rem;
}

.site-nav__mobile-cta {
  display: none;
}

body.nav-open {
  overflow: hidden;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: 0.2s ease;
  border: 1px solid transparent;
}
.btn--primary {
  background: linear-gradient(135deg, var(--gold), #a8841a);
  color: #050505 !important;
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.25);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--gold-hover), var(--gold));
  transform: translateY(-2px);
}
.btn--outline, .btn--ghost {
  background: transparent;
  color: var(--gold) !important;
  border-color: var(--gold);
}
.btn--ghost { border-color: var(--border); color: var(--text) !important; }
.btn--lg { padding: 1rem 1.75rem; font-size: 0.8rem; }

/* Hero */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: grid;
  place-items: center;
  overflow: hidden;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(201, 162, 39, 0.08), transparent 45%);
  pointer-events: none;
}
.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 0;
}
.hero__logo {
  margin: 0.75rem auto 1rem;
  max-width: min(520px, 90vw);
}
.hero__logo img {
  width: 100%;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.45));
}
.hero__eyebrow {
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 600;
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.05;
  margin: 0.75rem 0;
  text-transform: uppercase;
}
.hero__subtitle {
  max-width: 680px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* Sections */
.section {
  padding: 5rem 0;
  background: rgba(5, 5, 5, 0.55);
}
.section:nth-child(even) {
  background: rgba(10, 10, 10, 0.68);
}
.section--news {
  background: rgba(8, 8, 8, 0.72);
}
.section-head {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-head__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}
.section-head__desc { color: var(--text-muted); margin: 0; }

/* Info cards */
.info-grid, .feature-grid, .race-grid, .news-grid {
  display: grid;
  gap: 1.25rem;
}
.info-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.info-card, .feature-card, .race-card, .news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: 0.2s ease;
}
.info-card:hover, .feature-card:hover, .race-card:hover, .news-card:hover {
  border-color: rgba(201, 162, 39, 0.35);
  transform: translateY(-3px);
}
.info-card h3, .feature-card h3, .race-card h3 {
  font-family: var(--font-display);
  margin-top: 0;
}
.info-card ul { list-style: none; padding: 0; margin: 0; }
.info-card li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.info-card li:last-child { border-bottom: 0; }
.info-card strong { color: var(--gold); }

.feature-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature-card__icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.race-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.race-card__image img {
  border-radius: 8px;
  margin-bottom: 1rem;
}
.race-card--accretia { border-top: 3px solid #ef4444; }
.race-card--bellato { border-top: 3px solid #3b82f6; }
.race-card--cora { border-top: 3px solid #22c55e; }
.race-card--link { padding: 0; }
.race-card--link .race-card__body { padding: 1.5rem; }
.race-card--link .race-card__image img { margin-bottom: 0; }

.news-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.news-card {
  padding: 0;
  overflow: hidden;
}
.news-card__trigger {
  appearance: none;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 1.5rem;
  text-align: left;
  width: 100%;
}
.news-card__body {
  display: block;
}
.news-card__title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}
.news-card__excerpt {
  color: var(--text-muted);
  display: block;
  margin: 0;
}
.news-card__thumb img {
  border-radius: 8px;
  margin-bottom: 1rem;
}
.news-card time {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.news-card h2, .news-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}
.news-card h2 a, .news-card h3 a { color: var(--text); }
.news-card p { color: var(--text-muted); margin: 0; }
.news-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
}
.news-empty a { display: inline-block; margin-top: 0.75rem; }

/* News modal */
.rf-news-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1.5rem;
  position: fixed;
  z-index: 9999;
}
.rf-news-modal[hidden] {
  display: none;
}
.rf-news-modal__backdrop {
  background: rgba(0, 0, 0, 0.75);
  inset: 0;
  position: absolute;
}
.rf-news-modal__dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  max-height: min(85vh, 900px);
  max-width: 720px;
  overflow: auto;
  padding: 2rem 2rem 1.75rem;
  position: relative;
  width: 100%;
  z-index: 1;
}
.rf-news-modal__close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}
.rf-news-modal__close:hover { color: var(--text); }
.rf-news-modal__meta time {
  color: var(--text-muted);
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.rf-news-modal__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin: 0 0 1rem;
  padding-right: 2rem;
}
.rf-news-modal__content {
  color: var(--text-muted);
  line-height: 1.7;
}
.rf-news-modal__content img {
  border-radius: 8px;
  height: auto;
  max-width: 100%;
}
.rf-news-modal__content p:first-child { margin-top: 0; }
.rf-news-modal__content p:last-child { margin-bottom: 0; }
.rf-news-modal.is-loading .rf-news-modal__content::after {
  color: var(--text-muted);
  content: 'Loading…';
  display: block;
  padding: 1rem 0;
}
body.rf-news-modal-open { overflow: hidden; }

/* CTA */
.cta-box {
  text-align: center;
  padding: 3rem 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(201,162,39,0.08), rgba(5,5,5,0.2));
}
.cta-box h2 {
  font-family: var(--font-display);
  margin-top: 0;
}

/* Pages */
.page-title {
  font-family: var(--font-display);
  margin-top: 0;
}
.page-content, .entry-content {
  color: var(--text-muted);
}
.page-content {
  background: rgba(8, 8, 8, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}
.entry-content h2, .entry-content h3 {
  color: var(--text);
  font-family: var(--font-display);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(3, 3, 3, 0.92);
  padding: 3rem 0 1.5rem;
}
.site-footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.site-footer h3, .site-footer h4 {
  font-family: var(--font-display);
}
.site-footer p, .site-footer a {
  color: var(--text-muted);
}
.site-footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-footer__bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --header-height: 68px;
  }

  .section-head__title {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    min-height: calc(100dvh - var(--header-height));
  }

  .site-background {
    background-attachment: scroll;
  }
}

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .site-header__inner { position: relative; flex-wrap: wrap; }
  .site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(5, 5, 5, 0.98);
    border-bottom: 1px solid var(--border);
    display: none;
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .site-nav.is-open { display: block; }
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem;
  }
  .site-nav__list > li {
    border-bottom: 1px solid var(--border);
  }
  .site-nav__list > li:last-child {
    border-bottom: 0;
  }
  .site-nav__list > li > a {
    padding: 0.85rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .site-nav__list .sub-menu {
    position: static;
    display: none;
    min-width: 0;
    margin: 0 0 0.75rem 0.75rem;
    padding: 0.25rem 0 0.25rem 0.75rem;
    background: transparent;
    border: 0;
    border-left: 2px solid var(--gold);
    border-radius: 0;
    box-shadow: none;
  }
  .site-nav__list > li:hover > .sub-menu {
    display: none;
  }
  .site-nav__list > li.is-open > .sub-menu {
    display: block;
  }
  .site-nav__list .sub-menu a {
    padding: 0.55rem 0;
    white-space: normal;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .site-header__cta { display: none; }

  .site-nav__mobile-cta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .feature-grid,
  .race-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-content {
    padding: 1.5rem;
  }
}

@media (max-width: 600px) {
  .section { padding: 3.5rem 0; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__content { padding: 2.5rem 0; }
  .hero__logo { max-width: min(320px, 88vw); }
  .hero__subtitle { font-size: 0.95rem; padding: 0 0.5rem; }

  .info-grid,
  .feature-grid,
  .race-grid,
  .news-grid {
    grid-template-columns: 1fr;
  }

  .info-card li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .cta-box {
    padding: 2rem 1.25rem;
  }

  .page-content {
    padding: 1.25rem;
  }

  .site-footer__social {
    justify-content: center;
  }

  .btn--lg {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .site-title {
    font-size: 1rem;
  }

  .custom-logo-link img {
    max-height: 42px;
  }
}
