/* ============================================================
   ASHWA RACING — TEAM PAGE
   Aesthetic: Motorsport Editorial / F1 Paddock Pass
   Fonts: Barlow Condensed (display) + Barlow (body)
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  --red:        #e8001d;
  --red-dark:   #b5001a;
  --black:      #0a0a0a;
  --charcoal:   #141414;
  --dark-grey:  #1e1e1e;
  --mid-grey:   #3a3a3a;
  --light-grey: #f2f2f2;
  --white:      #ffffff;
  --text-muted: #888;

  /* Role accent colours — used for lead/captain elevation */
  --gold:       #c9a84c;
  --gold-dim:   rgba(201,168,76,0.12);

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--charcoal);
  color: var(--white);
  overflow-x: hidden;
}

/* ============================================================
   HERO
   ============================================================ */
.team-hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  max-height: 960px;
  background: var(--black);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.team-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  filter: brightness(0.32) saturate(0.75);
  transform: scale(1.04);
  transition: transform 9s var(--ease-out-expo);
}

.team-hero:hover .team-hero-bg {
  transform: scale(1.0);
}

/* Telemetry grid overlay */
.hero-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

/* Bottom vignette — anchors the text */
.team-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(transparent, rgba(10,10,10,0.92) 80%);
  pointer-events: none;
  z-index: 2;
}

/* Primary red vertical stripe */
.hero-stripe {
  position: absolute;
  top: 0; right: 8%;
  width: 3px;
  height: 100%;
  background: var(--red);
  opacity: 0.9;
  z-index: 3;
}

/* Secondary dimmer stripe */
.hero-stripe--secondary {
  right: calc(8% + 14px);
  width: 1px;
  opacity: 0.28;
}

.team-hero-content {
  position: relative;
  z-index: 3;
  padding: 0 7% 9vh;
  max-width: 820px;
}

/* Eyebrow — already in HTML, now has CSS */
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 22px;
  font-weight: 600;
}

.eyebrow-line {
  display: block;
  width: 28px;
  height: 2px;
  background: var(--red);
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 10.5vw, 8.5rem);
  font-weight: 800;
  line-height: 0.9;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 0.04em;
}

/* THE stays white, PEOPLE goes red-italic */
.hero-title > span:first-child {
  display: flex;
  gap: 0.18em;
  align-items: baseline;
}

.hero-title em {
  font-style: italic;
  color: var(--red);
}

.hero-desc {
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.52);
  max-width: 400px;
  margin-bottom: 44px;
  font-weight: 300;
  letter-spacing: 0.01em;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; }

.stat-num {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 5px;
}

.stat-divider {
  width: 1px;
  height: 38px;
  background: rgba(255,255,255,0.14);
  flex-shrink: 0;
}

/* Scroll hint — was in CSS but missing from HTML, now present */
.hero-scroll-hint {
  position: absolute;
  bottom: 52px;
  right: 7%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.28);
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.scroll-bar {
  width: 1px;
  height: 64px;
  background: rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
  writing-mode: horizontal-tb;
}

.scroll-bar::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--red);
  animation: scrollDrop 2s ease-in-out infinite;
}

@keyframes scrollDrop {
  0%   { top: -100%; }
  100% { top: 100%; }
}

/* ============================================================
   FILTERS
   ============================================================ */
.team-filters {
  background: var(--black);
  padding: 56px 0 52px;
  position: relative;
  /* Intentional top separator — red line, not just opacity border */
  border-top: 2px solid var(--red);
}

.filters-label {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,0.08);
  text-transform: uppercase;
  pointer-events: none;
  display: none;
  user-select: none;
}

@media (min-width: 1100px) {
  .filters-label { display: block; }
}

.team-filters-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 7%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Thin rule between year and subsystem groups */
.filter-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 -1px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-group-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  padding: 4px 0;
  scroll-behavior: smooth;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.year-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.year-item.spacer {
  width: 28vw;
  pointer-events: none;
}

.filter-btn {
  padding: 7px 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.42);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  position: relative;
}

.filter-btn:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.04);
}

.filter-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.nav-arrow {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.35);
  padding: 0;
  cursor: pointer;
  border-radius: 2px;
  font-size: 0.75rem;
  transition: border-color 0.18s, color 0.18s;
  flex-shrink: 0;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-arrow:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--white);
}

/* Subsystem description — redesigned with labelled tag */
.subsystem-desc {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-left: 2px solid var(--red);
  padding-left: 16px;
  transition: opacity 0.25s ease;
  min-height: 24px;
}

.desc-tag {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--red);
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.desc-text {
  font-size: 0.83rem;
  color: rgba(255,255,255,0.32);
  line-height: 1.6;
  letter-spacing: 0.01em;
  font-weight: 300;
}

/* ============================================================
   TEAM SECTION
   ============================================================ */
.team-section {
  background: var(--charcoal);
  padding: 72px 7% 100px;
  min-height: 60vh;
}

.team-section-header {
  max-width: 1320px;
  margin: 0 auto 52px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.section-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.team-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.section-meta-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.member-count {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--red);
  text-transform: uppercase;
}

.section-rule {
  width: 48px;
  height: 2px;
  background: var(--red);
}

/* ============================================================
   MEMBER GRID
   ============================================================ */
.member-grid {
  max-width: 1320px;
  margin: 0 auto;
  /* Max 4 columns at any viewport — prevents cramped 5-col layouts */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  max-width: 1320px;
  gap: 2px;
  transition: opacity 0.22s ease;
}

/* ============================================================
   NO MEMBERS STATE
   ============================================================ */
.no-members {
  grid-column: 1 / -1;
  text-align: center;
  padding: 100px 20px;
  color: rgba(255,255,255,0.22);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.no-members i {
  display: block;
  font-size: 2.2rem;
  margin-bottom: 20px;
  color: var(--red);
  opacity: 0.35;
}

/* ============================================================
   MEMBER CARD — BASE
   ============================================================ */
.member-card {
  background: var(--dark-grey);
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform 0.4s var(--ease-out-expo);
  animation: cardReveal 0.5s var(--ease-out-expo) both;
}

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

.member-card:hover {
  transform: scale(1.018);
  z-index: 2;
}

/* Red left-edge accent — animates full height on hover */
.member-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 0;
  background: var(--red);
  transition: height 0.4s var(--ease-out-expo);
  z-index: 4;
}

.member-card:hover::before { height: 100%; }

/* ============================================================
   ELEVATED CARD — TEAM CAPTAIN & CHIEF ENGINEER
   Spans 2 columns when grid allows, gold treatment
   ============================================================ */
.member-card.is-command {
  background: #191510;
  border: 1px solid rgba(201,168,76,0.18);
}

/* Gold edge instead of red */
.member-card.is-command::before {
  background: var(--gold);
}

.member-card.is-command:hover::before { height: 100%; }

/* ============================================================
   SUBSYSTEM LEAD CARD
   Slightly elevated — red-tinted dark background
   ============================================================ */
.member-card.is-lead {
  background: #1a1212;
}

/* ============================================================
   PROFILE HEADER (image + overlay)
   ============================================================ */
.profile-header {
  position: relative;
}

.profile-img-container {
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  background: var(--mid-grey);
}

.profile-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.65s var(--ease-out-expo), filter 0.4s ease;
  filter: saturate(0.8) brightness(0.95);
}

.member-card:hover .profile-img-container img {
  transform: scale(1.05);
  filter: saturate(1) brightness(1);
}

/* Command cards get a slightly larger image area for visual weight */
.member-card.is-command .profile-img-container {
  aspect-ratio: 3/4;
}

/* Gradient overlay — anchors name/role text */
.profile-info-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.88) 45%);
  padding: 56px 18px 16px;
}

.member-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}

.member-role {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 700;
}

/* Role colour varies by card type */
.member-card.is-command .member-role { color: var(--gold); }
.member-card.is-lead    .member-role { color: var(--red); }
.member-card            .member-role { color: rgba(255,255,255,0.55); }

.member-subsystem {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.38);
  margin-top: 3px;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

/* ============================================================
   ROLE BADGE — pinned top-right, replaces colour-only signal
   ============================================================ */
.role-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 2px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.role-badge.badge-command {
  background: rgba(201,168,76,0.9);
  color: #0a0a0a;
}

.role-badge.badge-lead {
  background: rgba(232,0,29,0.88);
  color: var(--white);
}

/* ============================================================
   CONTRIBUTION SECTION
   ============================================================ */
.member-experience {
  padding: 14px 18px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.exp-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exp-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}

.member-experience p {
  font-size: 0.82rem;
  line-height: 1.65;
  /* Improved from 0.5 opacity — better WCAG contrast on dark-grey */
  color: rgba(255,255,255,0.62);
  font-weight: 300;
}

/* ============================================================
   SOCIAL LINKS
   ============================================================ */
.member-social {
  padding: 0 18px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.member-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 2px;
  color: rgba(255,255,255,0.38);
  font-size: 0.8rem;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.member-social a:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
  transform: translateY(-2px);
}

/* Gold social links for command cards */
.member-card.is-command .member-social a:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
}

/* ============================================================
   3D EASTER EGG
   ============================================================ */
.member-3d {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  background: #000;
  transition: opacity 0.3s ease;
}

.member-card.easter-egg:hover .member-3d { opacity: 1; }
.member-card.easter-egg:hover > :not(.member-3d) { opacity: 0; }

.member-3d canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 32px; right: 32px;
  width: 46px; height: 46px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(232,0,29,0.3);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  z-index: 1000;
}

.back-to-top:hover {
  background: var(--red-dark);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(232,0,29,0.42);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .member-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 900px) {
  .hero-title {
    font-size: clamp(3.2rem, 14vw, 6rem);
  }

  .team-section {
    padding: 56px 5% 80px;
  }

  .team-section-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-meta-right {
    flex-direction: row-reverse;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
  }

  .section-rule { display: none; }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: clamp(2.8rem, 16vw, 5rem);
  }

  .hero-stats { gap: 18px; }
  .stat-num   { font-size: 1.5rem; }

  .team-filters { padding: 44px 0 40px; }
  .team-filters-inner { padding: 0 5%; }

  .member-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .year-item.spacer { width: 20vw; }

  .back-to-top {
    bottom: 20px; right: 20px;
    width: 42px; height: 42px;
  }
}

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