/* Virmaren Meridia Transit Authority - Design System */
:root {
  --vmta-navy: #0A1628;
  --vmta-navy-light: #142240;
  --vmta-teal: #1A6B7A;
  --vmta-teal-light: #2A8B9A;
  --vmta-gold: #E8A838;
  --vmta-gold-light: #F0C060;
  --vmta-white: #F8F9FA;
  --vmta-gray-100: #E9ECEF;
  --vmta-gray-200: #DEE2E6;
  --vmta-gray-300: #CED4DA;
  --vmta-gray-500: #6C757D;
  --vmta-gray-700: #495057;
  --vmta-gray-900: #212529;
  --vmta-red: #C0392B;
  --vmta-green: #27AE60;

  --line-aure: #E8A838;
  --line-cerule: #3B82C4;
  --line-gold: #D4A843;
  --line-hoyde: #6B8E5A;
  --line-ferge: #5B9BD5;

  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --font-display: 'Segoe UI', system-ui, -apple-system, sans-serif;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);

  --header-height: 64px;
  --max-width: 1200px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--vmta-gray-900);
  background: var(--vmta-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
  color: var(--vmta-teal);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover { color: var(--vmta-teal-light); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--vmta-gold);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  background: var(--vmta-navy);
  color: var(--vmta-white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-md);
}

/* Header */
.site-header {
  background: var(--vmta-navy);
  color: var(--vmta-white);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--vmta-white);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.header-logo:hover { color: var(--vmta-gold-light); }

.header-logo svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.main-nav { display: flex; align-items: center; gap: var(--space-xs); }

.main-nav a {
  color: var(--vmta-gray-200);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: rgba(255,255,255,0.1);
  color: var(--vmta-white);
}

.main-nav a[aria-current="page"] {
  background: rgba(255,255,255,0.15);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--vmta-white);
  cursor: pointer;
  padding: var(--space-sm);
}

/* Footer */
.site-footer {
  background: var(--vmta-navy);
  color: var(--vmta-gray-200);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
}

.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2xl);
}

.footer-col h3 {
  color: var(--vmta-white);
  font-size: 1rem;
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col a {
  color: var(--vmta-gray-300);
  display: block;
  padding: var(--space-xs) 0;
  font-size: 0.9rem;
}

.footer-col a:hover { color: var(--vmta-white); }

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: var(--space-2xl) auto 0;
  padding: var(--space-lg) var(--space-lg) 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--vmta-white);
  font-weight: 700;
}

.footer-logo svg { width: 28px; height: 28px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--vmta-teal);
  color: var(--vmta-white);
}

.btn-primary:hover {
  background: var(--vmta-teal-light);
  color: var(--vmta-white);
}

.btn-secondary {
  background: transparent;
  color: var(--vmta-teal);
  border-color: var(--vmta-teal);
}

.btn-secondary:hover {
  background: var(--vmta-teal);
  color: var(--vmta-white);
}

.btn-gold {
  background: var(--vmta-gold);
  color: var(--vmta-navy);
}

.btn-gold:hover {
  background: var(--vmta-gold-light);
  color: var(--vmta-navy);
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Line badges */
.line-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  white-space: nowrap;
}

.line-badge--aure { background: var(--line-aure); color: var(--vmta-navy); }
.line-badge--cerule { background: var(--line-cerule); }
.line-badge--gold { background: var(--line-gold); color: var(--vmta-navy); }
.line-badge--hoyde { background: var(--line-hoyde); }
.line-badge--ferge { background: var(--line-ferge); }

/* Section styles */
.section {
  padding: var(--space-3xl) 0;
}

.section--alt {
  background: var(--vmta-gray-100);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-header h2 {
  color: var(--vmta-navy);
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--vmta-gray-500);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--vmta-navy) 0%, var(--vmta-navy-light) 50%, var(--vmta-teal) 100%);
  color: var(--vmta-white);
  padding: var(--space-3xl) 0;
  min-height: 500px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
  width: 100%;
}

.hero-text h1 {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  line-height: 1.1;
}

.hero-text h1 span {
  color: var(--vmta-gold);
}

.hero-text p {
  font-size: 1.2rem;
  margin-bottom: var(--space-xl);
  color: var(--vmta-gray-200);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-visual svg {
  width: 100%;
  max-width: 500px;
  height: auto;
}

/* Form styles */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--vmta-gray-900);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--vmta-gray-200);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--vmta-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 107, 122, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-error {
  color: var(--vmta-red);
  font-size: 0.85rem;
  margin-top: var(--space-xs);
  display: none;
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--vmta-red);
}

.form-group.has-error .form-error {
  display: block;
}

.form-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

/* Departure board */
.departure-board-wrap {
  background: #0a0e14;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.departure-board-wrap canvas {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
}

.station-selector {
  margin-bottom: var(--space-lg);
}

.station-selector label {
  color: var(--vmta-gray-200);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  display: block;
}

.station-selector select {
  background: var(--vmta-navy-light);
  color: var(--vmta-white);
  border: 2px solid var(--vmta-gray-500);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  width: 100%;
  max-width: 400px;
}

/* Network map */
.map-container {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  overflow: hidden;
}

.map-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-line { cursor: pointer; transition: opacity 0.2s; }
.map-line:hover, .map-line.highlighted { opacity: 1; }
.map-station { cursor: pointer; }
.map-station:hover circle, .map-station:focus circle { stroke-width: 3; }

.map-tooltip {
  position: absolute;
  background: var(--vmta-navy);
  color: var(--vmta-white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.15s;
  max-width: 250px;
}

.map-tooltip.visible { opacity: 1; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  justify-content: center;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.9rem;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.map-legend-item:hover { background: var(--vmta-gray-100); }

.map-legend-swatch {
  width: 24px;
  height: 6px;
  border-radius: 3px;
}

/* Fare calculator */
.fare-calculator {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2xl);
  max-width: 600px;
  margin: 0 auto;
}

.receipt {
  background: #fefefe;
  border: 2px dashed var(--vmta-gray-300);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  position: relative;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  display: none;
}

.receipt.visible { display: block; }

.receipt-header {
  text-align: center;
  border-bottom: 2px dashed var(--vmta-gray-300);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.receipt-header svg { width: 48px; height: 48px; margin: 0 auto var(--space-sm); }

.receipt-line {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
}

.receipt-total {
  border-top: 2px solid var(--vmta-gray-900);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  font-weight: 700;
  font-size: 1.1rem;
}

.receipt-footer {
  text-align: center;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 2px dashed var(--vmta-gray-300);
  font-size: 0.8rem;
  color: var(--vmta-gray-500);
}

/* Timetable */
.timetable-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--vmta-gray-200);
  padding-bottom: var(--space-xs);
}

.timetable-tab {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--vmta-gray-500);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.timetable-tab:hover {
  color: var(--vmta-gray-900);
  background: var(--vmta-gray-100);
}

.timetable-tab.active {
  color: var(--vmta-navy);
  border-bottom-color: var(--vmta-teal);
}

.timetable-panel {
  display: none;
}

.timetable-panel.active {
  display: block;
}

.timetable-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.timetable-table th {
  background: var(--vmta-navy);
  color: var(--vmta-white);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: var(--header-height);
  z-index: 10;
}

.timetable-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--vmta-gray-200);
}

.timetable-table tr:nth-child(even) td {
  background: var(--vmta-gray-100);
}

.timetable-table tr:hover td {
  background: rgba(26, 107, 122, 0.08);
}

.timetable-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--vmta-gray-100);
  border-radius: var(--radius-md);
}

.timetable-meta dt {
  font-weight: 700;
  color: var(--vmta-navy);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.timetable-meta dd {
  margin-bottom: var(--space-sm);
  color: var(--vmta-gray-700);
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.info-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
}

.info-card h3 {
  color: var(--vmta-navy);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.info-card p {
  color: var(--vmta-gray-700);
  line-height: 1.7;
}

/* Fare table */
.fare-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.fare-table th {
  background: var(--vmta-navy);
  color: white;
  padding: var(--space-md) var(--space-lg);
  text-align: left;
}

.fare-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--vmta-gray-200);
}

.fare-table tr:nth-child(even) td {
  background: var(--vmta-gray-100);
}

.fare-price {
  font-weight: 700;
  color: var(--vmta-teal);
  font-size: 1.1rem;
}

/* Notice */
.service-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
}

.service-notice h3 {
  color: #856404;
  margin-bottom: var(--space-sm);
  font-size: 1rem;
}

.service-notice p {
  color: #856404;
  font-size: 0.95rem;
}

/* Page header */
.page-header {
  background: linear-gradient(135deg, var(--vmta-navy) 0%, var(--vmta-navy-light) 100%);
  color: var(--vmta-white);
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.page-header p {
  color: var(--vmta-gray-300);
  font-size: 1.15rem;
  max-width: 600px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--vmta-gray-300);
}

.breadcrumb a:hover { color: var(--vmta-white); }

.breadcrumb span { color: var(--vmta-gray-500); }

/* 404 */
.error-page {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.error-code {
  font-size: 8rem;
  font-weight: 900;
  color: var(--vmta-gray-200);
  line-height: 1;
  margin-bottom: var(--space-md);
}

.error-page h1 {
  margin-bottom: var(--space-md);
}

.error-page p {
  color: var(--vmta-gray-500);
  font-size: 1.15rem;
  margin-bottom: var(--space-xl);
  max-width: 500px;
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text h1 { font-size: 2rem; }

  .hero-actions {
    justify-content: center;
  }

  .hero-visual { order: -1; }
  .hero-visual svg { max-width: 300px; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--vmta-navy);
    flex-direction: column;
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
  }

  .main-nav.open { display: flex; }

  .main-nav a {
    padding: var(--space-md);
    width: 100%;
    text-align: center;
  }

  .menu-toggle { display: block; }

  .section { padding: var(--space-2xl) 0; }
  .section-header h2 { font-size: 1.5rem; }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .timetable-table { font-size: 0.8rem; }
  .timetable-table th, .timetable-table td {
    padding: var(--space-xs) var(--space-sm);
  }
}

@media (max-width: 480px) {
  .hero-text h1 { font-size: 1.6rem; }
  .container { padding: 0 var(--space-md); }
}

/* Print styles */
@media print {
  .site-header, .site-footer, .hero, .hero-visual,
  .menu-toggle, .breadcrumb, .btn, .station-selector,
  .hero-actions, .map-tooltip, .service-notice { display: none !important; }

  body {
    background: white;
    color: black;
    font-size: 10pt;
  }

  .page-header {
    background: none;
    color: black;
    padding: 0;
    margin-bottom: 1rem;
  }

  .page-header h1 { font-size: 18pt; color: black; }
  .page-header p { color: #333; }

  .timetable-table th {
    background: #333 !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .timetable-table td {
    border: 1px solid #ccc;
  }

  .timetable-panel { display: block !important; page-break-inside: avoid; margin-bottom: 2rem; }
  .timetable-tabs { display: none; }

  .container { max-width: 100%; padding: 0; }

  .fare-table th { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fare-table td { border: 1px solid #ccc; }

  .map-container { box-shadow: none; page-break-inside: avoid; }

  .receipt {
    border: 1px solid #000;
    display: block !important;
    page-break-inside: avoid;
    max-width: 100%;
  }

  .section { padding: 0.5rem 0; }
  .info-grid { display: block; }
  .info-card { box-shadow: none; border: 1px solid #ccc; margin-bottom: 0.5rem; }

  a { color: black; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print ticket special */
@media print {
  .ticket-print {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    padding: 2rem;
  }

  .ticket-print .receipt {
    display: block !important;
    max-width: 400px;
    margin: 2rem auto;
    border: 2px solid #000;
    font-size: 12pt;
  }
}
