/* =========================================================================
   Anuj Sonawane — Portfolio
   Plain CSS, no framework. Dark theme by default, light theme via [data-theme].
   ========================================================================= */

/* ---------- Tokens ------------------------------------------------------- */
:root {
  --bg:            #07090d;
  --bg-alt:        #0b0e14;
  --surface:       rgba(255,255,255,.035);
  --surface-2:     rgba(255,255,255,.055);
  --border:        rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.16);

  --text:      #e9edf5;
  --text-soft: #a5aec2;
  --text-mute: #6f7891;

  --brand:   #6d8bff;
  --brand-2: #22d3c5;
  --brand-3: #b98bff;
  --brand-rgb: 109,139,255;

  --grad: linear-gradient(115deg, #6d8bff 0%, #22d3c5 52%, #b98bff 100%);

  --ok:   #34d399;
  --warn: #fbbf24;
  --err:  #f87171;

  --radius:    18px;
  --radius-sm: 12px;
  --radius-lg: 26px;

  --shadow:    0 18px 48px -18px rgba(0,0,0,.7);
  --shadow-lg: 0 34px 80px -28px rgba(0,0,0,.85);

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --maxw: 1180px;
  --nav-h: 74px;

  --ease: cubic-bezier(.22,.68,.36,1);
}

html[data-theme="light"] {
  --bg:            #f7f8fc;
  --bg-alt:        #ffffff;
  --surface:       rgba(15,20,40,.028);
  --surface-2:     rgba(15,20,40,.05);
  --border:        rgba(15,20,40,.10);
  --border-strong: rgba(15,20,40,.18);

  --text:      #10141f;
  --text-soft: #4a5266;
  --text-mute: #767f95;

  --brand:   #3f5ce0;
  --brand-2: #0d9c92;
  --brand-3: #8b5cf6;
  --brand-rgb: 63,92,224;

  --grad: linear-gradient(115deg, #3f5ce0 0%, #0d9c92 52%, #8b5cf6 100%);

  --shadow:    0 16px 40px -20px rgba(20,30,70,.28);
  --shadow-lg: 0 30px 70px -30px rgba(20,30,70,.34);
}

/* ---------- Reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Kills the grey flash Android shows on every tap. */
  -webkit-tap-highlight-color: transparent;
  transition: background .45s var(--ease), color .45s var(--ease);
}

/* Long unbroken strings (emails, URLs) must never widen the page. */
h1, h2, h3, p, li, span, a { overflow-wrap: break-word; }

/* Set together with an inline `top: -<scrollY>px` by main.js — position:fixed
   is the only reliable scroll lock on iOS Safari. */
body.is-locked { position: fixed; width: 100%; overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

::selection { background: rgba(var(--brand-rgb), .32); color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

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

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 999;
  background: var(--brand); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-weight: 600;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- Layout ------------------------------------------------------- */
/* env() keeps content clear of notches and rounded corners in landscape. */
.container {
  width: 100%; max-width: var(--maxw); margin-inline: auto;
  padding-inline: max(24px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-right));
}

.section { padding: 108px 0; position: relative; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section__head { text-align: center; max-width: 660px; margin: 0 auto 62px; }

.section__num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .78rem; letter-spacing: .22em;
  color: var(--brand-2);
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  margin-bottom: 18px;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.12;
}

.section__sub { color: var(--text-soft); margin-top: 14px; font-size: 1.04rem; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Background --------------------------------------------------- */
.bg-layer { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }

.bg-grid {
  position: absolute; inset: -50%;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 62px 62px;
  opacity: .5;
  mask-image: radial-gradient(ellipse 62% 52% at 50% 30%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 62% 52% at 50% 30%, #000 20%, transparent 78%);
}

.orb { position: absolute; border-radius: 50%; filter: blur(110px); opacity: .30; }
html[data-theme="light"] .orb { opacity: .22; }

.orb--1 { width: 560px; height: 560px; background: var(--brand);   top: -180px; left: -140px; animation: drift1 26s ease-in-out infinite; }
.orb--2 { width: 480px; height: 480px; background: var(--brand-2); top: 22%;    right: -170px; animation: drift2 32s ease-in-out infinite; }
.orb--3 { width: 520px; height: 520px; background: var(--brand-3); bottom: -6%; left: 30%;    animation: drift3 38s ease-in-out infinite; }

@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(90px,70px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-80px,60px)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(60px,-70px)} }

.bg-noise {
  position: absolute; inset: 0; opacity: .30; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

/* ---------- Preloader ---------------------------------------------------- */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: grid; place-content: center; justify-items: center; gap: 22px;
  transition: opacity .55s var(--ease), visibility .55s;
}
.preloader.done { opacity: 0; visibility: hidden; }

.preloader__mark {
  font-family: var(--font-display); font-weight: 800; font-size: 2.4rem;
  letter-spacing: .06em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.42} }

.preloader__bar { width: 168px; height: 3px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.preloader__bar span { display: block; height: 100%; width: 40%; background: var(--grad); border-radius: 99px; animation: load 1.1s var(--ease) infinite; }
@keyframes load { 0%{transform:translateX(-100%)} 100%{transform:translateX(320%)} }

/* ---------- Scroll progress ---------------------------------------------- */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; background: transparent; }
.scroll-progress span { display: block; height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 14px rgba(var(--brand-rgb), .7); }

/* ---------- Navigation --------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: background .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease), height .35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  height: 64px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 30px -18px rgba(0,0,0,.6);
}

.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-display); font-weight: 700; }
.brand__mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--grad);
  color: #fff; font-size: .84rem; font-weight: 800; letter-spacing: .04em;
  box-shadow: 0 6px 20px -6px rgba(var(--brand-rgb), .75);
}
.brand__text { font-size: 1.02rem; letter-spacing: -.02em; }
.brand__dot { color: var(--brand-2); }

.nav__links { position: relative; display: flex; align-items: center; gap: 4px; }
.nav__link {
  position: relative; z-index: 1;
  padding: 9px 15px; border-radius: 99px;
  font-size: .92rem; font-weight: 500;
  color: var(--text-soft);
  transition: color .25s var(--ease);
  white-space: nowrap;
}
.nav__link:hover { color: var(--text); }
.nav__link.active { color: var(--text); font-weight: 600; }

/* Sized and positioned by main.js from the active link. Anchored to the
   vertical centre rather than stretched to 100% height, so anything else
   inside .nav__links can never distort it. */
.nav__pill {
  position: absolute; z-index: 0; top: 50%; left: 0;
  height: 0; width: 0;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0;
  transition: transform .4s var(--ease), width .4s var(--ease), opacity .3s var(--ease);
}

.nav__actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: all .25s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }
.icon-btn .ico { width: 19px; height: 19px; }

.ico--sun  { display: none; }
.ico--moon { display: block; }
html[data-theme="light"] .ico--sun  { display: block; }
html[data-theme="light"] .ico--moon { display: none; }

.burger { display: none; width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); position: relative; }
.burger span {
  position: absolute; left: 11px; width: 20px; height: 2px; border-radius: 2px;
  background: var(--text); transition: all .3s var(--ease);
}
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 20px; }
.burger span:nth-child(3) { top: 26px; }
.burger.open span:nth-child(1) { top: 20px; transform: rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.burger.open span:nth-child(3) { top: 20px; transform: rotate(-45deg); }

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 26px;
  border-radius: 99px;
  font-weight: 600; font-size: .95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex: none; }

.btn--primary {
  background: var(--grad);
  color: #fff;
  background-size: 180% 180%;
  box-shadow: 0 12px 30px -12px rgba(var(--brand-rgb), .85);
}
.btn--primary:hover { transform: translateY(-3px); background-position: 100% 50%; box-shadow: 0 20px 42px -14px rgba(var(--brand-rgb), .95); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--brand); color: var(--brand); }

.btn--sm { padding: 9px 17px; font-size: .87rem; }
.btn--sm svg { width: 15px; height: 15px; }
.btn--full { width: 100%; }

/* ---------- Hero --------------------------------------------------------- */
.hero {
  min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 56px) 0 96px;
  position: relative;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 62px; align-items: center;
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .84rem; font-weight: 500;
  color: var(--text-soft);
  padding: 7px 16px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  margin-bottom: 26px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: ping 2s infinite; }
@keyframes ping { 0%{box-shadow:0 0 0 0 rgba(52,211,153,.55)} 70%{box-shadow:0 0 0 9px rgba(52,211,153,0)} 100%{box-shadow:0 0 0 0 rgba(52,211,153,0)} }

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.6vw, 4.05rem);
  font-weight: 800; line-height: 1.05; letter-spacing: -.04em;
  margin-bottom: 12px;
}

.hero__role {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.7vw, 1.85rem);
  font-weight: 600; letter-spacing: -.02em;
  color: var(--text-soft);
  min-height: 2.2em;
  margin-bottom: 20px;
}
.type { color: var(--brand-2); }
.caret { display: inline-block; width: 3px; height: 1.05em; background: var(--brand-2); margin-left: 3px; vertical-align: -.14em; animation: blink 1s steps(2,start) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero__lede { color: var(--text-soft); font-size: 1.05rem; max-width: 60ch; margin-bottom: 32px; }
.hero__lede strong { color: var(--text); font-weight: 600; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 13px; margin-bottom: 34px; }

.hero__meta { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 24px; }
.hero__meta li { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-mute); }
.hero__meta svg { width: 16px; height: 16px; color: var(--brand); flex: none; }

.hero__social { display: flex; gap: 11px; }
.social {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: all .28s var(--ease);
}
.social svg { width: 19px; height: 19px; }
.social:hover { color: #fff; background: var(--grad); border-color: transparent; transform: translateY(-4px); box-shadow: 0 12px 26px -10px rgba(var(--brand-rgb),.8); }

/* Code card */
.hero__visual { position: relative; perspective: 1400px; }
.tilt { transform-style: preserve-3d; transition: transform .35s var(--ease); }

.code-card {
  background: color-mix(in srgb, var(--bg-alt) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}
.code-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, rgba(var(--brand-rgb),.55), transparent 45%, rgba(34,211,197,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.code-card__bar {
  display: flex; align-items: center; gap: 7px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot--r { background: #ff5f57; } .dot--y { background: #febc2e; } .dot--g { background: #28c840; }
.code-card__file { margin-left: 10px; font-family: var(--font-mono); font-size: .76rem; color: var(--text-mute); }

.code-card__body {
  padding: 22px 24px 26px;
  font-family: var(--font-mono);
  font-size: .8rem; line-height: 1.85;
  color: var(--text-soft);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;   /* don't drag the page while scrolling code */
  white-space: pre;
  tab-size: 4;
}
.c-key { color: #ff7bb0; } .c-cls { color: #ffd479; } .c-str { color: #7ee0a8; }
.c-fn  { color: #6fc3ff; } .c-arg { color: #d0a0ff; }
html[data-theme="light"] .c-key { color:#c2255c } html[data-theme="light"] .c-cls { color:#b45309 }
html[data-theme="light"] .c-str { color:#0f7a4f } html[data-theme="light"] .c-fn { color:#1a6fc4 }
html[data-theme="light"] .c-arg { color:#7c3aed }

.float-chip {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  font-size: .82rem; font-weight: 600;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.float-chip--1 { top: -22px;    right: -14px; animation: fl 5.5s ease-in-out infinite; }
.float-chip--2 { bottom: 52px;  left: -34px;  animation: fl 6.8s ease-in-out infinite .6s; }
.float-chip--3 { bottom: -20px; right: 28px;  animation: fl 6s   ease-in-out infinite 1.2s; }
@keyframes fl { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-13px)} }

.scroll-hint {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 8px;
  color: var(--text-mute); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  animation: fl 2.6s ease-in-out infinite;
}
.scroll-hint em { font-style: normal; }
.mouse { width: 24px; height: 38px; border: 2px solid var(--border-strong); border-radius: 14px; display: grid; justify-items: center; padding-top: 7px; }
.mouse span { width: 3px; height: 7px; border-radius: 2px; background: var(--brand-2); animation: wheel 1.7s var(--ease) infinite; }
@keyframes wheel { 0%{opacity:0;transform:translateY(-3px)} 40%{opacity:1} 100%{opacity:0;transform:translateY(11px)} }

/* ---------- Marquee ------------------------------------------------------ */
.marquee {
  border-block: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 17px 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.marquee__track { display: flex; align-items: center; gap: 20px; width: max-content; animation: scroll-x 42s linear infinite; }
.marquee__track span { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--text-mute); white-space: nowrap; }
.marquee__track i { color: var(--brand-2); font-size: .58rem; font-style: normal; }
@keyframes scroll-x { to { transform: translateX(-50%); } }

/* ---------- About -------------------------------------------------------- */
.about { display: grid; grid-template-columns: 1.25fr .95fr; gap: 56px; align-items: start; }
.about__text p { color: var(--text-soft); margin-bottom: 17px; font-size: 1.02rem; }
.about__text strong { color: var(--text); font-weight: 600; }

.about__tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.tag {
  font-size: .82rem; font-weight: 500;
  padding: 7px 15px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  transition: all .25s var(--ease);
}
.tag:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

.about__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat {
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  transition: all .3s var(--ease);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0;
  background: var(--grad); opacity: 0; transition: opacity .3s var(--ease);
  mask-image: linear-gradient(180deg, #000, transparent 60%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 60%);
}
.stat:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat:hover::after { opacity: .07; }
.stat__num {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -.03em; line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat__label { font-size: .8rem; color: var(--text-mute); margin-top: 8px; line-height: 1.5; }

/* ---------- Timeline ----------------------------------------------------- */
.timeline { position: relative; max-width: 880px; margin-inline: auto; padding-left: 34px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2), transparent);
  opacity: .55;
}

.tl-item { position: relative; margin-bottom: 26px; }
.tl-item:last-child { margin-bottom: 0; }

.tl-dot { position: absolute; left: -34px; top: 26px; width: 18px; height: 18px; display: grid; place-items: center; }
.tl-dot span { width: 12px; height: 12px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px var(--bg-alt), 0 0 16px rgba(var(--brand-rgb),.9); }

.tl-card {
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: all .3s var(--ease);
}
.tl-card:hover { transform: translateX(6px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.tl-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tl-card__role { font-family: var(--font-display); font-size: 1.17rem; font-weight: 700; letter-spacing: -.02em; }
.tl-card__org { color: var(--brand-2); font-size: .92rem; font-weight: 500; margin-top: 2px; }

.chip {
  font-family: var(--font-mono); font-size: .74rem;
  padding: 6px 13px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-mute);
  white-space: nowrap;
}
.chip--live { border-color: rgba(52,211,153,.4); color: var(--ok); background: rgba(52,211,153,.08); }

.tl-list li {
  position: relative; padding-left: 20px; margin-bottom: 8px;
  color: var(--text-soft); font-size: .95rem;
}
.tl-list li::before {
  content: ""; position: absolute; left: 2px; top: .68em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .8;
}
.tl-list strong { color: var(--text); font-weight: 600; }

.tl-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.tl-tags span {
  font-family: var(--font-mono); font-size: .72rem;
  padding: 4px 11px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-mute);
}

/* ---------- Projects ----------------------------------------------------- */
/* min() guard: without it a 320px track is wider than a 320px viewport's
   content box, which pushes the whole page sideways. */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 22px; }

.pcard {
  position: relative; overflow: hidden;
  padding: 32px 30px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex; flex-direction: column;
  transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.pcard:hover { transform: translateY(-9px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

.pcard__glow {
  position: absolute; top: -60%; left: -20%; width: 140%; height: 130%;
  background: radial-gradient(circle at 50% 50%, rgba(var(--brand-rgb),.20), transparent 62%);
  opacity: 0; transition: opacity .4s var(--ease); pointer-events: none;
}
.pcard:hover .pcard__glow { opacity: 1; }

.pcard__icon {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--grad);
  color: #fff;
  margin-bottom: 20px;
  box-shadow: 0 12px 28px -12px rgba(var(--brand-rgb),.9);
}
.pcard__icon svg { width: 25px; height: 25px; }

.pcard__title { font-family: var(--font-display); font-size: 1.24rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 12px; }
.pcard__desc  { color: var(--text-soft); font-size: .95rem; margin-bottom: 18px; }
.pcard__desc strong { color: var(--text); font-weight: 600; }

.pcard__points { margin-bottom: 20px; }
.pcard__points li {
  position: relative; padding-left: 22px; margin-bottom: 7px;
  font-size: .88rem; color: var(--text-mute);
}
.pcard__points li::before {
  content: "▸"; position: absolute; left: 4px; top: -1px; color: var(--brand-2); font-size: .82rem;
}

.pcard__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; margin-bottom: 20px; }
.pcard__tags span {
  font-family: var(--font-mono); font-size: .71rem;
  padding: 4px 11px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-mute);
}

.pcard__link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .9rem; font-weight: 600; color: var(--brand);
  transition: gap .25s var(--ease);
}
.pcard__link svg { width: 15px; height: 15px; }
.pcard__link:hover { gap: 12px; }

.pcard--cta { justify-content: flex-start; }
.pcard__btn { margin-top: 14px; align-self: flex-start; font-size: .88rem; padding: 11px 20px; }
.pcard__btn svg { width: 17px; height: 17px; }

/* ---------- Skills ------------------------------------------------------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 268px), 1fr)); gap: 18px; }

.skill-card {
  padding: 24px 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  transition: all .3s var(--ease);
}
.skill-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.skill-card__title {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 700;
  margin-bottom: 16px;
}
.skill-card__ico {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .84rem; font-family: var(--font-mono); color: var(--brand-2);
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills span {
  font-size: .82rem; font-weight: 500;
  padding: 6px 14px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
  transition: all .22s var(--ease);
}
.pills span:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

.cert {
  display: flex; align-items: center; gap: 18px;
  max-width: 480px; margin: 34px auto 0;
  padding: 20px 26px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.cert__badge {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center; border-radius: 13px;
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 24px -10px rgba(var(--brand-rgb),.85);
}
.cert__badge svg { width: 23px; height: 23px; }
.cert h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.cert p  { font-size: .87rem; color: var(--text-mute); }

/* ---------- Education ---------------------------------------------------- */
.edu { display: grid; gap: 14px; max-width: 900px; margin-inline: auto; }

.edu-card {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 24px; align-items: center;
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all .3s var(--ease);
}
.edu-card:hover { transform: translateX(6px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.edu-card__years { font-family: var(--font-mono); font-size: .8rem; color: var(--brand-2); }
.edu-card__body h3 { font-family: var(--font-display); font-size: 1.04rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.4; }
.edu-card__body p  { font-size: .88rem; color: var(--text-mute); margin-top: 3px; }
.edu-card__score { text-align: right; }
.edu-card__score span {
  display: block;
  font-family: var(--font-display); font-weight: 800; font-size: 1.32rem; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.edu-card__score em { font-style: normal; font-size: .7rem; color: var(--text-mute); letter-spacing: .12em; text-transform: uppercase; }

/* ---------- Contact ------------------------------------------------------ */
.contact { display: grid; grid-template-columns: .92fr 1.08fr; gap: 26px; align-items: start; }

.contact__side { display: grid; gap: 12px; }
.ccard {
  display: flex; align-items: center; gap: 16px;
  padding: 17px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  transition: all .28s var(--ease);
}
.ccard:hover { transform: translateX(6px); border-color: var(--brand); box-shadow: var(--shadow); }
.ccard--muted { cursor: default; }
.ccard--muted:hover { transform: none; border-color: var(--border); box-shadow: none; }

.ccard__ico {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--brand);
}
.ccard__ico svg { width: 19px; height: 19px; }
.ccard strong { display: block; font-size: .82rem; color: var(--text-mute); font-weight: 500; }
.ccard span   { display: block; font-size: .94rem; font-weight: 600; word-break: break-word; }

.contact__form {
  padding: 30px 30px 26px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  display: grid; gap: 16px;
}

.field { display: grid; gap: 7px; }
.field label { font-size: .84rem; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .94rem;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-mute); opacity: .7; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .16);
}
.field.invalid input, .field.invalid textarea { border-color: var(--err); box-shadow: 0 0 0 4px rgba(248,113,113,.14); }
.err { font-size: .78rem; color: var(--err); min-height: 1em; }

.form-note { font-size: .78rem; color: var(--text-mute); text-align: center; }

/* ---------- Footer ------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding-top: 46px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap; padding-bottom: 34px; }
.footer__brand { display: flex; align-items: center; gap: 13px; }
.footer__brand strong { display: block; font-family: var(--font-display); font-size: 1rem; }
.footer__brand span { font-size: .82rem; color: var(--text-mute); }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer__links a { font-size: .9rem; color: var(--text-soft); transition: color .22s var(--ease); }
.footer__links a:hover { color: var(--brand); }
.footer__social { display: flex; gap: 10px; }

.footer__bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px 24px; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--text-mute);
}

/* ---------- To top + toast ---------------------------------------------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 140;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad); color: #fff;
  box-shadow: 0 14px 32px -12px rgba(var(--brand-rgb),.95);
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.85);
  transition: all .35s var(--ease);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { transform: translateY(-4px) scale(1.06); }
.to-top svg { width: 19px; height: 19px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 500;
  transform: translate(-50%, 26px);
  padding: 13px 24px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: .9rem; font-weight: 500;
  opacity: 0; visibility: hidden;
  transition: all .35s var(--ease);
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- Reveal animation -------------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .75s var(--ease), transform .75s var(--ease); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile menu extras (hidden on desktop) ----------------------- */
.nav__menu-extra { display: none; }
.nav__menu-social { display: flex; gap: 12px; justify-content: center; }

/* ---------- Responsive --------------------------------------------------- */

/* --- Laptop / small desktop --- */
@media (max-width: 1080px) {
  .nav__links { gap: 0; }
  .nav__link { padding: 9px 12px; font-size: .88rem; }
  .hero__inner { gap: 44px; }
}

/* --- Tablet: stack the two-column layouts --- */
@media (max-width: 940px) {
  .hero__inner { grid-template-columns: 1fr; gap: 52px; }
  .hero__visual { max-width: 560px; margin-inline: auto; width: 100%; }
  .about { grid-template-columns: 1fr; gap: 40px; }
  .contact { grid-template-columns: 1fr; }
  .float-chip--2 { left: -10px; }
}

/* --- Burger menu takes over --- */
@media (max-width: 860px) {
  .nav__cta { display: none; }
  .burger { display: block; position: relative; z-index: 170; }

  /* Keep the header row usable while the menu is open. */
  .brand, .icon-btn { position: relative; z-index: 170; }

  .nav__links {
    position: fixed; inset: 0;
    height: 100dvh;                     /* dvh tracks the collapsing URL bar */
    flex-direction: column; gap: 4px;
    /* "safe" centring: falls back to start-alignment when the menu is taller
       than the screen, so the top links stay reachable on short phones. */
    justify-content: center;
    justify-content: safe center;
    padding: calc(var(--nav-h) + 20px) 24px max(28px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    transform: translateX(100%);
    transition: transform .4s var(--ease);
    z-index: 160;
    overflow-y: auto;                   /* short landscape screens can scroll */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .nav__links.open { transform: none; }

  .nav__link {
    font-size: 1.45rem; font-family: var(--font-display); font-weight: 700;
    padding: 13px 26px; width: 100%; max-width: 320px; text-align: center;
  }
  .nav__link.active { color: var(--brand); }
  .nav__pill { display: none; }

  .nav__menu-extra {
    display: grid; gap: 18px; justify-items: center;
    margin-top: 26px; padding-top: 26px;
    border-top: 1px solid var(--border);
    width: 100%; max-width: 320px;
  }

  .section { padding: 84px 0; }
  .section__head { margin-bottom: 46px; }
}

/* --- Phones --- */
@media (max-width: 680px) {
  :root { --nav-h: 66px; }
  body { font-size: 15.5px; }
  .container { padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right)); }

  .section { padding: 68px 0; }
  .section__head { margin-bottom: 38px; }
  .section__sub { font-size: .96rem; }

  .hero { padding: calc(var(--nav-h) + 30px) 0 64px; min-height: auto; }
  .hero__inner { gap: 42px; }
  .hero__title { font-size: clamp(2.05rem, 9vw, 2.8rem); }
  /* Two lines of room so the typing effect can't shove the page around. */
  .hero__role { min-height: 3.1em; margin-bottom: 16px; }
  .hero__lede { font-size: 1rem; margin-bottom: 26px; }
  .hero__meta { gap: 9px 18px; }
  .hero__meta li { font-size: .84rem; }
  .scroll-hint { display: none; }
  .float-chip { display: none; }

  /* Full-width CTAs are far easier to hit than side-by-side pills. */
  .hero__cta { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero__cta .btn { width: 100%; padding: 15px 24px; }

  .code-card__bar { padding: 11px 14px; }
  .code-card__body { padding: 18px 16px 20px; font-size: .68rem; line-height: 1.75; }

  .marquee { padding: 14px 0; }
  .marquee__track { gap: 16px; }
  .marquee__track span { font-size: .92rem; }

  .about__text p { font-size: .98rem; }
  .about__stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 20px 12px; }
  .stat__num { font-size: 1.75rem; }
  .stat__label { font-size: .74rem; }

  .timeline { padding-left: 24px; }
  .timeline::before { left: 5px; }
  .tl-dot { left: -24px; width: 14px; top: 24px; }
  .tl-dot span { width: 10px; height: 10px; box-shadow: 0 0 0 3px var(--bg-alt); }
  .tl-card { padding: 22px 18px; }
  .tl-card__top { gap: 10px; margin-bottom: 13px; }
  .tl-card__role { font-size: 1.08rem; }
  .tl-list li { font-size: .91rem; }

  .pcard { padding: 26px 20px; border-radius: 20px; }
  .pcard__title { font-size: 1.14rem; }
  .pcard__desc { font-size: .92rem; }

  .skill-card { padding: 20px 18px; }
  .cert { padding: 18px 20px; gap: 14px; }

  .edu-card { grid-template-columns: 1fr auto; gap: 10px 14px; padding: 20px 18px; }
  .edu-card__years { grid-column: 1 / -1; }
  .edu-card__body h3 { font-size: .98rem; }
  .edu-card__score { text-align: left; align-self: end; }

  .ccard { padding: 15px 16px; gap: 13px; }
  .contact__form { padding: 24px 18px; border-radius: 20px; }

  /* iOS zooms the whole page when a focused input is under 16px. */
  .field input, .field textarea { font-size: 16px; padding: 14px 15px; }

  .footer { padding-top: 38px; }
  .footer__inner { flex-direction: column; align-items: flex-start; gap: 22px; padding-bottom: 28px; }
  .footer__bottom { flex-direction: column; text-align: left; gap: 6px; }

  .to-top { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 44px; height: 44px; }
  /* Keep the toast clear of the back-to-top button. */
  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); font-size: .85rem; padding: 11px 18px; }
}

/* --- Small phones (360px and under) --- */
@media (max-width: 400px) {
  .brand__text { display: none; }
  .container { padding-inline: 15px; }

  .hero__title { font-size: 1.95rem; }
  .hero__eyebrow { font-size: .78rem; padding: 6px 13px 6px 10px; }
  .code-card__body { font-size: .62rem; padding: 16px 13px 18px; }

  .about__stats { grid-template-columns: 1fr; }
  .stat { padding: 18px 16px; }
  .stat__num { font-size: 1.9rem; }

  .nav__link { font-size: 1.3rem; padding: 11px 20px; }
  .section__title { font-size: 1.75rem; }
}

/* --- Landscape phones: very little vertical room --- */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 940px) {
  .nav__links { justify-content: flex-start; gap: 0; }
  .nav__link { font-size: 1.05rem; padding: 8px 20px; }
  .nav__menu-extra { margin-top: 16px; padding-top: 16px; gap: 12px; }
  .hero { min-height: auto; padding-bottom: 48px; }
  .scroll-hint { display: none; }
}

/* ---------- Touch devices ------------------------------------------------ */
/* Hover styles latch on after a tap on touchscreens — an element stays lifted
   until you tap elsewhere. Restrict every transform-on-hover to real pointers
   and give touch users an :active press instead. */
@media (hover: none) {
  .tl-card:hover, .edu-card:hover, .ccard:hover, .stat:hover,
  .pcard:hover, .skill-card:hover, .social:hover, .tag:hover,
  .pills span:hover, .icon-btn:hover, .btn:hover, .to-top:hover {
    transform: none;
  }
  .pcard:hover .pcard__glow { opacity: 0; }
  .tag:hover, .pills span:hover { border-color: var(--border); color: var(--text-soft); }
  .social:hover { background: var(--surface); border-color: var(--border); color: var(--text-soft); }

  .btn:active { transform: scale(.97); }
  .pcard:active, .tl-card:active, .ccard:active, .edu-card:active, .stat:active,
  .skill-card:active { border-color: var(--border-strong); }
  .social:active { color: #fff; background: var(--grad); border-color: transparent; }
}

/* Guarantee comfortable touch targets regardless of pointer type. */
@media (pointer: coarse) {
  .social, .icon-btn { min-width: 44px; min-height: 44px; }
  .nav__link { min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .footer__links a { padding-block: 6px; }
  .pcard__link { padding-block: 8px; }
}

/* ---------- Print -------------------------------------------------------- */
@media print {
  .nav, .to-top, .bg-layer, .preloader, .scroll-progress, .marquee, .scroll-hint, .contact__form, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding: 24px 0; page-break-inside: avoid; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
