/* Alex Byun - portfolio v2. Dark base, gradient glows, glass cards, one accent.
   Read MAINTAINING.md before editing. Theme tokens live in :root. */

:root {
  --bg: #0a0a0f;
  --surface: rgba(255, 255, 255, 0.04);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --ink: #f2f2f7;
  --ink-soft: #a9a9b8;
  --ink-faint: #74747f;
  --accent: #8b5cf6;            /* electric violet */
  --accent-soft: #4c9aff;       /* blue, gradient partner only */
  --accent-glow: rgba(139, 92, 246, 0.35);
  --line: rgba(255, 255, 255, 0.09);
  --radius: 18px;
  --nav-h: 64px;
  --maxw: 1060px;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* No smooth-scroll: the hash router jumps between views, and animating that
   jump is what made navigation feel like it was lagging. */
html { scroll-behavior: auto; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- glow field (fixed backdrop) ---------- */
.glow-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  contain: strict;          /* the orbs can never affect layout elsewhere */
  transform: translateZ(0); /* keep the whole field on its own compositor layer */
}
/* No filter: blur() here. A blurred layer has to be re-rasterised on every
   animation frame, which is the single most expensive thing on the page.
   The radial-gradient fades to transparent on its own, so the look survives. */
.orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.45;
  will-change: transform;
}
.orb-1 {
  width: 760px; height: 760px;
  top: -260px; right: -220px;
  background: radial-gradient(circle at 40% 40%, var(--accent) 0%, rgba(139, 92, 246, 0.35) 35%, transparent 68%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
.orb-2 {
  width: 660px; height: 660px;
  top: 28%; left: -260px;
  background: radial-gradient(circle at 60% 40%, var(--accent-soft) 0%, rgba(76, 154, 255, 0.3) 35%, transparent 68%);
  opacity: 0.3;
  animation: drift-b 32s ease-in-out infinite alternate;
}
.orb-3 {
  width: 600px; height: 600px;
  bottom: -220px; right: 12%;
  background: radial-gradient(circle at 50% 50%, #6d28d9 0%, rgba(109, 40, 217, 0.35) 35%, transparent 68%);
  opacity: 0.25;
  animation: drift-a 38s ease-in-out infinite alternate-reverse;
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-60px, 50px, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(70px, -40px, 0) scale(1.08); }
}

/* ---------- reveal motion ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

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

/* ---------- nav ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(10, 10, 15, 0.72);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-nav .container {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.nav-links a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.93rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.nav-links a:hover {
  color: var(--ink);
  background: var(--glass);
  text-decoration: none;
}
.nav-links a.active {
  color: #fff;
  background: var(--glass-strong);
  box-shadow: 0 0 18px var(--accent-glow);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--ink);
  margin: 4px 0;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.site-nav.open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-nav.open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 24px 18px;
    background: rgba(10, 10, 15, 0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .site-nav.open .nav-links { display: flex; }
  .nav-links a { display: block; padding: 12px 14px; font-size: 1rem; }
}

/* ---------- view switching ---------- */
.view { display: none; padding-top: var(--nav-h); min-height: 100vh; }
.view.active { display: block; animation: view-in 0.35s ease; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- shared type ---------- */
h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
}
h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-sub { color: var(--ink-soft); max-width: 560px; margin-bottom: 40px; }
.kicker {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { box-shadow: 0 0 28px var(--accent-glow); }

/* ---------- glass card base ---------- */
/* backdrop-filter deliberately NOT used here. Every card with one forces the
   browser to re-sample and re-blur the page behind it on every scroll frame,
   and there are ~20 cards on this page. The nav keeps its glass; the cards
   fake it with a flat translucent fill, which reads the same and scrolls. */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
a.card:hover, .card.hoverable:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 0 32px var(--accent-glow);
  text-decoration: none;
}

/* ---------- HOME ---------- */
.hero {
  min-height: calc(88vh - var(--nav-h));
  display: flex;
  align-items: center;
  padding: 60px 0 40px;
}
.hero-kicker { color: var(--ink-faint); font-size: 1rem; margin-bottom: 18px; }
.hero-sub {
  color: var(--ink-soft);
  font-size: 1.2rem;
  max-width: 560px;
  margin: 22px 0 34px;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; }

.route-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  padding-bottom: 90px;
}
.route-card {
  display: block;
  padding: 26px 26px 22px;
  color: var(--ink);
}
.route-card h3 { font-size: 1.15rem; margin-bottom: 6px; letter-spacing: -0.01em; }
.route-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.route-card .go { color: var(--accent); font-weight: 600; font-size: 0.95rem; }

@media (max-width: 700px) {
  .route-cards { grid-template-columns: 1fr; }
}

/* ---------- PORTFOLIO grid ---------- */
.view-head { padding: 70px 0 10px; }
.pgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  padding: 30px 0 90px;
}
.pcard {
  display: block;
  padding: 28px;
  color: var(--ink);
}
.pcard .pcard-kicker {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.pcard h3 { font-size: 1.3rem; letter-spacing: -0.015em; margin-bottom: 8px; }
.pcard p { color: var(--ink-soft); font-size: 0.97rem; margin-bottom: 16px; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; }
.pcard-foot .go { color: var(--accent); font-weight: 600; font-size: 0.93rem; }

.depth-tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

@media (max-width: 700px) {
  .pgrid { grid-template-columns: 1fr; }
}

/* ---------- PROCESS ---------- */
.method {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 10px 0 70px;
}
.method .card { padding: 24px; }
.method h3 { font-size: 1.05rem; margin-bottom: 8px; }
.method p { color: var(--ink-soft); font-size: 0.93rem; }
@media (max-width: 760px) { .method { grid-template-columns: 1fr; } }

/* ---------- build log (month accordions) ---------- */
.log { display: grid; gap: 14px; margin: 10px 0 80px; }

.log-month {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s ease;
}
.log-month[open] { border-color: rgba(139, 92, 246, 0.4); }
.log-month:hover { border-color: rgba(139, 92, 246, 0.4); }

.log-month > summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 26px;
  position: relative;
}
.log-month > summary::-webkit-details-marker { display: none; }
.log-month > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Everything inside <summary> is a <span>: summary only accepts phrasing
   content, so the layout is done with display rather than block elements. */
.log-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.log-when {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.log-count {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}

/* the peek: the 3 notable things, visible before you open the month */
.log-peek { display: grid; gap: 8px; }
.log-peek > span {
  position: relative;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}
.log-peek > span::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.log-more {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}
.log-more::before { content: "Full month \2193"; }
.log-month[open] .log-more::before { content: "Collapse \2191"; }
.log-month[open] .log-more { color: var(--ink-faint); }
.log-month[open] .log-peek { display: none; }
.log-month[open] .log-head { margin-bottom: 0; }

.log-month .timeline {
  margin: 0;
  padding: 0 26px 10px;
  border-top: 1px solid var(--line);
}
.log-month .timeline li:last-child { border-bottom: none; }

@media (max-width: 560px) {
  .log-month > summary { padding: 18px 20px; }
  .log-month .timeline { padding: 0 20px 8px; }
}

.timeline { list-style: none; margin: 10px 0 80px; }
.timeline li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.timeline time { color: var(--accent); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.timeline span { color: var(--ink-soft); }
@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

.cases {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  padding-bottom: 90px;
}
.case { padding: 26px; }
.case h3 { font-size: 1.12rem; margin-bottom: 10px; letter-spacing: -0.01em; }
.case p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.case-note { color: var(--ink-faint); font-size: 0.88rem; }
@media (max-width: 700px) { .cases { grid-template-columns: 1fr; } }

/* ---------- ABOUT / CONTACT ---------- */
.about-body { max-width: 680px; }
.about-body p { color: var(--ink-soft); font-size: 1.06rem; margin-bottom: 18px; }
.about-actions, .contact-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 30px 0 90px;
}
.contact-lede { color: var(--ink-soft); font-size: 1.1rem; max-width: 560px; margin-bottom: 8px; }
.contact-email {
  display: inline-block;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 18px 0 26px;
}

/* ---------- PROJECT DETAIL PAGES ---------- */
.detail-main { padding-top: calc(var(--nav-h) + 40px); }
.back-link {
  display: inline-block;
  color: var(--ink-soft);
  font-size: 0.93rem;
  margin-bottom: 34px;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.project-kicker {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.project h1, .detail-main h1 { margin-bottom: 14px; }
.project-value { color: var(--ink-soft); font-size: 1.18rem; max-width: 640px; margin-bottom: 40px; }

.project-visual {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 44px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.project-visual img { border-radius: 10px; }

.project-body { max-width: 680px; padding-bottom: 90px; }
.project-body > p { color: var(--ink-soft); margin-bottom: 22px; }
.muted { color: var(--ink-soft); opacity: 0.7; }

.skills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.skills li {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.depth { margin-bottom: 22px; }
.honest {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  color: var(--ink-soft);
  margin-bottom: 26px;
}
.honest strong { color: var(--ink); }
.project-links a { font-weight: 600; }

/* ---------- illustrated visuals (pipeline / terminal / json) ---------- */
.pipeline { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0; }
.pipe-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pipe-step {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: center;
}
.pipe-step span { display: block; color: var(--ink-faint); font-size: 0.78rem; font-weight: 400; }
.pipe-arrow { color: var(--ink-faint); }
.pipe-gate { border-color: var(--accent); color: var(--accent); background: rgba(139, 92, 246, 0.08); }
.pipe-final { background: var(--accent); border-color: var(--accent); color: #fff; }

.terminal {
  background: #0d0d14;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-faint); opacity: 0.5; }
.terminal-bar em { margin-left: 8px; color: var(--ink-faint); font-style: normal; font-size: 0.8rem; }
.terminal pre { padding: 18px; line-height: 1.7; color: var(--ink-soft); white-space: pre-wrap; }
.terminal pre b { color: var(--accent); font-weight: 600; }
.terminal pre i { color: var(--ink-faint); }

.json-card { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding: 8px; }
.json-before, .json-after {
  background: #0d0d14;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.85rem;
}
.json-before em, .json-after em { display: block; color: var(--ink-faint); font-style: normal; font-size: 0.78rem; margin-bottom: 8px; }
.json-before p { color: var(--ink-soft); }
.json-after pre { font-family: var(--mono); color: var(--ink-soft); white-space: pre-wrap; }
.json-arrow { color: var(--accent); font-size: 1.4rem; }
@media (max-width: 700px) {
  .json-card { grid-template-columns: 1fr; }
  .json-arrow { transform: rotate(90deg); justify-self: center; }
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 40px;
  color: var(--ink-faint);
  font-size: 0.88rem;
}
