/* ================= Theme ================= */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #fbfbfd;
  --surface: #ffffff;
  --text: #1d1d1f;
  --soft: #424245;
  --muted: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.09);
  --nav: rgba(251, 251, 253, 0.72);
  --dots: rgba(0, 0, 0, 0.07);
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.18);
  color-scheme: light;
}

/* dark: explicit choice, or system preference when no choice is saved */
:root[data-theme="dark"] {
  --bg: #0b0b0f;
  --surface: #151519;
  --text: #f5f5f7;
  --soft: #c7c7cc;
  --muted: #8e8e93;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #2997ff;
  --accent-soft: rgba(41, 151, 255, 0.13);
  --nav: rgba(11, 11, 15, 0.72);
  --dots: rgba(255, 255, 255, 0.07);
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0f;
    --surface: #151519;
    --text: #f5f5f7;
    --soft: #c7c7cc;
    --muted: #8e8e93;
    --line: rgba(255, 255, 255, 0.09);
    --accent: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.13);
    --nav: rgba(11, 11, 15, 0.72);
    --dots: rgba(255, 255, 255, 0.07);
    --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* ================= Base ================= */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--soft);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--text); font-weight: 600; }
h1, h2, h3 { margin: 0; color: var(--text); line-height: 1.2; }
img { display: block; max-width: 100%; height: auto; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ================= Navbar ================= */
.navbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.navbar__inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; gap: 20px;
}
.logo {
  flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 13px; font-weight: 800; letter-spacing: -0.5px; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #6366f1 55%, #ec4899);
}
.logo:hover { text-decoration: none; }

.navbar__links {
  flex: 1; min-width: 0;
  display: flex; gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
          mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.navbar__links::-webkit-scrollbar { display: none; }
@media (min-width: 640px) {
  .navbar__links { justify-content: center; -webkit-mask-image: none; mask-image: none; }
}
.navbar__links a {
  flex: none;
  padding: 6px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--soft);
}
.navbar__links a:hover, .navbar__links a[aria-current="page"] {
  text-decoration: none; color: var(--text); background: var(--accent-soft);
}

.theme-toggle {
  flex: none;
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer;
  transition: transform .2s ease;
}
.theme-toggle:hover { transform: rotate(15deg); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ================= Hero ================= */
.hero {
  position: relative;
  display: grid; gap: 40px; align-items: center;
  padding: 72px 0 56px;
}
/* subtle dot grid behind the hero */
.hero::before {
  content: ""; position: absolute; inset: 0 -24px; z-index: -1;
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 45%, #000 20%, transparent 70%);
          mask-image: radial-gradient(ellipse at 70% 45%, #000 20%, transparent 70%);
}
@media (min-width: 820px) { .hero { grid-template-columns: 1.1fr 1fr; padding: 96px 0 72px; } }

.hero h1 { font-size: clamp(40px, 6vw, 56px); font-weight: 700; letter-spacing: -0.035em; }
.role {
  margin: 8px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  background: linear-gradient(90deg, #0071e3, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { max-width: 460px; margin: 16px 0 0; font-size: 17px; color: var(--muted); }

.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 500; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--primary { background: var(--accent); border-color: transparent; color: #fff; }

.socials { list-style: none; display: flex; gap: 18px; margin: 28px 0 0; padding: 0; }
.socials a { display: block; color: var(--muted); }
.socials a:hover { color: var(--text); }
.socials svg { width: 21px; height: 21px; fill: currentColor; }

/* hero graphic: soft floating shapes */
.hero__art { margin: 0; max-width: 400px; width: 100%; justify-self: center; }
.shapes { width: 100%; height: auto; overflow: visible; }
.shape-glow { opacity: .35; }
.shape-ring { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 8; stroke-linecap: round; }
.shape { transform-box: fill-box; transform-origin: center; animation: float 7s ease-in-out infinite; }
.shape--square { animation-duration: 8s; animation-delay: -2s; }
.shape--dot { fill: var(--accent); animation-duration: 6s; animation-delay: -1s; }
.shape--small { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; animation-duration: 9s; animation-delay: -4s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.2); }

/* ================= Sections ================= */
section { padding: 40px 0; }
.label {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 24px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text);
}
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-head { display: flex; align-items: baseline; gap: 16px; }
.section-head .label { flex: 1; }
.section-head .more { margin: 0; }

.about { display: grid; gap: 32px; align-items: start; }
@media (min-width: 820px) { .about { grid-template-columns: 1fr 260px; gap: 48px; } }
.prose { max-width: 640px; }
.prose p { margin: 0 0 16px; font-size: 17px; }

.facts {
  list-style: none; margin: 0; padding: 18px 20px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14.5px; color: var(--text);
}
.facts li + li { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ================= Experience ================= */
.jobs { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.job { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 22px; padding-bottom: 24px; }
.job:last-child { padding-bottom: 0; }
/* line connecting the dots */
.job:not(:last-child)::before {
  content: ""; position: absolute; left: 6px; top: 34px; bottom: -14px;
  width: 2px; border-radius: 2px; background: var(--line);
}
.job__dot {
  width: 14px; height: 14px; margin-top: 22px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.job:first-child .job__dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.job__body {
  padding: 18px 20px 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: box-shadow .2s ease, transform .2s ease;
}
.job__body:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.job__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.job__top h3 { font-size: 17px; font-weight: 600; }
.job__org { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.job__body > p:not(.job__org) { margin: 14px 0 0; font-size: 15px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 999px;
  font: 500 12px var(--mono); color: var(--muted);
  background: var(--bg); border: 1px solid var(--line);
  white-space: nowrap;
}
.pill--live { color: var(--text); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 16px 0 0;
}
.stats div {
  padding: 10px 12px; border-radius: 12px;
  background: var(--accent-soft);
}
.stats dt { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); line-height: 1.2; }
.stats dd { margin: 2px 0 0; font-size: 12px; color: var(--soft); line-height: 1.3; }
@media (max-width: 480px) {
  .job { gap: 14px; }
  .stats dt { font-size: 17px; }
}

/* ================= Project cards ================= */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 14px 14px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card h3 { margin: 16px 4px 0; font-size: 16px; font-weight: 600; }
.card h3 a { color: var(--text); }
.card h3 a:hover { text-decoration: none; }
.card:hover h3 a { color: var(--accent); }
.card h3 a span { display: inline-block; font-size: 13px; transition: transform .2s ease; }
.card:hover h3 a span { transform: translate(2px, -2px); }
.card > p { margin: 6px 4px 0; font-size: 14.5px; flex: 1; }
.card .tags { margin: 14px 4px 0; }
.card__links { position: relative; z-index: 1; flex: none !important; margin: 12px 4px 0 !important; font-size: 14px; font-weight: 500; }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }

.thumb {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden;
}
.thumb--img { object-fit: cover; object-position: center 30%; background: #eef2ff; }
.thumb__emoji { font-size: 40px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.15)); }
.thumb--indigo { background: linear-gradient(135deg, #eef2ff, #c7d2fe); }
.thumb--sky    { background: linear-gradient(135deg, #e0f2fe, #bae6fd); }
.thumb--teal   { background: linear-gradient(135deg, #ccfbf1, #99f6e4); }
.thumb--amber  { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.thumb--violet { background: linear-gradient(135deg, #f3e8ff, #ddd6fe); }
.thumb--rose   { background: linear-gradient(135deg, #ffe4e6, #fecdd3); }
.thumb--green  { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.thumb--slate  { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }

:root[data-theme="dark"] .thumb--indigo { background: linear-gradient(135deg, #1e1b4b, #312e81); }
:root[data-theme="dark"] .thumb--sky    { background: linear-gradient(135deg, #082f49, #0c4a6e); }
:root[data-theme="dark"] .thumb--teal   { background: linear-gradient(135deg, #042f2e, #115e59); }
:root[data-theme="dark"] .thumb--amber  { background: linear-gradient(135deg, #2d1f05, #713f12); }
:root[data-theme="dark"] .thumb--violet { background: linear-gradient(135deg, #2e1065, #4c1d95); }
:root[data-theme="dark"] .thumb--rose   { background: linear-gradient(135deg, #3b0a14, #881337); }
:root[data-theme="dark"] .thumb--green  { background: linear-gradient(135deg, #052e16, #14532d); }
:root[data-theme="dark"] .thumb--slate  { background: linear-gradient(135deg, #0f172a, #1e293b); }
:root[data-theme="dark"] .thumb--img    { background: #1e1b4b; }
:root[data-theme="dark"] .spark path { stroke: #a5b4fc; }
:root[data-theme="dark"] .spark circle { fill: #a5b4fc; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thumb--indigo { background: linear-gradient(135deg, #1e1b4b, #312e81); }
  :root:not([data-theme="light"]) .thumb--sky    { background: linear-gradient(135deg, #082f49, #0c4a6e); }
  :root:not([data-theme="light"]) .thumb--teal   { background: linear-gradient(135deg, #042f2e, #115e59); }
  :root:not([data-theme="light"]) .thumb--amber  { background: linear-gradient(135deg, #2d1f05, #713f12); }
  :root:not([data-theme="light"]) .thumb--violet { background: linear-gradient(135deg, #2e1065, #4c1d95); }
  :root:not([data-theme="light"]) .thumb--rose   { background: linear-gradient(135deg, #3b0a14, #881337); }
  :root:not([data-theme="light"]) .thumb--green  { background: linear-gradient(135deg, #052e16, #14532d); }
  :root:not([data-theme="light"]) .thumb--slate  { background: linear-gradient(135deg, #0f172a, #1e293b); }
  :root:not([data-theme="light"]) .thumb--img    { background: #1e1b4b; }
  :root:not([data-theme="light"]) .spark path { stroke: #a5b4fc; }
  :root:not([data-theme="light"]) .spark circle { fill: #a5b4fc; }
}

.spark { width: 62%; overflow: visible; }
.spark path { fill: none; stroke: #4f46e5; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.spark circle { fill: #4f46e5; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; }
.tags li { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--accent); background: var(--accent-soft); }

.more { display: inline-block; margin-top: 24px; font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.more span { display: inline-block; transition: transform .2s ease; }
.more:hover { text-decoration: none; color: var(--accent); }
.more:hover span { transform: translateX(3px); }

/* ================= Blogs ================= */
.posts { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.posts li + li { border-top: 1px solid var(--line); }
.posts a { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 16px 0; color: var(--text); font-weight: 500; }
.posts a:hover { text-decoration: none; color: var(--accent); }
.posts time { flex: none; font: 13px var(--mono); color: var(--muted); }

/* ================= Projects page ================= */
.page-head { padding: 64px 0 16px; }
.page-head h1 { margin-top: 16px; font-size: clamp(36px, 5vw, 48px); letter-spacing: -0.03em; }
.back { font-size: 14px; font-weight: 500; color: var(--muted); }
.back:hover { color: var(--text); text-decoration: none; }

/* ================= Footer ================= */
.footer { margin-top: 40px; padding: 48px 0 56px; border-top: 1px solid var(--line); text-align: center; }
.footer__cta { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: var(--text); }
.footer__cta a { white-space: nowrap; }
.footer p.muted { margin: 0; font-size: 13px; }
