:root {
  --bg: #e8eef2;
  --bg-deep: #d5e0e8;
  --panel: #f7fafc;
  --ink: #15202b;
  --muted: #5a6b7a;
  --line: #c3d0da;
  --accent: #0b6e4f;
  --accent-soft: #d8f0e7;
  --warn: #8a4b08;
  --shadow: 0 10px 30px rgba(21, 32, 43, 0.08);
  --font-display: "Segoe UI", "Helvetica Neue", sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  line-height: 1.4;
  background-color: #1a2430;
  background-image:
    linear-gradient(
      180deg,
      rgba(12, 22, 32, 0.55) 0%,
      rgba(12, 22, 32, 0.35) 35%,
      rgba(12, 22, 32, 0.62) 100%
    ),
    url("assets/apron.jpg");
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.site-footer {
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #d7e3ec;
  font-size: 0.78rem;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.home-shell {
  min-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

.home-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem 3rem;
}

.home-hero .airport {
  margin: 0 0 0.75rem;
  color: #d7e3ec;
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.home-hero h1 {
  margin: 0;
  max-width: 18ch;
  color: #f4f8fb;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  position: relative;
  z-index: 1;
}

.site-nav {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.nav-left {
  position: relative;
}

.menu-toggle,
.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(15, 24, 34, 0.55);
  color: #f4f8fb;
  cursor: pointer;
}

.menu-toggle {
  flex-direction: row;
  gap: 0.55rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.75rem 0.45rem 0.55rem;
}

.menu-bars {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 1.15rem;
}

.menu-label {
  font: inherit;
  font-weight: 700;
  color: #f4f8fb;
  letter-spacing: 0.02em;
}

.refresh-btn {
  min-height: 2.6rem;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-weight: 700;
}

.menu-toggle:hover,
.menu-toggle:focus-visible,
.refresh-btn:hover,
.refresh-btn:focus-visible {
  background: rgba(15, 24, 34, 0.75);
  outline: none;
}

.refresh-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.menu-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 1px;
  background: #f4f8fb;
}

.site-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 12rem;
  padding: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(247, 250, 252, 0.96);
  box-shadow: 0 12px 28px rgba(8, 14, 20, 0.28);
}

.site-menu[hidden],
.menu-submenu[hidden] {
  display: none;
}

.menu-link,
.menu-group-toggle {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-link {
  display: block;
}

.menu-link:hover,
.menu-link:focus-visible,
.menu-group-toggle:hover,
.menu-group-toggle:focus-visible {
  background: #e8eef2;
  outline: none;
}

.menu-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.menu-group-toggle::after {
  content: "\203A"; /* › */
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.menu-group-toggle[aria-expanded="true"]::after {
  content: "\25BE"; /* ▾ */
}

.menu-submenu {
  margin: 0.15rem 0 0.25rem 0.55rem;
  padding-left: 0.35rem;
  border-left: 2px solid var(--line);
}

.menu-submenu .menu-link {
  font-weight: 500;
  font-size: 0.95rem;
}

.menu-visual.hidden,
.menu-visual-30m.hidden {
  display: none;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1.25rem;
}

.airport {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: #9fe3c7;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.brand h1 {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f4f8fb;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.week-label {
  font-size: 0.85rem;
  color: #d7e3ec;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

#week-select {
  min-width: 11rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.updated {
  margin: 0;
  width: 100%;
  font-size: 0.8rem;
  color: #d7e3ec;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.periods-panel,
.flights-panel {
  background: rgba(247, 250, 252, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(8, 14, 20, 0.28);
  backdrop-filter: blur(4px);
  min-height: 20rem;
  overflow: hidden;
}

.panel-head {
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.hint {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.legend li {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

.legend-key {
  display: inline-block;
  min-width: 2.4rem;
  margin-right: 0.25rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: #e8eef2;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
}

.period-list,
.flight-list {
  max-height: min(70vh, 760px);
  overflow: auto;
}

.period-row {
  display: grid;
  grid-template-columns: 6.25rem 1fr 5.75rem;
  gap: 0.55rem 0.75rem;
  align-items: start;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.period-row:hover,
.period-row:focus-visible {
  background: #eef5f8;
  outline: none;
}

.period-row.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.period-when {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: nowrap;
}

.period-date,
.period-time {
  display: block;
}

.period-meta {
  min-width: 0;
}

.period-mode {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-counts {
  display: grid;
  gap: 0.2rem;
  min-width: 5.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.period-count-num {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
}

.flight-row {
  display: grid;
  grid-template-columns: 4.5rem 5.5rem 1fr;
  gap: 0.4rem 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.flight-time {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.flight-id {
  font-weight: 700;
  font-size: 0.92rem;
}

.flight-carrier {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.flight-detail {
  min-width: 0;
}

.flight-type,
.flight-owner,
.flight-rwy {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flight-rwy {
  color: var(--warn);
  font-family: var(--font-mono);
}

.empty {
  margin: 0;
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

.error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2b6b6;
  border-radius: 8px;
  background: #fff5f5;
  color: #7a1f1f;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .period-list,
  .flight-list {
    max-height: 50vh;
  }

  .flight-row {
    grid-template-columns: 4.2rem 1fr;
  }

  .flight-detail {
    grid-column: 1 / -1;
  }
}
