/* -------------------------------------------------------------
   javier-website — dark, geeky, mono typography
   palette: deep charcoal background, neon purple + hot pink accents
   ------------------------------------------------------------- */

:root {
  --bg: #0b0b12;
  --bg-elev: #13131f;
  --bg-elev-2: #1b1b2b;
  --border: #2a2a3d;
  --fg: #d7d7e6;
  --fg-dim: #8a8aa3;
  --muted: #5a5a74;

  --accent: #b46cff;      /* neon purple */
  --accent-2: #ff4fbd;    /* hot pink    */
  --accent-glow: rgba(180, 108, 255, 0.35);
  --accent-2-glow: rgba(255, 79, 189, 0.35);

  --ok: #7effb4;
  --font-mono: "JetBrains Mono", "Space Mono", ui-monospace, SFMono-Regular,
               Menlo, Monaco, Consolas, monospace;

  --radius: 6px;
  --shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background grid + gradient glow — pure decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 500px at 80% -10%, var(--accent-glow), transparent 60%),
    radial-gradient(700px 450px at -10% 110%, var(--accent-2-glow), transparent 60%),
    linear-gradient(transparent 95%, rgba(255,255,255,0.03) 95%) 0 0 / 100% 22px,
    linear-gradient(90deg, transparent 95%, rgba(255,255,255,0.03) 95%) 0 0 / 22px 100%;
  z-index: -1;
}

/* Very subtle scanlines. Low opacity so it doesn't fatigue the eye. */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 1000;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
a:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }

code {
  font-family: var(--font-mono);
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-2);
  border: 1px solid var(--border);
}

.muted { color: var(--fg-dim); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 11, 18, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  border: none;
}
.brand:hover { border: none; color: inherit; }
.brand .prompt { color: var(--accent); }
.brand .brand-name { color: var(--fg); }
.brand .cursor {
  color: var(--accent-2);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.nav a {
  color: var(--fg-dim);
  border: none;
  padding: 4px 2px;
}
.nav a:hover { color: var(--accent-2); }
.nav a.active {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

/* ---------- Main / sections ---------- */

.site-main {
  padding: 48px 0 80px;
  min-height: calc(100vh - 140px);
}

.section-head {
  margin-bottom: 24px;
}
.section-head h1 {
  font-size: 28px;
  margin: 0 0 6px;
  color: var(--fg);
}
.section-head h1::before {
  content: "# ";
  color: var(--accent);
}

/* ---------- Terminal window styling (bio / contact) ---------- */

.terminal-window {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
}
.terminal-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }
.term-title {
  color: var(--muted);
  font-size: 12px;
  margin-left: 12px;
}

.terminal-body { padding: 24px 28px; }
.terminal-body .line {
  color: var(--fg-dim);
  margin: 18px 0 6px;
  font-size: 13px;
}
.prompt-arrow { color: var(--accent); margin-right: 8px; }

.hero-name {
  font-size: 34px;
  margin: 4px 0 6px;
  color: var(--fg);
  letter-spacing: -0.5px;
}
.hero-name::after {
  content: "_";
  color: var(--accent-2);
  animation: blink 1s steps(2) infinite;
  margin-left: 4px;
}
.hero-sub { margin-top: 0; }
.tagline { color: var(--fg-dim); }
.tagline-cursor {
  color: var(--accent-2);
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}

.bio p { margin: 10px 0; color: var(--fg); }

.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 4px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
}

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: all .2s;
}
.btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 20px var(--accent-glow);
  border-color: var(--accent);
}
.btn-ghost {
  border-color: var(--border);
  color: var(--fg-dim);
}
.btn-ghost:hover {
  border-color: var(--accent-2);
  color: var(--bg);
  background: var(--accent-2);
  box-shadow: 0 0 20px var(--accent-2-glow);
}

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

.map-section { max-width: 1200px; }
.map-canvas {
  height: 70vh;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #05050a;
}

/* Override Leaflet popup to match theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-elev) !important;
  color: var(--fg) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 0 20px var(--accent-glow) !important;
  border-radius: var(--radius) !important;
}
.leaflet-popup-content {
  margin: 14px 14px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}
/* Photos come in any shape — cap both dimensions and let the browser
   pick whichever one dominates so the popup stays consistently sized. */
.leaflet-popup-content img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  margin: 0 auto 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.leaflet-popup-content a { border: none; }
.leaflet-popup-content a:hover { border: none; }
.leaflet-popup-content .pop-meta { color: var(--fg-dim); font-size: 11px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--fg-dim) !important; }
.leaflet-container { background: #05050a !important; }

/* iPhone-style photo-thumbnail markers.
   The divIcon renders a square thumb on top and a tiny pointer below;
   together they read as "a pin holding a Polaroid". */
.photo-thumb-marker {
  background: transparent !important;
  border: none !important;
}
.photo-thumb-marker .thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elev-2);
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 1px var(--accent),
    0 2px 10px rgba(0, 0, 0, 0.55),
    0 0 14px var(--accent-glow);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.photo-thumb-marker:hover .thumb {
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 0 0 1px var(--accent-2),
    0 4px 14px rgba(0, 0, 0, 0.6),
    0 0 18px var(--accent-2-glow);
}
/* Small pointer below the thumbnail, in the accent colour so it matches
   the glow ring. CSS triangle via borders. */
.photo-thumb-marker .thumb-tip {
  width: 0;
  height: 0;
  margin: -1px auto 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
/* Cluster variant: slightly larger thumb + count badge. */
.photo-thumb-marker.cluster .thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}
.photo-thumb-marker .thumb-count {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(11, 11, 18, 0.85);
  color: #ffffff;
  border: 1px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  letter-spacing: 0.5px;
}
/* Hide the default markercluster circles — our icon fully replaces them. */
.marker-cluster,
.marker-cluster div,
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ---------- "Random photo" map control ----------
   Small pill button anchored top-right of the Leaflet map. */

.random-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(180, 108, 255, 0.25);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.random-photo-btn:hover {
  color: var(--accent-2);
  border-color: var(--accent-2) !important;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.5),
    0 0 14px var(--accent-2-glow);
}
.random-photo-btn:active { transform: translateY(1px); }
.random-photo-btn .rp-dice {
  font-size: 14px;
  line-height: 1;
  color: var(--accent-2);
  text-shadow: 0 0 8px var(--accent-2-glow);
}
.random-photo-btn:hover .rp-dice { color: var(--accent); }

/* ---------- Photo modal (lightbox) ----------
   Opens when a map marker is clicked. Replaces the old behaviour of
   navigating to the raw image URL in a new tab. */

.photo-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-modal.is-open { display: flex; }

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 10, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.photo-modal-content {
  position: relative;
  /* min-width keeps the close + "somewhere else" buttons from colliding
     when the image hasn't loaded yet (or the image is unusually narrow).
     Cap with 92vw so it still fits on small phones. */
  min-width: min(320px, 92vw);
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 38px 16px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 40px var(--accent-glow),
    0 10px 40px rgba(0, 0, 0, 0.6);
  animation: photo-modal-in 0.18s ease-out;
}
@keyframes photo-modal-in {
  from { transform: translateY(6px) scale(0.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.photo-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 4px 6px;
  transition: color .15s, text-shadow .15s;
}
.photo-modal-close:hover {
  color: var(--accent-2);
  text-shadow: 0 0 10px var(--accent-2-glow);
}

/* In-modal "take me somewhere else" — same neon pill vibe as the
   map's ./random control so the two controls feel related. */
.photo-modal-random {
  position: absolute;
  top: 6px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(180, 108, 255, 0.25);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.photo-modal-random:hover {
  color: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.5),
    0 0 14px var(--accent-2-glow);
}
.photo-modal-random:active { transform: translateY(1px); }
.photo-modal-random .rp-dice {
  font-size: 14px;
  line-height: 1;
  color: var(--accent-2);
  text-shadow: 0 0 8px var(--accent-2-glow);
}
.photo-modal-random:hover .rp-dice { color: var(--accent); }

.photo-modal-img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #05050a;
  /* Start invisible; JS flips .is-loaded once the image actually decodes,
     so we fade in rather than flashing a half-rendered frame. */
  opacity: 0;
  transition: opacity .3s ease;
}
.photo-modal-img.is-loaded { opacity: 1; }

/* Terminal-style blinking caret for the "loading_" meta hint. */
.photo-modal-meta .m-blink {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-2);
  animation: photo-modal-blink 1s steps(2, start) infinite;
}
@keyframes photo-modal-blink {
  to { visibility: hidden; }
}

.photo-modal-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  text-align: center;
  word-break: break-word;
}
.photo-modal-meta .m-k {
  color: var(--accent);
  margin-right: 4px;
}
.photo-modal-meta .m-sep {
  color: var(--muted);
  margin: 0 6px;
}

/* Lock page scroll while the modal is up. */
body.modal-open { overflow: hidden; }

/* Loading toast shown while a photo is being fetched ahead of the modal.
   Sits above the map but below the modal, so the user has feedback during
   slow network loads and never sees the half-rendered modal state. */
.photo-loading-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 1900;
  padding: 7px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  box-shadow:
    0 0 14px var(--accent-glow),
    0 6px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.photo-loading-toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.photo-loading-toast .lt-blink {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-2);
  animation: photo-modal-blink 1s steps(2, start) infinite;
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.gallery-item {
  margin: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.gallery-item figcaption {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--fg-dim);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gallery-item .fname {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-item .geo { color: var(--accent-2); }

.empty {
  padding: 60px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

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

.contact-list { list-style: none; padding: 0; margin: 8px 0; }
.contact-list li { margin: 8px 0; }
.contact-list .k { color: var(--accent); }
.contact-list .s { color: var(--fg-dim); margin: 0 6px; }
/* Last-ditch wrap for very long links so they never blow out the box. */
.contact-list a { overflow-wrap: anywhere; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 12px;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; gap: 10px; align-items: flex-start; }
  .nav { gap: 12px; font-size: 13px; }
  .hero-name { font-size: 22px; letter-spacing: -0.6px; }
  .map-canvas { height: 60vh; min-height: 360px; }
  /* Give the terminal body more horizontal room on phones so long
     contact lines (email, URLs) fit on a single line. */
  .terminal-body { padding: 18px 14px; }
  .contact-list { font-size: 13px; }
  .contact-list .s { margin: 0 4px; }
}

/* Extra-narrow phones — keep the full name on one line. */
@media (max-width: 380px) {
  .hero-name { font-size: 19px; letter-spacing: -0.7px; }
}
