/* ============================================================
   Mohsin Mirza Portfolio — Design System
   Themes are driven by CSS custom properties set by js/themes.js:
   --hue, --hue2, --hue3 rotate every day (365 unique looks),
   and [data-mode] switches day / evening / night palettes.
   ============================================================ */

:root {
  --hue: 210; --hue2: 250; --hue3: 160; --day: 1;
  --anim-speed: 1;

  --bg: hsl(var(--hue) 55% 96%);
  --bg-soft: hsl(var(--hue) 50% 92%);
  --surface: hsl(var(--hue) 60% 99%);
  --ink: hsl(var(--hue2) 45% 16%);
  --muted: hsl(var(--hue) 18% 42%);
  --brand: hsl(var(--hue) 80% 45%);
  --brand2: hsl(var(--hue3) 70% 40%);
  --accent: hsl(calc(var(--hue) + 180) 85% 50%);
  --line: hsl(var(--hue) 30% 84%);
  --shadow: 0 12px 32px hsl(var(--hue2) 45% 25% / .16);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

[data-mode="evening"] {
  --bg: hsl(var(--hue) 22% 80%);
  --bg-soft: hsl(var(--hue) 20% 74%);
  --surface: hsl(var(--hue) 26% 88%);
  --ink: hsl(var(--hue2) 35% 18%);
  --muted: hsl(var(--hue) 15% 36%);
  --brand: hsl(var(--hue) 65% 42%);
  --shadow: 0 12px 32px hsl(var(--hue2) 35% 25% / .22);
}

[data-mode="night"] {
  --bg: hsl(var(--hue2) 45% 9%);
  --bg-soft: hsl(var(--hue2) 40% 13%);
  --surface: hsl(var(--hue2) 38% 15%);
  --ink: hsl(var(--hue) 45% 93%);
  --muted: hsl(var(--hue) 25% 68%);
  --brand: hsl(var(--hue) 85% 62%);
  --brand2: hsl(var(--hue3) 70% 55%);
  --accent: hsl(calc(var(--hue) + 180) 80% 62%);
  --line: hsl(var(--hue2) 30% 26%);
  --shadow: 0 12px 34px #000c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--bg); line-height: 1.6; overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 10px; top: 10px; background: var(--surface); padding: 8px 14px; z-index: 99; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); }
.logo img { width: 38px; height: 38px; border-radius: 10px; }
.site-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 7px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: .92rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--bg-soft); text-decoration: none; }
.site-nav a.cta { background: var(--brand); color: #fff; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: .95rem;
}
.icon-btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- ticker ---------- */
.ticker {
  overflow: hidden; background: var(--brand); color: #fff;
  font-size: .85rem; white-space: nowrap;
}
.ticker-track { display: inline-block; padding: 6px 0; animation: marquee 40s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker span { margin: 0 22px; }

/* ---------- hero scene (Leonardi-style playful illustration) ---------- */
.hero { position: relative; min-height: 78vh; display: flex; align-items: center; overflow: hidden; }
.scene { position: absolute; inset: 0; pointer-events: none; }
.scene .sun {
  position: absolute; top: 8%; right: 12%; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7cf, hsl(45 90% 60%));
  box-shadow: 0 0 60px hsl(45 90% 60% / .8); animation: breathe 6s ease-in-out infinite;
}
[data-mode="night"] .scene .sun {
  background: radial-gradient(circle at 35% 35%, #f1f5f9, #cbd5e1);
  box-shadow: 0 0 50px #e2e8f0aa;
}
.scene .hill { position: absolute; bottom: -40px; border-radius: 50% 50% 0 0; opacity: .55; }
.scene .hill.h1 { left: -10%; width: 65%; height: 220px; background: hsl(var(--hue3) 45% 55%); animation: drift 26s ease-in-out infinite alternate; }
.scene .hill.h2 { right: -15%; width: 70%; height: 170px; background: hsl(calc(var(--hue3) + 25) 45% 48%); animation: drift 32s ease-in-out infinite alternate-reverse; }
.scene .cloud { position: absolute; background: #ffffffcc; border-radius: 50px; filter: blur(1px); animation: drift 40s linear infinite; }
.scene .cloud.c1 { top: 16%; width: 140px; height: 34px; }
.scene .cloud.c2 { top: 28%; width: 90px; height: 24px; animation-duration: 55s; }
.hero-inner { position: relative; z-index: 2; }
.hero-inner h1 { font-size: clamp(1.9rem, 4.5vw, 3.4rem); }
.hero-inner .accent { color: var(--brand); }
.hero .avatar-float { width: 150px; border-radius: 28px; box-shadow: var(--shadow); animation: float 5s ease-in-out infinite; }
.hero-grid { display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 12px; font-weight: 700;
  background: var(--brand); color: #fff; border: none; cursor: pointer; font-size: 1rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }

/* ---------- cards & sections ---------- */
.section { padding: 64px 0; }
.section.alt { background: var(--bg-soft); }
.grid { display: grid; gap: 20px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); }
.hover-glow { transition: box-shadow .25s ease, transform .25s ease, filter .25s ease; }
.hover-glow:hover {
  box-shadow: 0 0 0 2px var(--brand), 0 0 26px 4px hsl(var(--hue) 90% 60% / .55);
  filter: saturate(1.35) brightness(1.05);
}
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: hsl(var(--hue) 80% 92%); color: var(--brand);
}
[data-mode="night"] .chip { background: hsl(var(--hue) 50% 22%); color: hsl(var(--hue) 90% 78%); }
.stats { display: flex; gap: 30px; flex-wrap: wrap; }
.stat b { font-size: 2.2rem; color: var(--brand); }

/* ---------- certifications gallery ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.filters input {
  flex: 1; min-width: 220px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.cert-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cert-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  cursor: pointer; transition: transform .2s ease, box-shadow .25s ease, filter .25s ease;
}
.cert-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--bg-soft); }
.cert-card .meta { padding: 12px 14px; }
.cert-card h4 { margin: 0 0 4px; font-size: .95rem; }
.cert-card p { margin: 0; font-size: .8rem; color: var(--muted); }
.cert-card:hover, .cert-card:focus-visible {
  transform: scale(1.04); outline: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 30px 6px hsl(var(--accent) 90% 60% / .6);
  filter: contrast(1.1) saturate(1.3); z-index: 2;
}
.lightbox {
  position: fixed; inset: 0; background: #000c; display: none; z-index: 90;
  align-items: center; justify-content: center; padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox .box {
  background: var(--surface); border-radius: 18px; max-width: 760px; width: 100%;
  max-height: 90vh; overflow: auto; padding: 24px;
}

/* ---------- footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 40px 0 24px; margin-top: 40px; }
.site-footer .powered {
  display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 16px;
  border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted);
}

/* ---------- chatbot ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 80; width: 60px; height: 60px;
  border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 1.5rem;
  cursor: pointer; box-shadow: var(--shadow);
}
.chat-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 80; width: min(360px, calc(100vw - 44px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-log { height: 300px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-log .msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: .88rem; }
.chat-log .bot { background: var(--bg-soft); align-self: flex-start; }
.chat-log .me { background: var(--brand); color: #fff; align-self: flex-end; }
.chat-bar { display: flex; border-top: 1px solid var(--line); }
.chat-bar input { flex: 1; border: none; padding: 12px; background: transparent; color: var(--ink); }
.chat-bar button { border: none; background: var(--brand); color: #fff; padding: 0 18px; cursor: pointer; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-soft); }
.chat-head img { width: 34px; height: 34px; border-radius: 50%; }

/* ---------- consent banner ---------- */
.consent {
  position: fixed; left: 16px; bottom: 16px; z-index: 85; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 16px; display: none; font-size: .88rem;
}
.consent.show { display: block; }

/* ============================================================
   ANIMATION LIBRARY — 365 daily looks come from the theme engine
   rotating hue/pattern per day; these 30+ motion utilities plus
   admin/design-studio overrides give the manual design control.
   Usage: class="anim anim-float"  speed: class="anim-slow" / "anim-fast"
   ============================================================ */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes float-x { 0%,100% { transform: translateX(0); } 50% { transform: translateX(16px); } }
@keyframes drift { from { transform: translateX(-12px); } to { transform: translateX(14px); } }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .95; } 50% { transform: scale(1.07); opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 hsl(var(--hue) 90% 60% / .5); }
  50% { box-shadow: 0 0 22px 6px hsl(var(--hue) 90% 60% / .55); }
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(26px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slide-down { from { transform: translateY(-26px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slide-left { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slide-right { from { transform: translateX(-30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes zoom-in { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes zoom-out { from { transform: scale(1.12); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes flip-in { from { transform: perspective(700px) rotateX(55deg); opacity: 0; } to { transform: perspective(700px) rotateX(0); opacity: 1; } }
@keyframes swing { 0%,100% { transform: rotate(3deg); } 50% { transform: rotate(-3deg); } }
@keyframes shake { 10%,90% { transform: translateX(-1px); } 30%,70% { transform: translateX(2px); } 50% { transform: translateX(-3px); } }
@keyframes ripple { 0% { box-shadow: 0 0 0 0 hsl(var(--hue) 90% 60% / .5); } 100% { box-shadow: 0 0 0 18px hsl(var(--hue) 90% 60% / 0); } }
@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
@keyframes gradient-move { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes orbit { from { transform: rotate(0) translateX(12px) rotate(0); } to { transform: rotate(360deg) translateX(12px) rotate(-360deg); } }
@keyframes typewriter { from { width: 0; } to { width: 100%; } }
@keyframes blink-caret { 50% { border-color: transparent; } }
@keyframes bounce-soft { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-12px); } 60% { transform: translateY(-4px); } }
@keyframes jelly { 0%,100% { transform: scale(1,1); } 30% { transform: scale(1.08,.92); } 50% { transform: scale(.94,1.06); } 70% { transform: scale(1.03,.97); } }
@keyframes tilt { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
@keyframes wave { 0%,100% { border-radius: 40% 60% 55% 45%; } 50% { border-radius: 60% 40% 45% 55%; } }
@keyframes color-cycle { 0%,100% { filter: hue-rotate(0deg); } 50% { filter: hue-rotate(28deg); } }
@keyframes rise { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes heart-beat { 0%,100% { transform: scale(1); } 25% { transform: scale(1.12); } 45% { transform: scale(.96); } }

.anim { animation-duration: calc(3s / var(--anim-speed)); animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-fill-mode: both; }
.anim-float { animation-name: float; } .anim-float-x { animation-name: float-x; }
.anim-drift { animation-name: drift; } .anim-breathe { animation-name: breathe; }
.anim-pulse { animation-name: pulse; } .anim-pulse-glow { animation-name: pulse-glow; }
.anim-spin-slow { animation-name: spin-slow; animation-duration: calc(14s / var(--anim-speed)); }
.anim-spin-rev { animation-name: spin-rev; animation-duration: calc(14s / var(--anim-speed)); }
.anim-bob { animation-name: bob; } .anim-wiggle { animation-name: wiggle; }
.anim-bounce { animation-name: bounce-soft; } .anim-jelly { animation-name: jelly; }
.anim-tilt { animation-name: tilt; } .anim-wave { animation-name: wave; }
.anim-color-cycle { animation-name: color-cycle; } .anim-orbit { animation-name: orbit; }
.anim-heartbeat { animation-name: heart-beat; } .anim-swing { animation-name: swing; }
.anim-shimmer { animation-name: shimmer; background: linear-gradient(90deg, transparent, hsl(var(--hue) 90% 70% / .35), transparent); background-size: 300px 100%; }
.anim-gradient { background: linear-gradient(120deg, var(--brand), var(--accent), var(--brand2)); background-size: 220% 220%; animation-name: gradient-move; }
.anim-ripple { animation-name: ripple; animation-duration: calc(1.8s / var(--anim-speed)); }
/* entrance (run once) */
.enter { animation-duration: .8s; animation-timing-function: cubic-bezier(.2,.8,.2,1); animation-fill-mode: both; animation-iteration-count: 1; }
.enter-pop { animation-name: pop; } .enter-fade { animation-name: fade-in; }
.enter-up { animation-name: slide-up; } .enter-down { animation-name: slide-down; }
.enter-left { animation-name: slide-left; } .enter-right { animation-name: slide-right; }
.enter-zoom { animation-name: zoom-in; } .enter-zoom-out { animation-name: zoom-out; }
.enter-flip { animation-name: flip-in; } .enter-rise { animation-name: rise; }
.anim-slow { --anim-speed: .55; } .anim-fast { --anim-speed: 1.8; }
/* hover-triggered */
.hover-pop:hover { animation: pop .4s ease; }
.hover-jelly:hover { animation: jelly .6s ease; }
.hover-shake:hover { animation: shake .5s ease; }
/* scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.shown { opacity: 1; transform: none; }

/* custom cursor */
body.custom-cursor, body.custom-cursor a, body.custom-cursor button { cursor: none; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 999;
  border-radius: 50%; transform: translate(-50%, -50%);
}
.cursor-dot { width: 8px; height: 8px; background: var(--accent); }
.cursor-ring {
  width: 34px; height: 34px; border: 2px solid var(--brand); opacity: .6;
  transition: width .15s ease, height .15s ease, opacity .15s ease;
}
.cursor-ring.hovering { width: 52px; height: 52px; opacity: .9; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-nav.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); padding: 12px; border-bottom: 1px solid var(--line); }
  .nav-toggle { display: inline-block !important; }
  .hero-grid { justify-content: center; text-align: center; }
}
.nav-toggle { display: none; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
