/* ============================================================
   ASTROBLEPUS.COM — Design System
   Deep Andean / Scientific Elegance
   Adapted from loricariinae.com design system
   ============================================================ */

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

:root {
  --black:        #050709;
  --deep:         #0a0e14;
  --surface:      #0f1520;
  --panel:        #141c28;
  --border:       rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.14);

  /* Astroblepus accent: amber-gold + teal (same system, slightly warmer) */
  --gold:         #c8a96e;
  --gold-dim:     #8a7248;
  --gold-glow:    rgba(200,169,110,0.15);
  --teal:         #4ab8c8;
  --teal-dim:     #2a6878;
  --teal-glow:    rgba(74,184,200,0.12);

  --text-primary:   #e8e0d0;
  --text-secondary: #9a9080;
  --text-muted:     #5a5448;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui:      'Outfit', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --nav-h:        68px;
  --radius:       4px;
  --radius-lg:    10px;
  --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  background-color: var(--black);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Subtle mountain/water texture backgrounds ───────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 60%, rgba(74,184,200,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(200,169,110,0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Layout wrapper ──────────────────────────────────────── */
.site-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5,7,9,0.90);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 24px;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  /* vertical padding so image doesn't touch header edges */
  padding: 8px 0;
}

/* Logo image — 1:2 ratio (width:height = 1:2 → portrait)
   Height fills the usable header space, width is automatic */
.brand-logo {
  /* fill available header height minus top+bottom padding */
  height: calc(var(--nav-h) - 16px);
  width:  auto;          /* preserves 1:2 ratio naturally */
  display: block;
  object-fit: contain;
  object-position: left center;
}

/* On mobile the header shrinks to 60px → logo scales automatically */

/* Primary nav */
.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.primary-nav li { position: relative; }

.primary-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.primary-nav a:hover,
.primary-nav li.active > a {
  color: var(--gold);
  background: var(--gold-glow);
}

.primary-nav li.active > a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 14px; right: 14px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--text-secondary);
  transition: var(--transition);
}

/* Mobile overlay */
.mobile-nav {
  display: none;
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  background: rgba(5,7,9,0.97);
  backdrop-filter: blur(20px);
  z-index: 99;
  padding: 32px 24px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
  transition: color var(--transition), background var(--transition);
}
.mobile-nav a:hover { color: var(--gold); background: var(--gold-glow); }

/* ============================================================
   HERO / BANNER
   ============================================================ */
.hero {
  position: relative;
  height: 340px;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(5,7,9,0.1) 0%,
    rgba(5,7,9,0.3) 50%,
    rgba(5,7,9,0.9) 100%
  );
}

.hero-caption {
  position: absolute;
  bottom: 28px;
  left: 32px;
  right: 32px;
  animation: fadeUp 0.7s ease 0.1s both;
}

.hero-caption h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.1;
}

.hero-caption h1 em { color: var(--gold); font-style: italic; }

.hero-caption p {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 8px;
}

/* CSS-only hero fallback (no image) */
.hero-placeholder {
  height: 340px;
  background:
    radial-gradient(ellipse 100% 100% at 50% 120%, rgba(74,184,200,0.18) 0%, transparent 70%),
    linear-gradient(180deg, var(--deep) 0%, var(--black) 100%);
  display: flex;
  align-items: flex-end;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}

/* ============================================================
   PAGE BODY — shared inner layout
   ============================================================ */
.page-body {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  animation: fadeUp 0.6s ease 0.1s both;
}

.page-header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.page-label::before {
  content: '';
  display: inline-block;
  width: 18px; height: 1px;
  background: var(--teal-dim);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}
.page-title em { color: var(--gold); font-style: italic; }

/* ============================================================
   PROSE
   ============================================================ */
.prose {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.8;
}
.prose p   { margin-bottom: 16px; }
.prose a   { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-dim); transition: color var(--transition); }
.prose a:hover { color: var(--text-primary); }
.prose em  { color: var(--text-primary); font-style: italic; }
.prose strong { color: var(--text-primary); font-weight: 500; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-lg); margin: 16px 0; display: block; }

/* ============================================================
   PANEL / CARD UTILITIES
   ============================================================ */
.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.panel-label::before {
  content: '';
  display: inline-block;
  width: 18px; height: 1px;
  background: var(--teal-dim);
}

.works-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  font-style: italic;
}
.works-tag:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  padding: 36px 0 24px;
  flex-wrap: wrap;
}

.footer-brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 8px;
}

.footer-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 260px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.footer-nav a {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: color var(--transition), border-color var(--transition);
}
.footer-nav a:hover { color: var(--gold); border-color: var(--gold-dim); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ============================================================
   OVERVIEW PAGE — photo + river grid
   ============================================================ */
.country-section {
  margin-bottom: 48px;
}

.country-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.country-title em { color: var(--gold); font-style: italic; }

.specimen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2px;
  background: var(--border);
}

.specimen-card {
  background: var(--deep);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background var(--transition);
}
.specimen-card:hover { background: var(--surface); }

.specimen-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--panel);
}

.specimen-body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.specimen-drainage {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--teal-dim);
  text-transform: uppercase;
}

.specimen-river {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.river-arrow {
  color: var(--gold-dim);
  font-size: 10px;
  margin: 0 3px;
}

/* ============================================================
   SPECIES LIST PAGE
   ============================================================ */
.species-table {
  width: 100%;
  border-collapse: collapse;
}

.species-table-row {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.species-table-row:hover { background: rgba(255,255,255,0.025); }
.species-table-row:nth-child(even) { background: rgba(255,255,255,0.015); }
.species-table-row:nth-child(even):hover { background: rgba(255,255,255,0.03); }

.species-table-row td {
  padding: 11px 16px;
  font-size: 13.5px;
  vertical-align: top;
}

.species-name {
  font-style: italic;
  color: var(--gold);
  white-space: nowrap;
}

.species-author {
  font-variant: small-caps;
  font-style: normal;
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 4px;
}

.species-range {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* Alphabet jump-nav */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 28px;
}
.alpha-nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color var(--transition), border-color var(--transition);
}
.alpha-nav a:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ============================================================
   ABOUT PAGE — contact layout
   ============================================================ */
.about-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 48px;
}

.about-photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.about-photo img { width: 100%; height: auto; display: block; }

.about-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.about-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.about-link:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

.video-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  max-width: 600px;
  margin-top: 32px;
}
.video-wrap iframe {
  width: 100%; height: 100%;
  display: block; border: none;
}

/* ============================================================
   DISTRIBUTION MAP PAGE
   ============================================================ */
.map-full {
  position: relative;
  z-index: 1;
  height: calc(100vh - var(--nav-h));
  width: 100%;
}

#distMap {
  width: 100%;
  height: 100%;
  background: #0a1020;
}

.leaflet-container { background: #0a1020; }
.leaflet-popup-content-wrapper {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.7) !important;
}
.leaflet-popup-tip { background: var(--panel) !important; }
.leaflet-popup-content { font-family: var(--font-ui); font-size: 12.5px; line-height: 1.7; margin: 10px 14px !important; }
.leaflet-popup-content em { font-style: italic; color: var(--gold); }
.leaflet-popup-content a  { color: var(--teal); text-decoration: none; }

.map-popup-img {
  width: 100%;
  max-width: 200px;
  border-radius: var(--radius);
  margin-top: 8px;
  display: block;
}

/* Map loading overlay */
#mapLoading {
  position: absolute;
  inset: 0;
  background: rgba(5,7,9,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 9999;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  transition: opacity 0.35s;
}
.map-spinner {
  width: 30px; height: 30px;
  border: 2px solid var(--teal-dim);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: mapspin 0.85s linear infinite;
}
@keyframes mapspin { to { transform: rotate(360deg); } }

/* ============================================================
   QUICK-LINK CARDS (index.php)
   ============================================================ */
.quick-card {
  background: var(--deep);
  padding: 26px 22px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background var(--transition);
}
.quick-card:hover { background: var(--surface); }

.quick-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.quick-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.quick-card-arrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-dim);
  margin-top: 4px;
  transition: transform var(--transition), color var(--transition);
}
.quick-card:hover .quick-card-arrow {
  transform: translateX(4px);
  color: var(--gold);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .about-layout { grid-template-columns: 1fr; }
  .about-photo  { max-width: 180px; }

  /* Hero slightly shorter on tablets */
  .hero,
  .hero-placeholder { height: 280px; }
}

@media (max-width: 640px) {
  :root { --nav-h: 60px; }
  .primary-nav { display: none; }
  .nav-toggle  { display: flex; }
  .page-body   { padding: 24px 16px 48px; }
  .specimen-grid { grid-template-columns: 1fr; }
  .footer-inner  { flex-direction: column; gap: 20px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  /* Hero — compact on mobile */
  .hero,
  .hero-placeholder { height: 210px; }
  .hero-caption     { bottom: 18px; left: 20px; right: 20px; }

  /* avoid overlap on map */
  .map-sidebar { display: none; }
}

@media (max-width: 420px) {
  .brand-sub    { display: none; }
  /* Hide subtitle line on very small screens to save space */
  .hero-caption p { display: none; }
}
