/* ============================================
   TOPOGRAPHIC MAP PORTFOLIO — Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,300;0,400;0,600;1,400&family=DM+Mono:wght@400&display=swap');

@font-face {
  font-family: 'Commit Mono';
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/commit-mono@latest/latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Commit Mono';
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/commit-mono@latest/latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f7f5ef;
  --bg-card: #f9f7f2;

  --peak-about: #2D6A9F;
  --peak-experience: #3A7D44;
  --peak-skills: #D4762C;
  --peak-podcast: #7B4FA2;
  --peak-blog: #B85C38;
  --peak-contact: #2A9D8F;

  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #999;
  --text-label: #aaa;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);

  /* Display/titles: Commit Mono (clean, technical, cool) */
  --font-display: 'Commit Mono', 'Space Mono', monospace;
  /* Body text in popovers: Spectral (readable serif) */
  --font-body: 'Spectral', Georgia, serif;
  /* Small data labels: DM Mono */
  --font-mono: 'Commit Mono', 'DM Mono', monospace;

  --transition-fast: 0.15s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ---- Map Container ---- */

.map-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  cursor: crosshair;
}

.topo-map { width: 100%; height: 100%; display: block; }
.topo-map.interactive .peak-hit-target:hover { cursor: pointer; }
.peak-hit-target:focus, .peak-hit-target:focus-visible { outline: none; }

/* ---- Header ---- */

.map-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 30px 32px;
  z-index: 100;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.map-header.visible { pointer-events: auto; }

.map-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-transform: lowercase;
}

.map-title span {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 24px;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.map-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.map-nav a {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  text-decoration: none;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  text-transform: lowercase;
  transition: all var(--transition-fast);
  pointer-events: auto;
  padding: 6px 12px;
  border: 1px solid transparent;
}

.map-nav a:hover {
  color: var(--text-primary);
  border-color: #555;
}

/* ---- SVG Text Styles ---- */

.coord-label {
  font-family: 'DM Mono', monospace;
  font-size: 8.5px;
  fill: var(--text-label);
}

.peak-label-bg { opacity: 0; }

.peak-label {
  font-family: 'Commit Mono', 'Space Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  fill: var(--text-primary);
  letter-spacing: -0.02em;
  opacity: 0;
}

.peak-elevation-label {
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  fill: var(--text-muted);
  opacity: 0;
}

.peak-marker {
  opacity: 0;
  transition: transform 0.15s ease;
}

.elevation-label {
  font-family: 'DM Mono', monospace;
  font-size: 6px;
  fill: var(--text-label);
  opacity: 0;
}

.river-label {
  font-family: var(--font-body);
  font-size: 7.5px;
  fill: rgba(70, 130, 180, 0.45);
  font-style: italic;
  letter-spacing: 0.12em;
}

/* Annotation styles */
.annotation-italic {
  font-family: var(--font-body);
  font-size: 7.5px;
  font-style: italic;
  fill: rgba(0, 0, 0, 0.34);
  letter-spacing: 0.03em;
}

.annotation-latin {
  font-family: var(--font-body);
  font-size: 8.5px;
  font-style: italic;
  fill: rgba(0, 0, 0, 0.19);
  letter-spacing: 0.08em;
}

.annotation-small {
  font-family: 'DM Mono', monospace;
  font-size: 6px;
  fill: rgba(0, 0, 0, 0.26);
  letter-spacing: 0.04em;
}

.compass-n {
  font-family: 'Commit Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  fill: #c0392b;
}

.compass-label {
  font-family: 'DM Mono', monospace;
  font-size: 8.5px;
  fill: var(--text-muted);
}

.scale-label {
  font-family: 'DM Mono', monospace;
  font-size: 7px;
  fill: var(--text-secondary);
}

.scale-title {
  font-family: 'DM Mono', monospace;
  font-size: 6.5px;
  fill: var(--text-muted);
  letter-spacing: 0.06em;
}

.trail-label {
  font-family: 'DM Mono', monospace;
  font-size: 6px;
  fill: rgba(139, 105, 20, 0.45);
}

.trail-year {
  font-family: 'DM Mono', monospace;
  font-size: 6px;
  fill: rgba(139, 105, 20, 0.45);
}

.here-label {
  font-family: 'Commit Mono', monospace;
  font-size: 9px;
  fill: #c0392b;
  letter-spacing: 0.02em;
}

.here-sublabel {
  font-family: 'Commit Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  fill: var(--text-primary);
}

/* Legend */
.legend-title {
  font-family: 'Commit Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  fill: var(--text-primary);
  letter-spacing: 0.02em;
}

.legend-item {
  font-family: 'Commit Mono', monospace;
  font-size: 7px;
  fill: var(--text-secondary);
}

.contour-outer {
  transition: none;
  will-change: auto;
}

.lake-label {
  font-family: var(--font-body);
  font-size: 6.5px;
  font-style: italic;
  fill: rgba(70, 130, 200, 0.54);
  letter-spacing: 0.06em;
}

.forest-label {
  font-family: var(--font-body);
  font-size: 6px;
  font-style: italic;
  fill: rgba(80, 120, 60, 0.48);
  letter-spacing: 0.06em;
}

.marsh-label {
  font-family: var(--font-body);
  font-size: 5.5px;
  font-style: italic;
  fill: rgba(70, 140, 120, 0.48);
  letter-spacing: 0.06em;
}

.here-pulse {
  animation: herePulse 2s ease-in-out infinite;
}

@keyframes herePulse {
  0%, 100% { r: 12; opacity: 0.3; }
  50% { r: 18; opacity: 0; }
}

/* ---- Contour Rings ---- */

.contour-ring {
}

/* ---- Tooltip ---- */

.peak-tooltip {
  position: fixed;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 50;
  transform: translateX(-50%);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ---- Hint ---- */

.map-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  opacity: 0;
  z-index: 50;
  text-align: center;
}

.map-hint::before {
  content: '';
  display: block;
  width: 1px;
  height: 20px;
  background: var(--text-muted);
  margin: 0 auto 8px;
  opacity: 0.3;
}

/* ---- Popovers ---- */

.popover {
  position: fixed;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  width: 440px;
  max-height: 80vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  z-index: 200;
  display: none;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
}

.popover.active { display: flex; }

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Peak-specific top border on the popover itself (respects border-radius) */

.popover-header h2 {
  font-family: 'Commit Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-transform: lowercase;
}

.popover-elevation {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.popover-close {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  line-height: 1;
  margin-left: 12px;
  flex-shrink: 0;
}

.popover-close:hover {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

.popover-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.7;
}

.popover-body p {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.popover-body p:last-child { margin-bottom: 0; }

.popover-body .highlight {
  color: var(--text-primary);
  font-weight: 600;
}

/* Peak border colors — on the popover container so they respect border-radius */
.popover[data-peak="about"] { border-top: 3px solid var(--peak-about); }
.popover[data-peak="experience"] { border-top: 3px solid var(--peak-experience); }
.popover[data-peak="skills"] { border-top: 3px solid var(--peak-skills); }
.popover[data-peak="podcast"] { border-top: 3px solid var(--peak-podcast); }
.popover[data-peak="blog"] { border-top: 3px solid var(--peak-blog); }
.popover[data-peak="contact"] { border-top: 3px solid var(--peak-contact); }

/* ---- Stats ---- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-card {
  text-align: center;
  padding: 14px 8px;
  border: 1px solid var(--border);
}

.stat-number {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ---- Experience ---- */

.experience-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.experience-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.experience-company {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.experience-title {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.experience-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 16px;
}

.experience-description {
  font-size: 15px !important;
  color: var(--text-secondary);
  margin-bottom: 10px !important;
  line-height: 1.6;
}

.experience-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.experience-tag {
  font-family: 'Commit Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---- Skills ---- */

.skill-category { margin-bottom: 18px; }
.skill-category:last-child { margin-bottom: 0; }

.skill-category h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.skill-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ---- Podcast ---- */

.podcast-stats { display: flex; gap: 24px; margin: 16px 0; }

.podcast-stat-number {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.podcast-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.podcast-links { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.podcast-link {
  font-family: var(--font-display);
  font-size: 12px;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.podcast-link:hover { border-color: var(--text-primary); color: var(--text-primary); }

.podcast-link.primary {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}

.podcast-link.primary:hover { background: var(--text-secondary); }

/* ---- Blog ---- */

.blog-item {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.blog-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.blog-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.blog-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.blog-excerpt {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Contact ---- */

.contact-links { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 15px;
  transition: color var(--transition-fast);
}

.contact-link:hover { color: var(--text-primary); }
.contact-link i { width: 20px; text-align: center; color: var(--text-muted); }

.social-grid { display: flex; gap: 12px; margin-top: 16px; }

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 17px;
  transition: all var(--transition-fast);
}

.social-icon:hover { border-color: var(--text-primary); color: var(--text-primary); }

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .popover { right: 20px; width: 400px; }
}

@media (max-width: 768px) {
  .map-header { display: none; }
  .map-hint { font-size: 11px; bottom: 16px; }

  body { overflow-y: auto; height: auto; }
  .map-container { display: none; }
  .map-hint { display: none; }
  .peak-tooltip { display: none; }
  .mobile-layout { display: flex !important; }

  .popover {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-height: 70vh;
    border-radius: 16px 16px 0 0;
    border: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.1);
    transform: none;
  }

  .popover-header {
    padding: 16px 20px;
    position: relative;
  }

  .popover-header::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 32px; height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
  }

  .popover-body { padding: 16px 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .experience-header { flex-direction: column; }
  .experience-date { margin-left: 0; margin-top: 4px; }
  .podcast-stats { flex-wrap: wrap; }
  .peak-tooltip { display: none; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .popover { max-height: 80vh; }
}

/* ---- Scrollbar ---- */
.popover-body::-webkit-scrollbar { width: 4px; }
.popover-body::-webkit-scrollbar-track { background: transparent; }
.popover-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ---- Mobile Layout ---- */

.mobile-layout {
  display: none;
  flex-direction: column;
  padding: 0 24px 60px;
  gap: 0;
  min-height: 100vh;
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.mobile-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  color: var(--text-primary);
  margin-bottom: 4px;
  text-transform: lowercase;
}

.mobile-subtitle {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.mobile-peak-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-peak-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
}

.mobile-peak-item:first-child {
  border-top: 1px solid var(--border);
}

.mobile-peak-marker {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.mobile-peak-info {
  flex: 1;
}

.mobile-peak-name {
  font-family: 'Commit Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.mobile-peak-elev {
  font-family: 'Commit Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-peak-arrow {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-muted);
}

.mobile-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.mobile-footer-label {
  font-family: 'Commit Mono', monospace;
  font-size: 10px;
  color: #c0392b;
  margin-bottom: 4px;
}

.mobile-footer-location {
  font-family: 'Commit Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.mobile-nav {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.mobile-nav a {
  font-family: 'Commit Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
}

.mobile-nav a:active {
  border-color: #555;
  color: var(--text-primary);
}

@media print { .popover, .map-hint, .peak-tooltip, .mobile-layout { display: none; } }
