/* =============================================
   QMAK — Main stylesheet
   Light mode default, dark mode via html.dark
   ============================================= */

/* Light mode (default) */
:root {
  --color-bg: #edeae2;
  --color-surface: #f8f7f3;
  --color-surface-2: #d8d4cc;
  --color-border: #b8b4aa;
  --color-accent: #c8a020;
  --color-text: #1a1917;
  --color-text-muted: #56534e;
  --color-text-dim: #9e9b94;
  --color-canvas-bg: #ccc8be;

  --font-display: 'Raleway', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 28px;
  --space-xl: 48px;

  --grid-max: 560px;
  --grid-gap: 3px;
  --grid-cols: 3;
  --tile-radius: 14px;

  --bp-radius: 6px;
  --bp-shadow: 0 2px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.07);
}

/* Dark mode */
html.dark {
  --color-bg: #0a0a0a;
  --color-surface: #111111;
  --color-surface-2: #161616;
  --color-border: #2a2a2a;
  --color-accent: #E8C84A;
  --color-text: #ffffff;
  --color-text-muted: #8a8a8a;
  --color-text-dim: #444444;
  --color-canvas-bg: #0a0a0a;
  --bp-shadow: 0 2px 16px rgba(0,0,0,0.45), 0 1px 4px rgba(0,0,0,0.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--color-bg);
  background-image: radial-gradient(ellipse at 50% 0%, var(--color-surface-2) 0%, var(--color-bg) 60%);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 200ms ease, color 200ms ease;
}
img { max-width: 100%; height: auto; }
canvas { display: block; touch-action: none; }
a { color: var(--color-accent); -webkit-tap-highlight-color: transparent; }
input, button { font-size: 16px; font-family: var(--font-mono); }

/* ─── Theme toggle ─────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  line-height: 1;
  transition: border-color 150ms ease, color 150ms ease;
}
.theme-toggle:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ─── Layout shell ─────────────────────────── */
.page {
  max-width: 660px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}
@media (min-width: 600px) {
  .page { padding-left: var(--space-lg); padding-right: var(--space-lg); }
}

/* ─── Header ───────────────────────────────── */
.site-header {
  text-align: center;
  padding: var(--space-lg) 0 var(--space-md);
}
.site-tag {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-sm);
}
.site-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -1px;
  font-size: clamp(40px, 11vw, 88px);
  margin: 0;
  line-height: 1;
  color: var(--color-text);
}
.site-subtitle {
  color: var(--color-text-muted);
  font-size: 15px;
  font-weight: 500;
  margin: var(--space-sm) 0 0;
}

/* ─── Grid + Info panel wrapper ────────────── */
/* Stack on mobile/tablet, side-by-side on wide desktop */
.grid-and-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

@media (min-width: 1000px) {
  .grid-and-panel {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: var(--space-xl);
    max-width: 960px;
    margin: 0 auto;
  }
  .grid-side {
    flex: 0 0 auto;
  }
}

/* ─── Folder toggle (top of grid) ──────────── */
.folder-row {
  text-align: center;
  margin-bottom: var(--space-sm);
}
.folder-toggle {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 11px;
  padding: 11px 20px;
  min-height: 48px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.folder-toggle:hover,
.folder-toggle.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-surface);
}

/* ─── Grid area (canvas + desktop side arrows) */
.grid-area {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  max-width: calc(var(--grid-max) + 64px * 2 + var(--space-sm) * 2);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}
.grid-center {
  flex: 1;
  min-width: 0;
}

/* ─── Grid wrapper (canvas container) ──────── */
.grid-wrapper {
  position: relative;
  width: 100%;
}
#qmak-canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  background: var(--color-canvas-bg);
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

/* ─── Grid arrows ───────────────────────────── */
.grid-arrow {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  font-size: 22px;
  cursor: pointer;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.grid-arrow:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-surface-2);
}

/* Desktop: arrows flank canvas sides */
.grid-arrow--side { display: inline-flex; }
/* Mobile: arrows go into the controls row */
.grid-arrow--mob  { display: none; }

@media (max-width: 599px) {
  .grid-arrow--side { display: none; }
  .grid-arrow--mob  { display: inline-flex; width: 52px; height: 52px; }
  .grid-area { padding: 0 var(--space-sm); }
}

/* ─── Dot pagination + mobile arrow row ─────── */
.grid-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-sm) auto 0;
  max-width: calc(var(--grid-max) + 64px * 2 + var(--space-sm) * 2);
  padding: 0 var(--space-sm);
}
.grid-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex: 1;
}
.grid-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-text-dim);
  transition: background 200ms ease;
}
.grid-dot.active { background: var(--color-accent); }

/* ─── Swipe hint (mobile only) ─────────────── */
.swipe-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
  margin: var(--space-sm) 0 0;
}
@media (min-width: 600px) { .swipe-hint { display: none; } }

/* ─── Info panel ───────────────────────────── */
.info-panel {
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  padding: 24px;
  /* mobile/tablet: inline below grid, fades in */
  position: relative;
  max-width: var(--grid-max);
  width: 100%;
  margin: var(--space-md) auto 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.info-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Empty state placeholder (shown when no tile selected) */
.ip-placeholder {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-dim);
  text-align: center;
  padding: var(--space-xl) 0;
  margin: 0;
  display: none; /* hidden on mobile (panel is hidden anyway) */
}

/* Desktop side panel — always visible, placeholder shown until tile tapped */
@media (min-width: 1000px) {
  .info-panel {
    position: static;
    flex: 0 0 260px;
    max-width: 260px;
    margin: var(--space-lg) 0 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    border-left: 3px solid var(--color-accent);
  }
  .info-panel:not(.open) .ip-name,
  .info-panel:not(.open) .ip-desc,
  .info-panel:not(.open) .ip-tags,
  .info-panel:not(.open) .ip-cta,
  .info-panel:not(.open) .ip-links,
  .info-panel:not(.open) .ip-close { display: none; }
  .info-panel:not(.open) .ip-placeholder { display: block; }
  .info-panel.open .ip-close { display: none; } /* no close on desktop */
}

.info-panel .ip-name {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 var(--space-sm);
  letter-spacing: -0.5px;
  color: var(--color-text);
}
.info-panel .ip-desc {
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}
.info-panel .ip-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-md);
}
.info-panel .ip-tag {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 4px 8px;
}
.info-panel .ip-cta {
  display: block;
  width: 100%;
  height: 52px;
  line-height: 52px;
  text-align: center;
  background: var(--color-accent);
  color: #000;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 11px;
  text-decoration: none;
}
.info-panel .ip-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 44px; height: 44px;
  background: transparent; border: none; color: var(--color-text-muted);
  font-size: 20px; cursor: pointer;
}
.info-panel .ip-links {
  display: grid; gap: 6px; margin-top: var(--space-md);
}
.info-panel .ip-links a {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--color-text);
  border: 1px solid var(--color-border); padding: 12px;
  text-decoration: none; text-align: center;
}
.info-panel .ip-links a:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Mobile: bottom sheet */
@media (max-width: 599px) {
  .info-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    max-width: 100%;
    min-height: 40vh;
    max-height: 72vh;
    overflow-y: auto;
    transform: translateY(100%);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 100;
    border-left: none;
    border-top: 3px solid var(--color-accent);
    border-radius: 12px 12px 0 0;
  }
  .info-panel.open { transform: translateY(0); opacity: 1; }
}

/* ─── Content pages ────────────────────────── */
.content-page {
  padding-top: 52px; /* clear the fixed theme toggle button */
}
.content-page h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.5px;
  font-size: clamp(26px, 6vw, 44px);
  margin: var(--space-lg) 0 var(--space-md);
  line-height: 1.15;
  color: var(--color-text);
}
.content-page h2 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 11px;
  color: var(--color-accent);
  margin: var(--space-xl) 0 var(--space-sm);
}
.route-codes {
  font-family: var(--font-mono);
  letter-spacing: 4px;
  color: var(--color-accent);
  font-size: clamp(12px, 3vw, 18px);
  text-transform: uppercase;
}
.intro-p {
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.7;
}
.facts-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}
.facts-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.facts-table td:first-child {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  width: 45%;
}
.btn-block {
  display: block;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 16px;
  min-height: 52px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 11px;
  margin-bottom: var(--space-sm);
  text-align: center;
}
.btn-block.primary {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
}

/* ─── Ad slot ──────────────────────────────── */
.ad-slot {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
  margin: var(--space-lg) 0;
}

/* ─── FAQ ──────────────────────────────────── */
.faq details {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
}
.faq summary {
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--color-text);
}
.faq p { color: var(--color-text-muted); margin-top: var(--space-sm); }

/* ─── Related links ────────────────────────── */
.related {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
@media (min-width: 600px) {
  .related { grid-template-columns: 1fr 1fr; }
}
.related a {
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.related a:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ─── Footer ───────────────────────────────── */
.site-footer {
  text-align: center;
  margin-top: var(--space-xl);
  padding: var(--space-lg) 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 9px;
  color: var(--color-text-dim);
  border-top: 1px solid var(--color-border);
}
.site-footer a { color: var(--color-text-muted); text-decoration: none; }

/* ─── Back link ────────────────────────────── */
.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}
.back-link:hover { color: var(--color-accent); }

/* ─── Boarding pass card ─────────────────────────────── */
.bp-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  margin: var(--space-lg) 0;
  overflow: hidden;
  position: relative;
}

.bp-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}

.bp-logo-wrap {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.bp-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.bp-header-text { flex: 1; min-width: 0; }

.bp-airline-type {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 4px;
}

.bp-airline-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 5.5vw, 36px);
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--color-text);
  margin: 0 0 var(--space-xs);
}

.bp-selling-point {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Perforated divider — horizontal */
.bp-perf--h {
  width: 100%;
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    var(--color-border) 0px, var(--color-border) 6px,
    transparent 6px, transparent 12px
  );
  position: relative;
}
.bp-perf--h::before,
.bp-perf--h::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.bp-perf--h::before { left: -7px; }
.bp-perf--h::after  { right: -7px; }

/* Perforated divider — vertical (desktop only) */
.bp-perf--v {
  display: none;
  width: 1px;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--color-border) 0px, var(--color-border) 6px,
    transparent 6px, transparent 12px
  );
  position: relative;
  flex-shrink: 0;
}
.bp-perf--v::before,
.bp-perf--v::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.bp-perf--v::before { top: -7px; }
.bp-perf--v::after  { bottom: -7px; }

/* Body: facts + actions */
.bp-body { display: flex; flex-direction: column; }
.bp-facts { padding: var(--space-md) var(--space-lg); }
.bp-facts .facts-table tr:last-child td { border-bottom: none; }
.bp-actions {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
}

/* Desktop: side-by-side */
@media (min-width: 520px) {
  .bp-body { flex-direction: row; align-items: stretch; }
  .bp-perf--v { display: block; align-self: stretch; margin: var(--space-md) 0; }
  .bp-facts { flex: 1 1 55%; }
  .bp-actions {
    flex: 0 0 45%;
    padding: var(--space-md);
    justify-content: flex-start;
  }
  .bp-actions .btn-block {
    padding: 12px 14px;
    font-size: 10px;
    letter-spacing: 2px;
  }
}

/* ─── Destination tags ──────────────────────────────── */
.dest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-sm);
}
.dest-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 5px 10px;
  line-height: 1;
}

/* ─── Section groups ────────────────────────────────── */
.section-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--bp-radius);
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-lg);
}
.section-group h2 { margin-top: var(--space-md); }
.section-group h2:first-child { margin-top: 0; }
.section-group--tip { border-left: 3px solid var(--color-accent); }

/* ─── Airline list grid ─────────────────────────────── */
.airline-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
@media (min-width: 440px) {
  .airline-list { grid-template-columns: 1fr 1fr; }
}
.airline-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 12px 14px;
  transition: border-color 150ms ease;
}
.airline-card:hover { border-color: var(--color-accent); }
.airline-card__logo-wrap {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.airline-card__logo { width: 30px; height: 30px; object-fit: contain; }
.airline-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.airline-card__name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}
.airline-card__type {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
