* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; cursor: none; }

:root {
  --bg: #0a0a0a;
  --bg-panel: #131313;
  --amber: #ffb000;
  --amber-dim: #a86f00;
  --text: #d8d5cc;
  --text-dim: #6b6b64;
  --border: #2a2a26;
  --red: #e0605a;
}

body { font-family: 'JetBrains Mono', monospace; background: var(--bg); color: var(--text); }

@media (hover: none) { html, body { cursor: auto; } }

/* ---------- BOOT SCREEN ---------- */
#boot-screen {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; transition: opacity 0.5s ease;
}
#boot-screen.hidden { opacity: 0; pointer-events: none; }
#boot-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(11px, 1.6vw, 15px);
  color: var(--amber);
  white-space: pre-wrap;
  max-width: 600px;
}

/* ---------- CRT POWER-ON ---------- */
#crt-on {
  position: fixed; inset: 0; z-index: 300; background: #000;
  display: flex; align-items: center; justify-content: center;
}
#crt-on::before {
  content: ''; display: block; width: 0%; height: 3px;
  background: var(--amber); box-shadow: 0 0 20px 4px var(--amber);
  animation: crtLine 0.35s ease-out forwards;
}
#crt-on.expand::before { animation: crtExpand 0.4s ease-in forwards; }
#crt-on.hide { opacity: 0; transition: opacity 0.2s ease; pointer-events: none; }
@keyframes crtLine { from { width: 0%; } to { width: 100%; } }
@keyframes crtExpand { from { height: 3px; } to { height: 100vh; } }

/* ---------- MATRIX CANVAS ---------- */
#matrix-canvas { position: fixed; inset: 0; z-index: -1; opacity: 0.12; transition: opacity 0.6s ease; }
#matrix-canvas.idle-intense { opacity: 0.35; }

/* ---------- SCANLINES ---------- */
.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.025) 0px, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 3px);
  animation: flicker 6s infinite;
}
@keyframes flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: 0.85; } 98% { opacity: 1; } }

/* ---------- CUSTOM CURSOR ---------- */
#cursor-dot, #cursor-ring {
  position: fixed; top: 0; left: 0; border-radius: 50%;
  pointer-events: none; z-index: 90; transform: translate(-50%, -50%);
}
#cursor-dot { width: 6px; height: 6px; background: var(--amber); }
#cursor-ring { width: 30px; height: 30px; border: 1px solid var(--amber-dim); }
@media (hover: none) { #cursor-dot, #cursor-ring { display: none; } }

/* ---------- IDLE SCREENSAVER ---------- */
#idle-bouncer {
  position: fixed; font-size: 28px; color: var(--amber);
  z-index: 70; pointer-events: none; display: none;
}
#idle-bouncer.active { display: block; }

/* ---------- NOTIFICATIONS ---------- */
#notif-container {
  position: fixed; bottom: 20px; left: 20px; z-index: 35;
  display: flex; flex-direction: column; gap: 8px;
}
.notif {
  background: var(--bg-panel); border: 1px solid var(--border); border-left: 3px solid var(--amber);
  padding: 10px 14px; font-size: 12px; color: var(--text); border-radius: 4px;
  opacity: 0; transform: translateX(-20px); transition: opacity 0.4s ease, transform 0.4s ease;
  max-width: 260px;
}
.notif.notif-show { opacity: 1; transform: translateX(0); }
@media (max-width: 700px) { #notif-container { display: none; } }

/* ---------- SCROLL PROGRESS BAR ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 2px;
  z-index: 55; background: transparent;
}
#scroll-progress-fill {
  height: 100%; width: 0%; background: var(--amber);
  box-shadow: 0 0 8px var(--amber); transition: width 0.1s linear;
}

/* ---------- SCANLINE WIPE ON SECTION CHANGE ---------- */
#wipe-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 6px;
  background: var(--amber); box-shadow: 0 0 20px 4px var(--amber);
  z-index: 65; opacity: 0; pointer-events: none;
}
#wipe-overlay.wipe-active { animation: wipeDown 0.6s ease-out; }
@keyframes wipeDown {
  0% { opacity: 1; top: 0; }
  100% { opacity: 0; top: 100%; }
}

/* ---------- CUSTOM CONTEXT MENU ---------- */
#context-menu {
  position: fixed; z-index: 96; background: var(--bg-panel);
  border: 1px solid var(--amber-dim); border-radius: 4px; padding: 6px 0;
  min-width: 160px; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#context-menu.hidden { display: none; }
.ctx-item { padding: 8px 14px; font-size: 12px; color: var(--text); cursor: pointer; }
.ctx-item:hover { background: var(--amber); color: #0a0a0a; }

/* ---------- DEV MODE ---------- */
#dev-mode-toggle {
  position: fixed; bottom: 20px; left: 20px; z-index: 40;
  font-size: 11px; color: var(--text-dim); background: var(--bg-panel);
  border: 1px solid var(--border); padding: 8px 12px; border-radius: 4px; cursor: pointer;
}
#dev-mode-toggle:hover { color: var(--amber); border-color: var(--amber-dim); }

#dev-panel {
  position: fixed; bottom: 60px; left: 20px; z-index: 40;
  width: min(85vw, 340px); background: var(--bg-panel);
  border: 1px solid var(--amber-dim); border-radius: 6px; padding: 16px;
  font-size: 12px; line-height: 1.7; color: var(--text-dim);
}
#dev-panel.hidden { display: none; }
#dev-panel h4 { color: var(--amber); font-size: 12px; margin-bottom: 8px; }

/* ---------- ASCII CURSOR TRAIL ---------- */
.ascii-trail {
  position: fixed; font-size: 12px; color: var(--amber);
  pointer-events: none; z-index: 89; opacity: 0.8;
}

/* ---------- COMPILE TOAST (run demo) ---------- */
.compile-toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg-panel); border: 1px solid var(--amber-dim); border-radius: 6px;
  padding: 20px 26px; font-size: 13px; color: var(--amber); z-index: 97;
  text-align: left; white-space: pre-wrap;
}

/* ---------- FOOTER ---------- */
#site-footer {
  padding: 40px 10vw 40px 14vw;
  display: flex; flex-wrap: wrap; gap: 20px;
  font-size: 12px; color: var(--text-dim);
  border-top: 1px solid var(--border);
}
#site-footer a { color: var(--text-dim); text-decoration: none; transition: color 0.2s ease; }
#site-footer a:hover { color: var(--amber); }

/* ---------- GITHUB CHART / COMMIT TICKER ---------- */
#github-chart { margin: 10px 0 20px; max-width: 100%; overflow-x: auto; }
#github-chart img { max-width: 100%; filter: grayscale(0.3); }

.commit-ticker {
  width: 100%; overflow: hidden; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg-panel); padding: 10px 0;
}
.commit-ticker-track {
  display: flex; gap: 40px; width: max-content;
  animation: tickerScroll 25s linear infinite;
  font-size: 13px; color: var(--text-dim); white-space: nowrap;
}
.commit-ticker-track span { color: var(--amber-dim); }
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- GREETING LINE ---------- */
#greeting-line { color: var(--text-dim); }

/* ---------- SIDE NAV ---------- */
#side-nav {
  position: fixed; top: 50%; left: 24px; transform: translateY(-50%);
  z-index: 10; display: flex; flex-direction: column; gap: 16px;
}
.nav-link { font-size: 12px; color: var(--text-dim); text-decoration: none; display: flex; gap: 8px; transition: color 0.2s ease; }
.nav-link span { text-transform: lowercase; }
.nav-link:hover, .nav-link.active { color: var(--amber); }
.resume-link { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { #side-nav { left: 10px; gap: 10px; } .nav-link span { display: none; } }

/* ---------- SECTIONS ---------- */
.section { min-height: 100vh; padding: 100px 10vw 100px 14vw; position: relative; }
.section-label { font-size: clamp(16px, 2vw, 22px); font-weight: 700; color: var(--amber); margin-bottom: 40px; letter-spacing: 1px; }
.subsection-label { font-size: 14px; color: var(--amber-dim); margin: 40px 0 20px; }

/* ---------- HOME ---------- */
.hero-section { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.prompt-line { font-size: 14px; color: var(--text-dim); opacity: 0; animation: fadeUp 0.6s ease-out 0s forwards; }

.hero-name {
  position: relative; font-size: clamp(28px, 6vw, 58px); font-weight: 700; color: var(--text);
  text-shadow: 0 0 12px rgba(255, 176, 0, 0.25);
  opacity: 0; animation: fadeUp 0.7s ease-out 0.3s forwards;
}
.hero-name:hover::before, .hero-name:hover::after {
  content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; background: var(--bg);
}
.hero-name:hover::before { color: #ff2079; animation: glitchTop 0.3s infinite linear alternate-reverse; }
.hero-name:hover::after { color: #00fff9; animation: glitchBottom 0.3s infinite linear alternate-reverse; }
@keyframes glitchTop { 0% { clip-path: inset(0 0 90% 0); transform: translate(-2px, -2px); } 100% { clip-path: inset(0 0 0 0); transform: translate(2px, 2px); } }
@keyframes glitchBottom { 0% { clip-path: inset(90% 0 0 0); transform: translate(2px, 2px); } 100% { clip-path: inset(0 0 0 0); transform: translate(-2px, -2px); } }

.hero-tagline { font-size: clamp(16px, 2.4vw, 22px); color: var(--amber); min-height: 1.4em; opacity: 0; animation: fadeUp 0.7s ease-out 0.6s forwards; }
.cursor { display: inline-block; animation: blink 0.9s step-end infinite; color: var(--amber); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.social-icons { display: flex; gap: 22px; font-size: 22px; opacity: 0; animation: fadeUp 0.7s ease-out 0.9s forwards; }
.social-icons a { color: var(--text-dim); transition: color 0.25s ease; }
.social-icons a:hover { color: var(--amber); }

.code-window {
  margin-top: 10px; width: min(90vw, 380px); background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; text-align: left;
  opacity: 0; animation: fadeUp 0.7s ease-out 1.2s forwards;
}
#code-typer { padding: 14px; font-size: 12px; color: var(--amber); min-height: 130px; white-space: pre-wrap; }

.scroll-cue {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--text-dim); text-decoration: none; animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 6px); } }

/* ---------- REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- WORK (horizontal scroll + flip cards) ---------- */
.horizontal-wrap { position: relative; }
.horizontal-sticky { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding-left: 14vw; }
.horizontal-sticky .section-label { margin-bottom: 30px; }
.horizontal-track { display: flex; gap: 24px; width: max-content; will-change: transform; }

.project-card { width: min(80vw, 380px); flex-shrink: 0; perspective: 1000px; }

.flip-inner {
  position: relative; width: 100%; height: 320px;
  transition: transform 0.6s; transform-style: preserve-3d;
}
.flip-inner.flipped { transform: rotateY(180deg); }

.flip-front, .flip-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  transition: border-color 0.25s ease;
}
.flip-front { position: relative; }
.project-card:hover .flip-front,
.project-card:hover .flip-back { border-color: var(--amber-dim); }

.flip-back { transform: rotateY(180deg); padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.flip-back h3 { color: var(--amber); font-size: 14px; margin-bottom: 10px; }
.flip-back ul { list-style: none; font-size: 13px; color: var(--text-dim); line-height: 1.8; }
.flip-back ul li::before { content: '> '; color: var(--amber); }

.flip-trigger {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--amber-dim); color: var(--amber);
  font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.flip-trigger:hover { background: var(--amber); color: #0a0a0a; }

.term-bar-mini { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #1a1a1a; border-bottom: 1px solid var(--border); }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: #e5c07b; }
.dot.green { background: #6bad6b; }
.term-title { margin-left: 8px; font-size: 12px; color: var(--text-dim); }

.project-body { padding: 18px; }
.project-body h3 { font-size: 15px; color: var(--amber); margin-bottom: 8px; }
.project-body p { font-size: 15px; margin-bottom: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag { font-size: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); padding: 3px 9px; border-radius: 4px; }
.project-links { display: flex; gap: 16px; }
.project-links a { font-size: 13px; color: var(--text-dim); text-decoration: none; transition: color 0.2s ease; }
.project-links a:hover { color: var(--amber); }

/* ---------- PROFILE ---------- */
.profile-bio { max-width: 600px; font-size: 16px; margin-bottom: 20px; }
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.achievement-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px; padding: 20px; transition: border-color 0.25s ease; }
.achievement-card:hover { border-color: var(--amber-dim); }
.achievement-icon { font-size: 14px; color: var(--amber); display: block; margin-bottom: 8px; }
.achievement-card h3 { font-size: 14px; color: var(--amber); margin-bottom: 6px; }
.achievement-date { font-size: 13px; color: var(--text-dim); }
.achievement-card p { margin-top: 10px; font-size: 14px; }

.skills-list { max-width: 500px; }
.skill-bar { margin-bottom: 18px; }
.skill-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.skill-status { color: var(--text-dim); }
.skill-track { width: 100%; height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.skill-fill { width: 0%; height: 100%; background: var(--amber); transition: width 1.4s ease; }

/* ---------- SERVICES ---------- */
.service-item { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px; padding: 24px; margin-bottom: 24px; max-width: 500px; transition: border-color 0.25s ease; }
.service-item:hover { border-color: var(--amber-dim); }
.service-tag { font-size: 12px; color: var(--text-dim); }
.service-item h3 { font-size: 16px; color: var(--amber); margin: 10px 0; }
.quote-btn { margin-top: 14px; font-size: 13px; color: var(--amber); background: transparent; border: 1px solid var(--amber-dim); padding: 10px 16px; border-radius: 4px; cursor: pointer; }
.quote-btn:hover { background: var(--amber); color: #0a0a0a; }

/* ---------- CONTACT ---------- */
.contact-form { display: flex; flex-direction: column; gap: 6px; max-width: 500px; margin-top: 20px; }
.contact-form label { font-size: 13px; color: var(--amber-dim); margin-top: 12px; }
.contact-form input, .contact-form textarea { font-family: 'JetBrains Mono', monospace; font-size: 14px; background: var(--bg-panel); border: 1px solid var(--border); color: var(--text); padding: 10px; border-radius: 4px; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--amber); }
#submit-btn { margin-top: 18px; font-size: 13px; color: var(--amber); background: transparent; border: 1px solid var(--amber-dim); padding: 12px 20px; border-radius: 4px; cursor: pointer; }
#submit-btn:hover { background: var(--amber); color: #0a0a0a; }
#submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#form-status { margin-top: 12px; font-size: 13px; }
#form-status.success { color: var(--amber); }
#form-status.error { color: var(--red); }

/* ---------- MAGNETIC BUTTONS ---------- */
.magnetic { transition: transform 0.15s ease; }

/* ---------- TERMINAL WIDGET ---------- */
#term-toggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 40;
  font-size: 12px; color: var(--amber); background: var(--bg-panel);
  border: 1px solid var(--amber-dim); padding: 10px 14px; border-radius: 4px; cursor: pointer;
}
#term-toggle:hover { background: var(--amber); color: #0a0a0a; }

#term-widget {
  position: fixed; bottom: 70px; right: 20px; z-index: 41;
  width: min(90vw, 380px); height: 340px;
  background: var(--bg-panel); border: 1px solid var(--amber-dim); border-radius: 6px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
}
#term-widget.hidden { display: none; }
#term-widget .term-bar-mini { cursor: move; }

#term-close { cursor: pointer; }
#term-output { flex: 1; overflow-y: auto; padding: 12px; font-size: 13px; color: var(--text); white-space: pre-wrap; }
#term-output .line-amber { color: var(--amber); }
#term-output .line-dim { color: var(--text-dim); }
#term-output .line-error { color: var(--red); }

.term-input-row { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.term-input-row span { color: var(--amber); font-size: 13px; }
#term-input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ---------- MINI-GAME MODAL ---------- */
#game-modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(10,10,10,0.9);
  align-items: center; justify-content: center; display: none;
}
#game-modal:not(.hidden) { display: flex; }

.game-box { position: relative; background: var(--bg-panel); border: 1px solid var(--amber-dim); border-radius: 6px; padding: 30px; width: min(90vw, 420px); text-align: center; }
.game-box h2 { font-size: 16px; color: var(--amber); margin-bottom: 12px; }
#game-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

#game-arena { position: relative; width: 100%; height: 240px; background: var(--bg); border: 1px dashed var(--border); border-radius: 6px; margin: 16px 0; overflow: hidden; }
#game-score, #game-timer { position: absolute; top: 6px; font-size: 12px; color: var(--amber); z-index: 2; }
#game-score { left: 8px; }
#game-timer { right: 8px; }
.bug { position: absolute; width: 26px; height: 26px; font-size: 18px; background: none; border: none; cursor: pointer; }

#game-start { font-size: 13px; color: var(--amber); background: transparent; border: 1px solid var(--amber-dim); padding: 10px 18px; border-radius: 4px; cursor: pointer; }
#game-start:hover { background: var(--amber); color: #0a0a0a; }

/* ---------- SNAKE MODAL ---------- */
#snake-modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(10,10,10,0.9);
  align-items: center; justify-content: center; display: none;
}
#snake-modal:not(.hidden) { display: flex; }
.locked-tag { font-size: 10px; color: var(--amber-dim); }
#snake-canvas { background: var(--bg); border: 1px dashed var(--border); border-radius: 4px; margin: 14px 0; }
.snake-score { font-size: 13px; color: var(--amber); margin-bottom: 12px; }
#snake-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

/* ---------- KONAMI X2 ---------- */
.konami-flash { animation: konamiFlash 0.4s ease; }
@keyframes konamiFlash { 0% { filter: brightness(1); } 50% { filter: brightness(2.5) saturate(2); } 100% { filter: brightness(1); } }
.konami-flash-big { animation: konamiFlashBig 1.2s ease; }
@keyframes konamiFlashBig { 0% { filter: brightness(1); } 30% { filter: brightness(3.5) saturate(3); } 60% { filter: brightness(1.5); } 100% { filter: brightness(1); } }

/* ---------- STATS HUD ---------- */
#stats-hud {
  position: fixed; top: 20px; right: 20px; z-index: 30;
  font-size: 11px; color: var(--text-dim); background: rgba(19,19,19,0.7);
  border: 1px solid var(--border); padding: 10px 14px; border-radius: 4px; line-height: 1.8;
}
.stat-online { color: var(--amber); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (max-width: 700px) { #stats-hud { display: none; } }

/* ---------- PRINT STYLESHEET ---------- */
@media print {
  #crt-on, #boot-screen, #matrix-canvas, .scanlines, #cursor-dot, #cursor-ring,
  #idle-bouncer, #notif-container, #scroll-progress, #wipe-overlay, #context-menu,
  #dev-mode-toggle, #dev-panel, #side-nav, #term-toggle, #term-widget,
  #game-modal, #snake-modal, #stats-hud, .scroll-cue {
    display: none !important;
  }
  html, body { cursor: auto; background: #fff; color: #111; }
  .horizontal-wrap { height: auto !important; }
  .horizontal-sticky { position: static; height: auto; overflow: visible; padding-left: 0; }
  .horizontal-track { transform: none !important; flex-wrap: wrap; }
  .section { min-height: auto; padding: 20px 0; page-break-inside: avoid; }
  .section-label, .hero-name, .project-body h3, .achievement-card h3 { color: #000; }
  .project-card, .achievement-card, .service-item { border: 1px solid #ccc; background: #fafafa; }
}