/* Design tokens mirror the reference: Tailwind slate scale + accent #6b6c60 light, #a0a196 dark, Inter. */
:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-hover: #cbd5e1;
  --chip: #f1f5f9;
  --chip-fg: #475569;
  --btn: #a0a196;
  --btn-fg: #0f172a;
  --btn-hover: #8e8f83;
  --ghost-hover: #f8fafc;
  --frame: #0f172a;
  --accent: #6b6c60;
  --accent-soft: rgba(107, 108, 96, 0.12);
  --header-bg: rgba(255, 255, 255, 0.8);
  --radius: 1rem;
  color-scheme: light;
}
html.dark {
  --bg: #020617;
  --fg: #ffffff;
  --muted: #94a3b8;
  --subtle: #64748b;
  --faint: #475569;
  --line: #1e293b;
  --line-hover: #334155;
  --chip: #0f172a;
  --chip-fg: #94a3b8;
  --btn: #a0a196;
  --btn-fg: #0f172a;
  --btn-hover: #8e8f83;
  --ghost-hover: #0f172a;
  --frame: #1e293b;
  --header-bg: rgba(2, 6, 23, 0.8);
  --accent: #a0a196;
  --accent-soft: rgba(160, 161, 150, 0.15);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { flex-shrink: 0; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
@media (min-width: 640px) { .container { padding: 0 2rem; } }
@media (min-width: 1024px) { .container { padding: 0 2.5rem; } }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; padding: .5rem 1rem; border-radius: 999px; background: var(--btn); color: var(--btn-fg); font-size: .875rem; }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid transparent; transition: background-color .2s, border-color .2s; }
.header.scrolled { background: var(--header-bg); border-color: var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.brand { font-size: .875rem; font-weight: 600; letter-spacing: -.01em; }
.nav { display: none; gap: 2rem; }
.nav a, .mobile-nav a { font-size: .875rem; font-weight: 500; color: var(--muted); transition: color .15s; }
.nav a:hover, .mobile-nav a:hover { color: var(--fg); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); transition: border-color .15s, color .15s; }
.icon-btn:hover { border-color: var(--line-hover); color: var(--fg); }
.icon-sun { display: none; }
html.dark .icon-sun { display: block; }
html.dark .icon-moon { display: none; }
.menu-btn { display: inline-flex; }
.header .header-cta { display: none; }
.mobile-nav { display: none; flex-direction: column; gap: 1rem; padding: 1rem 1.5rem 1.5rem; border-top: 1px solid var(--line); background: var(--bg); }
.mobile-nav.open { display: flex; }
@media (min-width: 768px) {
  .nav, .header .header-cta { display: flex; }
  .menu-btn, .mobile-nav.open { display: none; }
}

/* ---------- Buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: 999px; font-size: .875rem; font-weight: 500; transition: background-color .15s, border-color .15s; }
.btn-primary { background: var(--btn); color: var(--btn-fg); padding: .75rem 1.5rem; }
.btn-primary:hover { background: var(--btn-hover); }
.btn-sm { padding: .5rem 1rem; }
.btn-ghost { border: 1px solid var(--line); color: var(--fg); padding: .75rem 1.5rem; }
.btn-ghost:hover { border-color: var(--line-hover); background: var(--ghost-hover); }
.chip { display: inline-flex; border-radius: 999px; background: var(--chip); color: var(--chip-fg); padding: .25rem .625rem; font-size: .75rem; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.accent { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 5rem 0; text-align: center; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 520px; z-index: -1; pointer-events: none; background: radial-gradient(60% 50% at 50% 0%, var(--accent-soft), transparent); }
.hero-inner { max-width: 48rem; margin: 0 auto; }
.avatar { width: 6rem; height: 6rem; margin: 0 auto; border-radius: 999px; overflow: hidden; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.05); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-flex; align-items: center; gap: .375rem; margin-top: 1.5rem; padding: .25rem .75rem; border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; font-weight: 500; color: var(--muted); }
.hero h1 { margin-top: 1.5rem; font-size: 2.25rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; }
.hero .role { margin-top: 1rem; font-weight: 500; color: var(--accent); }
.hero .intro { max-width: 42rem; margin: 1.5rem auto 0; font-size: 1.125rem; line-height: 1.625; color: var(--muted); text-wrap: balance; }
.hero-ctas { display: flex; flex-direction: column; gap: .75rem; justify-content: center; margin-top: 2.5rem; }
@media (min-width: 640px) {
  .hero { padding: 7rem 0; }
  .avatar { width: 7rem; height: 7rem; }
  .hero h1 { font-size: 3rem; }
  .hero .role { font-size: 1.125rem; }
  .hero-ctas { flex-direction: row; }
}
@media (min-width: 1024px) { .hero h1 { font-size: 3.75rem; } }

.fade-up { opacity: 0; animation: fadeUp .6s ease-out forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease-out, transform .7s ease-out; }
.reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .fade-up, .reveal { opacity: 1 !important; animation: none !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--line); padding: 5rem 0; }
@media (min-width: 640px) { .section { padding: 7rem 0; } }
.eyebrow { font-size: .875rem; font-weight: 500; color: var(--accent); }
.section h2 { margin-top: .75rem; font-size: 1.875rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
@media (min-width: 640px) { .section h2 { font-size: 2.25rem; } }
.lead { max-width: 42rem; margin-top: 1rem; font-size: 1.125rem; line-height: 1.625; color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s; }
a.card:hover, .card.hoverable:hover { border-color: var(--line-hover); }
.icon-circle { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 999px; background: var(--chip); color: var(--accent); }
.grid-3 { display: grid; gap: 1rem; margin-top: 3rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* How I work */
.service { display: flex; align-items: flex-start; gap: .75rem; height: 100%; padding: 1.25rem; }
.service-title { font-size: .875rem; font-weight: 600; }
.service-desc { margin-top: .25rem; font-size: .875rem; line-height: 1.625; color: var(--muted); }
.steps-title { margin-top: 4rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--subtle); }
.steps { display: grid; gap: .75rem; margin-top: 1.25rem; grid-template-columns: 1fr; counter-reset: step; }
.step { position: relative; padding: 1rem 1.25rem; font-size: .875rem; font-weight: 500; }
.step span { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: var(--faint); margin-bottom: .25rem; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Projects ---------- */
.projects { display: flex; flex-direction: column; gap: 6rem; margin-top: 4rem; }
@media (min-width: 640px) { .projects { margin-top: 5rem; gap: 8rem; } }
.project-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
.project-grid > * { min-width: 0; }
main { overflow-x: clip; }
@media (min-width: 1024px) {
  .project-grid { grid-template-columns: 7fr 5fr; gap: 3rem; }
  .project.flip .project-media { order: 2; }
}
.project-media { position: relative; }
.project-media::before { content: ""; position: absolute; inset: -1rem; z-index: -1; border-radius: 2.5rem; background: linear-gradient(135deg, rgba(160,161,150,.12), rgba(160,161,150,.03), transparent); filter: blur(24px); opacity: .5; transition: opacity .7s; }
.project-media:hover::before { opacity: .8; }
.project-media > * { transition: transform .5s ease-out; }
.project-media:hover > * { transform: translateY(-6px); }

.browser { overflow: hidden; border-radius: 1rem; border: 1px solid var(--line); background: var(--bg); box-shadow: 0 25px 50px -12px rgba(15,23,42,.25); }
html.dark .browser { box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); }
.browser-bar { display: flex; align-items: center; gap: .375rem; padding: .625rem .875rem; border-bottom: 1px solid var(--line); background: var(--chip); }
.browser-bar i { width: .625rem; height: .625rem; border-radius: 999px; background: var(--line-hover); }
.browser-bar .url { margin-left: .75rem; flex: 1; max-width: 18rem; padding: .125rem .75rem; border-radius: 999px; background: var(--bg); font-size: .6875rem; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-shot { aspect-ratio: 16 / 10; overflow: hidden; }
.browser-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .7s ease-out; }
.project-media:hover .browser-shot img { transform: scale(1.03); }

.phone { position: relative; width: 100%; max-width: 280px; margin: 0 auto; border: 10px solid var(--frame); border-radius: 2.75rem; background: var(--frame); box-shadow: 0 25px 50px -12px rgba(15,23,42,.25); }
html.dark .phone { box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); }
.phone::before { content: ""; position: absolute; top: 0; left: 50%; z-index: 2; width: 6rem; height: 1.25rem; transform: translateX(-50%); border-radius: 0 0 .75rem .75rem; background: var(--frame); }

.project-meta { display: flex; align-items: center; gap: .75rem; }
.num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: var(--faint); }
.badge { display: inline-flex; padding: .25rem .75rem; border-radius: 999px; background: var(--chip); color: var(--chip-fg); font-size: .75rem; font-weight: 500; }
.project h3 { margin-top: 1rem; font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; }
@media (min-width: 640px) { .project h3 { font-size: 1.875rem; } }
.project .subtitle { margin-top: .375rem; font-size: .875rem; font-weight: 500; color: var(--accent); }
.project .desc { margin-top: 1.5rem; line-height: 1.625; color: var(--muted); }
.project .chips { margin-top: 1.5rem; }
.notes { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; font-size: .75rem; font-weight: 500; color: var(--subtle); }
.notes span, .notes a { display: inline-flex; align-items: center; gap: .375rem; }
.notes a:hover { color: var(--accent); }
@media (min-width: 640px) { .notes { flex-direction: row; flex-wrap: wrap; gap: .5rem 1.25rem; } }
.project-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.case-btn { padding: .625rem 1.25rem; font-weight: 600; }
.case-btn svg { transition: transform .3s; }
.case-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.case { display: grid; grid-template-rows: 0fr; margin-top: 2rem; transition: grid-template-rows .5s ease-in-out; }
.case.open { grid-template-rows: 1fr; }
.case > div { overflow: hidden; }
.case-body { padding: 1.5rem; }
@media (min-width: 640px) { .case-body { padding: 2rem; } }
.case-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .case-grid { grid-template-columns: repeat(2, 1fr); } }
.case h4 { font-size: .875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--subtle); }
.case p, .case li { margin-top: .75rem; font-size: .875rem; line-height: 1.625; color: var(--muted); }
.case li { position: relative; margin-top: .5rem; padding-left: .875rem; }
.case li::before { position: absolute; left: 0; top: 0; }
.case code { font-size: .8125rem; padding: .0625rem .375rem; border-radius: .375rem; background: var(--chip); color: var(--fg); }
.case li::before, .bullets li::before { content: ""; flex-shrink: 0; width: .25rem; height: .25rem; margin-top: .55rem; border-radius: 999px; background: var(--faint); }
.gallery { display: grid; gap: 1rem; margin-top: 2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
.gallery figure { margin: 0; }
.gallery img { height: auto; border-radius: .75rem; border: 1px solid var(--line); }
.gallery figcaption { margin-top: .5rem; font-size: .75rem; color: var(--subtle); }

/* Real phone screenshots */
.phone img { display: block; width: 100%; height: auto; border-radius: 2rem; }
.gallery.phones { grid-template-columns: repeat(3, 1fr); max-width: 44rem; margin-inline: auto; }
.gallery.phones img { border-radius: 1.25rem; }
.gallery .wide { grid-column: 1 / -1; }


/* ---------- Experience ---------- */
.timeline { position: relative; margin-top: 3.5rem; }
.timeline::before { content: ""; position: absolute; left: 7px; top: .5rem; bottom: .5rem; width: 1px; background: var(--line); }
.timeline ol { display: flex; flex-direction: column; gap: 3rem; }
.timeline li.job { position: relative; padding-left: 2rem; }
.timeline li.job::before { content: ""; position: absolute; left: 0; top: .375rem; width: .875rem; height: .875rem; border-radius: 999px; border: 2px solid var(--accent); background: var(--bg); }
@media (min-width: 640px) {
  .timeline::before { left: 9px; }
  .timeline li.job { padding-left: 2.5rem; }
  .timeline li.job::before { width: 18px; height: 18px; }
}
.job-head { display: flex; flex-direction: column; gap: .25rem; }
@media (min-width: 640px) { .job-head { flex-direction: row; align-items: baseline; justify-content: space-between; } }
.job h3 { font-size: 1.125rem; font-weight: 600; }
.job-date { font-size: .875rem; font-weight: 500; color: var(--subtle); }
.job-org { margin-top: .25rem; font-size: .875rem; font-weight: 500; color: var(--accent); }
.bullets { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.bullets li { display: flex; gap: .625rem; font-size: .875rem; line-height: 1.625; color: var(--muted); }

/* ---------- About ---------- */
.about-grid { display: grid; gap: .75rem; margin-top: 3rem; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 1024px) { .about-grid { grid-template-columns: 1fr auto 1fr; } }
.about-card { display: flex; flex-direction: column; height: 100%; padding: 1.5rem; }
.about-card .icon-circle { width: 2.5rem; height: 2.5rem; }
.about-label { margin-top: 1rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--subtle); }
.about-card p:last-child { margin-top: .5rem; line-height: 1.625; color: var(--muted); }
.about-arrow { display: flex; align-items: center; justify-content: center; color: var(--faint); padding: .25rem 0; }
.about-arrow svg { transform: rotate(90deg); }
@media (min-width: 1024px) { .about-arrow svg { transform: none; } }
.about-foot { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
@media (min-width: 640px) { .about-foot { flex-direction: row; justify-content: space-between; } }
.about-foot > a { font-size: .875rem; font-weight: 500; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-hover); text-underline-offset: 4px; }
.about-foot > a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.edu { display: flex; gap: .75rem; font-size: .875rem; color: var(--muted); }
.edu svg { color: var(--faint); margin-top: .125rem; }
.edu strong { font-weight: 500; color: var(--fg); }

/* ---------- Skills ---------- */
.skill-card { height: 100%; padding: 1.5rem; }
.skill-card h3 { font-size: .875rem; font-weight: 600; }
.skill-card .chips { margin-top: 1rem; }
.skill-card .chip { padding: .25rem .75rem; color: var(--fg); opacity: .85; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 2.5rem; margin-top: 3rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .contact-grid { grid-template-columns: 2fr 3fr; } }
.contact-links { display: flex; flex-direction: column; gap: 1rem; }
.contact-link { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; }
.contact-link .icon-circle { width: 2.5rem; height: 2.5rem; color: var(--muted); }
.contact-link p:first-child { font-size: .875rem; font-weight: 500; }
.contact-link p:last-child { font-size: .875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-link > div { min-width: 0; }
.form { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 640px) { .form { padding: 2rem; } }
.form-row { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form label { font-size: .875rem; font-weight: 500; color: var(--muted); }
.form input, .form textarea { display: block; width: 100%; margin-top: .5rem; padding: .625rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: transparent; color: var(--fg); font: inherit; font-size: .875rem; outline: none; transition: border-color .15s; }
.form textarea { resize: vertical; min-height: 8rem; }
.form input::placeholder, .form textarea::placeholder { color: var(--faint); }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form .btn { align-self: flex-start; }
.form-hint { font-size: .75rem; color: var(--subtle); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 2rem 0; }
.footer .container { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: .75rem; font-size: .875rem; color: var(--subtle); }
@media (min-width: 640px) { .footer .container { flex-direction: row; } }

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