/* Pedro Queiroz · portfolio v3 — shared styles (index + case studies)
   Design values follow elayadesign/redesign-skill: flat neutral surfaces, one accent,
   Tailwind type scale, 0/2/4/8/12/16/24/32/40/48/64/80/96 spacing, Tailwind radii. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #181818;
  --surface: #181818;
  --surface-2: #1f1f1f;
  --surface-3: #272727;
  --border: rgb(255 255 255 / .08);
  --border-strong: rgb(85 134 231 / .5);
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --faint: #8c8c8c;
  --accent: #5586e7;
  --dither: #5586e7;
  --accent-ink: #fff;
  --btn: #2258c3;
  --btn-hover: #1d4aa5;
  --accent-soft: rgb(85 134 231 / .12);
  --ok: #34d399;
  --heading-from: #ffffff;
  --heading-to: #9b9b9b;
  --shadow: 0 24px 48px -24px rgb(0 0 0 / .8);
  --radius: 12px;
  --radius-lg: 16px;
  --wrap: 1200px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-move: .5s;
  --t-color: .3s;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --bg-2: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --surface-3: #e8e8e8;
  --border: rgb(0 0 0 / .09);
  --border-strong: rgb(31 95 214 / .45);
  --text: #0a0a0a;
  --muted: #525252;
  --faint: #5c5c5c;
  --accent: #1f5fd6;
  --dither: #0f3a9e;
  --accent-soft: rgb(31 95 214 / .08);
  --btn: #1f5fd6;
  --btn-hover: #184fb5;
  --ok: #0f9d6b;
  --heading-from: #000000;
  --heading-to: #666666;
  --shadow: 0 24px 48px -24px rgb(10 10 10 / .18);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font: 400 16px/24px var(--font);
  color: var(--text);
  background: transparent; /* html paints the base color so the dither canvas can sit between them */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { font-weight: 600; text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -64px; z-index: 50; padding: 8px 12px; border-radius: 8px; background: var(--btn); color: var(--accent-ink); font-weight: 600; }
.skip:focus { top: 16px; }
.mono { font-family: var(--mono); }
.stack-top { margin-top: 16px; }
.icon { width: 18px; height: 18px; flex: none; fill: currentColor; }

/* Header: compact bar floating off the top edge */
.site-header { position: sticky; top: 12px; z-index: 30; display: flex; justify-content: center; margin-top: 12px; pointer-events: none; }
.site-header .wrap { position: relative; display: flex; align-items: center; gap: 4px; width: auto; max-width: calc(100% - 32px); margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 16px; pointer-events: auto; }
/* Blur on a pseudo element: a backdrop-filter on the bar itself would trap the fixed mobile panel inside it */
.site-header .wrap::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
.brand { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 8px; border-radius: 12px; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.brand img { width: 24px; height: 24px; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--muted); transition: color var(--t-color) var(--ease), background-color var(--t-color) var(--ease); }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="true"] { color: var(--text); background: var(--surface-3); }
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: color var(--t-color) var(--ease), background-color var(--t-color) var(--ease), transform var(--t-move) var(--ease); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }
.lang-toggle { width: auto; min-width: 40px; padding: 0 8px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.menu-toggle { display: none; }
.burger { position: relative; width: 18px; height: 12px; }
.burger i { position: absolute; left: 0; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--t-move) var(--ease); }
.burger i:first-child { top: 2px; }
.burger i:last-child { top: 8px; }
.menu-toggle[aria-expanded="true"] .burger i:first-child { transform: translateY(3px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .burger i:last-child { transform: translateY(-3px) rotate(-45deg); }
.site-header .header-cta { border-radius: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid transparent; font-size: 16px; line-height: 24px; font-weight: 600; cursor: pointer; transition: background-color var(--t-color) var(--ease), border-color var(--t-color) var(--ease), color var(--t-color) var(--ease), transform var(--t-move) var(--ease); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn); color: var(--accent-ink); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 8px 12px; font-size: 14px; line-height: 20px; }
.text-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--muted); transition: color var(--t-color) var(--ease); }
.text-link:hover { color: var(--text); }
.text-link .icon { transition: transform var(--t-move) var(--ease); }
.text-link:hover .icon { transform: translateY(2px); }

/* Fundo ASCII animado (página inicial) — o canvas fica atrás, o conteúdo por cima */
.bg-ascii { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bg-ascii ~ main, .bg-ascii ~ .site-footer { position: relative; z-index: 1; }

/* Hero */
.hero { padding: 80px 0 96px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 64px; align-items: center; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 14px; line-height: 20px; color: var(--muted); }
.status .dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .55; } to { transform: scale(2.6); opacity: 0; } }
.hero .kicker { margin-top: 24px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--accent); }
.hero h1, .case-hero h1 {
  max-width: 680px;
  padding-bottom: 4px;
  font-weight: 700;
  letter-spacing: -.03em;
  background: linear-gradient(90deg, var(--heading-from), var(--heading-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.hero h1 { margin-top: 8px; font-size: 48px; line-height: 1; }
.hero .lead { margin-top: 24px; max-width: 680px; font-size: 18px; line-height: 28px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 16px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.chip-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }

/* Editor visual */
.editor { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; font: 14px/24px var(--mono); }
.editor-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--faint); font-size: 12px; line-height: 16px; }
.editor-bar .dots { display: flex; gap: 4px; }
.editor-bar .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); }
.editor pre { margin: 0; padding: 16px 24px 24px 16px; overflow-x: auto; color: var(--text); counter-reset: line; }
.editor .ln { display: block; min-height: 1lh; padding-left: 40px; position: relative; white-space: pre; }
.editor .ln::before { counter-increment: line; content: counter(line); position: absolute; left: 0; width: 24px; text-align: right; color: var(--faint); opacity: .7; }
.tk-k { color: #c792ea; } .tk-s { color: #8bd5a4; } .tk-p { color: #82aaff; } .tk-c { color: var(--faint); } .tk-b { color: #f7a76c; }
:root[data-theme="light"] .tk-k { color: #8b3fd1; }
:root[data-theme="light"] .tk-s { color: #12805a; }
:root[data-theme="light"] .tk-p { color: #1f5fd6; }
:root[data-theme="light"] .tk-b { color: #b4570f; }
.caret { display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* Editor typing (site.js): lines wait dimmed until the caret reaches them */
.editor .ln.wait::before { opacity: .25; }
.caret.typing { animation: none; }

/* Sections */
.section { padding: 96px 0; border-top: 1px solid var(--border); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 48px; margin-bottom: 48px; }
.eyebrow { display: block; margin-bottom: 12px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--accent); }
.section-head h2, .h2 { font-size: 36px; line-height: 40px; letter-spacing: -.025em; }
.section-head p { max-width: 65ch; color: var(--muted); }

/* Featured projects: two column zig zag */
.featured-grid { display: grid; gap: 24px; }
.project { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); transition: border-color var(--t-color) var(--ease); }
.project:nth-child(even) .project-media { order: 2; }
.project:hover { border-color: var(--border-strong); }
.project .project-media { border-radius: 8px; }
.project-media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-2); }
.project-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .7s var(--ease); }
.project:hover .project-media img, .mini:hover .project-media img { transform: scale(1.03); }
/* Pixel art keeps hard edges; the crop keeps both the capybara and the moon in frame */
.project-media img.pixel-art { image-rendering: pixelated; object-position: 70% center; }
.project-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.project .project-meta, .mini .project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--faint); }
.project-meta .sep { opacity: .5; }
.project h3 { font-size: 30px; line-height: 36px; letter-spacing: -.02em; }
.project p { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted); transition: color var(--t-color) var(--ease); }
.link-arrow:hover { color: var(--text); }

.all-projects { margin-top: 80px; }
.all-projects h3 { font-size: 24px; line-height: 32px; letter-spacing: -.02em; margin-bottom: 8px; }
.all-projects > p { color: var(--muted); margin-bottom: 24px; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mini { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color var(--t-color) var(--ease); }
.mini:hover { border-color: var(--border-strong); }
.mini .project-media { aspect-ratio: 16 / 9; }
.mini-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px; }
.mini h4 { font-size: 18px; line-height: 28px; letter-spacing: -.01em; }
.mini p { font-size: 14px; line-height: 20px; color: var(--muted); }
.mini .project-actions { padding-top: 4px; }

/* Tagline reveal: words go from muted to full color as they cross the trigger line */
.tagline { padding: 96px 0; border-top: 1px solid var(--border); }
.tagline-text { max-width: 880px; font-size: 48px; line-height: 1.1; font-weight: 600; letter-spacing: -.03em; text-wrap: balance; }
.tagline-text .w { color: color-mix(in srgb, var(--text) 35%, transparent); transition: color var(--t-move) var(--ease); }
.tagline-text .w.on { color: var(--text); }

/* Experience */
.xp-grid { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 24px 48px; }
.xp-type { padding-top: 24px; font-size: 14px; line-height: 20px; color: var(--faint); }
.xp-type strong { display: block; margin-bottom: 4px; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text); }
.xp-card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.xp-card + .xp-card { margin-top: 16px; }
.xp-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; }
.xp-head h3 { font-size: 20px; line-height: 28px; }
.xp-head time { font: 500 14px/28px var(--mono); color: var(--faint); }
.xp-org { margin-top: 2px; color: var(--accent); font-size: 14px; line-height: 20px; font-weight: 600; }
.xp-list { display: grid; gap: 8px; margin-top: 16px; }
.xp-list li { position: relative; padding-left: 16px; color: var(--muted); }
.xp-list li::before { content: ""; position: absolute; left: 0; top: 10px; width: 4px; height: 4px; border-radius: 1px; background: var(--accent); }
.xp-card .tags { margin-top: 16px; }
.xp-grid > .xp-type + div { min-width: 0; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.skill-group { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.skill-group-wide { grid-column: 1 / -1; }
.skill-group h3 { display: flex; align-items: center; gap: 12px; font-size: 18px; line-height: 28px; margin-bottom: 16px; }
.skill-group h3 .icon { width: 20px; height: 20px; color: var(--accent); }
.skill-list { display: grid; }
.skill { display: grid; grid-template-columns: minmax(112px, 160px) minmax(0, 1fr); gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.skill:first-child { border-top: 0; padding-top: 0; }
.skill-name { font-weight: 600; }
.skill-where { font-size: 14px; line-height: 20px; color: var(--muted); padding-top: 2px; }
.skill-where a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; transition: color var(--t-color) var(--ease); }
.skill-where a:hover { color: var(--accent); }
.level { display: inline-block; margin-left: 8px; padding: 0 4px; border-radius: 4px; font-size: 12px; line-height: 16px; font-weight: 500; vertical-align: 1px; white-space: nowrap; }
.skill-name .level { display: table; margin: 4px 0 0; }
.level-pro { color: var(--accent); background: var(--accent-soft); }
.level-base { color: var(--faint); background: var(--surface-2); }
.skills-note { margin-top: 24px; font-size: 14px; line-height: 20px; color: var(--faint); }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 64px; }
.about-text h2 { margin-bottom: 16px; }
.about-text p { color: var(--muted); font-size: 18px; line-height: 28px; max-width: 65ch; }
.about-text p + p { margin-top: 16px; }
.about-text strong { color: var(--text); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.fact { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fact dt { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--faint); }
.fact dd { margin: 4px 0 0; font-weight: 600; }
.timeline-title { margin-bottom: 24px; }
.timeline { position: relative; display: grid; gap: 24px; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -31px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.tl-item.now::before { background: var(--accent); }
.tl-item time { font: 500 12px/16px var(--mono); color: var(--faint); }
.tl-item h3 { margin-top: 4px; font-size: 16px; line-height: 24px; }
.tl-item p { font-size: 14px; line-height: 20px; color: var(--muted); }
.edu-photo { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.edu-photo img { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Services: a list of rows instead of a card grid */
.services-grid { display: grid; border-bottom: 1px solid var(--border); }
.service { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 18rem); grid-template-areas: "icon title ex" "icon desc ex"; gap: 4px 24px; padding: 24px 0; border-top: 1px solid var(--border); }
.service .icon { grid-area: icon; width: 24px; height: 24px; margin-top: 4px; color: var(--accent); }
.service h3 { grid-area: title; font-size: 20px; line-height: 28px; }
.service p { grid-area: desc; color: var(--muted); max-width: 65ch; }
.service .example { grid-area: ex; align-self: center; font-size: 14px; line-height: 20px; color: var(--faint); }
.service .example a { color: var(--muted); text-decoration: underline; text-underline-offset: 4px; transition: color var(--t-color) var(--ease); }
.service .example a:hover { color: var(--text); }
.services-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.services-cta p { color: var(--muted); max-width: 60ch; }
.services-cta strong { color: var(--text); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
.contact-grid > div > p { margin-top: 16px; color: var(--muted); font-size: 18px; line-height: 28px; max-width: 46ch; }
.contact-list { display: grid; gap: 8px; }
.contact-item { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color var(--t-color) var(--ease), transform var(--t-move) var(--ease); }
.contact-item:hover { border-color: var(--border-strong); transform: translateX(4px); }
.contact-item:active { transform: scale(.98); }
.contact-item .icon { width: 20px; height: 20px; color: var(--accent); }
.contact-item span { display: grid; min-width: 0; }
.contact-item small { font-size: 12px; line-height: 16px; color: var(--faint); }
.contact-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-item .go { margin-left: auto; color: var(--faint); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 40px; font-size: 14px; line-height: 20px; color: var(--faint); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer a { transition: color var(--t-color) var(--ease); }
.site-footer a:hover { color: var(--text); }

/* Case study pages */
.case-hero { padding: 64px 0 48px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; line-height: 20px; color: var(--faint); }
.breadcrumb a { color: var(--muted); transition: color var(--t-color) var(--ease); }
.breadcrumb a:hover { color: var(--text); }
.case-hero h1 { margin-top: 16px; font-size: 60px; line-height: 1; }
.case-hero .lead { margin-top: 16px; max-width: 680px; color: var(--muted); font-size: 18px; line-height: 28px; }
.case-hero .hero-actions { margin-top: 24px; }
.case-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.case-cover { margin-top: 32px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.case-cover img { width: 100%; border-radius: 8px; }
.case-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 64px; padding: 64px 0; border-top: 1px solid var(--border); }
.toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 2px; font-size: 14px; line-height: 20px; }
.toc a { padding: 4px 12px; border-left: 2px solid var(--border); color: var(--faint); transition: color var(--t-color) var(--ease), border-color var(--t-color) var(--ease); }
.toc a:hover, .toc a[aria-current="true"] { color: var(--text); border-left-color: var(--accent); }
.prose { max-width: 72ch; }
.prose section + section { margin-top: 48px; }
.prose h2 { font-size: 30px; line-height: 36px; letter-spacing: -.02em; margin-bottom: 16px; scroll-margin-top: 96px; }
.prose h2 .num { margin-right: 12px; font: 500 14px/1 var(--mono); color: var(--accent); vertical-align: 6px; }
.prose h3 { font-size: 18px; line-height: 28px; margin: 24px 0 8px; }
.prose p, .prose ul:not(.tags) li { color: var(--muted); font-size: 16px; line-height: 24px; }
.prose p + p { margin-top: 16px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul:not(.tags) { display: grid; gap: 8px; margin-top: 12px; }
.prose ul:not(.tags) li { position: relative; padding-left: 16px; }
.prose ul:not(.tags) li::before { content: ""; position: absolute; left: 0; top: 10px; width: 4px; height: 4px; border-radius: 1px; background: var(--accent); }
.prose code { padding: 2px 4px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font: 500 .875em var(--mono); color: var(--text); }
.prose figure { margin-top: 24px; }
.prose figure img { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.prose figcaption { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--faint); }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.callout { margin-top: 16px; padding: 16px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); background: var(--accent-soft); }
.callout p { font-size: 16px; line-height: 24px; }
.arch { margin-top: 16px; padding: 16px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; font: 14px/24px var(--mono); color: var(--text); white-space: pre; }
.challenge { margin-top: 16px; padding: 16px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.challenge h3 { margin: 0 0 8px; }
.case-next { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 32px 0 64px; border-top: 1px solid var(--border); }

/* Project browser dialog */
.project-browser { margin: auto; width: min(1200px, 96vw); height: 88vh; height: 88dvh; padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 40px 96px rgb(0 0 0 / .6); }
.project-browser[open] { display: flex; flex-direction: column; }
.project-browser::backdrop { background: rgb(0 0 0 / .78); backdrop-filter: blur(4px); }
.browser-heading, .browser-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.browser-heading { justify-content: space-between; background: var(--surface-2); }
.browser-heading strong { font-size: 16px; line-height: 24px; font-weight: 600; }
.browser-toolbar { flex-wrap: wrap; }
.project-browser button, .browser-toolbar a { cursor: pointer; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 500 14px/20px var(--font); transition: border-color var(--t-color) var(--ease); }
.project-browser button:hover, .browser-toolbar a:hover { border-color: var(--border-strong); }
.project-browser button[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--accent-ink); }
.browser-address { flex: 1; min-width: 96px; padding: 8px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px/16px var(--mono); color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.browser-hint { padding: 8px 12px; font-size: 14px; line-height: 20px; color: var(--muted); }
.browser-viewport { flex: 1; min-height: 0; display: flex; justify-content: center; background: var(--bg); }
#project-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.mobile-preview #project-frame { max-width: 390px; }

/* Dither field: pixel dots drawn by site.js behind the content */
.dither-bg { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; opacity: 0; transition: opacity 1.2s var(--ease); }
.dither-bg.ready { opacity: .45; }
:root[data-theme="light"] .dither-bg.ready { opacity: .5; }

/* Hero intro: starts from first paint (has-js is set in <head>), so there is no flash */
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
.has-js .hero-grid > div > * { animation: rise-in .9s var(--ease) both; }
.has-js .hero-grid > div > :nth-child(2) { animation-delay: 80ms; }
.has-js .hero-grid > div > :nth-child(3) { animation-delay: 160ms; }
.has-js .hero-grid > div > :nth-child(4) { animation-delay: 240ms; }
.has-js .hero-grid > div > :nth-child(5) { animation-delay: 320ms; }
.has-js .hero-grid > div > :nth-child(n+6) { animation-delay: 400ms; }

/* Technology marquee: moves exactly one set per loop so it repeats seamlessly */
.marquee { overflow: hidden; padding: 24px 0; border-top: 1px solid var(--border); -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee-track li { display: flex; align-items: center; gap: 24px; padding-right: 24px; font-size: 20px; line-height: 28px; font-weight: 500; color: var(--faint); white-space: nowrap; transition: color var(--t-color) var(--ease); }
.marquee-track li::after { content: ""; width: 4px; height: 4px; border-radius: 1px; background: var(--accent); }
.marquee-track li:hover { color: var(--text); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Reveal: only hides content once JS confirmed it can reveal it. --d staggers siblings. */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--d, 0) * 80ms); }
.js .reveal.in, .js .reveal:focus-within { opacity: 1; transform: none; }
/* Screenshots resolve from blur to sharp once their card is in view */
.js .reveal .project-media { filter: blur(12px) saturate(.6); transition: filter .9s cubic-bezier(.33, 1, .68, 1); transition-delay: calc(var(--d, 0) * 80ms + 150ms); }
.js .reveal.in .project-media { filter: none; }
/* Eyebrow rule and timeline draw on */
.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: currentColor; transform-origin: left; }
.js .reveal .eyebrow::before { transform: scaleX(0); transition: transform .7s var(--ease) .2s; }
.js .reveal.in .eyebrow::before { transform: none; }
.js .reveal .timeline::before { transform: scaleY(0); transform-origin: top; transition: transform 1.4s cubic-bezier(.65, 0, .35, 1) .2s; }
.js .reveal.in .timeline::before { transform: none; }
.js .reveal .tl-item::before { transform: scale(.85); opacity: 0; transition: transform .6s var(--ease), opacity .6s var(--ease); }
.js .reveal.in .tl-item::before { transform: none; opacity: 1; }
.js .reveal.in .tl-item:nth-child(2)::before { transition-delay: .3s; }
.js .reveal.in .tl-item:nth-child(3)::before { transition-delay: .5s; }
.js .reveal.in .tl-item:nth-child(4)::before { transition-delay: .7s; }
.js .reveal.in .tl-item:nth-child(5)::before { transition-delay: .9s; }
/* Arrows nudge in the direction they point */
.btn .icon, .link-arrow .icon, .contact-item .go { transition: transform var(--t-move) var(--ease); }
.btn-primary:hover .icon:last-child { transform: translateX(4px); }
.link-arrow:hover .icon { transform: translateY(-2px); }
.contact-item:hover .go { transform: translateX(4px); }

/* Responsive */
@media (max-width: 1024px) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .editor { max-width: 560px; }
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .hero h1, .case-hero h1 { font-size: 48px; }
  .tagline-text { font-size: 36px; line-height: 40px; }
}
@media (max-width: 960px) {
  .site-header .wrap { width: calc(100% - 32px); }
  .has-js .menu-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .has-js .nav {
    position: fixed; inset: 0; z-index: -2;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
    padding: 96px 24px 32px; overflow-y: auto; overscroll-behavior: contain;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--t-color) var(--ease), visibility 0s;
  }
  .has-js .nav.open { opacity: 1; visibility: visible; }
  .has-js .nav a { padding: 12px 8px; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.02em; color: var(--text); border-radius: 12px; opacity: 0; transform: translateY(24px); transition: opacity var(--t-move) var(--ease), transform var(--t-move) var(--ease), background-color var(--t-color) var(--ease); }
  .has-js .nav.open a { opacity: 1; transform: none; }
  .has-js .nav.open a:nth-child(2) { transition-delay: 60ms; }
  .has-js .nav.open a:nth-child(3) { transition-delay: 120ms; }
  .has-js .nav.open a:nth-child(4) { transition-delay: 180ms; }
  .has-js .nav.open a:nth-child(5) { transition-delay: 240ms; }
  .has-js .nav.open a:nth-child(6) { transition-delay: 300ms; }
  .has-js .nav.open a:nth-child(n+7) { transition-delay: 360ms; }
  html.menu-open { overflow: hidden; }
  html:not(.has-js) .site-header { position: static; }
  html:not(.has-js) .site-header .wrap { flex-wrap: wrap; }
  html:not(.has-js) .nav { order: 3; flex-wrap: wrap; width: 100%; }
  html:not(.has-js) .nav a { padding: 8px; }
  .featured-grid .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .project-media { order: 0; }
  .project-body { padding: 16px 16px 8px; }
  .skills-grid { grid-template-columns: 1fr; }
  .xp-grid { grid-template-columns: 1fr; gap: 12px; }
  .xp-type { padding-top: 12px; }
  .service { grid-template-columns: 24px minmax(0, 1fr); grid-template-areas: "icon title" "icon desc" "icon ex"; }
  .service .example { align-self: start; margin-top: 4px; }
}
@media (max-width: 640px) {
  .hero { padding: 48px 0 64px; }
  .hero h1, .case-hero h1 { font-size: 36px; line-height: 40px; }
  .hero h1 br { display: none; }
  .hero .lead, .case-hero .lead { font-size: 16px; line-height: 24px; }
  .section, .tagline { padding: 64px 0; }
  .section-head { margin-bottom: 32px; }
  .section-head h2, .h2 { font-size: 30px; line-height: 36px; }
  .project h3 { font-size: 24px; line-height: 32px; }
  .tagline-text { font-size: 30px; line-height: 36px; }
  .gallery, .facts { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 100%; }
  .skill { grid-template-columns: 1fr; }
  .header-cta { display: none; }
  .editor { font-size: 12px; line-height: 20px; }
  .all-projects { margin-top: 64px; }
  .dither-bg.ready { opacity: .3; }
  :root[data-theme="light"] .dither-bg.ready { opacity: .3; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-property: opacity, color, background-color, border-color !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; filter: none; }
  .tagline-text .w { color: var(--text); }
  .marquee-track { animation: marquee 90s linear infinite !important; } /* ambient, kept on at a slower pace */
  .has-js .nav a { transform: none !important; }
  .btn:hover, .btn:active, .contact-item:hover, .project:hover .project-media img, .mini:hover .project-media img { transform: none; }
}

/* Print (used for case studies) */
@media print {
  .site-header, .site-footer, .toc, .hero-actions, .case-next, .skip, .dither-bg, .marquee { display: none !important; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1; transform: none; }
  .hero h1, .case-hero h1 { color: #000; -webkit-text-fill-color: #000; background: none; }
}
