/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f4f6fb;
  --text: #0f172a;
  --muted: #5b6475;
  --border: #e2e6ef;
  --accent: #3b66f0;
  --accent-2: #12b5cb;
  --focus: #3b66f0;
  --header-bg: rgba(255, 255, 255, 0.85);
  --radius: 12px;
  --space: 1rem;
  --max-width: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --surface: #131a2e;
    --text: #e8ecf6;
    --muted: #9aa5bd;
    --border: #232c45;
    --accent: #6c90ff;
    --accent-2: #2fd0e4;
    --focus: #2fd0e4;
    --header-bg: rgba(11, 16, 32, 0.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #131a2e;
  --text: #e8ecf6;
  --muted: #9aa5bd;
  --border: #232c45;
  --accent: #6c90ff;
  --accent-2: #2fd0e4;
  --focus: #2fd0e4;
  --header-bg: rgba(11, 16, 32, 0.85);
  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--bg); overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Scroll reveal: hidden state applies only when JS has added .js to <html> */
.js .reveal { transition: opacity 0.6s ease, transform 0.6s ease; }
.js .card.reveal { transition: opacity 0.6s ease, transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.js .reveal:not(.is-visible) { opacity: 0; transform: translateY(16px); }
@media (prefers-reduced-motion: reduce) {
  .js .reveal:not(.is-visible) { opacity: 1; transform: none; }
  .js .reveal, .js .card.reveal { transition: none; }
}

.container { width: 100%; max-width: var(--max-width); margin-inline: auto; padding-inline: 1.25rem; }
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1rem; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; transition: top 0.15s; }
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.8rem 1.5rem; border-radius: 999px; font: inherit; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, #3b66f0, #0e7490); box-shadow: 0 8px 24px rgba(59, 102, 240, 0.35); }
.btn-primary:hover { box-shadow: 0 12px 30px rgba(59, 102, 240, 0.5); }
.btn-ghost { color: var(--text); background: transparent; border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.nav { margin-left: auto; }
.nav-list { display: flex; gap: 0.25rem; }
.nav-list a { display: block; padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--muted); font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: color 0.15s, background 0.15s; }
.nav-list a:hover, .nav-list a.is-active, .nav-list a[aria-current] { color: var(--text); background: var(--surface); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: background 0.15s; }
.icon-btn:hover { background: var(--surface); }
#menu-toggle { display: none; }
html:not(.js) #theme-toggle { display: none; }

@media (max-width: 899px) {
  .header-actions { margin-left: auto; }
  .nav { margin-left: 0; }
  .nav-list { flex-wrap: wrap; }
  /* Without JS the nav wraps below the bar and stays usable */
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 0.5rem; }
  html:not(.js) .nav { order: 3; width: 100%; }
  /* With JS: collapsed panel toggled by #menu-toggle */
  .js #menu-toggle { display: inline-grid; }
  .js .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0.5rem 1.25rem 1rem; box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15); }
  .js .nav.is-open { display: block; }
  .js .nav-list { flex-direction: column; }
  .js .nav-list a { padding: 0.75rem; }
}

/* ---------- Hero (always dark) ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; color: #e8ecf6; background: radial-gradient(900px 500px at 85% -10%, rgba(47, 208, 228, 0.28), transparent 60%), radial-gradient(800px 500px at 0% 10%, rgba(108, 144, 255, 0.35), transparent 60%), linear-gradient(180deg, #0b1020, #101936); padding-block: clamp(4.5rem, 12vw, 9rem); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000, transparent 75%); mask-image: radial-gradient(ellipse at 50% 30%, #000, transparent 75%); }
.hero-inner > * { max-width: 820px; }
.hero-inner > .eyebrow { max-width: 100%; }
.eyebrow { display: inline-block; margin-bottom: 1.25rem; padding: 0.35rem 0.85rem; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; background: rgba(255, 255, 255, 0.06); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: #aebcf0; }
.hero h1 { font-size: clamp(2.25rem, 7vw, 4.25rem); font-weight: 800; letter-spacing: -0.03em; overflow-wrap: break-word; }
.grad { background: linear-gradient(90deg, #8fb0ff, #36d6ea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin-top: 1.5rem; max-width: 60ch; font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: #b6c0da; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2.25rem; }
.hero .btn-ghost { color: #e8ecf6; border-color: rgba(255, 255, 255, 0.28); }
.hero .btn-ghost:hover { color: #fff; border-color: #fff; background: rgba(255, 255, 255, 0.08); }

/* ---------- Content sections ---------- */
.section-alt { background: var(--surface); }
.section-kicker { margin-bottom: 0.75rem; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.section-title { max-width: 24ch; overflow-wrap: break-word; }
.section-lead { max-width: 60ch; color: var(--muted); font-size: 1.1rem; }
.section-title + .card-grid, .section-title + .stats, .section-lead + .card-grid, .section-lead + .steps { margin-top: 2.5rem; }
.section-lead { margin-bottom: 0; }
.section-title + .section-lead { margin-top: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 1.25rem; }
.card { padding: 1.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.section-alt .card { background: var(--bg); }
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12); }
.card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.card p { color: var(--muted); }
.card-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 1rem; border-radius: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.stats li { padding: 1.25rem; text-align: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-value { display: block; font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.95rem; }
.strengths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 1.5rem; }
.strength { padding-left: 1rem; border-left: 3px solid var(--accent-2); }
.strength h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.strength p { color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 1.25rem; counter-reset: step; }
.steps li { position: relative; counter-increment: step; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 0.85rem; border-radius: 50%; color: #fff; font-weight: 700; background: linear-gradient(135deg, #3b66f0, #0e7490); }
.steps h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.steps p { color: var(--muted); font-size: 0.95rem; }

.project { padding: 0; overflow: hidden; }
.project > h3, .project > .tags, .project > p { margin-inline: 1.5rem; }
.project > h3 { margin-top: 1.25rem; }
.project > p { margin-block: 0.75rem 1.5rem; }
.thumb { height: 160px; }
.thumb-1 { background: linear-gradient(135deg, #3b66f0, #12b5cb); }
.thumb-2 { background: linear-gradient(135deg, #7c3aed, #ec4899); }
.thumb-3 { background: linear-gradient(135deg, #0f766e, #84cc16); }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li { padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

.quote { margin: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.quote blockquote { margin: 0; font-size: 1.05rem; }
.quote blockquote::before { content: "\201C"; display: block; font-size: 3rem; line-height: 0.6; color: var(--accent); }
.quote footer { display: flex; flex-direction: column; font-size: 0.95rem; }
.quote footer span { color: var(--muted); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; margin-top: 2.5rem; align-items: start; }
.contact-info, .contact-form { min-width: 0; padding: 1.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.contact-info h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.contact-list { display: grid; gap: 1rem; }
.contact-list li { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.contact-label { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.contact-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.95rem; }
.field input, .field textarea { display: block; width: 100%; max-width: 100%; padding: 0.75rem 0.9rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; transition: border-color 0.15s, box-shadow 0.15s; }
.field textarea { min-height: 8rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.field input.is-invalid, .field textarea.is-invalid { border-color: #d92d3f; }
.field-error { min-height: 0; margin-top: 0.35rem; font-size: 0.875rem; color: #c8202f; overflow-wrap: anywhere; }
.field-error:empty { display: none; }
.contact-form .btn { justify-self: start; }
#form-success { padding: 0.85rem 1rem; border-radius: 10px; color: #0b5d2c; background: #dcf5e4; border: 1px solid #9bd8b0; }
#form-success[hidden] { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field-error { color: #ff8a96; }
  :root:not([data-theme="light"]) .field input.is-invalid, :root:not([data-theme="light"]) .field textarea.is-invalid { border-color: #ff6b7a; }
  :root:not([data-theme="light"]) #form-success { color: #8de8ac; background: rgba(46, 160, 90, 0.15); border-color: rgba(46, 160, 90, 0.5); }
}
:root[data-theme="dark"] .field-error { color: #ff8a96; }
:root[data-theme="dark"] .field input.is-invalid, :root[data-theme="dark"] .field textarea.is-invalid { border-color: #ff6b7a; }
:root[data-theme="dark"] #form-success { color: #8de8ac; background: rgba(46, 160, 90, 0.15); border-color: rgba(46, 160, 90, 0.5); }

@media (max-width: 767px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-info, .contact-form { padding: 1.25rem; }
}

/* ---------- Footer ---------- */
.site-footer { padding-block: 2.5rem; background: var(--surface); border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.footer-links a:hover { color: var(--accent); }
.copyright { width: 100%; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }

/* ---------- Back to top ---------- */
.back-to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #3b66f0, #0e7490); box-shadow: 0 8px 24px rgba(59, 102, 240, 0.4); cursor: pointer; transition: transform 0.15s; }
.back-to-top:hover { transform: translateY(-2px); }
.back-to-top[hidden] { display: none; }
