
/* ==================================================
   PENCIL ATLAS
   Mid-century geography meets stationery zine
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');


/* --------------------------------------------------
   1. COLOURS & VARIABLES
   -------------------------------------------------- */

:root {
  --paper: #f3e8ce;
  --cream: #fffaf0;
  --ink: #242321;
  --sage: #697f75;
  --sage-light: #a9c1b3;
  --orange: #fa9c6a;
  --ocean: #c8ddd4;
  --muted: #716d62;

  --border: var(--ink);

  --shadow: 4px 4px 0 var(--ink);

  --font-body: 'DM Sans', sans-serif;
  --font-label: 'Space Mono', monospace;
}


/* --------------------------------------------------
   2. GLOBAL RESET
   -------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

button,
select {
  font: inherit;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}


/* --------------------------------------------------
   3. HEADER & BRANDING
   -------------------------------------------------- */

header {
  text-align: center;
  padding: 24px 20px 20px;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
}

/* Temporary text logo */
h1 {
  margin: 0;
  font-family: var(--font-label);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -2px;
  text-transform: uppercase;
}

/* Future hand-drawn logo image */
.site-logo {
  display: block;
  width: min(440px, 90%);
  height: auto;
  margin: 0 auto 16px;
}

header > p:not(.eyebrow) {
  margin: 12px 0 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.eyebrow {
  margin: 0 0 12px;
  font-family: var(--font-label);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}


/* --------------------------------------------------
   4. MAIN LAYOUT
   -------------------------------------------------- */

main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px;
  align-items: start;
}

.map-section,
aside {
  min-width: 0;
  padding: 20px;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
}


/* --------------------------------------------------
   5. MAP TOOLBAR
   -------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.toolbar label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select {
  padding: 10px 34px 10px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 12px;
}

select:hover {
  background: var(--orange);
}


/* --------------------------------------------------
   6. INTERACTIVE MAP
   -------------------------------------------------- */

.map-container {
  position: relative;
}

#map {
  width: 100%;
  height: 550px;
  background: var(--ocean);
  border: 2px solid var(--ink);
  z-index: 0;
}

/* Leaflet country tooltips */

.leaflet-tooltip {
  padding: 8px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 700;
}

.leaflet-tooltip::before {
  display: none;
}

/* Leaflet zoom buttons */

.leaflet-bar {
  border: 2px solid var(--ink) !important;
  border-radius: 0 !important;
  box-shadow: 3px 3px 0 var(--ink) !important;
}

.leaflet-bar a {
  background: var(--cream) !important;
  color: var(--ink) !important;
  border-color: var(--ink) !important;
  border-radius: 0 !important;
  font-family: var(--font-label) !important;
}

.leaflet-bar a:hover {
  background: var(--orange) !important;
}

/* Attribution */

.leaflet-control-attribution {
  background: rgba(255, 250, 240, 0.85) !important;
  color: var(--muted) !important;
  font-family: var(--font-label);
  font-size: 9px;
}


/* --------------------------------------------------
   7. RETURN TO WORLD MAP BUTTON
   -------------------------------------------------- */

#reset-map {
  position: absolute;
  bottom: 22px;
  left: 22px;
  z-index: 1000;

  padding: 12px 18px;

  background: var(--orange);
  color: var(--ink);

  border: 2px solid var(--ink);
  border-radius: 0;

  box-shadow: 3px 3px 0 var(--ink);

  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;

  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

#reset-map:hover {
  background: var(--sage-light);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

#reset-map:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}


/* --------------------------------------------------
   8. COUNTRY CATALOGUE
   -------------------------------------------------- */

#country-panel {
  height: 800px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#country-panel h2 {
  margin: 8px 0 14px;
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -1px;
}

#country-description {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

#pencil-list {
  flex: 1;
  min-height: 0;
  margin-top: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--sage) var(--cream);
}

#pencil-list::-webkit-scrollbar {
  width: 8px;
}

#pencil-list::-webkit-scrollbar-track {
  background: var(--cream);
}

#pencil-list::-webkit-scrollbar-thumb {
  background: var(--sage);
  border: 1px solid var(--ink);
}

/* --------------------------------------------------
   9. PENCIL SPECIMEN CARDS
   -------------------------------------------------- */

.pencil {
  position: relative;
  margin-bottom: 14px;
  padding: 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  transition: transform 0.15s ease;
}

.pencil:hover {
  transform: translateY(-2px);
}

.pencil h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.pencil p {
  margin: 4px 0;
  font-size: 12px;
  color: var(--muted);
}

/* Future specimen labels */

.specimen-number {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.specimen-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 14px;
  background: var(--cream);
}

.pencil-status {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border: 1px solid var(--ink);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.pencil-status.owned {
  background: var(--sage-light);
}

.pencil-status.wishlist {
  background: var(--orange);
}


/* --------------------------------------------------
   10. MAP LEGEND (FUTURE)
   -------------------------------------------------- */

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0 0;
  font-family: var(--font-label);
  font-size: 10px;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
}

.legend-swatch.owned {
  background: var(--sage);
}

.legend-swatch.wishlist {
  background: var(--orange);
}

.legend-swatch.unexplored {
  background: var(--paper);
}


/* --------------------------------------------------
   11. FOOTER
   -------------------------------------------------- */

footer {
  max-width: 1600px;
  margin: 30px auto 0;
  padding: 24px;
  text-align: center;
  border-top: 2px solid var(--ink);
  font-family: var(--font-label);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}


/* --------------------------------------------------
   12. RESPONSIVE DESIGN
   -------------------------------------------------- */

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    padding: 20px;
  }


#country-panel {
  height: auto;
  min-height: 250px;
  overflow: visible;
}

#pencil-list {
  flex: none;
  overflow: visible;
  max-height: none;
  padding-right: 0;
}

  #map {
    height: 480px;
  }
}

@media (max-width: 600px) {
  header {
    padding: 28px 16px;
  }

  main {
    gap: 18px;
    padding: 14px;
  }

  .map-section,
  aside {
    padding: 12px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  #map {
    height: 360px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  #reset-map {
    bottom: 12px;
    left: 12px;
    padding: 10px 12px;
    font-size: 10px;
  }

  #country-panel h2 {
    font-size: 1.8rem;
  }
}

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




/* ==========================================
   SPECIMEN DETAIL VIEW
   ========================================== */

.clickable-specimen {
  cursor: pointer;
  transition: background 0.2s ease;
}

.clickable-specimen:hover,
.clickable-specimen:focus-visible {
  background: #fa9c6a;
  outline: 2px solid #242321;
  outline-offset: 2px;
}

.specimen-back {
  display: block;
  margin: 0 0 24px;
  padding: 10px 14px;
  background: #f3e8ce;
  color: #242321;
  border: 2px solid #242321;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 3px 3px 0 #242321;
}

.specimen-back:hover {
  background: #fa9c6a;
}

.specimen-detail {
  border-top: 2px solid #242321;
  margin-top: 15px;
}

.specimen-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid #b5a88f;
}

.specimen-label {
  font-family: monospace;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.specimen-value {
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}




/* ==========================================
   PENCIL ATLAS — PHOTOGRAPHIC ARCHIVE
   ========================================== */

/* Small catalogue card photograph */

.catalogue-photo {
  margin-bottom: 14px;
  padding: 8px;
  background: #fffaf0;
  border: 1px solid #242321;
}

.catalogue-photo img {
  display: block;
  width: 100%;
  height: 155px;
  object-fit: cover;
  object-position: center;
}

/* Expanded specimen gallery */

.specimen-gallery {
  margin: 18px 0 24px;
}

.specimen-gallery-label {
  margin: 0 0 12px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.specimen-main-photo {
  display: block;
  width: 100%;
  padding: 10px;
  background: #fffaf0;
  border: 2px solid #242321;
  box-shadow: 4px 4px 0 #242321;
  cursor: zoom-in;
}

.specimen-main-photo img {
  display: block;
  width: 100%;
  max-height: 350px;
  object-fit: contain;
}

.specimen-photo-caption {
  margin: 12px 0;
  font-size: 12px;
  color: #48665b;
}

.specimen-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.specimen-thumbnail {
  padding: 4px;
  border: 2px solid #242321;
  background: #fffaf0;
  cursor: pointer;
}

.specimen-thumbnail.active {
  border-color: #697f75;
  box-shadow: 3px 3px 0 #697f75;
}

.specimen-thumbnail img {
  display: block;
  width: 100%;
  height: 65px;
  object-fit: cover;
}

/* Full-size viewer */

.specimen-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 30px;
  background: rgba(36, 35, 33, 0.94);
}

.specimen-lightbox img {
  display: block;
  max-width: 95%;
  max-height: 80vh;
  object-fit: contain;
}

.specimen-lightbox-close {
  align-self: flex-end;
  padding: 12px 20px;
  background: #fa9c6a;
  border: 2px solid #242321;
  font-family: monospace;
  font-weight: 700;
  cursor: pointer;
}


/* Compact catalogue metadata */

.pencil-metadata {
  margin: 6px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #68645d;
  letter-spacing: 0.01em;
}




/* ==========================================
   PENCIL ATLAS — COLLECTION STATISTICS
   ========================================== */

.atlas-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.atlas-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.atlas-stat-number {
  font-family: var(--font-label);
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.2;
}

.atlas-stat-label {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.atlas-progress {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-label);
  font-size: 10px;
  text-transform: uppercase;
}

.atlas-progress-track {
  width: 100%;
  height: 9px;
  background: var(--paper);
  border: 1px solid var(--ink);
}

.atlas-progress-fill {
  width: 0;
  height: 100%;
  background: var(--sage);
  transition: width 0.3s ease;
}

@media (max-width: 600px) {
  .atlas-stats {
    gap: 14px;
  }

  .atlas-stat-number {
    font-size: 22px;
  }
}




/* ATLAS FILTER CONTROLS */

.toolbar {
  align-items: flex-end;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.toolbar-field select {
  max-width: 100%;
}

@media (max-width: 600px) {
  .toolbar-field,
  .toolbar > select {
    width: 100%;
  }

  .toolbar-field select {
    width: 100%;
  }
}

/* SEARCH THE ATLAS */
.atlas-search { margin-bottom: 18px; }
.atlas-search-heading { margin: 0 0 12px; font: 700 11px var(--font-label); letter-spacing: 1px; }
.atlas-search-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.atlas-search-fields .toolbar-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.atlas-search-fields label { font: 700 10px var(--font-label); text-transform: uppercase; }
.atlas-search-fields select { width: 100%; min-width: 0; padding: 10px 22px 10px 8px; font-size: 11px; }
.atlas-search-actions { display: flex; gap: 10px; margin-top: 12px; }
.atlas-search-actions button { border: 2px solid var(--ink); padding: 10px 15px; font: 700 11px var(--font-label); text-transform: uppercase; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }
.atlas-search-button { background: var(--orange); }
.atlas-clear-button { background: var(--paper); }
.atlas-search-actions button:hover { background: var(--sage-light); }
@media (max-width: 700px) { .atlas-search-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }




/* MAP LOADING INDICATOR */

#map-loading {
  position: absolute;
  inset: 2px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: var(--ocean);
  color: var(--ink);
  font-family: var(--font-label);
  text-align: center;
}

#map-loading[hidden] {
  display: none;
}

.atlas-loader-globe {
  font-size: 64px;
  line-height: 1;
}

.atlas-loader-ring {
  width: 64px;
  height: 6px;
  background: var(--paper);
  border: 1px solid var(--ink);
  overflow: hidden;
  position: relative;
}

.atlas-loader-ring::after {
  content: "";
  position: absolute;
  width: 40%;
  height: 100%;
  left: -40%;
  background: var(--orange);
  animation: atlas-loading 1.2s ease-in-out infinite;
}

#map-loading strong {
  font-size: 13px;
  letter-spacing: 2px;
}

#map-loading span {
  font-size: 11px;
  color: var(--muted);
}

@keyframes atlas-loading {
  to { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-loader-ring::after {
    animation: none;
    left: 30%;
  }
}



/* SPECIMEN COUNTRY + COLLECTION BADGES */

.pencil-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pencil-badges .pencil-status {
  margin-top: 0;
}

.pencil-country-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--cream);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  text-transform: uppercase;
}
