:root {
  color-scheme: light;
  --bg: #f2ebdc;
  --paper: #faf6ec;
  --paper-2: #f3ecdd;
  --surface-solid: #faf6ec;
  --border: rgba(38, 31, 22, 0.16);
  --border-hi: rgba(38, 31, 22, 0.2);
  --text: #262019;
  --text-2: #5c5344;
  --text-dim: #726752;
  --accent: #a63d24;
  --accent-2: #3c6b5e;
  --accent-soft: rgba(166, 61, 36, 0.07);
  --accent-glow: rgba(166, 61, 36, 0.15);
  --accent-muted: rgba(60, 107, 94, 0.06);
  --shadow: 0 2px 8px rgba(38, 31, 22, 0.04);
  --shadow-lg: 0 12px 28px rgba(38, 31, 22, 0.12);
  --r: 12px;
  --r-lg: 16px;
  --mono: 'IBM Plex Mono', 'Noto Sans KR', ui-monospace, monospace;
  --display: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar-h: 56px;

  /* Shared ivory card surface, no blur. */
  --glass-bg: var(--paper);
  --glass-border: 1px solid var(--border);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
#top, #repos, #journey, section[id] { scroll-margin-top: calc(var(--topbar-h) + 12px); }

html { scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border-hi) 80%, transparent);
  border-radius: 999px;
  border: 1px solid var(--bg);
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:active {
  background: color-mix(in srgb, var(--accent) 85%, black);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

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

a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}

body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* ── mesh tint: static corner wash, own layer so it isn't dimmed by .paper-grain's opacity ── */
.mesh-tint {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(166, 61, 36, 0.08), transparent 65%),
    radial-gradient(ellipse 70% 60% at 100% 30%, rgba(60, 107, 94, 0.04), transparent 65%);
}

/* ── paper grain: fixed noise layer, replaces the old video background ── */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0 0.09 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.34;
  mix-blend-mode: multiply;
}
@media (prefers-reduced-motion: reduce), (max-width: 560px) {
  .paper-grain { opacity: 0.22; }
}

.accent-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  background: var(--accent);
  opacity: 0.9;
}

/* Shared opaque card surface. */
.glass {
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--shadow);
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 6px 1.5rem;
  padding-top: max(6px, env(safe-area-inset-top, 0px));
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
  margin-top: 3px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.25s, box-shadow 0.25s;
}
html.is-scrolled .topbar {
  border-bottom-color: var(--border-hi);
  box-shadow: 0 8px 24px rgba(38, 31, 22, 0.08);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--paper);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  font-family: var(--display);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.brand:hover .brand-mark {
  transform: rotate(-4deg);
  box-shadow: 0 3px 10px var(--accent-glow);
}
.brand-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-2);
  font-weight: 500;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(38, 31, 22, 0.03);
  border: 1px solid var(--border);
  min-width: 0;
  flex-shrink: 1;
}
.topnav a {
  display: flex;
  align-items: center;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.topnav a:hover {
  color: var(--text);
  background: rgba(38, 31, 22, 0.06);
}
.topnav a.nav-cta {
  color: #ffffff;
  font-weight: 600;
  background: var(--accent);
}
.topnav a.nav-cta:hover {
  filter: brightness(1.08);
}

/* ── Layout ── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

/* ── Hero ── */
.hero {
  position: relative;
  margin-bottom: 2rem;
  text-align: left;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 1.5rem;
  padding: 0.4rem 0.9rem 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px dashed var(--border-hi);
  transform: none;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
}

h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.65rem;
  line-height: 1.12;
}
h1 .name-line {
  display: block;
  color: var(--text);
  margin-bottom: 0.1em;
}
h1 .hl {
  display: block;
  color: var(--accent);
  font-style: normal;
}

.tagline {
  display: block;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 400;
  margin: 0 0 0.9rem;
  max-width: 34em;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 2.2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s, border-color 0.2s, filter 0.2s;
}
.btn-arrow {
  font-size: 12px;
  opacity: 0.8;
  transition: transform 0.25s var(--ease);
}
.btn-primary {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 3px 14px var(--accent-glow);
}
.btn-ghost {
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--border-hi);
}
@media (hover: hover) {
  .btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--accent-glow);
  }
  .btn-primary:hover .btn-arrow { transform: translateY(3px); }
  .btn-ghost:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
  }
  .btn-ghost:hover .btn-arrow { transform: translateY(3px); }
  .btn:active { transform: translateY(0) scale(0.98); }
}

/* hero stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.stat-card {
  position: relative;
  padding: 0.7rem 0.75rem;
  border-radius: var(--r);
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--shadow);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
@media (hover: hover) {
  .stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px) rotate(-0.4deg);
    box-shadow: var(--shadow-lg);
  }
}
.stat-num {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}
.stat-label {
  display: block;
  font-size: 0.64rem;
  line-height: 1.4;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.skill-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}
.skill-strip span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.36rem 0.75rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.25s var(--ease);
}
@media (hover: hover) {
  .skill-strip span:hover {
    color: var(--accent-2);
    border-color: var(--accent-2);
    background: var(--accent-muted);
    transform: translateY(-2px);
  }
}

.exp-note {
  position: relative;
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0.9rem 1rem 0.9rem 1.15rem;
  border-radius: var(--r);
  margin-bottom: 1.1rem;
  overflow: hidden;
}
.exp-note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.learning-note {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: var(--r);
  margin-bottom: 3.8rem;
  position: relative;
}
.learning-note .li-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border: 1px solid var(--border);
}
.learning-note .li-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-2);
}
.learning-note .li-body p {
  margin: 0 0 0.5rem;
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.6;
}
.learning-note .li-body p b {
  color: var(--text);
  font-weight: 600;
}
.learning-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.learning-tags span {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--paper);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.25s var(--ease);
}
@media (hover: hover) {
  .learning-tags span:hover {
    color: var(--accent-2);
    border-color: var(--accent-2);
    background: var(--accent-muted);
    transform: translateY(-2px);
  }
}

/* sections */
section { margin-bottom: 1.75rem; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}
h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
h2::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--accent);
}
.section-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

#journey .section-head h2::before {
  background: var(--accent-2);
}

/* repo cards */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.repo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: var(--r);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.2s;
  overflow: hidden;
}
.repo-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  object-position: top;
  background: var(--paper-2);
  border-bottom: 1px solid var(--border);
  transition: transform 0.4s var(--ease);
}
.repo-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.7rem 0.85rem;
}
.repo-card:focus,
.repo-card:focus-visible,
.tl-item:focus,
.tl-item:focus-visible {
  outline: none;
}
@media (hover: hover) {
  .repo-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
  }
  .repo-card:hover .repo-thumb { transform: scale(1.05); }
  .repo-card:hover .repo-head svg { color: var(--accent); }
  .repo-card:hover .repo-live {
    border-color: var(--accent-2);
  }
  .repo-card:hover .repo-tags span {
    border-color: var(--accent);
    color: var(--accent);
  }
  .repo-card:active { transform: translateY(-1px); }
}

.repo-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.repo-head svg,
.repo-head .icon-gh {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.25s;
}
.repo-head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--mono);
  flex: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.repo-live {
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.42rem;
  border-radius: 999px;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.25s;
}
.repo-live::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
}
.repo-desc {
  margin: 0 0 0.55rem;
  color: var(--text-2);
  font-size: 0.79rem;
  line-height: 1.5;
  min-height: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}
.repo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
}
.repo-tags span {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--text-2);
  font-weight: 500;
  border: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}

/* journey timeline */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.tl-item {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem 0.7rem 2.3rem;
  text-decoration: none;
  color: inherit;
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), background 0.25s, transform 0.25s var(--ease);
}
.tl-thumb {
  flex-shrink: 0;
  width: 128px;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper-2);
  transition: transform 0.4s var(--ease);
}
@media (hover: hover) {
  .tl-item:hover {
    border-color: var(--border-hi);
    background: var(--paper);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
  }
  .tl-item:hover .tl-thumb { transform: scale(1.06); }
  .tl-item:hover h3 .go {
    color: var(--accent-2);
    transform: translate(3px, -2px);
  }
  .tl-item:active { background: var(--paper-2); }
}
.tl-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.tl-date {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}
.tl-ver {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--accent-2);
  padding: 0.06rem 0.4rem;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.tl-body { flex: 1; min-width: 0; }
.tl-body h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-body h3 .go {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 400;
  display: inline-block;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease), color 0.2s;
}
.tl-body p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.79rem;
  line-height: 1.42;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* footer */
footer {
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--border);
  border-radius: var(--r);
}
footer .flinks {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
footer a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
footer a:hover {
  color: var(--accent-2);
  border-color: var(--border);
  background: var(--accent-muted);
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: 1fr; }
  .stat-card { display: flex; align-items: baseline; gap: 0.75rem; }
  .stat-num { margin-bottom: 0; }
}

@media (max-width: 560px) {
  footer {
    flex-direction: column;
    gap: 0.7rem;
    text-align: center;
  }
  .brand-name { display: none; }
  .brand-cluster { gap: 8px; }
  .topbar {
    padding: 6px 0.9rem;
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-left: max(0.9rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.9rem, env(safe-area-inset-right, 0px));
  }
  .topnav a {
    padding: 6px 9px;
    font-size: 12px;
    min-height: 36px;
  }
  /* Projects/Journey duplicate the hero CTAs right below the fold —
     drop them here so GitHub + Resume stay visible in the pill */
  .topnav .topnav-anchor { display: none; }
  .wrap {
    padding: 3rem 1.15rem 3.5rem;
    padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 0px) + 2rem);
    padding-left: max(1.15rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.15rem, env(safe-area-inset-right, 0px));
  }
  .exp-note,
  .learning-note { margin-bottom: 2rem; }
  .repo-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .hero-cta .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }
  h1 { font-size: clamp(1.7rem, 7vw, 2.1rem); }
  dialog.modal-frame {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .repo-card,
  .stat-card,
  .tl-item,
  .btn,
  .skill-strip span,
  .learning-tags span {
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s !important;
  }
  .repo-card:hover,
  .stat-card:hover,
  .tl-item:hover,
  .btn:hover,
  .skill-strip span:hover,
  .learning-tags span:hover {
    transform: none !important;
  }
}

/* modal */
dialog.modal-frame {
  display: none;
  width: min(1100px, 94vw);
  height: 94vh;
  margin: auto;
  padding: 0;
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(38, 31, 22, 0.04);
  flex-direction: column;
  overflow: hidden;
}
dialog.modal-frame[open] {
  display: flex;
  animation: modalIn 0.25s var(--ease);
}
dialog.modal-frame::backdrop {
  background: rgba(38, 31, 22, 0.35);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.05rem;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  flex-shrink: 0;
}
.modal-title {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.modal-actions a {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent-2);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--border-hi);
  transition: background 0.15s, border-color 0.15s;
}
.modal-actions a:hover {
  background: var(--accent-muted);
  border-color: var(--accent-2);
}
.modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.modal-close svg { width: 13px; height: 13px; }
.modal-close:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.modal-frame iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--surface-solid);
}

/* entrance */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-badge,
h1,
.tagline,
.hero-cta,
.hero-stats,
.skill-strip,
.exp-note,
.learning-note {
  animation: riseIn 0.7s var(--ease-out) both;
}
h1 { animation-delay: 0.06s; }
.tagline { animation-delay: 0.12s; }
.hero-cta { animation-delay: 0.18s; }
.hero-stats { animation-delay: 0.24s; }
.skill-strip { animation-delay: 0.3s; }
.exp-note { animation-delay: 0.36s; }
.learning-note { animation-delay: 0.42s; }

.reveal-section {
  padding: 0 12px;
  margin-left: -12px;
  margin-right: -12px;
}
.reveal-section h2,
.reveal-section .section-sub {
  opacity: 1;
  transition: opacity 0.45s ease;
}
/* card reveal: settles into place like a photo being set down — one-shot, not continuous.
   NOTE: this selector out-specifies the base .repo-card/.tl-item rule, so its `transition`
   shorthand is what actually governs hover (border-color/box-shadow/background) too — every
   property that needs to ease on hover must be listed here, or it silently snaps instead. */
.reveal-section .repo-card,
.reveal-section .tl-item {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.18s var(--ease-out),
    box-shadow 0.28s var(--ease),
    border-color 0.2s var(--ease),
    background 0.25s var(--ease);
}
.reveal-section.in-view h2,
.reveal-section.in-view .section-sub {
  opacity: 1;
}
.reveal-section.in-view .repo-card,
.reveal-section.in-view .tl-item {
  opacity: 1;
  transform: translateY(0) rotate(0deg);
}
.reveal-section.in-view h2,
.reveal-section.in-view .section-sub { transition-delay: 0s; }
.reveal-section.in-view .repo-card,
.reveal-section.in-view .tl-item {
  transition-delay: calc(0.05s + var(--reveal-i, 0) * 0.04s);
}
/* .reveal-section.in-view .tl-item (0,3,0) out-specifies plain .tl-item:hover
   (0,2,0), so the hover lift needs to be pinned at equal-or-higher specificity
   here or it silently gets reset by the rest-state transform above. */
@media (hover: hover) {
  .reveal-section.in-view .tl-item:hover {
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-section h2,
  .reveal-section .section-sub,
  .reveal-section .repo-card,
  .reveal-section .tl-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-badge, h1, .tagline, .hero-cta, .hero-stats,
  .skill-strip, .exp-note, .learning-note {
    animation: none;
  }
}

/* Project overview: use the desktop width, keep narrow screens readable. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 2rem; align-items: center; }
.hero-badge { grid-column: 1 / -1; justify-self: start; margin-bottom: 1rem; }
.hero-cta { margin-bottom: 0; }
.hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0; }
.context-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.75rem; }
.context-grid > * { margin: 0; min-width: 0; }
.section-sub a, .repo-head a { color: inherit; text-decoration: none; }
.repo-card { cursor: pointer; }
.repo-head a::after { content: ""; position: absolute; inset: 0; cursor: pointer; }
.repo-card:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.repo-actions { position: relative; z-index: 1; }
.section-sub a:hover, .repo-head a:hover { color: var(--accent); text-decoration: underline; }
.repo-head h3 { white-space: normal; overflow-wrap: anywhere; }
.repo-thumb { height: 104px; aspect-ratio: auto; }
.repo-desc { display: block; overflow: visible; }
.repo-actions { margin-top: auto; }
.repo-actions { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0.85rem; border-top: 1px solid var(--border); }
.repo-actions a { color: var(--accent); font-size: 0.75rem; font-weight: 600; text-decoration: none; padding: 0.25rem 0; }
.repo-actions a:hover { text-decoration: underline; }
.project-map { display: grid; grid-template-columns: 80px repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.project-map button { font: inherit; text-align: left; color: var(--text-2); background: var(--paper); border: 1px solid var(--border-hi); border-radius: var(--r); padding: 0.65rem 0.8rem; cursor: pointer; }
.project-map button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.map-label { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; }
.map-all { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.25rem; }
.map-all strong { font-size: 1.5rem; }
.map-track { display: block; height: 4px; margin: 0.65rem 0; background: var(--border); border-radius: 4px; }
.map-track > span { display: block; height: 100%; width: var(--share); background: var(--accent-2); border-radius: inherit; }
.map-flow { display: block; font-size: 0.72rem; word-break: keep-all; }
.project-result { color: var(--text-dim); font-size: 0.75rem; margin: 0.7rem 0 1rem; }
.prism-feature { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 1rem 1.25rem; padding: 1rem 1.15rem; border-radius: var(--r-lg); border-top: 3px solid var(--accent); }
.feature-label { color: var(--accent); font: 600 0.7rem var(--mono); }
.prism-feature h3 { margin: 0.4rem 0; font-size: 1.15rem; letter-spacing: -0.03em; }
.prism-feature p { font-size: 0.83rem; color: var(--text-2); line-height: 1.6; margin: 0 0 0.5rem; word-break: keep-all; }
.feature-link { display: inline-block; color: var(--accent); font-size: 0.85rem; font-weight: 600; text-decoration: none; padding: 0.4rem 0; }
.feature-link:hover { text-decoration: underline; }
.prism-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.prism-flow li { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.flow-number { font: 500 0.8rem var(--mono); color: var(--accent); }
.prism-flow strong { display: block; font-size: 0.85rem; }
.prism-flow div > span { display: block; font-size: 0.75rem; color: var(--text-dim); word-break: keep-all; }
.prism-facts { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.prism-facts li { padding: 0.5rem 0.65rem; border-left: 2px solid var(--accent-2); background: var(--accent-muted); border-radius: 0 8px 8px 0; }
.prism-facts strong { display: block; font-size: 1.05rem; color: var(--text); }
.prism-facts span { display: block; font-size: 0.72rem; color: var(--text-dim); word-break: keep-all; }
.prism-shots { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.prism-shot { display: block; color: inherit; text-decoration: none; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: #1c1d20; }
.prism-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: left top; }
.shot-caption { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.7rem; background: var(--paper); border-top: 1px solid var(--border); font-size: 0.78rem; }
.shot-caption span { color: var(--accent-2); font-size: 0.7rem; font-weight: 500; white-space: nowrap; align-self: center; }
.prism-detail { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); gap: 0.75rem; }
.prism-block { padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.prism-detail h4 { margin: 0 0 0.5rem; font-size: 0.85rem; }
.prism-detail ul { margin: 0; padding-left: 1rem; display: grid; gap: 0.3rem; font-size: 0.76rem; line-height: 1.55; color: var(--text-2); word-break: keep-all; }
.prism-detail b { color: var(--text); margin-right: 0.2rem; }
.prism-feature .prism-next { margin: 0.55rem 0 0; font-size: 0.72rem; color: var(--text-dim); }
.prism-stack { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.4rem 0.6rem; align-items: baseline; }
.prism-stack dt { font: 600 0.68rem var(--mono); color: var(--accent); }
.prism-stack dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.prism-stack dd span { font-size: 0.7rem; padding: 0.1rem 0.45rem; border: 1px solid var(--border); border-radius: 999px; background: var(--paper); color: var(--text-2); }
.journey-records-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 1.15rem 0 0.7rem; }
.journey-note { display: flex; align-items: center; gap: 0.55rem; font-size: 0.95rem; font-weight: 700; color: var(--text); margin: 0; }
.journey-note::before { content: ""; width: 3px; height: 16px; border-radius: 2px; background: var(--accent-2); flex-shrink: 0; }
.journey-records-count { font-size: 0.68rem; color: var(--accent-2); background: var(--accent-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.18rem 0.55rem; white-space: nowrap; }
.timeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.timeline::before, .tl-item::before { display: none; }
.tl-item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0.7rem; padding: 0.75rem; }
.tl-thumb { width: 72px; height: 54px; aspect-ratio: auto; }
.tl-body h3 { display: block; font-size: 0.83rem; white-space: normal; overflow: visible; }
.tl-body p { font-size: 0.76rem; line-height: 1.5; }
.tl-meta { flex-wrap: wrap; }
[hidden] { display: none !important; }
@media (min-width: 1050px) {
  .repo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h1 { font-size: 2.6rem; }
}
@media (max-width: 1000px) {
  .hero { grid-template-columns: minmax(0, 1fr) 270px; gap: 0 1.5rem; }
  .repo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prism-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prism-block:last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .hero { display: block; }
  .hero-cta { margin-bottom: 0.85rem; }
  .hero-stats .stat-card { display: block; }
  .hero-stats .stat-num { margin-bottom: 0.25rem; }
  .context-grid { grid-template-columns: 1fr; }
  .project-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prism-feature { grid-template-columns: 1fr; gap: 0.75rem; padding: 0.9rem; }
  .prism-shots, .prism-detail { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .repo-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .repo-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .repo-thumb { grid-row: 1 / -1; width: 96px; height: 100%; min-height: 140px; object-fit: contain; object-position: center; border-bottom: 0; border-right: 1px solid var(--border); }
  .repo-body { min-width: 0; }
  .repo-actions { grid-column: 2; gap: 0.5rem; }
}
