/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg:          #0a0a0a;
  --bg-surface:  #111111;
  --bg-elevated: #161616;
  --border:      #1c1c1c;
  --border-mid:  #252525;
  --border-hi:   #333333;

  --text-1: #e0e0e0;
  --text-2: #888888;
  --text-3: #444444;

  --green:       #00ff88;
  --green-dim:   rgba(0, 255, 136, 0.08);
  --green-glow:  rgba(0, 255, 136, 0.12);
  --blue:        #5599ff;
  --blue-dim:    rgba(85, 153, 255, 0.08);
  --amber:       #f0a040;
  --amber-dim:   rgba(240, 160, 64, 0.08);
  --red:         #ff5566;

  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  --nav-h:     56px;
  --pad-x:     clamp(20px, 5vw, 40px);
  --pad-sec:   clamp(72px, 10vw, 128px);
  --max-w:     1080px;
  --radius:    4px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

ul { list-style: none; }
strong { font-weight: 600; }

/* selection */
::selection {
  background: var(--green);
  color: var(--bg);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar        { width: 4px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--border-mid); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-dim { color: var(--text-3); }

.hl        { font-style: normal; }
.hl.green  { color: var(--green); }
.hl.blue   { color: var(--blue); }
.hl.amber  { color: var(--amber); }

.arrow { color: var(--green); margin-right: 6px; }

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: border-color 0.3s;
}

#nav.scrolled { border-color: var(--border-mid); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.04em;
}

.nav-logo::after {
  content: ':~$';
  color: var(--text-3);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 0.72rem;
  color: var(--text-2);
  letter-spacing: 0.02em;
  transition: color 0.15s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--green);
  transition: width 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--green); }

.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

/* ============================================================
   HERO
   ============================================================ */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 48px) var(--pad-x) 48px;
  position: relative;
}

/* very subtle scanline */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.04) 3px,
    rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.terminal-window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 80px var(--green-glow);
}

.terminal-titlebar {
  height: 38px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 7px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-title {
  font-size: 0.68rem;
  color: var(--text-3);
  margin: 0 auto;
  user-select: none;
}

.terminal-body {
  padding: 22px 24px 24px;
  min-height: 260px;
  font-size: 0.82rem;
  line-height: 1.85;
}

/* dynamically created output elements */
.t-cmd-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 1px;
}

.t-prompt {
  color: var(--green);
  flex-shrink: 0;
  user-select: none;
}

.t-cmd-text { color: var(--text-1); }

.t-output {
  color: var(--text-2);
  padding-left: 0;
}

.t-output.hi { color: var(--text-1); }

.t-dir { color: var(--blue); }

.t-blank { height: 0.55em; }

/* static prompt shown after animation */
.terminal-prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.cursor {
  color: var(--green);
  animation: blink 1.1s step-end infinite;
  line-height: 1;
  font-size: 0.88rem;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-hint {
  position: relative;
  z-index: 1;
  margin-top: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadein 1s ease 5s both;
}

.hint-arrow {
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(5px); }
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   SECTIONS — SHARED
   ============================================================ */
section {
  padding: var(--pad-sec) var(--pad-x);
  border-top: 1px solid var(--border);
}

#hero { border-top: none; }

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 48px;
}

.section-prompt {
  color: var(--green);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.section-header h2 {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.section-sub {
  color: var(--text-3);
  font-size: 0.75rem;
  margin-top: -36px;
  margin-bottom: 44px;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 64px;
  align-items: start;
}

.about-text p {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 18px;
  line-height: 1.9;
}

.about-text p:last-child { margin-bottom: 0; }

.about-text strong { color: var(--text-1); }

.sidebar-block { margin-bottom: 32px; }
.sidebar-block:last-child { margin-bottom: 0; }

.sidebar-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.sidebar-block li {
  font-size: 0.78rem;
  color: var(--text-2);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.sidebar-block li:last-child { border-bottom: none; }

/* ============================================================
   TAGS (shared between lab + projects)
   ============================================================ */
.tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  padding: 2px 8px;
  border-radius: 2px;
  user-select: none;
}

.tag.ai   { background: var(--green-dim);  color: var(--green); }
.tag.game { background: var(--blue-dim);   color: var(--blue);  }
.tag.hw   { background: var(--amber-dim);  color: var(--amber); }

/* ============================================================
   LAB
   ============================================================ */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.lab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.lab-card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 0 32px var(--green-glow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-status {
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

.card-status.active { color: var(--green); }
.card-status.wip    { color: var(--amber); }
.card-status.paused { color: var(--text-3); }

.lab-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 10px;
  line-height: 1.4;
}

.lab-card p {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.75;
  flex: 1;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 5px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  letter-spacing: 0.03em;
}

.filter-btn:hover {
  color: var(--text-2);
  border-color: var(--border-hi);
}

.filter-btn.active {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-dim);
}

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

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.project-card.hidden { display: none; }

.project-card:hover { border-color: var(--border-hi); }

.project-card > div,
.project-card > * { /* handled by inner */ }

.project-card {
  padding: 20px;
}

.proj-vis {
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.project-card h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 14px 0 10px;
  line-height: 1.4;
}

.project-card p {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.75;
  flex: 1;
}

.proj-links {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.link-arr {
  font-size: 0.72rem;
  color: var(--green);
  transition: opacity 0.15s;
}

.link-arr:hover { opacity: 0.65; }

.link-dim {
  font-size: 0.72rem;
  color: var(--text-3);
}

/* ============================================================
   GEAR
   ============================================================ */
.gear-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px 80px;
}

.gear-cat {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.spec-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  gap: 12px;
}

.spec-list li:last-child { border-bottom: none; }

.spec-k {
  color: var(--text-3);
  white-space: nowrap;
  min-width: 80px;
  flex-shrink: 0;
}

.spec-v {
  color: var(--text-2);
  text-align: right;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-intro {
  font-size: 0.88rem;
  color: var(--text-2);
  max-width: 520px;
  margin-bottom: 40px;
  line-height: 1.9;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-2);
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 360px;
  transition: border-color 0.15s, color 0.15s;
}

.contact-item:hover {
  border-color: var(--green);
  color: var(--green);
}

.contact-icon {
  color: var(--text-3);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.contact-note {
  font-size: 0.72rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  padding: 28px var(--pad-x);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  gap: 16px;
}

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .lab-grid,
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gear-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

@media (max-width: 600px) {
  :root { --pad-sec: 56px; }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.66rem;
  }

  .lab-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .terminal-body {
    padding: 16px;
    font-size: 0.76rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .filter-bar {
    flex-wrap: wrap;
  }
}

@media (max-width: 400px) {
  .nav-links a[data-section="projects"],
  .nav-links a[data-section="gear"] {
    display: none;
  }
}
