/* ==========================================================================
   Fernando Mota · portfolio
   An IDE-inspired theme: neutral editor greys, one soft blue accent and
   syntax-highlight colours used sparingly.
   ========================================================================== */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --maxw: 1200px;
  --header-h: 60px;
  --status-h: 28px;
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Dark (default): modern editor dark theme */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e13;
  --bg-elev: #11151c;
  --bg-elev-2: #161b24;
  --bg-elev-3: #1c2230;
  --border: #1f2632;
  --border-strong: #2b3342;
  --text: #e7eaf0;
  --text-muted: #a3abba;
  --text-subtle: #6f798b;
  --text-faint: #465063;
  --accent: #6ea8fe;
  --accent-hover: #8dbbff;
  --accent-soft: rgba(110, 168, 254, .12);
  --accent-border: rgba(110, 168, 254, .34);
  --on-accent: #08111f;
  --ok: #3ecf8e;
  --ide-bg: #0f131a;
  --ide-chrome: #0c1016;
  --ide-side: #0d1117;
  --ide-active: #1a2132;
  --ide-line: #151b25;
  --glow: rgba(110, 168, 254, .14);
  --dot: rgba(255, 255, 255, .055);
  --grid: rgba(255, 255, 255, .045);
  --cover-bg: #0e1218;
  --cover-l: 72%;
  --cover-s: 85%;
  --selection: rgba(110, 168, 254, .28);
  --shadow-lg: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --shadow-xl: 0 50px 120px -40px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .02);
  --syn-kw: #c792ea;
  --syn-str: #e5c07b;
  --syn-pr: #7dcfff;
  --syn-fn: #82aaff;
  --syn-num: #f78c6c;
  --syn-pn: #8b95a7;
  --syn-cm: #5c677a;
  --syn-vr: #e7eaf0;
}

/* Light: clean, paper-white editor */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #f7f8fa;
  --bg-elev-2: #eff1f5;
  --bg-elev-3: #e6e9ef;
  --border: #e3e6ec;
  --border-strong: #d1d6df;
  --text: #151922;
  --text-muted: #4e5767;
  --text-subtle: #778093;
  --text-faint: #a9b0bc;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, .08);
  --accent-border: rgba(37, 99, 235, .28);
  --on-accent: #ffffff;
  --ok: #16a34a;
  --ide-bg: #ffffff;
  --ide-chrome: #f5f6f8;
  --ide-side: #f8f9fb;
  --ide-active: #e7edfb;
  --ide-line: #f3f5f9;
  --glow: rgba(37, 99, 235, .09);
  --dot: rgba(15, 23, 42, .075);
  --grid: rgba(15, 23, 42, .055);
  --cover-bg: #f5f7fa;
  --cover-l: 46%;
  --cover-s: 70%;
  --selection: rgba(37, 99, 235, .18);
  --shadow-lg: 0 16px 34px -18px rgba(15, 23, 42, .22);
  --shadow-xl: 0 40px 90px -36px rgba(15, 23, 42, .28), 0 0 0 1px rgba(15, 23, 42, .02);
  --syn-kw: #7c3aed;
  --syn-str: #b45309;
  --syn-pr: #0369a1;
  --syn-fn: #2563eb;
  --syn-num: #c2410c;
  --syn-pn: #6b7280;
  --syn-cm: #9aa1ad;
  --syn-vr: #151922;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: var(--status-h);
  transition: background-color .25s ease, color .25s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--selection); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.container { width: min(var(--maxw), 100% - 48px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { top: 12px; }
kbd {
  font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: var(--bg-elev-2); color: var(--text-muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 9px;
  font-size: 14.5px; font-weight: 550; letter-spacing: -.005em;
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease);
}
.btn:hover { background: var(--bg-elev-2); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn .i { width: 16px; height: 16px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 8px; color: var(--text-muted); border: 1px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg-elev-2); border-color: var(--border); }
.icon-btn .i { width: 18px; height: 18px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border);
}
.cmd-trigger {
  flex: 1; max-width: 340px; margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 8px 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-subtle); font-size: 13.5px; text-align: left;
  transition: border-color .15s, color .15s;
}
.cmd-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.cmd-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { padding: 6px 11px; border-radius: 7px; font-size: 14px; color: var(--text-muted); transition: color .15s, background-color .15s; }
.nav a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav a.active { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 2px; }
.menu-btn, .cmd-mobile { display: none; }
.mobile-nav { display: grid; padding: 8px 16px 16px; border-top: 1px solid var(--border); }
.mobile-nav a { padding: 12px 4px; font-size: 16px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 64px 0 88px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-bg::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 60% 20%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 70% at 60% 20%, #000 30%, transparent 75%);
}
.hero-bg::after {
  content: ''; position: absolute; width: 900px; height: 600px; right: -120px; top: 40px;
  background: radial-gradient(closest-side, var(--glow), transparent);
}
.hero-grid {
  position: relative; display: grid; align-items: center; gap: 56px;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
}
.badge {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev);
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.badge img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: center 30%; }
.badge-sep { width: 1px; height: 14px; background: var(--border-strong); }
.badge-status { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 8%, transparent); } }
.hero h1 { margin-top: 26px; font-size: clamp(44px, 5.4vw, 66px); line-height: 1.02; letter-spacing: -.04em; font-weight: 700; }
.hero-headline { margin-top: 14px; font-size: clamp(21px, 2.1vw, 26px); line-height: 1.3; letter-spacing: -.02em; font-weight: 500; color: var(--text-muted); }
.hero-headline em { font-style: normal; color: var(--text); }
.hero-lede { margin-top: 18px; font-size: 16.5px; line-height: 1.7; color: var(--text-muted); max-width: 520px; }
.hero-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-meta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13.5px; color: var(--text-subtle); }
.hero-meta li { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta a { display: inline-flex; align-items: center; gap: 7px; transition: color .15s; }
.hero-meta a:hover { color: var(--text); }
.hero-meta .i { width: 15px; height: 15px; }

/* ---------- IDE window ---------- */
.ide {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--ide-bg); box-shadow: var(--shadow-xl); overflow: hidden;
  font-size: 13px;
}
.ide-titlebar {
  height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 14px;
  background: var(--ide-chrome); border-bottom: 1px solid var(--border);
}
.ide-dots { display: flex; gap: 7px; }
.ide-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); transition: background-color .2s; }
.ide:hover .ide-dots i:nth-child(1) { background: #ff5f57; }
.ide:hover .ide-dots i:nth-child(2) { background: #febc2e; }
.ide:hover .ide-dots i:nth-child(3) { background: #28c840; }
.ide-title { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 9px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  transition: background-color .15s, transform .15s var(--ease);
}
.run-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.run-btn:active { transform: scale(.96); }
.run-btn .i { width: 12px; height: 12px; }
.run-btn.running { animation: runflash .6s var(--ease); }
@keyframes runflash { 30% { background: var(--accent); color: var(--on-accent); } }

.ide-body { display: grid; grid-template-columns: 178px minmax(0, 1fr); height: 600px; }
.ide-explorer { display: flex; flex-direction: column; background: var(--ide-side); border-right: 1px solid var(--border); padding: 10px 0; overflow: auto; }
.explorer-title { padding: 2px 14px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); }
.tree-row {
  display: flex; align-items: center; gap: 7px; width: 100%; height: 26px; padding: 0 12px;
  font-size: 13px; color: var(--text-muted); text-align: left; white-space: nowrap;
  transition: background-color .12s, color .12s;
}
.tree-row:hover { background: var(--ide-line); color: var(--text); }
.tree-row.active { background: var(--ide-active); color: var(--text); }
.tree-row .chev { width: 12px; height: 12px; transition: transform .15s; }
.tree-row[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.tree-indent { padding-left: 31px; }
.tree-indent-2 { padding-left: 14px; }
.ficon { width: 18px; text-align: center; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: -.02em; flex: none; }
.ficon.ts { color: #4b9cf5; }
.ficon.json { color: #e5b350; }
.ficon.yaml { color: #b083f0; }
.ficon.sh { color: #4fc9a8; }
.ficon.folder { color: var(--text-subtle); }
.explorer-hint { margin-top: auto; padding: 12px 14px 4px; font-size: 11.5px; line-height: 1.5; color: var(--text-subtle); }
.explorer-hint b { color: var(--accent); font-weight: 600; }

.ide-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.ide-tabs { display: flex; background: var(--ide-chrome); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ide-tabs::-webkit-scrollbar { display: none; }
.ide-tab {
  position: relative; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  font-size: 12.5px; color: var(--text-subtle); white-space: nowrap;
  border-right: 1px solid var(--border); margin-bottom: -1px; border-bottom: 1px solid transparent;
  transition: color .12s, background-color .12s;
}
.ide-tab:hover { color: var(--text-muted); }
.ide-tab[aria-selected="true"] { background: var(--ide-bg); color: var(--text); border-bottom-color: var(--ide-bg); }
.ide-tab[aria-selected="true"]::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.ide-crumbs { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 16px; font-size: 12px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; }
.ide-crumbs .i { width: 11px; height: 11px; opacity: .7; }
.ide-crumbs .sym { color: var(--syn-vr); }

.ide-editor {
  overflow: auto; min-height: 0; padding: 4px 0 18px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7; font-variant-ligatures: none;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.ide-editor:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent-border); border-radius: 0; }
.code-row { display: flex; min-width: max-content; }
.code-row.cur, .code-row.cur .ln { background: var(--ide-line); }
.ln {
  position: sticky; left: 0; z-index: 1; flex: none; width: 50px; padding-right: 18px;
  text-align: right; color: var(--text-faint); background: var(--ide-bg); user-select: none;
}
.code-row.cur .ln { color: var(--text-muted); }
.code { white-space: pre; padding-right: 28px; color: var(--syn-vr); }
.t-kw { color: var(--syn-kw); }
.t-st { color: var(--syn-str); }
.t-pr { color: var(--syn-pr); }
.t-fn { color: var(--syn-fn); }
.t-nm { color: var(--syn-num); }
.t-pn { color: var(--syn-pn); }
.t-cm { color: var(--syn-cm); font-style: italic; }
.t-vr { color: var(--syn-vr); }
.tok-link {
  font: inherit; cursor: pointer; padding: 0;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px; transition: text-decoration-color .15s, background-color .15s; border-radius: 3px;
}
.tok-link:hover { text-decoration-color: currentColor; background: color-mix(in srgb, currentColor 10%, transparent); }
.caret { display: inline-block; width: 2px; height: 1.15em; margin-left: 1px; vertical-align: -.2em; background: var(--accent); animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.ide-panel { display: flex; flex-direction: column; height: 228px; border-top: 1px solid var(--border); background: var(--ide-bg); }
.panel-tabs {
  display: flex; align-items: center; gap: 18px; height: 34px; padding: 0 8px 0 16px; flex: none;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle);
}
.panel-tabs > span { display: flex; align-items: center; gap: 6px; height: 100%; }
.panel-tabs .active { color: var(--text); box-shadow: inset 0 -1px 0 var(--accent); }
.panel-tabs .count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bg-elev-3); font-size: 10px; color: var(--text-muted); }
.panel-clear { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--text-subtle); }
.panel-clear:hover { color: var(--text); background: var(--bg-elev-2); }
.panel-clear .i { width: 14px; height: 14px; }
.term {
  flex: 1; min-height: 0; overflow: auto; padding: 2px 16px 10px; cursor: text;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.term-line { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-muted); min-height: 1.65em; }
.term-line.cmd { color: var(--text); margin-top: 6px; }
.term-prompt { color: var(--accent); white-space: nowrap; flex: none; }
.term-tilde { color: var(--syn-kw); }
.term .ok { color: var(--ok); }
.term .hl { color: var(--text); }
.term .dim { color: var(--text-subtle); }
.term .kw { color: var(--syn-kw); }
.term .st { color: var(--syn-str); }
.term .pr { color: var(--syn-pr); }
.term .err { color: #f7768e; }
.term-link {
  font: inherit; color: var(--syn-pr); cursor: pointer; padding: 0;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px;
}
.term-link:hover { text-decoration-color: currentColor; }
.term-input-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.term-input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; caret-color: var(--accent); }
.term-chips { display: flex; gap: 6px; padding: 8px 16px 10px; overflow-x: auto; scrollbar-width: none; border-top: 1px dashed var(--border); flex: none; }
.term-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-family: var(--font-mono); font-size: 11.5px; padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted);
  transition: color .15s, border-color .15s, background-color .15s;
}
.chip:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

.ide-status {
  display: flex; align-items: center; height: 26px; padding: 0 4px 0 0;
  font-size: 11.5px; color: var(--text-subtle); background: var(--ide-chrome); border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden;
}
.st-item { display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; height: 100%; }
.st-item .i { width: 12px; height: 12px; }
.st-branch { background: var(--accent-soft); color: var(--accent); padding: 0 10px; }
.st-spacer { flex: 1; }

/* ---------- Sections ---------- */
.section { padding: 104px 0; }
.section-alt { background: linear-gradient(180deg, transparent, var(--bg-elev) 18%, var(--bg-elev) 82%, transparent); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; margin-bottom: 40px; }
.eyebrow { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-bottom: 12px; }
.section-title { font-size: clamp(30px, 3.6vw, 42px); line-height: 1.1; letter-spacing: -.035em; font-weight: 700; }
.section-sub { margin-top: 14px; max-width: 560px; font-size: 16.5px; line-height: 1.65; color: var(--text-muted); }

/* ---------- Project filters + grid ---------- */
.filters { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); }
.filter {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 7px;
  font-size: 13.5px; color: var(--text-muted); transition: color .15s, background-color .15s;
}
.filter:hover { color: var(--text); }
.filter[aria-pressed="true"] { background: var(--bg-elev-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.filter .count { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }

.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card {
  --c: hsl(var(--hue, 214) var(--cover-s) var(--cover-l));
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); overflow: hidden;
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s var(--ease);
  animation: cardin .45s var(--ease) both;
}
@keyframes cardin { from { opacity: 0; transform: translateY(8px); } }
.card:hover { border-color: color-mix(in srgb, var(--c) 40%, var(--border-strong)); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--cover-bg); }
.card-cover > img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-cover > img { transform: scale(1.03); }
.card-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 22px 20px; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-subtle); }
.cat-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border-strong); font-family: var(--font-sans); font-size: 11.5px; color: var(--text-muted); }
.card-meta .pill { margin-left: auto; }
.card-title { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; }
.card-title button { text-align: left; }
.card-title button::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.card-title button:focus-visible { outline: none; }
.card:has(.card-title button:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-summary { font-size: 14.5px; line-height: 1.65; color: var(--text-muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.tag { font-family: var(--font-mono); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; font-size: 13.5px; }
.card-more { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 550; }
.card-more .i { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.card:hover .card-more .i { transform: translateX(3px); }
.card-link { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 5px; color: var(--text-subtle); transition: color .15s; }
.card-link:hover { color: var(--accent); }
.card-link .i { width: 13px; height: 13px; }

.card.featured { grid-column: 1 / -1; flex-direction: row; }
.card.featured .card-cover { flex: 1.2; aspect-ratio: auto; min-height: 360px; border-bottom: 0; border-right: 1px solid var(--border); }
.card.featured .card-body { flex: 1; padding: 34px 34px 30px; gap: 12px; }
.card.featured .card-title { font-size: 25px; }
.card.featured .card-summary { font-size: 15.5px; }
.featured-flag { color: var(--accent); }

/* Generated cover art (used when a project has no cover image) */
.cover-art {
  position: absolute; inset: 0;
  background:
    radial-gradient(55% 75% at 72% 28%, hsl(var(--hue) 85% 60% / .2), transparent 70%),
    radial-gradient(45% 60% at 18% 92%, hsl(calc(var(--hue) + 40) 85% 60% / .12), transparent 70%),
    var(--cover-bg);
}
.cover-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 25%, transparent 80%);
}
.cover-orbit {
  position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; translate: -50% -50%;
  border-radius: 50%; border: 1px dashed hsl(var(--hue) 70% 60% / .22);
  animation: spin 40s linear infinite;
}
.cover-orbit::after { content: ''; position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); }
@keyframes spin { to { rotate: 360deg; } }
.cover-icon {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 92px; height: 92px; display: grid; place-items: center; border-radius: 24px;
  color: var(--c); background: color-mix(in srgb, var(--bg-elev) 75%, transparent);
  border: 1px solid hsl(var(--hue) 70% 60% / .3);
  box-shadow: 0 0 0 10px hsl(var(--hue) 70% 60% / .04), 0 24px 60px -16px hsl(var(--hue) 85% 50% / .45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: translate .35s var(--ease);
}
.card:hover .cover-icon { translate: -50% calc(-50% - 4px); }
.cover-icon svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.cover-path { position: absolute; left: 16px; bottom: 13px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-subtle); }
.cover-path b { color: var(--c); font-weight: 500; }

/* ---------- Project dialog ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(4, 7, 12, .62); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.doc {
  width: min(880px, 100% - 32px); max-height: min(90vh, 980px); max-height: min(90dvh, 980px);
  padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--ide-bg); box-shadow: var(--shadow-xl); overflow: hidden;
}
.doc[open] { display: flex; flex-direction: column; animation: dialogin .28s var(--ease); }
@keyframes dialogin { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.doc-bar { display: flex; align-items: center; height: 42px; flex: none; background: var(--ide-chrome); border-bottom: 1px solid var(--border); padding-right: 6px; }
.doc-tab {
  position: relative; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 16px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text); background: var(--ide-bg);
  border-right: 1px solid var(--border); margin-bottom: -1px;
}
.doc-tab::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.doc-tab .ficon { color: #4b9cf5; }
.doc-close { margin-left: auto; }
.doc-close:focus-visible { outline-offset: -2px; }
.doc-scroll { overflow: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.doc-body { padding: 30px 40px 40px; }
.doc-cover { position: relative; aspect-ratio: 21 / 9; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); background: var(--cover-bg); margin-bottom: 30px; --c: hsl(var(--hue, 214) var(--cover-s) var(--cover-l)); }
.doc-cover > img { width: 100%; height: 100%; object-fit: cover; }
.doc-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); }
.doc-body h2 { margin-top: 12px; font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -.035em; font-weight: 700; }
.doc-tagline { margin-top: 10px; font-size: 17px; line-height: 1.55; color: var(--text-muted); }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; margin-top: 26px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); }
.doc-meta > div { padding: 12px 16px; background: var(--bg-elev); }
.doc-meta dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.doc-meta dd { margin-top: 4px; font-size: 14px; color: var(--text); }
.doc-body h3 { display: flex; align-items: center; gap: 8px; margin: 34px 0 12px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.doc-body h3::before { content: '##'; font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--accent); opacity: .8; }
.doc-body p.doc-p { font-size: 15.5px; line-height: 1.75; color: var(--text-muted); }
.doc-list { display: grid; gap: 10px; }
.doc-list li { position: relative; padding-left: 26px; font-size: 15.5px; line-height: 1.65; color: var(--text-muted); }
.doc-list li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--accent); transform: rotate(45deg); }
.doc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gallery figure { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-elev); }
.gallery figure.wide { grid-column: 1 / -1; }
.gallery img { width: 100%; height: auto; background: #fff; }
.gallery figcaption { padding: 10px 14px; font-size: 13px; line-height: 1.55; color: var(--text-subtle); border-top: 1px solid var(--border); }
.slot-empty {
  display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 18px; min-height: 160px;
  border: 1.5px dashed var(--border-strong); border-radius: 10px; color: var(--text-subtle); font-size: 13px; line-height: 1.5;
  background: repeating-linear-gradient(-45deg, transparent 0 12px, var(--grid) 12px 13px);
}
.slot-empty .i { width: 22px; height: 22px; color: var(--text-faint); }
.slot-empty code { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.doc-actions .btn { height: 38px; font-size: 14px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 64px; align-items: center; }
.portrait { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev-2); aspect-ratio: 4 / 5; box-shadow: var(--shadow-lg); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; }
.portrait figcaption {
  position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 8px; font-family: var(--font-mono); font-size: 11.5px; color: #e7eaf0;
  background: rgba(10, 13, 18, .62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .1);
}
.about-bio { margin-top: 22px; display: grid; gap: 14px; }
.about-bio p { font-size: 16.5px; line-height: 1.75; color: var(--text-muted); }
.about-bio p:first-child { font-size: 19px; color: var(--text); letter-spacing: -.01em; }
.facts { margin-top: 30px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); }
.facts > div { padding: 14px 18px; background: var(--bg); }
.facts dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.facts dd { margin-top: 4px; font-size: 14.5px; color: var(--text); }

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 72px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; scroll-margin-top: calc(var(--header-h) + 20px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 46px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--ide-chrome); }
.panel-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.panel-file { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-subtle); }

.xp { position: relative; padding: 22px 22px 6px; }
.xp li { position: relative; padding: 0 0 22px 28px; }
.xp li::before { content: ''; position: absolute; left: 4px; top: 8px; bottom: -6px; width: 1px; background: var(--border-strong); }
.xp li:last-child::before { display: none; }
.xp li::after { content: ''; position: absolute; left: 0; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.xp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.xp-title { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.xp-period { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); }
.xp-org { margin-top: 2px; font-size: 14px; color: var(--accent); }
.xp-org span { color: var(--text-subtle); }
.xp-text { margin-top: 8px; font-size: 14.5px; line-height: 1.65; color: var(--text-muted); }

.skills { padding: 20px 22px 22px; display: grid; gap: 18px; }
.skill-group h4 { margin-bottom: 10px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.skill-list { display: flex; flex-wrap: wrap; gap: 7px; }
.skill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-elev); font-size: 13.5px; color: var(--text);
  transition: border-color .15s, transform .15s var(--ease);
}
.skill:hover { border-color: hsl(var(--hue) 60% 55% / .5); transform: translateY(-1px); }
.skill i { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--hue) var(--cover-s) var(--cover-l)); }

.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.photos figure { display: grid; gap: 10px; }
.photos .ph { aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev-2); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .slot-empty { height: 100%; min-height: 0; border-radius: 12px; }
.photos figcaption { font-size: 13.5px; color: var(--text-subtle); }

/* ---------- Contact ---------- */
.contact-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: center;
  padding: 56px; border: 1px solid var(--border-strong); border-radius: 20px; overflow: hidden;
  background: radial-gradient(700px 360px at 90% -10%, var(--glow), transparent 70%), var(--bg-elev);
}
.contact-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(110deg, transparent 40%, #000 100%); mask-image: linear-gradient(110deg, transparent 40%, #000 100%);
}
.contact-copy, .contact-list { position: relative; }
.contact-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; }
.contact-list { display: grid; gap: 10px; }
.contact-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg); transition: border-color .15s, transform .2s var(--ease);
  width: 100%; text-align: left;
}
.contact-row:hover { border-color: var(--accent-border); transform: translateX(3px); }
.contact-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--bg-elev-2); color: var(--text); flex: none; }
.contact-ico .i, .contact-ico svg { width: 18px; height: 18px; }
.contact-label { display: grid; min-width: 0; }
.contact-label b { font-size: 14.5px; font-weight: 600; }
.contact-label span { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row > .i { margin-left: auto; color: var(--text-subtle); }

/* ---------- Footer + status bar ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 32px; font-size: 13.5px; color: var(--text-subtle); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--status-h);
  display: flex; justify-content: space-between; align-items: stretch;
  background: var(--ide-chrome); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-subtle);
}
.sb-group { display: flex; align-items: stretch; min-width: 0; }
.sb-item { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; white-space: nowrap; transition: background-color .12s, color .12s; }
.sb-item .i { width: 13px; height: 13px; }
a.sb-item:hover, button.sb-item:hover { background: var(--bg-elev-2); color: var(--text); }
.sb-branch { background: var(--accent); color: var(--on-accent); font-weight: 500; }
a.sb-branch:hover { background: var(--accent-hover); color: var(--on-accent); }
#sb-section { font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- Command palette ---------- */
.palette {
  width: min(620px, 100% - 32px); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg-elev);
  box-shadow: var(--shadow-xl); overflow: hidden;
}
.palette[open] { animation: dialogin .2s var(--ease); }
.palette-input-row { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-subtle); }
.palette-input-row .i { width: 18px; height: 18px; }
.palette-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15.5px; }
.palette-input::placeholder { color: var(--text-subtle); }
.palette-list { max-height: min(420px, 58vh); overflow: auto; padding: 6px; scrollbar-width: thin; }
.palette-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--text-muted); cursor: pointer; }
.palette-item .i { width: 16px; height: 16px; color: var(--text-subtle); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.palette-item[aria-selected="true"] .i { color: var(--accent); }
.palette-item .hint { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.palette-item mark { background: none; color: var(--accent); font-weight: 600; }
.palette-empty { padding: 28px 12px; text-align: center; font-size: 14px; color: var(--text-subtle); }
.palette-foot { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-subtle); }
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }
.palette-foot kbd { padding: 2px 5px; font-size: 10.5px; }

.noscript { position: fixed; inset: auto 16px 40px; padding: 14px 18px; border-radius: 10px; background: var(--bg-elev-2); border: 1px solid var(--border); z-index: 50; }
.noscript a { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 52px; }
  .hero-intro { max-width: 720px; }
  .hero-lede { max-width: 620px; }
}
@media (max-width: 960px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; }
  .cmd-trigger { max-width: 300px; }
  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .portrait { max-width: 360px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .contact-card { grid-template-columns: minmax(0, 1fr); padding: 40px; gap: 32px; }
  .card.featured { flex-direction: column; }
  .card.featured .card-cover { aspect-ratio: 16 / 9; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .card.featured .card-body { padding: 22px 24px 22px; }
  .card.featured .card-title { font-size: 21px; }
}
@media (max-width: 760px) {
  .container { width: calc(100% - 32px); }
  .cmd-trigger { display: none; }
  .cmd-mobile { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .hero { padding: 40px 0 64px; }
  .ide-body { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ide-explorer { display: none; }
  .ide-editor { height: 300px; font-size: 12px; }
  .ide-panel { height: 270px; }
  .term { font-size: 12px; }
  .term-input { font-size: 16px; }
  .hide-sm { display: none !important; }
  .section { padding: 72px 0; }
  .projects-grid { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .photos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .contact-card { padding: 28px 22px; border-radius: 16px; }
  .doc { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .doc-body { padding: 22px 20px 28px; }
  .doc-cover { aspect-ratio: 16 / 9; }
  .sb-hide-sm { display: none; }
  .footer-note { display: none; }
}
@media (max-width: 1000px) { .sb-hide-md { display: none; } }
@media (max-width: 480px) {
  .badge-role, .badge-sep { display: none; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .badge { font-size: 12px; }
  .photos { grid-template-columns: minmax(0, 1fr); }
  .ln { width: 38px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
