/* =========================================================
   Design tokens
   ========================================================= */
:root{
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --ink: #1A1E2B;
  --muted: #5C6273;
  --muted-2: #8A8FA3;
  --line: #E3E5F0;
  --line-strong: #D2D5E6;
  --accent: #3B4FA0;
  --accent-ink: #262F73;
  --accent-tint: #EAEDF9;
  --accent-light: #93A2E8;
  --sky: #D7E6F7;
  --sky-tint: #EFF6FC;
  --warm: #8C6F78;
  --warm-tint: #F3ECEE;
  /* Always-dark surfaces (contact, footer) and text on ink buttons */
  --deep: #1A1E2B;
  --on-ink: #FFFFFF;
  --topbar-bg: rgba(247,248,250,0.82);
  --shadow: rgba(26,30,43,0.16);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --rail-w: 88px;
  --topbar-h: 72px;
  --radius: 14px;
  --radius-sm: 8px;
  --max: 980px;
}

/* Dark theme — same blue identity, deep navy surfaces */
:root[data-theme="dark"]{
  --bg: #0E1119;
  --surface: #161A26;
  --ink: #E8EAF2;
  --muted: #A3A9BA;
  --muted-2: #7A8093;
  --line: #252A39;
  --line-strong: #353B4F;
  --accent: #8B9CF0;
  --accent-ink: #B7C2F7;
  --accent-tint: #1E2442;
  --accent-light: #93A2E8;
  --sky: #1C2744;
  --sky-tint: #121727;
  --warm: #D9B6C0;
  --warm-tint: #2A2027;
  --deep: #07090F;
  --on-ink: #0E1119;
  --topbar-bg: rgba(14,17,25,0.82);
  --shadow: rgba(0,0,0,0.5);
  color-scheme: dark;
}
body{ transition: background-color .35s ease, color .35s ease; }

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3{ font-family: var(--font-display); margin:0; letter-spacing: -0.01em; }
p{ margin:0; }
a{ color: inherit; text-decoration: none; }
ul{ margin:0; padding:0; list-style:none; }

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

/* =========================================================
   Buttons
   ========================================================= */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover{ transform: translateY(-1px); }
.btn-solid{ background: var(--ink); color: var(--on-ink); }
.btn-solid:hover{ background: var(--accent-ink); }
.btn-outline{ background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover{ border-color: var(--ink); }
.btn-ghost{ background: transparent; color: var(--muted); }
.btn-ghost:hover{ color: var(--ink); }

/* =========================================================
   Pipeline rail (desktop side nav) — signature element
   ========================================================= */
.rail{
  position: fixed;
  top: 0; left: 0;
  width: var(--rail-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 46px;
  z-index: 40;
}
/* Track (unfilled) — top/height are set by JS from the real ball centers */
.rail-line{
  position: absolute;
  top: 0; height: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: var(--line);
}
/* Filled line — thick ink with a blue core and soft glow */
.rail-progress{
  position: absolute;
  top: 0; height: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--accent-ink) 100%);
  box-shadow: 0 0 10px rgba(59,79,160,0.35);
}
/* Glowing head at the tip of the filled line */
.rail-progress::after{
  content: '';
  position: absolute;
  left: 50%; bottom: -5px;
  width: 10px; height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(59,79,160,0.18), 0 0 14px rgba(59,79,160,0.6);
}
.rail-node{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}
.rail-num{
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  box-shadow: 0 2px 6px rgba(26,30,43,0.08);
  transition: background .3s ease, color .3s ease, box-shadow .3s ease, transform .3s ease;
}
/* Ring drawn around the ball as you scroll through that stage */
.rail-ring{
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px); height: calc(100% + 6px);
  transform: rotate(-90deg); /* start drawing from the top */
  pointer-events: none;
  overflow: visible;
}
.rail-ring circle{ fill: none; stroke-width: 3; }
.ring-track{ stroke: var(--line-strong); }
.ring-fill{
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 2px rgba(59,79,160,0.55));
}
/* Current stage: lifted, blue glow, ink number */
.rail-node.active .rail-num{
  color: var(--ink);
  transform: scale(1.12);
  box-shadow: 0 0 0 6px var(--accent-tint), 0 4px 14px rgba(59,79,160,0.25);
}
/* Completed stages: solid ink ball, white number, full blue ring */
.rail-node.done .rail-num,
.rail-node.complete .rail-num{
  background: var(--ink);
  color: var(--on-ink);
}
.rail-node.done .ring-fill,
.rail-node.complete .ring-fill{ stroke: var(--accent-light); }
.rail-label{
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s ease, transform .2s ease;
  position: absolute;
  left: 40px;
  top: 6px;
  white-space: nowrap;
  background: var(--bg);
  padding: 2px 4px;
}
.rail-node:hover .rail-label,
.rail-node.active .rail-label{ opacity: 1; transform: translateX(0); color: var(--ink); }

@media (max-width: 860px){
  .rail{ display: none; }
}

/* =========================================================
   Top bar
   ========================================================= */
.topbar{
  position: fixed;
  top: 0;
  left: var(--rail-w);
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.brand{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-dot{ color: var(--accent); }

.topbar-actions{ display:flex; align-items:center; gap: 10px; }

.resume-dropdown{ position: relative; }
.resume-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(20,24,31,0.09);
  padding: 6px;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.resume-menu.open{ opacity: 1; visibility: visible; transform: translateY(0); }
.resume-menu a{
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
}
.resume-menu a:hover{ background: var(--accent-tint); color: var(--accent-ink); }

.menu-btn{
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.menu-btn span{
  display: block;
  width: 20px; height: 2px;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}

@media (max-width: 860px){
  .topbar{ left: 0; padding: 0 20px; }
  .topbar-actions .btn-ghost{ display: none; }
  .menu-btn{ display: flex; }
}
@media (max-width: 520px){
  .topbar-actions .resume-dropdown,
  .topbar-actions .topbar-resume{ display:none; }
}

.mobile-nav{
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 10px 20px 20px;
  gap: 2px;
  z-index: 49;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: all .18s ease;
}
.mobile-nav.open{ transform: translateY(0); opacity: 1; visibility: visible; }
.mobile-nav a{
  padding: 12px 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mobile-nav .mobile-cta{
  margin-top: 10px;
  border: none;
  color: var(--accent-ink);
  font-weight: 600;
}

/* =========================================================
   Layout shell
   ========================================================= */
main{ padding-left: var(--rail-w); }
@media (max-width: 860px){ main{ padding-left: 0; } }

.stage-inner, .hero-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 40px;
}
@media (max-width: 640px){
  .stage-inner, .hero-inner{ padding: 0 22px; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--topbar-h);
  position: relative;
}
.hero-inner{
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 64px;
  align-items: center;
  width: 100%;
}
@media (max-width: 860px){
  .hero-inner{ grid-template-columns: 1fr; gap: 40px; }
}

.eyebrow{
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 18px;
}
.hero-title{
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 700;
  line-height: 1.02;
}
.hero-sub{
  margin-top: 22px;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--muted);
  max-width: 46ch;
  line-height: 1.55;
}
.hero-cta{ display:flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.hero-links{ display:flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.hero-links a{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.hero-links a:hover{ color: var(--accent-ink); border-color: var(--accent); background: var(--accent-tint); }
.hero-links .icon{ width: 14px; height: 14px; }

/* Icon base */
.icon{
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.btn .icon{ width: 14px; height: 14px; }

/* Hero visual — photo + status */
.hero-visual{
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 380px;
}
@media (max-width: 860px){ .hero-visual{ max-width: 320px; } }

.photo-frame{
  position: relative;
  width: 100%;
}
.photo-frame::before{
  content: '';
  position: absolute;
  /* Sit exactly behind the photo so it's centered in the box */
  inset: 0;
  background: var(--sky);
  border: 1.5px solid var(--accent);
  border-radius: 26px;
  box-shadow: 0 26px 54px var(--shadow);
  z-index: 0;
}
.photo-frame img{
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto; /* let aspect-ratio win over the HTML height attribute */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  /* Portrait photo in a square frame: keep the head, crop from the bottom */
  object-position: center top;
  border-radius: 26px;
  /* Grow from the bottom edge so the head rises out of the box */
  transform-origin: 50% 100%;
  clip-path: inset(0 0 0 0 round 26px);
  transition:
    transform .5s cubic-bezier(.2,.8,.2,1.2),
    clip-path .5s cubic-bezier(.2,.8,.2,1.2),
    filter .5s ease;
}

/* Hover: pop-out — the photo grows up and out of the top of the box.
   Sides are clipped by 1/scale so the jacket stays inside the box edges. */
@media (hover: hover){
  .photo-frame:hover img{
    transform: scale(1.1);
    clip-path: inset(-20% 4.55% 0 4.55% round 0 0 23.6px 23.6px);
    filter: drop-shadow(0 14px 18px rgba(26,30,43,0.28));
  }
}

.hero-status{ display: flex; flex-direction: column; gap: 14px; }
.hero-status-line{
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.status-dot{
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{
  0%, 100%{ opacity: 1; }
  50%{ opacity: .45; }
}
.status-stack{
  display: flex; flex-wrap: wrap; gap: 6px;
}
.status-stack span{
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.scroll-hint{
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}
@media (max-width: 860px){ .scroll-hint{ display: none; } }

/* =========================================================
   Stages (shared section styling)
   ========================================================= */
.stage{ padding: 120px 0; }
.stage-alt{ background: var(--sky-tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stage-deploy{ background: var(--deep); color: #fff; }

.stage-eyebrow{
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.stage-deploy .stage-eyebrow{ color: var(--accent-light); }

.stage-title{
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  margin-top: 10px;
  font-weight: 600;
}
.stage-lede{
  margin-top: 16px;
  color: var(--muted);
  max-width: 60ch;
  font-size: 1.05rem;
}
.stage-deploy .stage-lede{ color: #B8BEC7; }

/* Reveal-on-scroll */
.reveal{ opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in{ opacity: 1; transform: translateY(0); }

/* =========================================================
   Chips
   ========================================================= */
.chip-row{ display:flex; flex-wrap: wrap; gap: 8px; }
.chip{
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-ink);
  border: 1px solid transparent;
}
.chip-sm{ font-size: 11.5px; padding: 5px 10px; background: var(--sky-tint); color: var(--muted); border: 1px solid var(--line); }

/* =========================================================
   Stage 01 — Ingest (About + Education)
   ========================================================= */
.about-grid{
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  margin-top: 44px;
  align-items: start;
}
@media (max-width: 760px){ .about-grid{ grid-template-columns: 1fr; } }

.about-bio{ font-size: 1.05rem; line-height: 1.75; color: var(--ink); }

.edu-list{ display: flex; flex-direction: column; gap: 14px; }
.edu-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}
.edu-degree{ font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }
.edu-school{ margin-top: 4px; color: var(--muted); font-size: 0.94rem; }
.edu-meta{ margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--accent-ink); }

.coursework{ margin-top: 44px; }
.coursework-label{
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 14px;
}

/* =========================================================
   Stage 02 — Process (Experience timeline)
   ========================================================= */
.timeline{ margin-top: 48px; position: relative; }
.timeline-item{
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 24px;
  padding-bottom: 44px;
  position: relative;
}
.timeline-item:last-child{ padding-bottom: 0; }
.timeline-item::before{
  content: '';
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: -18px;
  width: 2px;
  background: var(--line-strong);
}
.timeline-item:last-child::before{ display: none; }
.timeline-marker{
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--accent-tint);
  margin-top: 2px;
}
.timeline-marker-sm{
  width: 14px; height: 14px;
  margin: 7px 0 0 5px;
  background: var(--muted-2);
  border: 3px solid var(--bg);
}
.timeline-head{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.timeline-role{ font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.timeline-role span{ font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: 0.95rem; }
.timeline-date{ font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); white-space: nowrap; }
.timeline-org{ margin-top: 4px; color: var(--accent-ink); font-weight: 500; }
.timeline-list{ margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.timeline-list li{
  padding-left: 18px;
  position: relative;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.96rem;
}
.timeline-list li::before{
  content: '';
  position: absolute;
  left: 0; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* =========================================================
   Stage 03 — Build (Projects)
   ========================================================= */
.project-grid{
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px){ .project-grid{ grid-template-columns: 1fr; } }

/* Wide featured card (Ask my AI): copy on the left, chat preview on the right */
.project-card.project-card-wide{ grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.wide-copy{ display: flex; flex-direction: column; gap: 14px; }
.project-card-wide .chart-chat{ height: auto; max-height: 150px; }
/* Readmission card: readmission rate by risk band */
.project-card-wide .chart-risk{ height: auto; max-height: 160px; }
.chart-risk text{ font-family: var(--font-mono); font-size: 10px; fill: var(--muted); text-anchor: middle; dominant-baseline: hanging; }
.chart-risk text.risk-val{ fill: var(--ink); font-size: 11px; dominant-baseline: auto; }
@media (max-width: 900px){
  .project-card.project-card-wide{ grid-template-columns: 1fr; gap: 18px; }
  .project-card-wide .chart-chat{ order: -1; max-height: 110px; }
  .project-card-wide .chart-risk{ order: -1; max-height: 130px; }
}
.project-link.project-link-solid{ background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; }
.project-link.project-link-solid:hover{ color: #fff; filter: brightness(1.08); }
:root[data-theme="dark"] .project-link.project-link-solid{ color: #0E1119; }

.project-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.project-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 22px 40px rgba(20,24,31,0.08);
  border-color: var(--line-strong);
}
.project-tag{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.project-title{ font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.project-desc{ color: var(--muted); font-size: 0.94rem; line-height: 1.6; flex-grow: 1; }
.project-stats{ display: flex; gap: 16px; flex-wrap: wrap; padding: 4px 0; }
.project-stats li{ font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.project-stats li strong{ color: var(--ink); display: block; font-size: 1rem; font-family: var(--font-display); }

.project-footer{ margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.project-link{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color .15s ease, background .15s ease;
}
.project-link:hover{ border-color: var(--accent); background: var(--accent-tint); }
.project-link .icon{ width: 14px; height: 14px; }

.also-built-label{
  margin-top: 52px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.mini-grid{
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px){ .mini-grid{ grid-template-columns: 1fr; } }
.mini-card{
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}
.mini-title{ font-family: var(--font-display); font-weight: 600; }
.mini-desc{ margin-top: 6px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; margin-bottom: 12px; }

/* =========================================================
   Stage 04 — Stack (Skills)
   ========================================================= */
.skill-grid{
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px){ .skill-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px){ .skill-grid{ grid-template-columns: 1fr; } }

.skill-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.skill-cat{
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  margin-bottom: 12px;
}

.cert-row{
  margin-top: 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
@media (max-width: 700px){ .cert-row{ grid-template-columns: 1fr; } }
.cert-list{ display: flex; flex-direction: column; gap: 12px; }
.cert-list li{ font-size: 0.95rem; line-height: 1.55; color: var(--ink); }
.tag-progress{
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--warm);
  background: var(--warm-tint);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

/* =========================================================
   Stage 05 — Deploy (Contact)
   ========================================================= */
.deploy-grid{
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 760px){ .deploy-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px){ .deploy-grid{ grid-template-columns: 1fr; } }

.deploy-card{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, background .15s ease;
}
.deploy-card:hover{ border-color: var(--accent-light); background: rgba(255,255,255,0.03); }
.deploy-card .icon{ width: 18px; height: 18px; color: var(--accent-light); margin-bottom: 2px; }
.deploy-label{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #8890A0; }
.deploy-value{ font-family: var(--font-mono); font-size: 13.5px; word-break: break-word; }

.deploy-resumes{ display: flex; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.stage-deploy .btn-outline{ color: #fff; border-color: rgba(255,255,255,0.28); }
.stage-deploy .btn-outline:hover{ border-color: #fff; }
.stage-deploy .btn-solid{ background: var(--accent-light); color: var(--deep); }
.stage-deploy .btn-solid:hover{ background: #A9B6EE; }

/* =========================================================
   Footer
   ========================================================= */
.footer{
  background: var(--deep);
  color: #8890A0;
  padding: 26px 40px 34px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
@media (max-width: 520px){ .footer{ flex-direction: column; gap: 6px; padding: 24px 22px 30px; } }

/* =========================================================
   Interactive upgrades
   ========================================================= */

/* ---------- Theme toggle ---------- */
/* Minimal rounded tile. The tile itself never moves — only the icon morphs. */
.theme-toggle,
.surprise-btn{
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: #F7F7F8;
  color: #0B0B0B;
  cursor: pointer;
  transition: border-color .2s ease;
}
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .surprise-btn{
  background: #1B1B1D;
  border-color: #2C2C30;
  color: #F7F7F8;
}
.theme-toggle:hover,
.surprise-btn:hover{ border-color: var(--accent); }

/* Surprise tile: still tile, only the sparkles inside animate */
.sp-icon{ width: 19px; height: 19px; overflow: visible; }
.sp-big, .sp-small, .sp-dot{
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .45s cubic-bezier(.3,1.5,.45,1), opacity .3s ease;
}
.surprise-btn:hover .sp-big{ transform: rotate(45deg) scale(1.08); }
.surprise-btn:hover .sp-small{ transform: rotate(-45deg) scale(1.15); }
.surprise-btn:hover .sp-dot{ transform: scale(1.5); }
/* Click: sparkles burst — big one spins, small ones pop */
.surprise-btn.pop .sp-big{ animation: spSpin .8s cubic-bezier(.3,1.4,.45,1) both; }
.surprise-btn.pop .sp-small{ animation: spPop .7s cubic-bezier(.3,1.6,.45,1) .08s both; }
.surprise-btn.pop .sp-dot{ animation: spPop .6s cubic-bezier(.3,1.6,.45,1) .16s both; }
@keyframes spSpin{
  0%  { transform: rotate(0) scale(1); }
  35% { transform: rotate(200deg) scale(.6); }
  100%{ transform: rotate(360deg) scale(1); }
}
@keyframes spPop{
  0%  { transform: scale(1); }
  40% { transform: scale(0); opacity: 0; }
  100%{ transform: scale(1); opacity: 1; }
}

.tt-icon{ width: 20px; height: 20px; overflow: visible; }
.tt-core, .tt-cut, .tt-rays{
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .5s cubic-bezier(.4,0,.2,1), opacity .35s ease;
}
/* Light mode → solid moon: full circle with a "bite" cut by the mask, no rays */
.tt-rays{ transform: scale(.5) rotate(-45deg); opacity: 0; }
/* Dark mode → solid sun: the bite slides away, circle shrinks to a core, rays grow out */
:root[data-theme="dark"] .tt-cut{ transform: translate(9px, -9px); }
:root[data-theme="dark"] .tt-core{ transform: scale(.5); }
:root[data-theme="dark"] .tt-rays{
  transform: none;
  opacity: 1;
  transition: transform .5s cubic-bezier(.4,0,.2,1) .08s, opacity .3s ease .1s;
}

/* ---------- Theme switch: double ripple from the toggle ----------
   The browser snapshots the old theme, applies the new one instantly, then
   reveals the new page through a soft-edged circle growing from the button:
   it bursts out, pulls back a touch, then floods the screen. Two echo rings
   ride on top in their own transition layer, driven by the same radius so
   they stay perfectly in sync. Every element changes in the same frame. */
@property --vt-r{ syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --vt-echo{ syntax: "<length>"; inherits: true; initial-value: 0px; }

:root{ --vt-x: 100vw; --vt-y: 0px; --vt-R: 150vmax; --vt-dur: 1.15s; --vt-feather: 26px; }

/* Ripple colors follow the theme being switched INTO (rings are drawn with
   the new theme): dark spreads like ink, light spreads like a soft glow */
:root[data-theme="dark"]{
  --rip-edge: rgba(7,9,15,.55);
  --rip-glow: rgba(7,9,15,.28);
  --rip-echo: rgba(7,9,15,.30);
  --rip-spark: rgba(7,9,15,.35);
}
:root[data-theme="light"]{
  --rip-edge: rgba(255,255,255,.75);
  --rip-glow: rgba(255,255,255,.20);
  --rip-echo: rgba(255,255,255,.32);
  --rip-spark: rgba(255,255,255,.55);
}

/* Scoped to theme switches only: page changes and the projects filter use
   their own (default) view transitions */
:root.theme-switching::view-transition-old(root),
:root.theme-switching::view-transition-new(root){
  animation: none;
  mix-blend-mode: normal;
}
:root.theme-switching::view-transition-new(root){
  -webkit-mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) - var(--vt-feather)), transparent var(--vt-r));
          mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) - var(--vt-feather)), transparent var(--vt-r));
  animation: rippleReveal var(--vt-dur) both;
}
/* Burst → slight pull-back (the "double" beat) → flood */
@keyframes rippleReveal{
  0%  { --vt-r: 0px;                          animation-timing-function: cubic-bezier(.2,.9,.3,1); }
  28% { --vt-r: calc(var(--vt-R) * .24);      animation-timing-function: cubic-bezier(.4,0,.6,1); }
  40% { --vt-r: calc(var(--vt-R) * .205);     animation-timing-function: cubic-bezier(.7,0,.25,1); }
  100%{ --vt-r: calc(var(--vt-R) + 40px); }
}

/* Echo-ring layer: lives above the page snapshots during the swap */
.ripple-layer{
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  view-transition-name: theme-ripple;
  overflow: hidden;
}
::view-transition-group(theme-ripple),
::view-transition-new(theme-ripple){ animation: none; }
::view-transition-old(theme-ripple){ display: none; }

.ripple-ring{
  position: absolute;
  left: var(--vt-x); top: var(--vt-y);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
/* Ring 1: rides exactly on the reveal edge (same keyframes, same clock),
   centred in the feathered band; a soft theme-colored shadow spreads outward */
.ripple-edge{
  width: calc(var(--vt-r) * 2 - var(--vt-feather));
  height: calc(var(--vt-r) * 2 - var(--vt-feather));
  border: 1px solid var(--rip-edge);
  box-shadow: 0 0 28px 6px var(--rip-glow);
  animation: rippleReveal var(--vt-dur) both, ringFade var(--vt-dur) both;
}
@keyframes ringFade{
  0%, 70%{ opacity: .9; }
  100%   { opacity: 0; }
}
/* Ring 2: thinner echo that shoots ahead on the pull-back beat and fades */
.ripple-echo{
  width: calc(var(--vt-echo) * 2);
  height: calc(var(--vt-echo) * 2);
  border: 1px solid var(--rip-echo);
  animation: rippleEcho calc(var(--vt-dur) * .8) cubic-bezier(.15,.7,.3,1) calc(var(--vt-dur) * .3) both;
}
@keyframes rippleEcho{
  0%  { --vt-echo: calc(var(--vt-R) * .2); opacity: .85; }
  100%{ --vt-echo: calc(var(--vt-R) * .95); opacity: 0; }
}
/* Spark: a quick flash at the button the moment you click */
.ripple-spark{
  width: 0; height: 0;
  background: radial-gradient(circle, var(--rip-spark) 0%, transparent 70%);
  animation: rippleSpark .5s ease-out both;
}
@keyframes rippleSpark{
  0%  { width: 0;    height: 0;    opacity: .9; }
  100%{ width: 90px; height: 90px; opacity: 0; }
}
/* While swapping, freeze per-element color transitions so nothing lags behind
   the wipe (the toggle keeps its own animation) */
.theme-switching *:not(.theme-toggle):not(.theme-toggle *),
.theme-switching *::before,
.theme-switching *::after,
.theme-switching body{ transition: none !important; }

/* Fallback for browsers without View Transitions: a short, even crossfade */
.theme-fade *, .theme-fade *::before, .theme-fade *::after, .theme-fade body{
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, fill .5s ease, stroke .5s ease, box-shadow .5s ease !important;
}

/* ---------- Hero: typing tagline ---------- */
.eyebrow.typing::after{
  content: "";
  display: inline-block;
  width: 7px; height: 1.05em;
  margin-left: 4px;
  vertical-align: -0.15em;
  background: var(--accent);
  animation: caret 1s steps(1) infinite;
}
.eyebrow.typed::after{ animation: caret 1s steps(1) 3 forwards; }
@keyframes caret{ 50%{ opacity: 0; } }

/* ---------- Hero: 3D tilt toward the cursor ---------- */
.photo-frame{
  --rx: 0deg; --ry: 0deg;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.photo-frame.tilting{ transition: transform .08s linear; }

/* ---------- Ingest: raw CSV decoding into clean text ---------- */
.decode-raw{ color: var(--accent); font-family: var(--font-mono); font-size: .92em; opacity: .75; }
.sr-only{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Process: timeline lights up in sequence ---------- */
.timeline-marker{ transition: background .5s ease, box-shadow .5s ease; }
.timeline-item.in .timeline-marker{ box-shadow: 0 0 0 6px var(--accent-tint), 0 0 16px rgba(59,79,160,.35); }
.timeline-item.in .timeline-marker-sm{ background: var(--accent); }
.timeline-item::after{
  content: "";
  position: absolute;
  left: 11px; top: 26px; bottom: -18px;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .9s ease .3s;
}
.timeline-item:last-child::after{ display: none; }
.timeline-item.in::after{ transform: scaleY(1); }

/* ---------- Build: mini charts on project cards ---------- */
.mini-chart{ width: 100%; height: 48px; overflow: visible; }
/* Build mini charts: intro plays once when the card scrolls in, then one
   element keeps looping. Hovering a card replays the intro (app.js). */
.chart-axis{ stroke: var(--line-strong); stroke-width: 1; }
.chart-bars rect{
  fill: var(--accent-light);
  opacity: .55;
  transform-box: fill-box;
  transform-origin: bottom;
  transform: scaleY(0);
  transition: opacity .2s ease;
}
.chart-bars rect.hi{ fill: var(--accent); opacity: 1; }
.project-card:hover .chart-bars rect{ opacity: .85; }
.project-card:hover .chart-bars rect.hi{ opacity: 1; }
.project-card.in .chart-bars rect{ animation: barGrow .7s cubic-bezier(.2,.8,.2,1.15) forwards; animation-delay: calc(var(--i) * 70ms); }
/* idle: the tallest bar breathes */
.project-card.in .chart-bars rect.hi{ animation: barGrow .7s cubic-bezier(.2,.8,.2,1.15) .21s forwards, barBreathe 2.6s ease-in-out 1.3s infinite; }
@keyframes barGrow{ to{ transform: scaleY(1); } }
@keyframes barBreathe{ 0%,100%{ transform: scaleY(1); } 50%{ transform: scaleY(.84); } }

/* NBA: the shot's arc draws, then the ball keeps dropping through the net */
.hoop-pole{ stroke: var(--line-strong); stroke-width: 2.4; }
.hoop-board{ fill: var(--surface); stroke: var(--muted-2); stroke-width: 1.2; }
.hoop-rim{ stroke: #E0773B; stroke-width: 2.4; stroke-linecap: round; }
.hoop-net{ fill: none; stroke: var(--muted-2); stroke-width: .9; stroke-linejoin: round; }
.hoop-shot{ fill: none; stroke: var(--accent-light); stroke-width: 1.8; stroke-dasharray: 100; stroke-dashoffset: 100; }
.hoop-ball{ fill: #E0773B; stroke: #9A4A1E; stroke-width: .8; opacity: 0; transform-box: fill-box; }
.project-card.in .hoop-shot{ animation: chartDraw 1.1s ease-out .15s forwards; }
.project-card.in .hoop-ball{ animation: hoopDrop 2.4s ease-in 1.1s infinite; }
@keyframes hoopDrop{
  0%{ opacity: 0; transform: translateY(-3px); }
  12%{ opacity: 1; transform: none; }
  50%{ opacity: 1; transform: translateY(13px); }
  62%, 100%{ opacity: 0; transform: translateY(15px); }
}

/* EV: battery cells charge one by one beside the growth line */
.ev-batt{ fill: var(--surface); stroke: var(--ink); stroke-width: 1.8; }
.ev-tip{ fill: var(--ink); }
.ev-cell{ fill: var(--accent); opacity: 0; transform: scaleX(.3); transform-origin: left; transform-box: fill-box; }
.ev-bolt{ fill: #F2C94C; stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; opacity: 0; }
.project-card.in .ev-cell{ animation: evCharge .35s ease-out forwards, evCells 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * .2s), calc(1.4s + var(--i) * .3s); }
.project-card.in .ev-bolt{ animation: chartFade .3s ease .95s forwards; }
@keyframes evCharge{ to{ opacity: 1; transform: none; } }
@keyframes evCells{ 0%,100%{ opacity: 1; transform: none; } 50%{ opacity: .35; transform: none; } }

.line-path{ fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.line-area{ fill: var(--accent-tint); opacity: 0; }
.line-dot{ fill: var(--accent); opacity: 0; }
.project-card.in .line-path{ animation: chartDraw 1.4s ease .2s forwards; }
.project-card.in .line-area{ animation: chartFade .8s ease 1s forwards; }
/* idle: the latest point pulses */
.project-card.in .line-dot{ animation: chartFade .3s ease 1.5s forwards, dotPulse 2s ease-in-out 1.8s infinite; }
@keyframes chartDraw{ to{ stroke-dashoffset: 0; } }
@keyframes chartFade{ to{ opacity: 1; } }
@keyframes dotPulse{ 0%,100%{ r: 3; opacity: 1; } 50%{ r: 4.5; opacity: 1; } }

.grid-dots circle{ r: 2; fill: var(--line-strong); }
.dfs-dead, .dfs-path{ fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dfs-dead{ stroke: var(--warm); stroke-width: 2; opacity: 0; stroke-dasharray: 3 4; }
.dfs-path{ stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 100; stroke-dashoffset: 100; }
.dfs-goal{ fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.dfs-start{ fill: var(--accent); transform-box: fill-box; transform-origin: center; }
.project-card.in .dfs-dead{ animation: dfsDead .4s ease .3s forwards; }
.project-card.in .dfs-path{ animation: chartDraw 1.4s ease .8s forwards; }
/* idle: the goal glows and the start point pings */
.project-card.in .dfs-goal{ animation: goalHit 2.2s ease-in-out 2.2s infinite; }
.project-card.in .dfs-start{ animation: startPing 2.2s ease-out 2.2s infinite; }
@keyframes dfsDead{ to{ opacity: .7; } }
@keyframes goalHit{ 0%,100%{ fill: transparent; transform: none; } 50%{ fill: var(--accent-tint); transform: scale(1.22); } }
@keyframes startPing{ 0%,100%{ transform: scale(1); } 15%{ transform: scale(1.4); } 35%{ transform: scale(1); } }

/* Chat preview: bubbles pop in and their text writes, then the
   assistant keeps "typing" (three dots) as the idle loop */
.chart-chat .cb{ opacity: 0; transform-box: fill-box; transform-origin: center; }
.chart-chat .cb-q{ transform-origin: right center; }
.chart-chat .cb-a{ transform-origin: left center; }
.chart-chat .cb-q rect{ fill: var(--accent); }
.chart-chat .cb-a rect{ fill: var(--accent-tint); stroke: var(--line-strong); stroke-width: 1; }
.chart-chat .cb-text{ fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.chart-chat .cb-q .cb-text{ stroke: rgba(255,255,255,.75); }
:root[data-theme="dark"] .chart-chat .cb-q .cb-text{ stroke: rgba(14,17,25,.6); }
.chart-chat .cb-a .cb-text{ stroke: var(--accent-light); }
.chart-chat .cb-typing circle{ fill: var(--accent-light); opacity: 0; transform-box: fill-box; transform-origin: center; }
.project-card.in .chart-chat .cb{ animation: bubbleIn .5s cubic-bezier(.3,1.4,.45,1) forwards; animation-delay: calc(.15s + var(--i) * .7s); }
.project-card.in .chart-chat .cb-q .cb-text{ animation: chartDraw .5s ease .45s forwards; }
.project-card.in .chart-chat .cb-a .cb-text{ animation: chartDraw 1.1s ease 1.15s forwards; }
.project-card.in .chart-chat .cb-typing circle{ animation: chartFade .3s ease 2.3s forwards, typingDot 1.2s ease-in-out calc(2.4s + var(--d)) infinite; }
@keyframes bubbleIn{ from{ opacity: 0; transform: scale(.6); } to{ opacity: 1; transform: none; } }
@keyframes typingDot{ 0%,60%,100%{ transform: translateY(0); opacity: .45; } 30%{ transform: translateY(-4px); opacity: 1; } }

/* Card: soft spotlight that follows the cursor */
.project-card{ position: relative; overflow: hidden; }
.project-card::before{
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), var(--accent-tint), transparent 60%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.project-card:hover::before{ opacity: 1; }
.project-card > *{ position: relative; }

/* ---------- Stack: filter ---------- */
.skill-filter{ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.filter-btn{
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .2s ease;
}
.filter-btn:hover{ border-color: var(--accent); color: var(--ink); }
.filter-btn.is-on{ background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.skill-filter + .skill-grid{ margin-top: 20px; }
.skill-card{ transition: opacity .35s ease, transform .35s ease, border-color .35s ease, box-shadow .35s ease; }
.skill-grid.filtering .skill-card{ opacity: .28; transform: scale(.97); }
.skill-grid.filtering .skill-card.match{
  opacity: 1; transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(59,79,160,.14);
}

/* ---------- Deploy: terminal ---------- */
.terminal{
  margin-top: 40px;
  max-width: 560px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.terminal-bar{
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.terminal-bar span{ width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.terminal-bar span:first-child{ background: var(--accent-light); }
.terminal-bar p{ margin-left: 8px; font-family: var(--font-mono); font-size: 11px; color: #8890A0; }
.terminal-body{
  margin: 0;
  padding: 14px 16px 16px;
  min-height: 112px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: #C9CEDA;
  white-space: pre-wrap;
}
.terminal-body .t-ok{ color: #8FD6A8; }
.terminal-body .t-acc{ color: var(--accent-light); }
.terminal-body .t-cur{ display: inline-block; width: 7px; height: 1em; vertical-align: -0.12em; background: var(--accent-light); animation: caret 1s steps(1) infinite; }

/* ---------- Dynamic Island ----------
   One black pill, top-center, in both themes. JS sets --iw/--ih to the
   measured content size so the pill morphs (springs) between messages. */
.island{
  --iw: 32px; --ih: 32px;
  position: fixed;
  top: 14px; left: 50%;
  width: var(--iw); height: var(--ih);
  transform: translate(-50%, -10px) scale(.6);
  opacity: 0;
  border-radius: 16px;
  background: #000;
  color: #F2F3F7;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  overflow: hidden;
  z-index: 120;
  pointer-events: none;
  transition:
    width .5s cubic-bezier(.3,1.3,.45,1),
    height .5s cubic-bezier(.3,1.3,.45,1),
    border-radius .5s ease,
    transform .45s cubic-bezier(.3,1.3,.45,1),
    opacity .22s ease;
}
.island.show{ transform: translate(-50%, 0) scale(1); opacity: 1; }
.island.tall{ border-radius: 18px; }
.island-inner{
  position: absolute;
  top: 0; left: 0;
  display: flex; align-items: center; gap: 7px;
  min-height: 32px;
  padding: 0 14px 0 12px;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .005em;
  transition: opacity .16s ease, filter .16s ease;
}
.island.swap .island-inner{ opacity: 0; filter: blur(2px); }
.island.tall .island-inner{
  align-items: flex-start;
  padding: 11px 16px 13px 12px;
  white-space: normal;
  width: 290px;
}
/* Plain glyph, no bubble */
.island-icon{
  flex: 0 0 auto;
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #F2F3F7;
}
.island-icon svg{ width: 14px; height: 14px; }
.island[data-tone="ok"]   .island-icon{ color: #8FD6A8; }
.island[data-tone="info"] .island-icon{ color: #B7C2F7; }
.island[data-tone="warn"] .island-icon{ color: #F2A0A0; }
/* Listening: just a small pulsing red dot, like the iPhone recording light */
.island[data-tone="live"] .island-icon svg{ display: none; }
.island[data-tone="live"] .island-icon::before{
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #FF453A;
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse{ 50%{ opacity: .45; } }
/* Hint sits inline in a muted tone, keeping the pill to one line */
.island-text small{ color: #8C92A4; font-weight: 400; margin-left: 6px; font-size: 12px; }
.island-text small::before{ content: "· "; }
.island.tall .island-text small{ display: block; margin: 8px 0 0; font-size: 11px; }
.island.tall .island-text small::before{ content: ""; }
.island-text .cmd-list{ display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 8px; color: #C9CEDA; font-size: 11.5px; }
.island-text .cmd-list span::before{ content: "› "; color: #93A2E8; }

/* Live sound wave while listening */
.island-wave{ display: none; align-items: center; gap: 2.5px; height: 12px; margin-left: 4px; }
.island.listening .island-wave{ display: inline-flex; }
.island-wave i{
  width: 3px; height: 100%;
  border-radius: 2px;
  background: #F5F6FA;
  transform: scaleY(.25);
  animation: waveIdle 1.1s ease-in-out infinite;
}
.island-wave i:nth-child(2){ animation-delay: .12s; }
.island-wave i:nth-child(3){ animation-delay: .24s; }
.island-wave i:nth-child(4){ animation-delay: .36s; }
.island-wave i:nth-child(5){ animation-delay: .48s; }
.island.hearing .island-wave i{ animation-name: waveLoud; animation-duration: .55s; }
@keyframes waveIdle{ 50%{ transform: scaleY(.45); } }
@keyframes waveLoud{ 0%,100%{ transform: scaleY(.3); } 50%{ transform: scaleY(1); } }

/* ---------- Floating mic: bottom-right, same minimal tile language ---------- */
.mic-wrap{
  position: fixed;
  right: 24px;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px));
  z-index: 95;
  display: flex;
  align-items: center;
  animation: micEnter .6s cubic-bezier(.3,1.4,.45,1) .9s both;
}
.mic-wrap[hidden]{ display: none; }
@keyframes micEnter{
  from{ opacity: 0; transform: translateY(14px) scale(.7); }
}
.mic-btn{
  position: relative;
  width: 50px; height: 50px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: #F7F7F8;
  color: #0B0B0B;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(26,30,43,.14), 0 2px 6px rgba(26,30,43,.08);
  transition: border-color .2s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
}
:root[data-theme="dark"] .mic-btn{
  background: #1B1B1D; border-color: #2C2C30; color: #F7F7F8;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
}
.mic-btn:hover{ border-color: var(--accent); }
.mic-icon{
  position: relative; z-index: 1;
  width: 22px; height: 22px;
  transition: transform .35s cubic-bezier(.3,1.4,.4,1);
}
.mic-btn:hover .mic-icon,
.mic-btn:focus-visible .mic-icon{ transform: scale(1.14); }
/* Sound-wave rings pulse out from the mic (inside the tile) */
.mic-arc{
  position: absolute;
  left: 50%; top: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0;
  pointer-events: none;
}
.mic-btn:hover .mic-arc,
.mic-btn.listening .mic-arc{ animation: micArc 1.6s ease-out infinite; }
.mic-btn:hover .mic-arc-2,
.mic-btn.listening .mic-arc-2{ animation-delay: .8s; }
@keyframes micArc{
  0%  { transform: scale(.7); opacity: .45; }
  100%{ transform: scale(1.9); opacity: 0; }
}
/* Listening: tile lights up in the accent, capsule breathes */
.mic-btn.listening{ background: #E5484D; border-color: #E5484D; color: #fff; }
:root[data-theme="dark"] .mic-btn.listening{ background: #E5484D; border-color: #E5484D; color: #fff; }
.mic-btn.listening .mic-capsule{ animation: capsuleBreathe 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes capsuleBreathe{ 50%{ transform: scaleY(.82); } }

/* Click ripple: spreads from the click point inside the tile.
   White over the red "on" state, accent blue when switching off. */
.mic-ripple{
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: micRipple .6s cubic-bezier(.2,.7,.3,1) forwards;
}
.mic-ripple.on{ background: rgba(255,255,255,.55); }
.mic-ripple.off{ background: var(--accent); opacity: .35; }
@keyframes micRipple{
  from{ transform: scale(0); opacity: .7; }
  to  { transform: scale(9); opacity: 0; }
}
/* Smooth color change between idle and listening */
.mic-btn{ transition: border-color .2s ease, background-color .22s ease, color .22s ease, box-shadow .25s ease; }

/* One rotating suggestion, to the left of the mic */
.mic-tip{
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(6px, -50%);
  pointer-events: none;
  transition: opacity .2s ease, transform .3s cubic-bezier(.3,1.3,.45,1);
}
.mic-tip::before{
  content: "";
  position: absolute;
  right: -4px; top: 50%;
  width: 8px; height: 8px;
  background: inherit;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}
.mic-wrap:hover .mic-tip,
.mic-wrap:focus-within .mic-tip{ opacity: 1; transform: translate(0, -50%); }
.mic-wrap.is-listening .mic-tip{ opacity: 0 !important; }
.mic-tip-label{ opacity: .6; }
.mic-tip-text{ display: inline-block; }
.mic-tip-text.swap-out{ animation: tipOut .22s ease forwards; }
.mic-tip-text.swap-in{ animation: tipIn .3s cubic-bezier(.3,1.3,.45,1) both; }
@keyframes tipOut{ to{ opacity: 0; transform: translateY(-7px); filter: blur(2px); } }
@keyframes tipIn{ from{ opacity: 0; transform: translateY(7px); filter: blur(2px); } }

/* ---------- "Surprise me" celebration ----------
   JS picks everything currently on screen and sets --sxd (a delay based on
   its vertical position) so the effects sweep down the screen as a wave. */
.sx-ch{ display: inline-block; white-space: pre; }
.sx-heading .sx-ch{ animation: chWave .75s cubic-bezier(.3,1.5,.5,1) calc(var(--sxd, 0ms) + var(--i) * 32ms) both; }

/* Text: lifts gently and flashes the accent */
.sx-text{ animation: sxText .9s cubic-bezier(.3,1.3,.5,1) var(--sxd, 0ms) both; }
@keyframes sxText{
  35% { transform: translateY(-5px); color: var(--accent); }
}
/* Cards / boxes: pop with a tilt and an accent edge glow */
.sx-box{ animation: sxBox .9s cubic-bezier(.3,1.4,.5,1) var(--sxd, 0ms) both; }
@keyframes sxBox{
  30% { transform: translateY(-6px) scale(1.03) rotate(-1deg); box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(59,79,160,.2); }
  60% { transform: translateY(-2px) scale(1.01) rotate(.6deg); }
}
/* Chips / tags: hop */
.sx-chip{ animation: sxChip .6s cubic-bezier(.3,1.6,.5,1) var(--sxd, 0ms) both; }
@keyframes sxChip{
  40% { transform: translateY(-8px) scale(1.08); background: var(--accent); color: var(--on-ink); border-color: var(--accent); }
}
/* Buttons: wiggle */
.sx-btn{ animation: sxBtn .7s ease var(--sxd, 0ms) both; }
@keyframes sxBtn{
  20% { transform: rotate(-6deg) scale(1.05); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(2deg); }
}
/* Chart bars bounce */
/* (raised specificity so it wins over the cards' own intro/idle animations) */
.sx-chart rect:not(.chart-axis),
.project-card.in .chart-bars.sx-chart rect:not(.chart-axis){ animation: sxBar .8s cubic-bezier(.3,1.6,.5,1) calc(var(--sxd, 0ms) + var(--i, 0) * 60ms) both; }
@keyframes sxBar{ 0%,100%{ transform: scaleY(1); } 40%{ transform: scaleY(1.3); } }
/* Line chart and DFS path redraw themselves */
.sx-redraw .line-path,
.sx-redraw .dfs-path,
.project-card.in .sx-redraw .line-path,
.project-card.in .sx-redraw .dfs-path{ animation: sxRedraw 1.3s ease var(--sxd, 0ms) both; }
@keyframes sxRedraw{ from{ stroke-dashoffset: 100; } to{ stroke-dashoffset: 0; } }
.brand-dot{ display: inline-block; }
/* Dots / markers: ripple */
.sx-dot{ animation: sxDot .8s ease-out var(--sxd, 0ms) both; }
@keyframes sxDot{
  40% { transform: scale(1.6); box-shadow: 0 0 0 8px var(--accent-tint); }
}
/* Rail line flashes */
.rail-progress.sx-flash{ animation: sxFlash 1.2s ease both; }
@keyframes sxFlash{ 30%{ box-shadow: 0 0 22px 3px rgba(59,79,160,.7); } }

/* Name: letters bounce in a wave and flash the accent */
.hero-title .ch{ display: inline-block; white-space: pre; }
.hero-title.wave .ch{ animation: chWave .75s cubic-bezier(.3,1.5,.5,1) calc(var(--i) * 45ms) both; }
@keyframes chWave{
  35% { transform: translateY(-16px) rotate(-6deg); color: var(--accent); }
  70% { transform: translateY(3px); }
}
/* Photo: jumps out of its frame, wiggles, settles back */
.photo-frame img.cheer{ animation: photoCheer 1.4s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes photoCheer{
  0%  { transform: none; }
  22% { transform: scale(1.12) translateY(-12px) rotate(-3deg); clip-path: inset(-25% 5.3% 0 5.3% round 0 0 23px 23px); }
  42% { transform: scale(1.12) translateY(-12px) rotate(3deg);  clip-path: inset(-25% 5.3% 0 5.3% round 0 0 23px 23px); }
  60% { transform: scale(1.1) translateY(-8px) rotate(-1.5deg); clip-path: inset(-25% 4.5% 0 4.5% round 0 0 23px 23px); }
  100%{ transform: none; }
}
/* Mic: a happy hop */
.mic-btn.cheer{ animation: micCheer .9s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes micCheer{
  30% { transform: translateY(-14px) rotate(-10deg) scale(1.08); }
  55% { transform: translateY(0) rotate(6deg); }
  75% { transform: translateY(-5px) rotate(-3deg); }
}
/* Island icon spins while greeting */
.island[data-anim="spin"] .island-icon svg{ animation: iconSpin 1.2s cubic-bezier(.3,1.3,.5,1) both; }
@keyframes iconSpin{ from{ transform: rotate(-180deg) scale(.4); } }
/* Sparkle trail behind the cursor / finger */
.sparkle{
  position: fixed;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  pointer-events: none;
  z-index: 115;
  background: var(--accent);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: sparkleFade .8s ease-out forwards;
}
@keyframes sparkleFade{
  from{ transform: scale(1) rotate(0deg); opacity: 1; }
  to  { transform: translate(var(--dx), var(--dy)) scale(0) rotate(180deg); opacity: 0; }
}

/* =========================================================
   Celebration card (greeting + weather)
   ========================================================= */
/* A compact notification that drops from the top-center, springing open
   from a small pill (same spot and motion language as the Dynamic Island).
   No backdrop: the page stays usable behind it. */
.cc-wrap{
  position: fixed;
  top: 14px; left: 50%;
  z-index: 112;
  width: min(340px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.cc-card{
  position: relative;
  padding: 14px 16px 14px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(26,30,43,.18), 0 3px 10px rgba(26,30,43,.07);
  overflow: hidden;
  pointer-events: auto;
  transform-origin: 50% 0;
  opacity: 0;
  transform: translateY(-16px) scaleX(.32) scaleY(.2);
  clip-path: inset(0 0 0 0 round 22px);
  transition:
    opacity .22s ease,
    transform .6s cubic-bezier(.3,1.28,.45,1);
}
:root[data-theme="dark"] .cc-card{ box-shadow: 0 18px 44px rgba(0,0,0,.5); }
/* Contents fade in once the shape has opened, so nothing looks squashed */
.cc-card > *{ opacity: 0; transition: opacity .25s ease .22s; }
.cc-wrap.show .cc-card{ opacity: 1; transform: none; }
.cc-wrap.show .cc-card > *{ opacity: 1; }
.cc-wrap.hide .cc-card{
  opacity: 0;
  transform: translateY(-12px) scaleX(.4) scaleY(.25);
  transition: opacity .25s ease .1s, transform .4s cubic-bezier(.5,0,.75,0);
}
.cc-wrap.hide .cc-card > *{ opacity: 0; transition-delay: 0s; transition-duration: .12s; }
/* Soft accent glow in the corner */
.cc-card::before{
  content: ""; position: absolute; top: -70px; right: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-tint) 0%, transparent 70%);
  pointer-events: none;
  opacity: 1;
}
.cc-close{
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 24px; height: 24px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: color .2s ease, border-color .2s ease, opacity .25s ease .22s;
}
.cc-close:hover{ color: var(--ink); border-color: var(--accent); }
.cc-close svg{ width: 11px; height: 11px; }
@media (max-width: 860px){
  .cc-wrap{ top: calc(var(--topbar-h) + 6px); }
}

.cc-top{ position: relative; display: flex; align-items: center; gap: 10px; padding-right: 26px; }
.cc-hi{ font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); letter-spacing: .02em; }
.cc-wave{ display: inline-block; transform-origin: 70% 70%; animation: ccWave 1.6s ease-in-out .7s 2; }
@keyframes ccWave{ 0%,60%,100%{ transform: rotate(0); } 10%,30%{ transform: rotate(16deg); } 20%,40%{ transform: rotate(-10deg); } }
.cc-title{ margin-top: 1px; font-size: 1.12rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.cc-icon{ flex: 0 0 auto; }

.cc-weather{ position: relative; margin-top: 10px; min-height: 40px; }
.cc-loading{ display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; padding: 10px 0; }
.cc-dots{ display: inline-flex; gap: 4px; }
.cc-dots i{ width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: ccDot 1s ease-in-out infinite; }
.cc-dots i:nth-child(2){ animation-delay: .15s; } .cc-dots i:nth-child(3){ animation-delay: .3s; }
@keyframes ccDot{ 50%{ transform: translateY(-5px); opacity: .5; } }
.cc-noweather{ color: var(--muted); font-size: 12.5px; padding: 6px 0; }

.cc-now{ display: flex; align-items: center; gap: 10px; animation: ccIn .45s ease both; }
.cc-temp{ font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1; letter-spacing: -.03em; }
.cc-temp sup{ font-size: .8rem; font-weight: 500; vertical-align: top; margin-left: 1px; color: var(--muted); }
.cc-cond b{ display: block; font-size: .92rem; font-weight: 600; line-height: 1.25; }
.cc-cond span{ font-size: 12px; color: var(--muted); }

.cc-stats{
  margin-top: 10px;
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px;
  animation: ccIn .45s ease .08s both;
}
.cc-stats span{
  padding: 6px 7px; border-radius: 9px;
  background: var(--sky-tint); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink);
  white-space: nowrap; text-align: center;
}
.cc-stats em{ display: block; font-style: normal; font-size: 9.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1px; }
.cc-stats small{ font-size: 9.5px; color: var(--muted); margin-left: 2px; }
@keyframes ccIn{ from{ opacity: 0; transform: translateY(6px); } }

.cc-wish{ margin-top: 10px; font-size: 13px; font-weight: 500; line-height: 1.4; }
.cc-foot{ margin-top: 8px; }
.cc-chip{ display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-ink); }
.cc-loc{
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 9px 3px 7px;
  font: 500 11px/1.4 var(--font-body); color: var(--accent-ink);
  background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.cc-loc svg{ width: 12px; height: 12px; }
.cc-loc:hover{ background: var(--accent-tint); border-color: transparent; }
.cc-loc:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-loc:disabled{ opacity: .6; cursor: progress; }
.cc-timer{ position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.cc-timer i{ display: block; height: 100%; background: var(--accent); transform-origin: left; opacity: .7; }

/* ---------- Animated weather icons ---------- */
.wi{ display: block; overflow: visible; }
.wi-lg{ width: 84px; height: 84px; }
.wi-md{ width: 44px; height: 44px; }
.wi-sm{ width: 34px; height: 34px; margin: 2px 0; }
.wi line, .wi path{ stroke-linecap: round; stroke-linejoin: round; }
.wi-rays line{ stroke: #F2B33D; stroke-width: 3.4; }
.wi-core{ fill: #F7C04A; }
.wi-rays{ transform-origin: 32px 32px; animation: wiSpin 14s linear infinite; }
.wi-core{ transform-box: fill-box; transform-origin: center; animation: wiPulse 3s ease-in-out infinite; }
@keyframes wiSpin{ to{ transform: rotate(360deg); } }
@keyframes wiPulse{ 50%{ transform: scale(1.08); } }
.wi-moon{ fill: #C9D2F2; }
:root[data-theme="dark"] .wi-moon{ fill: #E3E8FF; }
.wi-moonwrap{ animation: wiFloat 4s ease-in-out infinite; }
.wi-star{ fill: #F2C45A; animation: wiTwinkle 2s ease-in-out infinite; }
.wi-star.s2{ animation-delay: .6s; } .wi-star.s3{ animation-delay: 1.2s; }
@keyframes wiTwinkle{ 50%{ opacity: .25; } }
@keyframes wiFloat{ 50%{ transform: translateY(-2px); } }
.wi-cloud path{ fill: #DCE3F0; stroke: #C3CDE0; stroke-width: 1.5; }
.wi-cloud.c2 path{ fill: #EEF2F9; }
:root[data-theme="dark"] .wi-cloud path{ fill: #4A5574; stroke: #5D6888; }
:root[data-theme="dark"] .wi-cloud.c2 path{ fill: #5D6888; }
.wi-cloud{ animation: wiDrift 5s ease-in-out infinite; }
.wi-cloud.c2{ animation-duration: 6.5s; animation-direction: reverse; }
@keyframes wiDrift{ 50%{ translate: 3px 0; } }
.wi-drop{ stroke: #5B8DEF; stroke-width: 2.6; animation: wiRain 1s linear var(--d, 0s) infinite; }
.wi-drop.thin{ stroke-width: 1.8; animation-duration: 1.3s; }
@keyframes wiRain{
  0%  { transform: translateY(-4px); opacity: 0; }
  30% { opacity: 1; }
  100%{ transform: translateY(8px); opacity: 0; }
}
.wi-flake path{ stroke: #9FB4E8; stroke-width: 1.8; fill: none; }
:root[data-theme="dark"] .wi-flake path{ stroke: #E3E8FF; }
.wi-flake{ transform-box: fill-box; transform-origin: center; animation: wiSnow 2.4s linear var(--d, 0s) infinite; }
@keyframes wiSnow{
  0%  { transform: translateY(-4px) rotate(0); opacity: 0; }
  25% { opacity: 1; }
  100%{ transform: translateY(9px) rotate(120deg); opacity: 0; }
}
.wi-bolt{ fill: #F5C542; animation: wiBolt 2.2s ease-in-out infinite; }
@keyframes wiBolt{ 0%,40%,48%,100%{ opacity: 1; } 44%{ opacity: .15; } 70%{ opacity: .5; } }
.wi-fog line{ stroke: #AAB4CA; stroke-width: 3; animation: wiFog 3s ease-in-out infinite; }
.wi-fog line:nth-child(2){ animation-delay: .8s; }
@keyframes wiFog{ 50%{ transform: translateX(5px); opacity: .6; } }
.wi-wind path{ fill: none; stroke: #8FA2D6; stroke-width: 3; stroke-dasharray: 60; animation: wiWind 2.4s ease-in-out infinite; }
.wi-wind .w2{ animation-delay: .3s; } .wi-wind .w3{ animation-delay: .6s; }
@keyframes wiWind{ 0%{ stroke-dashoffset: 60; } 50%{ stroke-dashoffset: 0; } 100%{ stroke-dashoffset: -60; } }
.wi-loading{ animation: wiPulse 1.2s ease-in-out infinite; opacity: .6; }

/* Hidden native switch used only to trigger iPhone haptics */
.haptic-switch{
  position: fixed;
  width: 1px; height: 1px;
  left: -100px; top: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Keyboard hint chip shown in suggestions on desktop */
.kbd{
  display: inline-block;
  padding: 0 5px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 4px;
  font-size: 11px;
  line-height: 16px;
}

/* ---------- Rail: pulse when a ring completes ---------- */
.rail-num.pulse::after{
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ringPulse .7s ease-out forwards;
  pointer-events: none;
}
@keyframes ringPulse{
  from{ transform: scale(1); opacity: .9; }
  to{ transform: scale(1.8); opacity: 0; }
}

/* Phones/tablets: the top bar is full of controls, so the island drops
   just below it instead of covering the menu and mic */
@media (max-width: 860px){
  .island{ top: calc(var(--topbar-h) + 6px); }
}
@media (max-width: 520px){
  .mic-tip{ display: none; }
  .mic-wrap{ right: 16px; bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px)); }
  .mic-btn{ width: 48px; height: 48px; border-radius: 15px; }
}

@media (prefers-reduced-motion: reduce){
  .photo-frame{ transform: none !important; }
  .island{ transition: opacity .2s ease; }
  .chart-bars rect, .project-card.in .chart-bars rect{ transform: none; animation: none; }
  .line-path, .dfs-path, .project-card.in .line-path, .project-card.in .dfs-path{ stroke-dashoffset: 0; animation: none; }
  .dfs-dead, .line-area, .line-dot, .project-card.in .dfs-dead, .project-card.in .line-area, .project-card.in .line-dot,
  .project-card.in .dfs-goal, .project-card.in .dfs-start{ animation: none; opacity: 1; }
  .project-card.in .dfs-dead{ opacity: .7; }
  .hoop-shot, .project-card.in .hoop-shot{ stroke-dashoffset: 0; animation: none; }
  .hoop-ball, .ev-cell, .ev-bolt, .project-card.in .hoop-ball, .project-card.in .ev-cell, .project-card.in .ev-bolt{ animation: none; opacity: 1; transform: none; }
}

/* =========================================================
   Ask my AI: floating button + chat panel
   ========================================================= */
.ask-fab{
  position: fixed; z-index: 95;
  right: 24px; bottom: calc(max(24px, calc(env(safe-area-inset-bottom) + 14px)) + 62px);
  display: inline-flex; align-items: center; gap: 8px;
  height: 50px; padding: 0 18px 0 15px;
  border-radius: 16px; border: 1px solid var(--line-strong);
  background: #0B0B0B; color: #F7F7F8;
  font: 600 14px/1 var(--font-body); letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(26,30,43,.18), 0 2px 6px rgba(26,30,43,.1);
  animation: micEnter .6s cubic-bezier(.3,1.4,.45,1) 1.05s both;
  transition: transform .25s cubic-bezier(.3,1.4,.4,1), opacity .2s ease, box-shadow .25s ease, background-color .25s ease;
}
.ask-fab[hidden]{ display: none; }
.mic-wrap[hidden] + .ask-fab{ bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px)); }
:root[data-theme="dark"] .ask-fab{ background: #F7F7F8; color: #0B0B0B; border-color: transparent; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.ask-fab svg{ width: 21px; height: 21px; flex: none; }
.ask-fab .ask-spark{ transform-origin: 12px 9.7px; animation: askTwinkle 3.2s ease-in-out infinite; }
@keyframes askTwinkle{ 0%,70%,100%{ transform: scale(1); } 80%{ transform: scale(1.35) rotate(20deg); } }
.ask-fab:hover{ transform: translateY(-2px); }
/* Compact while scrolling: icon only, so it covers less of the page */
.ask-fab .ask-label{ display: inline-block; max-width: 90px; overflow: hidden; white-space: nowrap; transition: max-width .3s cubic-bezier(.3,.8,.3,1), opacity .2s ease; }
.ask-fab{ transition: transform .25s cubic-bezier(.3,1.4,.4,1), opacity .2s ease, box-shadow .25s ease, background-color .25s ease, padding .3s cubic-bezier(.3,.8,.3,1), gap .3s ease; }
.ask-fab.is-compact:not(:hover):not(:focus-visible){ padding: 0 14px; gap: 0; }
.ask-fab.is-compact:not(:hover):not(:focus-visible) .ask-label{ max-width: 0; opacity: 0; }
.ask-fab:active{ transform: scale(.96); }
.ask-fab:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
body.ai-open .ask-fab, body.ai-open .mic-wrap{ opacity: 0; pointer-events: none; transform: scale(.85); }

.ai-panel{
  position: fixed; z-index: 120;
  right: 24px; bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px));
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 110px));
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(26,30,43,.22), 0 4px 14px rgba(26,30,43,.08);
  overflow: hidden;
  transform-origin: 100% 100%;
  opacity: 0; transform: translateY(12px) scale(.94); visibility: hidden;
  transition: opacity .22s ease, transform .32s cubic-bezier(.3,1.25,.45,1), visibility 0s linear .32s;
}
:root[data-theme="dark"] .ai-panel{ box-shadow: 0 24px 60px rgba(0,0,0,.55); }
.ai-panel.open{ opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }

.ai-head{ display: flex; align-items: center; gap: 11px; padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--line); }
.ai-badge{ width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--accent-tint); color: var(--accent); }
.ai-badge svg{ width: 20px; height: 20px; }
.ai-titles{ flex: 1; min-width: 0; }
.ai-titles h2{ font-size: 15px; line-height: 1.2; }
.ai-status{ display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.ai-status i{ width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.ai-status.is-online i{ background: #2F9E6B; box-shadow: 0 0 0 3px rgba(47,158,107,.18); }
.ai-status.is-waking i{ background: #E0A93B; animation: aiBlink 1s ease-in-out infinite; }
.ai-status.is-offline i{ background: #D0473E; }
@keyframes aiBlink{ 50%{ opacity: .3; } }
.ai-close{ width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.ai-close:hover{ background: var(--accent-tint); color: var(--ink); }
.ai-close svg{ width: 16px; height: 16px; }

.ai-log{ flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.ai-msg{ display: flex; flex-direction: column; max-width: 88%; animation: aiIn .28s cubic-bezier(.3,1.2,.45,1) both; }
@keyframes aiIn{ from{ opacity: 0; transform: translateY(6px); } }
.ai-msg.user{ align-self: flex-end; align-items: flex-end; }
.ai-msg.bot{ align-self: flex-start; }
.ai-bubble{ padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.bot .ai-bubble{ background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.ai-msg.user .ai-bubble{ background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
:root[data-theme="dark"] .ai-msg.user .ai-bubble{ color: #0E1119; }
.ai-msg.is-error .ai-bubble{ border-color: rgba(208,71,62,.35); }
.ai-bubble a{ color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ai-src{ margin: 4px 4px 0; font-size: 10.5px; color: var(--muted-2); }
.ai-dots{ display: inline-flex; gap: 4px; padding: 3px 0; }
.ai-dots i{ width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); animation: aiDot 1.1s ease-in-out infinite; }
.ai-dots i:nth-child(2){ animation-delay: .15s; } .ai-dots i:nth-child(3){ animation-delay: .3s; }
@keyframes aiDot{ 0%,60%,100%{ transform: none; opacity: .5; } 30%{ transform: translateY(-4px); opacity: 1; } }

.ai-chips{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ai-chip{ padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--accent-ink); font: 500 12.5px/1.3 var(--font-body); cursor: pointer; transition: background .2s, border-color .2s; }
.ai-chip:hover{ background: var(--accent-tint); border-color: transparent; }

.ai-form{ display: flex; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--line); }
.ai-input{ flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 400 16px/1 var(--font-body); }
.ai-input::placeholder{ color: var(--muted-2); }
.ai-input:focus{ outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.ai-send{ width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 0; border-radius: 13px; background: var(--accent); color: #fff; cursor: pointer; transition: transform .2s, opacity .2s; }
:root[data-theme="dark"] .ai-send{ color: #0E1119; }
.ai-send:hover{ transform: translateX(1px); }
.ai-send:disabled{ opacity: .45; cursor: progress; transform: none; }
.ai-send svg{ width: 19px; height: 19px; }
.ai-note{ margin: 0; padding: 2px 14px 10px; font-size: 10.5px; color: var(--muted-2); text-align: center; }

@media (max-width: 520px){
  .ask-fab{ right: 16px; bottom: calc(max(16px, calc(env(safe-area-inset-bottom) + 10px)) + 60px); width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 15px; }
  .mic-wrap[hidden] + .ask-fab{ bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px)); }
  .ask-fab .ask-label{ display: none; }
  .ai-panel{ right: 8px; left: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: min(78dvh, 620px); border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce){
  .ai-panel, .ask-fab, .ai-msg{ transition: opacity .15s ease; animation: none; transform: none; }
  .ask-fab .ask-spark, .ai-dots i{ animation: none; }
}

/* ---------- Build: "See all projects" link to /projects/ ---------- */
.see-all-wrap{ margin-top: 34px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.see-all{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 18px 13px 22px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink);
  font: 600 15px/1 var(--font-body);
  box-shadow: 0 10px 26px rgba(26,30,43,.14);
  transition: transform .25s cubic-bezier(.3,1.4,.45,1), box-shadow .25s ease, background .25s ease;
}
.see-all:hover{ transform: translateY(-2px); box-shadow: 0 16px 34px rgba(26,30,43,.2); }
.see-all:active{ transform: scale(.97); }
.see-all:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
.see-all-n{ min-width: 24px; height: 24px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #fff; font: 600 12px/1 var(--font-mono); }
:root[data-theme="dark"] .see-all-n{ color: #0E1119; }
.see-all-arrow{ display: inline-block; transition: transform .3s cubic-bezier(.3,1.4,.45,1); }
.see-all:hover .see-all-arrow{ transform: translateX(4px); }
.see-all-note{ font-size: 13px; color: var(--muted-2); }

/* Smooth cross-fade between pages (home ⇄ /projects/) where supported */
@view-transition{ navigation: auto; }
::view-transition-old(root), ::view-transition-new(root){ animation-duration: .28s; }
@media (prefers-reduced-motion: reduce){ @view-transition{ navigation: none; } }

/* Off-screen cards: freeze their looping animations (app.js toggles the class) */
.project-card.is-offscreen *, .project-card.is-offscreen *::before, .project-card.is-offscreen *::after{ animation-play-state: paused !important; }
