/* Depends on: calendar.css -- linked as separate <link>
   tags by every template that uses this file, NOT @import-ed here.
   @import is a serialized waterfall: the browser cannot discover an
   imported file until it has downloaded and parsed the one importing
   it, so this site's deepest chain (tokens -> nav -> calendar ->
   event_detail) cost four sequential round trips before first paint.
   Separate links are all visible in the initial HTML and download in
   parallel. Templates list dependencies first, so the cascade is
   unchanged -- see core/tests/test_template_lint.py, which fails if
   an @import is reintroduced here. */
/* calendar.css supplies the shell (body, .wrap, .topbar, .brand, .btn-ghost,
   .cat-chip, .empty-state). Below is team-detail specific. */

/* ---------- Hero ---------- */
.team-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 24px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(175deg, var(--surface) 0%, var(--card-gradient-end) 100%);
}
/* Platinum sponsor's own page -- same gold treatment as the directory's
   featured row (.platinum-sponsor-row), just scaled up for a hero. */
.team-hero-platinum {
  border-color: var(--gold);
  background: linear-gradient(175deg, var(--gold-soft) 0%, var(--card-gradient-end) 100%);
}
/* A clean, unobstructed photo strip -- normal document flow (not an
   absolutely-positioned background), so nothing ever sits on top of it;
   .team-hero-body (logo/name/badges) flows below instead. */
.team-hero .hero-cover {
  display: block; width: calc(100% + 52px); margin: -26px -26px 20px;
  aspect-ratio: 4 / 1.0815; /* ~8% taller than LinkedIn's own cover ratio (1584x396) */
  object-fit: cover;
}
/* .hero-cover-video-wrap carries the same slot/sizing as .hero-cover
   above (a real <img> can't wrap a fallback poster the way a background-
   image can), with the video absolutely filling it -- see
   team_detail.html's own comment on why the poster needs its own layer:
   hiding the video under reduced motion must still leave a real image,
   not an empty box. */
.team-hero .hero-cover-video-wrap {
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
/* The placeholder cover (no team photo yet) is toned down so it reads as a
   backdrop, not as the loudest thing on the page. A real uploaded cover is untouched. */
.team-hero .hero-cover-video-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 13, 16, 0.3), rgba(10, 13, 16, 0.72));
}
.team-hero .hero-cover-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (prefers-reduced-motion: reduce) {
  .team-hero .hero-cover-video { display: none; }
}
.team-hero-body { display: flex; align-items: center; gap: 22px; }
.team-bio { font-size: 13.5px; color: var(--text-secondary); margin-top: 10px; line-height: 1.55; max-width: 60ch; }
.team-logo {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-tertiary);
}
.team-logo img { width: 100%; height: 100%; object-fit: cover; }
.team-logo svg { width: 40px; height: 40px; }
.team-id { min-width: 0; }
.team-eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.team-hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; margin-top: 4px; }
.team-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.recruiting-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 100px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
}
.recruiting-toggle-form { margin-top: 12px; }
.cover-reposition { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.cr-label { font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); margin-right: 2px; }
.cr-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-secondary); font-size: 11px;
  cursor: pointer; display: grid; place-items: center; font-family: inherit;
}
.cr-btn:hover { border-color: var(--accent-line); color: var(--text-primary); }
.cr-reset { width: auto; padding: 0 8px; font-size: 10.5px; font-weight: 700; }

/* ---------- Jump nav ---------- */
.team-jump-nav {
  display: flex; flex-wrap: wrap; gap: 6px 4px; margin-top: 16px;
  /* Sticks just below .topbar (nav.css), which is itself sticky at
     top:0/z-index:30 with min-height:64px -- offsetting by that height
     keeps this row from stacking underneath it once both are stuck. */
  position: sticky; top: 64px; z-index: 5;
  background: var(--glass-bg); backdrop-filter: blur(10px); padding: 8px 0;
}
.team-jump-nav a {
  padding: 6px 12px; border-radius: 100px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-secondary); font-size: 12.5px;
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.team-jump-nav a:hover { border-color: var(--accent-line); color: var(--text-primary); }

/* ---------- Stat strip ---------- */
.team-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-top: 14px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ts-cell { background: var(--surface); padding: 16px 12px; text-align: center; display: block; color: inherit; text-decoration: none; }
a.ts-cell:hover { background: var(--card-gradient-end); }
a.ts-cell:hover .l { color: var(--text-secondary); }
.ts-cell .v { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.ts-cell .v.accent { color: var(--accent); }
.ts-cell .l { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

/* ---------- Sections ---------- */
.team-section { margin-top: 30px; }
.team-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.team-section-head h2 { font-size: 18px; font-weight: 800; }
.team-section-head .sub { font-size: 12.5px; color: var(--text-tertiary); }

/* The roster cards (.roster-*) live in roster.css. */

/* ---------- Results table ---------- */
.team-results {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.team-results th {
  text-align: left;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.team-results td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.team-results tr:last-child td { border-bottom: none; }
.team-results tbody tr:hover { background: var(--surface); }
.res-pos {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.res-pos.p1 { background: var(--gold-soft); color: var(--gold); }
.res-pos.p2 { background: var(--silver-soft); color: var(--silver); }
.res-pos.p3 { background: var(--bronze-soft); color: var(--bronze); }
.tr-driver a { font-weight: 700; }
.tr-driver a:hover { color: var(--accent); }
.tr-event a:hover { color: var(--accent); }
.tr-heat { color: var(--text-tertiary); font-size: 11.5px; }
.tr-date { color: var(--text-tertiary); }

@media (max-width: 620px) {
  .team-stats { grid-template-columns: repeat(2, 1fr); }
  /* .team-hero itself isn't a flex container -- .team-hero-body (logo +
     name/badges) is the actual row that needs to stack. text-align stays
     on .team-hero since it's inherited by every child either way. */
  .team-hero { text-align: center; }
  .team-hero-body { flex-direction: column; }
  .team-results { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Team rankings directory (/equipos/) */
.team-rank-list { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 40px; }
.team-rank-row {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: linear-gradient(175deg, var(--surface) 0%, var(--card-gradient-end) 100%);
  color: inherit; transition: border-color 0.15s ease, transform 0.15s ease;
}
.team-rank-row:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tr-pos {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 800; font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); background: var(--surface-2);
}
.tr-logo {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line);
}
.tr-logo img { width: 100%; height: 100%; object-fit: cover; }
.tr-logo svg { width: 20px; height: 20px; color: var(--text-tertiary); }
/* No logo: the team's initials, tinted, instead of one identical icon on every row. */
.tr-initials { font-size: 14px; font-weight: 800; letter-spacing: 0.02em; color: var(--accent); }
.team-initials { font-size: 26px; }
.tr-logo:has(.tr-initials) { background: var(--accent-soft); border-color: var(--accent-line); }
.tr-info { flex: 1; min-width: 0; }
.tr-name { font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tr-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }
.tr-points { text-align: right; flex-shrink: 0; }
.tr-points .v { font-size: 19px; font-weight: 800; color: var(--accent); }
.tr-points .l { font-size: 9.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }

/* Platinum sponsor placement -- a paid spot, styled with the same
   gold/champion palette as a real 1st place (.tr-pos.p1) so it reads as
   premium, but visually distinct (badge text, not a bare position number)
   so it's never confused with an earned ranking result. */
.team-rank-row.platinum-sponsor-row {
  border-color: var(--gold); background: linear-gradient(175deg, var(--gold-soft) 0%, var(--card-gradient-end) 100%);
}
/* A paid spot takes more room than an earned one: roomier padding, a bigger
   logo and name, and a soft gold glow, so it reads as the featured row. */
.team-rank-row.platinum-sponsor-row { padding: 26px 22px; gap: 20px; box-shadow: 0 0 28px -14px var(--gold); }
.platinum-sponsor-row .tr-logo { width: 68px; height: 68px; border-radius: 14px; }
.platinum-sponsor-row .tr-initials { font-size: 20px; }
.platinum-sponsor-row .tr-name { font-size: 18px; }
.platinum-sponsor-row .tr-sub { font-size: 13px; margin-top: 5px; }
.tr-pos.platinum-badge { background: var(--gold-soft); color: var(--gold); font-size: 16px; }
.platinum-sponsor-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 100px;
  background: var(--gold-soft); border: 1px solid var(--gold); color: var(--gold);
}
@media (max-width: 480px) {
  .team-rank-row { gap: 10px; padding: 12px; }
  .team-rank-row.platinum-sponsor-row { gap: 12px; padding: 18px 14px; }
  .platinum-sponsor-row .tr-logo { width: 56px; height: 56px; }
  .tr-sub { display: block; }
}

/* ---------- Shared form primitives (this page's own edit forms) ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.field select { width: 100%; }
.field input[type="file"], .field input[type="text"], .field input[type="email"],
.field input[type="url"], .field input[type="number"], .field input[type="date"], .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-primary); font-size: 13.5px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.field-inline { display: flex; gap: 10px; }
.field-inline .field { flex: 1; }
.team-edit-details { margin-top: 14px; }
.team-edit-details summary { cursor: pointer; display: inline-block; list-style: none; }
.team-edit-details summary::-webkit-details-marker { display: none; }
.team-edit-details form { margin-top: 12px; max-width: 420px; }

/* ---------- Team profile ---------- */
.team-profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tpg-item { display: flex; flex-direction: column; gap: 3px; }
.tpg-label { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }
.tpg-value { font-size: 14px; font-weight: 700; color: var(--text-primary); }

/* ---------- Contact info ---------- */
.contact-info { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--text-secondary);
}
.contact-chip:hover { border-color: var(--accent-line); color: var(--text-primary); }
.contact-chip svg { width: 14px; height: 14px; color: var(--text-tertiary); flex-shrink: 0; }

/* ---------- Photo wall (gallery + car-listing photos) ---------- */
.photo-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pw-item { position: relative; }
.pw-cell {
  display: block; position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--radius-md); border: 1px solid var(--line);
}
.pw-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.pw-cell:hover img { transform: scale(1.05); }
.pw-delete-form { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity 0.15s ease; }
.pw-item:hover .pw-delete-form { opacity: 1; }
.pw-delete-btn {
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(10, 13, 16, 0.75); color: #fff; font-size: 15px; line-height: 1;
}
.pw-delete-btn:hover { background: #b91c1c; }
.gallery-upload-form { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.gallery-upload-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-secondary); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.gallery-upload-btn:hover { border-color: var(--accent-line); color: var(--text-primary); background: var(--card-gradient-end); }
.gallery-upload-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Lightbox (shared with event/profile galleries; see lightbox.js) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 10, 0.93); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 4vw; }
.lb-img { max-width: 88vw; max-height: 82vh; object-fit: contain; border-radius: 8px; box-shadow: 0 24px 70px -24px rgba(0,0,0,0.85); }
.lb-cap { font-size: 13px; color: rgba(255,255,255,0.72); font-weight: 600; }
.lb-cap[hidden] { display: none; }
.lb-close, .lb-nav {
  position: fixed; display: grid; place-items: center; color: #fff;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.14); line-height: 1;
  transition: background 0.15s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,0.24); }
.lb-close { top: 18px; right: 20px; width: 42px; height: 42px; border-radius: 10px; font-size: 26px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; font-size: 30px; }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lightbox.single .lb-nav, .lightbox.single .lb-counter { display: none; }
.lb-counter { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; letter-spacing: 0.03em; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .lb-nav { width: 42px; height: 42px; font-size: 24px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

/* ---------- Car listings ---------- */
.car-listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.car-listing-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); display: flex; flex-direction: column;
}
.cl-hero { aspect-ratio: 16 / 10; border-radius: 0; border: none; }
.cl-hero-empty { display: grid; place-items: center; background: var(--surface-2); color: var(--text-tertiary); }
.cl-hero-empty svg { width: 32px; height: 32px; }
.cl-thumb-strip { display: flex; gap: 4px; padding: 6px 6px 0; }
.cl-thumb-strip .pw-cell { width: 44px; height: 44px; aspect-ratio: unset; flex-shrink: 0; }
.cl-body { padding: 14px 16px 16px; }
.cl-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cl-type-badge {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 100px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.cl-type-badge.cl-rent { background: var(--gold-soft); color: var(--gold); border-color: rgba(255, 201, 74, 0.3); }
.cl-status-badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 100px;
  background: var(--surface-2); color: var(--text-tertiary); border: 1px solid var(--line);
}
.cl-status-badge.cl-status-sold_or_rented { color: var(--text-tertiary); text-decoration: line-through; }
.cl-status-badge.cl-status-inactive { opacity: 0.6; }
.cl-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.cl-price { font-size: 17px; font-weight: 800; color: var(--accent); }
.cl-period { font-size: 11px; font-weight: 600; color: var(--text-tertiary); margin-left: 3px; }
.cl-event { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.cl-event:hover { color: var(--accent); }
.cl-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }
.cl-actions { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 620px) {
  .car-listing-grid { grid-template-columns: 1fr; }
}

/* Resultados recientes: the profile's race-history rows (profile.css .race-row,
   .pos-badge) restated here, since this page doesn't link profile.css. */
.tr-card { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(175deg, var(--surface) 0%, var(--card-gradient-end, var(--surface)) 100%); padding: 6px 20px; }
.tr-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.tr-row:last-child { border-bottom: none; }
.tr-row.podium { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); border-radius: 10px; padding-left: 12px; padding-right: 12px; margin: 0 -12px; }
.tr-pos { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 15px; font-weight: 800; font-family: var(--font-mono); }
.tr-pos.p1 { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(255,201,74,0.35); }
.tr-pos.p2 { background: var(--silver-soft); color: var(--silver); border: 1px solid rgba(201,211,220,0.3); }
.tr-pos.p3 { background: var(--bronze-soft); color: var(--bronze); border: 1px solid rgba(214,138,86,0.35); }
.tr-pos.pn { background: var(--surface); color: var(--text-soft); border: 1px solid var(--line); }
.tr-info { flex: 1; min-width: 0; }
.tr-info .tr-driver { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tr-info .tr-driver:hover { color: var(--accent); }
.tr-sub { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.tr-sub .tr-event { color: var(--text-secondary); }
.tr-sub .tr-event:hover { color: var(--accent); }
.tr-row .tr-date { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
@media (max-width: 520px) { .tr-row { flex-wrap: wrap; } .tr-row .tr-date { flex-basis: 100%; padding-left: 62px; } }
