:root {
  --target-size: 24px;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

html {
  scroll-padding-top: calc(7.25rem + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: #F8FAFC;
  color: #1E293B;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  margin: 0;
  padding: 0;
  overflow-wrap: break-word;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

img,
video,
svg {
  max-inline-size: 100%;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

/* Prevent iOS Safari auto-zoom (<16px) and enforce mobile / coarse pointer tap targets (WCAG 2.5.5 / 2.5.8) */
@media (pointer: coarse), (max-width: 639px) {
  :where(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) {
    font-size: max(1rem, 1em) !important;
  }
}

@media (pointer: coarse) {
  :where(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) {
    min-block-size: var(--target-size);
  }

  :where(button:not(.compact-pill), [role="button"], nav a, label:has(input[type="checkbox"], input[type="radio"])) {
    min-block-size: 40px;
  }

  input[type="range"] {
    min-block-size: 36px;
  }
}

.icon-close-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 36px;
  min-block-size: 36px;
  border-radius: 6px;
}
.icon-close-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.safe-top-header {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.safe-bottom-toast {
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hide horizontal scrollbar clutter on mobile nav strip while keeping touch scroll */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.brand-cyan { color: #23B5E8; }
.bg-brand-cyan { background-color: #23B5E8; }
.border-brand-cyan { border-color: #23B5E8; }

.btn-cyan-solid {
  background: linear-gradient(180deg, #27BCEF 0%, #19A8DA 100%);
  color: #FFFFFF;
  border: 1px solid #179ECC;
  box-shadow: 0 2px 6px rgba(25, 168, 218, 0.25);
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.btn-cyan-solid:hover {
  filter: brightness(1.04);
  box-shadow: 0 4px 12px rgba(25, 168, 218, 0.34);
}
.btn-cyan-solid:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-cyan-outline {
  background: #FFFFFF;
  color: #19A8DA;
  border: 1.5px solid #23B5E8;
  transition: background-color 150ms ease, color 150ms ease;
}
.btn-cyan-outline:hover {
  background: #23B5E8;
  color: #FFFFFF;
}

/* Primary navigation current-page indicator (non-color-only WCAG 1.4.1) */
.top-nav-link {
  position: relative;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 5px;
  transition: color 140ms ease, background-color 140ms ease;
}
.top-nav-link:hover {
  color: #23B5E8;
  background-color: #F1F9FD;
}
.top-nav-link[aria-current="page"] {
  color: #138CB8;
  font-weight: 600;
  background-color: #F1F9FD;
}
.top-nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline: 10px;
  inset-block-end: 0;
  block-size: 2px;
  border-radius: 999px;
  background: #23B5E8;
}

/* Editorial Hero Banner — enhanced mobile legibility gradient */
.hero-banner {
  position: relative;
  background-color: #0D141B;
  background-image:
    linear-gradient(180deg, rgba(9, 14, 20, 0.90) 0%, rgba(12, 20, 28, 0.82) 100%),
    url('/assets/hero-banner.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

@media (min-width: 640px) {
  .hero-banner {
    background-image:
      linear-gradient(90deg, rgba(9, 14, 20, 0.88) 0%, rgba(12, 20, 28, 0.72) 44%, rgba(12, 20, 28, 0.18) 72%, rgba(12, 20, 28, 0.06) 100%),
      url('/assets/hero-banner.jpg');
    background-position: center right;
  }
}

.sub-banner {
  background: linear-gradient(105deg, #0E1722 0%, #193142 58%, #286A87 100%);
}

.clean-card {
  background: #FFFFFF;
  border: 1px solid #E5E9F0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.clean-card:hover {
  border-color: #B9E5F7;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #23B5E8;
  outline-offset: 2px;
}

/* Responsive container-query tables */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(460px, 75dvh);
  container-type: inline-size;
}
.clean-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.clean-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #F8FAFC;
}
.clean-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #FFFFFF;
  text-align: left;
  font-weight: 600;
}
.clean-table tbody tr:hover th,
.clean-table tbody tr:hover td {
  background: #F8FAFC;
}
@container (width < 600px) {
  .clean-table,
  .clean-table thead,
  .clean-table tbody,
  .clean-table tr,
  .clean-table th,
  .clean-table td {
    display: block;
  }
  .clean-table thead {
    display: none;
  }
  .clean-table tbody {
    padding: 0.75rem;
  }
  .clean-table tr {
    margin-block-end: 0.75rem;
    border: 1px solid #E5E9F0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #FFFFFF;
  }
  .clean-table tr:last-child {
    margin-block-end: 0;
  }
  .clean-table tbody th {
    position: static;
    background: #F8FAFC;
    border-bottom: 1px solid #E5E9F0;
    padding: 0.65rem 0.85rem;
  }
  .clean-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #F1F5F9;
    text-align: right;
    white-space: normal !important;
  }
  .clean-table tbody td:last-child {
    border-bottom: 0;
  }
  .clean-table tbody td:not([colspan])::before {
    content: attr(data-label);
    font-weight: 600;
    color: #64748B;
    text-align: left;
    flex-shrink: 0;
  }
  .clean-table tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 1.25rem 1rem;
  }
}

/* Modal scroll containment & backdrop light-dismiss styling */
dialog:modal {
  overscroll-behavior: contain;
  max-block-size: min(92dvh, 720px);
  margin: auto;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

input[type="range"] {
  accent-color: #23B5E8;
}

/* Real Interactive Leaflet Map Price Pills & Markers */
.leaflet-container {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.p99-map-pin-wrap {
  background: transparent;
  border: 0;
}

.p99-map-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 44px;
  height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: #23B5E8;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 2px solid #FFFFFF;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.p99-map-pill:hover {
  transform: translateY(-2px) scale(1.06);
  background: #0F172A;
}

.p99-map-pill.is-selected {
  background: #0F172A;
  border-color: #23B5E8;
  box-shadow: 0 0 0 4px rgba(35, 181, 232, 0.28), 0 6px 14px rgba(15, 23, 42, 0.32);
  transform: scale(1.08);
  z-index: 900;
}

.p99-map-pill.is-dimmed {
  opacity: 0.38;
}

.p99-route-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
  white-space: nowrap;
}

.p99-route-badge.is-solver {
  background: #23B5E8;
}

.p99-route-badge.is-poster {
  background: #0F172A;
}
