/* ──────────────────────────────────────────────────
   itguy.work — cyberpunk/space theme
   Tokens + layout + tab system + per-tab components
   ────────────────────────────────────────────────── */

:root {
  --void: #010108;
  --deep: #050518;
  --panel: rgba(5,8,30,0.85);
  --panel-solid: #07091c;
  --cyan: #00e5ff;
  --cyan-dim: #007fa8;
  --purple: #7c3aed;
  --gold: #fbbf24;
  --green: #10b981;
  --text: #c8dff0;
  --muted: #4a6a80;
  --border: rgba(0,229,255,0.12);
  --border-strong: rgba(0,229,255,0.35);
  --glow-cyan: 0 0 20px rgba(0,229,255,0.4), 0 0 60px rgba(0,229,255,0.15);
  --font-display: 'Orbitron', 'Courier New', monospace;
  --font-body: 'Rajdhani', 'Trebuchet MS', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  background: var(--void);
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: crosshair;
  min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }

/* ─── Custom scrollbars ─── */
* { scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track {
  background: rgba(1,1,8,0.4);
  border-left: 1px solid var(--border);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan-dim), rgba(0,127,168,0.4));
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cyan);
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-corner { background: transparent; }

/* ─── Background layers ─── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.nebula {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(124,58,237,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 70%, rgba(0,229,255,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 80% 30% at 50% 50%, rgba(251,191,36,0.03) 0%, transparent 70%);
  animation: nebulaDrift 30s ease-in-out infinite alternate;
}

@keyframes nebulaDrift {
  from { transform: scale(1)    rotate(0deg); opacity: 0.7; }
  to   { transform: scale(1.05) rotate(1deg); opacity: 1;   }
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
}

.cursor-ring {
  position: fixed;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0,229,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, border-color 0.2s, opacity 0.2s;
}

/* ─── App shell ─── */
.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  background: rgba(1, 1, 8, 0.35);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar > .brand { flex: 0 0 auto; }
.topbar > .search { margin-left: auto; }
.topbar > .tabs-desktop { flex: 0 0 auto; }

.brand {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.22em;
  text-decoration: none;
}
.brand span { color: var(--muted); }

/* ─── Tab bar ─── */
.tabs {
  display: flex;
  gap: 4px;
  list-style: none;
}
.tabs-mobile {
  display: none;
}

.tab-btn {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.tab-btn:hover { color: var(--cyan); }

.tab-btn[aria-selected="true"] {
  color: var(--void);
  background: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 24px rgba(0,229,255,0.25);
}

.tab-btn-num {
  display: inline-block;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.6;
}

/* ─── Tab content containers ─── */
.tab-viewport {
  flex: 1;
  position: relative;
  padding-top: 54px;
}

.tab-section {
  display: none;
  padding: 32px 32px 60px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  animation: tabIn 0.35s ease;
}

.tab-section.active {
  display: block;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── HUD panel (shared card) ─── */
.hud-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  position: relative;
  backdrop-filter: blur(10px);
}

.hud-panel::before,
.hud-panel::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
}
.hud-panel::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}
.hud-panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
}

/* ─── Section headers ─── */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.section-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ─── Buttons ─── */
.btn-primary, .btn-ghost {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 28px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  border: none;
}
.btn-primary {
  font-weight: 700;
  color: var(--void);
  background: var(--cyan);
  box-shadow: 0 0 30px rgba(0,229,255,0.3);
}
.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 50px rgba(0,229,255,0.6);
  transform: translateY(-2px);
}
.btn-ghost {
  font-weight: 600;
  color: var(--cyan);
  background: transparent;
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.05);
}

/* ──────────────────────────────────────────────────
   ABOUT tab
   ────────────────────────────────────────────────── */
.about-wrap {
  display: grid;
  grid-template-columns: minmax(0,1.3fr) minmax(0,1fr);
  gap: 24px;
}

.about-hero {
  padding: 36px 36px 40px;
}

.about-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.about-tag::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--cyan-dim);
}

.about-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5.5vw, 56px);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 14px;
  color: #fff;
}
.about-hero h1 em {
  font-style: normal;
  color: var(--cyan);
  text-shadow: 0 0 40px rgba(0,229,255,0.5);
}

.about-role {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 22px;
}

.about-summary {
  max-width: 620px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 28px;
  opacity: 0.92;
}

.about-stats {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.about-stats .stat { display: flex; flex-direction: column; gap: 4px; }
.about-stats .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1;
}
.about-stats .stat-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.about-actions .btn-primary,
.about-actions .btn-ghost {
  flex: 1;
  text-align: center;
}

/* availability + capabilities card */
.about-aside {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.avail-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: rgba(0,229,255,0.06);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-transform: uppercase;
  align-self: flex-start;
}
.avail-pill.closed {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}
.avail-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulseDot 2s ease-in-out infinite;
}
.avail-pill.closed .dot { background: var(--muted); box-shadow: none; animation: none; }

@keyframes pulseDot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.45; transform: scale(0.8); }
}

.avail-modes {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.mode-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 3px 8px;
}

.location-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.loc-icon { color: var(--cyan-dim); }

.aside-divider {
  height: 1px;
  background: var(--border);
}

.aside-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.caps-header {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}

.caps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.caps-list li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.caps-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--cyan);
}

.lang-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lang-row {
  display: grid;
  grid-template-columns: 68px 1fr 44px;
  align-items: center;
  gap: 10px;
}
.lang-name {
  font-size: 13px;
  color: var(--text);
}
.lang-bar-wrap {
  height: 2px;
  background: rgba(0,229,255,0.1);
  border-radius: 1px;
  overflow: hidden;
}
.lang-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  box-shadow: 0 0 6px rgba(0,229,255,0.5);
  border-radius: 1px;
}
.lang-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan-dim);
  letter-spacing: 0.1em;
  text-align: right;
}

.about-contact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.contact-link {
  flex: 1;
  min-width: 68px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--cyan-dim);
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 9px 8px;
  text-align: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  display: block;
}
.contact-link:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: rgba(0,229,255,0.05);
}
.contact-email-slot {
  flex: 1;
  min-width: 68px;
  display: flex;
}
.contact-email-slot a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  border: 1px solid var(--border-strong);
  padding: 9px 8px;
  background: rgba(0,229,255,0.06);
  text-align: center;
}

.email-reveal-btn {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  padding: 9px 8px;
  width: 100%;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.email-reveal-btn:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: rgba(0,229,255,0.05);
}

/* ──────────────────────────────────────────────────
   PROJECTS tab
   ────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.proj-card {
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.proj-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.proj-card:hover::before { transform: translateX(100%); }
.proj-card:hover {
  border-color: rgba(0,229,255,0.3);
  transform: translateY(-3px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.proj-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.proj-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.proj-status.live     { color: var(--cyan);  }
.proj-status.live     .dot { background: var(--cyan);  box-shadow: 0 0 6px var(--cyan); }
.proj-status.wip      { color: var(--gold);  }
.proj-status.wip      .dot { background: var(--gold);  box-shadow: 0 0 6px var(--gold); }
.proj-status.archived { color: var(--muted); }
.proj-status.archived .dot { background: var(--muted); }

.proj-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.proj-tagline {
  font-size: 13px;
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.proj-body p, .proj-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.88;
  margin-bottom: 6px;
}
.proj-body p strong {
  color: var(--cyan);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 6px;
}

.proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.proj-stack .chip {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  border: 1px solid rgba(0,229,255,0.2);
  padding: 3px 8px;
}

.proj-actions {
  margin-top: auto;
  display: flex;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.proj-actions a, .proj-actions button {
  color: var(--cyan);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  transition: color 0.2s;
}
.proj-actions a:hover, .proj-actions button:hover { color: #fff; }
.proj-actions .disabled { color: var(--muted); cursor: default; }

/* ──────────────────────────────────────────────────
   TIMELINE / CV tab
   ────────────────────────────────────────────────── */
.cv-top {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 20px 26px;
}

.cv-lang-strip {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.cv-lang-strip strong {
  color: var(--cyan);
  font-weight: 700;
  margin-right: 4px;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 20px 24px 20px 28px;
  margin-left: 14px;
  position: relative;
  cursor: pointer;
  border-left: 2px solid rgba(0,229,255,0.1);
  transition: border-color 0.3s, background 0.3s;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--void);
  border: 2px solid var(--muted);
  transition: all 0.3s;
}
.timeline-item:hover,
.timeline-item.open {
  border-color: var(--cyan);
}
.timeline-item:hover::before,
.timeline-item.open::before {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,229,255,0.6), 0 0 24px rgba(0,229,255,0.3);
}
.timeline-item.open {
  background: linear-gradient(90deg, rgba(0,229,255,0.04), transparent);
}

.ti-period {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-top: 3px;
  line-height: 1.4;
}
.ti-company {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 6px;
}
.ti-role {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}
.ti-summary {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
}
.ti-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s;
  opacity: 0;
}
.timeline-item.open .ti-detail {
  max-height: 800px;
  opacity: 1;
  padding-top: 14px;
}
.ti-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ti-bullets li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.88;
}
.ti-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--cyan);
}

.ti-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ti-skills .chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text);
  background: rgba(0,229,255,0.04);
  border: 1px solid var(--border);
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ti-skills .chip:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: rgba(0,229,255,0.1);
}

.cv-edu {
  margin-top: 32px;
  padding: 22px 26px;
}
.cv-edu h3 {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
}
.cv-edu ul { list-style: none; }
.cv-edu li {
  font-size: 13.5px;
  color: var(--text);
  padding: 6px 0;
}
.cv-edu li strong { color: #fff; font-family: var(--font-display); }
.cv-edu li em { color: var(--muted); font-style: normal; }

/* ──────────────────────────────────────────────────
   CONSTELLATION tab
   ────────────────────────────────────────────────── */
.const-section {
  padding: 0 !important;
  max-width: 100% !important;
}

.const-wrap {
  position: relative;
  height: 100vh;
  min-height: 520px;
  width: 100%;
  overflow: hidden;
  background: transparent;
}

/* Full-bleed the constellation tab so the cluster gets the whole viewport.
   Pull up by 54px so the canvas starts at y=0, letting the topbar
   backdrop-filter sample real Three.js stars instead of empty space. */
#tab-constellation.tab-section {
  padding: 0;
  max-width: none;
  margin: 0;
  margin-top: -54px;
}

/* Hide scanlines + nebula while the 3D constellation is on screen so the
   cluster floats directly on the live starfield. */
body:has(#tab-constellation.active) .scanlines,
body:has(#tab-constellation.active) .nebula {
  opacity: 0;
}

/* Pin footer over the canvas so it's always visible without scrolling. */
body:has(#tab-constellation.active) footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Compact groups toggle — tucked into the bottom-left corner. */
.const-groups-toggle {
  position: absolute;
  left: 18px;
  bottom: calc(var(--footer-top-offset, 68px) + 8px);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(1,1,8,0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.const-groups-toggle:hover {
  color: #fff;
  border-color: var(--cyan);
  background: rgba(0,229,255,0.1);
}
.const-groups-toggle .cgt-icon { font-size: 12px; opacity: 0.8; }
.const-groups-toggle[aria-expanded="true"] {
  background: var(--cyan);
  color: var(--void);
}

.const-groups {
  position: absolute;
  left: 18px;
  bottom: calc(var(--footer-top-offset, 68px) + 54px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(1,1,8,0.82);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  min-width: 200px;
  max-width: min(260px, 80vw);
  animation: cgFadeIn 0.18s ease;
}
.const-groups[hidden] { display: none; }

@keyframes cgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.const-group-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
}
.const-group-btn .swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}
.const-group-btn:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}
.const-group-btn.active {
  background: rgba(0,229,255,0.1);
  border-color: currentColor;
}

#const-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.const-hint {
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
}

.const-label {
  position: absolute;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  background: rgba(5,8,30,0.85);
  border: 1px solid var(--cyan);
  padding: 3px 8px;
  transform: translate(14px, -50%);
  white-space: nowrap;
  z-index: 4;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  opacity: 0;
  transition: opacity 0.15s;
}
.const-label.visible { opacity: 1; }

.const-panel {
  position: absolute;
  top: 72px;
  right: 18px;
  width: 340px;
  max-height: calc(100% - 36px);
  background: rgba(5,8,30,0.92);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
  padding: 20px 22px 22px;
  z-index: 3;
  overflow: auto;
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0.35s;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.const-panel.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.const-panel .back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  padding: 4px 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
  letter-spacing: 0.05em;
}
.const-panel .back:hover { color: var(--cyan); }

.const-panel .close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.const-panel .close:hover { color: var(--cyan); }

.cp-domain {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.cp-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
  margin-bottom: 4px;
}
.cp-level {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 16px;
}
.cp-section {
  margin-top: 16px;
}
.cp-section h4 {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.cp-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cp-list li a, .cp-list li button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.cp-list li a:hover, .cp-list li button:hover {
  color: var(--cyan);
  border-color: var(--border);
  background: rgba(0,229,255,0.05);
}
.cp-list .meta {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-top: 2px;
  display: block;
}

.cp-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ──────────────────────────────────────────────────
   Footer
   ────────────────────────────────────────────────── */
footer {
  position: relative;
  z-index: 10;
  padding: 18px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(1, 1, 8, 0.35);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  gap: 12px;
}
.footer-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.15em;
}
.footer-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-hud-field {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.footer-hud-label {
  color: var(--cyan-dim);
  letter-spacing: 0.12em;
  margin-right: 3px;
}
.footer-hud-sep {
  color: var(--border);
  font-size: 9px;
}
.footer-hud-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* ──────────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .about-wrap { grid-template-columns: 1fr; }
  .about-hero { padding: 24px; }
  .const-panel { width: 82vw; }
  .timeline-item { grid-template-columns: 110px 1fr; padding: 18px 18px 18px 24px; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .tabs-desktop { display: none; }
  .tabs-mobile {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 60;
    justify-content: space-around;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
    background: transparent;
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
  }
  .tab-btn { padding: 7px 8px; font-size: 9px; letter-spacing: 0.12em; }
  .tab-btn-num { display: none; }
  .tab-section { padding: 18px 16px 90px; }
  #tab-constellation.tab-section { padding: 0; }
  .const-wrap { height: 100vh; }
  .const-groups-toggle { position: fixed; z-index: 61; left: 6px; bottom: calc(var(--footer-top-offset, 120px) + 6px); font-size: 9px; padding: 6px 10px; }
  .const-groups { position: fixed; z-index: 61; left: 6px; bottom: calc(var(--footer-top-offset, 120px) + 42px); min-width: 180px; max-width: calc(100vw - 12px); }
  .const-panel { width: calc(100vw - 24px); right: 12px; top: 66px; max-height: 60vh; }
  .timeline-item { grid-template-columns: 1fr; }
  .timeline-item::before { display: none; }
  .ti-period { padding-top: 0; }
  footer { padding: 14px 16px 90px; }
  body:has(#tab-constellation.active) footer { bottom: calc(42px + env(safe-area-inset-bottom, 0)); padding-bottom: 14px; }
}

/* === Search === */

:root {
  --topbar-h: 54px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 320px;
  min-width: 200px;
  max-width: 360px;
  margin: 0;
  padding: 0;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
  transition: color .2s;
}

.search-input {
  width: 100%;
  padding: 6px 12px 6px 30px;
  font-family: var(--font-mono, 'Space Mono', ui-monospace, monospace);
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--text);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  border-radius: 2px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.search-input::placeholder {
  color: var(--muted);
  opacity: .8;
}

.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 12px rgba(0, 229, 255, .3);
  background: rgba(0, 20, 32, .55);
}

/* Tighter desktop range: shrink search before tabs. */
@media (max-width: 900px) and (min-width: 641px) {
  .search { flex-basis: 220px; min-width: 160px; }
}

/* Mobile: brand + search only (tabs are in bottom dock). */
@media (max-width: 640px) {
  .search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }
  .search-input {
    /* 16px+ prevents iOS auto-zoom on focus. */
    font-size: 16px;
    padding: 8px 12px 8px 32px;
  }
  .search-icon { left: 12px; }
}

/* === Search results dropdown === */

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 360px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 0;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

.search-results[hidden] { display: none; }

.search-results .sr-section + .sr-section {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.search-results .sr-section-title {
  display: block;
  padding: 4px 14px;
  font-family: var(--font-mono, 'Space Mono', monospace);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
}
.search-results .sr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.search-results .sr-row:hover,
.search-results .sr-row.is-active {
  background: rgba(0, 229, 255, .07);
  border-left-color: var(--cyan);
}
.search-results .sr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-results .sr-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body, 'Rajdhani', sans-serif);
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-results .sr-meta {
  font-family: var(--font-mono, 'Space Mono', monospace);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.search-results .sr-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-results mark.search-hit {
  background: transparent;
  color: var(--cyan);
  font-weight: 700;
}
.search-results .sr-empty {
  padding: 12px 14px;
  color: var(--muted);
  font-family: var(--font-mono, 'Space Mono', monospace);
  font-size: 12px;
}

/* Mobile: full-width fixed under topbar (overrides desktop absolute). */
@media (max-width: 640px) {
  .search-results {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--topbar-h);
    min-width: 0;
    max-height: min(50dvh, 50vh);
    border-top: 1px solid var(--border);
  }
}

/* === Search arrival flash === */

@keyframes searchArrivalFlash {
  0%   { box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(0, 229, 255, .55); background-color: rgba(0, 229, 255, .10); }
  60%  { box-shadow: 0 0 0 1px rgba(0, 229, 255, .4), 0 0 8px rgba(0, 229, 255, .2); background-color: rgba(0, 229, 255, .04); }
  100% { box-shadow: 0 0 0 1px transparent, 0 0 0 transparent; background-color: transparent; }
}
.search-arrival-flash {
  animation: searchArrivalFlash 1.2s ease-out;
}
