/* ═══════════════════════════════════════════════════════════
   Airport History Timeline — history.css
   ═══════════════════════════════════════════════════════════ */

/* ── iOS Safari fixes ──────────────────────────────────────── */
.history-page {
  /* Match atmosphere bg so iOS overscroll area isn't white */
  background: #0f1118;
  /* Prevent horizontal overflow from reveal animations */
  overflow-x: hidden;
}
/* Also paint html for iOS top/bottom rubber-band areas */
html:has(.history-page) {
  background: #0f1118;
}

/* ── Atmosphere (fixed star field) ─────────────────────────── */
.history-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* iOS Safari: fixed bg needs explicit height */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(1.2px 1.2px at 20% 30%, rgba(255,255,255,0.15) 50%, transparent 50%),
    radial-gradient(1px   1px   at 40% 70%, rgba(255,255,255,0.1)  50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 60% 20%, rgba(255,255,255,0.12) 50%, transparent 50%),
    radial-gradient(1px   1px   at 80% 60%, rgba(255,255,255,0.08) 50%, transparent 50%),
    radial-gradient(0.8px 0.8px at 10% 80%, rgba(255,255,255,0.1)  50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 70% 45%, rgba(255,255,255,0.07) 50%, transparent 50%),
    linear-gradient(180deg, #0f1118 0%, #1b1d23 40%, #12161e 100%);
  background-size:
    550px 550px,
    350px 350px,
    250px 250px,
    450px 450px,
    300px 300px,
    400px 400px,
    100% 100%;
  animation: starTwinkle 8s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0%   { opacity: 1; }
  100% { opacity: 0.85; }
}

/* ── Container ────────────────────────────────────────────── */
.history-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.history-breadcrumb {
  font-size: 13px;
  color: var(--dsc-text-muted, #9ca3af);
  margin-bottom: 28px;
}
.history-breadcrumb a {
  color: var(--dsc-text-muted, #9ca3af);
  text-decoration: none;
  transition: color 0.2s;
}
.history-breadcrumb a:hover { color: var(--dsc-primary, #00aeef); }
.history-breadcrumb .sep {
  margin: 0 6px;
  opacity: 0.4;
}

/* ── Hero ─────────────────────────────────────────────────── */
.history-hero {
  position: relative;
  text-align: center;
  padding: 48px 32px 40px;
  margin-bottom: 56px;
  background: rgba(18, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 174, 239, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-icao-badge {
  display: inline-block;
  background: rgba(0, 174, 239, 0.12);
  border: 1px solid rgba(0, 174, 239, 0.3);
  color: #00aeef;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.hero-title {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  color: var(--dsc-text, #e4e4e7);
  margin: 0 0 8px;
  line-height: 1.2;
}
.hero-subtitle {
  font-size: 15px;
  color: var(--dsc-text-muted, #9ca3af);
  margin: 0 0 12px;
  font-style: italic;
  letter-spacing: 0.04em;
}
.hero-year-range {
  font-size: 18px;
  font-weight: 600;
  color: rgba(0, 174, 239, 0.8);
  margin: 0;
  letter-spacing: 0.06em;
}

/* ── Share pills (inside hero) ───────────────────────────── */
.history-share {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.share-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1) !important;
  background: rgba(255,255,255,0.04) !important;
  color: var(--dsc-text-muted, #9ca3af);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}
.share-pill:hover {
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.2) !important;
  color: #fff;
}
.share-pill-x:hover { color: #fff; border-color: #1d9bf0 !important; background: rgba(29,155,240,0.15) !important; }
.share-pill-wa:hover { color: #25d366; border-color: #25d366 !important; background: rgba(37,211,102,0.12) !important; }
.share-pill-li:hover { color: #0a66c2; border-color: #0a66c2 !important; background: rgba(10,102,194,0.12) !important; }
.share-pill-copy:hover { color: #00aeef; border-color: #00aeef !important; background: rgba(0,174,239,0.12) !important; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding: 20px 0 40px;
}
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 174, 239, 0.5) 8%,
    rgba(0, 174, 239, 0.5) 92%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(0, 174, 239, 0.3);
}

/* ── Decade markers ──────────────────────────────────────── */
.decade-marker {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 40px 0 28px;
  z-index: 2;
}
.decade-node {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  border: 2px solid;
  background: rgba(18, 22, 32, 0.9);
  backdrop-filter: blur(8px);
  transition: transform 0.3s, box-shadow 0.3s;
}
.decade-node:hover {
  transform: scale(1.08);
}

/* Era colour themes */
.era-pioneer .decade-node {
  border-color: #d9aa4b;
  box-shadow: 0 0 16px rgba(217, 170, 75, 0.3), inset 0 0 12px rgba(217, 170, 75, 0.1);
}
.era-golden .decade-node {
  border-color: #6b8eb4;
  box-shadow: 0 0 16px rgba(107, 142, 180, 0.3), inset 0 0 12px rgba(107, 142, 180, 0.1);
}
.era-jet .decade-node {
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3), inset 0 0 12px rgba(56, 189, 248, 0.1);
}
.era-modern .decade-node {
  border-color: #00aeef;
  box-shadow: 0 0 16px rgba(0, 174, 239, 0.3), inset 0 0 12px rgba(0, 174, 239, 0.1);
}

/* ── Timeline items (fact cards) ─────────────────────────── */
.timeline-item {
  position: relative;
  display: flex;
  margin: 24px 0;
  z-index: 1;
}
.timeline-item.left {
  justify-content: flex-start;
  padding-right: calc(50% + 32px);
}
.timeline-item.right {
  justify-content: flex-end;
  padding-left: calc(50% + 32px);
}

/* Dot on the timeline line */
.timeline-dot {
  position: absolute;
  left: 50%;
  top: 24px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00aeef;
  border: 2px solid #1b1d23;
  transform: translateX(-50%);
  z-index: 3;
  box-shadow: 0 0 6px rgba(0, 174, 239, 0.4);
}

/* Connector line from dot to card */
.timeline-connector {
  position: absolute;
  top: 29px;
  height: 1px;
  background: rgba(0, 174, 239, 0.25);
  z-index: 1;
}
.timeline-item.left .timeline-connector {
  right: calc(50% + 6px);
  left: auto;
  width: 26px;
}
.timeline-item.right .timeline-connector {
  left: calc(50% + 6px);
  right: auto;
  width: 26px;
}

/* ── Fact card ───────────────────────────────────────────── */
.timeline-card {
  background: rgba(18, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 20px 22px;
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 100%;
}
.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-year {
  display: inline-block;
  background: rgba(0, 174, 239, 0.12);
  color: #00aeef;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.card-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--dsc-text, #e4e4e7);
  margin: 0 0 12px;
}
.card-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.card-source {
  font-size: 12px;
  color: var(--dsc-primary, #00aeef);
  text-decoration: none;
  transition: opacity 0.2s;
}
.card-source:hover { opacity: 0.7; }
.card-source i { margin-right: 3px; font-size: 10px; }
.card-contributor {
  font-size: 12px;
  color: var(--dsc-text-muted, #9ca3af);
}
.card-contributor i { margin-right: 3px; font-size: 10px; }

/* ── End marker (Present) ────────────────────────────────── */
.timeline-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
  position: relative;
  z-index: 2;
}
.end-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00aeef;
  box-shadow: 0 0 12px rgba(0, 174, 239, 0.5);
  animation: endPulse 2s ease-in-out infinite;
}
.end-label {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 174, 239, 0.7);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@keyframes endPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(0, 174, 239, 0.5); transform: scale(1); }
  50%      { box-shadow: 0 0 24px rgba(0, 174, 239, 0.7); transform: scale(1.15); }
}

/* ── Empty state ─────────────────────────────────────────── */
.history-empty {
  text-align: center;
  padding: 64px 32px;
  background: rgba(18, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  margin-bottom: 40px;
}
.history-empty i {
  font-size: 48px;
  color: rgba(0, 174, 239, 0.3);
  margin-bottom: 16px;
}
.history-empty h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--dsc-text, #e4e4e7);
  margin: 0 0 10px;
}
.history-empty p {
  font-size: 14px;
  color: var(--dsc-text-muted, #9ca3af);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Submission form ─────────────────────────────────────── */
.history-form-wrapper {
  background: rgba(18, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  margin: 40px 0;
  overflow: hidden;
}
.form-toggle {
  cursor: pointer;
  padding: 18px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--dsc-text, #e4e4e7);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.form-toggle::-webkit-details-marker { display: none; }
.form-toggle .toggle-chevron {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s;
  color: var(--dsc-text-muted, #9ca3af);
}
.history-form-wrapper[open] .toggle-chevron {
  transform: rotate(180deg);
}
.form-toggle i:first-child {
  color: var(--dsc-primary, #00aeef);
}

.history-form {
  padding: 8px 24px 28px;
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group-year { flex: 0 0 140px; }
.form-group-name { flex: 1; }

.history-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dsc-text, #e4e4e7);
  margin-bottom: 6px;
}
.history-form label .req { color: #ef4444; }
.history-form label small { color: var(--dsc-text-muted, #9ca3af); font-weight: 400; }

.history-form input[type="number"],
.history-form input[type="text"],
.history-form input[type="url"],
.history-form textarea {
  width: 100%;
  padding: 10px 14px;
  /* 16px prevents iOS Safari auto-zoom on focus */
  font-size: 16px;
  color: var(--dsc-text, #e4e4e7);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.history-form input:focus,
.history-form textarea:focus {
  border-color: var(--dsc-primary, #00aeef);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.12);
}
.history-form textarea { resize: vertical; min-height: 100px; }

.char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--dsc-text-muted, #9ca3af);
  margin-top: 4px;
}
.form-hint {
  display: block;
  font-size: 12px;
  color: var(--dsc-text-muted, #9ca3af);
  margin-top: 4px;
}

.history-form-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
}
.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--dsc-primary, #00aeef);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-submit:hover { background: #0098d1; }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.g-recaptcha {
  margin: 16px 0;
  display: flex;
  justify-content: center;
}

.form-feedback {
  margin-top: 14px;
  font-size: 14px;
  border-radius: 8px;
  padding: 0;
  transition: all 0.3s;
  text-align: center;
}
.form-feedback.success {
  color: #34d399;
  padding: 12px 16px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.form-feedback.error {
  color: #f87171;
  padding: 12px 16px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ── Back link ───────────────────────────────────────────── */
.history-back {
  text-align: center;
  padding: 16px 0;
}
.history-back a {
  color: var(--dsc-text-muted, #9ca3af);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.history-back a:hover { color: var(--dsc-primary, #00aeef); }
.history-back a i { margin-right: 6px; }

/* ── Scroll reveal animations ────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.timeline-item.left[data-reveal] {
  transform: translateY(24px) translateX(-30px);
}
.timeline-item.right[data-reveal] {
  transform: translateY(24px) translateX(30px);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0) translateX(0);
}

/* ── Mobile (<768px) ─────────────────────────────────────── */
@media (max-width: 767px) {
  .history-container {
    padding: 20px 16px 48px;
  }

  .history-hero {
    padding: 36px 20px 32px;
    margin-bottom: 36px;
  }

  /* Timeline collapses to single column (line on left) */
  .timeline-line {
    left: 20px;
    transform: none;
  }
  .decade-marker {
    justify-content: flex-start;
    padding-left: 0;
    margin: 28px 0 20px;
  }
  .decade-node {
    width: 56px;
    height: 56px;
    font-size: 13px;
    margin-left: -8px;
  }

  .timeline-item.left,
  .timeline-item.right {
    padding-left: 48px;
    padding-right: 0;
    justify-content: flex-start;
    max-width: 100%;
  }
  .timeline-card {
    max-width: calc(100vw - 80px);
    word-break: break-word;
  }
  .timeline-item.left[data-reveal],
  .timeline-item.right[data-reveal] {
    transform: translateY(20px);
  }
  .timeline-dot {
    left: 20px;
  }
  .timeline-item.left .timeline-connector,
  .timeline-item.right .timeline-connector {
    left: 26px;
    right: auto;
    width: 16px;
  }

  .timeline-end {
    align-items: flex-start;
    padding-left: 12px;
  }

  /* Form stacks */
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .form-group-year { flex: none; }
  .history-form {
    padding: 8px 16px 24px;
  }
  .form-toggle {
    padding: 16px;
  }
}
