/* ============================================================
   Portfolio — CRT terminal theme
   Matches bundled-backup.html: near-black bg, glowing accent
   (green by default, switchable to amber/cyan), JetBrains Mono.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap');

:root {
  --bg: #050705;
  --panel: #070a08;
  --panel-2: #050705;
  --acc: #33ff99;
  --text-root: #d8ffe6;
  --text: #9fd9b8;
  --text-bright: #eafff0;
  --heading: #dff5e6;
  --border: color-mix(in srgb, var(--acc) 22%, transparent);
  --border-shell: color-mix(in srgb, var(--acc) 25%, transparent);
  --border-strong: color-mix(in srgb, var(--acc) 30%, transparent);
  --border-strongest: color-mix(in srgb, var(--acc) 45%, transparent);
}

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

html, body { height: 100%; scrollbar-width: thin; scrollbar-color: var(--acc) #0a0f0b; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-root);
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--acc); text-decoration: none; }
a:hover { text-shadow: 0 0 8px color-mix(in srgb, var(--acc) 70%, transparent); }

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection { background: var(--acc); color: #04140a; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0f0b; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--acc), #1a8f57); border: 2px solid #0a0f0b; border-radius: 0; box-shadow: 0 0 6px color-mix(in srgb, var(--acc) 50%, transparent); }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #6fffb8, var(--acc)); }
::-webkit-scrollbar-corner { background: #0a0f0b; }

/* ---------- background shader canvas ---------- */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  filter: blur(85px);
  opacity: 0.22;
  mix-blend-mode: screen;
}

/* ---------- animations ---------- */

@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes scan { 0% { transform: translateY(0); } 100% { transform: translateY(4px); } }
@keyframes pageIn { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes crtBreathe {
  0%, 100% { transform: rotateX(4deg) rotateY(0deg) scale(1.08); }
  50% { transform: rotateX(3.6deg) rotateY(0.3deg) scale(1.08); }
}
@keyframes blink { 50% { opacity: 0; } }

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  vertical-align: -0.15em;
  background: var(--acc);
  margin-left: 2px;
  animation: caret-blink 0.9s step-end infinite;
  box-shadow: 0 0 8px var(--acc);
}

.glow, .glow-heading {
  text-shadow:
    0 0 6px color-mix(in srgb, var(--acc) 85%, transparent),
    0 0 22px color-mix(in srgb, var(--acc) 45%, transparent),
    0 0 46px color-mix(in srgb, var(--acc) 22%, transparent);
}

.page { animation: pageIn 0.4s ease both; }

/* Permanent, subtle animated scanline overlay across the whole app —
   mirrors the reference's always-on CRT texture (separate from the
   boot-screen's bezel-only .crt-scanlines below). */
.scan { position: relative; }
.scan::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0,0,0,0.35) 3px, transparent 4px);
  mix-blend-mode: overlay;
  animation: scan 0.6s linear infinite;
}

/* ---------- shell / layout ---------- */

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 40px; }
.shell { max-width: 1200px; margin: 0 auto 60px; border: 1px solid var(--border-shell); background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,0.5); }

/* ---------- accent toggle ---------- */

.accent-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
}

/* ---------- terminal buttons / tags / cards / inputs ---------- */

.term-btn {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--acc);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--acc) 55%, transparent);
  padding: 11px 20px;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.term-btn:hover { background: color-mix(in srgb, var(--acc) 10%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--acc) 40%, transparent); }
.term-btn.solid { background: var(--acc); color: #04140a; font-weight: 700; }
.term-btn.solid:hover { box-shadow: 0 0 18px color-mix(in srgb, var(--acc) 60%, transparent); }
.term-btn.small { font-size: 12px; padding: 9px 14px; }

.term-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent);
  color: var(--acc);
  padding: 4px 9px;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.term-tag.solid { background: var(--acc); color: #04140a; font-weight: 700; }
.term-tag.status {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: #2a1f05; border-color: #b9862a; color: #f0c46a;
}

.term-card {
  position: relative;
  border: 1px solid var(--border-strong);
  padding: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  text-align: left;
  width: 100%;
  display: block;
  font-family: inherit;
  color: inherit;
}
.term-card:hover { border-color: color-mix(in srgb, var(--acc) 65%, transparent); box-shadow: 0 0 24px color-mix(in srgb, var(--acc) 12%, transparent); }

.term-tabs { display: flex; gap: 4px; align-items: flex-end; max-width: 1200px; margin: 60px auto 0; padding: 0 40px; }
.term-tab {
  position: relative;
  display: flex;
  align-items: center;
  padding: 9px 20px;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--text);
  opacity: 0.5;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--acc) 16%, transparent);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: opacity .15s, color .15s, background .15s;
  font-family: inherit;
}
.term-tab:hover { opacity: 0.8; }
.term-tab.active { color: var(--acc); opacity: 1; background: var(--panel); border-color: color-mix(in srgb, var(--acc) 55%, transparent); }
.term-tab.active::before {
  content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: var(--acc); box-shadow: 0 0 8px var(--acc); border-radius: 2px 2px 0 0;
}
.term-tab .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; margin-right: 9px; opacity: 0.7; }
.term-tab.active .dot { opacity: 1; box-shadow: 0 0 6px var(--acc); }

.term-input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-bright);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.term-input:focus { border-color: var(--acc); box-shadow: 0 0 10px color-mix(in srgb, var(--acc) 25%, transparent); }

/* ---------- masthead / nav ---------- */

.masthead-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border-shell);
}
.logo { font-weight: 800; letter-spacing: .04em; cursor: pointer; }
.logo .caret { }
.masthead-actions { display: flex; gap: 10px; }

/* ---------- prompt / heading blocks ---------- */

.prompt-block { position: relative; margin-bottom: 18px; }
.prompt-block .ghost { display: block; font-size: 15px; visibility: hidden; }
.prompt-block .live { position: absolute; inset: 0; display: block; font-size: 15px; color: var(--acc); }

.title-block { position: relative; }
.title-block .ghost { visibility: hidden; }
.title-block .live { position: absolute; inset: 0; }

.glow-heading {
  /* hero (home) heading — exact values from the reference */
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 700;
  max-width: 20ch;
}
/* work + 404 heading: no line-height/letter-spacing override in the
   reference (browser default), no max-width constraint */
.glow-heading.small { font-size: clamp(30px, 3.6vw, 44px); line-height: normal; letter-spacing: normal; max-width: none; }
/* about heading */
.glow-heading.about { font-size: clamp(32px, 3.8vw, 48px); line-height: 1.2; letter-spacing: normal; max-width: 18ch; }
/* contact heading — same size as about but narrower max-width */
.glow-heading.contact { font-size: clamp(32px, 3.8vw, 48px); line-height: 1.2; letter-spacing: normal; max-width: 16ch; }
/* detail heading: no line-height/letter-spacing override, no max-width */
.glow-heading.detail { font-size: clamp(36px, 4.4vw, 54px); line-height: normal; letter-spacing: normal; max-width: none; }
/* kept for back-compat if referenced anywhere else */
.glow-heading.medium { font-size: clamp(32px, 3.8vw, 48px); line-height: 1.2; letter-spacing: normal; max-width: 18ch; }

.lede { font-size: 16px; line-height: 1.7; max-width: 56ch; margin-top: 28px; color: var(--text); opacity: 0.85; }

/* ---------- stats ---------- */

.stats {
  padding: 44px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  gap: 32px;
}
.stat-num { font-size: 40px; font-weight: 700; color: var(--heading); }
.stat-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text); opacity: .7; margin-top: 8px; }

/* ---------- section labels / filters ---------- */

.section-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text); opacity: 0.6; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

/* ---------- grid / cards ---------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.img-hover-wrap { position: relative; border: 1px solid var(--border); aspect-ratio: 16/10; margin: -4px -4px 14px; overflow: hidden; background: #08090a; }
.img-hover-wrap img, .img-hover-wrap video.card-preview-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-hover-wrap:hover, .img-hover-wrap:hover * { cursor: none !important; }
.img-hover-wrap .zoom-icon {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .1s; pointer-events: none;
  color: var(--acc); filter: drop-shadow(0 0 4px rgba(0,0,0,0.7));
}
.img-hover-wrap:hover .zoom-icon { opacity: 0.8; }
.card-thumb-empty {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text); opacity: 0.6; font-size: 12px;
}

.term-card h3 { font-size: 18px; font-weight: 700; margin: 14px 0 6px; color: var(--text-bright); }
.term-card p.blurb { font-size: 13px; line-height: 1.6; color: var(--text); opacity: 0.85; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.term-card .meta { font-size: 12px; margin: 12px 0 0; color: var(--acc); opacity: 0.8; }

/* ---------- loading / error states ---------- */

.state-box { padding: 60px 20px; text-align: center; color: var(--text); opacity: 0.8; border: 1px dashed var(--border-strongest); }
.state-box.error { color: #ff8a80; border-color: #5c2b2e; opacity: 1; }

/* ---------- about page ---------- */

.about-grid { display: grid; grid-template-columns: minmax(0,7fr) minmax(0,5fr); gap: 28px 56px; padding: 40px 0; }
@media (max-width: 800px) { .about-grid, .detail-grid, .section-split { grid-template-columns: 1fr; } }
.about-grid p { font-size: 15px; line-height: 1.8; color: var(--text); opacity: 0.85; margin-top: 14px; max-width: 62ch; }

.skills-table { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border-strong); background: var(--bg); font-size: 12.5px; }
.skills-table .head { padding: 10px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border-strong); letter-spacing: .05em; }
.skills-table .head:last-child { border-right: none; }
.skills-table .cell { padding: 8px 14px; border-right: 1px solid color-mix(in srgb, var(--acc) 16%, transparent); color: var(--heading); opacity: 0.9; }
.skills-table .cell:nth-child(3n) { border-right: none; }

.ascii-box {
  font-family: inherit; color: var(--acc); white-space: pre; overflow-x: auto;
  line-height: 1.7; font-size: 12.5px; margin-top: 14px;
  background: var(--bg); border: 1px solid var(--border-strong); padding: 16px 18px;
}

.subsection { padding: 32px 0; border-top: 1px solid var(--border); }
.subsection:first-of-type { border-top: 1px solid var(--border); }

/* ---------- detail page ---------- */

.back-link { display: inline-flex; }

.detail-badges { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.detail-meta { color: var(--text); opacity: 0.65; font-size: 13px; margin-left: 8px; }

.detail-grid { display: grid; grid-template-columns: minmax(0,7fr) minmax(0,5fr); gap: 28px 56px; align-items: center; padding: 40px 0; }
.detail-media-row { display: flex; align-items: center; gap: 10px; }
.detail-media-row .img-hover-wrap { flex: 1; min-width: 0; margin: 0; border: 1px solid var(--border-strong); }
.media-counter { position: absolute; bottom: 10px; right: 12px; font-size: 11px; color: var(--acc); background: var(--bg); padding: 3px 8px; border: 1px solid var(--border-strong); }

.detail-desc h2 { font-size: 22px; font-weight: 700; margin: 0 0 14px; color: var(--text-bright); }
.detail-desc p { font-size: 14.5px; line-height: 1.7; color: var(--text); opacity: 0.85; }

.section-split { padding: 40px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 56px; border-top: 1px solid var(--border); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.commit-log {
  background: var(--bg); border: 1px solid var(--border-strong); padding: 16px 18px; margin-top: 14px;
  font-size: 13px; line-height: 1.9; color: var(--acc);
}
.commit-log .dollar { opacity: 0.7; }

.links-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.links-list a { font-size: 13px; }

/* ---------- contact ---------- */

.contact-grid { display: grid; grid-template-columns: minmax(0,7fr) minmax(0,5fr); gap: 28px 56px; padding: 36px 0 60px; }
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--acc); }
.status-box { margin-top: 26px; background: var(--bg); border: 1px solid var(--border-strong); padding: 16px 18px; font-size: 13px; color: var(--acc); }

/* ---------- lightbox ---------- */

.lightbox-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2,4,2,0.6); backdrop-filter: blur(14px);
  display: none; align-items: center; justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { width: min(900px,76vw); max-height: 74vh; object-fit: contain; border: 1px solid var(--border-strongest); box-shadow: 0 0 60px color-mix(in srgb, var(--acc) 25%, transparent); }
.lightbox-close { position: absolute; top: 24px; right: 24px; font-size: 13px; }
.lightbox-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lightbox-row { display: flex; align-items: center; gap: 20px; }
.lightbox-caption { font-size: 12px; color: var(--acc); letter-spacing: .05em; }

/* ---------- CRT boot intro ---------- */

.intro-overlay {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  perspective: 900px; perspective-origin: 50% 45%;
}
.intro-screen {
  position: relative; width: 112vw; height: 88vh;
  border-radius: 26px / 38px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.65), inset 0 0 60px rgba(0,0,0,0.55);
  animation: crtBreathe 6s ease-in-out infinite;
  will-change: transform;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  overflow: hidden;
}
.intro-inner { max-width: min(880px, 86vw); width: 100%; padding: 0 24px 4vh; box-sizing: border-box; }
.intro-log-wrap { width: 100%; position: relative; height: 83vh; }
.intro-log {
  width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden;
  font-size: 12px; line-height: 1.6; color: var(--acc); opacity: 0.85;
  white-space: pre-wrap; padding: 20px;
}
.intro-log::-webkit-scrollbar { display: none; }
.crt-scanlines { position: absolute; inset: -4% -2%; pointer-events: none; z-index: 5; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.5) 3px, rgba(0,0,0,0) 4px); border-radius: inherit; }
.crt-glass-sheen { position: absolute; inset: -4% -2%; pointer-events: none; background: radial-gradient(ellipse 65% 45% at 30% 18%, rgba(255,255,255,0.09), transparent 60%); border-radius: inherit; }
.intro-vignette { position: fixed; inset: 0; z-index: 46; pointer-events: none; background: radial-gradient(ellipse farthest-corner at 50% 45%, transparent 42%, var(--bg) 100%); }

/* ---------- footer ---------- */

.site-footer { text-align: center; padding: 40px 20px 60px; color: var(--text); opacity: 0.6; font-size: 12px; }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .wrap { padding: 0 20px; }
  .masthead-bar { padding: 18px 20px; flex-wrap: wrap; gap: 12px; }
  .term-tabs { padding: 0 20px; }
  .stats { grid-template-columns: repeat(2, auto); }
  .accent-toggle { top: 12px; right: 12px; }
}
