:root {
  --bg: #0A0A0B;
  --surface: #131316;
  --line: #23232A;
  --line-soft: #1F1F23;
  --text: #F2F2F0;
  --muted: #B4B4BA;
  --subtle: #8E8E94;
  --chip: #C9C9CE;
  --accent: #C8FF3D;
  --on-accent: #0A0A0B;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--display); -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
a:hover { color: #fff; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); }
.accent { color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(10,10,11,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-soft); }
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 14px; }
.brand { font-family: var(--mono); font-weight: 500; font-size: 15px; text-decoration: none; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0 28px; font-size: 15px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 12px 0; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; background: var(--accent); border-radius: 2px; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.swatch::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px #3A3A40; transition: transform .15s; }
.swatch[aria-pressed="true"]::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.swatch:hover::before { transform: scale(1.15); }

/* Hero */
.hero { padding-block: clamp(64px, 10vw, 140px) clamp(64px, 8vw, 120px); }
.pill { display: inline-flex; align-items: center; gap: 10px; border: 1px solid #2A2A2F; border-radius: 999px; padding: 8px 16px; font-family: var(--mono); font-size: 13px; color: var(--chip); }
.hero h1 { margin-top: 32px; font-size: clamp(88px, 17vw, 240px); line-height: .86; font-weight: 700; letter-spacing: -.05em; }
.hero-row { display: flex; flex-wrap: wrap; gap: 32px 64px; align-items: flex-end; justify-content: space-between; margin-top: 48px; }
.lede { max-width: 640px; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.3; font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px; font: 500 16px var(--display); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform .15s, background .15s, color .15s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { color: var(--on-accent); }
.btn-ghost { border-color: #3A3A40; color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--text); }

/* Facts */
.facts { border-block: 1px solid var(--line-soft); }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fact { padding: 28px 24px 28px 0; display: flex; flex-direction: column; gap: 6px; font-size: 18px; font-weight: 500; }
.label { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }

/* Sections */
.section { padding-top: clamp(72px, 9vw, 128px); }
.section h2 { margin-top: 12px; font-size: clamp(44px, 6vw, 80px); line-height: 1; font-weight: 700; letter-spacing: -.03em; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { min-height: 44px; padding: 0 18px; border-radius: 999px; font: 500 14px var(--display); cursor: pointer; background: transparent; color: var(--chip); border: 1px solid #2E2E35; transition: background .15s, color .15s, border-color .15s; }
.filter:hover { border-color: var(--chip); }
.filter[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 20px; margin-top: 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 3vw, 36px); display: flex; flex-direction: column; gap: 24px; transition: border-color .2s, transform .2s; animation: fadeUp .4s ease both; }
.card:hover { border-color: #3A3A42; transform: translateY(-3px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status { font-family: var(--mono); font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid #3A3A40; color: var(--chip); }
.status.shipped { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.flow { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 14px; padding: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; }
.step { padding: 6px 12px; border-radius: 8px; background: #1A1A1E; color: #D4D4D8; border: 1px solid #2A2A30; }
.step.last { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 500; }
.card h3 { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.card p { margin-top: 10px; font-size: 17px; line-height: 1.55; color: var(--muted); }
.stack { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { font-family: var(--mono); font-size: 12px; color: var(--chip); border: 1px solid #2E2E35; border-radius: 6px; padding: 5px 10px; }
.card-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.card-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--chip); }
.card-links a.primary { color: var(--accent); }
.card-links a[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 48px; background: var(--line); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.skill { background: var(--bg); padding: 32px; display: flex; flex-direction: column; gap: 18px; transition: background .2s; }
.skill:hover { background: var(--surface); }
.skill h3 { font-size: 20px; }
.skill ul { list-style: none; margin: 0; padding: 0; font-size: 16px; line-height: 1.7; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 48px 0 0; padding: 0; }
.timeline li { display: flex; flex-wrap: wrap; gap: 8px 48px; padding: 32px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.when { flex: 0 0 180px; font-family: var(--mono); font-size: 14px; color: var(--subtle); padding-top: 6px; }
.timeline li > div { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.timeline h3 { font-size: clamp(24px, 2.6vw, 34px); letter-spacing: -.02em; }
.timeline p { font-size: 17px; line-height: 1.55; color: var(--muted); }

/* Contact */
.contact-wrap { padding-bottom: clamp(96px, 12vw, 160px); }
.contact { background: var(--accent); color: var(--on-accent); border-radius: 28px; padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; gap: 40px; transition: background .3s; }
.eyebrow-dark { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.contact h2 { margin: 0; font-size: clamp(48px, 8vw, 120px); line-height: .95; letter-spacing: -.04em; }
.btn-dark { background: var(--bg); color: var(--text); min-height: 56px; font-size: 17px; }
.btn-dark:hover { color: #fff; }
.btn-outline-dark { background: transparent; border: 1.5px solid var(--bg); color: var(--bg); min-height: 56px; font-size: 17px; }
.btn-outline-dark:hover { background: var(--bg); color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid var(--line-soft); }
.footer-row { padding-block: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 13px; color: var(--subtle); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Motion */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .nav { justify-content: center; }
  .nav-links { justify-content: center; gap: 0 20px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Case-study cards ---------- */
.section-sub { margin-top: 16px; font-size: 18px; color: var(--muted); max-width: 560px; }
.card .tagline { margin-top: 10px; font-size: 18px; line-height: 1.5; color: var(--text); }
.case { margin: 0; display: grid; gap: 16px; }
.case dt { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }
.case dd { margin: 6px 0 0; font-size: 16px; line-height: 1.55; color: var(--muted); }
.results { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.result { background: var(--bg); padding: 16px 18px; display: flex; flex-direction: column-reverse; gap: 4px; }
.result dd { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--accent); }
.result dt { font-size: 13px; line-height: 1.4; color: var(--subtle); }
.ask-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-left: auto; padding: 0 16px; border-radius: 999px; border: 1px solid #2E2E35; background: transparent; color: var(--chip); font: 500 14px var(--display); cursor: pointer; }
.ask-link:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Chat ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent); font: 700 15px var(--display); cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.45); transition: transform .15s; }
.chat-fab:hover { transform: translateY(-2px); }
.chat { position: fixed; right: 20px; bottom: 84px; z-index: 50; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid #2E2E35; border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.6); overflow: hidden; animation: fadeUp .2s ease both; }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.chat-head strong { display: block; font-size: 16px; }
.chat-head span { display: block; margin-top: 2px; font-size: 12px; color: var(--subtle); }
.chat-close { width: 44px; height: 44px; margin: -8px -6px 0 0; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--chip); cursor: pointer; }
.chat-close:hover { background: #1F1F24; color: var(--text); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant { align-self: flex-start; background: #1C1C21; color: var(--text); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.msg.typing { color: var(--subtle); font-style: italic; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.chat-suggestions[hidden] { display: none; }
.chip { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid #2E2E35; background: transparent; color: var(--chip); font: 400 13px var(--display); text-align: left; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #2E2E35; background: var(--bg); color: var(--text); font: 400 15px var(--display); }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.chat-form button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 640px) {
  .chat-fab span { display: none; }
  .chat-fab { width: 56px; padding: 0; justify-content: center; }
  .chat { right: 16px; bottom: 88px; }
}

@media (max-width: 960px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .skills { grid-template-columns: 1fr; } }

.msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
