/* ============ design tokens (swap palette here) ============ */
:root {
  --bg: #0d0f1a;
  --panel: #151827;
  --border: #232840;
  --text: #e8e9f0;
  --muted: #9aa0b8;
  --accent: #2de2e6;      /* neon cyan */
  --accent-2: #ff3864;    /* magenta */
  --accent-3: #f9c80e;    /* amber */
  --n-cyan: #00ffec; 
  --n-magenta: #ff00ce; 
  --n-green: #21ff25;
  --n-yellow: #fffc02; 
  --n-purple: #cc00ff;
  --font-head: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}

.mono { font-family: var(--font-mono); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ header ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 2rem;
  padding: 0.9rem 2rem;
  background: rgba(13, 15, 26, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--font-head);
  font-weight: 700; font-size: 1.1rem; letter-spacing: 0.06em;
  color: var(--text);
}
.site-nav { display: flex; gap: 1.4rem; }
.site-nav a {
  color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.header-links { margin-left: auto; display: flex; gap: 1.2rem; align-items: center; font-size: 0.9rem; }
.cv-btn {
  border: 1px solid var(--accent); padding: 0.25rem 0.7rem; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.cv-btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; }

/* ============ hero ============ */
.hero { border-bottom: 1px solid var(--border); }
.hero-intro { padding: 3rem 2rem 1.5rem; max-width: 1200px; }
.hero-intro h1 {
  font-family: var(--font-head); font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgba(45, 226, 230, 0.35);
}
.tagline { color: var(--accent); font-family: var(--font-mono); margin: 0.3rem 0 1rem; }
.hero-line { color: var(--muted); max-width: 60ch; }
.hero-hint { color: var(--accent-3); font-size: 0.8rem; margin-top: 1rem; }

#map {
  position: relative; height: 62vh; min-height: 420px;
  background:
    linear-gradient(rgba(45,226,230,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,226,230,0.05) 1px, transparent 1px),
    var(--panel);
  background-size: 40px 40px, 40px 40px, auto;
  border-top: 1px solid var(--border);
}
.map-pending {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 0.85rem; letter-spacing: 0.15em;
}

/* ============ sections ============ */
.section { padding: 3.5rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-title {
  color: var(--accent-2); font-size: 1rem; letter-spacing: 0.12em;
  margin-bottom: 2rem;
}
.section-sub { color: var(--muted); font-size: 0.75rem; margin: -1.4rem 0 2rem; }
.stub { color: var(--muted); font-size: 0.85rem; }

/* ============ project grid ============ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(45, 226, 230, 0.12);
}
.card-media { position: relative; aspect-ratio: 16 / 9; background: #0a0c14; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media.placeholder {
  display: grid; place-items: center;
  background:
    radial-gradient(circle at center, rgba(45,226,230,0.12), transparent 65%),
    linear-gradient(rgba(45,226,230,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,226,230,0.06) 1px, transparent 1px),
    #0a0c14;
  background-size: auto, 24px 24px, 24px 24px, auto;
}
.card-media.placeholder::after {
  content: "\2295"; /* crosshair-ish glyph */
  font-size: 2.2rem; color: var(--accent); opacity: 0.5;
}
.nda-badge {
  position: absolute; top: 0.6rem; right: 0.6rem;
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em;
  color: var(--accent-3); border: 1px solid var(--accent-3);
  padding: 0.1rem 0.5rem; border-radius: 3px;
  background: rgba(13, 15, 26, 0.8);
}
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.card-meta { display: flex; gap: 0.8rem; align-items: center; font-family: var(--font-mono); font-size: 0.75rem; }
.card-years { color: var(--accent-3); }
.card-category { color: var(--accent-2); border: 1px solid rgba(255,56,100,0.4); padding: 0.05rem 0.5rem; border-radius: 3px; }
.card-kind { color: var(--muted); }
.card h3 { font-family: var(--font-head); font-size: 1.15rem; line-height: 1.3; }
.card-location { color: var(--muted); font-size: 0.8rem; font-family: var(--font-mono); }
.card-blurb { color: var(--muted); font-size: 0.9rem; }
.card-tech { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.card-tech span {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--accent); border: 1px solid rgba(45,226,230,0.35);
  padding: 0.1rem 0.5rem; border-radius: 3px;
}
.card-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; padding-top: 0.5rem; }

/* ============ footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem; text-align: center;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.site-footer > .mono:first-child { color: var(--accent-2); letter-spacing: 0.12em; }
.footer-note { color: var(--muted); font-size: 0.75rem; margin-top: 1rem; }

/* ============ small screens ============ */
@media (max-width: 720px) {
  .site-header { flex-wrap: wrap; gap: 0.8rem; padding: 0.8rem 1rem; }
  .site-nav { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .site-nav a { font-size: 0.75rem; }
  .header-links { margin-left: 0; }
  .hero-intro, .section { padding-left: 1rem; padding-right: 1rem; }
}

/* ============ map: popups & attribution (dark theme) ============ */
.maplibregl-popup-content {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-family: var(--font-body);
  box-shadow: 0 4px 20px rgba(45, 226, 230, 0.2);
}
.maplibregl-popup-tip { border-top-color: var(--accent) !important; }
.maplibregl-popup-close-button {
  color: var(--muted); font-size: 1.1rem; right: 4px; top: 2px;
}
.popup-title { font-family: var(--font-head); font-size: 0.95rem; margin-bottom: 0.2rem; }
.popup-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent-3); margin-bottom: 0.4rem; }
.popup-loc { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); margin-bottom: 0.5rem; }
.popup-link { font-size: 0.8rem; }
.maplibregl-ctrl-attrib {
  background: rgba(13, 15, 26, 0.75) !important;
  font-family: var(--font-mono); font-size: 0.65rem;
}
.maplibregl-ctrl-attrib a { color: var(--muted); }

/* ============ map legend ============ */
.map-legend {
  position: absolute; bottom: 1rem; left: 1rem; z-index: 5;
  display: flex; gap: 1rem;
  background: rgba(13, 15, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ============ experience timeline ============ */
.timeline { display: flex; flex-direction: column; gap: 2rem; }
.t-entry {
  display: grid; grid-template-columns: 180px 1fr; gap: 1.5rem;
  padding-left: 1rem; border-left: 2px solid var(--border);
  position: relative;
}
.t-entry::before {
  content: ""; position: absolute; left: -6px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.t-when { color: var(--accent-3); font-size: 0.78rem; padding-top: 3px; }
.t-body h3 { font-family: var(--font-head); font-size: 1.05rem; }
.t-org { color: var(--accent); font-weight: 500; }
.t-place { color: var(--muted); font-size: 0.75rem; margin: 0.15rem 0 0.5rem; }
.t-body ul { padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.t-body li { margin-bottom: 0.3rem; }
.t-body p { color: var(--muted); font-size: 0.9rem; }
/* .t-entry.compact::before { background: var(--muted); box-shadow: none; }*/
.edu-title { margin-top: 3rem; }
.edu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem;
}
.edu-item {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.1rem 1.2rem;
}
.edu-item h3 { font-family: var(--font-head); font-size: 1rem; margin-bottom: 0.3rem; }

/* ============ skills ============ */
.skills-acc { display: flex; flex-direction: column; gap: 0.6rem; max-width: 900px; }
.skill-group {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
}
.skill-group summary {
  cursor: pointer; list-style: none;
  padding: 0.8rem 1.2rem;
  color: var(--accent-2); font-size: 0.8rem; letter-spacing: 0.1em;
}
.skill-group summary::-webkit-details-marker { display: none; }
.skill-group summary::after {
  content: "\25B8"; float: right; color: var(--muted);
  transition: transform 0.15s ease; font-size: 1.05rem;
}
.skill-group[open] summary::after { content: "\25BE"; color: var(--accent); }
.skill-group summary:hover { background: rgba(45, 226, 230, 0.05); }
.skill-group summary:hover::after { color: var(--accent); }
.skill-group[open] summary { border-bottom: 1px solid var(--border); }
.skill-body { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 1.1rem; }
.chip-row { display: flex; flex-direction: column; gap: 0.6rem; }
.chip-sub { color: var(--accent-3); font-size: 0.7rem; letter-spacing: 0.1em; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips span {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.2rem 0.6rem;
}
.offmap-chips span { color: var(--muted); }
.chips-structured .chip-org { font-style: normal; color: var(--muted); }
.chips-structured .chip-date { font-style: normal; color: var(--accent-3); }

@media (max-width: 720px) {
  .t-entry { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ============ project modal ============ */
.card { cursor: pointer; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 6, 12, 0.85);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 2rem 1rem;
}
.modal-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(45, 226, 230, 0.18);
  max-width: 860px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-panel .card-media { aspect-ratio: 16 / 9; }
.modal-panel .card-media video { object-fit: contain; }
.modal-close {
  position: absolute; top: 0.6rem; right: 0.8rem; z-index: 5;
  background: rgba(13, 15, 26, 0.8);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 1.3rem; line-height: 1;
  padding: 0.15rem 0.55rem; cursor: pointer;
}
.modal-close:hover { border-color: var(--accent-2); color: var(--accent-2); }
.modal-body { padding: 1.4rem 1.6rem 1.8rem; display: flex; flex-direction: column; gap: 0.8rem; }
.modal-body h2 { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.25; }
.modal-text { color: var(--muted); font-size: 0.95rem; }
.modal-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem; margin: 0.5rem 0;
}
.modal-gallery figure { margin: 0; }
.modal-gallery img, .modal-gallery video {
  width: 100%; border: 1px solid var(--border); border-radius: 6px; display: block;
}
.modal-gallery img:hover, .modal-gallery video:hover { border-color: var(--accent); }
.modal-gallery figcaption { font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; }

/* ============ modal chip groups ============ */
.chip-group-label {
  color: var(--muted); font-size: 0.68rem; letter-spacing: 0.12em;
  margin-top: 0.4rem; margin-bottom: -0.3rem;
}
.card-tech.data-chips span {
  color: var(--accent-3);
  border-color: rgba(249, 200, 14, 0.35);
}

.chip-libs {
  font-style: normal; color: var(--muted); font-size: 0.65rem;
}

.jack-stage { display: flex; justify-content: center; align-items: flex-end; padding: 3rem 0 1rem; }
.jack-card { width: 120px; height: 176px; margin: 0 -6px; perspective: 750px; }
/* THE ARC */
.jack-card:nth-child(1) { transform: rotate(-14deg) translateY(18px); }
.jack-card:nth-child(2) { transform: rotate(-5deg)  translateY(2px); }
.jack-card:nth-child(3) { transform: rotate(5deg)   translateY(2px); }
.jack-card:nth-child(4) { transform: rotate(14deg)  translateY(18px); }


.jack-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  /* THE PACING: one flip-out-and-back takes 7s; the full cycle
      incl. the upside-down round is 2 x 7s = 14s */
  animation: jackflip 7s ease-in-out infinite;
}
/* THE 180 TWIST: front face quietly rotates half a turn while the
    back is showing, so each return alternates which emblem is upright */
.jack-front { animation: frontspin 14s ease-in-out infinite; }

/* THE STAGGER: both animations delayed together per card */
/*.jack-card:nth-child(1) .jack-inner, .jack-card:nth-child(1) .jack-front { animation-delay: 0s; }
.jack-card:nth-child(2) .jack-inner, .jack-card:nth-child(2) .jack-front { animation-delay: 0.18s; }
.jack-card:nth-child(3) .jack-inner, .jack-card:nth-child(3) .jack-front { animation-delay: 0.36s; }
.jack-card:nth-child(4) .jack-inner, .jack-card:nth-child(4) .jack-front { animation-delay: 0.54s; }*/

.jack-card:nth-child(1) .jack-inner, .jack-card:nth-child(1) .jack-front { animation-delay: 2s; }
.jack-card:nth-child(2) .jack-inner, .jack-card:nth-child(2) .jack-front { animation-delay: 2.18s; }
.jack-card:nth-child(3) .jack-inner, .jack-card:nth-child(3) .jack-front { animation-delay: 2.36s; }
.jack-card:nth-child(4) .jack-inner, .jack-card:nth-child(4) .jack-front { animation-delay: 2.54s; }

@keyframes jackflip {
  0%   { transform: rotateY(0deg); }
  22%  { transform: rotateY(180deg); }
  45%  { transform: rotateY(180deg); }
  67%  { transform: rotateY(0deg); }
  100% { transform: rotateY(0deg); }
}
/* front is hidden roughly 5.5-28% and 55.5-78% of the 14s cycle;
    the two half-turns happen inside those windows */
@keyframes frontspin {
  0%    { transform: rotateZ(0deg); }
  7.5%  { transform: rotateZ(0deg); }
  17.5% { transform: rotateZ(180deg); }
  57.5% { transform: rotateZ(180deg); }
  67.5% { transform: rotateZ(360deg); }
  100%  { transform: rotateZ(360deg); }
}

.jack-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 10px; border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55); overflow: hidden;
}
.jack-front {
  background: var(--panel);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 7px 8px;
}
.corner { font-size: 0.85rem; line-height: 1.05; }
.corner.bottom { transform: rotate(180deg); align-self: flex-end; }
.emblems { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.emblems svg { width: 66px; height: 50px; margin: 0 auto; display: block; }
.emblems .divider { border-top: 1px solid currentColor; opacity: 0.3; width: 72%; margin: 0 auto; }
.emblems svg.mirror { transform: rotate(180deg); }
.suit-spade   { color: var(--n-cyan); }
.suit-heart   { color: var(--n-magenta); }
.suit-club    { color: var(--n-purple); }  /* retro green alt: swap to color: var(--n-green); */
.suit-diamond { color: var(--n-green); }  /* retro green alt: swap to color: var(--n-green); */ /* retro yellow alt: swap to color: var(--n-yellow); */
.jack-front .corner { text-shadow: 0 0 10px currentColor; }
.jack-front .emblems { filter: drop-shadow(0 0 4px currentColor); }

.jack-back { transform: rotateY(180deg); border-color: var(--n-purple); }
.jack-back svg { width: 100%; height: 100%; display: block; }

.jack-caption { text-align: center; color: var(--n-cyan); letter-spacing: 0.15em; font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
  .jack-inner, .jack-front { animation: none; }
}

/* ============ hero layout with jack deck ============ */
.hero-intro { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.hero-text { max-width: 640px; }
.hero-jack .jack-stage {padding: 1.5rem 0 2rem;}
.hero-jack .jack-card {width: 96px; height: 141px;}
.hero-jack .jack-front {padding: 5px 6px;}
.hero-jack .corner {flex: 0 0 auto; font-size: 0.7rem; line-height: 1;}
.hero-jack .emblems {min-height: 0; gap: 1px;}
.hero-jack .emblems svg {width: 50px; height: 36px; flex: 0 0 36px;}
.jack-caption {font-size: 0.7rem;}

@media (max-width: 900px) {
  .hero-jack { width: 100%; margin: 0 auto; }
  .hero-jack .jack-stage { padding: 1rem 0 1.8rem; }
  .hero-jack .jack-card { width: 78px; height: 115px; }
  .hero-jack .corner { font-size: 0.6rem; }
  .hero-jack .emblems svg { width: 42px; height: 30px; flex: 0 0 30px; }
}

/* ============ lime logo ============ */
.brand { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-logo { width: 22px; height: 22px; }
.footer-gh { display: inline-flex; align-items: center; gap: 0.35rem; }
.footer-logo { width: 16px; height: 16px; }

.hero-hint { flex: 1 1 100%; margin-top: 0; }

.map-pending { padding: 1rem; text-align: center; }