/* ---------- tokens ---------- */
:root{
  --bg: #FAFAF8;
  --bg-alt: #F1F0EB;
  --ink: #14161A;
  --ink-muted: #5B5D58;
  --ink-faint: #8C8B85;
  --accent: #2F6FED;
  --accent-deep: #1E4FBD;
  --accent-tint: #E9F0FE;
  --line: rgba(20,22,26,0.09);
  --line-strong: rgba(20,22,26,0.16);
  --surface: #ffffff;
  --nav-bg: rgba(250,250,248,0.7);
  --glass-bg: rgba(255,255,255,0.6);
  --glass-border: rgba(255,255,255,0.8);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 1px 2px rgba(20,22,26,0.04), 0 12px 32px rgba(20,22,26,0.06);
  --shadow-lift: 0 2px 6px rgba(20,22,26,0.06), 0 24px 48px rgba(20,22,26,0.10);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --cs-ml: #0F9D8B;
  --cs-ml-tint: rgba(15,157,139,0.12);
  --cs-alert: #D1435B;
  --cs-alert-tint: rgba(209,67,91,0.10);
}

/* ---------- dark theme ---------- */
:root[data-theme="dark"]{
  --bg: #0E1014;
  --bg-alt: #14171D;
  --ink: #F2F3F5;
  --ink-muted: #A2A5AD;
  --ink-faint: #71747C;
  --accent: #5A90FF;
  --accent-deep: #8AB0FF;
  --accent-tint: rgba(90,144,255,0.14);
  --line: rgba(255,255,255,0.10);
  --line-strong: rgba(255,255,255,0.20);
  --surface: #191C22;
  --nav-bg: rgba(14,16,20,0.7);
  --glass-bg: rgba(35,39,47,0.6);
  --glass-border: rgba(255,255,255,0.10);
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.30), 0 12px 32px rgba(0,0,0,0.35);
  --shadow-lift: 0 2px 6px rgba(0,0,0,0.35), 0 24px 48px rgba(0,0,0,0.45);
  --cs-ml: #37C9B4;
  --cs-ml-tint: rgba(55,201,180,0.16);
  --cs-alert: #FF6B81;
  --cs-alert-tint: rgba(255,107,129,0.14);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

a{ color: inherit; text-decoration: none; }
ul{ margin:0; padding:0; list-style:none; }
h1,h2,h3{ margin:0; font-weight: 600; letter-spacing: -0.02em; }
p{ margin:0; }

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

/* subtle ambient background field */
.bg-field{
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 82% 8%, rgba(47,111,237,0.07), transparent 60%),
    radial-gradient(40% 30% at 10% 30%, rgba(47,111,237,0.04), transparent 60%);
}

/* ---------- nav ---------- */
.nav{
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.nav-inner{
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-name{ font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.nav-links{ display: flex; gap: 32px; }
.nav-links a{
  font-size: 14px;
  color: var(--ink-muted);
  transition: color 0.2s ease;
}
.nav-links a:hover{ color: var(--ink); }
.nav-cta{
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.nav-cta:hover{ background: var(--accent); color: #fff; transform: translateY(-1px); }

/* nav actions cluster */
.nav-actions{ display: flex; align-items: center; gap: 12px; }

.theme-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover{ color: var(--ink); border-color: var(--ink); transform: translateY(-1px); }
.theme-toggle .icon-moon{ display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun{ display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon{ display: block; }

/* hamburger */
.nav-toggle{
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span{
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px){
  .nav-toggle{ display: flex; }
  .nav-cta{ display: none; }
  .nav-links{
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .nav-links.open{
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }
  .nav-links a{
    padding: 14px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
  }
  .nav-links a:last-child{ border-bottom: none; }
}

/* ---------- hero ---------- */
.hero{
  max-width: 1120px;
  margin: 0 auto;
  padding: 96px 32px 140px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero-intro{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.hero-avatar{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 10%;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-soft);
}
.hero-status{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.status-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}

.eyebrow{
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--accent-deep);
  margin: 0 0 24px;
  text-transform: lowercase;
}

.hero-title{
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.98;
  margin: 0 0 24px;
}

.hero-sub{
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 460px;
  margin: 0 0 36px;
}

.hero-actions{ display: flex; gap: 14px; flex-wrap: wrap; }

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary{
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47,111,237,0.2), 0 12px 24px rgba(47,111,237,0.25);
}
.btn-primary:hover{ background: var(--accent-deep); transform: translateY(-2px); }
.btn-primary:active{ transform: translateY(0) scale(0.98); }

.btn-secondary{
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover{ border-color: var(--ink); transform: translateY(-2px); }
.btn-secondary:active{ transform: translateY(0) scale(0.98); }

/* floating glass cards */
.hero-cards{
  position: relative;
  height: 380px;
}
.glass-card{
  position: absolute;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease-out;
  will-change: transform;
}
.card-value{ font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.card-value-sm{ font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.card-label{ font-size: 13px; color: var(--ink-muted); }
.card-mono{ font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-deep); }

.card-1{ top: 6%; left: 4%; width: 210px; }
.card-2{ top: 46%; left: 30%; width: 260px; }
.card-3{ top: 74%; left: 2%; width: 190px; }

@media (max-width: 960px){
  .hero{ grid-template-columns: 1fr; padding-top: 64px; }
  .hero-cards{ height: 260px; margin-top: 20px; }
  .card-1{ left: 0; top: 0; }
  .card-2{ left: 38%; top: 30%; }
  .card-3{ left: 4%; top: 66%; }
}

/* ---------- sections ---------- */
.section{ padding: 100px 32px; }
.section-alt{ background: var(--bg-alt); }
.section-inner{ max-width: 1120px; margin: 0 auto; }

.section-eyebrow{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-deep);
  letter-spacing: 0.03em;
  margin: 0 0 16px;
}
.section-title{ font-size: clamp(28px,4vw,38px); margin-bottom: 40px; }

/* about */
.about-grid{
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  align-items: start;
}
.profile-photo{
  width: 240px;
  height: 240px;
  object-fit: cover;
  object-position: center 10%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}
.about-lead{ font-size: 20px; font-weight: 500; margin-bottom: 18px; line-height: 1.5; }
.about-copy p{ color: var(--ink-muted); margin-bottom: 16px; font-size: 16px; }

.cert-link{
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.cert-link:hover{
  color: var(--accent-deep);
  text-decoration-color: var(--accent);
}

.tag-row{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.tag{
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-deep);
}

@media (max-width: 720px){
  .about-grid{ grid-template-columns: 1fr; }
  .profile-photo{ width: 160px; height: 160px; }
}

/* experience */
.exp-row{
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 40px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.exp-row:last-child{ border-bottom: 1px solid var(--line); }
.exp-what h3{ font-size: 20px; margin-bottom: 4px; }
.exp-org{ color: var(--ink-muted); font-size: 14px; margin-bottom: 16px; }
.exp-what ul{ display: flex; flex-direction: column; gap: 10px; }
.exp-what li{
  position: relative;
  padding-left: 18px;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.6;
}
.exp-what li::before{
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 720px){
  .exp-row{ grid-template-columns: 1fr; gap: 12px; }
}

/* projects */
.project-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.project-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.project-card:hover{
  transform: translateY(-6px);
  box-shadow: var(--shadow-lift);
  border-color: transparent;
}
.project-glow{
  position: absolute;
  top: -40%;
  right: -30%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(47,111,237,0.10), transparent 70%);
  pointer-events: none;
}
.project-tag{ display: block; margin-bottom: 18px; }
.project-card h3{ font-size: 19px; margin-bottom: 10px; }
.project-card p{ color: var(--ink-muted); font-size: 14.5px; line-height: 1.6; }

.project-note{
  margin-top: 28px;
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
}

@media (max-width: 900px){
  .project-grid{ grid-template-columns: 1fr; }
}

/* contact */
.contact-inner{ text-align: center; }
.contact-title{ font-size: clamp(32px,5vw,48px); margin-bottom: 16px; }
.contact-sub{
  color: var(--ink-muted);
  font-size: 17px;
  max-width: 480px;
  margin: 0 auto 36px;
}
.contact-inner .hero-actions{ justify-content: center; }

/* footer */
.footer{ border-top: 1px solid var(--line); padding: 32px; }
.footer-inner{
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-faint);
}
.footer-links{ display: flex; gap: 20px; }
.footer-links a{ transition: color 0.2s ease; }
.footer-links a:hover{ color: var(--ink); }

/* ---------- scroll reveal ---------- */
.reveal{
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(.2,.8,.2,1), transform 0.7s cubic-bezier(.2,.8,.2,1);
}
.reveal.is-visible{
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce){
  .reveal{ opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   FEATURED PROJECT CARD (index — Projects section)
   ========================================================================== */
.project-featured{
  position: relative;
  display: block;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 34px;
  margin-bottom: 24px;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.project-featured:hover{
  transform: translateY(-6px);
  box-shadow: var(--shadow-lift);
  border-color: transparent;
}
.pf-badge{
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-tint);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.pf-head{ display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.project-featured h3{ font-size: 24px; margin-bottom: 10px; letter-spacing: -0.02em; }
.project-featured .pf-copy{ color: var(--ink-muted); font-size: 15.5px; line-height: 1.65; max-width: 62ch; }
.pf-link{ font-size: 14px; font-weight: 600; color: var(--accent-deep); white-space: nowrap; }
.project-featured:hover .pf-link{ text-decoration: underline; text-underline-offset: 3px; }
.pf-metrics{ display: flex; flex-wrap: wrap; gap: 36px; margin: 26px 0 22px; }
.pf-metric .m-v{ font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.pf-metric .m-v.alert{ color: var(--cs-alert); }
.pf-metric .m-l{ font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.pf-tags{ display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px){
  .pf-metrics{ gap: 22px; }
  .project-featured{ padding: 26px 22px; }
}

/* ==========================================================================
   CASE STUDY PAGE
   ========================================================================== */
.cs-page{ max-width: 1000px; margin: 0 auto; padding: 0 32px; }
.cs-back{
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted);
  margin: 40px 0 26px; transition: color 0.2s ease, gap 0.2s ease;
}
.cs-back:hover{ color: var(--ink); gap: 11px; }

.cs-hero{ padding-bottom: 20px; }
.cs-hero h1{ font-size: clamp(30px, 5.2vw, 50px); line-height: 1.04; margin: 14px 0 20px; }
.cs-lead{ font-size: 18px; line-height: 1.6; color: var(--ink-muted); max-width: 66ch; }
.cs-tags{ display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.cs-note{
  display: inline-flex; align-items: center; gap: 9px; margin-top: 22px;
  font-size: 13px; color: var(--ink-muted);
  background: var(--surface); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: var(--radius-sm);
}
.cs-note b{ color: var(--ink); }

.cs-section{ padding: 52px 0; border-top: 1px solid var(--line); }
.cs-section:first-of-type{ border-top: none; }
.cs-eyebrow{ font-family: var(--font-mono); font-size: 13px; color: var(--accent-deep); margin: 0 0 12px; }
.cs-title{ font-size: clamp(22px, 3.4vw, 32px); margin-bottom: 14px; letter-spacing: -0.02em; }

.cs-kpis{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cs-kpi{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-soft);
}
.cs-kpi .v{ font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.cs-kpi .v.alert{ color: var(--cs-alert); }
.cs-kpi .l{ font-size: 12.5px; color: var(--ink-muted); margin-top: 4px; line-height: 1.45; }

.cs-grid2{ display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.cs-card{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-soft);
}
.cs-card h3{ font-size: 17px; margin-bottom: 4px; }
.cs-card .sub{ font-size: 13px; color: var(--ink-muted); margin-bottom: 18px; }

.cs-flow{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.cs-step{
  flex: 1; min-width: 150px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 15px 17px;
}
.cs-step .n{ font-family: var(--font-mono); font-size: 12px; color: var(--accent-deep); }
.cs-step b{ display: block; margin: 4px 0 3px; font-weight: 600; }
.cs-step small{ color: var(--ink-muted); font-size: 13px; line-height: 1.5; }

.cs-table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cs-table{ width: 100%; border-collapse: collapse; font-size: 14px; }
.cs-table th, .cs-table td{ padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.cs-table th:first-child, .cs-table td:first-child{ text-align: left; }
.cs-table thead th{ font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); font-weight: 500; }
.cs-table tr.hi td{ background: var(--accent-tint); font-weight: 700; }

.cs-legend{ display: flex; gap: 18px; font-size: 12.5px; color: var(--ink-muted); margin: 2px 0 14px; }
.cs-swatch{ display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

.cs-callout{
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--accent-tint); border-radius: var(--radius-md);
  padding: 20px 22px; margin-top: 22px; font-size: 15px; line-height: 1.65; color: var(--ink-muted);
}
.cs-callout.ml{ border-left-color: var(--cs-ml); background: var(--cs-ml-tint); }
.cs-callout b{ color: var(--ink); }

.cs-svg text{ font-family: var(--font-sans); }

/* dashboard screenshots framed as a browser window */
.cs-shot{
  border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-soft); margin-top: 18px;
}
.cs-shot .bar{
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg-alt);
}
.cs-shot .dot{ width: 10px; height: 10px; border-radius: 50%; }
.cs-shot .bar .title{ font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-muted); margin-left: 8px; }
.cs-shot img{ display: block; width: 100%; height: auto; }
.cs-shot figcaption{ font-size: 12.5px; color: var(--ink-muted); padding: 11px 15px; border-top: 1px solid var(--line); }
.cs-shot figcaption b{ color: var(--ink); }

@media (max-width: 820px){
  .cs-kpis{ grid-template-columns: repeat(2, 1fr); }
  .cs-grid2{ grid-template-columns: 1fr; }
}
