/* ==========================================================================
   Jaydeep Gadhiya — portfolio
   Plain CSS. Dark theme by default, light theme via [data-theme="light"].
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg:            #0b0910;
  --bg-soft:       #120f1a;
  --surface:       rgba(255, 255, 255, 0.038);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text:          #ece9f3;
  --text-dim:      #a9a2bd;
  --text-faint:    #6f6885;

  --accent:        #a06bff;
  --accent-2:      #e0489b;
  --accent-3:      #ff6b57;
  --accent-soft:   rgba(160, 107, 255, 0.14);
  --grad:          linear-gradient(115deg, #a06bff 0%, #e0489b 55%, #ff6b57 100%);

  --nav-bg:        rgba(11, 9, 16, 0.72);
  --shadow:        0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --code-bg:       #0f0c17;

  --radius:        18px;
  --radius-sm:     11px;
  --maxw:          1160px;
  --font:          "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono:          "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="light"] {
  --bg:            #f7f5fb;
  --bg-soft:       #ffffff;
  --surface:       rgba(255, 255, 255, 0.85);
  --surface-hover: #ffffff;
  --border:        rgba(24, 16, 44, 0.10);
  --border-strong: rgba(24, 16, 44, 0.20);

  --text:          #1b1526;
  --text-dim:      #574d6b;
  --text-faint:    #8a819d;

  --accent:        #7c3aed;
  --accent-2:      #d0247f;
  --accent-3:      #f2543c;
  --accent-soft:   rgba(124, 58, 237, 0.10);
  --grad:          linear-gradient(115deg, #7c3aed 0%, #d0247f 55%, #f2543c 100%);

  --nav-bg:        rgba(247, 245, 251, 0.78);
  --shadow:        0 18px 45px -22px rgba(40, 20, 80, 0.28);
  --code-bg:       #17122a;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* The nav is sticky and 68px tall, so anchor targets need to clear it or the
   first line of every section lands underneath. */
:target { scroll-margin-top: 88px; }
section[id], .hero { scroll-margin-top: 88px; }

body {
  margin: 0;
  -webkit-tap-highlight-color: rgba(160, 107, 255, .18);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.022em; font-weight: 700; }
p  { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }

svg {
  width: 1em; height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg.fill { fill: currentColor; stroke: none; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem; z-index: 200; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 2.2rem); }

/* ---------- background decor ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .30;
}
.blob-1 {
  width: 46rem; height: 46rem;
  top: -18rem; right: -14rem;
  background: radial-gradient(circle at 30% 30%, #a06bff, transparent 68%);
}
.blob-2 {
  width: 40rem; height: 40rem;
  bottom: -16rem; left: -12rem;
  background: radial-gradient(circle at 60% 40%, #e0489b, transparent 66%);
}
[data-theme="light"] .blob { opacity: .22; }

.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  opacity: .55;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.stuck { border-bottom-color: var(--border); }

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center;
  width: 33px; height: 33px; border-radius: 10px;
  background: var(--grad); color: #fff;
  font-size: .8rem; font-weight: 800; letter-spacing: .02em;
}
.brand-text { font-size: .96rem; letter-spacing: -.01em; }

.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-links a {
  position: relative;
  padding: .45rem .75rem;
  font-size: .9rem; font-weight: 500;
  color: var(--text-dim);
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ""; position: absolute; left: .75rem; right: .75rem; bottom: .18rem;
  height: 2px; border-radius: 2px; background: var(--grad);
}

.nav-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
  display: grid; place-items: center;
  width: 37px; height: 37px;
  font-size: 1.05rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }

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

.burger {
  display: none;
  width: 37px; height: 37px;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.burger span {
  display: block; width: 16px; height: 1.8px; border-radius: 2px;
  background: var(--text);
  transition: transform .28s ease, opacity .2s ease;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }

.scroll-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0;
  background: var(--grad);
  transition: width .1s linear;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .74rem 1.3rem;
  font-family: inherit; font-size: .92rem; font-weight: 600;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn svg { font-size: 1.05rem; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  color: #fff;
  background: var(--grad);
  background-size: 160% 100%;
  box-shadow: 0 10px 26px -12px rgba(160, 107, 255, .75);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 16px 32px -12px rgba(160, 107, 255, .85); }

.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-sm { padding: .55rem 1rem; font-size: .86rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(3.5rem, 9vh, 6.5rem) 0 clamp(3rem, 7vh, 5rem); }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  margin: 0 0 1.4rem;
  padding: .4rem .9rem .4rem .7rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .01em;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.eyebrow svg { font-size: 1rem; color: var(--accent); }

.hero-title {
  font-size: clamp(2.1rem, 5.4vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -.035em;
  margin-bottom: 1.25rem;
}
.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.hero-sub {
  max-width: 44ch;
  font-size: clamp(1rem, 1.15vw, 1.09rem);
  color: var(--text-dim);
  margin-bottom: 2rem;
}
.hero-sub strong { color: var(--text); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 2.6rem; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 1rem clamp(1.1rem, 2.4vw, 1.9rem); }
.hero-stats li { display: flex; align-items: baseline; gap: .5rem; }
.hero-stats b {
  font-size: 1.62rem; font-weight: 800; letter-spacing: -.03em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stats span { font-size: .78rem; line-height: 1.3; color: var(--text-faint); }

/* code card */
.hero-card {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
[data-theme="light"] .hero-card { border-color: rgba(24, 16, 44, .18); }

.code-head {
  display: flex; align-items: center; gap: .45rem;
  padding: .8rem 1rem;
  background: rgba(255, 255, 255, .035);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.tl { width: 10px; height: 10px; border-radius: 50%; }
.tl-r { background: #ff5f57; } .tl-y { background: #febc2e; } .tl-g { background: #28c840; }
.code-file {
  margin-left: auto;
  font-family: var(--mono); font-size: .74rem;
  color: rgba(236, 233, 243, .45);
}

.code-body {
  margin: 0;
  padding: 1.2rem 1.35rem 1.5rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .795rem;
  line-height: 1.72;
  color: #d6d2e4;
  tab-size: 4;
}
.c-k { color: #ff7ab6; }
.c-t { color: #6ee7d6; }
.c-f { color: #9bb8ff; }
.c-s { color: #ffca7a; }
.c-v { color: #d6d2e4; }

/* ---------- sections ---------- */
.section { padding: clamp(3.5rem, 8vh, 6rem) 0; }

.sec-head { max-width: 60ch; margin-bottom: clamp(2rem, 4vw, 3rem); }
.sec-num {
  display: inline-block;
  font-family: var(--mono); font-size: .78rem; font-weight: 500;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .55rem;
}
.sec-head h2 {
  font-size: clamp(1.65rem, 3.6vw, 2.35rem);
  font-weight: 800; letter-spacing: -.03em;
  margin-bottom: .6rem;
}
.sec-lead { color: var(--text-dim); margin: 0; font-size: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform .25s ease, border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: var(--shadow);
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1.6rem, 4vw, 3.2rem);
  align-items: start;
}
.about-copy p { color: var(--text-dim); font-size: 1.005rem; }
.about-copy p:last-child { margin-bottom: 0; }
.about-copy a {
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color .2s;
}
.about-copy a:hover { color: var(--accent); }

.about-facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem 1.35rem;
}
.about-facts li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  justify-content: space-between;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.about-facts li:last-child { border-bottom: 0; }
.about-facts span { font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); }
.about-facts b { font-size: .92rem; font-weight: 600; text-align: right; }

/* ---------- skills ---------- */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 1.1rem;
}
.skill-ico {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 12px;
}
.skill-card h3 { font-size: 1.05rem; margin-bottom: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chips li {
  padding: .34rem .72rem;
  font-size: .8rem; font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}
[data-theme="light"] .chips li { background: rgba(24, 16, 44, .035); }
.chips.small li { font-size: .74rem; padding: .26rem .6rem; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 2.1rem; }

/* The rail fills as the section scrolls past — see initTimelineRail() in main.js */
.tl-rail {
  position: absolute; left: 6px; top: .6rem; bottom: .6rem;
  width: 2px; border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.tl-rail i {
  display: block; width: 100%; height: 0;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
  transition: height .12s linear;
}
.tl-item { position: relative; padding-bottom: 1.1rem; }
.tl-item:last-child { padding-bottom: 0; }

.tl-dot {
  position: absolute; left: -2.1rem; top: 1.65rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.tl-item:first-child .tl-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.tl-card { position: relative; }
.tl-badge {
  position: absolute; top: 1.35rem; right: 1.4rem;
  padding: .22rem .6rem;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: #3ddc84;
  background: rgba(61, 220, 132, .11);
  border: 1px solid rgba(61, 220, 132, .28);
  border-radius: 999px;
}
.tl-date {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .04em;
  color: var(--accent);
  margin-bottom: .45rem;
}
.tl-card h3 { font-size: 1.13rem; margin-bottom: .25rem; }
.tl-org { font-size: .87rem; font-weight: 600; color: var(--text-dim); margin-bottom: .7rem; }
.tl-desc { font-size: .93rem; color: var(--text-dim); margin: 0; max-width: 70ch; }

/* ---------- projects ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 1.1rem;
}
.proj-card { display: flex; flex-direction: column; }
.proj-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.proj-ico {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  font-size: 1.2rem;
  color: #fff;
  background: var(--grad);
  border-radius: 12px;
}
.proj-tag {
  padding: .24rem .62rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .04em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.proj-card h3 { font-size: 1.12rem; margin-bottom: .3rem; }
.proj-kind { font-size: .84rem; font-weight: 600; color: var(--accent); margin-bottom: .7rem; }
.proj-desc { font-size: .92rem; color: var(--text-dim); margin-bottom: 1.1rem; }
.proj-card .chips { margin-top: auto; }
.proj-more { justify-content: space-between; }
.proj-more .btn { align-self: flex-start; margin-top: auto; }

/* ---------- education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 1.1rem;
}
.edu-card { display: flex; flex-direction: column; }
.edu-year {
  align-self: flex-start;
  margin-bottom: .9rem;
  padding: .26rem .7rem;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .05em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}
.edu-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.edu-org { font-size: .9rem; color: var(--text-dim); margin-bottom: .2rem; }
.edu-sub { font-size: .8rem; color: var(--text-faint); margin-bottom: .9rem; }
.edu-score { margin: auto 0 0; font-size: .82rem; color: var(--text-faint); }
.edu-score b {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- contact ---------- */
.section-contact { padding-bottom: clamp(4rem, 9vh, 7rem); }
.contact-wrap {
  position: relative;
  max-width: 640px; margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 3.4rem) clamp(1.4rem, 4vw, 3rem);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  overflow: hidden;
}
.contact-wrap::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--grad);
}
.contact-wrap h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800; letter-spacing: -.03em;
  margin-bottom: .8rem;
}
.contact-lead { color: var(--text-dim); margin-bottom: 1.9rem; }

.mail-btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .85rem 1.5rem;
  font-size: clamp(.88rem, 2.4vw, 1.02rem); font-weight: 600;
  word-break: break-all;
  color: #fff;
  background: var(--grad);
  background-size: 160% 100%;
  border-radius: 13px;
  box-shadow: 0 12px 30px -14px rgba(160, 107, 255, .8);
  transition: background-position .3s ease, transform .2s ease, box-shadow .2s ease;
}
.mail-btn svg { flex: none; font-size: 1.15rem; }
.mail-btn:hover { background-position: 100% 0; transform: translateY(-2px); }

.contact-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.6rem;
  margin-top: 1.9rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.contact-links a, .contact-links .loc {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .88rem; font-weight: 500;
  color: var(--text-dim);
  transition: color .2s;
}
.contact-links a:hover { color: var(--text); }
.contact-links svg { font-size: 1.05rem; }

/* ---------- footer ---------- */
/* ---------- footer ---------- */
.footer {
  position: relative;
  overflow: hidden;
  padding-top: clamp(2.6rem, 5vw, 3.6rem);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}
.footer-glow {
  position: absolute; top: -55%; left: 50%;
  width: min(70rem, 130%); height: 34rem;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(160, 107, 255, .17), transparent 62%);
  pointer-events: none;
}
[data-theme="light"] .footer-glow { background: radial-gradient(ellipse at center, rgba(124, 58, 237, .11), transparent 62%); }
.footer .container { position: relative; }

.footer-main {
  display: grid;
  /* The last column carries the full email address, so it gets extra width
     rather than breaking it mid-word. */
  grid-template-columns:
    minmax(0, 1.55fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: clamp(1.7rem, 3.2vw, 2.6rem);
  padding-bottom: clamp(1.8rem, 4vw, 2.6rem);
}

.footer-brand .brand { margin-bottom: 1rem; }
.footer-brand .brand-text { display: inline; }
.footer-tag {
  max-width: 40ch;
  margin-bottom: 1.3rem;
  font-size: .9rem;
  color: var(--text-dim);
}

.footer-social { display: flex; flex-wrap: wrap; gap: .5rem; }
.footer-social a {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  font-size: 1.02rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: color .22s, background .22s, border-color .22s, transform .22s;
}
.footer-social a:hover {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  transform: translateY(-3px);
}

.footer-col h3 {
  margin-bottom: 1.05rem;
  font-size: .74rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-faint);
}
.footer-col li { margin-bottom: .1rem; }
.footer-col a,
.footer-contact span {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .34rem 0;
  font-size: .875rem;
  color: var(--text-dim);
  transition: color .2s, transform .2s;
}
.footer-col a:hover { color: var(--text); transform: translateX(3px); }
.footer-col svg { flex: none; font-size: 1rem; color: var(--text-faint); }
.footer-col a:hover svg { color: var(--accent); }
.footer-pkgs code { font-family: var(--mono); font-size: .785rem; }
.footer-contact a { overflow-wrap: break-word; }

.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem 1.6rem;
  padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}
.footer-copy { margin: 0; font-size: .84rem; font-weight: 600; color: var(--text-dim); }
.footer-built { margin: 0; font-size: .78rem; color: var(--text-faint); }

.to-top {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-left: auto;
  padding: .5rem .9rem;
  font-size: .82rem; font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color .2s, border-color .2s, transform .2s;
}
.to-top:hover { color: var(--text); border-color: var(--border-strong); }
.to-top svg { transition: transform .25s ease; }
.to-top:hover svg { transform: translateY(-3px); }

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .65s cubic-bezier(.22, .8, .3, 1), transform .65s cubic-bezier(.22, .8, .3, 1);
}
.reveal.in { opacity: 1; transform: none; }

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

/* ---------- responsive ---------- */
/* Eight nav items plus the brand and action buttons need ~950px before they
   collide, so the menu collapses at the same width the hero stacks. */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { order: -1; }
  .about-grid { grid-template-columns: 1fr; }

  .burger { display: flex; }

  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    gap: .1rem;
    padding: .7rem clamp(1.1rem, 4vw, 2.2rem) 1.1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: .7rem .8rem; font-size: .95rem; }
  .nav-links a.active::after { left: .8rem; right: auto; width: 18px; bottom: .45rem; }
}

@media (max-width: 760px) {
  .brand-text { display: none; }
  .hero-stats { gap: 1.3rem; }
  .hero-stats b { font-size: 1.55rem; }
  .card { padding: 1.25rem; }
  .tl-badge { position: static; display: inline-block; margin-bottom: .5rem; }
  .code-body { font-size: .72rem; }
}

@media (max-width: 420px) {
  .hero-cta .btn { width: 100%; justify-content: center; }
}

/* ---------- print ---------- */
@media print {
  .nav, .bg-decor, .footer .to-top, .hero-card { display: none; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1; transform: none; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
}

/* ==========================================================================
   Open-source packages
   ========================================================================== */

/* extra terminal tokens used by the hero code card */
.c-c { color: #6f6885; }
.c-p { color: #6ee7d6; }
.c-g { color: #3ddc84; }

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.1rem;
}

.pkg-card { display: flex; flex-direction: column; }

.pkg-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; }

.pkg-badge {
  padding: .24rem .66rem;
  font-family: var(--mono); font-size: .68rem; font-weight: 500; letter-spacing: .04em;
  border-radius: 999px;
}
.pkg-badge-php  { color: #b39dff; background: rgba(160, 107, 255, .14); }
.pkg-badge-node { color: #7ede9b; background: rgba(61, 220, 132, .13); }
[data-theme="light"] .pkg-badge-php  { color: #6b32d6; }
[data-theme="light"] .pkg-badge-node { color: #1e8a4c; background: rgba(30, 138, 76, .11); }

.pkg-flag {
  margin-left: auto;
  font-size: .7rem; font-weight: 600; letter-spacing: .03em;
  color: var(--text-faint);
}

.pkg-card h3 { font-size: 1.06rem; margin-bottom: .55rem; word-break: break-word; }
.pkg-card h3 a {
  font-family: var(--mono); font-size: .97rem; font-weight: 500;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity .2s;
}
.pkg-card h3 a:hover { opacity: .75; }

.pkg-desc { font-size: .91rem; color: var(--text-dim); margin-bottom: 1rem; }
.pkg-desc code {
  font-family: var(--mono); font-size: .84em;
  padding: .05rem .3rem;
  color: var(--text);
  background: var(--bg-soft);
  border-radius: 5px;
}
[data-theme="light"] .pkg-desc code { background: rgba(24, 16, 44, .06); }

.pkg-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1rem;
  margin-bottom: 1rem;
}
.pkg-meta li {
  display: inline-flex; align-items: center; gap: .32rem;
  font-family: var(--mono); font-size: .76rem;
  color: var(--text-dim);
}
.pkg-meta svg { font-size: .95rem; color: var(--accent); }
.pkg-lang {
  padding: .18rem .5rem;
  font-size: .7rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pkg-install {
  display: flex; align-items: stretch; gap: .4rem;
  margin: auto 0 .9rem;
  padding: .1rem .1rem .1rem .7rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
[data-theme="light"] .pkg-install { border-color: rgba(24, 16, 44, .18); }
.pkg-install code {
  flex: 1 1 auto;
  min-width: 0;
  padding: .55rem .3rem .55rem 0;
  font-family: var(--mono); font-size: .715rem; line-height: 1.5;
  /* wraps rather than scrolling — the package name is the point, so it must be readable */
  white-space: normal;
  overflow-wrap: anywhere;
  color: #d6d2e4;
}

.copy-btn {
  flex: none;
  align-self: flex-start;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  margin: .18rem 0;
  font-size: .95rem;
  color: rgba(236, 233, 243, .5);
  background: rgba(255, 255, 255, .05);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.copy-btn.copied { color: #3ddc84; }

.pkg-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.pkg-links a {
  padding: .4rem .8rem;
  font-size: .8rem; font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: color .2s, border-color .2s;
}
.pkg-links a:hover { color: var(--text); border-color: var(--border-strong); }

/* the flagship package gets a gradient hairline on top */
.pkg-feature { position: relative; overflow: hidden; }
.pkg-feature::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: var(--grad);
}

/* projects: cards now carry a link button, so push it to the bottom */
.proj-card .btn { align-self: flex-start; margin-top: .9rem; }

@media (max-width: 760px) {
  .pkg-grid { grid-template-columns: 1fr; }
  .pkg-install code { font-size: .7rem; }
}

/* ==========================================================================
   Selected client work
   ========================================================================== */

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1.1rem;
}

.work-card { display: flex; flex-direction: column; }

/* the lead project spans both columns so its detail has room to breathe */
.work-lead { grid-column: 1 / -1; }
.work-lead .work-desc { max-width: 68ch; }
.work-lead .work-points { columns: 2; column-gap: 2.2rem; }

.work-top {
  display: flex; align-items: baseline; gap: .7rem;
  margin-bottom: .8rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--border);
}
.work-idx {
  font-family: var(--mono); font-size: 1.05rem; font-weight: 500;
  letter-spacing: -.02em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.work-era {
  margin-left: auto;
  font-size: .74rem; font-weight: 500; letter-spacing: .01em;
  text-align: right;
  color: var(--text-faint);
}

.work-card h3 { font-size: 1.11rem; margin-bottom: .3rem; }
.work-lead h3 { font-size: 1.32rem; }

.work-role {
  margin-bottom: .8rem;
  font-size: .82rem; font-weight: 600; letter-spacing: .01em;
  color: var(--accent);
}
.work-desc { font-size: .92rem; color: var(--text-dim); margin-bottom: .9rem; }

.work-points { margin: 0 0 1rem; }
.work-points li {
  position: relative;
  padding-left: 1.05rem;
  margin-bottom: .38rem;
  font-size: .875rem;
  color: var(--text-dim);
  break-inside: avoid;
}
.work-points li:last-child { margin-bottom: 0; }
.work-points li::before {
  content: "";
  position: absolute; left: 0; top: .62em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: .75;
}

.work-card .chips { margin-top: auto; }

@media (max-width: 760px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-lead .work-points { columns: 1; }
  .work-lead h3 { font-size: 1.15rem; }
  .work-top { flex-wrap: wrap; }
  .work-era { margin-left: 0; text-align: left; flex-basis: 100%; }
}

/* ==========================================================================
   Tech ticker
   ========================================================================== */

.ticker {
  position: relative;
  padding: 1.05rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ticker-viewport {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 42s linear infinite;
}
.ticker:hover .ticker-track,
.ticker:focus-within .ticker-track { animation-play-state: paused; }

/* Two identical groups sit side by side, so -50% lands exactly on the seam. */
@keyframes ticker-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.ticker-group { display: flex; align-items: center; gap: 2.1rem; padding-right: 2.1rem; }
.ticker-group li {
  display: flex; align-items: center; gap: 2.1rem;
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--text-faint);
}
.ticker-group li::after {
  content: "";
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
  opacity: .5;
}

/* ==========================================================================
   Interaction polish
   ========================================================================== */

/* Cursor-following spotlight on every card. --mx/--my are set in main.js;
   the gradient is invisible until hover so touch devices never see it. */
.card { position: relative; overflow: hidden; }
.card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
              rgba(160, 107, 255, .14), transparent 62%);
}
[data-theme="light"] .card::after {
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
              rgba(124, 58, 237, .09), transparent 62%);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover::after { opacity: 1; }
}

/* Light sweep across the primary button on hover. */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary::after {
  content: "";
  position: absolute; top: 0; left: -130%;
  width: 55%; height: 100%;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent);
}
@media (hover: hover) {
  .btn-primary:hover::after { animation: btn-shine .8s ease; }
}
@keyframes btn-shine { to { left: 150%; } }

/* Counting numbers must not jitter as digits change width. */
.stat-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Nav underline grows from the centre instead of just appearing. */
.nav-links a.active::after { transform-origin: center; animation: nav-in .32s cubic-bezier(.22,.8,.3,1); }
@keyframes nav-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Section headings get a gradient tick above the number. */
.sec-head { position: relative; }
.sec-num::before {
  content: "";
  display: block;
  width: 30px; height: 3px;
  margin-bottom: .7rem;
  border-radius: 3px;
  background: var(--grad);
}

/* ==========================================================================
   Mobile refinements
   ========================================================================== */

@media (max-width: 900px) {
  .footer-main { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .ticker-group { gap: 1.5rem; padding-right: 1.5rem; }
  .ticker-group li { gap: 1.5rem; font-size: .74rem; }

  /* Comfortable thumb targets in the collapsed menu and the footer. */
  .nav-links a { padding: .85rem .8rem; }
  .footer-col a, .footer-contact span { padding: .5rem 0; }
  .footer-social a { width: 44px; height: 44px; }

  .sec-num::before { width: 24px; }
}

@media (max-width: 560px) {
  .footer-main { grid-template-columns: 1fr; gap: 1.9rem; }
  .footer-tag { max-width: none; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .to-top { margin-left: 0; }
}

@media (max-width: 420px) {
  .hero-stats { gap: 1rem 1.4rem; }
  .hero-stats li { flex: 1 1 40%; }
  .pkg-links a, .footer-social a { flex: none; }
  .contact-links { gap: .5rem 1.1rem; }
}

/* ==========================================================================
   Motion preferences — belt and braces over the earlier blanket rule
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none !important; transform: none !important; }
  .btn-primary:hover::after { animation: none !important; }
  .nav-links a.active::after { animation: none !important; }
  .card::after { transition: none !important; }
  .tl-rail i { transition: none !important; }
}
