/* ============================================================
   Juwel - Premium Portfolio
   Plain CSS only. No frameworks, no external assets.
   ============================================================ */

/* ---------------- Design tokens ---------------- */
:root {
  /* Premium color palette */
  --bg: #0a0d1f;
  --bg-mesh: radial-gradient(at 27% 37%, hsla(251, 86%, 65%, 0.18) 0, transparent 50%),
             radial-gradient(at 97% 21%, hsla(189, 84%, 62%, 0.14) 0, transparent 50%),
             radial-gradient(at 52% 99%, hsla(280, 65%, 70%, 0.12) 0, transparent 50%),
             radial-gradient(at 10% 29%, hsla(242, 82%, 68%, 0.16) 0, transparent 50%),
             radial-gradient(at 97% 96%, hsla(189, 84%, 62%, 0.10) 0, transparent 50%),
             radial-gradient(at 33% 50%, hsla(251, 86%, 65%, 0.08) 0, transparent 50%),
             radial-gradient(at 79% 53%, hsla(280, 65%, 70%, 0.09) 0, transparent 50%);

  /* Glassmorphism surfaces */
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --surface-hover: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);

  /* Typography scale */
  --text: #f0f4ff;
  --text-muted: #a5b4d4;
  --text-dim: #7a8aae;

  /* Premium accent colors */
  --accent-cyan: #22d3ee;
  --accent-purple: #a78bfa;
  --accent-indigo: #6366f1;
  --gradient: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
  --gradient-warm: linear-gradient(135deg, #c084fc 0%, var(--accent-purple) 100%);
  --gradient-soft: linear-gradient(135deg, rgba(167, 139, 250, 0.24), rgba(34, 211, 238, 0.16));

  /* Refined radius system */
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;

  /* Enhanced shadow system */
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.20);
  --glow-cyan: 0 8px 32px rgba(34, 211, 238, 0.28);
  --glow-purple: 0 8px 32px rgba(167, 139, 250, 0.28);

  /* Premium animation curves */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);

  --header-h: 74px;
  --maxw: 1180px;
}

/* ---------------- Reset & base ---------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-mesh);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
  font-optical-sizing: auto;
}

body.nav-open { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }

/* Reserve icon box sizes up-front so late SVG paint can't shift layout. */
.skill-icon,
.mini-avatar,
.social-link svg,
.back-to-top svg { aspect-ratio: 1 / 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
ul { list-style: none; }

::selection {
  background: rgba(34, 211, 238, 0.35);
  color: #fff;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
}

/* ---------------- Background decoration ----------------
   Perf: static layer, isolated to its own paint + compositing layer so the
   animated blobs never force the page content to repaint.
   Note: blobs are visual overflow by design; the fixed layer clips them
   (overflow:clip) and body overflow-x stays hidden, so document scrollWidth
   always equals the viewport (no page-level horizontal scroll). */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
  contain: strict;
  content-visibility: auto;
}

.blob {
  position: absolute;
  border-radius: 50%;
  /* 40px blur for better performance. */
  filter: blur(40px);
  opacity: 0.4;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.blob-1 {
  width: 44vw; height: 44vw;
  min-width: 320px; min-height: 320px; max-width: 640px; max-height: 640px;
  top: -12vw; left: -10vw;
  background: radial-gradient(circle at 35% 35%, rgba(99, 102, 241, 0.85), transparent 70%);
  animation: drift 22s ease-in-out infinite;
}

.blob-2 {
  width: 38vw; height: 38vw;
  min-width: 280px; min-height: 280px; max-width: 600px; max-height: 600px;
  top: 22vh; right: -16vw;
  background: radial-gradient(circle at 60% 40%, rgba(34, 211, 238, 0.7), transparent 70%);
  animation: drift 26s ease-in-out infinite reverse;
}

.blob-3 {
  width: 40vw; height: 40vw;
  min-width: 300px; min-height: 300px;
  bottom: -16vw; left: 26vw;
  background: radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.6), transparent 70%);
  animation: drift 30s ease-in-out infinite;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  opacity: 0.5;
}

/* ---------------- Layout helpers ---------------- */
.container {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

.section {
  position: relative;
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: relative;
}

.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.lift {
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
              border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.lift:hover,
.lift:focus-within {
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-lg), var(--glow-purple);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.lift:hover::before,
.lift:focus-within::before {
  opacity: 1;
}

.gradient-text {
  background-image: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 120;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: #101734;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.9rem;
  transition: transform 0.3s var(--ease);
}

.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), border-color 0.25s var(--ease);
  backface-visibility: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 4px;
  outline-style: solid;
}

.btn-primary {
  background-image: var(--gradient);
  color: #0a0d1f;
  font-weight: 600;
  box-shadow: var(--glow-cyan);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--glow-cyan), 0 12px 40px rgba(34, 211, 238, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(-2px) scale(1.01);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.btn-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--accent-cyan), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.btn-ghost:hover {
  transform: translateY(-4px) scale(1.02);
  background: rgba(34, 211, 238, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.btn-ghost:hover::before {
  opacity: 0.15;
}

.btn-small {
  padding: 0.6rem 1.2rem;
  font-size: 0.86rem;
}

.btn-quiet {
  margin-top: 1.1rem;
  padding: 0.5rem 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-quiet:hover {
  color: var(--accent-cyan);
  transform: translateX(6px);
}

.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------------- Section headings ---------------- */
.section-head { margin-bottom: clamp(2rem, 4vw, 3rem); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan));
  box-shadow: 0 0 8px var(--accent-cyan);
}

.section-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  margin: 0.85rem 0;
}

.section-sub {
  max-width: 62ch;
  color: var(--text-muted);
}

/* ---------------- Entrance animation ---------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  contain: layout style;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  contain: layout style;
}

/* ---------------- Toast notification ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 110;
  max-width: min(92vw, 420px);
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  background: rgba(13, 19, 40, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), var(--glow-purple);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-spring);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------------- Sticky header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

.site-header.is-scrolled {
  background: rgba(10, 13, 31, 0.9);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background-image: var(--gradient);
  color: #0a0d1f;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: var(--glow-purple);
  transition: transform 0.5s var(--ease-spring), box-shadow 0.4s var(--ease);
}

.logo:hover .logo-mark {
  transform: rotate(-8deg) scale(1.08);
  box-shadow: var(--glow-purple), 0 16px 48px rgba(167, 139, 250, 0.45);
}

.logo-text { font-size: 1.1rem; letter-spacing: -0.01em; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.32rem;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background-image: var(--gradient);
  transform: translateX(-50%);
  transition: width 0.4s var(--ease-spring);
  box-shadow: 0 0 12px var(--accent-cyan);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover::after,
.nav-link.is-active::after { width: 42%; }

.nav-link.is-active { color: var(--text); }

.nav-link:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.menu-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.menu-toggle .bar {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
  transition: transform 0.35s var(--ease), opacity 0.25s var(--ease),
    top 0.35s var(--ease);
}

.menu-toggle .bar:nth-child(1) { top: 15px; }
.menu-toggle .bar:nth-child(2) { top: 21px; }
.menu-toggle .bar:nth-child(3) { top: 27px; }

.menu-toggle.is-open .bar:nth-child(1) { top: 21px; transform: translateX(-50%) rotate(45deg); }
.menu-toggle.is-open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.is-open .bar:nth-child(3) { top: 21px; transform: translateX(-50%) rotate(-45deg); }

.menu-toggle:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3.5rem, 7vw, 6rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero-copy { max-width: 640px; }

.hero-title {
  font-size: clamp(2.3rem, 5.4vw, 4rem);
  letter-spacing: -0.035em;
  margin: 1rem 0 0.55rem;
}

.hero-role {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.hero-sub {
  max-width: 56ch;
  color: var(--text-muted);
  font-size: clamp(1rem, 1.5vw, 1.06rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.9rem;
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(300px, 38vw, 380px);
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
  backface-visibility: hidden;
}

.ring-a {
  width: min(86%, 360px);
  aspect-ratio: 1;
  border-top-color: rgba(34, 211, 238, 0.75);
  border-right-color: rgba(34, 211, 238, 0.2);
  animation: spin 24s linear infinite;
}

.ring-b {
  width: min(66%, 272px);
  aspect-ratio: 1;
  border-bottom-color: rgba(192, 132, 252, 0.7);
  border-left-color: rgba(99, 102, 241, 0.4);
  animation: spin 17s linear infinite reverse;
}

.code-card {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
  padding: 1.35rem 1.5rem 1.55rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(19, 25, 48, 0.96), rgba(9, 13, 28, 0.92));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), var(--glow-purple);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: floatCard 9s ease-in-out infinite;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
  backface-visibility: hidden;
}

.code-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--glow-cyan), 0 20px 60px rgba(34, 211, 238, 0.25);
}

.code-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.code-title {
  margin-left: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.code-body {
  margin-top: 0.95rem;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(0.76rem, 1.4vw, 0.85rem);
  line-height: 1.8;
  color: #cbd7f5;
  white-space: pre;
}

.tk-key { color: #c084fc; }
.tk-var { color: #22d3ee; }
.tk-prop { color: #93b4ff; }
.tk-str { color: #7ee7b0; }

.float-chip {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  background: rgba(15, 20, 40, 0.92);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 4px 24px rgba(167, 139, 250, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 0.8rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  backface-visibility: hidden;
}

.float-chip:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--glow-cyan);
}

.chip-avatar {
  top: 1%;
  left: 0;
  animation: floatChip 7s ease-in-out infinite;
}

.chip-stack {
  right: 0;
  bottom: 3%;
  color: var(--text-muted);
  animation: floatChip 8.5s ease-in-out infinite 0.6s;
}

.mini-avatar { width: 34px; height: 34px; border-radius: 50%; }

.chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.chip-text strong { font-size: 0.85rem; }
.chip-text small { color: var(--text-dim); font-size: 0.72rem; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse 2.4s ease-out infinite;
}

/* ---------------- Below-fold rendering ----------------
   content-visibility skips layout/paint of off-screen sections until near
   viewport; intrinsic sizes reserve space so no layout shift occurs. */
#about, #skills, #projects, #contact {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
  contain: layout style;
}

/* Islands of static decoration: keep them on their own layer. */
.code-card, .chip-avatar, .chip-stack, .stat-card, .skill-card, .project-card {
  contain: layout style;
}

/* ---------------- About ---------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  max-width: 60ch;
}

.about-text p + p { margin-top: 1rem; }

.about-text .btn { margin-top: 1.6rem; }

.stat-grid {
  display: grid;
  gap: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.3rem 1.45rem;
}

.stat-value {
  flex: 0 0 auto;
  min-width: 3.6rem;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background-image: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.4s var(--ease-spring);
}

.stat-card:hover .stat-value {
  transform: scale(1.1);
}

.stat-label {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ---------------- Skills ---------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem;
}

.skill-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.skill-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  transition: transform 0.5s var(--ease-spring), color 0.4s var(--ease),
              box-shadow 0.4s var(--ease), background 0.4s var(--ease);
}

.skill-icon svg {
  width: 22px;
  height: 22px;
  transition: transform 0.4s var(--ease-spring);
}

.lift:hover .skill-icon {
  transform: translateY(-4px) scale(1.1);
  color: #a5f3fc;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.32), rgba(34, 211, 238, 0.24));
  box-shadow: var(--glow-cyan);
}

.lift:hover .skill-icon svg {
  transform: scale(1.1) rotate(5deg);
}

.skill-text { display: flex; flex-direction: column; }

.skill-name {
  font-weight: 600;
  font-size: 1rem;
}

.skill-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.skill-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.skill-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background-image: var(--gradient);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1s var(--ease) 0.1s;
}

.reveal.is-visible .skill-bar span { transform: scaleX(var(--fill, 0.7)); }

/* ---------------- Projects ---------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-visual {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.project-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.09), transparent 70%);
  pointer-events: none;
}

.pv-1 { background: linear-gradient(140deg, rgba(99, 102, 241, 0.16), rgba(34, 211, 238, 0.07)); }
.pv-2 { background: linear-gradient(140deg, rgba(192, 132, 252, 0.16), rgba(99, 102, 241, 0.07)); }
.pv-3 { background: linear-gradient(140deg, rgba(34, 211, 238, 0.14), rgba(192, 132, 252, 0.09)); }

.project-svg {
  width: 100%;
  height: auto;
  max-height: 170px;
  transition: transform 0.6s var(--ease);
}

.project-card:hover .project-svg,
.project-card:focus-within .project-svg {
  transform: scale(1.08) translateY(-6px);
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.3);
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem;
}

.project-title { font-size: 1.15rem; }

.project-desc {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.3s var(--ease);
}

.tag:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}

.project-btn {
  align-self: flex-start;
  margin-top: auto;
}

/* ---------------- Contact ---------------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 4vw, 2.25rem);
  align-items: start;
}

.contact-panel {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.75rem;
}

.contact-panel h3 { font-size: 1.2rem; }

.contact-panel > p { color: var(--text-muted); font-size: 0.94rem; }

.contact-list { display: grid; gap: 1rem; }

.contact-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.92rem;
}

.contact-row .row-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.contact-row:hover .row-icon {
  transform: scale(1.1);
  box-shadow: var(--glow-cyan);
}

.contact-row .row-icon svg { width: 18px; height: 18px; }

.contact-row span small {
  display: block;
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.availability {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
  color: #86efac;
  font-size: 0.85rem;
}

/* ---------------- Contact form ---------------- */
.contact-form {
  display: grid;
  gap: 1.1rem;
  padding: 1.75rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 132px;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15), var(--glow-cyan);
  transform: translateY(-2px);
}

.field.has-error input,
.field.has-error textarea {
  border-color: rgba(248, 113, 113, 0.65);
  background: rgba(248, 113, 113, 0.07);
}

.form-status {
  display: none;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
}

.form-status.is-visible { display: block; }

.form-status.is-success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #86efac;
}

.form-status.is-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(8, 11, 24, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 2.25rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.social-list {
  display: flex;
  gap: 0.6rem;
}

.social-link {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  transition: transform 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease), background-color 0.35s var(--ease);
}

.social-link svg { width: 19px; height: 19px; }

.social-link:hover {
  transform: translateY(-4px) scale(1.05);
  color: #fff;
  border-color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.15);
  box-shadow: var(--glow-cyan);
}

.social-link:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

/* ---------------- Back to top ---------------- */
.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 100;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(15, 20, 40, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
    border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.18);
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-lg), var(--glow-cyan);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.back-to-top svg { width: 20px; height: 20px; }

/* ---------------- Keyframes ---------------- */
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4%, 5%, 0) scale(1.08); }
}

@keyframes floatCard {
  0%, 100% { transform: translateY(-6px) translateZ(0); }
  50% { transform: translateY(6px) translateZ(0); }
}

@keyframes floatChip {
  0%, 100% { transform: translateY(-7px) translateZ(0); }
  50% { transform: translateY(7px) translateZ(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------------- Responsive: tablet & small laptop ---------------- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(2.25rem, 5vw, 3rem);
  }

  .hero-visual { min-height: 360px; }

  .hero-sub { max-width: 66ch; }

  .about-grid { grid-template-columns: minmax(0, 1fr); }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------- Responsive: mobile navigation ---------------- */
@media (max-width: 860px) {
  .menu-toggle { display: block; }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    padding: 1.1rem clamp(1.25rem, 5vw, 2rem) 1.6rem;
    background: rgba(8, 11, 22, 0.97);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 26px 55px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-14px);
    transition: opacity 0.25s var(--ease), transform 0.3s var(--ease),
      visibility 0.25s var(--ease);
  }

  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
  }

  .nav-link {
    padding: 0.8rem 1rem;
    font-size: 0.98rem;
    border-radius: 14px;
  }

  .nav-link::after { display: none; }

  .nav-link.is-active {
    background: rgba(99, 102, 241, 0.16);
    color: var(--text);
  }
}

/* ---------------- Perf: mobile / low-end ----------------
   Freeze always-on decorative loops on small screens: blobs, rings,
   floating chips and the avatar bob become static. Identical layout,
   zero per-frame compositing cost. */
@media (max-width: 768px) {
  .blob,
  .ring-a,
  .ring-b,
  .chip-avatar,
  .chip-stack,
  .code-card,
  .mini-avatar {
    animation: none !important;
  }
  .bg-decor { content-visibility: auto; }

  /* Reduce blur on mobile for better performance */
  .blob { filter: blur(30px); }

  .glass,
  .site-header.is-scrolled,
  .toast,
  .back-to-top {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* Remove will-change on mobile to save memory */
  .lift { will-change: auto; }
}

/* ---------------- Responsive: phones ---------------- */
@media (max-width: 600px) {
  :root { --header-h: 66px; }

  .container { width: min(100% - 2rem, var(--maxw)); }

  .section { padding: clamp(3rem, 10vw, 4.25rem) 0; }

  .hero { padding-top: 1.75rem; }

  .hero-actions .btn { flex: 1 1 100%; }

  .hero-visual { min-height: 330px; }

  .code-card { width: 100%; }

  .chip-avatar { top: -2%; left: 0; }
  .chip-stack { right: 0; bottom: -2%; }

  .stat-card { padding: 1.1rem 1.15rem; }

  .skill-card { padding: 1.25rem; }

  .contact-panel,
  .contact-form { padding: 1.25rem; }

  .contact-form .btn { width: 100%; }

  .project-btn { width: 100%; }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .toast { bottom: 1rem; }
}

/* ---------------- Reduced motion ----------------
   Perf: fully freeze every looping decoration (not just shorten it) so
   reduced-motion users get zero per-frame animation cost. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .blob,
  .ring-a,
  .ring-b,
  .chip-avatar,
  .chip-stack,
  .code-card,
  .mini-avatar,
  .pulse-dot {
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .skill-bar span { transform: scaleX(var(--fill, 0.7)); }
}

