:root {
  --bg: #0b0d0c;
  --bg-elevated: #151817;
  --bg-card: #1a1e1c;
  --accent: #7ed957;
  --accent-dim: #4f9a37;
  --text: #f2f4f2;
  --text-dim: #9aa39d;
  --border: #2a2f2c;
  --radius: 14px;
  --maxw: 1200px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

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

a { color: inherit; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* ---------- Nav ---------- */
header.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(11, 13, 12, 0.75);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(10px, 2vw, 16px) clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-weight: 800;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing: 0.02em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { color: var(--accent); }
.logo img { height: clamp(34px, 5vw, 46px); width: auto; display: block; }

nav.links {
  display: flex;
  gap: clamp(10px, 2vw, 28px);
  flex-wrap: wrap;
  align-items: center;
}

nav.links a {
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
nav.links a:hover, nav.links a.active { color: var(--accent); }
nav.links img { width: 18px; height: 18px; filter: grayscale(1) brightness(1.4); }
nav.links a:hover img { filter: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(78vh, 700px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,13,12,0.15) 0%, rgba(11,13,12,0.55) 55%, rgba(11,13,12,0.97) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 6vw, 64px) clamp(16px, 4vw, 40px) clamp(40px, 8vw, 80px);
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}
.hero-content h1 {
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 1.02;
  margin: 0 0 12px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.hero-content h1 span { color: var(--accent); }
.hero-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-dim);
  max-width: 540px;
  margin: 0 0 28px;
}
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary { background: var(--accent); color: #06210a; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(126,217,87,0.5); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Section headings ---------- */
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section .eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 10px;
}
.section .lead {
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 0 40px;
}

/* ---------- Driver cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(16px, 3vw, 28px);
}
.driver-card {
  container-type: inline-size;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.driver-card:hover { transform: translateY(-4px); border-color: var(--accent-dim); }
.driver-card .thumb { aspect-ratio: 4/3; overflow: hidden; }
.driver-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.driver-card:hover .thumb img { transform: scale(1.06); }
.driver-card .body { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.driver-card .name { font-size: 1.3rem; font-weight: 800; }
.driver-card .car { color: var(--text-dim); font-size: 0.9rem; }
.driver-card .tag {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
@container (min-width: 380px) {
  .driver-card .name { font-size: 1.5rem; }
}

/* ---------- Gallery page ---------- */
.gallery-hero {
  padding: clamp(40px, 8vw, 80px) 0 clamp(20px, 4vw, 40px);
}
.gallery-hero .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 700; }
.gallery-hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 8px 0 6px; font-weight: 900; }
.gallery-hero .meta { color: var(--text-dim); }
.gallery-hero .socials { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.gallery-hero .socials a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border);
  text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.9rem;
}
.gallery-hero .socials a:hover { border-color: var(--accent); color: var(--accent); }
.gallery-hero .socials img { width: 18px; height: 18px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 60px;
}
.photo-grid button {
  all: unset;
  cursor: zoom-in;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4/3;
  display: block;
}
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.photo-grid button:hover img { transform: scale(1.05); }

dialog.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 92vw;
  max-height: 88vh;
}
dialog.lightbox::backdrop { background: rgba(4,5,4,0.9); }
dialog.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
dialog.lightbox button.close {
  all: unset;
  position: fixed;
  top: 18px; right: 22px;
  color: #fff; font-size: 2rem; cursor: pointer;
  z-index: 3;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
footer a { color: var(--text-dim); text-decoration: underline; }

@media (max-width: 560px) {
  .nav-inner { flex-direction: column; align-items: flex-start; }
  nav.links { width: 100%; justify-content: flex-start; }
}

.profile-edit-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 14px 0 16px; }
.profile-edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--text-dim); }
.profile-edit-form input[type=text] {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 0.9rem; min-width: 200px;
}
.profile-edit-form button { padding: 9px 20px; }

.caption { font-size: 0.82rem; color: var(--text-dim); text-align: center; margin-top: 2px; word-break: break-word; }
.caption-form { display: flex; gap: 4px; width: 100%; margin-top: 2px; }
.caption-input {
  flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 4px 6px; font-size: 0.78rem;
}
.save-all-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.save-all-bar .btn { padding: 10px 22px; border: none; cursor: pointer; }
.save-all-bar #saveAllStatus { color: var(--text-dim); font-size: 0.85rem; }
.order-input {
  flex: 0 0 44px; width: 44px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 4px 4px; font-size: 0.78rem; text-align: center;
}
.caption-save {
  background: var(--accent); color: #06210a; border: none; border-radius: 4px;
  padding: 4px 10px; font-size: 0.85rem; cursor: pointer; font-weight: 700;
}
