/* ============================================================
   CLASSIFIED INTELLIGENCE DOSSIER — Theme
   ============================================================ */

:root {
  --bg-deep: #04070f;
  --bg-mid: #060c18;
  --bg-card: #080e1c;
  --primary: #4a90d9;
  --primary-dim: rgba(74, 144, 217, 0.5);
  --gold: #d4a843;
  --gold-dim: rgba(212, 168, 67, 0.5);
  --teal: #00c9a7;
  --violet: #8b6de8;
  --red: #e8324a;
  --text-primary: #e8e6e3;
  --text-muted: #8a8f98;
  --border: rgba(74, 144, 217, 0.2);
  --font-serif: "Playfair Display", Georgia, serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --font-body: "Crimson Pro", Georgia, serif;
}

/* ========== LIGHT MODE (Declassified) ========== */
html.declassified {
  --bg-deep: #f5f0e8;
  --bg-mid: #ebe5d8;
  --bg-card: #fffef8;
  --text-primary: #1a1a1a;
  --text-muted: #5a5a5a;
  --border: rgba(74, 144, 217, 0.25);
}
html.declassified body::before { opacity: 0.015; }
html.declassified body::after { opacity: 0; visibility: hidden; }
html.declassified .cursor-ring { border-color: var(--primary); }
html.declassified .cursor-dot { background: var(--primary); }
html.declassified #boot { background: var(--bg-deep); }
html.declassified .classified-watermark { color: rgba(232, 50, 74, 0.04) !important; }

/* Subtle transition when toggling theme (applied via JS only during switch) */
html.declassified-transition body,
html.declassified-transition body::before,
html.declassified-transition body::after,
html.declassified-transition #app,
html.declassified-transition #app * {
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease, opacity 0.45s ease, visibility 0.45s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* Scanline overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.15) 1px,
    rgba(0, 0, 0, 0.15) 2px
  );
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-mid); }
::-webkit-scrollbar-thumb { background: var(--primary-dim); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Canvas background */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ========== BUTTON PRESS ANIMATION ========== */
@keyframes btnPress {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.93); }
  100% { transform: scale(1); }
}
button:active,
.hero-cta:active,
.card-link:active,
.filter-btn:active,
.sidebar-nav a:active,
.cert-link:active,
.dark-light-toggle:active,
#backToTop:active {
  animation: btnPress 0.15s ease;
}

/* ========== BOOT SEQUENCE ========== */
#boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
#boot.done { opacity: 0; pointer-events: none; }

.boot-inner { text-align: center; max-width: 480px; padding: 2rem; }

.boot-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.2em;
  margin: 0 0 2.5rem;
  opacity: 0;
  animation: bootFadeIn 0.6s ease 0.2s forwards;
}

.boot-logs {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 1.5rem;
}
.boot-line { min-height: 1.4em; opacity: 0; }
.boot-line.visible { opacity: 1; animation: bootLineIn 0.2s ease; }

.boot-progress-wrap { height: 3px; background: var(--bg-card); margin-bottom: 0.75rem; overflow: hidden; }
.boot-progress-bar { height: 100%; width: 0; background: var(--primary); transition: width 0.15s linear; }
.boot-status { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin: 0; }

@keyframes bootFadeIn { to { opacity: 1; } }
@keyframes bootLineIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ========== APP WRAPPER ========== */
#app { position: relative; z-index: 1; transition: opacity 0.8s ease; }

/* ========== SIDEBAR ========== */
#sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 260px; height: 100vh;
  background: var(--bg-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header { padding: 1.5rem 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar-logo { width: 40px; height: 40px; display: block; margin-bottom: 0.75rem; }
.sidebar-subject-name {
  font-family: var(--font-serif);
  font-size: 1.1rem; font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--text-primary);
}
.sidebar-brand {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.sidebar-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
}
.status-dot {
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Dark / Light toggle */
.dark-light-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.dark-light-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* ========== SIDEBAR NAV — Scroll progress dots ========== */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  position: relative;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1.25rem 0.55rem 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: none;
  position: relative;
  transition: color 0.2s, background 0.2s;
}
.sidebar-nav a:hover { color: var(--primary); }

/* Progress dots */
.sidebar-nav a::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: border-color 0.2s, background 0.3s, box-shadow 0.3s;
  z-index: 2;
}

/* Connecting vertical line */
.sidebar-nav a::after {
  content: "";
  position: absolute;
  left: calc(1rem + 3px);
  top: calc(50% + 6px);
  width: 2px;
  height: calc(100% - 4px);
  background: var(--border);
  z-index: 1;
}
.sidebar-nav a:last-child::after { display: none; }

/* Visited state */
.sidebar-nav a.visited::before {
  border-color: var(--primary);
  background: var(--primary);
}

/* Active state — pulse */
.sidebar-nav a.active {
  color: var(--primary);
  background: rgba(74, 144, 217, 0.06);
}
.sidebar-nav a.active::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-dim);
  animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 4px var(--primary-dim); }
  50% { box-shadow: 0 0 10px var(--primary); }
}

.sidebar-filters { padding: 0 1rem 1rem; }
.sidebar-filters .filter-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, border-color 0.2s;
}
.sidebar-filters .filter-btn:hover,
.sidebar-filters .filter-btn.active {
  color: var(--primary);
  border-color: var(--primary);
}

.sidebar-clearance { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.clearance-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.clearance-bar { height: 4px; background: var(--bg-card); overflow: hidden; }
.clearance-fill { height: 100%; width: 0; background: var(--primary); transition: width 0.2s ease; }

/* ========== MAIN WRAP ========== */
#main-wrap {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== STATUS BAR ========== */
#status-bar {
  position: sticky;
  top: 0; z-index: 99;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: rgba(4, 7, 15, 0.9);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
html.declassified #status-bar { background: rgba(245, 240, 232, 0.92); }

.status-bar-left { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.class-pill { padding: 0.2rem 0.5rem; border: 1px solid; font-weight: 600; letter-spacing: 0.05em; }
.class-secret { color: var(--red); border-color: var(--red); }
.class-subject { color: var(--primary); border-color: var(--primary); }
.status-bar-name { color: var(--text-primary); }
.status-bar-location { color: var(--text-muted); }
.status-bar-clock { color: var(--primary); font-variant-numeric: tabular-nums; }

/* ========== CONTENT ========== */
#content { flex: 1; padding: 2rem 2rem 4rem; overflow: visible; }

.content-section {
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.content-section.in-view { opacity: 1; transform: translateY(0); }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  letter-spacing: 0.2em;
  margin-bottom: 0.5rem;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.75rem; font-weight: 700;
  margin: 0 0 1.5rem;
  color: var(--text-primary);
}

/* ========== HERO ========== */
#section-hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 3rem;
}
.hero-left { min-width: 0; }
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  letter-spacing: 0.25em;
  margin-bottom: 0.5rem;
}
.hero-eyebrow .cursor-blink {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-name-wrap { position: relative; margin-bottom: 0.5rem; }
.hero-name-first {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  display: block;
}
.hero-name-last {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px var(--primary);
  line-height: 1.1;
  display: block;
}
.hero-ghost-initials {
  position: absolute;
  top: -0.2em; left: 0;
  font-family: var(--font-serif);
  font-size: 4rem; font-weight: 800;
  color: var(--bg-card);
  line-height: 1;
  pointer-events: none;
  z-index: -1;
}
.hero-typewriter-wrap {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.5em;
  margin-bottom: 1rem;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.hero-tag {
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-decoration: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  transition: background 0.2s, color 0.2s;
}
.hero-cta:hover { background: var(--primary); color: var(--bg-deep); }
.hero-cta.primary { background: var(--primary); color: var(--bg-deep); }
.hero-cta.primary:hover { background: transparent; color: var(--primary); }

/* Subject File card */
.subject-file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0;
  position: relative;
}
.subject-file-card .card-image-wrap {
  width: 200px; height: 200px;
  margin: 0 auto;
  overflow: hidden;
}
.subject-file-card .card-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.subject-file-card .card-meta { padding: 1rem 1.25rem; }
.subject-file-card .meta-row {
  display: flex; justify-content: space-between;
  padding: 0.35rem 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.subject-file-card .meta-row:last-child { border-bottom: none; }
.subject-file-card .meta-key { color: var(--text-muted); }
.subject-file-card .meta-val { color: var(--text-primary); }
.subject-file-card .stamp {
  position: absolute;
  bottom: 1rem; right: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--primary);
  letter-spacing: 0.15em;
  transform: rotate(-12deg);
  opacity: 0.8;
}

/* ========== STATS BAR ========== */
#section-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}
.stat-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem;
  text-align: center;
}
.stat-number {
  font-family: var(--font-serif);
  font-size: 2.5rem; font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-number sup { font-size: 0.5em; opacity: 0.8; }
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.1em;
}

/* ========== PROFILE / PERSONNEL FILE ========== */
#section-about { display: block; }

.pf-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  margin-bottom: 0;
}
.pf-stamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--red);
  border: 2px solid var(--red);
  padding: 0.15rem 0.6rem;
  transform: rotate(-3deg);
  flex-shrink: 0;
}
.pf-header-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.pf-id-row {
  display: flex;
  gap: 2rem;
  padding: 1.5rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  align-items: center;
}
.pf-photo-wrap {
  width: 160px; height: 160px;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border);
}
.pf-photo-wrap img { width: 100%; height: 100%; object-fit: cover; }

.pf-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 2rem;
  flex: 1;
}
.pf-meta-item { display: flex; flex-direction: column; gap: 0.15rem; }
.pf-meta-key {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.pf-meta-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pf-assessment {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
}
.pf-assessment-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--primary);
  margin: 0 0 0.75rem;
}
.pf-assessment-body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}
.pf-assessment-body p { margin: 0 0 1rem; }
.pf-assessment-body p:last-child { margin-bottom: 0; }

.pf-findings {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
}
.pf-findings-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--primary);
  margin: 0 0 1rem;
}
.pf-findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.pf-finding {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-mid);
  border-left: 3px solid var(--primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
}
.pf-finding-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 1rem;
}
.pf-finding-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.3rem;
}
.pf-finding-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}

/* ========== PROJECTS / CASE FILES ========== */
#section-projects { overflow: visible; }
#section-projects .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.filter-row button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.filter-row button:hover,
.filter-row button.active {
  color: var(--primary);
  border-color: var(--primary);
}

/* Showcase — latest projects (carousel) */
.showcase-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  letter-spacing: 0.15em;
  margin-bottom: 0.75rem;
}
.showcase-carousel {
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  min-height: 200px;
}
.showcase-track {
  display: flex;
  transition: transform 0.35s ease;
  --slide-width: 100;
  position: relative;
  z-index: 0;
}
.showcase-slide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 0 0.5rem;
  box-sizing: border-box;
}
.showcase-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.showcase-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
}
.showcase-dot.active {
  background: var(--primary);
  border-color: var(--primary);
}
.showcase-dot:hover { border-color: var(--primary); }
.showcase-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.showcase-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.showcase-card img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  object-position: top;
  display: block;
}
.showcase-card .showcase-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(transparent, rgba(4, 7, 15, 0.88));
}
.showcase-card .showcase-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.showcase-card .showcase-type {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem;
  border: 1px solid;
  background: rgba(4, 7, 15, 0.7);
}
.showcase-card .showcase-type.type-code { color: var(--teal); border-color: var(--teal); }
.showcase-card .showcase-type.type-paper { color: var(--gold); border-color: var(--gold); }
.showcase-card .showcase-type.type-others { color: var(--violet); border-color: var(--violet); }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.project-card {
  position: relative;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-top: none;
  overflow: visible;
  margin-top: 20px;
  transition: border-color 0.2s, transform 0.2s;
  box-shadow: inset 0 1px 0 var(--border);
}
.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.project-card:hover .folder-tab {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.project-card.span2 { grid-column: span 2; }

/* Folder crease line */
.project-card .card-inner::before {
  content: "";
  display: block;
  border-top: 1px dashed var(--border);
  margin: 0 -1.25rem 0.75rem;
  padding: 0 1.25rem;
}

/* Folder tab */
.project-card .folder-tab {
  position: absolute;
  top: -20px;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  border: 1px solid;
  border-bottom: none;
  background: var(--bg-card);
  z-index: 2;
  transition: border-color 0.2s, color 0.2s;
}
.project-card .folder-tab.type-code { color: var(--teal); border-color: var(--teal); }
.project-card .folder-tab.type-paper { color: var(--gold); border-color: var(--gold); }
.project-card .folder-tab.type-others { color: var(--violet); border-color: var(--violet); }

/* Classified watermark */
.project-card .classified-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 2.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: rgba(232, 50, 74, 0.06);
  pointer-events: none;
  white-space: nowrap;
  z-index: 1;
  letter-spacing: 0.15em;
}

.project-card .card-image-wrap {
  height: 160px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
.project-card .card-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.project-card .card-inner {
  padding: 1rem 1.25rem;
  position: relative;
  z-index: 2;
}
.project-card .card-type-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.project-card .card-type-badge.type-code { color: var(--teal); }
.project-card .card-type-badge.type-paper { color: var(--gold); }
.project-card .card-type-badge.type-others { color: var(--violet); }

.project-card .card-title {
  font-family: var(--font-serif);
  font-size: 1rem; font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}
.project-card .card-desc {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.project-card .card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.project-card .card-tag {
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(74, 144, 217, 0.08);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.project-card .card-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.project-card .card-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.project-card .card-link:hover { text-decoration: underline; }
.project-card.hidden { display: none; }

/* ========== CERTIFICATES & BADGES ========== */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.2s;
}
.cert-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.cert-card-link:hover { border-color: var(--primary); }
.cert-card:hover { border-color: var(--primary); }

.cert-card .cert-image-wrap {
  height: 140px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-mid);
}
.cert-card .cert-image-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cert-card .cert-body { padding: 1rem; }
.cert-card .cert-name {
  font-family: var(--font-serif);
  font-size: 0.95rem; font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text-primary);
}
.cert-card .cert-issuer { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.cert-card .cert-year { font-family: var(--font-mono); font-size: 0.65rem; color: var(--primary); margin-bottom: 0.5rem; }
.cert-card .cert-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cert-card .cert-link:hover { text-decoration: underline; }

.badges-section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
/* Badges — infinite marquee */
.badges-marquee {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
}
.badges-track {
  display: flex;
  gap: 1.5rem;
  width: max-content;
  animation: marqueeScroll 30s linear infinite;
}
.badges-marquee:hover .badges-track {
  animation-play-state: paused;
}
@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.badges-track .badge-tile {
  flex-shrink: 0;
  width: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s;
}
.badges-track .badge-tile:hover { border-color: var(--primary); }
.badge-tile img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 0.5rem; }
.badge-tile .badge-name { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); line-height: 1.3; }

/* ========== SKILLS / ARSENAL INVENTORY ========== */
.arsenal-category {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.arsenal-category.in-view {
  opacity: 1;
  transform: translateY(0);
}

.arsenal-cat-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.08em;
}
.arsenal-cat-title i { font-size: 0.9rem; }

.arsenal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
}

.arsenal-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem 0.5rem;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
  opacity: 0;
  transform: translateY(12px);
  animation: tileIn 0.4s ease forwards;
  animation-delay: calc(var(--i) * 50ms);
}
.arsenal-category.in-view .arsenal-tile {
  opacity: 1;
  transform: translateY(0);
}
.arsenal-tile:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(74, 144, 217, 0.12);
}

@keyframes tileIn {
  to { opacity: 1; transform: translateY(0); }
}

.arsenal-icon {
  display: block;
  margin: 0 auto 0.5rem;
  font-size: 1.6rem;
  color: var(--text-primary);
  width: 28px; height: 28px;
  object-fit: contain;
}
img.arsenal-icon { width: 28px; height: 28px; }
i.arsenal-icon { width: auto; height: auto; line-height: 28px; }

.arsenal-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: block;
}

/* ========== EDUCATION / TIMELINE ========== */
.timeline-container {
  position: relative;
  padding: 1rem 0 2rem;
}
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 0 2.5rem 2.5rem;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.timeline-item.timeline-left {
  left: 0;
  text-align: right;
  transform: translateX(-30px);
}
.timeline-item.timeline-right {
  left: 50%;
  text-align: left;
  transform: translateX(30px);
}
.timeline-item.in-view {
  opacity: 1;
  transform: translateX(0);
  transition-delay: calc(var(--i) * 0.15s);
}

.timeline-dot {
  position: absolute;
  top: 0.5rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--bg-deep);
  z-index: 2;
  transition: background 0.3s, box-shadow 0.3s;
}
.timeline-left .timeline-dot { right: -8px; }
.timeline-right .timeline-dot { left: -8px; }
.timeline-item.in-view .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.5);
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem;
  text-align: left;
  transition: border-color 0.2s;
}
.timeline-card:hover { border-color: var(--primary); }

.timeline-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.timeline-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.timeline-card-header .edu-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--bg-mid);
  flex-shrink: 0;
}
.timeline-card-header .edu-school {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
}
.timeline-card-header .edu-level {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(var(--primary-rgb), 0.15);
  border: 1px solid var(--border);
  color: var(--primary);
}
.timeline-card .edu-course {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}
.timeline-card .edu-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 900px) {
  .timeline-line { left: 1.25rem; }
  .timeline-item {
    width: 100%;
    left: 0 !important;
    padding-left: 3rem;
    padding-right: 0;
    text-align: left !important;
    transform: translateY(20px);
  }
  .timeline-item.timeline-left,
  .timeline-item.timeline-right { transform: translateY(20px); }
  .timeline-item.in-view { transform: translateY(0); }
  .timeline-left .timeline-dot,
  .timeline-right .timeline-dot {
    left: 0.65rem;
    right: auto;
  }
}

.ops-log-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary);
  letter-spacing: 0.1em;
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ops-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.ops-entry .ops-role {
  font-family: var(--font-serif);
  font-size: 1rem; font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ops-entry .ops-org { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.ops-entry .ops-period { font-family: var(--font-mono); font-size: 0.65rem; color: var(--primary); margin-bottom: 0.5rem; }
.ops-entry ul {
  margin: 0;
  padding-left: 1.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ========== CONTACT ========== */
#section-contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.contact-blurb { font-family: var(--font-body); font-size: 1rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 1.5rem; }
.contact-rows { display: flex; flex-direction: column; gap: 0.75rem; }
.contact-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.contact-row .key {
  color: var(--text-muted);
  min-width: 100px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.contact-row a { color: var(--primary); text-decoration: none; }
.contact-row a:hover { text-decoration: underline; }
.social-rows { margin-top: 1rem; }
.social-rows .contact-row a { display: inline-flex; align-items: center; gap: 0.5rem; }

.terminal-block {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.terminal-block .term-line { margin: 0.25rem 0; }
.terminal-block .term-prompt { color: var(--primary); }
.terminal-block .term-redacted { color: var(--text-muted); letter-spacing: 0.2em; }
.terminal-block .term-cursor {
  display: inline-block;
  width: 8px; height: 1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

/* ========== FOOTER ========== */
#footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}
#footer .footer-text { margin: 0; }
#footer .footer-easter { opacity: 0.25; transition: opacity 0.2s; }
#footer .footer-easter:hover { opacity: 1; }

/* ========== BACK TO TOP ========== */
#backToTop {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  z-index: 98;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, border-color 0.2s;
}
#backToTop.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#backToTop:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--bg-deep);
}

/* ========== CUSTOM CURSOR ========== */
.cursor-ring,
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
}
.cursor-ring {
  width: 24px; height: 24px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.15s, height 0.15s, border-color 0.15s;
}
.cursor-ring.hover { width: 40px; height: 40px; }
.cursor-dot {
  width: 4px; height: 4px;
  background: var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
@media (pointer: coarse) { .cursor-ring, .cursor-dot { display: none; } }

/* ========== RESPONSIVE 900px ========== */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  #sidebar.open { transform: translateX(0); }

  .sidebar-toggle {
    display: block;
    position: fixed;
    top: 0.75rem; left: 1rem;
    z-index: 101;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    font-size: 1.25rem;
  }

  #main-wrap { margin-left: 0; }
  #status-bar { padding-left: 4rem; }
  #section-hero { grid-template-columns: 1fr; }
  #section-stats { grid-template-columns: repeat(2, 1fr); }
  #section-contact { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.span2 { grid-column: span 1; }
  .pf-id-row { flex-direction: column; align-items: center; text-align: center; }
  .pf-meta-grid { grid-template-columns: 1fr 1fr; }
  .pf-findings-grid { grid-template-columns: 1fr; }
}

.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar-toggle { display: block; }
}
