:root {
  color-scheme: light;
  --bg: #f5f4f1;
  --surface: #fffefa;
  --surface-strong: #eeece6;
  --text: #181816;
  --muted: #6f6a62;
  --line: #dbd7cf;
  --line-strong: #bbb5aa;
  --blue: #4f4b43;
  --blue-strong: #26231f;
  --blue-soft: #e7e3db;
  --cyan: #7c725f;
  --pin: #2f2d29;
  --pin-active: #86785f;
  --shadow: 0 20px 60px rgba(38, 35, 31, 0.13);
  --portfolio-shadow: 0 28px 90px rgba(24, 24, 22, 0.22);
  --glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 90%, transparent);
  --image-overlay: linear-gradient(180deg, rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0.78) 100%);
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11100f;
  --surface: #1a1816;
  --surface-strong: #24211e;
  --text: #f3f0ea;
  --muted: #aaa39a;
  --line: #37322d;
  --line-strong: #514a42;
  --blue: #c7c0b4;
  --blue-strong: #efe9dd;
  --blue-soft: #2f2b27;
  --cyan: #b6aa95;
  --pin: #ded6c8;
  --pin-active: #b39d75;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --portfolio-shadow: 0 34px 100px rgba(0, 0, 0, 0.52);
  --glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 84%, transparent);
  --image-overlay: linear-gradient(180deg, rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0.84) 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11100f;
    --surface: #1a1816;
    --surface-strong: #24211e;
    --text: #f3f0ea;
    --muted: #aaa39a;
    --line: #37322d;
    --line-strong: #514a42;
    --blue: #c7c0b4;
    --blue-strong: #efe9dd;
    --blue-soft: #2f2b27;
    --cyan: #b6aa95;
    --pin: #ded6c8;
    --pin-active: #b39d75;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --portfolio-shadow: 0 34px 100px rgba(0, 0, 0, 0.52);
    --glass: color-mix(in srgb, var(--surface) 72%, transparent);
    --glass-strong: color-mix(in srgb, var(--surface) 84%, transparent);
    --image-overlay: linear-gradient(180deg, rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0.84) 100%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  letter-spacing: 0;
  animation: page-in 420ms ease-out both;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 8px 12px;
  transform: translateY(-140%);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.brand:hover {
  opacity: 0.86;
  transform: translateY(-1px);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title,
.brand-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
}

.tab-nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.nav-select {
  display: none;
  min-width: 0;
  min-height: 38px;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.tab-button,
.theme-toggle,
.plain-button,
.icon-button,
.segment-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.tab-button {
  padding: 8px 14px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  text-overflow: ellipsis;
}

.tab-button.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.theme-toggle,
.plain-button {
  padding: 8px 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.theme-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  place-items: center;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-toggle:hover,
.plain-button:hover,
.icon-button:hover,
.segment-button:hover,
.tab-button:hover {
  border-color: var(--line-strong);
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 34px) 34px;
}

.view[hidden] {
  display: none;
}

.workspace {
  display: grid;
  gap: 20px;
  align-items: start;
}

.map-workspace,
.dex-workspace {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.dex-column {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.stats-page {
  display: grid;
  gap: 20px;
}

.squadrons-page {
  display: grid;
  gap: 20px;
}

.stats-hero {
  display: grid;
  gap: 16px;
}

.stats-hero .lead {
  max-width: 760px;
  margin-bottom: 0;
}

.dex-count {
  margin: 14px 0 0;
}

.control-panel,
.map-stage,
.recent-photos-panel,
.results-panel,
.dex-browser {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.control-panel {
  position: sticky;
  top: 92px;
  padding: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.heading-with-icon {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.heading-with-icon span {
  min-width: 0;
}

.heading-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  color: var(--blue);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.lead,
.muted,
.viewer-caption {
  color: var(--muted);
}

.lead {
  margin-bottom: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.stat-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.stat-value,
.stat-label {
  display: block;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.field-label {
  display: block;
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface-strong);
  color: var(--text);
}

.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 20%, transparent);
}

.panel-heading,
.browser-heading,
.group-header,
.result-header,
.entry-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.panel-heading {
  margin: 18px 0 10px;
}

.location-list {
  display: grid;
  max-height: 330px;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.location-row,
.aircraft-card,
.photo-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.location-row strong,
.aircraft-card strong,
.photo-card strong {
  display: block;
}

.location-row span,
.aircraft-card span,
.photo-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.location-row.is-active,
.aircraft-card.is-active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 10px 24px rgba(38, 35, 31, 0.08);
}

.count-pill {
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.map-column {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.map-column,
.map-stage {
  z-index: 0;
}

.map-panel-toggle {
  display: none;
}

.map-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: var(--surface-strong);
}

.map-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
}

.map-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.icon-button {
  display: grid;
  min-width: 38px;
  padding: 0 10px;
  place-items: center;
  border-color: var(--line);
  background: var(--surface);
  font-weight: 800;
}

.icon-button.wide {
  min-width: 58px;
}

.world-map {
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.map-fallback {
  position: absolute;
  inset: auto 16px 16px;
  z-index: 2;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.leaflet-container {
  background: var(--surface-strong);
  color: var(--text);
  font-family: var(--font);
}

.leaflet-tile {
  transition: filter 180ms ease;
}

:root[data-theme="dark"] #mapView .map-stage {
  background: #080806;
}

:root[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.62) invert(1) contrast(0.9) hue-rotate(180deg) saturate(0.75);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #mapView .map-stage {
    background: #080806;
  }

  :root:not([data-theme="light"]) .leaflet-tile {
    filter: brightness(0.62) invert(1) contrast(0.9) hue-rotate(180deg) saturate(0.75);
  }
}

.leaflet-control-attribution,
.leaflet-control-zoom a {
  color: #34312c !important;
}

.leaflet-control-zoom a {
  background: #f5f4f1 !important;
  border-bottom-color: #d5d0c7 !important;
  font-weight: 900;
}

.leaflet-control-zoom a:hover {
  background: #ebe8e1 !important;
}

.spotterdex-marker-shell {
  display: flex !important;
  width: min(340px, 48vw) !important;
  height: auto !important;
  align-items: center;
  gap: 8px;
  border: 0 !important;
  background: transparent !important;
}

.spotterdex-marker-dot {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--pin);
  box-shadow: 0 10px 28px rgba(38, 35, 31, 0.26);
  color: var(--surface);
  font-size: 0.86rem;
  font-weight: 900;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.spotterdex-marker-dot::after {
  position: absolute;
  inset: -6px;
  border: 1px solid color-mix(in srgb, var(--pin) 34%, transparent);
  border-radius: inherit;
  content: "";
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 180ms ease, transform 180ms ease;
}

.spotterdex-marker-label {
  display: grid;
  width: max-content;
  max-width: min(292px, calc(48vw - 44px));
  min-width: 0;
  gap: 4px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
  border-radius: var(--radius);
  background: var(--glass-strong);
  box-shadow: 0 10px 28px rgba(24, 24, 22, 0.16);
  color: var(--text);
  line-height: 1;
  backdrop-filter: blur(14px) saturate(1.05);
}

.spotterdex-marker-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-logo-row,
.map-family-row {
  display: inline-flex;
  height: 1em;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.map-logo-row img {
  width: 1em;
  height: 1em;
  padding: 1px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  object-fit: contain;
}

.map-family-icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.spotterdex-marker-shell.is-active .spotterdex-marker-dot {
  background: var(--pin-active);
  color: #ffffff;
  transform: scale(1.12);
}

.spotterdex-marker-shell.is-active .spotterdex-marker-dot::after {
  opacity: 1;
  transform: scale(1);
}

.spotterdex-marker-shell.is-active .spotterdex-marker-label {
  border-color: var(--pin-active);
  box-shadow: 0 16px 42px rgba(38, 35, 31, 0.26);
}

.spotterdex-cluster-shell .spotterdex-marker-dot {
  width: 36px;
  height: 36px;
  background: var(--blue-strong);
}

.spotterdex-cluster-shell {
  width: min(380px, 54vw) !important;
}

.spotterdex-cluster-shell .spotterdex-marker-label {
  max-width: min(326px, calc(54vw - 50px));
}

.spotterdex-marker-shell:hover .spotterdex-marker-dot {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(38, 35, 31, 0.32);
}

.cluster-count,
.cluster-flags {
  display: block;
  line-height: 1;
}

.cluster-count {
  font-size: 0.78rem;
}

.cluster-flags {
  margin-top: 1px;
  font-size: 0.55rem;
}

.recent-photos-panel,
.results-panel,
.dex-browser {
  padding: 18px;
}

.recent-photos-panel {
  min-width: 0;
  overflow: hidden;
  padding-bottom: 12px;
}

.recent-photos-panel .browser-heading {
  margin-bottom: 10px;
}

.sidebar-recent-photos {
  margin-top: 18px;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-recent-photos .browser-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.recent-photo-strip {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-auto-columns: clamp(132px, 16vw, 170px);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  padding-bottom: 8px;
  scroll-snap-type: inline proximity;
}

.recent-photo-card {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 3 / 2;
  max-height: none;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  scroll-snap-align: start;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.recent-photo-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(38, 35, 31, 0.1);
}

.recent-photo-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  background: transparent;
  transition: transform 520ms ease;
}

.recent-photo-card span {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 34px 10px 10px;
  background: var(--image-overlay);
  color: #ffffff;
}

.recent-photo-card strong,
.recent-photo-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-photo-card small {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
}

.recent-photo-card:hover img {
  transform: scale(1.025);
}

.result-header {
  margin-bottom: 14px;
}

.location-detail-page {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.location-hero {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(170px, 24svh, 260px);
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.location-hero.is-empty {
  display: grid;
  min-height: 0;
  place-items: center;
  cursor: default;
}

.location-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform 620ms ease, filter 620ms ease;
}

.location-hero:hover img {
  transform: scale(1.025);
}

.location-hero-overlay {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 5px;
  padding: clamp(48px, 12vw, 92px) 18px 18px;
  background: var(--image-overlay);
  color: #ffffff;
}

.location-hero-overlay strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1.5rem, 4vw, 2.55rem);
  line-height: 1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.62);
}

.location-hero-overlay span:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 800;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.58);
}

.location-detail-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.location-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
}

.location-detail-block {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.compact-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.compact-heading h3 {
  margin: 0;
}

.location-family-list,
.location-unit-list,
.location-recent-grid {
  gap: 8px;
}

.location-family-list,
.location-unit-list {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.location-family-list {
  flex-wrap: nowrap;
}

.location-family-chip,
.location-unit-chip {
  display: flex;
  min-width: 0;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.location-family-chip {
  flex: 0 0 auto;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.location-family-chip img {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  object-fit: cover;
}

.location-unit-list {
  flex-wrap: nowrap;
}

.location-unit-chip {
  flex: 0 0 auto;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 6px;
  color: inherit;
}

button.location-unit-chip {
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

button.location-unit-chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(38, 35, 31, 0.12);
}

button.location-unit-chip:focus-visible,
.squadron-logo-link:focus-visible,
.viewer-squadron-logo-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.location-unit-chip img,
.location-unit-fallback {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: calc(var(--radius) - 2px);
}

.location-unit-chip img {
  object-fit: contain;
}

.location-unit-fallback {
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-size: 0.76rem;
  font-weight: 900;
}

.location-recent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.location-recent-card {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: #ffffff;
  cursor: pointer;
  text-align: left;
}

.location-recent-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform 420ms ease;
}

.location-recent-card:hover img {
  transform: scale(1.035);
}

.location-recent-card > span {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 2px;
  padding: 30px 10px 10px;
  background: var(--image-overlay);
}

.location-recent-card strong,
.location-recent-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.location-recent-card small {
  opacity: 0.78;
}

.location-photo-browser {
  padding-top: 4px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.segment-button {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.segment-button.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.photo-groups {
  display: grid;
  gap: 18px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}

.photo-groups-map .photo-grid,
.photo-groups-dex .photo-grid,
.photo-grid-squadron {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
}

.photo-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
}

.photo-card:hover,
.aircraft-card:hover,
.location-row:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(38, 35, 31, 0.1);
}

.photo-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  background: transparent;
  transition: transform 520ms ease, filter 520ms ease;
}

.photo-card .photo-body {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 2px;
  padding: 48px 14px 14px;
  background: var(--image-overlay);
  color: #ffffff;
}

.photo-card:hover img {
  transform: scale(1.025);
}

.photo-card .photo-body strong,
.photo-card .photo-body span {
  color: #ffffff;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.48);
}

.photo-card .photo-body span {
  opacity: 0.78;
}

.dex-browser {
  min-width: 0;
}

.browser-heading {
  margin-bottom: 14px;
}

.stats-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats-pair-card {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.stats-pair-card div {
  min-width: 0;
  text-align: center;
}

.stats-pair-card strong,
.stats-pair-card span,
.stats-pair-card p {
  display: block;
  min-width: 0;
}

.stats-pair-card strong {
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
}

.stats-pair-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stats-pair-card p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.exif-dashboard {
  display: grid;
  gap: 16px;
}

.exif-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.exif-summary-grid div,
.exif-stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.exif-summary-grid div {
  padding: 12px;
}

.exif-summary-grid strong,
.exif-summary-grid span,
.exif-summary-grid small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exif-summary-grid strong {
  color: var(--text);
  font-size: 1.15rem;
}

.exif-summary-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.exif-summary-grid small {
  color: var(--muted);
  font-size: 0.74rem;
}

.exif-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.exif-stat-card {
  padding: 12px;
}

.exif-stat-card h3 {
  margin-bottom: 10px;
}

.exif-stat-card .heading-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.exif-bar-list {
  display: grid;
  gap: 10px;
}

.exif-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.9fr) minmax(70px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.exif-bar-label,
.exif-bar-count {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.exif-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exif-bar-count {
  color: var(--text);
  text-align: right;
}

.exif-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.exif-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

.squadrons-hero {
  display: grid;
  gap: 18px;
}

.squadrons-hero .lead {
  max-width: 760px;
  margin-bottom: 0;
}

.squadron-country-list {
  display: grid;
  gap: 26px;
}

.squadron-country-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.squadron-country-header {
  margin-bottom: 0;
}

.squadron-logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.squadron-logo-card {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-rows: 220px minmax(172px, auto);
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.squadron-logo-card:hover,
.squadron-logo-card.is-active {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(38, 35, 31, 0.1);
}

.squadron-logo-card.is-active {
  background: var(--blue-soft);
}

.squadron-logo-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.squadron-logo-media {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 22px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.squadron-logo-media.has-hero {
  padding: 0;
  place-items: stretch;
}

.squadron-card-hero {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 420ms ease, filter 420ms ease;
}

.squadron-logo-card:hover .squadron-card-hero,
.squadron-logo-card.is-active .squadron-card-hero {
  filter: saturate(1.04) contrast(1.03);
  transform: scale(1.04);
}

.squadron-card-logo {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.squadron-card-logo.is-standalone {
  position: static;
  width: min(168px, 100%);
  height: 168px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.squadron-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.squadron-logo-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--blue);
  font-size: 2.4rem;
  font-weight: 900;
}

.squadron-logo-body {
  display: grid;
  grid-template-rows: auto minmax(2.6em, auto) minmax(2.5em, auto) auto;
  gap: 8px;
  align-content: start;
  padding: 14px;
}

.squadron-logo-body h2,
.squadron-logo-body p {
  margin: 0;
}

.squadron-logo-body p,
.squadron-logo-body span {
  color: var(--muted);
  font-size: 0.86rem;
}

.squadron-logo-body h2,
.squadron-logo-body p:not(.eyebrow) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.squadron-logo-body h2 {
  min-height: 2.6em;
  line-height: 1.3;
  -webkit-line-clamp: 2;
}

.squadron-logo-body p:not(.eyebrow) {
  min-height: 2.5em;
  -webkit-line-clamp: 2;
}

.squadron-logo-body span {
  align-self: end;
  font-weight: 800;
}

.squadron-detail {
  display: grid;
  gap: 14px;
}

.squadron-detail-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.squadron-detail-hero img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

.squadron-detail-logo {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.squadron-detail-logo img,
.squadron-detail-logo .squadron-logo-fallback {
  width: 100%;
  height: 100%;
}

.squadron-type-list {
  margin: 0;
}

.aircraft-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.aircraft-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 270px;
  overflow: hidden;
}

.aircraft-cover {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.aircraft-cover img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: inherit;
  object-fit: cover;
  transition: transform 520ms ease, filter 520ms ease;
}

.aircraft-card:hover .aircraft-cover img {
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1.025);
}

.empty-cover {
  display: grid;
  aspect-ratio: 16 / 10;
  place-items: center;
  border-radius: inherit;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 800;
}

.aircraft-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.aircraft-title {
  font-size: 1rem;
  line-height: 1.25;
}

.aircraft-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.aircraft-stat-row span {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.aircraft-stat-row strong {
  color: var(--text);
  font-size: 0.8rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  max-width: 100%;
  padding: 4px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.entry-stat-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.entry-stat-grid strong,
.entry-stat-grid span {
  display: block;
  overflow-wrap: anywhere;
}

.entry-stat-grid strong {
  font-size: 1rem;
}

.entry-stat-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.squadron-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.squadron-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.squadron-logo,
.logo-fallback {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.squadron-logo-link {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.squadron-logo-link:hover .squadron-logo,
.squadron-logo-link:hover .logo-fallback {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(38, 35, 31, 0.12);
}

.squadron-logo {
  object-fit: contain;
  padding: 5px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.logo-fallback {
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 800;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  min-height: 140px;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  background: #050505;
  color: #f8fafc;
}

.photo-viewer[hidden] {
  display: none;
}

.viewer-stage {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  background: #050505;
}

.viewer-image-frame {
  position: relative;
  display: inline-grid;
  max-width: 100%;
  max-height: 100vh;
  place-items: center;
}

.viewer-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100vh;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
  user-select: none;
}

.viewer-button {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.62);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  backdrop-filter: blur(14px);
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.viewer-button:hover {
  background: rgba(40, 40, 40, 0.9);
  transform: translateY(-1px);
}

.viewer-button.close {
  top: 18px;
  right: 18px;
}

.viewer-button.info-toggle {
  display: none;
  top: 18px;
  left: 18px;
  font-family: Georgia, serif;
  font-size: 1.08rem;
  font-style: italic;
}

.viewer-button.previous {
  bottom: 18px;
  left: 18px;
}

.viewer-button.next {
  bottom: 18px;
  right: 18px;
}

.viewer-info {
  min-width: 0;
  max-height: 100vh;
  overflow: auto;
  padding: 34px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 7, 7, 0.78);
  backdrop-filter: blur(24px);
}

.viewer-info .eyebrow {
  color: #d8d1c4;
}

.metadata-panel {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.metadata-section {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.metadata-section h3 {
  margin: 0 0 10px;
  color: #f8fafc;
}

.metadata-section p {
  margin: 0;
  color: #a8b4c7;
}

.metadata-list {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.metadata-list dt {
  color: #a8b4c7;
  font-weight: 800;
}

.metadata-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.viewer-squadron-logo-link {
  display: block;
  width: max-content;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.viewer-squadron-logo {
  width: 68px;
  height: 68px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  object-fit: contain;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.viewer-squadron-logo-link .viewer-squadron-logo {
  margin-top: 0;
}

.viewer-squadron-logo-link:hover .viewer-squadron-logo {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.view.is-active .control-panel,
.view.is-active .map-stage,
.view.is-active .recent-photos-panel,
.view.is-active .results-panel,
.view.is-active .dex-browser,
.view.is-active .stats-hero,
.view.is-active .squadrons-hero {
  animation: drawer-in 360ms ease-out both;
}

.view.is-active .aircraft-card,
.view.is-active .photo-card,
.view.is-active .location-recent-card,
.view.is-active .squadron-logo-card,
.view.is-active .stats-pair-card,
.view.is-active .exif-count-card {
  animation: item-in 320ms ease-out both;
}

.view.is-active .photo-card:nth-child(2),
.view.is-active .aircraft-card:nth-child(2),
.view.is-active .squadron-logo-card:nth-child(2) {
  animation-delay: 35ms;
}

.view.is-active .photo-card:nth-child(3),
.view.is-active .aircraft-card:nth-child(3),
.view.is-active .squadron-logo-card:nth-child(3) {
  animation-delay: 70ms;
}

.view.is-active .photo-card:nth-child(4),
.view.is-active .aircraft-card:nth-child(4),
.view.is-active .squadron-logo-card:nth-child(4) {
  animation-delay: 105ms;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 1041px) {
  .map-workspace > .control-panel,
  .dex-workspace > .control-panel {
    display: flex;
    height: calc(100vh - 116px);
    flex-direction: column;
    overflow: hidden;
  }

  .map-workspace .location-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  .dex-workspace .sidebar-recent-photos {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  .sidebar-recent-photos .recent-photo-strip {
    flex: 1 1 auto;
    grid-auto-columns: initial;
    grid-auto-flow: row;
    grid-auto-rows: clamp(112px, 16vh, 168px);
    grid-template-columns: 1fr;
    max-height: none;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 2px;
  }

  .sidebar-recent-photos .recent-photo-card {
    height: 100%;
    aspect-ratio: auto;
    grid-template-columns: initial;
    grid-template-rows: auto;
    min-height: 0;
    max-height: none;
  }

  .sidebar-recent-photos .recent-photo-card img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  #mapView {
    margin: -22px calc(50% - 50vw) -34px;
  }

  #mapView .map-workspace {
    position: relative;
    z-index: 0;
    display: block;
    height: calc(100svh - 88px);
    min-height: 0;
    isolation: isolate;
    overflow: hidden;
    background: var(--surface-strong);
  }

  #mapView .map-column {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
  }

  #mapView .map-stage {
    position: absolute;
    inset: 0;
    z-index: 0;
    min-height: inherit;
    border: 0;
    border-radius: 0;
    background: #dedbd3;
    box-shadow: none;
  }

  #mapView .map-stage::after {
    background:
      radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--surface) 22%, transparent), transparent 34%),
      linear-gradient(90deg, color-mix(in srgb, var(--bg) 58%, transparent) 0%, transparent 36%, transparent 68%, color-mix(in srgb, var(--bg) 36%, transparent) 100%),
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 32%, transparent) 0%, transparent 34%, color-mix(in srgb, var(--bg) 46%, transparent) 100%);
  }

  #mapView .world-map {
    height: 100%;
    min-height: inherit;
  }

  #mapView .control-panel {
    position: absolute;
    top: clamp(24px, 4vh, 48px);
    left: clamp(18px, 3vw, 48px);
    z-index: 20;
    width: min(410px, calc(100vw - 36px));
    height: auto;
    max-height: calc(100svh - 118px);
    padding: 24px;
    border-color: color-mix(in srgb, var(--line-strong) 70%, transparent);
    background: var(--glass);
    box-shadow: var(--portfolio-shadow);
    backdrop-filter: blur(24px) saturate(1.08);
  }

  #mapView .control-panel h1 {
    max-width: 12ch;
    font-size: clamp(1.45rem, 2.8vw, 2.9rem);
    line-height: 0.98;
  }

  #mapView .control-panel .lead {
    max-width: 32ch;
    font-size: 0.96rem;
  }

  #mapView .location-list {
    max-height: min(38vh, 420px);
  }

  #mapView #mapResults {
    position: absolute;
    top: clamp(18px, 3vw, 42px);
    right: clamp(18px, 3vw, 48px);
    bottom: clamp(18px, 3vw, 42px);
    z-index: 20;
    width: min(880px, max(470px, calc(100vw - 520px)));
    max-height: none;
    overflow: auto;
    border-color: color-mix(in srgb, var(--line-strong) 68%, transparent);
    background: var(--glass);
    box-shadow: var(--portfolio-shadow);
    backdrop-filter: blur(24px) saturate(1.08);
  }

  #mapView .leaflet-control-container {
    position: relative;
    z-index: 3;
  }
}

@media (max-width: 1040px) {
  .site-header {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    gap: 10px;
  }

  .tab-nav {
    min-width: 0;
    width: auto;
    justify-self: stretch;
  }

  .tab-button {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
  }

  .dex-workspace {
    max-width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .dex-workspace > .control-panel,
  .dex-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .control-panel {
    position: static;
  }

  #mapView {
    margin: -22px calc(50% - 50vw) -34px;
  }

  #mapView .map-workspace {
    position: relative;
    z-index: 0;
    display: block;
    height: calc(100svh - 88px);
    min-height: 0;
    isolation: isolate;
    overflow: hidden;
    background: var(--surface-strong);
  }

  #mapView .map-column {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
  }

  #mapView .map-stage {
    position: absolute;
    inset: 0;
    z-index: 0;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: #dedbd3;
    box-shadow: none;
  }

  #mapView .map-stage::after {
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--bg) 34%, transparent) 0%, transparent 46%, color-mix(in srgb, var(--bg) 24%, transparent) 100%),
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 24%, transparent) 0%, transparent 38%, color-mix(in srgb, var(--bg) 38%, transparent) 100%);
  }

  #mapView .world-map {
    height: 100%;
    min-height: 0;
  }

  #mapView.view.is-active .control-panel,
  #mapView.view.is-active .results-panel,
  #mapView.view.is-active .map-stage {
    animation: none;
  }

  #mapView .control-panel,
  #mapView #mapResults {
    position: absolute;
    top: 16px;
    bottom: 76px;
    z-index: 20;
    width: min(440px, calc(100vw - 64px));
    max-height: none;
    overflow: auto;
    border-color: color-mix(in srgb, var(--line-strong) 68%, transparent);
    background: var(--glass);
    box-shadow: var(--portfolio-shadow);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(22px) saturate(1.08);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  #mapView .control-panel {
    left: 16px;
    transform: translateX(calc(-100% - 22px));
  }

  #mapView #mapResults {
    right: 16px;
    transform: translateX(calc(100% + 22px));
  }

  #mapView .map-workspace.is-locations-open > .control-panel,
  #mapView .map-workspace.is-results-open #mapResults {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  #mapView .location-list {
    max-height: none;
  }

  #mapView .map-panel-toggle {
    position: absolute;
    bottom: 18px;
    z-index: 30;
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 13px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
    border-radius: var(--radius);
    background: var(--glass-strong);
    box-shadow: var(--portfolio-shadow);
    color: var(--text);
    font-weight: 850;
    backdrop-filter: blur(18px) saturate(1.08);
  }

  #mapView .map-panel-toggle-locations {
    left: 16px;
  }

  #mapView .map-panel-toggle-results {
    right: 16px;
  }

  #mapView .map-panel-toggle.is-active {
    border-color: var(--pin-active);
    background: var(--surface);
  }

  #mapView .leaflet-control-container {
    position: relative;
    z-index: 3;
  }

  #mapView .spotterdex-marker-shell {
    width: min(306px, 54vw) !important;
  }

  #mapView .spotterdex-marker-label {
    max-width: min(252px, calc(54vw - 44px));
  }
}

@media (max-width: 760px) {
  .site-header {
    gap: 10px;
    padding: 12px;
  }

  .tab-nav {
    display: none;
  }

  .nav-select {
    display: block;
  }

  .brand-subtitle {
    display: none;
  }

  .app-shell {
    padding: 14px 10px 24px;
  }

  .control-panel,
  .recent-photos-panel,
  .results-panel,
  .dex-browser {
    padding: 14px;
  }

  .sidebar-recent-photos {
    padding: 18px 0 0;
  }

  .map-stage,
  .world-map {
    min-height: 390px;
  }

  #mapView {
    margin: -14px -10px -24px;
  }

  #mapView .map-workspace {
    position: relative;
    z-index: 0;
    display: block;
    height: calc(100svh - 62px);
    min-height: 0;
    isolation: isolate;
    overflow: hidden;
    background: var(--surface-strong);
  }

  #mapView .map-column {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
  }

  #mapView .map-stage {
    position: absolute;
    inset: 0;
    z-index: 0;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: #dedbd3;
    box-shadow: none;
  }

  #mapView .map-stage::after {
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--bg) 34%, transparent) 0%, transparent 46%, color-mix(in srgb, var(--bg) 24%, transparent) 100%),
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 24%, transparent) 0%, transparent 38%, color-mix(in srgb, var(--bg) 38%, transparent) 100%);
  }

  #mapView .world-map {
    height: 100%;
    min-height: 0;
  }

  #mapView.view.is-active .control-panel,
  #mapView.view.is-active .results-panel,
  #mapView.view.is-active .map-stage {
    animation: none;
  }

  #mapView .control-panel,
  #mapView #mapResults {
    position: absolute;
    top: 12px;
    bottom: 68px;
    z-index: 20;
    width: min(430px, calc(100vw - 52px));
    max-height: none;
    overflow: auto;
    border-color: color-mix(in srgb, var(--line-strong) 68%, transparent);
    background: var(--glass);
    box-shadow: var(--portfolio-shadow);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(22px) saturate(1.08);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  #mapView .control-panel {
    left: 10px;
    transform: translateX(calc(-100% - 18px));
  }

  #mapView #mapResults {
    right: 10px;
    transform: translateX(calc(100% + 18px));
  }

  #mapView .map-workspace.is-locations-open > .control-panel,
  #mapView .map-workspace.is-results-open #mapResults {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  #mapView .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 14px 0;
  }

  #mapView .stat-grid div {
    padding: 9px 7px;
  }

  #mapView .stat-value {
    font-size: 1.05rem;
  }

  #mapView .stat-label {
    font-size: 0.68rem;
  }

  #mapView .location-list {
    max-height: none;
  }

  #mapView .map-panel-toggle {
    position: absolute;
    bottom: 14px;
    z-index: 30;
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 13px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
    border-radius: var(--radius);
    background: var(--glass-strong);
    box-shadow: var(--portfolio-shadow);
    color: var(--text);
    font-weight: 850;
    backdrop-filter: blur(18px) saturate(1.08);
  }

  #mapView .map-panel-toggle-locations {
    left: 12px;
  }

  #mapView .map-panel-toggle-results {
    right: 12px;
  }

  #mapView .map-panel-toggle.is-active {
    border-color: var(--pin-active);
    background: var(--surface);
  }

  #mapView .leaflet-control-container {
    position: relative;
    z-index: 3;
  }

  #mapView .spotterdex-marker-shell {
    width: min(286px, 74vw) !important;
    gap: 6px;
  }

  #mapView .spotterdex-marker-label {
    max-width: min(236px, calc(74vw - 42px));
    padding: 6px 8px;
  }

  #mapView .spotterdex-cluster-shell {
    width: min(306px, 80vw) !important;
  }

  #mapView .spotterdex-cluster-shell .spotterdex-marker-label {
    max-width: min(252px, calc(80vw - 48px));
  }

  .photo-groups-map .photo-grid,
  .photo-groups-dex .photo-grid,
  .photo-grid-squadron {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .squadron-logo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .squadron-logo-media {
    min-height: 150px;
    padding: 16px;
  }

  .squadron-card-logo.is-standalone,
  .squadron-card-logo.is-standalone .squadron-logo-fallback {
    width: min(124px, 100%);
    height: 124px;
  }

  .entry-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .location-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .location-detail-grid {
    grid-template-columns: 1fr;
  }

  .location-recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .exif-summary-grid,
  .exif-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-header,
  .browser-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .photo-viewer {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .photo-viewer::before {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: rgba(0, 0, 0, 0.34);
    content: "";
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .photo-viewer.is-info-open::before {
    opacity: 1;
  }

  .viewer-stage {
    height: 100svh;
    min-height: 100svh;
    padding: 0;
  }

  .viewer-image-frame {
    max-width: 100vw;
    max-height: 100svh;
  }

  .viewer-stage img {
    max-width: 100vw;
    max-height: 100svh;
  }

  .viewer-button {
    z-index: 7;
  }

  .viewer-button.info-toggle {
    display: grid;
  }

  .viewer-button.info-toggle.is-active {
    background: rgba(255, 255, 255, 0.16);
  }

  .viewer-button.previous,
  .viewer-button.next {
    bottom: max(18px, env(safe-area-inset-bottom));
  }

  .viewer-info {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    width: min(390px, 88vw);
    max-height: none;
    padding: 74px 20px 24px;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .photo-viewer.is-info-open .viewer-info {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand {
    gap: 0;
  }

  .brand-title {
    display: none;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
  }

  .tab-button {
    padding: 7px 4px;
    font-size: 0.72rem;
  }

  .nav-select {
    min-height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 0.82rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .squadron-logo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .squadron-logo-card {
    grid-template-rows: 132px minmax(150px, auto);
  }

  .squadron-logo-media {
    min-height: 132px;
    padding: 10px;
  }

  .squadron-card-logo {
    left: 10px;
    bottom: 10px;
    width: 56px;
    height: 56px;
    padding: 6px;
  }

  .squadron-card-logo.is-standalone,
  .squadron-card-logo.is-standalone .squadron-logo-fallback {
    width: min(96px, 100%);
    height: 96px;
  }

  .squadron-logo-fallback {
    font-size: 1.55rem;
  }

  .squadron-logo-body {
    grid-template-rows: auto minmax(2.45em, auto) minmax(2.45em, auto) auto;
    gap: 6px;
    padding: 10px;
  }

  .squadron-logo-body h2 {
    font-size: 0.9rem;
    line-height: 1.22;
  }

  .squadron-logo-body p,
  .squadron-logo-body span {
    font-size: 0.72rem;
  }

  .aircraft-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .aircraft-card {
    min-height: 0;
  }

  .aircraft-cover {
    border-radius: calc(var(--radius) - 2px);
  }

  .aircraft-body {
    gap: 6px;
    padding: 8px;
  }

  .aircraft-title {
    font-size: 0.82rem;
    line-height: 1.18;
  }

  .aircraft-body > span:not(.badge-row) {
    font-size: 0.7rem;
  }

  .aircraft-stat-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .aircraft-stat-row span {
    padding: 5px 6px;
  }

  .badge-row {
    gap: 4px;
  }

  .badge {
    padding: 3px 6px;
    font-size: 0.66rem;
  }

  .exif-summary-grid,
  .exif-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-pair-card {
    grid-template-columns: 1fr;
  }

  .location-hero {
    height: 150px;
  }

  .location-hero-overlay {
    padding: 42px 14px 14px;
  }

  .location-recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exif-bar-row {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .exif-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .recent-photo-strip {
    grid-auto-columns: minmax(136px, 46vw);
  }

  .photo-groups-map .photo-grid,
  .photo-groups-dex .photo-grid,
  .photo-grid-squadron {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metadata-list {
    grid-template-columns: 1fr;
  }
}

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