/* ===== LOCAL FONTS ===== */
@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Thin.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-ThinItalic.otf') format('opentype');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-LightItalic.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-MediumItalic.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Semibold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-SemiboldItalic.otf') format('opentype');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-BoldItalic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-BlackItalic.otf') format('opentype');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-Ultra.otf') format('opentype');
  font-weight: 950;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD UI';
  src: url('../assets/fonts/md-ui/MDUITrial-UltraItalic.otf') format('opentype');
  font-weight: 950;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Thin.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-ThinItalic.otf') format('opentype');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-LightItalic.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-MediumItalic.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Semibold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-SemiboldItalic.otf') format('opentype');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-BoldItalic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-BlackItalic.otf') format('opentype');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-Ultra.otf') format('opentype');
  font-weight: 950;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MD IO';
  src: url('../assets/fonts/md-io/MDIOTrial-UltraItalic.otf') format('opentype');
  font-weight: 950;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ===== TYPOGRAPHY - FONT FAMILIES ===== */
  /* Primary: UI / navigation */
  --font-sans: 'MD UI', 'Helvetica Neue', Arial, sans-serif;
  /* Computational: mechanical/procedural (coordinates, metadata) */
  --font-mono: 'MD IO', 'Courier New', monospace;
  /* Keep only two families in the Swiss system */
  --font-serif: 'MD UI', 'Helvetica Neue', Arial, sans-serif;

  /* ===== CORE PALETTE ===== */
  --palette-white: #FFFFFF;
  --palette-gray: #F2EFEA;
  --palette-sand: #D4D4D4;
  --palette-header: #000000;
  --palette-charcoal: #1A1A1A;
  --palette-paper: var(--palette-sand);
  --palette-paper-light: var(--palette-gray);
  --palette-paper-dark: #A3A3A3;
  --palette-signal-red: #D42A14;
  --palette-signal-red-hover: #B8220F;
  --palette-signal-red-subtle: rgba(212, 42, 20, 0.12);

  /* ===== GRAYSCALE SPECTRUM ===== */
  --gray-100: #FFFFFF;
  --gray-200: #F5F5F5;
  --gray-300: #E5E5E5;
  --gray-400: #D4D4D4;
  --gray-500: #A3A3A3;
  --gray-600: #737373;
  --gray-700: #525252;
  --gray-800: #262626;
  --gray-900: #1A1A1A;

  /* Typography semantic aliases */
  --ink: var(--gray-900);
  --ink-secondary: #3A3A3A;
  --ink-muted: var(--gray-600);

  /* ===== TYPOGRAPHY SCALE ===== */
  /* 1.25 modular scale - slightly undersized, infrastructural feel */

  /* Font sizes */
  --text-2xs: 0.75rem;   /* 12px */
  --text-xs: 0.8125rem;  /* 13px - metadata */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px - body */
  --text-lg: 1.125rem;   /* 18px - emphasis */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: clamp(2rem, 4vw, 2.5rem);     /* 32-40px */
  --text-3xl: clamp(2.4rem, 5vw, 3.5rem);   /* display */
  --text-4xl: clamp(3.5rem, 8vw, 4.5rem);   /* 56-72px hero */

  /* Letter-spacing - tighter than typical web */
  --ls-tight: -0.02em;
  --ls-normal: 0;
  --ls-relaxed: 0.01em;
  --ls-wide: 0.01em;
  --ls-caps: 0.01em;

  /* Line heights - tight, infrastructural */
  --leading-none: 1.0;
  --leading-tight: 1.06;
  --leading-snug: 1.16;
  --leading-normal: 1.3;
  --leading-relaxed: 1.4;

  /* ===== SPACING SCALE (8px base) ===== */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ===== COMPONENT TOKENS ===== */
  /* Buttons */
  --btn-padding-sm: var(--space-2) var(--space-3);
  --btn-padding-md: var(--space-3) var(--space-4);
  --btn-font-size: var(--text-xs);
  --btn-letter-spacing: var(--ls-wide);

  /* Borders */
  --border-subtle: 1px solid rgba(17, 17, 17, 0.12);
  --border-medium: 1px solid rgba(17, 17, 17, 0.2);
  --border-strong: 1px solid rgba(17, 17, 17, 0.35);

  /* ===== MOTION ===== */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ===== LAYOUT ===== */
  --max-content: 1080px;
}

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

/* ===== BODY DEFAULTS ===== */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  letter-spacing: var(--ls-normal);
  color: var(--ink);
  background: var(--palette-gray);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY LAYERS ===== */

/* Layer 1: Sans - Map labels, UI, titles */
.type-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

.type-heading {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

.type-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  letter-spacing: var(--ls-relaxed);
}

.type-label-caps {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
}

/* Layer 2: Mono - Computational, coordinates, metadata */
.type-mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
  color: var(--ink-secondary);
}

.type-mono-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
}

.type-data {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* Layer 3: Body variants */
.type-caption {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  letter-spacing: 0;
}

.type-body-serif {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

/* ===== MAP-SPECIFIC TYPOGRAPHY ===== */
.map-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.map-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-2xs);
  line-height: var(--leading-tight);
  letter-spacing: var(--ls-relaxed);
  color: var(--ink);
}

.map-coords {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 9px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink-secondary);
}

.map-meta {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
  color: var(--ink-muted);
}

/* ===== GLOBAL NAV STYLES ===== */
/* Right-aligned minimal nav, matching index.html's editorial aesthetic */
.page-nav {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 100;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.page-nav.hidden {
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-6);
  text-decoration: none;
  color: var(--ink);
  font-size: var(--text-sm);
  padding: 6px 0;
  border-bottom: 1px solid var(--ink);
  transition: color var(--duration-fast) var(--ease-default);
}

.nav-item:hover {
  color: var(--palette-signal-red);
}

.nav-item:hover .nav-num {
  color: var(--palette-signal-red);
}

.nav-item.active,
.nav-item[aria-current="page"] {
  color: var(--palette-signal-red);
}

.nav-label {
  font-weight: 400;
}

.nav-num {
  font-weight: 400;
  min-width: 1.5ch;
  text-align: right;
}

@media (max-width: 768px) {
  .page-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    border-bottom: var(--border-medium);
    background: var(--palette-paper-light);
  }

  .nav-item {
    border-bottom: none;
    padding: var(--space-2) var(--space-3);
    border: var(--border-subtle);
  }
}

/* ===== SHARED BUTTON STYLES ===== */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--btn-font-size);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: var(--btn-padding-sm);
  border: var(--border-medium);
  background: var(--palette-paper-light);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
}

.btn:hover {
  background: var(--gray-200);
}

.btn:focus-visible {
  outline: 2px solid var(--gray-600);
  outline-offset: 2px;
}

/* ===== UTILITY CLASSES ===== */
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }

.uppercase { text-transform: uppercase; }
.tabular-nums { font-variant-numeric: tabular-nums; }

.text-ink { color: var(--ink); }
.text-muted { color: var(--ink-muted); }
.text-secondary { color: var(--ink-secondary); }

/* ===== SITE FOOTER ===== */
.site-footer {
  border-top: var(--border-medium);
  padding: var(--space-6) var(--space-8);
  background: var(--palette-paper);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--gray-600);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-6);
  max-width: var(--max-content);
  margin: 0 auto;
}

.footer-brand-section .footer-brand {
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: var(--space-2);
}

.footer-brand-section p {
  line-height: var(--leading-relaxed);
  max-width: 36ch;
}

.footer-section h4 {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.footer-section a {
  display: block;
  color: var(--gray-600);
  text-decoration: none;
  padding: var(--space-1) 0;
  transition: color var(--duration-fast) var(--ease-default);
}

.footer-section a:hover {
  color: var(--ink);
}

.footer-bottom {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  flex-wrap: wrap;
  max-width: var(--max-content);
  margin-left: auto;
  margin-right: auto;
}

.footer-bottom span {
  color: var(--gray-500);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-2);
  }
}
