/* ---- Floating F1 Header Navigation Capsule & Miniature Track Straight ---- */

/* Fullscreen cinematic blur backdrop during transit */
.f1-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99940;
  background: rgba(4, 6, 12, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.f1-nav-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Floating Capsule Bar (Resting State: Simple, Clean Bar) */
.f1-nav-capsule {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: center bottom;
  z-index: 99950;
  width: min(840px, calc(100vw - 32px));
  background: rgba(11, 14, 20, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  padding: 10px 22px;
  gap: 0;
  user-select: none;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              padding 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              border-radius 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}

/* Enlarged Transit State - Prominent centerpiece across viewport */
.f1-nav-capsule.is-expanded {
  width: min(1320px, calc(100vw - 32px));
  border-radius: 18px;
  padding: 16px 28px 16px 28px;
  gap: 14px;
  transform: translateX(-50%) scale(1.02);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95);
  border-color: rgba(220, 38, 38, 0.7);
}

@media (prefers-reduced-transparency: reduce) {
  .f1-nav-capsule {
    background: #0B0E14;
    backdrop-filter: none;
  }
}

/* Header Top Row */
.f1-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.f1-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.f1-nav-brand-badge {
  display: inline-flex;
  align-items: center;
  background: #DC2626;
  color: #FFFFFF;
  font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.f1-nav-brand-text {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.85rem;
  font-weight: 800;
  color: #E8E6E1;
  letter-spacing: 0.12em;
}

/* Navigation Links */
.f1-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.f1-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #94A3B8;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.f1-nav-lbl-short {
  display: none;
}

.f1-nav-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.f1-nav-btn.is-active {
  color: #FFFFFF;
  background: rgba(220, 38, 38, 0.26);
  border-color: rgba(220, 38, 38, 0.75);
}

/* Transit Telemetry Status (Hidden when resting, shown when enlarged) */
.f1-nav-status {
  display: none;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  color: #94A3B8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 14px;
  border-radius: 6px;
  white-space: nowrap;
}

.f1-nav-capsule.is-expanded .f1-nav-status {
  display: flex;
}

.f1-nav-drs-tag {
  color: #DC2626;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.f1-nav-speed {
  font-weight: 800;
  color: #FFF200;
  font-size: 0.9rem;
}

/* Miniature F1 Track Straight Container */
.f1-nav-track-wrap {
  position: relative;
  width: 100%;
  height: 0;
  opacity: 0;
  pointer-events: none;
  background: #11141C;
  border-radius: 8px;
  overflow: hidden;
  border: 0 solid rgba(255, 255, 255, 0.1);
  transition: height 0.32s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.32s ease,
              border-width 0.32s ease;
}

.f1-nav-capsule.is-expanded .f1-nav-track-wrap {
  height: 76px;
  opacity: 1;
  pointer-events: auto;
  border-width: 1px;
}

/* Monaco GP Kerbing: Top and Bottom */
.f1-nav-kerb-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, #DC2626 0, #DC2626 16px, #FFFFFF 16px, #FFFFFF 32px);
}

.f1-nav-kerb-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, #FFFFFF 0, #FFFFFF 16px, #DC2626 16px, #DC2626 32px);
}

/* Asphalt Straight Bed & Lane Markings */
.f1-nav-asphalt {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  right: 0;
  background: #12151E;
  display: flex;
  align-items: center;
}

/* Dashed centerline */
.f1-nav-asphalt::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0.35) 10px, transparent 10px, transparent 20px);
  transform: translateY(-50%);
  pointer-events: none;
}

/* Grid Slots at start */
.f1-nav-grid-marks {
  position: absolute;
  left: 14px;
  top: 6px;
  bottom: 6px;
  width: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  pointer-events: none;
}

.f1-nav-grid-box {
  width: 20px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

/* Waypoints / Sector Marks along the straight */
.f1-nav-waypoint {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.f1-nav-waypoint::after {
  content: attr(data-tag);
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 800;
  text-transform: uppercase;
}

.f1-nav-waypoint.is-active::after {
  color: #DC2626;
}

/* Checkered finish line at the far end */
.f1-nav-finish-line {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: repeating-conic-gradient(#000000 0% 25%, #FFFFFF 0% 50%) 50% / 10px 10px;
  pointer-events: none;
}

/* Animated Sprint Across Track from Start (0px) to End */
@keyframes f1SprintAcrossTrack {
  0% {
    left: 0px;
  }
  12% {
    left: 4%;
  }
  100% {
    left: calc(100% - 114px);
  }
}

/* The Animated Top-Down Ferrari F1 Car */
.f1-nav-car-cursor {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 108px;
  height: 46px;
  pointer-events: none;
  z-index: 10;
  will-change: transform, left;
}

.f1-nav-car-cursor.is-sprinting {
  animation: f1SprintAcrossTrack 0.95s cubic-bezier(0.18, 0.92, 0.3, 1) forwards;
}

.f1-nav-car-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Speed streak effect when car is accelerating */
.f1-nav-car-cursor.is-driving::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 85%;
  width: 95px;
  height: 12px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.95) 25%, #FFF200 80%, #FFFFFF);
  border-radius: 6px;
  opacity: 0.95;
  pointer-events: none;
}

/* Responsive queries */
@media (max-width: 768px) {
  .f1-nav-capsule {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    width: calc(100vw - 16px);
    max-width: 480px;
    padding: 6px 8px;
    z-index: 99950;
  }
  .f1-nav-capsule.is-expanded {
    width: calc(100vw - 16px);
    max-width: 480px;
    padding: 8px 8px 6px 8px;
    transform: translateX(-50%) scale(1.01);
  }
  .f1-nav-brand-text {
    display: none;
  }
  .f1-nav-status {
    display: none !important;
  }
  .f1-nav-lbl-long {
    display: none;
  }
  .f1-nav-lbl-short {
    display: inline;
  }
  .f1-nav-links {
    gap: 2px;
    width: 100%;
    justify-content: space-between;
  }
  .f1-nav-btn {
    font-size: 0.66rem;
    padding: 3px 6px;
  }
  .f1-nav-capsule.is-expanded .f1-nav-track-wrap {
    height: 46px;
  }
  .f1-nav-car-cursor {
    width: 68px;
    height: 28px;
  }
  @keyframes f1SprintAcrossTrackMobile {
    0% {
      left: 0px;
    }
    100% {
      left: calc(100% - 72px);
    }
  }
  .f1-nav-car-cursor.is-sprinting {
    animation: f1SprintAcrossTrackMobile 0.95s cubic-bezier(0.18, 0.92, 0.3, 1) forwards;
  }
}
