:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --panel: rgba(22, 22, 26, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(var(--accent-rgb), 0.45);
  --text: #ede8e1;
  --muted: #8f8a84;
  --accent-rgb: 230, 199, 156;
  --accent-2-rgb: 196, 170, 232;
  --accent: rgb(var(--accent-rgb));
  --accent-2: rgb(var(--accent-2-rgb));
  --danger: #e57373;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); color: var(--accent); background: rgba(var(--accent-rgb), 0.08); padding: 0.1em 0.4em; border-radius: 6px; font-size: 0.9em; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Background layers */
#bg { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; }
.cursor-glow {
  position: fixed; z-index: -1; pointer-events: none;
  width: 600px; height: 600px; left: 0; top: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.08), transparent 60%);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem clamp(1rem, 5vw, 4rem);
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { font-family: var(--mono); font-weight: 700; }
.blink { color: var(--accent); animation: blink 1s steps(1) infinite; }
.nav nav { display: flex; gap: clamp(0.75rem, 2vw, 1.75rem); flex-wrap: wrap; }
.nav nav a { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); transition: color 0.2s; }
.nav nav a:hover { color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2rem); }

/* Hero */
.hero { min-height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: center; padding: 4rem 0; }
.hero-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(2rem, 5vw, 4rem); }
.portrait {
  position: relative; margin: 0; width: clamp(220px, 26vw, 320px); aspect-ratio: 3 / 4;
  border-radius: 24px; padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 30px 70px -25px rgba(var(--accent-rgb), 0.45);
  transition: transform 0.15s ease-out, box-shadow 0.3s;
}
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 21px; }
.portrait:hover { box-shadow: 0 30px 80px -20px rgba(var(--accent-2-rgb), 0.55); }
.eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.85rem; margin: 0 0 1.25rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); animation: pulse 2s infinite; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0; font-weight: 800; }
.gradient {
  background: linear-gradient(110deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
}
.typed { font-size: clamp(1rem, 2.4vw, 1.35rem); color: var(--accent); margin: 1.25rem 0 0; min-height: 1.6em; }
.caret { animation: blink 1s steps(1) infinite; }
.lead { max-width: 640px; color: var(--muted); font-size: 1.1rem; margin: 1.25rem 0 2rem; }
.lead strong { color: var(--text); font-weight: 600; }
.cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.4rem; border-radius: 10px;
  font-family: var(--mono); font-size: 0.9rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--border-hi); box-shadow: 0 8px 30px -10px rgba(var(--accent-rgb), 0.4); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: #f0d6b0; }

.stats { list-style: none; padding: 0; margin: 4rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stats li { padding: 1.1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); backdrop-filter: blur(6px); }
.stats .num, .stats .unit { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; color: var(--text); }
.stats .unit { color: var(--accent); }
.stats .label { display: block; color: var(--muted); font-size: 0.85rem; }

/* Sections */
.section { padding: 6rem 0 2rem; }
.section-title { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.02em; margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.75rem; }
.section-title.center { justify-content: center; }
.section-title:not(.center)::after { content: ""; flex: 1; height: 1px; background: var(--border); margin-left: 1rem; max-width: 320px; }
.section-sub { color: var(--muted); margin: 0 0 2rem; }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Mac desktop */
.mac {
  --sf-mono: "SF Mono", Menlo, Monaco, var(--mono);
  position: relative; overflow: hidden; border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(60% 80% at 15% 20%, rgba(var(--accent-rgb), 0.35), transparent 60%),
    radial-gradient(55% 70% at 85% 30%, rgba(var(--accent-2-rgb), 0.32), transparent 60%),
    radial-gradient(70% 60% at 50% 110%, rgba(120, 80, 60, 0.45), transparent 60%),
    linear-gradient(160deg, #17141a, #0b0a0d 60%, #120f12);
  box-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.mac::after { /* film grain */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.12; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.mac-menubar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 1.1rem; height: 28px; padding: 0 1rem;
  font-family: var(--sans); font-size: 0.78rem; color: rgba(255, 255, 255, 0.85);
  background: rgba(10, 10, 12, 0.45); backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mac-menubar b { font-weight: 700; }
.mac-logo { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.mac-right { margin-left: auto; display: flex; gap: 1rem; align-items: center; font-variant-numeric: tabular-nums; }
.mac-desktop { position: relative; z-index: 1; padding: clamp(1.25rem, 4vw, 3rem) clamp(0.75rem, 4vw, 3rem) 6.5rem; min-height: 560px; }

/* Terminal window */
.term {
  position: relative; max-width: 820px; margin: 0 auto;
  border-radius: 12px; overflow: hidden;
  background: rgba(22, 21, 24, 0.78);
  backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.8), 0 40px 90px -20px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform-origin: 50% 120%;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.35s, max-width 0.4s ease;
}
.term.zoomed { max-width: 100%; }
.term.minimized { transform: translateY(60%) scale(0.08); opacity: 0; pointer-events: none; }
.term.closed { transform: scale(0.94); opacity: 0; pointer-events: none; }
.term-bar {
  position: relative; display: flex; align-items: center; height: 38px; padding: 0 14px;
  background: linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  user-select: none;
}
.lights { display: flex; gap: 8px; position: relative; z-index: 1; }
.tdot {
  width: 12px; height: 12px; border-radius: 50%; padding: 0; border: 0.5px solid rgba(0, 0, 0, 0.25); cursor: pointer;
  display: grid; place-items: center; font: 700 9px/1 var(--sans); color: transparent;
}
.lights:hover .tdot { color: rgba(0, 0, 0, 0.6); }
.tdot.r { background: #ff5f57; } .tdot.y { background: #febc2e; } .tdot.g { background: #28c840; }
.term:not(:focus-within) .lights:not(:hover) .tdot { background: rgba(255, 255, 255, 0.18); }
.term-title {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: rgba(255, 255, 255, 0.6);
}
.term-title svg { width: 14px; height: 14px; opacity: 0.7; }
.term-body { height: 380px; overflow-y: auto; padding: 0.9rem 1.1rem; font-family: var(--sf-mono); font-size: 0.86rem; line-height: 1.55; cursor: text; }
.reopen {
  position: absolute; inset: 0; margin: auto; width: max-content; height: max-content;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.mac.term-hidden .reopen { opacity: 1; pointer-events: auto; }

/* Dock */
.mac-dock {
  position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 10px; padding: 8px 10px;
  border-radius: 20px; background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
}
.dock-item {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  font: 700 1rem/1 var(--mono); color: #fff; border: 0; padding: 0; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 14px -6px rgba(0, 0, 0, 0.8);
  transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.dock-item:hover { transform: translateY(-10px) scale(1.25); }
.dock-item::before {
  content: attr(data-label); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) scale(0.8);
  padding: 3px 9px; border-radius: 6px; font: 500 0.7rem var(--sans); white-space: nowrap; color: var(--text);
  background: rgba(30, 30, 34, 0.9); border: 1px solid rgba(255, 255, 255, 0.1); opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.dock-item:hover::before { opacity: 1; }
.dock-item.running::after { content: ""; position: absolute; bottom: -7px; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.8); }
.dock-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: rgba(255, 255, 255, 0.18); }
.i-term { background: linear-gradient(#3a3a3e, #121214); color: var(--accent); font-size: 0.85rem; }
.i-proj { background: linear-gradient(#f0d6b0, #b8925f); color: #2a1f12; }
.i-mail { background: linear-gradient(#cdb8f0, #8a6fc4); }
.i-in   { background: linear-gradient(#5b8fd6, #2d5aa0); font-family: var(--sans); }
.i-gh   { background: linear-gradient(#4a4a50, #1d1d20); }
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
#term-out > div { white-space: pre-wrap; word-break: break-word; }
.term-line { display: flex; gap: 0.6rem; align-items: center; margin: 0; }
.prompt { color: var(--accent); white-space: nowrap; }
#term-in { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font: inherit; caret-color: var(--accent); }
.t-cmd .prompt { margin-right: 0.6rem; }
.t-dim { color: var(--muted); }
.t-acc { color: var(--accent); }
.t-pur { color: var(--accent-2); }
.t-err { color: var(--danger); }
.t-ok { color: #4ade80; }
.t-yel { color: #facc15; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.chips button, .filters button {
  font-family: var(--mono); font-size: 0.8rem; cursor: pointer;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  transition: all 0.2s;
}
.chips button:hover, .filters button:hover { color: var(--accent); border-color: var(--border-hi); }
.filters button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 2rem 0 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); opacity: 0.4; }
.job { position: relative; padding: 0 0 2.5rem 2.5rem; }
.job::before { content: ""; position: absolute; left: 0; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5); }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; }
.job h3 { margin: 0; font-size: 1.2rem; }
.date { color: var(--accent); font-size: 0.8rem; }
.org { margin: 0.15rem 0 0.75rem; color: var(--muted); }
.job ul { margin: 0 0 1rem; padding-left: 1.1rem; color: #c4bdb4; }
.job-desc { margin: 0; color: #c4bdb4; max-width: 640px; }
.job li { margin-bottom: 0.4rem; }
.job li::marker { color: var(--accent); }
.job b { color: var(--text); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags span { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.15); padding: 0.2rem 0.6rem; border-radius: 999px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.card {
  position: relative; padding: 1.6rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(8px);
  transform-style: preserve-3d; transition: border-color 0.3s, box-shadow 0.3s, transform 0.15s ease-out;
  display: flex; flex-direction: column;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--accent-rgb), 0.12), transparent 40%);
}
.card:hover { border-color: var(--border-hi); box-shadow: 0 20px 50px -20px rgba(var(--accent-rgb), 0.25); }
.card:hover::before { opacity: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-icon { font-size: 1.4rem; color: var(--accent); }
.card-links { display: flex; gap: 0.9rem; }
.card-link { color: var(--muted); font-size: 1.2rem; transition: color 0.2s; }
.card-link:hover { color: var(--accent); }
.card h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.card p { color: var(--muted); font-size: 0.93rem; margin: 0 0 1.25rem; flex: 1; }

/* Skills */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.skill {
  padding: 0.85rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--panel);
  font-family: var(--mono); font-size: 0.85rem;
  transition: opacity 0.3s, transform 0.3s, border-color 0.2s, color 0.2s;
}
.skill:hover { border-color: var(--border-hi); color: var(--accent); transform: translateY(-3px); }
.skill.dim { opacity: 0.15; transform: scale(0.96); }

/* Education */
.edu { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.edu-item { max-width: 560px; padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.edu-item h3 { margin: 0.4rem 0 0.25rem; }
.edu-item p { margin: 0.25rem 0; }
.edu-item .muted { font-size: 0.88rem; }

/* Contact */
.contact { padding-bottom: 6rem; }
.contact-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; }

footer { text-align: center; padding: 2rem 1rem 3rem; font-size: 0.8rem; border-top: 1px solid var(--border); }


body.party .gradient { animation-duration: 0.6s; }
body.party { animation: hue 3s linear infinite; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes shine { to { background-position: 200% center; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
@keyframes hue { to { filter: hue-rotate(360deg); } }

@media (max-width: 820px) {
  .hero-main { grid-template-columns: 1fr; }
  .portrait { order: -1; width: 200px; }
}

@media (max-width: 640px) {
  .nav nav { display: none; }
  .term-body { height: 320px; font-size: 0.78rem; }
  .term-title { display: none; }
  .mac-menubar .mi { display: none; }
  .mac-desktop { min-height: 0; padding-bottom: 5.5rem; }
  .dock-item { width: 38px; height: 38px; border-radius: 10px; font-size: 0.85rem; }
  .dock-item:hover { transform: none; }
  .cursor-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
