:root {
  --accent: #ff5e00;
  --accent-dim: rgba(255, 94, 0, 0.15);
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-2: #1c1c22;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e8ec;
  --muted: #9a9aa8;
  --font: "Rajdhani", "Exo 2", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.back {
  font-size: 0.9rem;
  color: var(--muted);
}

.lang-switch {
  display: flex;
  gap: 0.35rem;
}

.lang-switch button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}

.lang-switch button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero p {
  color: var(--muted);
}

.hero__source {
  font-size: 0.82rem;
  color: var(--muted);
  opacity: 0.85;
}

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

.stat {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.stat__label {
  display: block;
  padding-top: 0.2rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.search-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.search-block__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.search-block__input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font: inherit;
}

.search-block__input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-block__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.teams {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.team {
  border-bottom: 1px solid var(--border);
}

.team__summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0;
  cursor: pointer;
  list-style: none;
}

.team__summary::-webkit-details-marker {
  display: none;
}

.team__summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.75rem;
  width: 0.75rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.team[open] .team__summary::before {
  transform: rotate(90deg);
}

.team-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.team-swatch--red { background: #e10600; }
.team-swatch--orange { background: #ff8000; }
.team-swatch--cyan { background: #00d2be; }
.team-swatch--blue { background: #3671c6; }
.team-swatch--navy { background: #005aff; }
.team-swatch--green { background: #006f62; }
.team-swatch--pink { background: #ff87bc; }
.team-swatch--yellow { background: #f9d648; }
.team-swatch--gray { background: #9a9aa8; }

.team__title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.team__meta {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.team__body {
  padding: 0 0 1rem 1.4rem;
}

.team__lineage {
  font-size: 0.88rem;
  color: var(--muted);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.era-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.era {
  display: grid;
  grid-template-columns: 7.5rem 5.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
}

.era--no-photo {
  grid-template-columns: 5.5rem 1fr;
}

.era--no-photo .era__years {
  grid-column: 1;
}

.era--no-photo .era__body {
  grid-column: 2;
}

.era__photo {
  margin: 0;
  grid-column: 1;
  grid-row: 1 / span 2;
}

.era__photo-link {
  display: block;
  text-decoration: none;
}

.era__photo-link:hover .era__img {
  border-color: var(--accent);
}

.era__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.photo-credit {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.era__years {
  flex-shrink: 0;
  min-width: 5.5rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  grid-column: 2;
  align-self: start;
}

.era__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  grid-column: 3;
}

.era__entry {
  display: block;
  font-weight: 500;
}

.era__chassis {
  font-size: 0.85rem;
  color: var(--muted);
}

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

  .team__meta {
    display: none;
  }

  .era {
    grid-template-columns: 5.5rem 1fr;
    gap: 0.5rem 0.65rem;
  }

  .era__photo {
    grid-column: 1;
    grid-row: 1 / span 3;
    max-width: 5.5rem;
  }

  .era__years {
    grid-column: 2;
  }

  .era__body {
    grid-column: 2;
  }
}
