:root {
  --bg: #0a0d12;
  --bg-2: #0d1117;
  --ink: #e6edf3;
  --muted: #8b98a5;
  --faint: #55606c;
  --line: #1c2530;
  --line-strong: #2a3642;
  --accent: #4cc9f0;
  --accent-dim: rgba(76, 201, 240, 0.08);
  --accent-glow: rgba(76, 201, 240, 0.16);
  --accent-wash: rgba(76, 201, 240, 0.05);
  --font: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --max: 1240px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, dl, dd, dt { margin: 0; }

::selection { background: var(--accent); color: var(--bg); }

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

/* ------- full-screen fixed blueprint background ------- */
.frame {
  position: relative;
  min-height: 100dvh;
  background: var(--bg);
}
.frame::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 560px at 82% -8%, var(--accent-glow), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(76, 201, 240, 0.06), transparent 55%),
    linear-gradient(var(--accent-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-dim) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
}
.frame::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(10, 13, 18, 0) 0px,
    rgba(10, 13, 18, 0) 3px,
    rgba(10, 13, 18, 0.14) 3px,
    rgba(10, 13, 18, 0.14) 4px
  );
}

.reg {
  position: fixed;
  z-index: 2;
  color: var(--faint);
  font-size: 12px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
.reg-tl { top: 1rem; left: 0.85rem; }
.reg-tr { top: 1rem; right: 0.85rem; }
.reg-bl { bottom: 1rem; left: 0.85rem; }
.reg-br { bottom: 1rem; right: 0.85rem; }

header, main, footer { position: relative; z-index: 1; }

/* ------- topbar ------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
}
.wordmark { font-weight: 600; font-size: 14px; letter-spacing: 0.01em; }
.wordmark .accent, .accent { color: var(--accent); }
nav { display: flex; gap: clamp(1rem, 3vw, 2.2rem); }
nav a {
  position: relative;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.18s ease;
}
nav a:hover { color: var(--ink); }
nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.2s var(--ease);
}
nav a:hover::after { transform: scaleX(1); transform-origin: left; }
nav a.external { color: var(--ink); }
nav a.external:hover { color: var(--accent); }

/* ------- hero ------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vh, 2.75rem) var(--gutter) clamp(1.5rem, 4vh, 2.25rem);
}
.prompt { color: var(--faint); font-size: 14px; margin-bottom: 1rem; }
.prompt .accent { color: var(--accent); }
h1 {
  font-size: clamp(2.75rem, 9vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin-bottom: 1.25rem;
}
.cursor {
  display: inline-block;
  width: 0.055em;
  height: 0.72em;
  margin-left: 0.08em;
  background: var(--accent);
  transform: translateY(0.05em);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.lead {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.sub { color: var(--muted); font-size: clamp(0.95rem, 1.5vw, 1.05rem); max-width: 34rem; margin-bottom: 1.25rem; }
.status {
  display: grid;
  gap: 0.35rem;
  max-width: 40rem;
}
.status div { display: grid; grid-template-columns: 7ch 1fr; gap: 1.25rem; }
.status dt { color: var(--accent); font-size: 13px; }
.status dd { color: var(--muted); font-size: 13px; }

/* ------- sections ------- */
.work, .toolbox, .contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vh, 2rem) var(--gutter);
}
.sec-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.sec-title .accent { color: var(--accent); }

/* ------- projects ------- */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.project {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0 0.75rem 0.85rem;
}
.project::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.18s ease;
}
.project:hover::before { background: var(--accent); }
.project:hover h3 { color: var(--accent); }
.p-main h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.18s ease;
}
.tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  padding: 1px 6px;
  border-radius: 2px;
  vertical-align: 2px;
}
.tag.private { color: var(--faint); border-color: var(--line); }
.p-main p { color: var(--muted); margin-top: 0.35rem; max-width: 38rem; font-size: 13px; }
.p-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-start;
  margin-top: auto;
}
.lang {
  font-size: 10px;
  color: var(--faint);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 2px;
}
.arrow {
  margin-left: 0.6rem;
  font-size: 12px;
  color: var(--ink);
  transition: color 0.18s ease, transform 0.18s ease;
}
.arrow:hover { color: var(--accent); transform: translate(1px, -1px); }
.more { color: var(--faint); font-size: 12px; margin-top: 0.75rem; }

/* ------- toolbox ------- */
.skills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skills li {
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 0.4rem 0.85rem;
  border-radius: 2px;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.skills li:hover { border-color: var(--accent); color: var(--accent); }

/* ------- contact ------- */
.contact-note { color: var(--muted); margin-bottom: 1.25rem; font-size: 14px; }
.big-link {
  display: inline-block;
  font-size: clamp(1.35rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  border-bottom: 2px solid var(--line-strong);
  padding-bottom: 0.3rem;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.big-link:hover { border-color: var(--accent); color: var(--accent); }
.big-link .accent { font-size: 0.7em; vertical-align: 4px; margin-left: 0.4rem; }

/* ------- footer ------- */
footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--gutter) 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--faint);
  font-size: 12px;
}

/* ------- load animation (hero, above the fold) ------- */
.prompt, .lead, .sub, .status {
  animation: rise 0.65s var(--ease) both;
}
.lead { animation-delay: 0.12s; }
.sub { animation-delay: 0.18s; }
.status { animation-delay: 0.24s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------- scroll reveal (below the fold, JS-gated) ------- */
.js .reveal { opacity: 0; }
.js .reveal.in { animation: rise 0.6s var(--ease) both; }
.project:nth-child(2).reveal.in { animation-delay: 0.08s; }
.project:nth-child(3).reveal.in { animation-delay: 0.16s; }
.skills li:nth-child(2).reveal.in { animation-delay: 0.06s; }
.skills li:nth-child(3).reveal.in { animation-delay: 0.12s; }
.skills li:nth-child(4).reveal.in { animation-delay: 0.18s; }
.skills li:nth-child(5).reveal.in { animation-delay: 0.24s; }

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

/* ------- responsive ------- */
@media (max-width: 760px) {
  .reg { display: none; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.9rem var(--gutter); }
  nav { flex-wrap: wrap; gap: 0.75rem 1.25rem; }
  .hero { padding: clamp(1.75rem, 5vh, 3rem) var(--gutter) clamp(1.5rem, 4vh, 2rem); }
  h1 { font-size: clamp(2.6rem, 16vw, 3.75rem); }
  .projects { grid-template-columns: 1fr; }
  .project { gap: 0.4rem; padding: 0.7rem 0 0.7rem 0.7rem; }
  .p-main p { display: none; }
  .p-meta { justify-content: flex-start; }
  .status div { grid-template-columns: 1fr; gap: 0.1rem; }
  .status dd { font-size: 12px; }
  footer { flex-direction: column; gap: 0.25rem; padding: 1rem var(--gutter) 1.25rem; }
}
