:root {
  --bg: #07070b;
  --text: #c9c6d6;
  --strong: #ece9f5;
  --muted: #8c889c;
  --accent: #9b8bcf;
  --accent-dim: #5f5388;
  --line: #1d1b29;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 44rem;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
@media (min-width: 40rem) { html { scroll-padding-top: 5rem; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1rem/1.75 var(--font); -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 82% 12%, rgba(255,255,255,.28), transparent),
    radial-gradient(1.5px 1.5px at 64% 38%, rgba(255,255,255,.22), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255,255,255,.25), transparent),
    radial-gradient(1px 1px at 90% 74%, rgba(255,255,255,.3), transparent),
    radial-gradient(1px 1px at 8% 88%, rgba(255,255,255,.22), transparent),
    radial-gradient(60rem 36rem at 50% -8rem, rgba(110,92,170,.16), transparent 70%),
    radial-gradient(40rem 30rem at 100% 100%, rgba(70,55,120,.10), transparent 70%);
}
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
a { color: var(--accent); text-underline-offset: .2em; transition: color .15s; }
a:hover { color: var(--strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--bg); padding: .5rem 1rem; z-index: 20; }
.skip:focus { top: 1rem; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(7,7,11,.88); }
@media (min-width: 40rem) { .site-header { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px); } }
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }
.nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.nav a:hover { color: var(--strong); }
.nav .brand { color: var(--strong); font-family: var(--mono); font-size: .95rem; }

section { padding-top: 5rem; }
.hero { padding-top: 5rem; }
h1 { margin: 0 0 1.25rem; color: var(--strong); font-size: clamp(2.25rem, 6vw, 3rem); line-height: 1.1; font-weight: 600; letter-spacing: -.01em; }
h2 { margin: 0 0 1.5rem; color: var(--accent); font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
p { margin: 0 0 1.1rem; }
.eyebrow, .k { margin: 0 0 .5rem; color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.lead { color: var(--strong); font-size: 1.15rem; line-height: 1.7; }
.note, .empty { color: var(--muted); font-size: .85rem; }

.status { margin: 2rem 0; padding-left: 1rem; border-left: 2px solid var(--accent-dim); }
.status ul { margin: 0 0 .5rem; padding: 0; list-style: none; }
.status .note { margin: 0; }

.socials { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin: 0; padding: 0; list-style: none; }
.socials li { display: flex; align-items: baseline; gap: .6rem; }
.socials .k { margin: 0; min-width: 4rem; }
.socials.stacked { flex-direction: column; gap: 0; margin-top: 1.5rem; }
.socials.stacked li { padding: .9rem 0; border-top: 1px solid var(--line); }
code { color: var(--strong); font-family: var(--mono); }
.copy {
  font: inherit; font-size: .8rem; color: var(--accent); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; padding: .1rem .6rem;
  transition: border-color .15s, color .15s;
}
.copy:hover { border-color: var(--accent-dim); color: var(--strong); }

.rows { margin: 0; }
.rows > div { display: grid; grid-template-columns: 12rem 1fr; gap: .25rem 2rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.rows dt { color: var(--strong); font-weight: 600; }
.rows dd { margin: 0; }
@media (max-width: 40rem) { .rows > div { grid-template-columns: 1fr; } }

.group { margin: 2.25rem 0 .5rem; color: var(--strong); font-size: .95rem; font-weight: 600; }
.project { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.project h4 { margin: 0 0 .4rem; color: var(--strong); font-size: 1rem; }
.project p { margin: 0; }
.badge { margin-left: .7rem; padding: .05rem .55rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: .7rem var(--mono); vertical-align: middle; }
.badge.ongoing { color: var(--accent); border-color: var(--accent-dim); }

footer { padding-top: 5rem; padding-bottom: 3rem; color: var(--muted); font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* language switch */
.langs { display: flex; gap: .5rem; }
.lang { display: block; padding: 3px; background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; opacity: .5; filter: saturate(.6); transition: opacity .15s, border-color .15s; }
.lang:hover { opacity: .85; }
.lang[aria-pressed="true"] { opacity: 1; filter: none; border-color: var(--accent-dim); }
.lang svg { display: block; width: 1.5rem; height: 1rem; border-radius: 2px; }

/* blog */
.post { border-top: 1px solid var(--line); }
.post summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem 1rem; padding: 1.1rem 0; color: var(--strong); font-weight: 600; cursor: pointer; list-style: none; }
.post summary::-webkit-details-marker { display: none; }
.post summary::before { content: "+"; width: .8rem; color: var(--accent); font-family: var(--mono); }
.post[open] summary::before { content: "\2013"; }
.post .date { color: var(--muted); font: 400 .8rem var(--mono); }
.post .body { padding: 0 0 .5rem 1.8rem; }

/* ===== visual pass: Gargantua hero, glass panels, motion ===== */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); scrollbar-color: var(--accent-dim) var(--bg); }
body { overflow-x: clip; -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(155,139,207,.35); color: var(--strong); }
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes ring { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translateY(-8vh); } }

/* hero: the one big moment, a quiet Gargantua behind the title */
.hero { position: relative; }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.hero::before {
  top: 1rem; right: -8rem; width: 21rem; aspect-ratio: 1; border-radius: 50%; opacity: .8;
  background: conic-gradient(from 200deg, transparent, rgba(155,139,207,.5) 25%, rgba(236,233,245,.9) 38%, rgba(155,139,207,.55) 55%, transparent 80%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 41%, #000 43%, transparent 62%);
  mask: radial-gradient(circle, transparent 38%, #000 41%, #000 43%, transparent 62%);
  animation: ring 1.6s var(--ease-out) backwards, spin 140s linear infinite;
}
.hero::after {
  top: 9.75rem; right: -10.5rem; width: 26rem; height: 3.5rem; border-radius: 50%; transform: rotate(-7deg);
  background: radial-gradient(closest-side, rgba(236,233,245,.45), rgba(155,139,207,.18) 55%, transparent);
  filter: blur(8px); animation: ring 2s var(--ease-out) .2s backwards;
}
@media (max-width: 40rem) { .hero::before, .hero::after { opacity: .35; } }
h1 { font-size: clamp(2.75rem, 9vw, 4.25rem); letter-spacing: -.035em; text-shadow: 0 0 40px rgba(155,139,207,.35); }
.lead { max-width: 34rem; }
.hero > * { animation: rise .5s var(--ease-out) backwards; }
.hero > :nth-child(2) { animation-delay: 60ms; }
.hero > :nth-child(3) { animation-delay: 120ms; }
.hero > :nth-child(4) { animation-delay: 180ms; }
.hero > :nth-child(5) { animation-delay: 240ms; }

/* stars drift slowly with the scroll (where supported) */
body::before { inset: 0 0 -10vh; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::before { animation: drift linear both; animation-timeline: scroll(root); }
  }
}

/* section titles and wayfinding */
h2 { display: flex; align-items: center; gap: 1rem; }
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent-dim), transparent); opacity: .6; }
.nav ul a { position: relative; }
.nav ul a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.3rem; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 200ms var(--ease-out); }
.nav ul a[aria-current] { color: var(--strong); }
.nav ul a[aria-current]::after { transform: scaleX(1); }

/* glass panels */
.status { padding: 1rem 1.25rem; border: 1px solid rgba(255,255,255,.06); border-top-color: rgba(255,255,255,.12); border-left: 2px solid var(--accent-dim); border-radius: 10px; background: linear-gradient(180deg, rgba(155,139,207,.07), rgba(155,139,207,.02)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.project { margin-top: .75rem; padding: 1.25rem 1.35rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(155,139,207,.03); transition: border-color .2s, background-color .2s; }
@media (hover: hover) and (pointer: fine) { .project:hover { border-color: var(--accent-dim); background: rgba(155,139,207,.06); } }
@media (hover: none) { .copy:hover { border-color: var(--line); color: var(--accent); } .lang:hover { opacity: .5; } .lang[aria-pressed="true"]:hover { opacity: 1; } }
@media (prefers-reduced-transparency: reduce) { .status, .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; } .status { background: #12101c; } }

/* press feedback and state */
.copy { transition: border-color .15s, color .15s, transform 100ms var(--ease-out); }
.copy:active { transform: scale(.96); }
.copy.done { color: var(--strong); border-color: var(--accent); }
.lang { transition: opacity .15s, border-color .15s, transform 100ms var(--ease-out); }
.lang:active { transform: scale(.92); }
.lang[aria-pressed="true"] { box-shadow: 0 0 14px rgba(155,139,207,.3); }
@media (pointer: coarse) { .lang { padding: 8px; } .copy { padding: .4rem .9rem; } }

/* blog open/close */
.post summary::before { display: inline-block; transition: transform 200ms var(--ease-out); }
.post[open] summary::before { content: "+"; transform: rotate(45deg); }
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .post::details-content { block-size: 0; overflow: hidden; transition: block-size 220ms var(--ease-out), content-visibility 220ms allow-discrete; }
  .post[open]::details-content { block-size: auto; }
}

/* cursor glow, desktop pointers only (element is added by main.js) */
.glow { position: fixed; left: 0; top: 0; z-index: -1; width: 28rem; height: 28rem; margin: -14rem 0 0 -14rem; border-radius: 50%; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(155,139,207,.1), transparent 65%); transition: opacity .6s; }
.glow.on { opacity: 1; }

/* scroll reveal, only where scroll-driven animations exist */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rows > div, .project, .post, .stacked li { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
  }
}

/* reduced motion: fades only, no movement */
@media (prefers-reduced-motion: reduce) {
  .hero > * { animation: fade .4s ease backwards; }
  .hero::before { animation: ring 1s ease backwards; }
  .glow { display: none; }
}
