/* =========================================================
   TOKENS
========================================================= */
:root {
  --bg: #090b14;
  --bg-elevated: #0e1120;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9ebf5;
  --text-muted: #9aa1c2;
  --text-faint: #5c6488;

  --violet: #7c5cff;
  --cyan: #22d3ee;
  --amber: #ffb84d;

  --gradient: linear-gradient(135deg, var(--violet) 0%, var(--cyan) 100%);

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --container: 1180px;
  --radius: 14px;
  --radius-sm: 8px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint, static film grain — cinematic texture, no runtime cost */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Cursor spotlight — added by JS only on fine-pointer devices */
#cursor-spotlight {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%), rgba(124, 92, 255, 0.07), transparent 70%);
  mix-blend-mode: screen;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; }

.mono { font-family: var(--font-mono); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

.eyebrow {
  color: var(--cyan);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.file-label {
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.section__title {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  margin-bottom: 40px;
}

/* faint background grid for texture */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

/* slow-drifting ambient glow, sitewide — very low opacity, purely atmospheric */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
}
.bg-blobs span:nth-child(1) {
  width: 420px; height: 420px;
  background: var(--violet);
  top: -10%; left: -8%;
  animation: blobDrift1 26s ease-in-out infinite;
}
.bg-blobs span:nth-child(2) {
  width: 380px; height: 380px;
  background: var(--cyan);
  top: 35%; right: -10%;
  animation: blobDrift2 32s ease-in-out infinite;
}
.bg-blobs span:nth-child(3) {
  width: 340px; height: 340px;
  background: var(--violet);
  bottom: -12%; left: 30%;
  animation: blobDrift3 30s ease-in-out infinite;
}
@keyframes blobDrift1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(60px, 40px); } }
@keyframes blobDrift2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-50px, 60px); } }
@keyframes blobDrift3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, -50px); } }
@media (prefers-reduced-motion: reduce) {
  .bg-blobs span { animation: none !important; }
}

/* =========================================================
   REVEAL ANIMATION
========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { transition: none; transform: none; opacity: 1; }
}

/* Cinematic title reveal — used on section headings for a bigger,
   more deliberate entrance than the standard fade above. */
.reveal-cinematic {
  opacity: 0;
  transform: scale(1.06);
  filter: blur(6px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.reveal-cinematic.is-visible {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal-cinematic { transition: none; transform: none; filter: none; opacity: 1; }
}

/* =========================================================
   3D TILT + GLARE — applied by initTilt() in animations.js.
   Perspective lives in the transform itself so no parent
   `perspective`/`transform-style` juggling is needed.
========================================================= */
.tilt {
  position: relative;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.35s var(--ease);
  will-change: transform;
}
.tilt:hover,
.tilt:focus-within {
  transition: transform 0.08s linear;
}
.tilt::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255, 255, 255, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.tilt:hover::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .tilt { transform: none !important; }
  .tilt::before { display: none; }
}

/* =========================================================
   BUTTONS
========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn--primary {
  background: var(--gradient);
  color: #060713;
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(124, 92, 255, 0.55); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--cyan); }

.btn--whatsapp {
  background: #25d366;
  color: #06210f;
}
.btn--whatsapp:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(37, 211, 102, 0.55); }

.btn--sm { padding: 8px 16px; font-size: 0.8rem; }

/* =========================================================
   NAV
========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 0;
  transition: background 0.3s var(--ease), padding 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
  /* Always carry a soft scrim, even before scrolling — the nav sits
     directly over the animated hero (3D scene / canvas), and a fully
     transparent nav made the logo and links hard to read against it. */
  background: linear-gradient(to bottom, rgba(5, 6, 12, 0.55), rgba(5, 6, 12, 0));
}
.nav.is-scrolled {
  background: rgba(9, 11, 20, 0.75);
  backdrop-filter: blur(14px);
  padding: 12px 0;
  border-bottom-color: var(--border);
}
.nav__inner { display: flex; align-items: center; gap: 24px; }

.nav__brand {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: flex;
}
.nav__brand svg, .nav__brand img { width: 100%; height: 100%; display: block; }
.nav__brand img { border-radius: 22%; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.nav__brand:hover img { transform: scale(1.06); box-shadow: 0 0 18px rgba(34, 211, 238, 0.35); }

.nav__links {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.nav__links a {
  color: var(--text-muted);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1.5px;
  background: var(--gradient);
  transition: width 0.25s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { width: 100%; }

.nav__resume { flex-shrink: 0; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
}
.nav__toggle span {
  width: 22px; height: 2px; background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav__toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-active span:nth-child(2) { opacity: 0; }
.nav__toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   HERO
========================================================= */
.hero {
  position: relative;
  min-height: 100vh;   /* fallback for browsers without svh support */
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  overflow: hidden;
  scroll-margin-top: 80px;
  /* cinematic edge vignette — sits over the 3D/canvas layer, behind the
     positioned text (z-index: 3), drawing focus to the center */
  box-shadow: inset 0 0 18vw 4vw rgba(5, 6, 12, 0.65);
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
  touch-action: none; /* allow drag-to-rotate on the 3D hero without scrolling the page */
}
.hero__inner { position: relative; z-index: 3; max-width: 860px; }

.hero__name {
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  font-weight: 700;
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
  background: linear-gradient(110deg, var(--text) 0%, var(--text) 35%, var(--violet) 48%, var(--cyan) 58%, var(--text) 70%, var(--text) 100%);
  background-size: 260% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: nameShimmer 7s linear infinite;
  /* Break at the character the typing has actually reached, rather than
     relocating a whole already-typed word to the next line once it no
     longer fits — that whole-word relocation is what read as the text
     "jumping" left/right during typing. */
  overflow-wrap: break-word;
  word-break: break-word;
  /* Reserves room for the longest looping phrase wrapping onto multiple
     lines, so the page content below doesn't jump as shorter/longer
     phrases cycle through — only the name is shown statically if
     reduced-motion disables the loop, so this is a harmless minimum. */
  min-height: 2.5em;
}
@keyframes nameShimmer {
  from { background-position: 0% center; }
  to { background-position: -260% center; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__name { animation: none; background-position: 0 center; min-height: 0; }
}

.hero__greeting {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 500;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  margin-left: 4px;
  vertical-align: -0.08em;
  background: var(--cyan);
  animation: cursorBlink 0.9s step-end infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .typing-cursor { animation: none; opacity: 0.7; }
}
.hero__role {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 600;
  margin-bottom: 18px;
}
.hero__bio {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin-bottom: 22px;
}
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.hero__fact {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero__fact svg { color: var(--cyan); flex-shrink: 0; }
.status-dot-sm {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
  flex-shrink: 0;
}
.hero__actions { display: flex; gap: 16px; flex-wrap: wrap; }

.hero__scroll {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 34px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  z-index: 1;
}
.hero__scroll span {
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--cyan);
  animation: scrollDot 1.8s infinite;
}
@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__scroll span { animation: none; }
}

/* =========================================================
   SECTIONS (shared)
========================================================= */
.section { padding: 96px 0; position: relative; scroll-margin-top: 80px; }
.section--alt { background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.035), transparent); }

/* ---- About ---- */
.about__grid {
  display: grid;
  grid-template-columns: auto 1.3fr 1fr;
  gap: 40px;
  align-items: start;
}
.about__avatar { flex-shrink: 0; }

/* ---- Avatar (hero + about) — real photo via personal.avatarUrl, or an
   auto-generated initials badge in the site's gradient as a placeholder.
   Shared rules size/frame both the <img> and the generated <svg>. ---- */
.hero__avatar, .about__avatar { position: relative; border-radius: 50%; }
.hero__avatar { width: 108px; height: 108px; margin-bottom: 18px; }
.about__avatar { width: 128px; height: 128px; }
.hero__avatar::before, .about__avatar::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--gradient);
  z-index: -1;
  opacity: 0.9;
}
.avatar-img, .avatar-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
}
.about__text { color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; }
.about__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat__value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; }
.stat__label { color: var(--text-faint); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- GitHub Activity (live, fetched client-side — see js/github.js) ---- */
.github__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}
.github__grid .stat__value { display: flex; align-items: baseline; gap: 6px; }
.github__note {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 22px;
}
.github__note a { color: var(--cyan); border-bottom: 1px solid rgba(34, 211, 238, 0.3); }
.github__repos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 26px;
}
.repo-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  animation: repoFadeIn 0.6s var(--ease) forwards;
}
@keyframes repoFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .repo-card { animation: none; }
}
.repo-card__name { font-family: var(--font-mono); font-size: 0.88rem; color: var(--text); }
.repo-card__desc { color: var(--text-muted); font-size: 0.85rem; margin: 6px 0 10px; }
.repo-card__meta { display: flex; gap: 14px; color: var(--text-faint); font-size: 0.78rem; font-family: var(--font-mono); }
.repo-card__meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Skills ---- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.skill-card__title { color: var(--cyan); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 18px; }
.skill-list { display: flex; flex-direction: column; gap: 14px; }
.skill-row__top { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 6px; }
.skill-row__pct { color: var(--text-faint); }
.skill-bar { height: 5px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; }
.skill-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--gradient);
  border-radius: 4px;
  transition: width 1.1s var(--ease);
}

/* ---- Experience timeline ---- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 46px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--violet), transparent);
}
.timeline__item { position: relative; padding-left: 34px; }
.timeline__marker {
  position: absolute; left: 0; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}
.timeline__period { color: var(--text-faint); font-size: 0.78rem; margin-bottom: 6px; }
.timeline__role { font-size: 1.25rem; font-weight: 600; }
.timeline__company { color: var(--text-muted); margin: 4px 0 14px; font-size: 0.94rem; }
.timeline__points { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.timeline__points li { color: var(--text-muted); position: relative; padding-left: 18px; font-size: 0.95rem; }
.timeline__points li::before { content: "→"; position: absolute; left: 0; color: var(--violet); }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.25);
  color: #c9bfff;
}

/* ---- Projects ---- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}
.project-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.project-card:hover { transform: translateY(-6px); border-color: var(--border-strong); }
.project-card__glow {
  position: absolute; top: -60%; right: -30%;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(124,92,255,0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.project-card:hover .project-card__glow { opacity: 1; }
.project-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.project-card__head h3 { font-size: 1.15rem; font-weight: 600; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(255, 184, 77, 0.14);
  color: var(--amber);
  border: 1px solid rgba(255, 184, 77, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.project-card__desc { color: var(--text-muted); font-size: 0.94rem; margin-bottom: 16px; }
.project-card__hint { color: var(--text-faint); font-size: 0.8rem; margin-top: 14px; }
.project-card__foot .project-card__hint { margin: 0; }

/* ---- Interests / curiosity ---- */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.interest-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.interest-card:hover { transform: translateY(-6px); border-color: var(--border-strong); }
.interest-card__icon {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.35));
}
.interest-card__icon svg { width: 100%; height: 100%; }
.interest-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; }
.interest-card p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* ---- Icon motion: robot bob/blink, firing neurons, orbiting electron,
   pulsing circuit traces. All original, drawn/authored for this site. ---- */
.robot-bob { transform-box: view-box; animation: robotBob 3.2s ease-in-out infinite; }
@keyframes robotBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.robot-eye { transform-box: fill-box; transform-origin: center; animation: robotBlink 4.6s ease-in-out infinite; }
.robot-eye--r { animation-delay: 0.08s; }
@keyframes robotBlink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.15); } }
.robot-antenna { animation: antennaPulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes antennaPulse { 0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 transparent); } 50% { opacity: 0.55; filter: drop-shadow(0 0 4px currentColor); } }

.ai-node { animation: aiFire 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ai-node--core { animation-name: aiFireCore; }
@keyframes aiFire { 0%, 100% { opacity: 0.5; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1.15); } }
@keyframes aiFireCore { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.2); } }

.orbit-ring { transform-box: fill-box; transform-origin: center; }
.orbit-ring--1 { animation: ring1Spin 10s linear infinite; }
.orbit-ring--2 { animation: ring2Spin 7s linear infinite reverse; }
.orbit-ring--3 { animation: ring3Spin 13s linear infinite; }
/* Each ring's starting tilt (0deg / 60deg / 120deg) is baked into its own
   keyframes rather than left on the SVG `transform` attribute — a CSS
   `transform` animation silently overrides any XML transform attribute
   on the same element, so the old approach collapsed all three rings
   onto the same (untilted) orientation once animated. */
@keyframes ring1Spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes ring2Spin { from { transform: rotate(60deg); } to { transform: rotate(420deg); } }
@keyframes ring3Spin { from { transform: rotate(120deg); } to { transform: rotate(480deg); } }
.quantum-nucleus { animation: nucleusPulse 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nucleusPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.chip-legs { animation: chipPulse 1.1s linear infinite; }
@keyframes chipPulse { to { stroke-dashoffset: -8; } }
.chip-core { animation: nucleusPulse 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.chip-arrow { transform-box: fill-box; transform-origin: center; animation: chipArrowFloat 2.4s ease-in-out infinite; }
@keyframes chipArrowFloat { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(2px, -2px); } }

@media (prefers-reduced-motion: reduce) {
  .robot-bob, .robot-eye, .robot-antenna, .ai-node, .orbit-ring,
  .quantum-nucleus, .chip-legs, .chip-core, .chip-arrow {
    animation: none !important;
    transform: none !important;
  }
}
.project-card__hint { transition: color 0.2s; }
.project-card:hover .project-card__hint, .project-card:focus-visible .project-card__hint { color: var(--cyan); }

/* ---- Certifications ---- */
.certs__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; gap: 16px; align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.cert-card:hover, .cert-card:focus-visible { border-color: rgba(34, 211, 238, 0.4); transform: translateY(-3px); }
.cert-card__badge {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
}
.cert-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.cert-card__meta { color: var(--text-faint); font-size: 0.82rem; }

/* ---- Education ---- */
.edu-list { display: flex; flex-direction: column; gap: 28px; }
.edu-item {
  border-left: 2px solid var(--border);
  padding-left: 22px;
}
.edu-item h3 { font-size: 1.1rem; margin: 4px 0; }
.edu-item__school { color: var(--text-muted); font-size: 0.95rem; }
.edu-item__details { color: var(--text-faint); font-size: 0.88rem; margin-top: 6px; }

/* ---- Contact ---- */
.contact__inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact__lead { color: var(--text-muted); max-width: 480px; margin: 0 auto 34px; }
.contact__links { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.social-row { display: flex; gap: 16px; }
.social-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.social-icon:hover { color: var(--cyan); border-color: var(--cyan); transform: translateY(-3px); }

/* =========================================================
   FOOTER
========================================================= */
.footer {
  position: relative;
  border-top: 1px solid var(--border);
  padding: 52px 0 0;
}
.footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: var(--gradient);
  opacity: 0.5;
}
.footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 32px;
  align-items: start;
  padding-bottom: 36px;
}
.footer__brand { display: flex; flex-direction: column; gap: 14px; max-width: 340px; }
.footer__logo { width: 40px; height: 40px; }
.footer__tagline { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.footer__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.footer__nav a { color: var(--text-muted); transition: color 0.2s; }
.footer__nav a:hover { color: var(--cyan); }
.footer .social-row { gap: 12px; }
.footer .social-icon { width: 38px; height: 38px; }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.78rem;
}
.footer__top-link { color: var(--text-faint); transition: color 0.2s; }
.footer__top-link:hover { color: var(--cyan); }
@media (max-width: 760px) {
  .footer__top { grid-template-columns: 1fr; gap: 26px; }
}

/* =========================================================
   RESUME PREVIEW MODAL — view-only, no download affordance
========================================================= */
.resume-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.resume-modal.is-open { opacity: 1; pointer-events: auto; }
.resume-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 12, 0.78);
  backdrop-filter: blur(6px);
}
.resume-modal__panel {
  position: relative;
  width: min(880px, 100%);
  height: min(86vh, 1000px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.3s var(--ease);
}
.resume-modal.is-open .resume-modal__panel { transform: translateY(0) scale(1); }
.resume-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}
.resume-modal__close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}
.resume-modal__close:hover { color: var(--text); border-color: var(--border-strong); }
.resume-modal__body { flex: 1; background: #fff; }
.resume-modal__body iframe { width: 100%; height: 100%; border: none; }
@media (prefers-reduced-motion: reduce) {
  .resume-modal, .resume-modal__panel { transition: none; }
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 900px) {
  .about__grid { grid-template-columns: 1fr; gap: 36px; }
  .about__avatar { width: 96px; height: 96px; }
}

@media (max-width: 760px) {
  .nav__links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(9, 11, 20, 0.97);
    backdrop-filter: blur(16px);
    padding: 26px 24px;
    gap: 20px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .nav__links.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav__toggle { display: flex; }
  .nav__resume { display: none; }

  .section { padding: 76px 0; }
  .about__stats { grid-template-columns: 1fr 1fr; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { justify-content: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .stat__value { font-size: 1.7rem; }
  .cert-card { flex-direction: column; }
  .hero { box-shadow: inset 0 0 12vw 3vw rgba(5, 6, 12, 0.6); }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================
   PAGE HEADER — used by every non-Home page instead of a full hero
========================================================= */
.page-header {
  padding: 150px 0 50px;
  position: relative;
  overflow: hidden;
}
.page-header .container { position: relative; z-index: 1; }
.page-header { --title-size: clamp(2rem, 4.5vw, 3.2rem); }
.page-header__title {
  font-size: var(--title-size);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.page-header__subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
}
@media (max-width: 640px) {
  .page-header { padding: 120px 0 40px; }
}

/* =========================================================
   HOME — welcome message + quotes + cosmic/math/AI decoration
========================================================= */
.welcome { position: relative; overflow: hidden; }
.welcome .container { position: relative; z-index: 1; }

.welcome__message {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 62ch;
  margin-bottom: 44px;
}
.cosmic-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.cosmic-bg canvas { width: 100%; height: 100%; opacity: 0.55; }

.float-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.float-item {
  position: absolute;
  animation: floatDrift linear infinite;
  will-change: transform;
}
.float-item--eq {
  font-family: var(--font-mono);
  color: var(--text-faint);
  opacity: 0.32;
  white-space: nowrap;
}
.float-item--symbol {
  font-family: var(--font-mono);
  color: var(--text-faint);
  opacity: 0.28;
  white-space: nowrap;
  font-weight: 600;
}
.float-item--chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
  opacity: 0.55;
}
.float-item--icon { opacity: 0.4; color: var(--text-muted); }
.float-item--icon svg { width: 34px; height: 34px; }
@keyframes floatDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(18px, -22px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .float-item { animation: none; }
}

.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}
.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius-sm);
  padding: 22px 24px;
  margin: 0;
}
.quote-card p {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  font-style: italic;
}

/* =========================================================
   BLOG / ARTICLES
========================================================= */
.blog__controls {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.blog__select-wrap { position: relative; flex: 1 1 320px; min-width: 260px; max-width: 460px; }
.blog__meta { color: var(--text-faint); font-size: 0.85rem; font-family: var(--font-mono); }

.article-body {
  max-width: 980px;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.75;
}
.article-body h1, .article-body h2, .article-body h3 {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  margin: 1.6em 0 0.6em;
  line-height: 1.3;
}
.article-body h1 { font-size: 1.9rem; }
.article-body h2 { font-size: 1.5rem; }
.article-body h3 { font-size: 1.2rem; }
.article-body > p, .article-body > ul, .article-body > ol,
.article-body > blockquote, .article-body > h1, .article-body > h2,
.article-body > h3, .article-body > h4, .article-body > hr { max-width: 72ch; }
.article-body p { margin: 0 0 1.1em; }
.article-body ul, .article-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.article-body li { margin-bottom: 0.4em; }
.article-body a { color: var(--cyan); border-bottom: 1px solid rgba(34, 211, 238, 0.35); }
.article-body strong { color: var(--text); }
.article-body blockquote {
  border-left: 3px solid var(--violet);
  padding: 4px 0 4px 18px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 1.1em;
}
.article-body code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
  color: var(--cyan);
}
.article-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1.1em;
}
.article-body pre code { background: none; border: none; padding: 0; color: var(--text); }
.article-body img { max-width: 100%; border-radius: var(--radius-sm); margin: 0.5em 0; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.blog__loading, .blog__error { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.9rem; }

/* =========================================================
   CONTACT FORM
========================================================= */
.contact__layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 50px;
  align-items: start;
}
.contact-form { display: flex; flex-direction: column; gap: 18px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.form-field input, .form-field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  resize: vertical;
}
.form-field input:focus-visible, .form-field textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}
.form-note {
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.6;
}
.contact-aside {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.contact-aside h3 { font-size: 1.05rem; margin-bottom: 14px; }
.contact-aside .social-row { margin-top: 18px; }
@media (max-width: 800px) {
  .contact__layout { grid-template-columns: 1fr; }
}

.floating-bot { position: absolute; opacity: 0.45; pointer-events: none; }
.floating-bot--1 { width: 92px; height: 92px; top: 6%; right: 6%; }
.floating-bot--2 { width: 70px; height: 70px; bottom: 8%; left: 4%; }
@media (max-width: 700px) {
  .floating-bot { display: none; }
}

/* =========================================================
   DETAIL MODAL — project/certification click-to-expand
========================================================= */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.detail-modal.is-open { opacity: 1; pointer-events: auto; }
.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 12, 0.78);
  backdrop-filter: blur(6px);
}
.detail-modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 36px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.3s var(--ease);
}
.detail-modal.is-open .detail-modal__panel { transform: translateY(0) scale(1); }
.detail-modal__close {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: color 0.2s, border-color 0.2s;
}
.detail-modal__close:hover { color: var(--text); border-color: var(--border-strong); }
.detail-modal__eyebrow { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.detail-modal__body h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 14px; padding-right: 30px; }
.detail-modal__meta { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 14px; }
.detail-modal__desc { color: var(--text-muted); line-height: 1.7; margin-bottom: 18px; }
.detail-modal__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.detail-modal__gallery img { width: 100%; border-radius: var(--radius-sm); }
.detail-modal__placeholder {
  height: 160px;
  border-radius: var(--radius-sm);
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.detail-modal__placeholder span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  color: rgba(6, 7, 19, 0.55);
  letter-spacing: 0.05em;
}
.detail-modal__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.detail-modal__note { color: var(--text-faint); font-size: 0.88rem; }
@media (prefers-reduced-motion: reduce) {
  .detail-modal, .detail-modal__panel { transition: none; }
}
@media (max-width: 600px) {
  .detail-modal__panel { padding: 26px 20px; }
}


/* ---- Contact page closing illustration ---- */
.contact-illustration { text-align: center; }
.contact-illustration__img {
  max-width: 380px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 20px 40px rgba(124, 92, 255, 0.2));
}
@media (max-width: 480px) {
  .contact-illustration__img { max-width: 260px; }
}

/* ---- Home page closing illustration: robot surrounded by seven images ---- */
.home-illustration { text-align: center; }
/* Desktop: circle | robot cluster (centred) | circle. The two side columns
   share the leftover space equally, so the cluster stays exactly centred and
   each circle sits in the middle of its side. */
.orbit-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
}
.orbit-stage {
  position: relative;
  width: clamp(340px, 42vw, 520px);
  aspect-ratio: 472 / 462;   /* proportions measured from the reference layout */
}
.orbit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  translate: -50% -50%;      /* centre on (--x, --y); separate from the reveal transform */
}
/* The two spinning circles (same spin + blink as always:
   .spin-slow / .spin-slow--reverse). */
.orbit-deco { width: clamp(96px, 12vw, 150px); margin-top: 6%; }
.orbit-deco img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.85;
}
/* Mobile / narrow: circle above, cluster, circle below. */
@media (max-width: 760px) {
  .orbit-row { grid-template-columns: 1fr; row-gap: 26px; }
  .orbit-stage { width: min(100%, 440px); }
  .orbit-deco { width: 112px; margin-top: 0; }
}
.orbit img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 26px rgba(34, 211, 238, 0.16));
  animation: orbitFloat var(--t, 6.5s) ease-in-out var(--fd, 0s) infinite;
  transition: scale 0.4s var(--ease), filter 0.4s var(--ease);
}
.orbit:hover img {
  scale: 1.07;
  filter: drop-shadow(0 12px 30px rgba(34, 211, 238, 0.5));
}
.orbit--robot img {
  filter: drop-shadow(0 20px 40px rgba(124, 92, 255, 0.35));
  animation: robotFloat 4.5s ease-in-out infinite;
}
.orbit--robot:hover img { scale: 1.03; }
@keyframes orbitFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
@keyframes robotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@media (max-width: 600px) {
  @keyframes orbitFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
}
@media (prefers-reduced-motion: reduce) {
  .orbit img, .orbit--robot img { animation: none; }
}

/* ---- Slow rotation + blink (digital-circle decorations flanking the
   robot). Two concurrent animations — rotate on transform, blink on
   opacity — don't conflict since they target different properties.
   The --reverse modifier swaps in a mirrored keyframe (negative
   rotation) rather than using animation-direction, so it's a single,
   unambiguous source of truth for which way each copy spins. ---- */
.spin-slow {
  animation-name: spinSlow, blinkSlow;
  animation-duration: 18s, 4.5s;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
}
.spin-slow--reverse {
  animation-name: spinSlowReverse, blinkSlow;
}
@keyframes spinSlow {
  to { transform: rotate(360deg); }
}
@keyframes spinSlowReverse {
  to { transform: rotate(-360deg); }
}
@keyframes blinkSlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .spin-slow, .spin-slow--reverse { animation: none; }
}

/* =========================================================
   PREVIOUS / NEXT PAGE NAVIGATION
========================================================= */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-top: 32px;
  padding-bottom: 56px;
}
.page-nav__btn {
  gap: 14px;
  padding: 14px 26px;
  text-align: left;
}
.page-nav__btn--next { text-align: right; margin-left: auto; }
.page-nav__text { display: flex; flex-direction: column; line-height: 1.25; }
.page-nav__kicker {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.page-nav__label { font-family: var(--font-display); font-size: 1.05rem; }
.page-nav__arrow { font-size: 1.2rem; transition: transform 0.25s var(--ease); }
.page-nav__btn--prev:hover .page-nav__arrow { transform: translateX(-4px); }
.page-nav__btn--next:hover .page-nav__arrow { transform: translateX(4px); }
.page-nav__btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
@media (max-width: 480px) {
  .page-nav { gap: 10px; padding-top: 40px; padding-bottom: 40px; }
  .page-nav__btn { padding: 12px 16px; gap: 10px; }
  .page-nav__label { font-size: 0.95rem; }
}

/* =========================================================
   DETAIL MODAL — certificate image + education course list
========================================================= */
.detail-modal__cert { margin: 0 0 18px; }
.detail-modal__cert img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.detail-modal__cert-placeholder {
  min-height: 140px;
  margin-bottom: 18px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-faint);
  font-size: 0.88rem;
}
.detail-modal__subhead { font-size: 1rem; margin: 6px 0 12px; color: var(--text); }
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.course-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.edu-item__more { margin-top: 12px; }
.edu-item__more:hover span { transform: translateX(3px); }
.edu-item__more span { display: inline-block; transition: transform 0.2s var(--ease); }

/* =========================================================
   VISION & MISSION (About)
========================================================= */
.vm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
  /* On narrower screens there isn't enough page margin for the robots that hang outside
     the cards, so the grid gets extra side padding (0 when the margins are already wide enough). */
  padding-inline: max(0px, calc(62px - max(24px, calc((100vw - var(--container)) / 2 + 24px))));
}
.vm-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 32px;
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.vm-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gradient);
}
.vm-slot { position: relative; container-type: inline-size; transition: transform 0.3s var(--ease); }
.vm-slot:hover { transform: translateY(-5px); }
.vm-card:hover { border-color: var(--border-strong); }
.vm-card__icon { width: 44px; height: 44px; color: var(--cyan); margin-bottom: 16px; }
.vm-card--vision .vm-card__icon { color: var(--violet); }
.vm-card__icon svg { width: 100%; height: 100%; }
.vm-card__title {
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px;
}
.vm-card p { font-size: 1.05rem; line-height: 1.75; color: var(--text); }

/* =========================================================
   ART GALLERY (About)
========================================================= */
.art-quote { max-width: 760px; margin: 0 auto 40px; text-align: center; }
.art-quote blockquote p {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  line-height: 1.5;
  font-weight: 500;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.art-quote figcaption { margin-top: 14px; color: var(--text-faint); font-size: 0.85rem; }

.art-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 260px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-elevated);
  text-align: left;
  transition: transform 0.35s var(--ease), border-color 0.3s var(--ease);
}
.art-cover:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.art-cover:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.art-cover__mosaic { position: absolute; inset: 0; display: grid; gap: 3px; }
.art-cover--n1 .art-cover__mosaic { grid-template-columns: 1fr; }
.art-cover--n2 .art-cover__mosaic { grid-template-columns: 1fr 1fr; }
.art-cover--n3 .art-cover__mosaic { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.art-cover--n3 .art-cover__tile:first-child { grid-row: 1 / span 2; }
.art-cover__tile { position: relative; overflow: hidden; min-height: 0; }
.art-cover__tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.6s var(--ease);
}
.art-cover:hover .art-cover__tile img { transform: scale(1.06); }
.art-cover__overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 56px 28px 22px;
  background: linear-gradient(180deg, transparent, rgba(6, 7, 19, 0.88));
}
.art-cover__title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: #fff; }
.art-cover__meta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 0.82rem; color: rgba(255, 255, 255, 0.75);
}
.art-cover__open { color: var(--cyan); }
.art-cover__open span { display: inline-block; transition: transform 0.25s var(--ease); }
.art-cover:hover .art-cover__open span { transform: translateX(4px); }

.art-placeholder {
  width: 100%; height: 100%; min-height: 100px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-faint);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(34, 211, 238, 0.1));
}
.art-placeholder svg { width: 38px; height: 38px; opacity: 0.8; }

/* ---- full-screen gallery ---- */
.art-modal {
  position: fixed; inset: 0; z-index: 220;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.art-modal.is-open { opacity: 1; pointer-events: auto; }
.art-modal__backdrop { position: absolute; inset: 0; background: rgba(5, 6, 12, 0.88); backdrop-filter: blur(8px); }
.art-modal__panel {
  position: relative;
  width: min(1100px, 100%);
  max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.3s var(--ease);
}
.art-modal.is-open .art-modal__panel { transform: none; }
.art-modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.art-modal__head h3 { font-size: 1.4rem; font-weight: 700; }
.art-modal__head p { color: var(--text-faint); font-size: 0.82rem; margin-top: 4px; }
.art-modal__close {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  color: var(--text-muted); background: var(--surface);
  transition: color 0.2s, border-color 0.2s;
}
.art-modal__close:hover { color: var(--text); border-color: var(--border-strong); }
.art-grid {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding-right: 4px;
}
.art-grid__item {
  position: relative; display: block; padding: 0;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden; cursor: zoom-in;
  background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.art-grid__item:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.art-grid__item:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.art-grid__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.art-grid__item:hover img { transform: scale(1.07); }
.art-grid__label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 10px 8px;
  font-size: 0.8rem; color: #fff; text-align: left;
  background: linear-gradient(180deg, transparent, rgba(6, 7, 19, 0.85));
  opacity: 0; transition: opacity 0.25s;
}
.art-grid__item:hover .art-grid__label, .art-grid__item:focus-visible .art-grid__label { opacity: 1; }
.art-empty { grid-column: 1 / -1; color: var(--text-muted); line-height: 1.7; padding: 24px 4px; }

/* ---- enlarged picture ---- */
.art-lightbox {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  padding: 64px 72px 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.art-lightbox.is-open { opacity: 1; pointer-events: auto; }
.art-lightbox__backdrop { position: absolute; inset: 0; background: #04050a; border-radius: var(--radius); }
.art-lightbox__figure {
  position: relative; margin: 0;
  max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  transform: scale(0.94);
  transition: transform 0.35s var(--ease);
}
.art-lightbox.is-open .art-lightbox__figure { transform: scale(1); }
.art-lightbox__figure img {
  max-width: 100%; max-height: calc(100vh - 200px);
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.3s;
}
.art-lightbox__figure img.is-loaded { opacity: 1; }
.art-lightbox__figure figcaption {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-width: 680px; text-align: center;
}
.art-caption__text { display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }
.art-caption__text strong { color: var(--text); font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.art-caption__count { color: var(--text-faint); font-size: 0.78rem; }
.art-lightbox__btn {
  position: absolute; z-index: 3;
  color: var(--text); background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong); border-radius: 999px;
  transition: background 0.2s;
}
.art-lightbox__btn:hover { background: rgba(255, 255, 255, 0.18); }
.art-lightbox__btn[hidden] { display: none; }
.art-lightbox__back { top: 18px; left: 18px; padding: 8px 16px; font-size: 0.9rem; }
.art-lightbox__prev, .art-lightbox__next { top: 50%; width: 46px; height: 46px; margin-top: -23px; font-size: 1.8rem; line-height: 1; padding-bottom: 4px; }
.art-lightbox__prev { left: 16px; }
.art-lightbox__next { right: 16px; }
@media (max-width: 700px) {
  .art-cover { aspect-ratio: 4 / 3; }
  .art-cover__title { font-size: 1.2rem; }
  .art-modal { padding: 10px; }
  .art-modal__panel { padding: 18px; }
  .art-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .art-lightbox { padding: 60px 12px 16px; }
  .art-lightbox__prev, .art-lightbox__next { top: auto; bottom: 14px; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .art-modal, .art-modal__panel, .art-lightbox, .art-lightbox__figure,
  .art-cover, .art-cover__tile img, .art-grid__item, .art-grid__item img { transition: none; }
}

/* =========================================================
   BLOG DROPDOWN (custom, themed — replaces the native <select>)
========================================================= */
.dropdown { position: relative; }
.dropdown__btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.dropdown__btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.dropdown__btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dropdown.is-open .dropdown__btn { border-color: rgba(124, 92, 255, 0.55); background: var(--surface-hover); }
.dropdown__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown__chev { color: var(--text-muted); transition: transform 0.25s var(--ease); }
.dropdown.is-open .dropdown__chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .dropdown__chev { transition: none; } }

/* =========================================================
   ARTICLE RICH CONTENT — images, diagrams, charts, tables
========================================================= */
.md-figure { margin: 1.4em 0; }
.md-figure figcaption { margin-top: 8px; color: var(--text-faint); font-size: 0.86rem; text-align: center; }
.article-body .md-img-link { display: block; width: fit-content; max-width: 100%; margin: 0 auto; border-bottom: none; }
.article-body p > .md-img-link { display: inline-block; }
.article-body .md-img-link img {
  display: block; max-width: 100%; height: auto; margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.md-img-missing { display: inline-block; color: var(--text-faint); font-size: 0.82rem; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

.md-visual {
  margin: 1.4em 0;
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.md-visual--loading { color: var(--text-faint); font-size: 0.85rem; text-align: center; padding: 36px 18px; }
.md-diagram { overflow-x: auto; text-align: center; }
.md-diagram svg { max-width: 100%; height: auto; }
.md-diagram .nodeLabel, .md-diagram .edgeLabel { line-height: 1.35; }
.md-chart { margin-left: 0; margin-right: 0; }
.md-chart__canvas { position: relative; height: 360px; }
@media (max-width: 600px) { .md-chart__canvas { height: 280px; } .md-visual { padding: 12px; } }
.md-notice { margin: 1.4em 0; border: 1px solid rgba(255, 184, 77, 0.35); background: rgba(255, 184, 77, 0.06); border-radius: var(--radius-sm); padding: 14px 16px; }
.md-notice p { margin: 0 0 10px; color: var(--amber); font-size: 0.82rem; }
.md-notice pre { margin: 0; max-height: 260px; }

.article-body table {
  display: block; width: 100%; max-width: 100%; overflow-x: auto;
  border-collapse: collapse; margin: 0 0 1.4em; font-size: 0.94rem;
}
.article-body th, .article-body td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.article-body th { background: var(--surface-hover); color: var(--text); font-family: var(--font-display); font-weight: 600; }
.article-body tr:nth-child(even) td { background: var(--surface); }

/* =========================================================
   WELCOME SPLASH (Home) — js/welcome-splash.js
========================================================= */
html.splash-lock, html.splash-lock body { overflow: hidden; }
html.splash-off #welcome-splash { display: none; }

.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, #121233 0%, #070914 60%, #04050a 100%);
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transition:
    opacity var(--exit, 2400ms) cubic-bezier(0.4, 0, 0.2, 1),
    transform var(--exit, 2400ms) cubic-bezier(0.4, 0, 0.2, 1),
    filter var(--exit, 2400ms) cubic-bezier(0.4, 0, 0.2, 1);
}
.splash.is-leaving { opacity: 0; transform: scale(1.12); filter: blur(10px); pointer-events: none; }
.splash__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.splash__glow {
  position: absolute; left: 50%; top: 46%;
  width: min(900px, 120vw); height: min(900px, 120vw);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(124, 92, 255, 0.28), rgba(34, 211, 238, 0.1) 40%, transparent 68%);
  animation: splashGlow 6s ease-in-out infinite;
}
@keyframes splashGlow { 0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(0.95); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } }

.splash__center {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 14px; max-width: 900px;
}
.splash__logo { position: relative; width: 84px; height: 84px; margin-bottom: 14px; display: grid; place-items: center; }
.splash__logo-mark { width: 84px; height: 84px; opacity: 0; transform: scale(0.5) rotate(-12deg); }
.splash__logo-mark svg, .splash__logo-mark img { width: 100%; height: 100%; display: block; border-radius: 22%; filter: drop-shadow(0 0 22px rgba(34, 211, 238, 0.55)); }
.splash.is-playing .splash__logo-mark { animation: splashLogoIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards; }
@keyframes splashLogoIn { to { opacity: 1; transform: none; } }
.splash__ring {
  position: absolute; inset: 0; border-radius: 22%;
  border: 1.5px solid rgba(124, 92, 255, 0.55);
  opacity: 0;
}
.splash.is-playing .splash__ring { animation: splashRing 3.2s cubic-bezier(0.2, 0.6, 0.3, 1) infinite; }
.splash__ring:nth-child(2) { animation-delay: 1.05s !important; border-color: rgba(34, 211, 238, 0.5); }
.splash__ring:nth-child(3) { animation-delay: 2.1s !important; }
@keyframes splashRing { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(3.6); } }

.splash__hello {
  color: var(--cyan); font-size: 0.85rem; letter-spacing: 0.14em;
  opacity: 0;
}
.splash.is-playing .splash__hello { animation: splashFade 1s ease 0.5s forwards; }
@keyframes splashFade { to { opacity: 0.9; } }

.splash__lines { display: flex; flex-direction: column; gap: 10px; }
.splash__line {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.2vw, 2.7rem);
  line-height: 1.25;
  color: var(--text);
}
.splash__line--last {
  font-size: clamp(1.8rem, 5.4vw, 3.5rem);
  font-weight: 700;
}
/* Gradient is applied per word: background-clip:text on the parent doesn't
   paint through children that are individually animated (own compositing layer). */
.splash__line--last .splash__word {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  padding-bottom: 0.08em;
}
.splash__word {
  display: inline-block;
  opacity: 0;
  transform: translateY(26px);
  filter: blur(8px);
}
.splash.is-playing .splash__word { animation: splashWord 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms) forwards; }
@keyframes splashWord { to { opacity: 1; transform: none; filter: blur(0); } }

.splash__progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(255, 255, 255, 0.06); z-index: 2;
}
.splash__progress span {
  display: block; height: 100%; width: 0;
  background: var(--gradient);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.7);
}
.splash.is-playing .splash__progress span { animation: splashBar var(--total, 6000ms) linear forwards; }
@keyframes splashBar { to { width: 100%; } }

.splash__skip {
  position: absolute; z-index: 3; right: 22px; bottom: 24px;
  padding: 9px 16px; font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong); border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.splash__skip:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.splash__skip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* The landing page settles gently into place while the splash dissolves. */
body.splash-reveal #main { animation: homeFadeIn var(--reveal, 3000ms) cubic-bezier(0.4, 0, 0.2, 1) both; }
body.splash-reveal .hero canvas { animation: heroSettle var(--reveal, 3000ms) cubic-bezier(0.22, 1, 0.36, 1) both; }
body.splash-reveal #nav { animation: homeFadeIn var(--reveal, 3000ms) cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes homeFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes heroSettle { from { transform: scale(1.14); } to { transform: none; } }

@media (max-width: 600px) {
  .splash__logo, .splash__logo-mark { width: 68px; height: 68px; }
  .splash__skip { right: 14px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash__glow, .splash.is-playing .splash__ring { animation: none; }
  .splash.is-leaving { transform: none; filter: none; }
  .splash__word { transform: none; filter: none; }
  .splash.is-playing .splash__word { animation-duration: 0.6s; }
  body.splash-reveal .hero canvas { animation: none; }
}

/* ---- Robotic hand resting on the Next button ---- */
.page-nav__next {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: fit-content;      /* as wide as the Next button */
}
.page-nav__next .page-nav__btn--next { margin-left: 0; }
.page-nav__hand {
  display: block;
  /* Contributes no width of its own, then fills the button's width, so the
     image is always sized relative to the Next button (and scales with it). */
  width: 0;
  min-width: calc(100% * var(--hand-scale, 1));   /* 1 = same width as the button */
  height: auto;
  aspect-ratio: 460 / 601;
  margin: 0;               /* no gap: the fingertip sits on the button's top edge */
  pointer-events: none;
  user-select: none;
  /* Hidden until scrolled into view, then revealed slowly bottom -> top
     (a soft feathered edge rises up through the image). */
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 41.6%, transparent 56.2%);
          mask-image: linear-gradient(to top, #000 0%, #000 41.6%, transparent 56.2%);
  -webkit-mask-size: 100% 240%;
          mask-size: 100% 240%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
          mask-position: 0 0;
  transition:
    -webkit-mask-position 3.4s cubic-bezier(0.4, 0.05, 0.35, 1),
    mask-position 3.4s cubic-bezier(0.4, 0.05, 0.35, 1);
}
.page-nav__next.is-visible .page-nav__hand {
  -webkit-mask-position: 0 100%;
          mask-position: 0 100%;
}
@media (prefers-reduced-motion: reduce) {
  .page-nav__hand { transition: none; }
}
@media (max-width: 480px) {
  .page-nav { padding-top: 24px; }
}

/* =========================================================
   CLICKABLE ROBOT + IMAGES (Home) and their explanation popup
========================================================= */
.orbit__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}
.orbit__btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }
.orbit-hint {
  margin-top: 26px;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.explain { display: flex; gap: 22px; align-items: flex-start; }
.explain__fig {
  flex: 0 0 150px;
  margin: 0;
  min-height: 150px;
  display: grid; place-items: center;
  padding: 14px;
  background: radial-gradient(circle at 50% 45%, rgba(124, 92, 255, 0.2), rgba(34, 211, 238, 0.06) 60%, transparent 80%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.explain__fig img { display: block; max-width: 100%; max-height: 190px; width: auto; height: auto; }
.explain__text { flex: 1; min-width: 0; margin-bottom: 0; }
.explain__text p { margin: 0 0 0.9em; }
.explain__text p:last-child { margin-bottom: 0; }
.explain__voice { margin-top: 22px; }
.explain__listen { min-width: 128px; }
.explain__listen-icon { display: inline-block; margin-right: 8px; font-size: 0.85em; }
.explain__eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; opacity: 0; transition: opacity 0.3s; }
.explain__eq i { width: 4px; height: 6px; border-radius: 2px; background: var(--gradient); }
.explain__voice.is-speaking .explain__eq { opacity: 1; }
.explain__voice.is-speaking .explain__eq i { animation: eqBar 0.9s ease-in-out infinite; }
.explain__eq i:nth-child(2) { animation-delay: 0.15s !important; }
.explain__eq i:nth-child(3) { animation-delay: 0.3s !important; }
.explain__eq i:nth-child(4) { animation-delay: 0.45s !important; }
.explain__eq i:nth-child(5) { animation-delay: 0.6s !important; }
@keyframes eqBar { 0%, 100% { height: 6px; } 50% { height: 22px; } }
@media (max-width: 560px) {
  .explain { flex-direction: column; }
  .explain__fig { flex-basis: auto; width: 100%; }
  .explain__fig img { max-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .explain__voice.is-speaking .explain__eq i { animation: none; height: 14px; }
}

/* =========================================================
   RESTING ROBOT (About, just above the "About Me" heading) — wiped in left -> right
========================================================= */
.rest-mark {
  display: block;
  font-size: var(--title-size);          /* same size as the heading, so the width below tracks the heading text */
  width: 3.0em;                          /* "About Me" is about 4.4 x its font size wide (change this to resize) */
  height: auto;
  margin: 0 0 -0.1em 0.5em;            /* nearly touching the heading; left edge lines up with the text */
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
  /* Hidden until in view; then a soft feathered edge travels left -> right through the picture. */
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 41.6%, transparent 56.2%);
          mask-image: linear-gradient(to right, #000 0%, #000 41.6%, transparent 56.2%);
  -webkit-mask-size: 240% 100%;
          mask-size: 240% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
          mask-position: 100% 0;
  transition:
    -webkit-mask-position 2.6s cubic-bezier(0.4, 0.05, 0.35, 1),
    mask-position 2.6s cubic-bezier(0.4, 0.05, 0.35, 1);
}
.rest-mark.is-visible {
  -webkit-mask-position: 0 0;
          mask-position: 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .rest-mark { transition: none; -webkit-mask-position: 0 0; mask-position: 0 0; }
}

/* =========================================================
   BLOG — category groups, search, share links
========================================================= */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}



/* search box */
.blog-search { position: relative; flex: 1 1 280px; min-width: 240px; max-width: 520px; }
.blog-search__icon { position: absolute; left: 15px; top: 14px; color: var(--text-faint); pointer-events: none; }
.blog-search__input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 12px 40px 12px 42px;
  transition: background 0.2s, border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.blog-search__input::placeholder { color: var(--text-faint); }
.blog-search__input::-webkit-search-cancel-button { display: none; }
.blog-search__input:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.blog-search__input:focus { outline: none; border-color: rgba(124, 92, 255, 0.6); background: var(--surface-hover); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15); }
.blog-search__clear {
  position: absolute; right: 8px; top: 8px; width: 28px; height: 28px;
  border-radius: 6px; color: var(--text-muted); font-size: 0.8rem;
  background: transparent; border: 0; cursor: pointer;
}
.blog-search__clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.blog-search__clear[hidden] { display: none; }
.blog-search__list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  max-height: min(420px, 60vh); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: rgba(14, 17, 32, 0.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: ddIn 0.18s var(--ease);
}
.blog-search__list[hidden] { display: none; }
.blog-search__item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 14px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s;
}
.blog-search__item.is-active { background: rgba(124, 92, 255, 0.16); }
.blog-search__title { color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; line-height: 1.35; }
.blog-search__meta { color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.03em; }
.blog-search__snippet { color: var(--text-muted); font-size: 0.84rem; line-height: 1.5; }
.blog-search__empty { padding: 14px; color: var(--text-faint); font-size: 0.88rem; }
.blog-search mark { background: rgba(124, 92, 255, 0.4); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* under the article title: date, category, share buttons */
.article-tools {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px;
  margin: -0.2em 0 1.8em; padding-bottom: 1.2em;
  border-bottom: 1px solid var(--border);
}
.article-tools__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0; font-size: 0.82rem; color: var(--text-faint); }
.article-tools__cat {
  padding: 3px 10px; border-radius: 999px;
  color: var(--cyan); background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.25);
}
.article-tools__share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1;
  color: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-decoration: none;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.share-btn:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.share-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.share-btn--icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.share-btn.is-done { color: var(--cyan); border-color: rgba(34, 211, 238, 0.5); }
.share-btn[hidden] { display: none; }
.article-tools__status { flex-basis: 100%; min-height: 1.1em; margin: 0; font-size: 0.78rem; color: var(--cyan); }
.article-tools__status:empty { display: none; }
.blog__notice {
  margin: 0 0 1.4em; padding: 12px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.84rem; color: var(--amber);
  background: rgba(255, 184, 77, 0.07); border: 1px solid rgba(255, 184, 77, 0.35);
}
@media (max-width: 700px) {
  .blog__select-wrap, .blog-search { flex-basis: 100%; max-width: none; }
  .article-tools__share { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .blog-search__list { animation: none; } .share-btn { transition: none; } }

/* =========================================================
   BLOG CATEGORY MENU — categories, with a side panel of articles
========================================================= */
.cmenu__panels {
  position: absolute;
  z-index: 40;
  left: 0; right: 0; top: calc(100% + 8px);
}
.cmenu__panels[hidden], .cmenu__items[hidden] { display: none; }
.cmenu__panel {
  list-style: none; margin: 0; padding: 6px;
  background: rgba(14, 17, 32, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: ddIn 0.18s var(--ease);
}
.cmenu__cats { position: relative; }
.cmenu__items {
  position: absolute;
  left: calc(100% + 8px);
  width: min(420px, 90vw);
  max-height: min(380px, 70vh);
  overflow-y: auto;
  animation: cmIn 0.18s var(--ease);
}
@keyframes cmIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.cmenu__cat, .cmenu__item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 14px 11px 16px;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.4; text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cmenu__cat:hover, .cmenu__cat:focus-visible, .cmenu__cat.is-open,
.cmenu__item:hover, .cmenu__item:focus-visible { background: rgba(124, 92, 255, 0.16); color: var(--text); outline: none; }
.cmenu__cat-name { flex: 1; }
.cmenu__count {
  min-width: 22px; padding: 1px 7px; text-align: center;
  font-size: 0.72rem; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 999px;
}
.cmenu__arrow { color: var(--text-faint); font-size: 1.1rem; line-height: 1; transition: transform 0.2s var(--ease), color 0.2s; }
.cmenu__cat.is-open .cmenu__arrow { color: var(--cyan); transform: translateX(2px); }
.cmenu__cat.is-current .cmenu__cat-name { color: var(--cyan); }
.cmenu__cat.is-current::before, .cmenu__item.is-selected::before {
  content: ""; position: absolute; left: 4px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 2px; background: var(--gradient);
}
.cmenu__item { align-items: baseline; justify-content: space-between; gap: 14px; }
.cmenu__item-title { flex: 1; }
.cmenu__item-hint { flex-shrink: 0; font-size: 0.72rem; color: var(--text-faint); }
.cmenu__item.is-selected { color: var(--cyan); }
.cmenu__item.is-selected .cmenu__item-hint { color: rgba(34, 211, 238, 0.7); }
.cmenu__items::-webkit-scrollbar { width: 8px; }
.cmenu__items::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }

/* Narrow / touch screens: the article list opens inline under its category. */
.cmenu__items.is-inline {
  position: static; width: auto; max-height: none; overflow: visible;
  margin: 2px 0 8px 12px; padding: 4px 0 4px 8px;
  background: transparent; border: 0; border-left: 1px solid var(--border-strong); border-radius: 0;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  animation: none;
}
.cmenu__items.is-inline .cmenu__arrow { display: none; }
@media (max-width: 760px), (hover: none) {
  .cmenu__cat.is-open .cmenu__arrow { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .cmenu__panel, .cmenu__items { animation: none; }
}

/* Long unbroken text (headings, inline code, URLs) wraps instead of stretching the page on phones. */
.article-body { overflow-wrap: break-word; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { overflow-wrap: anywhere; }
.article-body :not(pre) > code { overflow-wrap: anywhere; }

/* =========================================================
   BLOG BANNER — full-width picture with a circular ring reveal
========================================================= */
.blog-banner {
  /* Sits directly in <main> (outside .container), so it spans the whole screen. */
  width: 100%;
  margin: 0 0 40px;
}
.blog-banner__stage {
  position: relative;
  width: 100%;
  height: clamp(220px, 32vw, 460px);
  overflow: hidden;
  background: #04122a;                     /* matches the picture's deep blue while it's still hidden */
}
.blog-banner__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  visibility: hidden;                      /* shown by js/ring-reveal.js as the reveal starts */
}
/* Soft fade into the page at the top and bottom edges. */
.blog-banner__stage::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(180deg, var(--bg, #070914) 0%, transparent 16%, transparent 80%, var(--bg, #070914) 100%);
}
/* Two glowing rings riding the edge of the expanding circle. Their size is
   animated from JS so they stay locked to the circle. */
.blog-banner__ring {
  position: absolute; z-index: 2;
  left: 50%; top: 50%;
  width: 0; height: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.95);
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.7), inset 0 0 26px rgba(34, 211, 238, 0.35);
  pointer-events: none;
  opacity: 0;
}
.blog-banner__ring--2 {
  border-color: rgba(124, 92, 255, 0.9);
  box-shadow: 0 0 26px rgba(124, 92, 255, 0.65), inset 0 0 26px rgba(124, 92, 255, 0.3);
}
@media (max-width: 600px) {
  .blog-banner { margin-bottom: 28px; }
}

/* =========================================================
   CAREER BANNER — full-width picture, fades up out of the dark
========================================================= */
.career-banner { width: 100%; margin: 0 0 24px; }
.career-banner__stage {
  position: relative;
  width: 100%;
  height: clamp(240px, 34vw, 520px);
  overflow: hidden;
  background: #060a22;                    /* the picture's deep blue, visible while it's still dark */
}
.career-banner__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 46%;               /* keeps the developer, the monitor and the projected code in frame */
  opacity: 0;
  filter: blur(18px) brightness(0.35);
  transform: scale(1.12);
  transition:
    opacity 2.8s cubic-bezier(0.4, 0, 0.3, 1),
    filter 3.4s cubic-bezier(0.25, 0.6, 0.3, 1),
    transform 5s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.career-banner.is-visible .career-banner__img {
  opacity: 1;
  filter: none;
  transform: none;
}
/* Soft fade into the page at the top and bottom edges. */
.career-banner__stage::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, var(--bg, #090b14) 0%, transparent 16%, transparent 80%, var(--bg, #090b14) 100%);
}
/* One thin scan line sweeping down the picture, like a screen powering on. */
.career-banner__scan {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.95) 20%, rgba(124, 92, 255, 0.95) 80%, transparent);
  box-shadow: 0 0 22px 4px rgba(34, 211, 238, 0.45);
  opacity: 0;
  pointer-events: none;
}
.career-banner.is-visible .career-banner__scan { animation: bannerScan 3.6s cubic-bezier(0.45, 0.05, 0.35, 1) 0.2s 1 both; }
@keyframes bannerScan {
  0%   { top: 0;    opacity: 0; }
  12%  {            opacity: 1; }
  88%  {            opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@media (max-width: 600px) { .career-banner { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) {
  .career-banner__img { opacity: 1; filter: none; transform: none; transition: none; }
  .career-banner__scan { display: none; }
}

/* =========================================================
   PROJECT CARD HANDS — a robotic hand slides in from the bottom-right
   edge of each project card, then taps the card from its fingertip
   (trigger: initProjectHands in js/animations.js)
========================================================= */
.project-card__foot {
  --hand-w: 180px;                       /* hand width; scales with the card where supported (below) */
  display: flex; align-items: flex-end;
  margin-top: 8px;
  /* keeps the text clear of the hand: hand height (0.661 × width) minus the card's bottom padding */
  min-height: calc(var(--hand-w) * 0.661 - 22px);
}
@supports (width: 1cqw) {
  .project-card { container-type: inline-size; }
  .project-card__foot { --hand-w: min(52cqw, 210px); }
}
.project-card__hand {
  position: absolute;                    /* positioned against the card: right end on its bottom-right edge */
  right: 0; bottom: 0;
  width: var(--hand-w);
  aspect-ratio: 640 / 423;
  pointer-events: none;
  transform: translate(105%, 14%);       /* hidden: off the right edge (the card clips it) */
  will-change: transform;
}
.project-card__hand-img { display: block; width: 100%; height: 100%; transform-origin: 100% 100%; }
.project-card.hand-in .project-card__hand {
  animation: handSlide 2.6s cubic-bezier(0.22, 0.61, 0.36, 1) var(--hd, 0ms) both;
}
@keyframes handSlide {
  from { transform: translate(105%, 14%); }
  to   { transform: translate(0, 0); }
}

/* Once it has arrived (2.6s) the hand dips like a click, and ripples spread from the fingertip. */
.project-card.hand-in .project-card__hand-img {
  animation: handPress 0.55s ease calc(var(--hd, 0ms) + 2.7s) 1;
}
@keyframes handPress {
  0%, 100% { transform: none; }
  38%      { transform: translate(-5px, 4px) scale(0.975); }
}
.project-card__tap {
  position: absolute;
  left: 1%; top: 2.5%;                   /* the fingertip, as a fraction of the hand image */
  width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.95);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.6), inset 0 0 18px rgba(34, 211, 238, 0.25);
  opacity: 0;
  transform: scale(0);
}
.project-card__tap::after {              /* the bright spark right at the tip */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 14px 4px rgba(34, 211, 238, 0.9);
  opacity: 0;
}
.project-card__tap--2 {
  border-color: rgba(124, 92, 255, 0.9);
  box-shadow: 0 0 18px rgba(124, 92, 255, 0.55), inset 0 0 18px rgba(124, 92, 255, 0.25);
}
.project-card__tap--2::after { display: none; }
.project-card.hand-in .project-card__tap {
  animation: tapRing 1.05s cubic-bezier(0.2, 0.6, 0.3, 1) calc(var(--hd, 0ms) + 2.78s) 1 both;
}
.project-card.hand-in .project-card__tap--2 {
  animation-delay: calc(var(--hd, 0ms) + 2.92s);
}
.project-card.hand-in .project-card__tap::after {
  animation: tapSpark 0.6s ease-out calc(var(--hd, 0ms) + 2.78s) 1 both;
}
@keyframes tapRing {
  0%   { opacity: 0.95; transform: scale(0.05); }
  100% { opacity: 0;    transform: scale(1.6); }
}
@keyframes tapSpark {
  0%   { opacity: 1; transform: scale(0.6); }
  100% { opacity: 0; transform: scale(2.6); }
}
/* The card itself reacts to the click: a brief cyan flash around its edge. */
.project-card.hand-in {
  animation: cardClick 0.9s ease calc(var(--hd, 0ms) + 2.8s) 1;
}
@keyframes cardClick {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
  30%      { box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.55), 0 0 28px rgba(34, 211, 238, 0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .project-card__hand { transform: none !important; animation: none !important; }
  .project-card__hand-img, .project-card__tap, .project-card.hand-in { animation: none !important; }
  .project-card__tap { display: none; }
}

/* =========================================================
   HANDSHAKE OVERLAY (Contact page) — js/handshake-overlay.js
   Shown for ~0.9s when a button is clicked, before its action runs.
========================================================= */
.hs-overlay {
  position: fixed; inset: 0; z-index: 950;
  display: none; align-items: center; justify-content: center;
  opacity: 1;
}
.hs-overlay.is-on { display: flex; }
.hs-overlay.is-leaving { opacity: 0; transition: opacity var(--hs-fade, 450ms) ease; pointer-events: none; }
.hs-overlay__backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 46%, rgba(20, 18, 56, 0.92), rgba(5, 6, 14, 0.94) 70%);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0;
}
.hs-overlay.is-on .hs-overlay__backdrop { animation: hsBackdrop 0.35s ease forwards; }
@keyframes hsBackdrop { to { opacity: 1; } }

.hs-overlay__stage { position: relative; width: clamp(190px, 30vmin, 320px); aspect-ratio: 640 / 624; }
.hs-overlay__logo {
  position: absolute; inset: 0;
  filter: drop-shadow(0 0 22px rgba(34, 211, 238, 0.5));
}
.hs-overlay.is-on .hs-overlay__logo { animation: hsBump 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) 0.58s both; }
@keyframes hsBump { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.07); } }

/* The logo is two halves (same picture, each clipped to one side) that slide together. */
.hs-half {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  -webkit-mask: url("../assets/images/handshake-logo.webp") center / contain no-repeat;
          mask: url("../assets/images/handshake-logo.webp") center / contain no-repeat;
  opacity: 0;
}
.hs-half--l { clip-path: inset(0 50% 0 0); }
.hs-half--r { clip-path: inset(0 0 0 50%); }
.hs-overlay.is-on .hs-half--l { animation: hsFromLeft 0.62s cubic-bezier(0.22, 0.8, 0.3, 1) 0.1s both; }
.hs-overlay.is-on .hs-half--r { animation: hsFromRight 0.62s cubic-bezier(0.22, 0.8, 0.3, 1) 0.1s both; }
@keyframes hsFromLeft  { from { opacity: 0; transform: translateX(-34%); } 55% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes hsFromRight { from { opacity: 0; transform: translateX(34%); }  55% { opacity: 1; } to { opacity: 1; transform: none; } }

/* A ring ripples out at the moment the hands meet. */
.hs-overlay__ring {
  position: absolute; inset: 4%; border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.9);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.55), inset 0 0 22px rgba(34, 211, 238, 0.25);
  opacity: 0; transform: scale(0.7);
}
.hs-overlay__ring--2 { border-color: rgba(124, 92, 255, 0.9); box-shadow: 0 0 22px rgba(124, 92, 255, 0.5), inset 0 0 22px rgba(124, 92, 255, 0.22); }
.hs-overlay.is-on .hs-overlay__ring { animation: hsRing 0.9s cubic-bezier(0.2, 0.6, 0.3, 1) 0.6s both; }
.hs-overlay.is-on .hs-overlay__ring--2 { animation-delay: 0.72s; }
@keyframes hsRing { 0% { opacity: 0.9; transform: scale(0.7); } 100% { opacity: 0; transform: scale(2.3); } }

@media (prefers-reduced-motion: reduce) {
  .hs-overlay.is-on .hs-overlay__backdrop { animation-duration: 0.15s; }
  .hs-overlay.is-on .hs-half { animation: hsFade 0.2s ease both; transform: none; }
  .hs-overlay.is-on .hs-overlay__logo, .hs-overlay.is-on .hs-overlay__ring { animation: none; }
  .hs-overlay__ring { display: none; }
  @keyframes hsFade { from { opacity: 0; } to { opacity: 1; } }
}

/* =========================================================
   ROBOT SEQUENCE (About, between "Vision & Mission" and "Beyond the Day Job")
   1. the waving robot fades/de-blurs in   2. it blurs away to nothing
   3. the "presenting" robot comes up through the blur   4. a circuit-board brain
   is revealed, bottom to top, above its open hand.   (trigger: js/robo-sequence.js)
   Positions below are % of the stage and were measured from the reference layout.
========================================================= */
.robo-section { padding: 36px 0 52px; }
.robo-stage {
  position: relative;
  width: clamp(280px, 86vw, 440px);
  aspect-ratio: 208 / 278;
  margin: 0 auto;
}
.robo-stage__robots {
  position: absolute; inset: 0;
  animation: roboFloat 5.5s ease-in-out infinite;     /* gentle hover once everything is in place */
}
@keyframes roboFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.robo-stage__hi, .robo-stage__show {
  position: absolute; bottom: 4.1%;
  height: auto;
  opacity: 0;                                          /* hidden until the sequence plays */
  user-select: none; pointer-events: none;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}
/* Same height and ground line for both poses, lined up on the body, so the swap reads as one robot changing pose. */
.robo-stage__hi   { left: 5.2%;  width: 51.3%; }
.robo-stage__show { left: 20.5%; width: 57.7%; }
.robo-stage__brain {
  position: absolute; left: 23.6%; top: 5%; width: 64.3%; height: auto;
  user-select: none; pointer-events: none;
  filter: brightness(1.55) saturate(1.15) drop-shadow(0 0 10px rgba(34, 211, 238, 0.35));
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 41.6%, transparent 56.2%);
          mask-image: linear-gradient(to top, #000 0%, #000 41.6%, transparent 56.2%);
  -webkit-mask-size: 100% 240%;          mask-size: 100% 240%;
  -webkit-mask-repeat: no-repeat;        mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;            mask-position: 0 0;      /* fully hidden */
}

/* Timeline (seconds): hi in 0-1.1 | wave, hold | hi out 2.9-4.2 | show in 3.4-4.9 | brain 5.0-9.0 */
.robo-stage.is-playing .robo-stage__hi   { animation: roboHi   4.2s cubic-bezier(0.4, 0, 0.3, 1) both; }
.robo-stage.is-playing .robo-stage__show { animation: roboShow 1.6s cubic-bezier(0.25, 0.6, 0.3, 1) 3.4s both; }
.robo-stage.is-playing .robo-stage__brain { animation: roboBrain 4s cubic-bezier(0.4, 0.05, 0.35, 1) 5s both; }
@keyframes roboHi {
  0%   { opacity: 0; filter: blur(14px); transform: translateY(14px) scale(0.94); }
  26%  { opacity: 1; filter: blur(0);    transform: none; }
  70%  { opacity: 1; filter: blur(0);    transform: none; }      /* ...waving... */
  100% { opacity: 0; filter: blur(18px); transform: scale(1.04); }  /* blurs away to nothing */
}
@keyframes roboShow {
  from { opacity: 0; filter: blur(18px); transform: scale(0.96); }
  to   { opacity: 1; filter: blur(0);    transform: none; }
}
@keyframes roboBrain {
  from { -webkit-mask-position: 0 0;    mask-position: 0 0; }
  to   { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
}
@media (prefers-reduced-motion: reduce) {
  /* No sequence: just show the finished picture (presenting robot + brain). */
  .robo-stage__robots { animation: none; }
  .robo-stage__show { opacity: 1; }
  .robo-stage__hi { display: none; }
  .robo-stage__brain { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
  .robo-stage.is-playing .robo-stage__show, .robo-stage.is-playing .robo-stage__brain { animation: none; }
}

/* =========================================================
   VISION & MISSION ROBOTS (About) — each robot peeks round the outer edge of its card.
   The flat cut edge of each picture sits exactly on the card's edge; the hands reach
   over onto the card. Motion: the robot slides out from behind the card, then its
   hands reach on. (trigger: initVisionPeek in js/about-page.js)
   --e   = where the cut edge is across the picture (fraction from its left)
   --fing = the hands' share of the picture's width
========================================================= */
.vm-peek {
  --rw: clamp(48px, 12.6cqw, 80px);        /* robot width: about 12.6% of the card (as in the reference) */
  position: absolute; top: 12px; z-index: 3;
  width: var(--rw);
  pointer-events: none;
}
.vm-peek img { display: block; width: 100%; height: auto; user-select: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4)); }

/* Vision: robot on the card's LEFT edge, looking left. */
.vm-peek--left {
  --e: 0.7287; --fing: 27.13%;
  --from: calc(var(--e) * var(--rw));                  /* start: pushed in behind the card */
  --clip-start: inset(0 var(--fing) 0 0);               /* only the part outside the card shows while sliding */
  left: calc(var(--e) * var(--rw) * -1);                /* cut edge lands exactly on the card's left edge */
  clip-path: var(--clip-start);
}
/* Mission: robot on the card's RIGHT edge, looking right. */
.vm-peek--right {
  --e: 0.2724; --fing: 27.24%;
  --from: calc((1 - var(--e)) * var(--rw) * -1);
  --clip-start: inset(0 0 0 var(--fing));
  left: calc(100% - var(--e) * var(--rw));              /* cut edge lands exactly on the card's right edge */
  clip-path: var(--clip-start);
}
.vm-peek img { transform: translateX(var(--from)); }   /* hidden behind the card until it plays */

/* Mission's two robots: the right-edge one on wide screens, a left-edge one (like Vision's) on phones. */
.vm-peek--phone { display: none; }
@media (max-width: 740px) {
  .vm-grid { grid-template-columns: 1fr; padding-inline-end: 0; }   /* one column; only the left side needs room for robots now */
  .vm-peek { --rw: clamp(48px, 12.6cqw, 62px); }                    /* keep them small enough to fit in the left margin */
  .vm-peek--desktop { display: none; }
  .vm-peek--phone { display: block; }
}

.vm-slot--vision { --pd: 0.9s; }
.vm-slot--mission { --pd: 1.15s; }
.vm-slot.is-peeking .vm-peek img { animation: peekSlide 1.8s cubic-bezier(0.22, 0.7, 0.25, 1) var(--pd) both; }
.vm-slot.is-peeking .vm-peek { animation: peekGrab 0.55s cubic-bezier(0.3, 0.7, 0.3, 1) calc(var(--pd) + 1.55s) both; }
@keyframes peekSlide { from { transform: translateX(var(--from)); } to { transform: translateX(0); } }
@keyframes peekGrab { from { clip-path: var(--clip-start); } to { clip-path: inset(0 0 0 0); } }

@media (prefers-reduced-motion: reduce) {
  .vm-peek { clip-path: none; }
  .vm-peek img { transform: none; }
  .vm-slot.is-peeking .vm-peek, .vm-slot.is-peeking .vm-peek img { animation: none; }
}

/* Entrance animations (e.g. headings that start slightly enlarged) must never make the page scroll sideways. */
main { overflow-x: clip; }

/* =========================================================
   HANDS SPLASH (Contact page) — js/hands-splash.js
   Robot hand from the left + human hand from the right meet at their fingertips;
   light blooms from the touch point; the splash washes out to reveal the page.
   Timeline (s):  hands glide in 0.35-2.95 | touch ~2.95 | light 2.9-4.2 | dissolve 4.05-5.0
========================================================= */
html.hands-on { overflow: hidden; }
.hands-splash { display: none; }
html.hands-on .hands-splash {
  display: block;
  position: fixed; inset: 0; z-index: 1100;
  overflow: hidden;
  /* Where the two fingertips meet, and the proportions measured from the two pictures. */
  --px: 50vw; --py: 44vh;
  --ar-r: 1.5094; --fxr: 0.9952; --fyr: 0.0102;    /* robot hand: aspect, fingertip x, y */
  --ar-h: 1.8525; --fxh: 0.0044; --fyh: 0.3443;    /* human hand */
  /* Each hand is at least big enough for its arm to run off the screen edge. */
  --Wr: max(calc(var(--px) * 1.06 / var(--fxr)), 46vh);
  --Wh: max(calc((100vw - var(--px)) * 1.06 / (1 - var(--fxh))), 46vh);
  background: radial-gradient(ellipse at 50% 42%, #0e1d45 0%, #070b1e 55%, #03050f 100%);
}
.hands-splash__net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }
.hands-splash__stage { position: absolute; inset: 0; }

.hands-splash__hand { position: absolute; display: block; height: auto; pointer-events: none; user-select: none; }
.hands-splash__hand--robot {
  width: var(--Wr);
  left: calc(var(--px) - var(--fxr) * var(--Wr));
  top: calc(var(--py) - var(--fyr) * var(--Wr) / var(--ar-r));
  transform: translateX(-85vw);
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55));
}
.hands-splash__hand--human {
  width: var(--Wh);
  left: calc(var(--px) - var(--fxh) * var(--Wh));
  top: calc(var(--py) - var(--fyh) * var(--Wh) / var(--ar-h));
  transform: translateX(85vw);
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55));
}
.hands-splash.is-playing .hands-splash__hand--robot { animation: handsInL 2.6s cubic-bezier(0.16, 0.72, 0.28, 1) 0.35s both; }
.hands-splash.is-playing .hands-splash__hand--human { animation: handsInR 2.6s cubic-bezier(0.16, 0.72, 0.28, 1) 0.35s both; }
@keyframes handsInL { from { transform: translateX(-85vw); } to { transform: translateX(0); } }
@keyframes handsInR { from { transform: translateX(85vw); }  to { transform: translateX(0); } }

/* ---- the light, all centred on the touch point ---- */
.hands-splash__glow, .hands-splash__rays, .hands-splash__ring, .hands-splash__spark {
  position: absolute; left: var(--px); top: var(--py); translate: -50% -50%; pointer-events: none; opacity: 0;
}
.hands-splash__glow {
  width: 90vmax; height: 90vmax; border-radius: 50%;
  background: radial-gradient(circle closest-side, #fff 0%, rgba(255, 255, 255, 0.92) 7%, rgba(150, 235, 255, 0.6) 22%, rgba(124, 92, 255, 0.28) 48%, transparent 72%);
}
.hands-splash__rays {
  width: 130vmax; height: 130vmax; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.5) 0deg 1.6deg, transparent 1.6deg 11deg);
  -webkit-mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.55) 30%, transparent 70%);
          mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.55) 30%, transparent 70%);
}
.hands-splash__ring { width: 28vmin; height: 28vmin; border-radius: 50%; border: 2px solid rgba(150, 235, 255, 0.95); box-shadow: 0 0 26px rgba(34, 211, 238, 0.7), inset 0 0 26px rgba(34, 211, 238, 0.3); }
.hands-splash__ring--2 { border-color: rgba(124, 92, 255, 0.9); box-shadow: 0 0 26px rgba(124, 92, 255, 0.65), inset 0 0 26px rgba(124, 92, 255, 0.3); }
.hands-splash__spark { width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 22px 9px rgba(255, 255, 255, 0.95), 0 0 60px 22px rgba(120, 230, 255, 0.8); }
.hands-splash__flash {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at var(--px) var(--py), rgba(255, 255, 255, 0.97) 0%, rgba(200, 240, 255, 0.82) 38%, rgba(124, 92, 255, 0.4) 80%);
}
.hands-splash.is-playing .hands-splash__glow  { animation: handsGlow 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) 2.9s both; }
.hands-splash.is-playing .hands-splash__rays  { animation: handsRays 2.1s ease-out 2.95s both; }
.hands-splash.is-playing .hands-splash__ring  { animation: handsRing 1.3s cubic-bezier(0.2, 0.6, 0.3, 1) 2.95s both; }
.hands-splash.is-playing .hands-splash__ring--2 { animation-delay: 3.15s; }
.hands-splash.is-playing .hands-splash__spark { animation: handsSpark 0.9s ease-out 2.9s both; }
.hands-splash.is-playing .hands-splash__flash { animation: handsFlash 1.2s ease-in 3.0s both; }
@keyframes handsGlow  { 0% { opacity: 0; scale: 0.02; } 22% { opacity: 1; scale: 0.2; } 100% { opacity: 1; scale: 1.5; } }
@keyframes handsRays  { 0% { opacity: 0; scale: 0.15; rotate: 0deg; } 30% { opacity: 0.9; } 100% { opacity: 0.55; scale: 1; rotate: 40deg; } }
@keyframes handsRing  { 0% { opacity: 0.95; scale: 0.05; } 100% { opacity: 0; scale: 4.2; } }
@keyframes handsSpark { 0% { opacity: 0; scale: 0.2; } 25% { opacity: 1; scale: 1.4; } 100% { opacity: 0.9; scale: 1; } }
@keyframes handsFlash { from { opacity: 0; } to { opacity: 0.88; } }

/* ---- the whole splash dissolves in the light, revealing the page ---- */
.hands-splash.is-playing { animation: handsExit 0.95s cubic-bezier(0.4, 0, 0.2, 1) 4.05s forwards; }
@keyframes handsExit { from { opacity: 1; scale: 1; filter: blur(0); } to { opacity: 0; scale: 1.07; filter: blur(8px); } }
.hands-splash.is-skipping { animation: handsSkip 0.5s ease forwards !important; pointer-events: none; }
@keyframes handsSkip { to { opacity: 0; } }

.hands-splash__skip {
  position: absolute; z-index: 5; right: 22px; bottom: 24px;
  padding: 9px 16px; font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--text-muted); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.hands-splash__skip:hover { color: var(--text); background: rgba(255, 255, 255, 0.14); }
.hands-splash__skip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
@media (max-width: 600px) { .hands-splash__skip { right: 14px; bottom: 16px; } }

/* =========================================================
   ROBOT CYCLE (Contact) — 13 poses crossfade one after another, endlessly, floating up and down
   js/robo-cycle.js starts it (as the page is revealed); everything else is CSS.
   All 13 frames share one canvas (1318 x 1402 in "reference" units, head pinned to the same spot),
   so the head never shifts between poses; --u is the size of one reference unit on screen.
========================================================= */
.robo-cycle {
  /* One reference unit on screen. Sized from the page container (so it follows the layout like the reference does): the
     standing robot is about 11.5% of the container width (~130 x 170px on a wide screen). */
  --u: calc(min(1132px, 100vw - 48px) / 5896);
  --T: 2.6s;                                            /* how long each pose is on screen (crossfade length is set in @keyframes roboFrame) */
  position: absolute; z-index: 1;
  left: calc(24px + (100% - 48px) * 0.78); top: 84px;  /* where the first robot sits beside the heading in the reference (78% across the container's inner width) */
  width: calc(var(--u) * 1318);
  aspect-ratio: 1318 / 1402;
  translate: -56.5% -67.9%;   /* centres the standing robot (not the whole canvas) on that spot */
  pointer-events: none;
}
.robo-cycle__float { position: absolute; inset: 0; animation: roboBob 3.4s ease-in-out infinite; }
@keyframes roboBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
.robo-cycle__frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; user-select: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}
/* Frame i starts i x --T after the first, and each runs the same 13 x --T loop, so as one pose fades
   out the next fades in (an endless crossfade chain, 1 -> 2 -> ... -> 13 -> 1). */
.robo-cycle.is-playing .robo-cycle__frame {
  animation: roboFrame calc(var(--T) * 13) linear calc(var(--T) * var(--i)) infinite both;
}
@keyframes roboFrame {
  0%     { opacity: 0; }
  2.66%  { opacity: 1; }     /* fade in: 2.66% of the 13 x 2.6s loop = 0.9s. If you change --T, scale these percentages too */
  7.69%  { opacity: 1; }     /* stays until the next pose starts to fade in (100 / 13) */
  10.35% { opacity: 0; }     /* fade out, overlapping the next pose's fade in */
  100%   { opacity: 0; }
}
@media (min-width: 761px) {
  /* keep the one-line subtitle clear of the robot */
  .page-header .container:has(.robo-cycle) .page-header__subtitle { max-width: 58%; }
}
/* Phones: the robot sits in the flow, below the heading and above the form. */
@media (max-width: 760px) {
  .robo-cycle { position: relative; left: auto; top: auto; translate: none; width: min(86vw, 340px); margin: 14px auto 0; }
}
@media (prefers-reduced-motion: reduce) {
  .robo-cycle__float { animation: none; }
  .robo-cycle__frame:first-child { opacity: 1; }
  .robo-cycle.is-playing .robo-cycle__frame { animation: none; }
}
