/* ==========================================================================
   muhammadusmandev.com
   ========================================================================== */

:root {
  --paper: #EDEAE2;
  --paper-2: #E3DFD4;
  --ink: #16150F;
  --ink-2: #57534A;
  --line: rgba(22, 21, 15, 0.16);
  --accent: #FF4D1A;
  --panel: #191813;
  --panel-2: #24221C;
  --panel-line: rgba(237, 234, 226, 0.12);
  --panel-border: transparent;
  --band-bg: #16150F;
  --band-fg: #EDEAE2;
  --grain-blend: multiply;
  --grain-opacity: 0.32;
  /* fixed in both themes: text on the accent, and on the always-dark demo panels */
  --light: #EDEAE2;
  --dark: #16150F;
  color-scheme: light;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* dark theme: an explicit choice, or the system setting when nothing is saved */
:root[data-theme="dark"] {
  --paper: #131210;
  --paper-2: #1D1C18;
  --ink: #ECE8DF;
  --ink-2: #A39E93;
  --line: rgba(236, 232, 223, 0.14);
  --accent: #FF5A28;
  --panel: #1B1A16;
  --panel-2: #27251F;
  --panel-border: rgba(236, 232, 223, 0.1);
  --band-bg: #1D1C18;
  --band-fg: #ECE8DF;
  --grain-blend: screen;
  --grain-opacity: 0.09;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131210;
    --paper-2: #1D1C18;
    --ink: #ECE8DF;
    --ink-2: #A39E93;
    --line: rgba(236, 232, 223, 0.14);
    --accent: #FF5A28;
    --panel: #1B1A16;
    --panel-2: #27251F;
    --panel-border: rgba(236, 232, 223, 0.1);
    --band-bg: #1D1C18;
    --band-fg: #ECE8DF;
    --grain-blend: screen;
    --grain-opacity: 0.09;
    color-scheme: dark;
  }
}

/* theme switch: the new theme grows out of the toggle (see main.js) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.42  0 0 0 0 0.36  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.muted { color: var(--ink-2); }

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
}
.skip:focus { top: 12px; }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom-color: var(--line);
}
.nav__mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  justify-self: start;
}
.nav__mono {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  transition: transform 0.6s var(--ease), background-color 0.3s;
}
.nav__mark:hover .nav__mono { transform: rotate(-360deg); background: var(--accent); }
.nav__name { font-weight: 500; font-size: 15px; }
.nav__links {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
}
.nav__links a {
  position: relative;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.25s, color 0.25s;
}
.nav__links a:hover { background: var(--paper-2); }
.nav__links a.is-active { background: var(--ink); color: var(--paper); }
.nav__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav__clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav__play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.nav__play svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  transition: transform 0.5s var(--ease);
}
.nav__play:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.nav__play:hover svg { transform: translate(2px, -3px) rotate(28deg); }
.nav__theme {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.nav__theme svg { width: 15px; height: 15px; transition: transform 0.7s var(--ease); }
.nav__theme:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.nav__theme[aria-pressed="true"] svg { transform: rotate(180deg); }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 77, 26, 0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 26, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(255, 77, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 26, 0); }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--nav-h) + 20px) var(--gutter) 28px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr auto;
  column-gap: 20px;
}
.hero__meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  color: var(--ink-2);
}
.hero__name {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
  position: relative;
  z-index: 2;
  margin: 0 0 clamp(20px, 3vw, 40px);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 15vw, 17rem);
  line-height: 0.84;
  letter-spacing: -0.035em;
  user-select: none;
}
.hero__line { display: block; white-space: nowrap; }
.hero__line--2 { padding-left: 0.9em; font-style: italic; }
.hero__stop { color: var(--accent); font-style: normal; }
.char {
  display: inline-block;
  font-variation-settings: "wght" var(--w, 380), "SOFT" var(--s, 0), "WONK" 1, "opsz" 144;
  will-change: font-variation-settings;
}
.js .hero__name .char {
  opacity: 0;
  transform: translateY(0.35em) rotate(4deg);
  transition: opacity 0.9s var(--ease), transform 1.1s var(--ease);
  transition-delay: calc(var(--i) * 45ms + 150ms);
}
.js .hero__name.is-in .char { opacity: 1; transform: none; }

.hero__sun {
  grid-column: 9 / 13;
  grid-row: 2;
  align-self: center;
  justify-self: end;
  width: clamp(140px, 21vw, 340px);
  aspect-ratio: 1;
  margin: 0 6vw 6vw 0;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(var(--sx, 0px), var(--sy, 0px)) scale(var(--ss, 1));
}
.js .hero__sun {
  scale: 0;
  transition: scale 1.4s var(--ease) 0.5s;
}
.js .hero__sun.is-in { scale: 1; }

.hero__foot {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 20px;
  align-items: start;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}
.hero__role {
  grid-column: 1 / 5;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.15;
  font-variation-settings: "opsz" 36;
}
.amp { font-style: italic; color: var(--accent); }
.hero__intro {
  grid-column: 5 / 11;
  margin: 0;
  max-width: 54ch;
  color: var(--ink-2);
}
.hero__intro strong { color: var(--ink); font-weight: 600; }
.hero__scroll {
  grid-column: 11 / 13;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.hero__scroll svg {
  width: 12px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  animation: nudge 2s var(--ease) infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateY(-3px); }
  50% { transform: translateY(4px); }
}

/* ---------- numbers ---------- */
.numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: clamp(48px, 8vw, 110px) var(--gutter);
}
.num {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.num__value {
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.9;
  font-variation-settings: "wght" 300, "opsz" 144;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.num__label { color: var(--ink-2); max-width: 26ch; line-height: 1.5; }

/* ---------- ticker ---------- */
.ticker {
  overflow: hidden;
  border-block: 1px solid var(--band-bg);
  padding: 18px 0;
  background: var(--band-bg);
  color: var(--band-fg);
}
.ticker__track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 28px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-variation-settings: "wght" 350, "SOFT" 100, "opsz" 72;
  line-height: 1;
  white-space: nowrap;
  animation: ticker 48s linear infinite;
}
.ticker__track i { color: var(--accent); font-style: normal; font-size: 0.6em; }
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.section {
  padding: clamp(80px, 12vw, 170px) var(--gutter) 0;
}
.section__head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 20px;
  align-items: end;
  margin-bottom: clamp(32px, 5vw, 64px);
}
.section__idx {
  grid-column: 1 / 3;
  align-self: start;
  padding-top: 0.9em;
}
.section__title {
  grid-column: 3 / 11;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 8vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
}
.section__title em, .contact__title em {
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.section__note {
  grid-column: 11 / 13;
  justify-self: end;
  margin: 0;
  color: var(--ink-2);
  text-align: right;
}

/* ---------- jobs ---------- */
.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}
.job { border-bottom: 1px solid var(--ink); }
.job__row {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 2fr 4fr 4fr 40px;
  gap: 20px;
  align-items: center;
  padding: 26px 0;
  background: none;
  border: 0;
  text-align: left;
  isolation: isolate;
}
.job__row::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -1);
  z-index: -1;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.5s var(--ease);
}
.job__row:hover { color: var(--paper); }
.job__row:hover::before { transform: scaleY(1); }
.job__row:hover .muted, .job__row:hover .job__where { color: color-mix(in srgb, var(--paper) 60%, transparent); }
.job__row > * { transition: transform 0.5s var(--ease), color 0.3s; }
.job__row:hover .job__co { transform: translateX(12px); }
.job__date { color: inherit; }
.job__co {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.2vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72;
}
.job__where {
  font-size: 0.45em;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  vertical-align: middle;
}
.job__role { font-size: 16px; }
.job__toggle {
  position: relative;
  width: 28px;
  height: 28px;
  justify-self: end;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.job__toggle::before, .job__toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%);
  transition: transform 0.4s var(--ease);
}
.job__toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.job.is-open .job__toggle::after { transform: translate(-50%, -50%) rotate(0deg); }

.job__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.6s var(--ease);
}
.job.is-open .job__body { grid-template-rows: 1fr; }
.job__inner {
  overflow: hidden;
  display: grid;
  grid-template-columns: 2fr 8fr 40px;
  gap: 20px;
}
.job__inner ul {
  grid-column: 2;
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
  max-width: 68ch;
}
.job__inner li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 12px;
  color: var(--ink-2);
}
.job__inner li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
mark {
  background: none;
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -0.45em 0 rgba(255, 77, 26, 0.35);
}
.tags {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 28px;
}
.tags span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

/* ---------- projects ---------- */
.project {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 32px;
  align-items: start;
  padding: clamp(40px, 6vw, 80px) 0;
  border-top: 1px solid var(--ink);
}
.project__text { grid-column: 1 / 6; position: sticky; top: calc(var(--nav-h) + 24px); }
.project .demo { grid-column: 6 / 13; }
.project--flip .project__text { grid-column: 8 / 13; grid-row: 1; }
.project--flip .demo { grid-column: 1 / 8; grid-row: 1; }

.project__kicker { color: var(--ink-2); margin: 0 0 14px; }
.project__title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 5.4vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
}
.project__lede {
  margin: 0 0 22px;
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.45;
}
.project__points {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.project__points li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15.5px;
}

/* ---------- demo panels ---------- */
.demo {
  position: relative;
  background: var(--panel);
  color: var(--light);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 30px 60px -30px rgba(22, 21, 15, 0.45);
}
.demo .muted { color: rgba(237, 234, 226, 0.5); }
.demo__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 12px;
}
.demo__title { display: inline-flex; align-items: center; gap: 8px; }
.demo__title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.demo__hint {
  margin: 12px 4px 2px;
  font-size: 11px;
  color: rgba(237, 234, 226, 0.45);
  text-transform: none;
}
.demo--pipe canvas {
  display: block;
  width: 100%;
  height: clamp(280px, 30vw, 380px);
  border-radius: 8px;
  background: #121109;
}
.demo__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 14px 4px 0;
}
.slider {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 220px;
}
.slider span { white-space: nowrap; }
.slider input { flex: 1; }
.slider.is-disabled { opacity: 0.35; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), rgba(237, 234, 226, 0.2) var(--fill, 50%));
}
input[type="range"]::-moz-range-track { height: 2px; background: rgba(237, 234, 226, 0.2); }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--light);
  border: 3px solid var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--light);
  border: 3px solid var(--accent);
}
.readout { display: flex; gap: 18px; }
.readout b { color: var(--light); font-weight: 500; font-variant-numeric: tabular-nums; }

/* MCP */
.mcp__stage { border-radius: 8px; background: #121109; overflow: hidden; }
.mcp__svg { display: block; width: 100%; height: auto; }
.mcp__svg text { font-family: var(--mono); fill: var(--light); }
.mcp__svg .node rect { fill: var(--panel-2); stroke: rgba(237, 234, 226, 0.18); transition: fill 0.3s, stroke 0.3s; }
.mcp__svg .node.is-hot rect { stroke: var(--accent); fill: #3a2116; }
.mcp__svg .node.is-err rect { stroke: #ff3b3b; fill: #3a1616; }
.mcp__svg .node--gw rect { fill: #201f19; stroke: rgba(237, 234, 226, 0.4); }
.mcp__svg .edge { fill: none; stroke: rgba(237, 234, 226, 0.14); stroke-width: 1.2; stroke-dasharray: 3 5; }
.mcp__svg .edge.is-hot { stroke: rgba(255, 77, 26, 0.65); stroke-dasharray: none; }
.mcp__svg .sub { fill: rgba(237, 234, 226, 0.5); }
.mcp__svg .badge rect { fill: transparent; stroke: rgba(237, 234, 226, 0.22); transition: fill 0.3s, stroke 0.3s; }
.mcp__svg .badge.is-ok rect { fill: rgba(80, 200, 120, 0.18); stroke: #5ac87a; }
.mcp__svg .badge.is-err rect { fill: rgba(255, 59, 59, 0.2); stroke: #ff3b3b; }
.mcp__svg .packet { fill: var(--accent); }
.mcp__svg .packet--back { fill: var(--light); }
.mcp__svg .packet--err { fill: #ff3b3b; }
.mcp__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 0; }
.mcp__log {
  margin: 12px 0 0;
  padding: 12px 14px;
  height: 128px;
  overflow: hidden;
  border-radius: 8px;
  background: #121109;
  color: rgba(237, 234, 226, 0.75);
  font-size: 11.5px;
  line-height: 1.7;
  text-transform: none;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.mcp__log .ok { color: #7bd88f; }
.mcp__log .err { color: #ff6b6b; }
.mcp__log .acc { color: var(--accent); }
.demo__credits b { color: var(--light); font-weight: 500; }

/* chat */
.demo--chat { max-width: 440px; justify-self: center; width: 100%; }
.chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--panel-line);
}
.chat__head b { display: block; font-weight: 600; font-size: 15px; }
.chat__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--dark);
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
}
.chat__body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
  height: 400px;
  overflow: hidden;
  padding: 16px 4px 4px;
}
.bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.4;
  animation: pop 0.45s var(--ease) both;
}
.bubble--in { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.bubble--out { align-self: flex-end; background: var(--light); color: var(--dark); border-bottom-right-radius: 4px; }
.bubble--card {
  border: 1px solid var(--panel-line);
  background: #121109;
  font-family: var(--mono);
  font-size: 12px;
}
.bubble--card b { color: var(--accent); font-weight: 500; }
.bubble--typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.bubble--typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(237, 234, 226, 0.6);
  animation: blink 1.2s infinite;
}
.bubble--typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble--typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--dark); }
.btn:active { transform: scale(0.97); }
.btn--sm {
  padding: 8px 14px;
  font-size: 13px;
  background: var(--light);
  color: var(--dark);
  border-color: var(--light);
}
.btn--ghost { background: transparent; color: var(--light); border-color: var(--panel-line); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- stack ---------- */
.stack { border-top: 1px solid var(--ink); }
.stack__row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.stack__cat { grid-column: 1 / 4; padding-top: 10px; color: var(--ink-2); }
.stack__items { grid-column: 4 / 13; display: flex; flex-wrap: wrap; gap: 8px; }
.stack__items span {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-variation-settings: "opsz" 36;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.35s var(--ease);
  cursor: default;
}
.stack__items span:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: translateY(-3px) rotate(-1.5deg);
}
.stack__row:hover .stack__cat { color: var(--accent); }

/* ---------- contact ---------- */
.contact {
  padding: clamp(100px, 14vw, 200px) var(--gutter) clamp(60px, 8vw, 110px);
}
.contact__title {
  margin: 20px 0 clamp(48px, 7vw, 90px);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 8.6vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144;
}
.contact__title > span { display: block; }
.contact__title > span:nth-child(2) { padding-left: 1.2em; }
.contact__title em { color: var(--accent); }
.contact__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--ink);
}
.contact__direct { grid-column: 1 / 7; }
.form { grid-column: 8 / 13; }
.contact__direct > p, .form > p { margin: 0 0 18px; }

.email { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 40px; }
.email__link {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.3vw, 2.8rem);
  letter-spacing: -0.02em;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px no-repeat;
  transition: background-size 0.5s var(--ease), color 0.3s;
  word-break: break-all;
}
.email__link:hover { color: var(--accent); background-size: 0 1.5px; background-position: 100% 100%; }
.email__copy {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 11px;
  transition: background-color 0.25s, color 0.25s;
}
.email__copy:hover { background: var(--ink); color: var(--paper); }

.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  transition: padding 0.45s var(--ease), color 0.25s;
}
.links a:hover { padding-left: 14px; color: var(--accent); }
.links .arrow {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: transform 0.45s var(--ease), background-color 0.25s, color 0.25s;
}
.links a:hover .arrow { transform: rotate(45deg); background: var(--accent); color: var(--dark); border-color: var(--accent); }
.links a[download]:hover .arrow { transform: translateY(3px); }

.field { display: block; margin-bottom: 22px; }
.field > span { display: block; margin-bottom: 6px; color: var(--ink-2); }
.field input, .field textarea {
  width: 100%;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  resize: vertical;
  transition: border-color 0.25s;
}
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.field.is-invalid input, .field.is-invalid textarea { border-bottom-color: #c42b00; }
.form__hint { margin: 14px 0 0; text-transform: none; font-size: 11.5px; }

/* ---------- footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--ink);
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- asteroids mini-game ---------- */
.game {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
  user-select: none;
}
.is-playing .nav__play { visibility: hidden; }
.game-hud {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 85;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 12px 30px -12px rgba(22, 21, 15, 0.5);
}
.game-hud b { color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.game-hud__exit {
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.game-hud__exit kbd { font: inherit; opacity: 0.5; margin-left: 4px; }
.game-msg {
  position: fixed;
  inset: 0;
  z-index: 84;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.game-msg.is-on { opacity: 1; }
.game-msg__inner {
  max-width: 520px;
  padding: 28px 32px;
  border: 1px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  text-align: center;
  box-shadow: 0 30px 60px -30px rgba(22, 21, 15, 0.45);
}
.game-msg h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.game-msg p { margin: 0; font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.game-msg__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.game-msg.is-on .btn { pointer-events: auto; }
.btn--line { background: transparent; color: var(--ink); }

/* ---------- reveal ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .nav__clock .muted { display: none; }
  .project__text, .project--flip .project__text { grid-column: 1 / -1; grid-row: auto; position: static; }
  .project .demo, .project--flip .demo { grid-column: 1 / -1; grid-row: auto; }
  .demo--chat { justify-self: start; }
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .nav { grid-template-columns: 1fr auto; }
  .nav__links { display: none; }
  .nav__name { display: none; }

  .hero { grid-template-rows: auto auto auto auto; row-gap: 0; }
  .hero__sun { grid-column: 7 / 13; width: 40vw; margin: 48px 0 0; }
  .hero__name { grid-column: 1 / -1; grid-row: 3; margin-top: -0.45em; font-size: clamp(3rem, 17.5vw, 8rem); }
  .hero__line--2 { padding-left: 0.6em; }
  .hero__foot { grid-row: 4; row-gap: 18px; }
  .hero__role { grid-column: 1 / -1; }
  .hero__intro { grid-column: 1 / -1; }
  .hero__scroll { display: none; }

  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }

  .section__head { row-gap: 12px; }
  .section__idx { grid-column: 1 / -1; padding: 0; }
  .section__title { grid-column: 1 / -1; }
  .section__note { grid-column: 1 / -1; justify-self: start; text-align: left; }

  .job__row { grid-template-columns: 1fr 32px; gap: 8px 12px; padding: 22px 0; }
  .job__date { grid-column: 1; grid-row: 1; }
  .job__co { grid-column: 1; grid-row: 2; }
  .job__role { grid-column: 1; grid-row: 3; }
  .job__toggle { grid-column: 2; grid-row: 1 / 4; align-self: center; }
  .job__inner { grid-template-columns: 1fr; }
  .job__inner ul, .tags { grid-column: 1; }

  .stack__cat, .stack__items { grid-column: 1 / -1; }
  .stack__cat { padding: 0 0 12px; }

  .contact__direct, .form { grid-column: 1 / -1; }
  .contact__title > span:nth-child(2) { padding-left: 0.6em; }
  .footer { flex-direction: column; }
}

@media (max-width: 480px) {
  .hero__meta span:last-child { display: none; }
  .game-hud { gap: 12px; padding-left: 14px; bottom: 14px; }
  .game-hud__best { display: none; }
  .readout { gap: 12px; flex-wrap: wrap; }
  .demo { padding: 10px; border-radius: 12px; }
  .chat__body { height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  .js .reveal, .js .hero__name .char { opacity: 1; transform: none; }
}
