/* ============================================================
   DISPATCH — shared design system
   Desktop-first; mobile overrides at @media (max-width: 767px)
   ============================================================ */

/* ===== Tokens ===== */
:root {
  --yellow: #FFCE00;
  --ink: #0E0E0E;
  --paper: #FBFAF5;
  --muted: #6B6258;
  --accent: #A0301A;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* Motion (mobile chrome) */
  --float-threshold: 60px;
  --drawer-duration: 280ms;
  --drawer-easing: cubic-bezier(0.2, 0.8, 0.2, 1);
  --float-duration: 240ms;
  --press-scale: 0.97;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

html, body {
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 48px;
}

a { color: inherit; }
button { font-family: inherit; }

/* ===== Page shell (desktop) ===== */
.frame {
  background: var(--paper);
  min-height: calc(100vh - 96px);
  position: relative;
}

/* ===== Masthead (desktop) ===== */
.masthead {
  border-bottom: 1.5px solid var(--ink);
  padding: 22px 48px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
}

.masthead-brand .wordmark {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

.masthead-brand .wordmark em {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

.masthead-brand .tagline {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Desktop nav */
.masthead-nav {
  display: flex;
  gap: 2px;
  align-items: flex-end;
}

.masthead-nav a {
  background: transparent;
  color: var(--ink);
  padding: 10px 14px 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.25s, color 0.25s;
  display: block;
}

.masthead-nav a:hover,
.masthead-nav a.active {
  background: var(--ink);
  color: var(--yellow);
}

.masthead-nav a .nav-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  opacity: 0.6;
  display: block;
}

.masthead-nav a .nav-label {
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
  display: block;
}

/* Mobile burger — hidden on desktop */
.burger-cell { display: none; }

/* Float bar / drawer — hidden on desktop (built by JS) */
.float-bar { display: none !important; }
.drawer { display: none !important; }
.drawer-backdrop { display: none !important; }

/* ===== Issue banner (desktop) ===== */
.issue-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}

/* ===== Kicker (desktop) ===== */
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker::before {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

.kicker.accent {
  color: var(--accent);
}

/* ===== Pill buttons ===== */
.pill-btn {
  display: inline-block;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: filter 0.2s;
}

.pill-btn:hover {
  filter: brightness(0.95);
}

.pill-btn-dark {
  background: var(--ink);
  color: var(--yellow);
}

.pill-btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.stats-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ===== Footer / colophon (desktop) ===== */
.colophon {
  border-top: 1.5px solid var(--ink);
  margin-top: 40px;
  padding: 22px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.colophon a {
  color: var(--ink);
  text-decoration: none;
}

.colophon a:hover {
  text-decoration: underline;
}

.colophon-links {
  display: flex;
  gap: 20px;
}

/* Mobile-only footer elements — hidden on desktop */
.colophon-divider { display: none; }
.colophon-sig { display: none; }
.colophon-version { display: none; }

/* ===== Tap highlights ===== */
button, a { -webkit-tap-highlight-color: transparent; }


/* ============================================================
   MOBILE OVERRIDES — max-width: 767px
   ============================================================ */
@media (max-width: 767px) {

  /* ── Shell ── */
  html, body {
    background: var(--paper);
    font-size: 14px;
    line-height: 1.55;
    overscroll-behavior-y: none;
  }

  html { scroll-behavior: smooth; }

  body {
    padding: 0;
    min-height: 100vh;
    position: relative;
  }

  .frame {
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    animation: page-in 320ms ease both;
  }

  @keyframes page-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }

  img { display: block; max-width: 100%; }

  /* ── Masthead (mobile: 2-cell grid) ── */
  .masthead {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 56px;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    position: relative;
    z-index: 50;
  }

  .masthead-brand {
    padding: 16px 16px 12px;
    border-right: 1.5px solid var(--ink);
  }

  .masthead-brand .wordmark {
    font-size: 28px;
    letter-spacing: -0.025em;
  }

  .masthead-brand .tagline {
    font-size: 8.5px;
  }

  /* Hide desktop nav on mobile */
  .masthead-nav { display: none; }

  /* Show burger on mobile */
  .burger-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 100%;
    background: var(--yellow);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background var(--drawer-duration) var(--drawer-easing);
  }

  .burger-cell.active {
    background: var(--ink);
  }

  .burger-icon {
    width: 22px;
    height: 14px;
    position: relative;
    display: block;
  }

  .burger-icon::before,
  .burger-icon::after,
  .burger-icon span {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: var(--ink);
    transition: transform var(--drawer-duration) var(--drawer-easing),
                opacity calc(var(--drawer-duration) * 0.6) ease;
  }

  .burger-icon::before { top: 0; }
  .burger-icon span    { top: 50%; transform: translateY(-50%); }
  .burger-icon::after  { bottom: 0; }

  .burger-cell.active .burger-icon::before,
  .burger-cell.active .burger-icon::after,
  .burger-cell.active .burger-icon span {
    background: var(--yellow);
  }

  .burger-cell.active .burger-icon::before {
    transform: translateY(6px) rotate(45deg);
  }
  .burger-cell.active .burger-icon::after {
    transform: translateY(-6px) rotate(-45deg);
  }
  .burger-cell.active .burger-icon span {
    opacity: 0;
  }

  /* ── Floating top bar ── */
  .float-bar {
    display: grid !important;
    grid-template-columns: 1fr 56px;
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--paper);
    border-bottom: 1.5px solid var(--ink);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--float-duration) var(--drawer-easing),
                opacity var(--float-duration) ease;
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  }

  .float-bar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .float-bar-brand {
    padding: 12px 16px;
    border-right: 1.5px solid var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .float-bar-brand .wordmark {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--ink);
  }

  .float-bar-brand .wordmark em {
    color: var(--muted);
    font-style: italic;
    font-weight: 400;
  }

  .float-bar-brand .crumb {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .float-bar-brand .crumb::before {
    content: '·';
    margin-right: 8px;
    opacity: 0.6;
  }

  /* ── Drawer ── */
  .drawer-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(14,14,14,0);
    z-index: 90;
    pointer-events: none;
    transition: background var(--drawer-duration) ease;
  }

  .drawer-backdrop.open {
    background: rgba(14,14,14,0.25);
    pointer-events: auto;
  }

  .drawer {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 95;
    background: var(--paper);
    border-bottom: 1.5px solid var(--ink);
    transform: translateY(-100%);
    transition: transform var(--drawer-duration) var(--drawer-easing);
    padding-top: 0;
  }

  .drawer.open {
    transform: translateY(0);
  }

  .drawer-inner {
    padding: 8px 0 12px;
  }

  .drawer a {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    align-items: center;
    padding: 16px 18px;
    border-top: 1px solid rgba(0,0,0,0.12);
    text-decoration: none;
    transition: background var(--drawer-duration) ease, color var(--drawer-duration) ease;
  }

  .drawer a:first-child { border-top: none; }

  .drawer a:active,
  .drawer a.active {
    background: var(--ink);
    color: var(--yellow);
  }

  .drawer .nav-sub {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.6;
  }

  .drawer .nav-label {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }

  .drawer .nav-arrow {
    font-family: var(--mono);
    font-size: 14px;
    opacity: 0.5;
  }

  /* ── Issue banner (mobile) ── */
  .issue-banner {
    font-size: 8.5px;
    letter-spacing: 0.18em;
    padding: 14px 0 12px;
    padding-bottom: 12px;
    gap: 8px;
  }

  .issue-banner span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .issue-banner span:nth-child(2) { flex: 1; text-align: center; }
  .issue-banner span:nth-child(3) { text-align: right; }

  /* ── Kicker (mobile) ── */
  .kicker {
    font-size: 9.5px;
    gap: 10px;
  }

  .kicker::before {
    width: 18px;
  }

  /* ── Pill buttons (mobile) ── */
  .pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    font-size: 10px;
    border-radius: 0;
    transition: transform 120ms ease, filter 200ms ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .pill-btn:active {
    transform: scale(var(--press-scale));
    filter: brightness(0.92);
  }

  .pill-btn:hover {
    filter: none;
  }

  .stats-meta {
    font-size: 9px;
  }

  /* ── Footer / colophon (mobile) ── */
  .colophon {
    margin-top: 32px;
    padding: 22px 16px 28px;
    flex-direction: column;
    gap: 14px;
    font-size: 9px;
    letter-spacing: 0.14em;
    text-align: center;
    justify-content: center;
  }

  .colophon-divider {
    display: block;
    width: 32px;
    height: 1px;
    border-top: 1px dotted var(--muted);
    margin: 4px auto;
  }

  .colophon-links {
    justify-content: center;
    gap: 18px;
  }

  .colophon-sig {
    display: block;
    color: var(--ink);
  }

}
