/* ================================================================
   Maps Library — style.css
   Design system: deep navy base, amber accent, DM Mono + Inter
   ================================================================ */

/* ── TOKENS ──────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --c-base:       #0E1B2E;   /* page background */
  --c-surface:    #1C2D42;   /* card / panel surface */
  --c-surface-2:  #243347;   /* raised surface / hover */
  --c-border:     #2E4260;   /* subtle border */
  --c-border-2:   #3D5A80;   /* prominent border */
  --c-amber:      #C8A96E;   /* primary accent — map-paper gold */
  --c-amber-dim:  #A08750;   /* dimmed amber */
  --c-sage:       #6B8F71;   /* tag / badge colour */
  --c-text:       #EEF0F3;   /* primary text */
  --c-text-2:     #9BAFCB;   /* secondary text */
  --c-text-3:     #5F7A9A;   /* tertiary / placeholder */
  --c-danger:     #E05C5C;   /* error states */
  --c-overlay:    rgba(5, 12, 22, 0.82);

  /* Typography */
  --f-mono:  'DM Mono', 'Fira Code', monospace;
  --f-body:  'Inter', 'Helvetica Neue', Arial, sans-serif;

  --fs-xs:   0.70rem;   /* 11.2px */
  --fs-sm:   0.80rem;   /* 12.8px */
  --fs-base: 0.9375rem; /* 15px */
  --fs-lg:   1.0625rem; /* 17px */
  --fs-xl:   1.25rem;
  --fs-2xl:  1.625rem;
  --fs-3xl:  2.25rem;
  --fs-4xl:  3rem;

  --lh-tight:  1.25;
  --lh-normal: 1.6;

  /* Spacing */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  /* Shape */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-med:  240ms;
}

/* ── RESET ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--c-base);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--c-amber); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* Visible focus outline for keyboard users */
:focus-visible {
  outline: 2px solid var(--c-amber);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ── LAYOUT HELPERS ──────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ── SITE HEADER ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 27, 46, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  letter-spacing: 0.01em;
}
.wordmark:hover { color: var(--c-text); text-decoration: none; }
.wordmark-section { color: var(--c-amber); }
.wordmark-sep { color: var(--c-text-3); }

.header-nav { display: flex; gap: var(--sp-6); }
.nav-link {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  transition: color var(--dur-fast);
}
.nav-link:hover { color: var(--c-text); text-decoration: none; }

/* ── HERO ────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: var(--sp-16) var(--sp-6) var(--sp-12);
  overflow: hidden;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-sage);
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-3);
}

.hero-title {
  font-family: var(--f-mono);
  font-size: clamp(var(--fs-3xl), 5vw, var(--fs-4xl));
  font-weight: 500;
  color: var(--c-text);
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-5);
  letter-spacing: -0.02em;
}

.hero-title::after {
  content: '_';
  color: var(--c-amber);
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-desc {
  font-size: var(--fs-lg);
  color: var(--c-text-2);
  line-height: var(--lh-normal);
  max-width: 60ch;
}

/* Decorative graticule grid */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--c-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.18) 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.18) 40%, transparent 100%);
  opacity: 0.5;
}

/* ── CONTROLS BAR ────────────────────────────────────────────────── */
.controls-bar {
  position: sticky;
  top: 52px;
  z-index: 90;
  background: rgba(14, 27, 46, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-3) var(--sp-6);
}

.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--c-text-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-8) var(--sp-2) var(--sp-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast);
  appearance: none;
}
.search-input::placeholder { color: var(--c-text-3); }
.search-input:focus { outline: none; border-color: var(--c-amber); }

.search-clear {
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  border-radius: var(--r-sm);
  transition: color var(--dur-fast);
}
.search-clear:hover { color: var(--c-text); }
.search-clear svg { width: 14px; height: 14px; }

/* Filter selects */
.filter-wrap {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-select {
  padding: var(--sp-2) var(--sp-8) var(--sp-2) var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--fs-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235F7A9A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.filter-select:focus { outline: none; border-color: var(--c-amber); color: var(--c-text); }
.filter-select option { background: var(--c-surface); color: var(--c-text); }

/* ── LIBRARY MAIN ────────────────────────────────────────────────── */
.library-main {
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
}

.library-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.results-count {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  margin-bottom: var(--sp-6);
  min-height: 1.4em;
}

/* ── MAP GRID ────────────────────────────────────────────────────── */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-5);
}

/* ── MAP CARD ────────────────────────────────────────────────────── */
.map-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
  role: listitem;
}
.map-card:hover {
  border-color: var(--c-amber-dim);
  transform: translateY(-2px);
}
.map-card:focus-visible {
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
}

.card-preview {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--c-base);
}

.card-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-med) var(--ease-out);
}
.map-card:hover .card-preview-img { transform: scale(1.03); }

.card-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-border-2);
}
.card-preview-placeholder svg { width: 48px; height: 48px; }

.card-body {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex: 1;
}

.card-meta {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-sage);
  background: rgba(107, 143, 113, 0.12);
  border: 1px solid rgba(107, 143, 113, 0.25);
  border-radius: var(--r-sm);
  padding: 2px var(--sp-2);
  white-space: nowrap;
}

.tag-region {
  color: var(--c-text-3);
  background: transparent;
  border-color: var(--c-border);
}

.card-title {
  font-family: var(--f-mono);
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--c-text);
  line-height: var(--lh-tight);
}

.card-desc {
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}

.card-formats {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.format-badge {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-amber-dim);
  background: rgba(200, 169, 110, 0.1);
  border: 1px solid rgba(200, 169, 110, 0.2);
  border-radius: var(--r-sm);
  padding: 1px var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-source {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Card view-more indicator */
.card-view-arrow {
  position: absolute;
  bottom: var(--sp-3);
  right: var(--sp-3);
  width: 28px;
  height: 28px;
  background: var(--c-surface-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-amber);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.map-card:hover .card-view-arrow,
.map-card:focus-visible .card-view-arrow { opacity: 1; }
.card-view-arrow svg { width: 14px; height: 14px; }

/* ── EMPTY STATE ─────────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-16) var(--sp-6);
  text-align: center;
  color: var(--c-text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
}
.empty-state svg { width: 56px; height: 56px; }
.empty-state p { font-size: var(--fs-lg); }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  background: var(--c-amber);
  color: var(--c-base);
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid var(--c-amber);
  text-decoration: none;
  transition: background var(--dur-fast), opacity var(--dur-fast);
  white-space: nowrap;
}
.btn-primary:hover { background: #d9ba80; text-decoration: none; }
.btn-primary[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: transparent;
  color: var(--c-text-2);
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.btn-ghost:hover { border-color: var(--c-border-2); color: var(--c-text); }

/* Format download buttons in detail view */
.format-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.format-btn:hover {
  border-color: var(--c-amber-dim);
  color: var(--c-amber);
  background: rgba(200, 169, 110, 0.06);
}
.format-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── DETAIL OVERLAY ──────────────────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}
.detail-overlay[hidden] { display: none; }

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: var(--c-overlay);
  cursor: pointer;
}

.detail-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  height: 100%;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: slide-in var(--dur-med) var(--ease-out);
}

@keyframes slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.detail-close {
  position: sticky;
  top: var(--sp-4);
  float: right;
  margin: var(--sp-4) var(--sp-4) 0 0;
  width: 32px;
  height: 32px;
  background: var(--c-surface-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-2);
  z-index: 10;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.detail-close:hover { color: var(--c-text); background: var(--c-border); }
.detail-close svg { width: 16px; height: 16px; }

/* Detail panel internals (generated by JS) */
.detail-preview {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  background: var(--c-base);
}

.detail-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.detail-tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.detail-title {
  font-family: var(--f-mono);
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: var(--lh-tight);
  color: var(--c-text);
}

.detail-desc {
  font-size: var(--fs-base);
  color: var(--c-text-2);
  line-height: var(--lh-normal);
}

.detail-section {
  border-top: 1px solid var(--c-border);
  padding-top: var(--sp-4);
}

.detail-section-label {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
  text-transform: uppercase;
}

.detail-source-name {
  font-size: var(--fs-base);
  color: var(--c-text);
  margin-bottom: var(--sp-1);
}

.detail-license-name {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-sage);
  background: rgba(107, 143, 113, 0.1);
  border: 1px solid rgba(107, 143, 113, 0.2);
  border-radius: var(--r-sm);
  padding: var(--sp-1) var(--sp-3);
}

.detail-formats {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── MODAL ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.modal-overlay[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--c-overlay);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: var(--c-surface);
  border: 1px solid var(--c-border-2);
  border-radius: var(--r-lg);
  animation: modal-in var(--dur-med) var(--ease-out);
  overflow: hidden;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
}

.modal-title {
  font-family: var(--f-mono);
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--c-text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  border-radius: var(--r-sm);
  transition: color var(--dur-fast);
  flex-shrink: 0;
}
.modal-close:hover { color: var(--c-text); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.modal-license-block {
  background: var(--c-base);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.modal-license-name {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-sage);
}

.modal-license-text {
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  line-height: 1.6;
}

.modal-license-link {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-amber);
}

/* Custom checkbox */
.modal-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  line-height: 1.55;
  user-select: none;
}

.modal-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.modal-checkbox-custom {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--c-border-2);
  border-radius: 4px;
  background: var(--c-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.modal-checkbox-label input:checked + .modal-checkbox-custom {
  background: var(--c-amber);
  border-color: var(--c-amber);
}

.modal-checkbox-label input:checked + .modal-checkbox-custom::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--c-base);
  border-bottom: 2px solid var(--c-base);
  transform: rotate(-45deg) translate(1px, -1px);
}

.modal-checkbox-label input:focus-visible + .modal-checkbox-custom {
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--c-border);
}

/* ── FOOTER ──────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding: var(--sp-8) var(--sp-6);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.site-footer p {
  font-family: var(--f-mono);
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.site-footer a { color: var(--c-text-2); }
.site-footer a:hover { color: var(--c-amber); }
.footer-sub { font-size: var(--fs-xs); }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: var(--sp-10) var(--sp-4) var(--sp-8); }
  .controls-bar { padding: var(--sp-3) var(--sp-4); }
  .controls-inner { gap: var(--sp-2); }
  .filter-wrap { width: 100%; }
  .filter-select { flex: 1; min-width: 0; }
  .library-main { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
  .map-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .detail-panel { width: 100%; border-left: none; border-top: 1px solid var(--c-border); }
  .detail-overlay { align-items: flex-end; }
  .modal-panel { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ── ADEEP AG SITE THEME ───────────────────────────────────────── */
@font-face {
  font-family: 'Hey Gotcha';
  src: url('/fonts/HeyGotcha-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Horiza';
  src: url('/fonts/Horizon.woff2') format('woff2');
  font-display: swap;
}
:root {
  --bg: #ffffff; --text: #000000; --text-body: #333333; --border: #000000;
  --accent: #2788c7; --card-bg: #ffffff;
  --c-base: var(--bg); --c-surface: var(--card-bg); --c-surface-2: #f2f2f2;
  --c-border: #d0d0d0; --c-border-2: #000000; --c-amber: var(--accent);
  --c-amber-dim: #1c6798; --c-sage: var(--accent); --c-text: var(--text);
  --c-text-2: var(--text-body); --c-text-3: #666666; --c-overlay: rgba(0,0,0,.72);
}
html.dark {
  --bg: #14171a; --text: #f2f2f2; --text-body: #cfcfcf; --border: #f2f2f2;
  --accent: #5fb3ec; --card-bg: #1e2227; --c-surface-2: #292e34;
  --c-border: #4b5158; --c-text-3: #aeb5bc; --c-overlay: rgba(0,0,0,.82);
}
body { background: var(--bg); color: var(--text); font-family: 'Arvo', 'Comic Neue', serif; padding-bottom: 80px; }
.theme-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 200; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); border-radius: 50%; background: var(--bg); color: var(--text);
}
.theme-toggle:hover { opacity: .8; }
.theme-toggle svg { width: 19px; height: 19px; fill: currentColor; }
.site-header { position: relative; background: var(--bg); border-bottom: 2px solid var(--border); backdrop-filter: none; }
.header-inner { max-width: 1366px; height: auto; min-height: 100px; padding: 24px 7%; }
.wordmark { color: var(--text); font-family: 'Arvo', serif; font-size: clamp(24px,4vw,52px); font-weight: 700; letter-spacing: normal; }
.wordmark:hover { color: var(--text); }
.header-nav { gap: clamp(16px,3vw,42px); padding-right: 80px; }
.nav-link { color: var(--accent); font-family: 'Hey Gotcha','Poppins',sans-serif; font-size: clamp(13px,1.5vw,21px); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-transform: uppercase; }
.nav-link:hover { color: var(--accent); opacity: .75; }
.hero { max-width: 1366px; margin: 0 auto; padding: clamp(48px,8vw,110px) 7% clamp(42px,6vw,80px); border-bottom: 2px solid var(--border); }
.hero-inner { max-width: 820px; margin: 0; }
.hero-eyebrow { color: var(--accent); font-family: 'Hey Gotcha','Poppins',sans-serif; font-size: clamp(14px,1.6vw,22px); font-weight: 700; text-transform: uppercase; }
.hero-title { color: var(--text); font-family: 'Horiza','Poppins',sans-serif; font-size: clamp(42px,8vw,100px); font-weight: 800; line-height: 1; letter-spacing: 0; }
.hero-title::after { color: var(--accent); }
.hero-desc { color: var(--text-body); font-family: 'Comic Neue','Arvo',sans-serif; font-size: clamp(18px,2vw,26px); line-height: 1.5; }
.hero-grid { opacity: .08; background-image: linear-gradient(var(--border) 1px,transparent 1px),linear-gradient(90deg,var(--border) 1px,transparent 1px); }
.controls-bar { position: relative; top: auto; background: var(--bg); border-bottom: 2px solid var(--border); padding: 18px 7%; }
.controls-inner { max-width: 1366px; }
.search-input, .filter-select { background: var(--card-bg); border: 2px solid var(--border); border-radius: 0; color: var(--text); font-family: 'Arvo',serif; }
.search-input::placeholder { color: var(--text-body); }
.filter-select option { background: var(--card-bg); color: var(--text); }
.library-main { max-width: 1366px; margin: 0 auto; padding: 48px 7% 80px; }
.library-inner { max-width: none; }
.results-count { color: var(--text-body); font-family: 'Comic Neue',sans-serif; font-size: 16px; }
.map-grid { gap: 28px; }
.map-card { background: var(--card-bg); border: 2px solid var(--border); border-radius: 0; box-shadow: 6px 6px 0 var(--border); }
.map-card:hover { border-color: var(--accent); transform: translate(-2px,-2px); }
.card-title, .detail-title, .modal-title { color: var(--text); font-family: 'Poppins',sans-serif; font-weight: 800; }
.card-desc, .detail-desc, .detail-source-name, .modal-license-text { color: var(--text-body); font-family: 'Comic Neue',sans-serif; }
.tag, .format-badge { color: var(--accent); background: transparent; border-color: var(--accent); border-radius: 0; font-family: 'Hey Gotcha','Poppins',sans-serif; }
.tag-region { color: var(--text-body); border-color: var(--border); }
.card-footer { border-color: var(--border); }
.card-source { color: var(--text-body); font-family: 'Comic Neue',sans-serif; }
.card-view-arrow { background: var(--accent); color: var(--bg); border-radius: 0; }
.btn-primary, .btn-ghost, .format-btn { border-radius: 0; font-family: 'Hey Gotcha','Poppins',sans-serif; text-transform: uppercase; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--text); border-color: var(--text); }
.btn-ghost, .format-btn { background: var(--card-bg); border: 2px solid var(--border); color: var(--text); }
.btn-ghost:hover, .format-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--card-bg); }
.detail-panel, .modal-panel { background: var(--card-bg); border: 2px solid var(--border); border-radius: 0; box-shadow: 8px 8px 0 var(--border); }
.detail-backdrop, .modal-backdrop { background: var(--c-overlay); }
.detail-close, .modal-close { color: var(--text); }
.detail-section, .modal-footer { border-color: var(--border); }
.detail-section-label, .modal-license-name { color: var(--accent); font-family: 'Hey Gotcha','Poppins',sans-serif; text-transform: uppercase; }
.modal-checkbox-label { color: var(--text-body); font-family: 'Comic Neue',sans-serif; }
.site-footer { max-width: 1366px; margin: 0 auto; padding: 0 7%; color: var(--text-body); font-family: 'Comic Neue',sans-serif; text-align: center; }
.site-footer a { color: var(--accent); }
@media (max-width: 700px) {
  .header-inner { padding: 24px 20px; flex-direction: column; gap: 18px; }
  .header-nav { padding-right: 0; flex-wrap: wrap; justify-content: center; }
  .theme-toggle { top: 14px; right: 14px; }
  .hero, .controls-bar, .library-main { padding-left: 20px; padding-right: 20px; }
  .hero-title { font-size: clamp(42px,13vw,68px); }
  .site-footer { padding: 0 20px; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 var(--sp-4); }
  .site-footer { padding: var(--sp-6) var(--sp-4); }
}
