/* ==========================================================================
   Portfolio styles — no external fonts or CDNs (keeps the CSP strict)
   ========================================================================== */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #0f172a;
  --muted: #5b6474;
  --border: #e3e6eb;
  --accent: #0b6e4f;        /* fintech green */
  --accent-2: #1d4ed8;      /* trust blue */
  --accent-soft: #e6f4ef;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 14px;
  --maxw: 1100px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --surface: #121826; --surface-2: #1a2232; --text: #e7ebf3;
    --muted: #9aa4b6; --border: #252f42; --accent: #34d399; --accent-2: #60a5fa;
    --accent-soft: #10291f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --surface-2: #1a2232; --text: #e7ebf3;
  --muted: #9aa4b6; --border: #252f42; --accent: #34d399; --accent-2: #60a5fa;
  --accent-soft: #10291f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.6; font-size: 17px; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(160%) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-weight: 700; letter-spacing: -.01em; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }

@media (max-width: 820px) {
  .menu-toggle { display: grid; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 20px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-actions .btn { display: none; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, background .12s ease; font-family: inherit; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #052e20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-primary:hover { color: #052e20; } }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.08; letter-spacing: -.03em; margin: 18px 0 16px; max-width: 18ch; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 60ch; margin: 0 0 28px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 56px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat strong { display: block; font-size: 1.6rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 14px; }

/* ---------- Sections ---------- */
section { padding: 56px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; margin: 0; }
.section-head p { color: var(--muted); margin: 6px 0 0; }
.page-head { padding: 64px 0 8px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.025em; margin: 0 0 10px; }
.page-head p { color: var(--muted); font-size: 1.1rem; max-width: 65ch; margin: 0; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -.01em; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card.linked { position: relative; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag.type { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.metric-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.metric-row b { color: var(--accent); font-size: 1.05rem; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.filter { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit; }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- About / resume ---------- */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel h3 { margin-top: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0 0 20px 22px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.timeline .when { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.timeline h3 { margin: 2px 0 4px; }
.timeline p { margin: 0; color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hobby { display: flex; gap: 12px; align-items: flex-start; }
.hobby .emoji { font-size: 24px; line-height: 1; }

/* ---------- Case study article ---------- */
.article { max-width: 760px; margin: 0 auto; padding: 48px 20px 24px; }
.article h1 { font-size: clamp(2rem, 4vw, 2.7rem); letter-spacing: -.025em; line-height: 1.15; margin: 12px 0; }
.article h2 { margin-top: 44px; letter-spacing: -.015em; }
.article .summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 28px 0; }
.article .summary div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 14px; }
.article .summary b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 8px; margin: 24px 0; }
.back { font-size: 14px; text-decoration: none; }

/* ---------- Demo ---------- */
.demo-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.demo-box label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.demo-box textarea { width: 100%; min-height: 110px; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); resize: vertical; }
.demo-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.demo-quota { font-size: 13px; color: var(--muted); }
.demo-output { margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--surface-2); white-space: pre-wrap; font-size: 15px; min-height: 56px; }
.demo-output.error { color: #b42318; }
.examples { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

dialog.demo-modal { width: min(1100px, 96vw); height: min(760px, 90vh); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
dialog.demo-modal::backdrop { background: rgba(5, 10, 20, .6); }
.demo-modal header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.demo-modal iframe { width: 100%; height: calc(100% - 58px); border: 0; background: #fff; }

/* ---------- CTA + footer ---------- */
.cta { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 20px; padding: 44px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cta h2 { margin: 0 0 6px; letter-spacing: -.02em; }
.cta p { margin: 0; opacity: .9; }
.cta .btn-ghost { background: #fff; color: #0f172a; border-color: #fff; }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; margin-top: 40px; color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.footer-links { display: flex; gap: 16px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.card > .tag.type { align-self: flex-start; }
.card.hobby { flex-direction: row; }
[hidden] { display: none !important; }
.demo-video { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: #000; }
.grid:has(.demo-video) { grid-template-columns: 1fr; max-width: 820px; }
.nav-links .nav-mobile-only { display: none; }
@media (max-width: 820px) { .nav-links .nav-mobile-only { display: list-item; } }
.demo-fallback { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 15px; }
.demo-modal-status { font-size: 13px; color: var(--muted); margin: 0 12px; flex: 1; }
