:root{
  --bg-1: #070b14;
  --bg-2: #0b1220;
  --card: rgba(255,255,255,.06);
  --card-2: rgba(255,255,255,.03);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --muted2: rgba(255,255,255,.55);
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);
  --accent: #7c5cff;
  --accent2:#22d3ee;
  --accent3:#10b981;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --radius: 18px;
  --radius2: 14px;
  --max: 1100px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";

  --spot-x: 50%;
  --spot-y: 0%;
  --spot-color: rgba(124,92,255,.18);
}

[data-theme="light"]{
  --bg-1: #f4f6fb;
  --bg-2: #eaeef7;
  --card: rgba(255,255,255,.78);
  --card-2: rgba(255,255,255,.55);
  --text: #0f172a;
  --muted: #475569;
  --muted2: #64748b;
  --line: rgba(15,23,42,.10);
  --line-strong: rgba(15,23,42,.20);
  --accent: #6d4cff;
  --accent2:#0891b2;
  --shadow: 0 18px 50px rgba(15,23,42,.10);
  --spot-color: rgba(109,76,255,.12);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2) 40%, var(--bg-1));
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}

a{color:inherit}
code{font-family: var(--mono)}

/* ==== Aurora ==== */
.aurora{
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  filter: blur(60px) saturate(1.1);
  opacity: .85;
}
.aurora-blob{
  position: absolute;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  will-change: transform;
  mix-blend-mode: screen;
}
[data-theme="light"] .aurora-blob{ mix-blend-mode: multiply; opacity: .35; }
[data-theme="light"] .aurora{ filter: blur(70px) saturate(1.05); opacity: 1; }

.a1{ top:-10%; left:-10%; background: radial-gradient(circle, var(--accent) 0%, transparent 60%); animation: float1 22s ease-in-out infinite; }
.a2{ top: 20%; right:-15%; background: radial-gradient(circle, var(--accent2) 0%, transparent 60%); animation: float2 26s ease-in-out infinite; }
.a3{ bottom:-20%; left: 20%; background: radial-gradient(circle, var(--accent3) 0%, transparent 60%); animation: float3 30s ease-in-out infinite; opacity:.65; }

@keyframes float1{ 0%,100%{transform:translate3d(0,0,0) scale(1)} 50%{transform:translate3d(8vw,6vh,0) scale(1.1)} }
@keyframes float2{ 0%,100%{transform:translate3d(0,0,0) scale(1)} 50%{transform:translate3d(-10vw,4vh,0) scale(1.15)} }
@keyframes float3{ 0%,100%{transform:translate3d(0,0,0) scale(1)} 50%{transform:translate3d(6vw,-8vh,0) scale(1.05)} }

/* ==== Scroll progress ==== */
.scroll-progress{
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 100;
  will-change: transform;
}

/* ==== Theme toggle ==== */
.theme-toggle{
  position: fixed;
  top: 16px; right: 16px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .25s ease, border-color .25s ease, background-color .25s ease;
}
.theme-toggle:hover{ transform: rotate(15deg) scale(1.05); border-color: var(--line-strong); }
.theme-toggle svg{ position: absolute; transition: opacity .3s ease, transform .4s ease; }
[data-theme="dark"] .icon-sun{ opacity: 1; transform: rotate(0); }
[data-theme="dark"] .icon-moon{ opacity: 0; transform: rotate(-90deg); }
[data-theme="light"] .icon-sun{ opacity: 0; transform: rotate(90deg); }
[data-theme="light"] .icon-moon{ opacity: 1; transform: rotate(0); }

/* ==== Layout ==== */
.wrap{max-width: var(--max); margin: 0 auto; padding: 38px 18px 56px;}

.top{
  display:grid;
  grid-template-columns: 1.3fr .9fr;
  gap: 18px;
  align-items: stretch;
}

/* ==== Cards ==== */
.card{
  position: relative;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* spotlight (cursor light) */
.spotlight::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(380px circle at var(--spot-x) var(--spot-y), var(--spot-color), transparent 60%);
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 0;
}
.spotlight:hover::before{ opacity: 1; }
.spotlight > *{ position: relative; z-index: 1; }

.card .inner{padding: 20px 20px 18px}
.card h2{
  margin:0 0 12px;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==== Hero ==== */
.hero{
  position: relative;
  padding: 30px 24px 22px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(800px 160px at 30% 0%, rgba(124,92,255,.22), transparent 60%),
    radial-gradient(680px 180px at 90% 20%, rgba(34,211,238,.18), transparent 55%);
}
[data-theme="light"] .hero{
  background:
    radial-gradient(800px 160px at 30% 0%, rgba(109,76,255,.10), transparent 60%),
    radial-gradient(680px 180px at 90% 20%, rgba(8,145,178,.10), transparent 55%);
}

.name{
  margin:0;
  font-size: clamp(28px, 4.5vw, 40px);
  letter-spacing: -.02em;
  line-height: 1.1;
  font-weight: 700;
}
.name-gradient{
  background: linear-gradient(110deg, var(--accent) 0%, var(--accent2) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 8s linear infinite;
}
@keyframes shine{ 0%{background-position:0% 0%} 100%{background-position:200% 0%} }

.subtitle{margin: 12px 0 0; color: var(--muted); font-size: 15px; max-width: 70ch;}

/* ==== Badges ==== */
.badges{display:flex; flex-wrap:wrap; gap: 10px; margin-top: 16px;}
.badge{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease, color .25s ease;
}
.badge:hover{
  transform: translateY(-2px);
  background: var(--card);
  border-color: var(--line-strong);
  color: var(--text);
}
.dot{
  width:8px; height:8px;
  border-radius:999px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 4px rgba(124,92,255,.10);
  flex: 0 0 auto;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{ box-shadow: 0 0 0 4px rgba(124,92,255,.10); }
  50%{ box-shadow: 0 0 0 7px rgba(124,92,255,.04); }
}

/* ==== Items / chips ==== */
.item{
  display:flex; gap: 10px;
  padding: 12px 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: var(--card-2);
  margin-bottom: 8px;
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease;
}
.item:last-child{ margin-bottom: 0 }
.item:hover{
  transform: translateY(-1px);
  background: var(--card);
  border-color: var(--line-strong);
}
.item .k{min-width: 155px; color: var(--muted2); font-size: 13px;}
.item .v{color: var(--text); font-size: 14px; flex:1;}
.chips{display:flex; flex-wrap:wrap; gap: 8px;}
.chip{
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  cursor: default;
  transition: transform .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.chip:hover{
  transform: translateY(-2px);
  background: var(--card);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(124,92,255,.18);
}
.hint-sm{ margin-top: 8px; color: var(--muted2); font-size: 12px; }

/* ==== Sections ==== */
.section{
  margin-top: 18px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.section.visible{ opacity: 1; transform: translateY(0); }

.section .head{
  display:flex; justify-content:space-between; align-items:baseline;
  padding: 18px 22px 0;
  gap: 12px;
}
.section .head h3{
  margin:0;
  font-size: 17px;
  letter-spacing: -.01em;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.section .head h3::before{
  content: "";
  width: 4px; height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
}
.section .head .hint{color: var(--muted2); font-size: 13px; text-align:right;}
.section .body{padding: 14px 22px 20px}

/* ==== Projects ==== */
.projects{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.proj{
  position: relative;
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: var(--radius2);
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-height: 84px;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.proj::after{
  content:"";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform .35s ease;
}
.proj:hover{
  transform: translateY(-3px);
  background: var(--card);
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(124,92,255,.14);
}
.proj:hover::after{ transform: scaleY(1); }

.proj .title{display:flex; align-items:center; justify-content:space-between; gap: 10px;}
.proj .title a, .proj .title .proj-name{
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
  position: relative;
}
.proj .title a::after{
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .3s ease;
}
.proj .title a:hover::after{ transform: scaleX(1); }

.proj .tag{
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--card-2);
  white-space: nowrap;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.proj .tag.ai{
  background: linear-gradient(135deg, rgba(34,211,238,.16), rgba(124,92,255,.16));
  color: var(--accent2);
  border-color: rgba(34,211,238,.40);
  font-weight: 700;
}
[data-theme="light"] .proj .tag.ai{ color: #0e7490; }

.proj .desc{margin:0; color: var(--muted); font-size: 13px;}

/* ==== Notes ==== */
.note{
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: var(--card-2);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
  transition: background-color .25s ease, border-color .25s ease, transform .25s ease;
}
.note:hover{
  background: var(--card);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.note code{
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12px;
}
.gap{ height: 14px; }

/* ==== Footer ==== */
footer{
  margin-top: 18px;
  padding: 18px 18px 22px;
  color: var(--muted);
  font-size: 13px;
  text-align:center;
  border-top: 1px solid var(--line);
  background: var(--card-2);
}
.contacts-title{ color: var(--text); font-weight:650; letter-spacing: .02em; }
.contacts{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap: 10px 14px;
  margin-top: 12px;
}
.contact{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  text-decoration:none;
  color: var(--text);
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.contact:hover{
  transform: translateY(-2px);
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(124,92,255,.18);
}
.contact small{color: var(--muted2); font-size: 12px;}
.mono{ font-family: var(--mono); }

/* ==== Reveal stagger ==== */
.reveal-child{
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.2,.7,.2,1);
}
.section.visible .reveal-child{
  opacity: 1;
  transform: translateY(0);
}

/* ==== Responsive ==== */
@media (max-width: 920px){
  .top{grid-template-columns: 1fr}
  .projects{grid-template-columns: 1fr}
  .item{flex-direction:column}
  .item .k{min-width: unset}
  .section .head{flex-direction:column; align-items:flex-start}
  .section .head .hint{text-align:left}
  .theme-toggle{ top: 12px; right: 12px; }
}

/* ==== Reduced motion ==== */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .section{ opacity: 1; transform: none; }
  .reveal-child{ opacity: 1; transform: none; }
}

/* ==== Print ==== */
@media print{
  body{background:#fff;color:#111}
  .aurora, .scroll-progress, .theme-toggle{ display:none !important; }
  .card, .proj, .item, .note{ box-shadow:none }
  .card{ background:#fff; border-color:#ddd; }
  a{ text-decoration:none; color:#111 }
  .badge,.chip,.tag,.contact,.note{ border-color:#ddd; background:#fff; color:#333 }
  .wrap{padding:0}
  footer{background:#fff}
  .section{opacity:1; transform:none}
  .name-gradient{ color:#111; -webkit-text-fill-color:#111; background: none; }
}