/* ============================================
   DESIGN TOKENS — "Trainer Dex" theme (dark navy variant)
   Original palette/typography inspired by handheld game UI —
   no copyrighted logos, fonts, or character art used.

   Palette:  screen #15223A (deep navy bg) · screen-raised #1E3050 (card navy)
             ink #EDE6D3 (warm parchment text) · ink-soft #93A7C2 (muted blue-gray)
             dex-red #E2483C (primary accent) · dex-blue #6FA8DC (secondary accent)
             dex-gold #E8C468 (tertiary accent) · line #2E4160 (dividers)
   Type:     "Press Start 2P" (pixel display, used sparingly — small caps only)
             Public Sans (body) · JetBrains Mono (data/meta/labels)
   ============================================ */

:root {
  --screen: #15223A;
  --screen-raised: #1E3050;
  --ink: #EDE6D3;
  --ink-soft: #93A7C2;
  --dex-red: #E2483C;
  --dex-red-soft: #3B2530;
  --dex-blue: #6FA8DC;
  --dex-blue-soft: #21324E;
  --dex-gold: #E8C468;
  --dex-gold-soft: #3A331F;
  --line: #2E4160;

  --pixel: 'Press Start 2P', monospace;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --wrap: 780px;
}

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

body {
  margin: 0;
  background-color: var(--screen);
  background-image: radial-gradient(rgba(147, 167, 194, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
a { color: inherit; }

/* ---------- DEX PAGE (standalone) ---------- */
.dex-page-head { padding: 48px 24px 32px; }
.dex-back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 18px;
}
.dex-back:hover { color: var(--dex-red); }

/* faint scanline texture instead of realistic grain — nods to a handheld screen */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background: repeating-linear-gradient(
    to bottom,
    var(--ink) 0px,
    var(--ink) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(21, 34, 58, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--ink);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.mark { font-family: var(--pixel); font-size: 13px; text-decoration: none; letter-spacing: 0.02em; }
.mark-dot { color: var(--dex-red); }
.nav { display: flex; gap: 24px; }
.nav a {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.nav a:hover { color: var(--dex-red); }

/* ---------- HERO / TRAINER CARD ---------- */
.hero { padding: 64px 24px 56px; position: relative; z-index: 1; }

.trainer-card {
  background: var(--screen-raised);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 0 22px rgba(232, 196, 104, 0.18), 0 0 0 1px rgba(232, 196, 104, 0.08);
  overflow: hidden;
  margin-bottom: 28px;
}
.card-topline {
  background: var(--dex-red);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
}
.card-label { font-family: var(--pixel); font-size: 10px; letter-spacing: 0.03em; }
.card-id { font-family: var(--mono); font-size: 12px; font-weight: 700; }

.card-body { display: flex; align-items: center; gap: 22px; padding: 24px; }
.card-photo {
  width: 104px;
  height: 104px;
  min-width: 104px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.card-name {
  font-family: var(--pixel);
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  margin: 0 0 10px;
  line-height: 1.4;
}
.card-class { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 20px;
  border: 2px solid var(--ink);
  background: var(--screen);
}
.badge-active { background: var(--dex-red); color: #fff; border-color: var(--ink); }

.hero-sub { max-width: 56ch; color: var(--ink-soft); font-size: 15.5px; margin: 0; }

/* ---------- SECTIONS ---------- */
.section { padding: 56px 24px; border-top: 3px dashed var(--line); position: relative; z-index: 1; }

.section-title {
  font-family: var(--pixel);
  font-size: 1.05rem;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.6;
}
.small-title { font-size: 0.85rem; }
.section-num { color: var(--dex-red); }
.section-note { color: var(--ink-soft); max-width: 60ch; margin: 0 0 32px; font-size: 14.5px; }

/* ---------- DEX ENTRIES ---------- */
.dex-list { display: flex; flex-direction: column; gap: 18px; }

.dex-entry {
  background: var(--screen-raised);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 4px 4px 0 var(--line);
}
.dex-entry-compact { box-shadow: 3px 3px 0 var(--line); }

.dex-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dex-num { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--ink-soft); }

.dex-type {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 4px;
  border: 2px solid var(--ink);
}
.type-code { background: var(--dex-blue-soft); color: var(--dex-blue); }
.type-speed { background: var(--dex-gold-soft); color: var(--dex-gold); }
.type-research { background: var(--dex-red-soft); color: var(--dex-red); }

.dex-status {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-left: auto;
  text-transform: uppercase;
}
.status-progress { background: var(--dex-gold-soft); color: var(--dex-gold); }
.status-hackathon { background: var(--dex-blue-soft); color: var(--dex-blue); }

.dex-title { font-family: var(--sans); font-weight: 700; font-size: 1.2rem; margin: 0 0 10px; }
.dex-desc { color: var(--ink-soft); margin: 0 0 16px; font-size: 14.5px; max-width: 62ch; }

.dex-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.dex-stack span {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  border: 2px solid var(--line);
  padding: 3px 9px;
  border-radius: 4px;
}

.dex-links { display: flex; gap: 20px; }
.dex-links a {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  color: var(--dex-red);
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.dex-links a:hover { border-color: var(--dex-red); }

.dex-add {
  background: transparent;
  border: 3px dashed var(--line);
  box-shadow: none;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
}

.side-quest { padding-top: 40px; }

.dex-teaser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--screen-raised);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 0 22px rgba(232, 196, 104, 0.18), 0 0 0 1px rgba(232, 196, 104, 0.08);
  padding: 20px 26px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dex-teaser:hover {
  transform: translate(-2px, -2px);
  box-shadow: 0 0 32px rgba(232, 196, 104, 0.32), 0 0 0 1px rgba(232, 196, 104, 0.15);
}
.dex-teaser-label { font-family: var(--pixel); font-size: 0.85rem; }
.dex-teaser-arrow { color: var(--dex-red); font-size: 1.2rem; }

/* ---------- POKÉDEX COMPONENT ---------- */
.pokedex {
  background: var(--screen-raised);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 0 22px rgba(232, 196, 104, 0.18), 0 0 0 1px rgba(232, 196, 104, 0.08);
  overflow: hidden;
}

.pokedex-tabs {
  display: flex;
  border-bottom: 3px solid var(--ink);
  background: var(--screen);
}
.pdx-tab {
  flex: 1;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.55);
  background: transparent;
  border: none;
  border-right: 2px solid rgba(255,255,255,0.1);
  padding: 12px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.pdx-tab:last-child { border-right: none; }
.pdx-tab:hover { color: #fff; }
.pdx-tab.is-active { color: #fff; background: var(--dex-red); }
.pdx-count {
  font-size: 10.5px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 1px 7px;
}
.pdx-tab.is-active .pdx-count { background: rgba(0,0,0,0.2); }

.pokedex-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: 460px;
}

.pdx-list {
  order: 2;
  border-left: 3px solid var(--line);
  border-right: none;
  overflow-y: auto;
  max-height: 560px;
  padding: 14px 10px 14px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.pdx-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--screen);
  border: 2px solid var(--ink);
  border-radius: 20px 6px 6px 20px;
  padding: 8px 14px 8px 8px;
  cursor: pointer;
  font-family: var(--sans);
  text-align: left;
  transform-origin: center center;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
}
.pdx-entry[hidden] { display: none; }
.pdx-spacer { flex-shrink: 0; }
.pdx-entry:hover {
  box-shadow: 3px 3px 0 var(--line);
  background: var(--dex-blue-soft);
}
.pdx-entry.is-selected {
  background: var(--dex-red);
  border-color: var(--ink);
  z-index: 2;
}
.pdx-entry.is-selected::before {
  content: '▶';
  position: absolute;
  left: -18px;
  color: var(--dex-red);
  font-size: 13px;
}
.pdx-entry.is-selected .pdx-flag { background: var(--ink); color: var(--dex-red); }
.pdx-entry.is-selected .pdx-name { color: #fff; }

.pdx-flag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  background: var(--ink);
  color: var(--screen);
  border-radius: 50%;
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdx-icon { font-size: 13px; color: var(--dex-gold); }
.pdx-name { font-size: 13.5px; font-weight: 600; }

.pdx-detail {
  order: 1;
  padding: 36px;
  overflow-y: auto;
  max-height: 560px;
}
.pdx-detail-empty { color: var(--ink-soft); font-family: var(--mono); font-size: 13px; }

.pdx-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pdx-detail-num { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.pdx-detail-cat {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--dex-blue-soft);
  color: var(--dex-blue);
}
.pdx-detail-title { font-family: var(--sans); font-weight: 700; font-size: 1.3rem; margin: 0 0 12px; }
.pdx-detail-location { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); font-weight: 700; margin: -6px 0 10px; }
.pdx-detail-duration { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); margin: -6px 0 14px; }
.pdx-detail-desc { color: var(--ink-soft); font-size: 14.5px; max-width: 60ch; margin: 0 0 18px; }
.pdx-detail-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pdx-detail-stack span {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  border: 2px solid var(--line);
  padding: 3px 9px;
  border-radius: 4px;
}
.pdx-detail-links a {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  color: var(--dex-red);
  margin-right: 20px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.pdx-detail-links a:hover { border-color: var(--dex-red); }

@media (max-width: 900px) {
  .pokedex-body { grid-template-columns: 1fr; }
  .pdx-list {
    order: 2;
    border-left: none;
    border-top: 3px solid var(--line);
    max-height: 280px;
    padding-left: 26px;
  }
  .pdx-detail { order: 1; max-height: none; }
}

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; }
.about-text { font-size: 15.5px; color: var(--ink-soft); max-width: 56ch; }
.facts { margin: 0; }
.facts > div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 2px solid var(--line); }
.facts dt { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.facts dd { margin: 0; font-size: 14px; font-weight: 700; text-align: right; }

/* ---------- STATS (skill bars) ---------- */
.stats-block { display: flex; flex-direction: column; gap: 16px; margin-bottom: 36px; }
.stat-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 16px; }
.stat-label { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.stat-bar {
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--screen);
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: var(--dex-red);
  border-radius: 6px 0 0 6px;
}

.skills-grid-secondary { grid-template-columns: repeat(2, 1fr); max-width: 480px; }
.skills-grid { display: grid; gap: 28px; }
.skill-group h3 {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dex-blue);
  margin: 0 0 12px;
}
.skill-group ul { list-style: none; margin: 0; padding: 0; }
.skill-group li { font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.muted { color: var(--ink-soft); font-size: 11px; }

/* ---------- CONTACT ---------- */
.contact-lead { color: var(--ink-soft); margin-bottom: 24px; }
.contact-links { display: flex; flex-direction: column; gap: 4px; }
.contact-link {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 2px solid var(--line);
  display: flex;
  justify-content: space-between;
  transition: color 0.15s ease, padding-left 0.15s ease;
}
.contact-link:hover { color: var(--dex-red); padding-left: 6px; }

/* ---------- FOOTER ---------- */
.site-footer {
  padding: 28px 24px 44px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  position: relative;
  z-index: 1;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .card-body { flex-direction: column; align-items: flex-start; }
  .nav { gap: 14px; }
  .nav a { font-size: 11.5px; }
  .stat-row { grid-template-columns: 100px 1fr; }
}
@media (max-width: 480px) {
  .hero { padding: 48px 20px 40px; }
  .skills-grid-secondary { grid-template-columns: 1fr; }
}

/* ---------- ACCESSIBILITY ---------- */
a:focus-visible, .nav a:focus-visible {
  outline: 2px solid var(--dex-red);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}