/* ==========================================================================
   X-EON Portfolio — Material 3 Expressive
   Tokens follow the M3 naming scheme (--md-sys-*). Colors are regenerated at
   runtime from a seed color (Dynamic Color) by main.js; the values below are
   static fallbacks for seed #1793D1.
   ========================================================================== */

:root {
  /* ---- Shape scale (M3 Expressive adds extra-large-increased & extra-extra-large) */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-large-increased: 20px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-extra-large-increased: 32px;
  --md-sys-shape-corner-extra-extra-large: 48px;
  --md-sys-shape-corner-full: 9999px;

  /* ---- Motion: expressive spring tokens (approximated with linear()) */
  --md-sys-motion-spring-fast-spatial: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.6%, 1.002 38.5%, 0.983 42.2%, 0.979 45.6%, 0.985 50.7%, 1.001 61.4%, 1.004 69.8%, 1);
  --md-sys-motion-spring-default-spatial: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1);
  --md-sys-motion-spring-effects: cubic-bezier(0.31, 0.94, 0.34, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-duration-short: 200ms;
  --md-sys-motion-duration-medium: 400ms;
  --md-sys-motion-duration-long: 650ms;

  --font: "Roboto Flex", "Google Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --content-width: 1240px;
}

/* ---- Static fallback color schemes ---- */
[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-primary: #8ecdff;
  --md-sys-color-on-primary: #00344f;
  --md-sys-color-primary-container: #004b70;
  --md-sys-color-on-primary-container: #cae6ff;
  --md-sys-color-secondary: #b7c9d9;
  --md-sys-color-on-secondary: #22323f;
  --md-sys-color-secondary-container: #374955;
  --md-sys-color-on-secondary-container: #d3e5f5;
  --md-sys-color-tertiary: #cdc0e9;
  --md-sys-color-on-tertiary: #342b4b;
  --md-sys-color-tertiary-container: #4b4263;
  --md-sys-color-on-tertiary-container: #e9ddff;
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-surface: #101417;
  --md-sys-color-on-surface: #dfe3e7;
  --md-sys-color-on-surface-variant: #c1c7ce;
  --md-sys-color-outline: #8b9198;
  --md-sys-color-outline-variant: #41484d;
  --md-sys-color-surface-container-lowest: #0b0f12;
  --md-sys-color-surface-container-low: #181c20;
  --md-sys-color-surface-container: #1c2024;
  --md-sys-color-surface-container-high: #262a2e;
  --md-sys-color-surface-container-highest: #313539;
  --md-sys-color-inverse-surface: #dfe3e7;
  --md-sys-color-inverse-on-surface: #2d3135;
}

[data-theme="light"] {
  color-scheme: light;
  --md-sys-color-primary: #00639a;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #cae6ff;
  --md-sys-color-on-primary-container: #001e31;
  --md-sys-color-secondary: #4f606e;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #d3e5f5;
  --md-sys-color-on-secondary-container: #0b1d29;
  --md-sys-color-tertiary: #64597c;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #e9ddff;
  --md-sys-color-on-tertiary-container: #1f1635;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-surface: #f7f9ff;
  --md-sys-color-on-surface: #181c20;
  --md-sys-color-on-surface-variant: #41474d;
  --md-sys-color-outline: #72787e;
  --md-sys-color-outline-variant: #c1c7ce;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f1f4f9;
  --md-sys-color-surface-container: #ebeef3;
  --md-sys-color-surface-container-high: #e5e8ed;
  --md-sys-color-surface-container-highest: #dfe3e7;
  --md-sys-color-inverse-surface: #2d3135;
  --md-sys-color-inverse-on-surface: #eef1f6;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized),
              color var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  font-size: 24px;
  line-height: 1;
  user-select: none;
  transition: font-variation-settings var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
}

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 12px 20px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
}
.skip-link:focus { top: 16px; }

:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 3px;
  border-radius: var(--md-sys-shape-corner-small);
}

/* ---- Type scale (M3 + emphasized variants via Roboto Flex axes) ---- */
.display-large  { font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.05; font-weight: 800; font-variation-settings: "wdth" 110, "opsz" 96; letter-spacing: -0.02em; margin: 0; }
.display-medium { font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1.08; font-weight: 800; font-variation-settings: "wdth" 115, "opsz" 72; letter-spacing: -0.015em; margin: 0; }
.headline-large { font-size: 2rem; line-height: 1.2; font-weight: 700; margin: 0; }
.headline-medium{ font-size: 1.75rem; line-height: 1.25; font-weight: 700; margin: 0 0 8px; }
.headline-small { font-size: 1.5rem; line-height: 1.3; font-weight: 700; margin: 0 0 8px; }
.title-large    { font-size: 1.375rem; line-height: 1.3; font-weight: 650; margin: 0 0 6px; }
.title-medium   { font-size: 1rem; font-weight: 650; }
.body-large     { font-size: 1.125rem; }
.body-medium    { font-size: 0.875rem; color: var(--md-sys-color-on-surface-variant); }
.label-large    { font-size: 0.875rem; font-weight: 600; letter-spacing: 0.01em; margin: 0 0 12px; }

/* ==========================================================================
   Top app bar
   ========================================================================== */
.top-app-bar {
  position: fixed; inset: 12px 12px auto 12px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  max-width: var(--content-width); margin: 0 auto;
  padding: 8px 8px 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 50%, transparent);
  transition: box-shadow var(--md-sys-motion-duration-medium), background-color var(--md-sys-motion-duration-medium);
}
.top-app-bar.scrolled { box-shadow: 0 8px 28px rgb(0 0 0 / 0.22); }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-text { font-weight: 900; font-size: 1.15rem; font-variation-settings: "wdth" 125; letter-spacing: 0.02em; }
.brand-shape {
  width: 30px; height: 30px; background: var(--md-sys-color-primary);
  /* 4-leaf clover via mask of radial gradients */
  -webkit-mask: radial-gradient(circle at 50% 28%, #000 27%, transparent 28%),
                radial-gradient(circle at 50% 72%, #000 27%, transparent 28%),
                radial-gradient(circle at 28% 50%, #000 27%, transparent 28%),
                radial-gradient(circle at 72% 50%, #000 27%, transparent 28%),
                radial-gradient(circle at 50% 50%, #000 30%, transparent 31%);
          mask: radial-gradient(circle at 50% 28%, #000 27%, transparent 28%),
                radial-gradient(circle at 50% 72%, #000 27%, transparent 28%),
                radial-gradient(circle at 28% 50%, #000 27%, transparent 28%),
                radial-gradient(circle at 72% 50%, #000 27%, transparent 28%),
                radial-gradient(circle at 50% 50%, #000 30%, transparent 31%);
  animation: spin 12s linear infinite;
}

.nav-rail { display: flex; gap: 4px; margin: 0 auto; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--md-sys-shape-corner-full);
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
  color: var(--md-sys-color-on-surface-variant);
  transition: background-color var(--md-sys-motion-duration-short), color var(--md-sys-motion-duration-short),
              padding var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.nav-item .material-symbols-rounded { font-size: 20px; }
.nav-item:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); color: var(--md-sys-color-on-surface); }
.nav-item.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding-inline: 22px;
}
.nav-item.active .material-symbols-rounded { font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24; }

.bar-actions { display: flex; gap: 4px; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; cursor: pointer; font: inherit;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent; color: var(--md-sys-color-on-surface-variant);
  transition: background-color var(--md-sys-motion-duration-short), border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.icon-btn:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.icon-btn:active { border-radius: var(--md-sys-shape-corner-medium); }
.icon-btn[aria-expanded="true"] { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); border-radius: var(--md-sys-shape-corner-large); }
.lang-label { font-weight: 800; font-size: 0.85rem; font-variation-settings: "wdth" 120; }

/* ---- Palette sheet ---- */
.palette-sheet {
  position: fixed; top: 80px; right: max(12px, calc((100vw - var(--content-width)) / 2 + 12px)); z-index: 60;
  width: min(320px, calc(100vw - 24px));
  padding: 20px; border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.3);
  transform-origin: top right;
  animation: sheet-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.palette-sheet[hidden] { display: none; }
@keyframes sheet-in { from { opacity: 0; transform: scale(0.85) translateY(-8px); } }

.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.swatch {
  aspect-ratio: 1; border: 0; cursor: pointer; border-radius: var(--md-sys-shape-corner-full);
  background: var(--c); position: relative;
  transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial), transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { border-radius: var(--md-sys-shape-corner-medium); box-shadow: 0 0 0 3px var(--md-sys-color-surface-container-high), 0 0 0 5px var(--md-sys-color-on-surface); }
.custom-color {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 14px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-highest); font-weight: 600;
}
.custom-color input { margin-left: auto; width: 36px; height: 28px; border: 0; padding: 0; background: none; cursor: pointer; }

/* ==========================================================================
   Layout
   ========================================================================== */
main { max-width: var(--content-width); margin: 0 auto; padding: 0 24px; }

.section { padding: 96px 0 24px; }
.section-tight { padding-top: 64px; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 32px; }
.section-index {
  font-weight: 900; font-size: 0.9rem; font-variation-settings: "wdth" 130;
  padding: 6px 14px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);
  transform: translateY(-6px);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 100svh; padding-top: 110px;
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 48px;
}

.assist-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: var(--md-sys-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem; font-weight: 600; color: var(--md-sys-color-on-surface-variant);
}
.assist-chip .dot {
  width: 10px; height: 10px; border-radius: 50%; background: #3ddc84;
  box-shadow: 0 0 0 0 rgb(61 220 132 / 0.6); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgb(61 220 132 / 0); } 100% { box-shadow: 0 0 0 0 rgb(61 220 132 / 0); } }

.display-hero {
  margin: 16px 0 8px;
  font-size: clamp(5rem, 15vw, 12rem); line-height: 0.88;
  letter-spacing: -0.03em; color: var(--md-sys-color-primary);
  display: flex; cursor: default;
}
.hero-letter {
  display: inline-block;
  font-variation-settings: "wght" var(--w, 900), "wdth" var(--wd, 120), "opsz" 144;
  transition: font-variation-settings 600ms var(--md-sys-motion-spring-default-spatial), transform 600ms var(--md-sys-motion-spring-fast-spatial), color 300ms;
}
.hero-letter:nth-child(2) { color: var(--md-sys-color-tertiary); }
.hero-letter:hover { transform: translateY(-10px) rotate(-4deg); color: var(--md-sys-color-tertiary); }

.headline { font-size: clamp(1.2rem, 2.2vw, 1.6rem); line-height: 1.4; max-width: 34ch; margin: 0 0 32px; color: var(--md-sys-color-on-surface-variant); }
.headline em { font-style: normal; font-weight: 750; color: var(--md-sys-color-on-surface); font-variation-settings: "wdth" 115; }

/* ---- Buttons (with expressive shape morph on press) ---- */
.button-group { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  --h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 24px; border: 0; cursor: pointer;
  border-radius: var(--md-sys-shape-corner-full);
  font: inherit; font-weight: 650; text-decoration: none; white-space: nowrap;
  transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial),
              transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial),
              background-color var(--md-sys-motion-duration-short), box-shadow var(--md-sys-motion-duration-short);
  position: relative; overflow: hidden; isolation: isolate;
}
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-sys-motion-duration-short); z-index: -1; }
.btn:hover::after { opacity: 0.08; }
.btn:active { border-radius: var(--md-sys-shape-corner-medium); transform: scale(0.97); }
.btn-lg { --h: 56px; padding: 0 28px; font-size: 1.05rem; }
.btn-xl { --h: 72px; padding: 0 36px; font-size: 1.2rem; }
.btn-xl .material-symbols-rounded { font-size: 28px; }
.btn-filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn-filled:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--md-sys-color-primary) 40%, transparent); }
.btn-tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn-outlined { background: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }
.btn-text { background: transparent; color: var(--md-sys-color-primary); padding: 0 14px; }
/* Connected button group: neighbours squish when one is pressed */
.button-group .btn:hover { border-radius: var(--md-sys-shape-corner-large-increased); }

/* ---- Stats ---- */
.stat-row { display: flex; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column; min-width: 120px;
  padding: 16px 20px; border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container);
}
.stat:nth-child(2) { border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-small); }
.stat-value { font-size: 2.2rem; font-weight: 900; line-height: 1; font-variation-settings: "wdth" 125; color: var(--md-sys-color-primary); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.85rem; color: var(--md-sys-color-on-surface-variant); margin-top: 6px; }

/* ---- Hero visual: morphing avatar ---- */
.hero-visual { position: relative; aspect-ratio: 1; width: min(100%, 520px); justify-self: center; display: grid; place-items: center; }
.avatar-morph {
  width: 78%; aspect-ratio: 1; padding: 0; border: 0; cursor: pointer; background: none;
  transition: transform var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial);
}
.avatar-morph:hover { transform: scale(1.04); }
.avatar-morph:active { transform: scale(0.96); }
.avatar-morph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar-bg { fill: var(--md-sys-color-primary-container); }

.orbit { position: absolute; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--md-sys-color-outline-variant) 80%, transparent); }
.orbit-1 { inset: 2%; animation: spin 40s linear infinite; }
.orbit-2 { inset: -6%; border-style: dotted; animation: spin 60s linear infinite reverse; }

.floating-shape { position: absolute; display: block; animation: float 7s ease-in-out infinite; }
.fs-1 { width: 74px; height: 74px; top: 6%; right: 8%; background: var(--md-sys-color-tertiary); border-radius: 50% 50% 50% 12%; animation-delay: -2s; }
.fs-2 { width: 54px; height: 54px; bottom: 12%; left: 2%; background: var(--md-sys-color-secondary); border-radius: 30%; transform: rotate(20deg); animation-delay: -4s; }
.fs-3 { width: 92px; height: 40px; bottom: 2%; right: 16%; background: var(--md-sys-color-primary); border-radius: var(--md-sys-shape-corner-full); }
@keyframes float { 0%, 100% { translate: 0 0; rotate: 0deg; } 50% { translate: 0 -18px; rotate: 12deg; } }
@keyframes spin { to { rotate: 360deg; } }

/* ==========================================================================
   Cards / bento
   ========================================================================== */
.card {
  padding: 28px; border-radius: var(--md-sys-shape-corner-extra-large);
  transition: border-radius var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-default-spatial),
              transform var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial);
}
.card p { margin: 0; }
.card:hover { border-radius: var(--md-sys-shape-corner-extra-extra-large) var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-extra-extra-large) var(--md-sys-shape-corner-large); }
.card-icon { font-size: 36px; margin-bottom: 16px; display: inline-block; }
.card-primary   { background: var(--md-sys-color-primary-container);   color: var(--md-sys-color-on-primary-container); }
.card-secondary { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.card-tertiary  { background: var(--md-sys-color-tertiary-container);  color: var(--md-sys-color-on-tertiary-container); }
.card-surface   { background: var(--md-sys-color-surface-container);   color: var(--md-sys-color-on-surface); }
.card-surface p { color: var(--md-sys-color-on-surface-variant); }

.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bento > * { grid-column: span 1; }
.bento-wide { grid-column: span 2 !important; }
.bento .card-primary { font-size: 1.1rem; }

/* ==========================================================================
   Projects
   ========================================================================== */
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 0; height: 40px; padding: 0 18px;
  border: 1px solid var(--md-sys-color-outline-variant); cursor: pointer; font: inherit; font-weight: 600; font-size: 0.9rem;
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent; color: var(--md-sys-color-on-surface-variant);
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.filter-chip .check { width: 0; overflow: hidden; font-size: 18px; transition: width var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial), margin var(--md-sys-motion-duration-medium); }
.filter-chip:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.filter-chip.selected {
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
  border-color: transparent; border-radius: var(--md-sys-shape-corner-full); padding-left: 12px;
}
.filter-chip.selected .check { width: 18px; margin-right: 8px; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.project-card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 24px; min-height: 280px; text-decoration: none;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow: hidden; isolation: isolate;
  transition: border-radius var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-default-spatial),
              transform var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial),
              background-color var(--md-sys-motion-duration-medium), border-color var(--md-sys-motion-duration-medium),
              opacity var(--md-sys-motion-duration-medium);
}
.project-card.featured { background: var(--md-sys-color-surface-container-high); border-color: transparent; }
.project-card:hover {
  transform: translateY(-4px);
  border-radius: var(--md-sys-shape-corner-extra-extra-large) var(--md-sys-shape-corner-medium);
  border-color: var(--md-sys-color-primary);
}
.project-card.hidden { display: none; }
.project-card.entering { animation: card-in var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial) both; }
@keyframes card-in { from { opacity: 0; transform: scale(0.9) translateY(16px); } }

/* Big decorative shape blob in the corner */
.project-card::before {
  content: ""; position: absolute; z-index: -1; width: 220px; height: 220px; right: -70px; top: -70px;
  background: var(--accent, var(--md-sys-color-primary-container)); opacity: 0.55;
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  transition: transform 900ms var(--md-sys-motion-spring-default-spatial), border-radius 900ms var(--md-sys-motion-spring-default-spatial);
}
.project-card:hover::before { transform: scale(1.35) rotate(40deg); border-radius: 50%; }

.project-top { display: flex; align-items: center; gap: 14px; }
.project-icon {
  width: 56px; height: 56px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-large);
  transition: border-radius var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial), rotate var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial);
}
.project-icon .material-symbols-rounded { font-size: 30px; font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 40; }
.project-card:hover .project-icon { border-radius: 50%; rotate: -8deg; }
.project-card:nth-child(3n+2) .project-icon { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); }
.project-card:nth-child(3n+3) .project-icon { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }

.project-name { font-size: 1.35rem; font-weight: 800; font-variation-settings: "wdth" 112; line-height: 1.15; margin: 0; word-break: break-word; }
.project-badge {
  display: inline-block; margin-top: 4px; font-size: 0.75rem; font-weight: 700;
  padding: 2px 10px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);
}
.project-desc { margin: 0; color: var(--md-sys-color-on-surface-variant); flex-grow: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant);
}
.project-meta { display: flex; align-items: center; gap: 16px; font-size: 0.85rem; color: var(--md-sys-color-on-surface-variant); }
.project-meta span { display: inline-flex; align-items: center; gap: 4px; }
.project-meta .material-symbols-rounded { font-size: 18px; }
.project-meta .go { margin-left: auto; color: var(--md-sys-color-primary); transition: translate var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial); }
.project-card:hover .go { translate: 6px 0; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lc, var(--md-sys-color-outline)); }

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-layout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skill-group h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.skill-group h3 .material-symbols-rounded { color: var(--md-sys-color-primary); }
.shape-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.shape-chip {
  padding: 10px 18px; font-weight: 650; font-size: 0.95rem; cursor: default;
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-full);
  transition: border-radius var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial),
              background-color var(--md-sys-motion-duration-short), color var(--md-sys-motion-duration-short),
              transform var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial);
}
.shape-chip:hover { transform: scale(1.06) rotate(-2deg); }
.shape-chip.s-cookie:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); border-radius: 40% 60% 45% 55% / 55% 45% 60% 40%; }
.shape-chip.s-pill:hover   { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); border-radius: var(--md-sys-shape-corner-medium); }
.shape-chip.s-clover:hover { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); border-radius: 8px 28px 8px 28px; }

/* ==========================================================================
   Music
   ========================================================================== */
.music-card {
  display: grid; grid-template-columns: 1fr 1.3fr; align-items: center; gap: 40px;
  padding: 40px; border-radius: var(--md-sys-shape-corner-extra-extra-large);
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);
}
.music-card p { margin: 0; font-size: 1.1rem; }
.eq { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 180px; }
.eq span {
  width: 18px; height: 100%; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-tertiary); transform-origin: bottom;
  animation: eq 1.2s var(--md-sys-motion-spring-effects) infinite alternate;
}
.eq span:nth-child(3n)   { background: var(--md-sys-color-primary); }
.eq span:nth-child(4n+1) { background: var(--md-sys-color-on-tertiary-container); }
.eq span:nth-child(1)  { animation-delay: -0.1s; } .eq span:nth-child(2)  { animation-delay: -0.5s; }
.eq span:nth-child(3)  { animation-delay: -0.9s; } .eq span:nth-child(4)  { animation-delay: -0.3s; }
.eq span:nth-child(5)  { animation-delay: -0.7s; } .eq span:nth-child(6)  { animation-delay: -1.1s; }
.eq span:nth-child(7)  { animation-delay: -0.2s; } .eq span:nth-child(8)  { animation-delay: -0.8s; }
.eq span:nth-child(9)  { animation-delay: -0.4s; } .eq span:nth-child(10) { animation-delay: -1.0s; }
.eq span:nth-child(11) { animation-delay: -0.6s; } .eq span:nth-child(12) { animation-delay: -0.15s; }
@keyframes eq { 0% { transform: scaleY(0.15); } 50% { transform: scaleY(0.75); } 100% { transform: scaleY(0.35); } }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-card {
  position: relative; overflow: hidden; isolation: isolate; text-align: center;
  padding: clamp(40px, 8vw, 96px) 24px; border-radius: var(--md-sys-shape-corner-extra-extra-large);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
}
.contact-card p { max-width: 50ch; margin: 16px auto 32px; opacity: 0.9; }
.contact-card .button-group { justify-content: center; }
.contact-card .btn-filled { background: var(--md-sys-color-on-primary); color: var(--md-sys-color-primary); }
.contact-shape {
  position: absolute; z-index: -1; width: 520px; height: 520px; left: 50%; top: 50%; translate: -50% -50%;
  background: color-mix(in srgb, var(--md-sys-color-on-primary) 10%, transparent);
  border-radius: 45% 55% 52% 48% / 48% 45% 55% 52%;
  animation: spin 30s linear infinite, blob 9s ease-in-out infinite alternate;
}
@keyframes blob { 50% { border-radius: 60% 40% 35% 65% / 40% 60% 40% 60%; } 100% { border-radius: 38% 62% 58% 42% / 62% 38% 62% 38%; } }

/* ==========================================================================
   Lists
   ========================================================================== */
.list { display: flex; flex-direction: column; gap: 4px; }
.list-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; text-decoration: none;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-small);
  transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial), background-color var(--md-sys-motion-duration-short);
}
.list-item:first-child { border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small); }
.list-item:last-child  { border-radius: var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large); }
.list-item:hover { background: var(--md-sys-color-surface-container-high); border-radius: var(--md-sys-shape-corner-extra-large); }
.list-text { display: flex; flex-direction: column; flex: 1; }
.list-item .leading { color: var(--md-sys-color-primary); }
.list-item .trailing { color: var(--md-sys-color-on-surface-variant); transition: translate var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial); }
.list-item:hover .trailing { translate: 6px 0; }

/* ==========================================================================
   Footer & FAB
   ========================================================================== */
.footer { text-align: center; padding: 64px 24px 48px; color: var(--md-sys-color-on-surface-variant); font-size: 0.9rem; }

.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 64px; height: 64px; display: grid; place-items: center; text-decoration: none;
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);
  border-radius: var(--md-sys-shape-corner-large-increased);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
  transform: scale(0) rotate(-90deg); opacity: 0;
  transition: transform var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial), opacity var(--md-sys-motion-duration-short),
              border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring-fast-spatial);
}
.fab.visible { transform: none; opacity: 1; }
.fab:hover { border-radius: 50%; }
.fab .material-symbols-rounded { font-size: 28px; }

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(32px) scale(0.98); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--md-sys-motion-easing-emphasized), transform 900ms var(--md-sys-motion-spring-default-spatial);
  transition-delay: var(--d, 0ms);
}
.no-js .reveal { opacity: 1; transform: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .nav-item span:not(.material-symbols-rounded) { display: none; }
  .nav-item.active { padding-inline: 18px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 120px; text-align: left; gap: 24px; }
  .hero-visual { width: min(80%, 380px); order: -1; }
  .bento { grid-template-columns: 1fr 1fr; }
  .skills-layout { grid-template-columns: 1fr; }
  .music-card { grid-template-columns: 1fr; padding: 28px; }
  .eq { height: 120px; }
}
@media (max-width: 640px) {
  main { padding: 0 16px; }
  .top-app-bar {
    inset: 8px 8px auto 8px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    justify-content: space-between;
    pointer-events: none;
  }
  .top-app-bar .brand,
  .top-app-bar .bar-actions {
    pointer-events: auto;
    padding: 6px 12px;
    border-radius: var(--md-sys-shape-corner-full);
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 85%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 50%, transparent);
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
  }
  /* Nav moves to a bottom navigation bar on phones */
  .nav-rail {
    position: fixed; inset: auto 12px 12px 12px;
    pointer-events: auto;
    margin: 0;
    justify-content: space-around;
    padding: 6px 10px;
    border-radius: var(--md-sys-shape-corner-full);
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 92%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 50%, transparent);
    box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);
    z-index: 50;
  }
  .nav-item { padding: 8px 12px; }
  .nav-item span:not(.material-symbols-rounded) { display: none; }
  .hero { padding-top: 80px; }
  .fab { bottom: 84px; right: 16px; width: 52px; height: 52px; }
  .bento { grid-template-columns: 1fr; }
  .bento-wide { grid-column: span 1 !important; }
  .projects-grid { grid-template-columns: 1fr; }
  .section { padding-top: 72px; }
  .stat { min-width: 0; flex: 1; padding: 14px; }
  .stat-value { font-size: 1.7rem; }
  .footer { padding-bottom: 100px; }
}

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

/* ==========================================================================
   Terminal Modal / Drawer (M3 Expressive)
   ========================================================================== */
.terminal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgb(0 0 0 / 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: scrim-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}
.terminal-scrim[hidden] { display: none; }
@keyframes scrim-in { from { opacity: 0; } }

.terminal-box {
  width: min(840px, 100%);
  max-height: 85vh;
  display: flex; flex-direction: column;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.45);
  overflow: hidden;
  font-family: "Fira Code", monospace, "Roboto Flex", monospace;
  animation: box-in var(--md-sys-motion-duration-long) var(--md-sys-motion-spring-fast-spatial);
}
@keyframes box-in { from { transform: scale(0.92) translateY(24px); opacity: 0; } }

.terminal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--md-sys-color-surface-container-high);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.term-dot { width: 12px; height: 12px; border-radius: 50%; }
.term-dot.red { background: #ff5f56; }
.term-dot.yellow { background: #ffbd2e; }
.term-dot.green { background: #27c93f; }
.term-title {
  margin-left: 8px; font-size: 0.85rem; font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0.04em;
}
.term-close {
  margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer;
  display: grid; place-items: center; padding: 4px; border-radius: var(--md-sys-shape-corner-full);
}
.term-close:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent); }

.terminal-body {
  flex: 1; overflow-y: auto; padding: 16px;
  font-size: 0.9rem; line-height: 1.5; color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-lowest);
}
.term-output { margin-bottom: 12px; white-space: pre-wrap; word-break: break-word; }
.term-output .prompt { color: var(--md-sys-color-primary); font-weight: 700; }
.term-output .accent { color: var(--md-sys-color-tertiary); font-weight: 700; }
.term-output .highlight { color: #3ddc84; font-weight: 700; }
.term-input-row { display: flex; align-items: center; gap: 8px; }
.term-input-row .prompt { color: var(--md-sys-color-primary); font-weight: 700; flex-shrink: 0; }
.term-input {
  flex: 1; background: transparent; border: 0; outline: none; font: inherit;
  color: var(--md-sys-color-on-surface);
}

/* ==========================================================================
   Interactive Music Synthesizer & Equalizer
   ========================================================================== */
.music-actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.synth-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary);
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  transition: transform var(--md-sys-motion-duration-short), background-color var(--md-sys-motion-duration-short);
}
.synth-btn:hover { transform: scale(1.04); }
.synth-btn:active { transform: scale(0.96); }
.synth-btn.playing {
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
}
.eq.live span {
  animation: none !important;
  transition: height 80ms ease;
}
