/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf7;
  --fg: #0b0b0b;
  --muted: #5d5d57;
  --line: #e4e4de;
  --card: #ffffff;
  --soft: #f0f0eb;
  --accent: #128a46;
  --accent-ink: #ffffff;
  --glow: rgba(18, 138, 70, 0.12);
  --radius: 22px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Inter Tight", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0b0a;
  --fg: #f1f1ec;
  --muted: #9b9b94;
  --line: #22241f;
  --card: #121411;
  --soft: #181a17;
  --accent: #3ddc84;
  --accent-ink: #06210f;
  --glow: rgba(61, 220, 132, 0.12);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 640px; }
.link { color: var(--muted); transition: color 0.2s; }
.link:hover { color: var(--fg); }
em { font-style: normal; color: var(--accent); }

/* ---------- Progress + header ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}
.site-header {
  position: sticky; top: 0; z-index: 50;
  transition: background-color 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }
.logo { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  font-size: 15px; color: var(--muted); padding: 8px 14px; border-radius: 999px;
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--fg); background: var(--soft); }
.nav-tools { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang button {
  font: 500 12px var(--font); letter-spacing: 0.04em; color: var(--muted);
  background: none; border: 0; padding: 6px 9px; border-radius: 999px; cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.lang button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--fg); cursor: pointer;
  transition: background-color 0.2s, transform 0.4s var(--ease);
}
.icon-btn:hover { background: var(--soft); transform: rotate(20deg); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
:root[data-theme="dark"] .i-sun, :root:not([data-theme="dark"]) .i-moon { display: none; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 24px; border-radius: 999px;
  border: 1px solid var(--line); font-weight: 500; font-size: 16px;
  transition: transform 0.35s var(--ease), background-color 0.25s, border-color 0.25s, color 0.25s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--fg); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100svh - 72px);
  display: flex; flex-direction: column; justify-content: center; gap: 24px;
  padding-top: 48px; padding-bottom: 72px; position: relative;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; width: 620px; height: 620px; right: -160px; top: 4%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  animation: float 12s ease-in-out infinite;
}
.hero h1 { font-size: clamp(42px, 7vw, 96px); max-width: 15ch; letter-spacing: -0.045em; line-height: 1; }
.hero-sub, .hero-actions, .hero .eyebrow, .status { opacity: 0; animation: fadeUp 0.9s var(--ease) forwards; }
.status { animation-delay: 0.05s; }
.hero .eyebrow { animation-delay: 0.15s; }
.hero-sub { animation-delay: 0.7s; }
.hero-actions { animation-delay: 0.85s; margin-top: 8px; }
.status {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  font-size: 14px; padding: 7px 14px 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: relative; }
.dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent);
  animation: pulse 2s ease-out infinite;
}

/* Word-by-word headline */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.06em 0.1em 0.22em; margin: -0.06em -0.1em -0.22em; }
.w > span {
  display: inline-block; transform: translateY(140%);
  animation: wordUp 1s var(--ease) forwards;
  animation-delay: calc(var(--i) * 55ms + 200ms);
}

/* ---------- Marquee ---------- */
.marquee {
  border-block: 1px solid var(--line); overflow: hidden; padding: 22px 0;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; gap: 40px; width: max-content; animation: marquee 38s linear infinite; }
.marquee-track span { font-family: var(--display); font-size: clamp(22px, 2.6vw, 32px); font-weight: 500; letter-spacing: -0.02em; white-space: nowrap; color: var(--muted); }
.marquee-track i { color: var(--accent); font-style: normal; align-self: center; }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ---------- Sections ---------- */
.section { padding-top: clamp(88px, 12vw, 160px); }
.section-head { display: grid; gap: 16px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(34px, 5vw, 64px); max-width: 16ch; }
.split { display: grid; grid-template-columns: 1fr 3fr; gap: 32px; }
.split + .split { margin-top: 96px; }

/* ---------- Case cards ---------- */
.case-list { display: grid; grid-template-columns: 1fr 1fr; gap: 48px 32px; }
.case-card { display: grid; gap: 22px; cursor: none; }
.case-card:first-child { grid-column: 1 / -1; }
.case-visual {
  aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; position: relative;
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(var(--hue) 70% 50% / 0.35), transparent 60%),
    linear-gradient(160deg, hsl(var(--hue) 35% 92%), hsl(var(--hue) 30% 84%));
  isolation: isolate;
}
:root[data-theme="dark"] .case-visual {
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(var(--hue) 70% 45% / 0.4), transparent 60%),
    linear-gradient(160deg, hsl(var(--hue) 20% 14%), hsl(var(--hue) 18% 9%));
}
.case-visual > img, .case-visual > .mock { transition: transform 0.9s var(--ease); }
.case-visual > img { width: 100%; height: 100%; object-fit: cover; }
.case-card:hover .case-visual > img, .case-card:hover .case-visual > .mock { transform: scale(1.04) translateY(-1%); }
.case-info { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; }
.case-num { font: 500 14px var(--font); color: var(--muted); padding-top: 6px; }
.case-company { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.case-info h3 { font-size: clamp(24px, 2.6vw, 34px); margin-bottom: 10px; }
.case-summary { color: var(--muted); max-width: 58ch; }
.case-arrow {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); font-size: 20px;
  transition: transform 0.45s var(--ease), background-color 0.3s, color 0.3s, border-color 0.3s;
}
.case-card:hover .case-arrow { transform: rotate(-45deg); background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags li { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); }

/* Abstract UI mock used until real images exist */
.mock {
  position: absolute; inset: 12% 10% -6% 10%; border-radius: 14px;
  background: var(--card); box-shadow: 0 30px 80px -30px hsl(var(--hue) 40% 20% / 0.45);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  display: flex; flex-direction: column; overflow: hidden;
}
.mock-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.mock-body { display: flex; flex: 1; }
.mock-side { width: 22%; border-right: 1px solid var(--line); padding: 16px 12px; display: grid; gap: 10px; align-content: start; }
.mock-side b, .mock-main > b, .mock-rows b { display: block; height: 9px; border-radius: 5px; background: var(--soft); }
.mock-side b:first-child { background: hsl(var(--hue) 60% 45% / 0.55); width: 70%; }
.mock-main { flex: 1; padding: 18px; display: grid; gap: 12px; align-content: start; }
.mock-main > b:first-child { height: 14px; background: color-mix(in srgb, var(--fg) 14%, transparent); }
.mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.mock-grid span { height: 54px; border-radius: 9px; background: var(--soft); }
.mock-grid span:first-child { background: hsl(var(--hue) 60% 45% / 0.22); }
.mock-rows { display: grid; gap: 9px; margin-top: 6px; }

/* ---------- About / skills ---------- */
.about-side { display: grid; gap: 28px; align-content: start; }
.portrait { margin: 0; position: relative; width: min(100%, 240px); aspect-ratio: 1; }
.portrait::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  background: var(--accent); transform: translate(10px, 10px);
  transition: transform 0.6s var(--ease);
}
.portrait img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius);
  filter: grayscale(1) contrast(1.12) brightness(1.02);
  transition: filter 0.7s var(--ease), transform 0.6s var(--ease);
}
.portrait:hover img { filter: grayscale(0) contrast(1); transform: translate(-4px, -4px); }
.portrait:hover::before { transform: translate(14px, 14px); }
.about-body { font-family: var(--display); font-size: clamp(24px, 2.8vw, 36px); line-height: 1.3; letter-spacing: -0.02em; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 56px; }
.stat { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 4px; }
.stat strong { font-family: var(--display); font-size: clamp(40px, 5vw, 64px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat span { color: var(--muted); font-size: 15px; }
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.skill {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px;
  transition: transform 0.5s var(--ease), border-color 0.3s;
}
.skill:hover { transform: translateY(-4px); border-color: var(--accent); }
.skill h3 { font-size: 22px; margin-bottom: 16px; }
.skill ul { display: flex; flex-wrap: wrap; gap: 8px; }
.skill li { font-size: 14px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

/* ---------- Experience ---------- */
.exp-row {
  display: grid; grid-template-columns: 160px 1fr 1.6fr; gap: 24px;
  padding: 28px 0; border-top: 1px solid var(--line);
  transition: padding 0.4s var(--ease);
}
.exp-row:last-child { border-bottom: 1px solid var(--line); }
.exp-row:hover { padding-left: 12px; }
.exp-period { font-size: 14px; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.exp-row h3 { font-size: 22px; }
.exp-role { color: var(--muted); font-size: 15px; margin-top: 4px; }
.exp-text { color: var(--muted); font-size: 15px; }

/* ---------- Contact ---------- */
.contact { display: grid; gap: 24px; padding-bottom: 40px; }
.contact-title { font-size: clamp(44px, 8vw, 112px); letter-spacing: -0.05em; }
.big-mail {
  font-family: var(--display); font-size: clamp(24px, 4.6vw, 60px); font-weight: 500; letter-spacing: -0.03em;
  justify-self: start; position: relative; color: var(--accent); overflow-wrap: anywhere;
}
.big-mail::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor;
  transform: scaleX(0.25); transform-origin: left; transition: transform 0.6s var(--ease);
}
.big-mail:hover::after { transform: scaleX(1); }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding-top: 40px; padding-bottom: 40px; margin-top: 80px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}

/* ---------- Case page ---------- */
.case-hero { display: grid; gap: 22px; padding-top: 48px; padding-bottom: 56px; }
.back { font-size: 15px; justify-self: start; margin-bottom: 16px; }
.case-hero h1 { font-size: clamp(42px, 7vw, 100px); letter-spacing: -0.045em; line-height: 1; max-width: 14ch; }
.case-hero .lead, .case-hero .eyebrow, .case-meta, .back { opacity: 0; animation: fadeUp 0.9s var(--ease) forwards; }
.case-hero .eyebrow { animation-delay: 0.1s; }
.case-hero .lead { animation-delay: 0.5s; }
.case-meta { animation-delay: 0.65s; }
.case-meta { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 24px; margin: 24px 0 0; border-top: 1px solid var(--line); padding-top: 24px; }
.case-meta dt { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.case-meta dd { margin: 0; font-size: 15px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding-top: 48px; padding-bottom: 32px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 10px; align-content: start; }
.metric strong { font-family: var(--display); font-size: clamp(36px, 4.4vw, 60px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; color: var(--accent); overflow-wrap: anywhere; }
.metric span { color: var(--muted); font-size: 15px; }
/* Case sections: heading left, text right, blocks full width below */
.cs { display: grid; grid-template-columns: 1fr 2fr; gap: 24px 32px; padding: 72px 0; border-bottom: 1px solid var(--line); }
.cs-head { display: grid; gap: 12px; align-content: start; }
.cs-head h2 { font-size: clamp(28px, 3.2vw, 40px); }
.cs-body { display: grid; gap: 18px; font-size: 18px; align-content: start; }
.cs-body:empty { display: none; }
.cs-body p { max-width: 62ch; }
.cs-block { grid-column: 1 / -1; margin-top: 16px; min-width: 0; }
.cs.closing .cs-body p { font-family: var(--display); font-size: clamp(22px, 2.4vw, 30px); line-height: 1.35; letter-spacing: -0.02em; color: var(--fg); }

.cs-figure { margin: 0; display: grid; gap: 12px; min-width: 0; }
.cs-figure img { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
.cs-figure figcaption { font-size: 14px; color: var(--muted); max-width: 70ch; }
.cs-figure.mid { max-width: 960px; margin-inline: auto; }
.cs-figure.narrow { max-width: 760px; margin-inline: auto; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.compare .frame { aspect-ratio: 7 / 5; background: var(--card); border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; padding: 14px; overflow: hidden; }
.compare .frame img { width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: 8px; background: transparent; }
.tag { justify-self: start; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.tag-before { background: var(--soft); color: var(--muted); }
.tag-after { background: var(--glow); color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 10px; align-content: start; }
.card h3 { font-size: 20px; letter-spacing: -0.02em; }
.card p { color: var(--muted); font-size: 15.5px; }
.cards.numbered { counter-reset: card; }
.cards.numbered .card::before { counter-increment: card; content: counter(card, decimal-leading-zero); font-size: 13px; font-weight: 600; color: var(--accent); }

.scroll { overflow-x: auto; padding-bottom: 4px; }
.steps { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; min-width: 880px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; gap: 8px; align-content: start; padding-top: 16px; border-top: 2px solid var(--line); }
.steps li.key { border-top-color: var(--accent); }
.steps li::before { content: counter(step, decimal-leading-zero); font-size: 13px; color: var(--muted); }
.steps b { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.steps small { font-size: 14px; color: var(--muted); line-height: 1.45; }

.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.quotes blockquote { margin: 0; padding: 24px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 14px; display: grid; gap: 12px; align-content: start; }
.quotes p { font-family: var(--display); font-size: 19px; line-height: 1.4; letter-spacing: -0.01em; }
.quotes cite { font-style: normal; font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.cs-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15.5px; }
.cs-table th, .cs-table td { text-align: left; vertical-align: top; padding: 16px 16px 16px 0; border-bottom: 1px dashed var(--line); }
.cs-table thead th { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.cs-table tbody th { font-family: var(--display); font-weight: 600; font-size: 17px; white-space: nowrap; }
.cs-table td { color: var(--muted); }

.diagram { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 22px; min-width: 0; }
.divider { height: 1px; background: var(--line); }
.node { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; background: var(--bg); min-width: 0; }
.node b { font-weight: 600; font-size: 15px; line-height: 1.3; }
.node small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.arrow { align-self: center; justify-self: center; color: var(--muted); font-size: 18px; padding: 0 8px; }
.lane { display: grid; gap: 14px; min-width: 860px; }
.lane-title { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.lane-row { display: flex; align-items: stretch; }
.lane-row .node { flex: 1 1 0; }
.lane-before .node.pain { border-style: dashed; background: var(--soft); }
.lane-after .node { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--glow); }
.loop { font-size: 14px; color: var(--accent); }
.map { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); gap: 12px 0; align-items: stretch; }
.map .node.pain { border-style: dashed; background: var(--soft); }
.map .node:not(.pain) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--glow); }

.matrix { width: 100%; min-width: 820px; border-collapse: separate; border-spacing: 6px; }
.matrix thead th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 4px 4px; }
.matrix tbody th { font-family: var(--display); font-size: 17px; font-weight: 600; text-align: left; width: 120px; vertical-align: middle; }
.matrix tbody th small { display: block; font-family: var(--font); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.cell { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.35; height: 100%; }
.cell b { display: block; font-size: 13px; font-weight: 600; }
.cell.full { background: var(--accent); color: var(--accent-ink); }
.cell.stage { border: 1.5px solid var(--accent); color: var(--fg); background: var(--glow); }
.cell.none { border: 1px dashed var(--line); color: var(--muted); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 8px; align-items: center; }
.sw { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.full { background: var(--accent); }
.sw.stage { border: 1.5px solid var(--accent); background: var(--glow); }
.sw.none { border: 1px dashed var(--muted); }
.palette { display: grid; grid-template-columns: repeat(11, minmax(60px, 1fr)); gap: 6px; min-width: 720px; }
.swatch { display: grid; gap: 6px; }
.swatch span { height: 72px; border-radius: 10px; display: flex; align-items: flex-end; padding: 6px 8px; font-size: 12px; font-weight: 600; }
.swatch.base span { outline: 2px solid var(--fg); outline-offset: 2px; }
.swatch small { display: grid; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.swatch small b { color: var(--fg); font-weight: 500; }
.cs-code { margin: 0; background: #0d0d0f; color: #e8e8ea; border-radius: var(--radius); padding: 24px; font: 13.5px/1.65 ui-monospace, Menlo, Consolas, monospace; overflow-x: auto; max-width: 720px; }
.cs-code .c { color: var(--code-comment, #3ddc84); }
.code-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.code-split .cs-code { max-width: none; }
.code-split h3 { font-size: 18px; }

/* Per-case accent: the case sets accent: "purple" */
:root[data-accent="purple"] { --accent: #8C3DE0; --accent-ink: #ffffff; --glow: rgba(140, 61, 224, 0.12); --code-comment: #C69EF0; }
:root[data-accent="purple"][data-theme="dark"] { --accent: #B17BEA; --accent-ink: #0B0812; --glow: rgba(177, 123, 234, 0.14); }
.checks { display: grid; gap: 12px; }
.checks li { position: relative; padding-left: 32px; color: var(--muted); max-width: 62ch; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 0.45em; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.next-case {
  display: grid; gap: 10px; margin-top: 96px; padding: 48px; border-radius: var(--radius); cursor: none;
  background: var(--soft); transition: background-color 0.4s var(--ease);
}
.next-case:hover { background: hsl(var(--hue) 60% 45% / 0.16); }
.next-title { font-family: var(--display); font-size: clamp(32px, 5vw, 64px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
.next-title span { display: inline-block; transition: transform 0.5s var(--ease); }
.next-case:hover .next-title span { transform: translateX(12px); }

/* ---------- Cursor pill ---------- */
.cursor-pill {
  position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none;
  padding: 12px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  opacity: 0; scale: 0.4; transition: opacity 0.25s, scale 0.35s var(--ease);
}
.cursor-pill.on { opacity: 1; scale: 1; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(40px); filter: blur(6px); transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; filter: none; }
.case-list .case-card:nth-child(odd).reveal { transition-delay: 0.08s; }

/* ---------- Page transitions (Chrome/Edge/Safari 18+) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 0.35s var(--ease) both vtOut; }
::view-transition-new(root) { animation: 0.55s var(--ease) both vtIn; }

/* ---------- Keyframes ---------- */
@keyframes wordUp { to { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pulse { from { transform: scale(1); opacity: 0.7; } to { transform: scale(3); opacity: 0; } }
@keyframes float { 50% { transform: translate(-40px, 30px) scale(1.08); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes vtOut { to { opacity: 0; transform: translateY(-16px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .split, .cs { grid-template-columns: 1fr; gap: 20px; }
  .compare, .code-split { grid-template-columns: 1fr; }
  .case-meta { grid-template-columns: 1fr 1fr; }
  .exp-row { grid-template-columns: 1fr; gap: 6px; }
  .exp-row:hover { padding-left: 0; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .case-list, .skills { grid-template-columns: 1fr; }
  .case-info { grid-template-columns: 1fr; gap: 6px; }
  .case-arrow { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .case-meta { grid-template-columns: 1fr; }
  .next-case { padding: 28px; }
  .cs { padding: 56px 0; }
  .diagram { padding: 18px; }
  .map { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .map .arrow { transform: rotate(90deg); }
  .hero::before { width: 360px; height: 360px; right: -140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .w > span, .reveal { transform: none; filter: none; opacity: 1; }
  .marquee-track { animation: none; }
  html { scroll-behavior: auto; }
}
