/* ==========================================================================
   Portfolio styles: clean, techy dark theme with a cyan accent.
   Tweak colors/fonts in the :root block below.
   ========================================================================== */

:root {
  --bg: #080b12;
  --bg-2: #0e131c;
  --line: rgba(233, 236, 232, 0.13);
  --text: #e8edf5;
  --muted: #8a96a8;
  --accent: #38e1ff;
  --accent-soft: rgba(56, 225, 255, 0.1);
  --accent-ink: #04121a;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 84px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0 0 1rem; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 em, .hero-role em { font-style: normal; color: var(--accent); }
h3 { font-size: 1.3rem; }
h4 { font-family: var(--mono); font-weight: 400; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 1.5rem 0 0.6rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; text-decoration: none; }

/* ---------- Floating pill nav ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 100; padding-top: 14px; pointer-events: none; }
.nav {
  position: relative; pointer-events: auto;
  width: min(1120px, 100% - 2rem); margin-inline: auto; height: 56px; padding: 0 0.6rem 0 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(8, 11, 18, 0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background 0.3s, border-color 0.3s;
}
.site-header.scrolled .nav { background: rgba(8, 11, 18, 0.92); }

.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { font-family: var(--mono); font-size: 0.8rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 0.1rem; }
.nav-links a { display: block; padding: 0.4rem 0.85rem; border-radius: 999px; color: var(--muted); font-size: 0.92rem; transition: color 0.2s, background 0.2s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); background: rgba(233, 236, 232, 0.08); }
.nav-links a.nav-cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-left: 0.3rem; }
.nav-links a.nav-cta:hover { filter: brightness(1.08); }

.nav-links { order: 2; }
.sound-toggle {
  order: 3; display: grid; place-items: center; width: 38px; height: 38px; flex: none; margin-left: 0.2rem;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(233, 236, 232, 0.04); color: var(--muted); cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.sound-toggle:hover { color: var(--text); border-color: var(--accent); }
.sound-toggle .ico-on { display: none; }
.sound-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 14px rgba(56, 225, 255, 0.35); }
.sound-toggle[aria-pressed="true"] .ico-on { display: block; }
.sound-toggle[aria-pressed="true"] .ico-off { display: none; }
.sound-toggle.hint { animation: sound-hint 2.4s ease-in-out infinite; }
@keyframes sound-hint { 0%, 100% { box-shadow: 0 0 0 0 rgba(56, 225, 255, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(56, 225, 255, 0); } }
.nav-toggle { order: 4; display: none; background: none; border: 0; padding: 0.6rem; cursor: pointer; border-radius: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: transform 0.25s, opacity 0.25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.5rem; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.96rem; cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #7aeeff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 0.45rem 1rem; font-size: 0.88rem; }
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-disabled="true"]:hover { transform: none; border-color: var(--line); color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: calc(var(--header-h) + 3.5rem) 0 4.5rem;
  background:
    radial-gradient(50% 45% at 85% 20%, rgba(56, 225, 255, 0.12), transparent 70%),
    radial-gradient(40% 40% at 5% 0%, rgba(99, 102, 241, 0.12), transparent 70%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(232, 237, 245, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 237, 245, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 85%);
}
.hero > .container { position: relative; }
.kicker { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(56, 225, 255, 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(56, 225, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(56, 225, 255, 0); } }

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.9rem); font-weight: 700; line-height: 1.02; letter-spacing: -0.045em;
  margin: 0 0 1.25rem; max-width: 14ch;
  background: linear-gradient(120deg, #ffffff 30%, #9fe9ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-role { font-size: clamp(1.15rem, 2.4vw, 1.6rem); letter-spacing: -0.015em; color: var(--muted); margin-bottom: 2rem; }

.hero-grid { display: grid; grid-template-columns: 1.3fr 0.8fr; gap: 3rem; align-items: center; }
.hero-copy { padding-top: 2rem; border-top: 1px solid var(--line); }
.lead { font-size: 1.15rem; color: #c0c9d6; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.75rem 0 2rem; }
.hero-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; font-size: 0.95rem; }
.hero-meta li { border-left: 1px solid var(--line); padding-left: 0.9rem; }
.hero-meta .label { display: block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.hero-photo { position: relative; justify-self: end; width: min(340px, 100%); padding-bottom: 11.5rem; }
.photo-frame { position: relative; aspect-ratio: 1; border-radius: 22px; border: 1px solid var(--line); padding: 8px; background: var(--bg-2); box-shadow: 0 30px 80px rgba(56, 225, 255, 0.08); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 15px; }
/* corner brackets */
.photo-frame::before, .photo-frame::after { content: ""; position: absolute; width: 28px; height: 28px; border: 2px solid var(--accent); pointer-events: none; }
.photo-frame::before { top: -7px; left: -7px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.photo-frame::after { bottom: -7px; right: -7px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }

/* code card */
.code-card { position: absolute; left: -5rem; bottom: 0; width: 360px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14, 19, 28, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); overflow: hidden; }
.code-bar { display: flex; align-items: center; gap: 6px; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); }
.code-bar span { width: 9px; height: 9px; border-radius: 50%; background: rgba(232, 237, 245, 0.18); }
.code-bar em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.code-card pre { margin: 0; padding: 0.85rem 1rem 1rem; overflow: hidden; }
.code-card code { font-family: var(--mono); font-size: 0.74rem; line-height: 1.75; color: #c0c9d6; white-space: pre; }
.code-card .ln { display: block; }
.code-card .k { color: #c4a7ff; }
.code-card .v { color: #7dd3fc; }
.code-card .a { color: #e8edf5; }
.code-card .s { color: #86efac; }
.code-card .n { color: #fcd34d; }
.code-card .p { color: #8a96a8; }

/* ---------- Sections ---------- */
.section { padding: 6rem 0; }
.section-alt { background: rgba(14, 19, 28, 0.62); border-block: 1px solid var(--line); }
.section-head { max-width: 40rem; margin-bottom: 3rem; }
.split { display: grid; grid-template-columns: 1fr 1.2fr; gap: 4rem; align-items: start; }
.split .section-head { margin-bottom: 0; }
.eyebrow { display: flex; align-items: center; gap: 0.75rem; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.eyebrow .num { color: var(--accent); }
.eyebrow .num::after { content: ""; display: inline-block; width: 2rem; height: 1px; background: var(--line); vertical-align: middle; margin-left: 0.75rem; }
.prose p { color: #c0c9d6; }
.prose p:first-child { font-size: 1.2rem; color: var(--text); }

/* ---------- Rows (skills, projects) ---------- */
.rows { border-top: 1px solid var(--line); }
.skill-row, .project-row {
  display: grid; gap: 1.25rem 2.5rem; padding: 2rem 0.5rem; border-bottom: 1px solid var(--line);
  transition: background 0.3s, padding 0.3s;
}
.skill-row { grid-template-columns: 1fr 1.5fr; align-items: center; }
.skill-row:hover, .project-row:hover { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); padding-left: 1.25rem; }
.row-head { display: flex; gap: 1.25rem; align-items: baseline; }
.row-head h3 { margin-bottom: 0.15rem; }
.num { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
.card-note { color: var(--muted); font-size: 0.92rem; margin: 0; }

.project-row { grid-template-columns: 3.5rem 1.4fr 1fr; align-items: start; }
.pr-main p { color: #c0c9d6; margin-bottom: 0; max-width: 52ch; }
.pr-main h3 { font-size: 1.5rem; }
.pr-side { display: flex; flex-direction: column; gap: 1.25rem; align-items: flex-start; }
.project-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.project-row.is-placeholder { border-bottom-style: dashed; opacity: 0.8; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li { font-size: 0.85rem; padding: 0.3rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); color: #d3d9d5; transition: border-color 0.2s, color 0.2s; }
.chips li:hover { border-color: var(--accent); color: var(--accent); }

.badge {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.2rem 0.65rem; border-radius: 999px; margin-bottom: 0.9rem;
  color: var(--accent); background: var(--accent-soft);
}

/* ---------- Cards (education, form) ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; }
.section-alt .card { background: var(--bg); }
.edu-card { border-left: 3px solid var(--accent); transition: transform 0.25s; }
.edu-card:hover { transform: translateX(4px); }
.edu-card h3 { margin-bottom: 0.4rem; }
.edu-program { font-weight: 600; margin-bottom: 0.1rem; }
.edu-level { color: var(--accent); font-family: var(--mono); font-size: 0.82rem; margin-bottom: 0.75rem; }
.edu-card + .edu-card { margin-top: 1.25rem; }

/* ---------- Timeline (horizontal on desktop) ---------- */
.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2.5rem 2rem; border-top: 1px solid var(--line); }
.timeline li { position: relative; padding-top: 1.75rem; }
.timeline li::before { content: ""; position: absolute; top: -6px; left: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); transition: background 0.2s, border-color 0.2s; }
.timeline li:hover::before { border-color: var(--accent); }
.timeline li.is-now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.tl-label { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.5rem; }
.timeline h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.timeline p:last-child { color: var(--muted); margin: 0; font-size: 0.98rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 4rem; align-items: start; }
.contact-links { display: grid; gap: 0.9rem; margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.contact-links li { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.contact-links .label { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); min-width: 72px; text-transform: uppercase; letter-spacing: 0.08em; }
.contact-links a { font-weight: 500; word-break: break-all; }
.contact-links a::after { content: " \2197"; }
.contact-links .placeholder-text { color: var(--muted); font-style: italic; font-size: 0.95rem; }

.field { margin-bottom: 1.1rem; }
label { display: block; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
input, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.75rem 0.95rem; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 130px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #f87171; }
.error { display: block; min-height: 1.1em; margin-top: 0.25rem; font-size: 0.85rem; color: #fca5a5; }
.form-note { background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.35); color: #fcd34d; border-radius: 12px; padding: 0.75rem 1rem; font-size: 0.92rem; margin-bottom: 1.25rem; }
.form-status { margin: 1rem 0 0; font-size: 0.95rem; min-height: 1.4em; }
.form-status.ok { color: #6ee7b7; }
.form-status.fail { color: #fca5a5; }
.form-status.info { color: #fcd34d; }

/* ---------- Modal ---------- */
.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); color: var(--text); padding: 0; width: min(560px, 100% - 2rem); max-height: 85vh; }
.modal::backdrop { background: rgba(5, 7, 6, 0.75); backdrop-filter: blur(3px); }
.modal[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-body { position: relative; padding: 2rem; }
.modal-close { position: absolute; top: 0.75rem; right: 0.9rem; background: none; border: 0; color: var(--muted); font-size: 2rem; line-height: 1; cursor: pointer; padding: 0.2rem 0.6rem; border-radius: 8px; }
.modal-close:hover { color: var(--text); background: rgba(233, 236, 232, 0.08); }
.modal ul:not(.chips) { padding-left: 1.2rem; list-style: disc; color: #c0c9d6; }
.modal ul:not(.chips) li { margin-bottom: 0.3rem; }
.modal ul:not(.chips) li::marker { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; }
.footer-inner p { margin: 0; }
.noscript { text-align: center; padding: 1rem; background: var(--bg-2); margin: 0; }

/* ---------- Featured project (~80% of the Projects section) ---------- */
.featured {
  position: relative; display: grid; grid-template-columns: 1.5fr 0.7fr; gap: 2rem; align-items: center;
  min-height: 600px; padding: clamp(2rem, 5vw, 4.5rem); overflow: hidden;
  border-radius: 26px; border: 1px solid rgba(56, 225, 255, 0.28);
  background: linear-gradient(135deg, rgba(56, 225, 255, 0.1), rgba(99, 102, 241, 0.09) 55%, rgba(14, 19, 28, 0.72));
  box-shadow: 0 30px 90px rgba(56, 225, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.featured::before {
  content: ""; position: absolute; top: -40%; right: -10%; width: 60%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(56, 225, 255, 0.16), transparent 65%);
}
.feat-body, .feat-art { position: relative; }
.feat-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.feat-top .badge { margin: 0; }
.feat-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s infinite; }
.featured h3 { font-size: clamp(2rem, 4.4vw, 3.4rem); letter-spacing: -0.035em; margin: 0.6rem 0 1.25rem; }
.feat-summary { font-size: 1.12rem; color: #c0c9d6; max-width: 58ch; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 2.75rem 0; }
.feat-grid li { border-top: 1px solid var(--line); padding-top: 0.9rem; }
.feat-grid h4 { margin: 0.35rem 0 0.3rem; font-family: var(--font); text-transform: none; letter-spacing: -0.01em; font-size: 1rem; color: var(--text); font-weight: 600; }
.feat-grid p { font-size: 0.92rem; color: var(--muted); margin: 0; }
.featured .project-actions { margin-top: 0.25rem; }
.featured .chips { margin-bottom: 1.25rem; }
.feat-note { font-size: 0.85rem; color: var(--muted); margin: 1.25rem 0 0; }
.feat-art { width: min(320px, 100%); aspect-ratio: 1; justify-self: center; filter: drop-shadow(0 0 30px rgba(56, 225, 255, 0.25)); }
.feat-art svg * { transform-box: view-box; transform-origin: 100px 100px; }
.feat-art .r1 { animation: spin 60s linear infinite; }
.feat-art .r2 { animation: spin 40s linear infinite reverse; }
.feat-art .d1 { animation: spin 14s linear infinite; }

/* Secondary projects (~20%) */
.more-label { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 2.25rem 0 0.9rem; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.mini { border: 1px solid var(--line); border-radius: 14px; padding: 0.95rem 1.15rem; background: rgba(14, 19, 28, 0.6); transition: transform 0.25s, border-color 0.25s; }
.mini:hover { transform: translateY(-2px); border-color: rgba(56, 225, 255, 0.4); }
.mini .badge { margin-bottom: 0.6rem; font-size: 0.66rem; }
.mini h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.mini p { font-size: 0.88rem; color: var(--muted); margin: 0 0 0.8rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.mini .btn-small { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.mini .card-note { font-size: 0.8rem; }
.mini .chips li { font-size: 0.75rem; padding: 0.12rem 0.6rem; }
.mini.is-placeholder { border-style: dashed; background: transparent; opacity: 0.8; }
.inline-link { color: var(--accent); }

@media (max-width: 900px) {
  .featured { grid-template-columns: 1fr; min-height: 0; }
  .feat-art { order: -1; width: 150px; justify-self: start; }
}
@media (max-width: 720px) {
  .feat-grid { grid-template-columns: 1fr; gap: 1rem; }
}

/* ---------- Space background ---------- */
#space-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; }
.nebula { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.nebula::before, .nebula::after { content: ""; position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%; will-change: transform; }
.nebula::before {
  top: -35vmax; left: -25vmax;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2), transparent 62%);
  animation: nebula-a 38s ease-in-out infinite alternate;
}
.nebula::after {
  bottom: -45vmax; right: -30vmax;
  background: radial-gradient(circle, rgba(56, 225, 255, 0.13), rgba(168, 85, 247, 0.07) 45%, transparent 65%);
  animation: nebula-b 46s ease-in-out infinite alternate;
}
@keyframes nebula-a { to { transform: translate(12vmax, 8vmax) scale(1.12); } }
@keyframes nebula-b { to { transform: translate(-10vmax, -9vmax) scale(1.1); } }

/* Orbit rings around the photo */
.photo-stack { position: relative; }
.photo-frame { z-index: 1; }
.code-card { z-index: 2; }
.orbit { position: absolute; border-radius: 50%; border: 1px dashed rgba(56, 225, 255, 0.2); pointer-events: none; }
.orbit i { position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 2px rgba(56, 225, 255, 0.7); }
.orbit-1 { inset: -26%; animation: spin 70s linear infinite; }
.orbit-2 { inset: -12%; border-color: rgba(167, 139, 250, 0.22); animation: spin 45s linear infinite reverse; }
.orbit-2 i { width: 6px; height: 6px; margin-left: -3px; top: -3px; background: #a78bfa; box-shadow: 0 0 10px 2px rgba(167, 139, 250, 0.7); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-photo { justify-self: start; width: min(320px, 100%); margin-left: 0; }
  .code-card { left: auto; right: 0; width: min(360px, 100%); }
  .split, .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .skill-row { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 2.5rem 1fr; }
  .pr-side { grid-column: 2; }
  .section { padding: 4.5rem 0; }
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .sound-toggle { margin-left: auto; margin-right: -0.4rem; }
  .nav-links {
    position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0; flex-direction: column; align-items: stretch;
    padding: 0.75rem; border: 1px solid var(--line); border-radius: 24px; background: rgba(8, 11, 18, 0.97);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  }
  .nav-links.open { transform: none; opacity: 1; visibility: visible; }
  .nav-links a { padding: 0.8rem 1rem; }
  .nav-links a.nav-cta { margin: 0.4rem 0 0; text-align: center; }
}

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .project-row { grid-template-columns: 1fr; padding-inline: 0; }
  .pr-side { grid-column: auto; }
  .skill-row:hover, .project-row:hover { padding-left: 0.5rem; }
  .modal-body { padding: 1.5rem; }
  .hero-photo { width: 100%; }
  .code-card { right: 0; width: 100%; }
  .code-card code { font-size: 0.68rem; }
}

.photo-frame { cursor: pointer; }
.photo-frame.wiggle { animation: wiggle 0.6s ease; }
@keyframes wiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-3deg) scale(1.03); } 45% { transform: rotate(2.5deg) scale(1.03); } 70% { transform: rotate(-1.5deg); } }

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