/* =========================================================
   ALAN BELTRAN POZO — PORTFOLIO 2026
   Editorial engineering system / light + dark / responsive
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #f2f1ec;
  --bg-elevated: #faf9f5;
  --surface: #ffffff;
  --surface-2: #e9e7df;
  --ink: #111116;
  --ink-soft: #36363f;
  --muted: #73737d;
  --line: rgba(17, 17, 22, 0.14);
  --line-strong: rgba(17, 17, 22, 0.3);
  --accent: #ff4d24;
  --accent-strong: #dc3210;
  --accent-soft: rgba(255, 77, 36, 0.12);
  --signal: #b7f23c;
  --signal-ink: #182000;
  --shadow: 0 18px 60px rgba(27, 25, 20, 0.08);
  --shadow-strong: 0 30px 90px rgba(27, 25, 20, 0.15);
  --container: 1320px;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-space: clamp(6rem, 11vw, 10rem);
  --display: 'Space Grotesk', system-ui, sans-serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* aliases retained for dynamic components */
  --bg-color: var(--bg);
  --bg-secondary: var(--bg-elevated);
  --text-color: var(--ink-soft);
  --text-secondary: var(--muted);
  --text-muted: var(--muted);
  --heading-color: var(--ink);
  --accent-color: var(--accent);
  --accent-hover: var(--accent-strong);
  --card-bg: var(--surface);
  --border-color: var(--line);
  --tag-bg: var(--accent-soft);
  --tag-color: var(--accent-strong);
  --hero-gradient: linear-gradient(135deg, var(--accent), #ff7759);
  --navbar-bg: rgba(242, 241, 236, 0.86);
  --navbar-text: var(--ink);
  --card-shadow: var(--shadow);
  --card-shadow-hover: var(--shadow-strong);
  --spotlight-color: rgba(255, 77, 36, 0.12);
  --spotlight-glow: rgba(255, 77, 36, 0.2);
  --spotlight-gradient: radial-gradient(500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--spotlight-color), transparent 45%);
  --transition-fast: 180ms ease;
  --transition-normal: 320ms var(--ease);
  --transition-bounce: 450ms var(--ease);
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c0c0f;
  --bg-elevated: #111116;
  --surface: #17171d;
  --surface-2: #202027;
  --ink: #f4f2ea;
  --ink-soft: #c8c6bd;
  --muted: #898890;
  --line: rgba(244, 242, 234, 0.12);
  --line-strong: rgba(244, 242, 234, 0.28);
  --accent: #ff6743;
  --accent-strong: #ff8b70;
  --accent-soft: rgba(255, 103, 67, 0.13);
  --signal: #c6fa52;
  --signal-ink: #151d00;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.3);
  --shadow-strong: 0 35px 100px rgba(0, 0, 0, 0.5);
  --navbar-bg: rgba(12, 12, 15, 0.84);
  --spotlight-color: rgba(255, 103, 67, 0.1);
  --spotlight-glow: rgba(255, 103, 67, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  transition: background-color 300ms ease, color 300ms ease;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: #fff;
}

a,
button,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

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

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--display);
  line-height: 1.02;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.container {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

.skip-to-content {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
  transform: translate(-50%, -120%);
  transition: transform 180ms ease;
}

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

/* progress + ambient cursor */
.scroll-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 1001;
  width: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.cursor-spotlight {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, var(--spotlight-glow), transparent 68%);
  transform: translate(-50%, -50%);
  transition: opacity 250ms ease;
}

body:hover .cursor-spotlight { opacity: 0.45; }

/* =========================================================
   NAVIGATION
   ========================================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--navbar-bg);
  color: var(--navbar-text);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: height 300ms var(--ease), box-shadow 300ms ease, background 300ms ease;
}

.navbar.scrolled {
  height: 62px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.07);
}

.navbar .container {
  width: min(100%, 1480px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { line-height: 1; }

.logo a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
}

.logo-mark {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: transform 350ms var(--ease), background 250ms ease;
}

.logo a:hover .logo-mark {
  background: var(--accent);
  color: #fff;
  transform: rotate(-8deg);
}

.logo-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 1.6vw, 1.7rem);
  list-style: none;
}

.nav-links a {
  position: relative;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-links a::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -0.4rem;
  left: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 300ms var(--ease);
}

.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.25rem;
}

.theme-toggle,
.lang-dropdown-toggle,
.mobile-menu-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border-radius: 50%;
  transition: color 200ms ease, border 200ms ease, transform 300ms var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(12deg);
}

.theme-toggle svg { width: 1rem; height: 1rem; }

.lang-dropdown { position: relative; }

.lang-dropdown-toggle {
  display: flex;
  height: 2.45rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.lang-dropdown-toggle:hover { border-color: var(--accent); }
.lang-dropdown-toggle .lang-flag { font-size: 0.78rem; letter-spacing: -0.15em; }
.lang-chevron { opacity: 0.55; transition: transform 200ms ease; }
.lang-dropdown.open .lang-chevron { transform: rotate(180deg); }

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  min-width: 158px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: 200ms ease;
}

.lang-dropdown.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: 0.5rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.lang-option:hover { background: var(--surface-2); color: var(--ink); }
.lang-option.active { color: var(--accent); font-weight: 700; }
.lang-option .lang-flag { letter-spacing: -0.15em; }

.mobile-menu-btn {
  display: none;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0.65rem;
  border-radius: 50%;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: calc(100svh - 72px);
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 78% 50%, var(--accent-soft), transparent 27%),
    var(--bg);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), var(--line) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(180deg, transparent calc(73% - 0.5px), var(--line) 73%, transparent calc(73% + 0.5px));
}

.hero::after {
  content: 'DESIGNING SYSTEMS THAT SHIP  —  41.3874° N';
  position: absolute;
  right: -10.2rem;
  top: 50%;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  transform: rotate(90deg);
}

.hero-grid-lines {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.7;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: clamp(76px, 7vw, 112px) clamp(76px, 7vw, 112px);
  mask-image: linear-gradient(90deg, #000, transparent 45%, transparent 58%, #000);
}

.hero-inner {
  width: min(100%, 1480px);
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  align-items: center;
  gap: clamp(3rem, 7vw, 8rem);
  padding-block: clamp(4rem, 8vh, 7rem);
}

.hero-copy { min-width: 0; }

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: clamp(1.5rem, 3vh, 2.5rem);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  animation: revealUp 700ms 80ms var(--ease) forwards;
}

.status-dot,
.availability-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(183, 242, 60, 0.3);
  animation: signal 2.4s infinite;
}

.hero-kicker-separator { color: var(--accent); }

.hero-title {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-size: clamp(4.6rem, 8.3vw, 9.2rem);
  font-weight: 600;
  letter-spacing: -0.078em;
  line-height: 0.78;
}

.hero-title > span {
  opacity: 0;
  transform: translateY(0.55em);
  animation: titleReveal 950ms var(--ease) forwards;
}

.hero-title > span:first-child { animation-delay: 120ms; }
.hero-title > span:last-child { animation-delay: 210ms; }

.hero-title-indent {
  margin-left: clamp(1.5rem, 8vw, 7rem);
  color: var(--accent);
  font-style: italic;
}

.hero-copy-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13.8rem;
  align-items: end;
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: clamp(2.5rem, 5vh, 4rem);
  padding-left: clamp(0rem, 5vw, 4rem);
  opacity: 0;
  animation: revealUp 800ms 390ms var(--ease) forwards;
}

.hero-intro { max-width: 35rem; }

.hero-subtitle {
  margin-bottom: 0.75rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.hero-description {
  max-width: 33rem;
  color: var(--muted);
  font-size: clamp(0.94rem, 1.1vw, 1.06rem);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hero-action {
  display: flex;
  min-height: 3.45rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 220ms ease, border 220ms ease, color 220ms ease;
}

.hero-action-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.hero-action-primary:hover { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.hero-action-secondary:hover { border-color: var(--accent); color: var(--accent); }
.hero-action svg { transition: transform 250ms var(--ease); }
.hero-action:hover svg { transform: translateX(0.25rem); }
.hero-action-secondary:hover svg { transform: translateY(0.2rem); }

.hero-stack {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.8rem);
  margin-top: clamp(2.5rem, 5vh, 4rem);
  padding: 0.85rem 0;
  border-block: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0;
  animation: revealUp 750ms 520ms var(--ease) forwards;
}

.hero-stack span:not(.hero-stack-label)::before { content: '•'; margin-right: 0.65rem; color: var(--accent); }
.hero-stack-label { margin-right: auto; color: var(--muted); font-size: 0.58rem; text-transform: uppercase; }

.hero-visual {
  --depth-x: 0px;
  --depth-y: 0px;
  position: relative;
  min-height: clamp(460px, 48vw, 620px);
  border-left: 1px solid var(--line);
  opacity: 0;
  transform: translate3d(var(--depth-x), var(--depth-y), 0);
  animation: visualReveal 1s 300ms var(--ease) forwards;
  transition: transform 400ms var(--ease);
}

.visual-index,
.visual-footer {
  position: absolute;
  right: 0;
  left: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.visual-index { top: 0; }
.visual-footer { bottom: 0; }
.visual-footer-line { height: 1px; flex: 1; margin: 0 1rem; background: var(--line); }

.orbit-scene {
  position: absolute;
  top: 50%;
  left: calc(50% + 0.6rem);
  width: min(92%, 540px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit::before,
.orbit::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 1.5rem var(--accent);
}

.orbit-outer { width: 100%; border-style: dashed; animation: orbitSpin 34s linear infinite; }
.orbit-outer::before { top: 18%; left: 10%; width: 0.5rem; height: 0.5rem; }
.orbit-outer::after { right: 6%; bottom: 29%; width: 0.25rem; height: 0.25rem; }
.orbit-middle { width: 72%; border-color: var(--accent); opacity: 0.8; animation: orbitSpinReverse 22s linear infinite; }
.orbit-middle::before { top: 29%; right: 3%; width: 0.38rem; height: 0.38rem; }
.orbit-middle::after { bottom: 5%; left: 20%; width: 0.22rem; height: 0.22rem; }
.orbit-inner { width: 43%; border-style: dotted; animation: orbitSpin 16s linear infinite; }
.orbit-inner::before { top: 50%; left: -0.15rem; width: 0.3rem; height: 0.3rem; }
.orbit-inner::after { display: none; }

.orbit-axis {
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--line);
  transform: translate(-50%, -50%);
}
.orbit-axis-horizontal { width: 112%; height: 1px; }
.orbit-axis-vertical { width: 1px; height: 112%; }

.orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 25%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 0 0 0.8rem var(--surface), 0 0 5rem var(--accent-soft);
  transform: translate(-50%, -50%);
  transition: transform 450ms var(--ease), background 250ms ease;
}

.hero-visual:hover .orbit-core { background: var(--accent); color: #fff; transform: translate(-50%, -50%) scale(1.08); }
.orbit-core span { font-family: var(--display); font-size: clamp(1.4rem, 2.5vw, 2.3rem); font-weight: 700; letter-spacing: -0.06em; }
.orbit-core small { margin-top: 0.25rem; font-family: var(--mono); font-size: clamp(0.3rem, 0.5vw, 0.46rem); letter-spacing: 0.12em; }

.orbit-node {
  position: absolute;
  z-index: 2;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(0.45rem, 0.65vw, 0.6rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-align: center;
  transition: 220ms ease;
}
.orbit-node:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
.orbit-node-rust { top: 48%; left: 1.5%; }
.orbit-node-tauri { top: 21%; right: 5%; }
.orbit-node-type { right: 11%; bottom: 14%; }
.orbit-node-ai { top: 13%; left: 18%; }

.orbit-coordinate {
  position: absolute;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.orbit-coordinate-top { top: -0.8rem; left: 50%; transform: translateX(-50%); }
.orbit-coordinate-bottom { bottom: -0.8rem; left: 50%; transform: translateX(-50%); }

.hero-scroll-cue {
  position: absolute;
  bottom: 1.35rem;
  left: max(var(--gutter), calc((100vw - 1480px) / 2 + var(--gutter)));
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0;
  animation: revealUp 700ms 700ms var(--ease) forwards;
}

.hero-scroll-line { position: relative; width: 3.5rem; height: 1px; overflow: hidden; background: var(--line-strong); }
.hero-scroll-line::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform: translateX(-100%); animation: scrollLine 2.4s 1s ease-in-out infinite; }

/* capability rail */
.capability-rail {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
}

.capability-track {
  width: max-content;
  display: flex;
  align-items: center;
  animation: marquee 28s linear infinite;
}

.capability-set { display: flex; align-items: center; }
.capability-set span {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.capability-set span::after { content: '✦'; color: var(--accent); font-size: 0.75rem; }

/* =========================================================
   SHARED SECTION SYSTEM
   ========================================================= */
.section {
  position: relative;
  padding-block: var(--section-space);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.section-alt { background: var(--bg-elevated); }
.section > .container { position: relative; }

.section-title {
  position: relative;
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
  padding-top: 1.3rem;
  border-top: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: clamp(3.2rem, 7vw, 6.8rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  text-align: left;
}

.section-title::before {
  display: block;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#about-heading::before { content: '01 / Profile'; }
#experience-heading::before { content: '02 / Career'; }
#projects-heading::before { content: '03 / Selected output'; }
#skills-heading::before { content: '04 / Capabilities'; }
#github-heading::before { content: '05 / Open source'; }
#ai-chat-heading::before { content: '06 / Interactive CV'; }
#contact-heading::before { content: '07 / Start a conversation'; }

html[lang='es'] #about-heading::before { content: '01 / Perfil'; }
html[lang='es'] #experience-heading::before { content: '02 / Trayectoria'; }
html[lang='es'] #projects-heading::before { content: '03 / Trabajo destacado'; }
html[lang='es'] #skills-heading::before { content: '04 / Capacidades'; }
html[lang='es'] #github-heading::before { content: '05 / Código abierto'; }
html[lang='es'] #ai-chat-heading::before { content: '06 / CV interactivo'; }
html[lang='es'] #contact-heading::before { content: '07 / Iniciemos una conversación'; }

.section-subtitle {
  max-width: 42rem;
  margin: calc(clamp(3.5rem, 7vw, 6rem) * -0.65) 0 clamp(3rem, 5vw, 4rem) auto;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  text-align: left;
}

/* scroll reveals */
.js [data-aos],
.js .section-title,
.js .about-content,
.js .timeline-item,
.js .github-stat-card,
.js .skill-group-card,
.js .contact-content {
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 750ms var(--ease), transform 750ms var(--ease);
}

.js .aos-animate { opacity: 1; transform: none; }

/* =========================================================
   ABOUT / PROFILE
   ========================================================= */
.about-content { max-width: none; }

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: start;
}

.about-text { counter-reset: paragraph; }

.about-text p {
  position: relative;
  margin-bottom: 2rem;
  padding-left: clamp(2.5rem, 5vw, 4.5rem);
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  letter-spacing: -0.025em;
  line-height: 1.55;
  counter-increment: paragraph;
}

.about-text p::before {
  content: '0' counter(paragraph);
  position: absolute;
  top: 0.25rem;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
}

.about-text strong { color: var(--ink); font-weight: 650; }

.about-highlights {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

.highlight-card {
  position: relative;
  overflow: hidden;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: padding 300ms var(--ease);
}

.highlight-card:hover { padding-left: 1rem; }
.highlight-card::after { content: '↗'; position: absolute; top: 1.6rem; right: 0; color: var(--accent); font-size: 1rem; }
.highlight-icon { margin-bottom: 1.1rem; color: var(--accent); font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; }
.highlight-card h3 { margin-bottom: 0.4rem; font-size: 1rem; font-weight: 600; }
.highlight-card p { color: var(--muted); font-size: 0.84rem; }

/* =========================================================
   EXPERIENCE
   ========================================================= */
.timeline {
  max-width: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
}

.timeline::before { display: none; }

.timeline-item { position: relative; padding: 0; }
.timeline-marker { display: none; }

.timeline-content {
  display: grid;
  grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 7vw, 7rem);
  padding: clamp(2rem, 4vw, 3.5rem) 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: padding 350ms var(--ease), background 250ms ease;
}

.timeline-content:hover { padding-inline: 1rem; background: var(--accent-soft); }
.timeline-header { margin: 0; }
.timeline-title { margin-bottom: 0.55rem; font-size: clamp(1.5rem, 2.5vw, 2.25rem); font-weight: 550; letter-spacing: -0.04em; }
.timeline-company { display: block; color: var(--accent); font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.timeline-date { display: block; margin-top: 1rem; color: var(--muted); font-family: var(--mono); font-size: 0.66rem; }
.timeline-description { max-width: 58rem; margin-bottom: 1.5rem; color: var(--muted); font-size: clamp(0.98rem, 1.25vw, 1.1rem); line-height: 1.8; }
.timeline-tags,
.project-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.timeline-tag,
.project-tag {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* =========================================================
   PROJECTS
   ========================================================= */
.project-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
  margin: -2.5rem 0 2.5rem;
}

.filter-btn,
.pagination-btn {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: 220ms ease;
}
.filter-btn:hover,
.pagination-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.filter-btn.active { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.project-card {
  position: relative;
  min-width: 0;
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  transition: background 250ms ease;
}

.project-card:hover { background: var(--bg-elevated); }

.project-image,
.skeleton-image {
  position: relative;
  height: clamp(190px, 17vw, 250px);
  overflow: hidden;
  background: var(--surface-2);
}

.project-image::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.25));
  opacity: 0;
  transition: opacity 350ms ease;
}

.project-card:hover .project-image::after { opacity: 1; }
.project-image img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.85); transition: transform 700ms var(--ease), filter 400ms ease; }
.project-card:hover .project-image img { filter: saturate(1); transform: scale(1.035); }
.project-image.image-contain { display: grid; place-items: center; padding: clamp(1.75rem, 3vw, 3.5rem); background: #08090d; }
.project-image.image-contain img { object-fit: contain; filter: none; }

.project-badges { position: absolute; top: 1rem; left: 1rem; z-index: 3; display: flex; gap: 0.45rem; }
.project-badge {
  padding: 0.4rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(12, 12, 15, 0.78);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}
.project-badge.muted { color: var(--signal); }

.project-content { min-height: 19rem; display: flex; flex-direction: column; padding: clamp(1.25rem, 2vw, 1.8rem); }
.project-card h3 { margin-bottom: 0.75rem; font-size: clamp(1.45rem, 2vw, 2.1rem); font-weight: 520; letter-spacing: -0.05em; }
.project-card p { margin-bottom: 1.1rem; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }
.project-highlights { display: grid; gap: 0.65rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.project-highlights li { position: relative; padding-left: 1.1rem; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
.project-highlights li::before { content: '↳'; position: absolute; left: 0; color: var(--accent); }
.project-tags { margin-top: auto; margin-bottom: 1rem; }
.project-stats { display: flex; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.62rem; }
.project-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; padding-top: 0.9rem; }

.project-link {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: 220ms ease;
}
.project-link:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.project-link.secondary { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.project-link.secondary:hover { border-color: var(--accent); color: var(--accent); }
.project-link.muted { border-color: var(--line); background: transparent; color: var(--muted); cursor: default; }
.project-link.muted:hover { border-color: var(--line); color: var(--muted); }
.project-link svg { width: 0.9rem; height: 0.9rem; }

.featured-project { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr); }
.featured-project .project-image { height: auto; min-height: 430px; }
.featured-project .project-content { min-height: 430px; }
.featured-project h3 { font-size: clamp(2.35rem, 4vw, 4rem); }

/* Complete partial rows without rendering empty grid cells. */
.projects-grid.project-remainder-2 > .project-card:nth-last-child(-n + 2) {
  grid-column: span 3;
}

.projects-grid.project-remainder-1 > .project-card:last-child:not(.featured-project) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.projects-grid.project-remainder-1 > .project-card:last-child:not(.featured-project) .project-image {
  height: auto;
  min-height: 19rem;
}

.skeleton { pointer-events: none; }
.skeleton-content { padding: 2rem; }
.skeleton-title,
.skeleton-text,
.skeleton-tag,
.skeleton-value,
.skeleton-label { border-radius: 2px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-title { width: 55%; height: 2rem; margin-bottom: 1rem; }
.skeleton-text { height: 0.9rem; margin-bottom: 0.6rem; }
.skeleton-text.short { width: 45%; }
.skeleton-tags { display: flex; gap: 0.5rem; margin-top: 1.5rem; }
.skeleton-tag { width: 4rem; height: 1.5rem; }

.pagination-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.5rem; }
.pagination-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination-info { color: var(--muted); font-family: var(--mono); font-size: 0.6rem; }

/* =========================================================
   SKILLS
   ========================================================= */
.skills-wrapper {
  position: relative;
  height: clamp(420px, 48vw, 620px);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 45%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg-elevated);
  background-size: auto, 70px 70px, 70px 70px, auto;
}

.skills-wrapper::before {
  content: 'DRAG TO EXPLORE';
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

#skills-globe { width: 100%; height: 100%; cursor: grab; touch-action: none; }
#skills-globe:active { cursor: grabbing; }

.skills-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.skill-group-card {
  position: relative;
  min-height: 13rem;
  overflow: hidden;
  padding: 1.5rem;
  background: var(--surface);
  transition: background 250ms ease, padding 350ms var(--ease);
}
.skill-group-card::before { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 3px; background: var(--accent); transition: width 350ms var(--ease); }
.skill-group-card:hover { padding-left: 2rem; background: var(--bg-elevated); }
.skill-group-card:hover::before { width: 100%; }
.skill-group-card h3 { margin-bottom: 2.5rem; font-size: 1.35rem; font-weight: 550; letter-spacing: -0.04em; }
.skill-group-card p { color: var(--muted); font-size: 0.84rem; line-height: 1.65; }

/* =========================================================
   GITHUB
   ========================================================= */
#github {
  --ink: #f7f4ec;
  --ink-soft: #d1cec5;
  --muted: #85848a;
  --line: rgba(247, 244, 236, 0.13);
  --line-strong: rgba(247, 244, 236, 0.3);
  --surface: #15151a;
  --bg: #0c0c0f;
  --bg-elevated: #111116;
  background: #0c0c0f;
  color: var(--ink-soft);
}

.github-dashboard { max-width: none; }
.github-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.github-stat-card { position: relative; min-height: 15rem; padding: 1.5rem; overflow: hidden; background: var(--surface); transition: background 250ms ease; }
.github-stat-card:hover { background: #1d1d24; }
.github-stat-icon { width: 2.5rem; height: 2.5rem; margin: 0 0 4rem; color: var(--accent); }
.github-stat-icon svg { width: 1.5rem; height: 1.5rem; }
.github-stat-value { margin-bottom: 0.75rem; color: var(--ink); font-family: var(--display); font-size: clamp(2.6rem, 5vw, 4.2rem); font-weight: 500; letter-spacing: -0.06em; line-height: 1; }
.github-stat-label { color: var(--muted); font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.skeleton-value { width: 60%; height: 3.5rem; margin-bottom: 0.75rem; }
.skeleton-label { width: 70%; height: 0.8rem; }
.github-link-container { margin-top: 2rem; text-align: right; }
.github-link { display: inline-flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line-strong); color: var(--ink); font-family: var(--mono); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-decoration: none; text-transform: uppercase; transition: 220ms ease; }
.github-link:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.github-link svg { width: 1rem; height: 1rem; }

/* =========================================================
   AI CHAT
   ========================================================= */
#ai-chat { background: var(--bg-elevated); }

.chat-container {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-container::before {
  content: 'LOCAL://ALAN-ASSISTANT';
  display: flex;
  height: 2.5rem;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.chat-initial,
.chat-preparing { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; }
.ai-avatar-large { position: relative; width: 5rem; height: 5rem; display: grid; place-items: center; margin-bottom: 1.5rem; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent); }
.ai-avatar-large::after { content: ''; position: absolute; inset: -0.5rem; border: 1px dashed var(--line-strong); border-radius: 50%; animation: orbitSpinFlat 12s linear infinite; }
.ai-avatar-large svg { width: 2rem; height: 2rem; }
.chat-intro { max-width: 29rem; margin-bottom: 1.7rem; color: var(--muted); font-size: 1.05rem; }

.cta-button {
  display: inline-flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: 220ms ease;
}
.cta-button:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.cta-button.secondary { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.cta-button.secondary:hover { border-color: var(--accent); color: var(--accent); }

.preparing-animation { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.preparing-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent); animation: preparingBounce 1.4s ease-in-out infinite; }
.preparing-dot:nth-child(2) { animation-delay: 0.2s; }
.preparing-dot:nth-child(3) { animation-delay: 0.4s; }
.preparing-text { color: var(--muted); }

.chat-active { height: 560px; display: flex; flex-direction: column; }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; padding: 1.5rem; scroll-behavior: smooth; }
.chat-message { max-width: 78%; display: flex; gap: 0.75rem; animation: messageAppear 300ms var(--ease); }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.ai { align-self: flex-start; }
.message-avatar { width: 2rem; height: 2rem; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.message-avatar.user { background: var(--accent); color: #fff; }
.message-avatar.ai { background: var(--ink); color: var(--bg); }
.message-bubble { padding: 0.85rem 1.1rem; border: 1px solid var(--line); background: var(--bg-elevated); color: var(--ink-soft); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.chat-message.user .message-bubble { border-color: var(--accent); background: var(--accent); color: #fff; }

.typing-indicator { display: flex; gap: 0.3rem; padding: 0.25rem; }
.typing-indicator span { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--muted); animation: typingBounce 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1.5rem 1rem; }
.suggestion-chip { padding: 0.45rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.7rem; transition: 200ms ease; }
.suggestion-chip:hover { border-color: var(--accent); color: var(--accent); }

.chat-input-area { display: flex; gap: 0.6rem; padding: 1rem 1.5rem 1.5rem; border-top: 1px solid var(--line); background: var(--surface); }
.chat-input-area input { flex: 1; min-width: 0; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 0; background: var(--bg); color: var(--ink); font-size: 0.9rem; }
.chat-input-area input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.chat-input-area button { width: 3rem; height: 3rem; display: grid; flex: 0 0 auto; place-items: center; border: 0; border-radius: 0; background: var(--accent); color: #fff; cursor: pointer; transition: background 200ms ease; }
.chat-input-area button:hover { background: var(--ink); }

/* =========================================================
   CONTACT
   ========================================================= */
#contact { overflow: hidden; }
#contact::after { content: 'HELLO'; position: absolute; right: -0.06em; bottom: -0.24em; z-index: 0; color: var(--accent-soft); font-family: var(--display); font-size: clamp(10rem, 28vw, 30rem); font-weight: 700; letter-spacing: -0.1em; line-height: 1; pointer-events: none; }
#contact .container { z-index: 1; }
.contact-content { max-width: none; }
.contact-description { max-width: 58rem; margin: 0 0 clamp(3rem, 6vw, 5rem); color: var(--ink); font-family: var(--display); font-size: clamp(1.7rem, 3.5vw, 3.3rem); letter-spacing: -0.045em; line-height: 1.15; text-align: left; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.contact-card { min-height: 28rem; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(2rem, 5vw, 4rem); background: var(--ink); color: var(--bg); }
.contact-card h3 { max-width: 9ch; color: var(--bg); font-size: clamp(2.8rem, 6vw, 6rem); font-weight: 500; letter-spacing: -0.07em; }
.contact-card p { max-width: 35rem; margin: 2rem 0; color: var(--muted); }
.contact-card-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.contact-card .cta-button { border-color: var(--bg); background: var(--bg); color: var(--ink); }
.contact-card .cta-button:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.contact-card .cta-button.secondary { background: transparent; color: var(--bg); }

.contact-info { display: flex; flex-direction: column; gap: 1px; background: var(--line); }
.contact-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.contact-link,
.copy-email-btn {
  min-height: 6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0;
  padding: 1rem 1.25rem;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: 220ms ease;
}
.contact-link:hover,
.copy-email-btn:hover { background: var(--accent); color: #fff; }
.contact-link svg { width: 1.15rem; height: 1.15rem; }
.copy-email-btn.copied { background: var(--signal); color: var(--signal-ink); }

.availability-card { flex: 1; padding: 2rem; background: var(--surface); }
.availability-header { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1rem; }
.availability-status { color: var(--ink); font-family: var(--mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.availability-text { max-width: 26rem; color: var(--muted); font-size: 0.85rem; }

/* footer */
.footer { padding: 2rem 0; border-top: 0; background: var(--ink); color: var(--muted); }
.footer .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.footer p { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.04em; text-transform: uppercase; }
.footer-credit { margin: 0; }

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 100;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: 300ms var(--ease);
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { border-color: var(--accent); background: var(--accent); color: #fff; transform: translateY(-3px); }
.back-to-top svg { width: 1rem; height: 1rem; }

/* animations */
@keyframes revealUp { to { opacity: 1; transform: translateY(0); } }
@keyframes titleReveal { to { opacity: 1; transform: translateY(0); } }
@keyframes visualReveal { from { opacity: 0; transform: translate3d(var(--depth-x), calc(var(--depth-y) + 2rem), 0) scale(0.95); } to { opacity: 1; transform: translate3d(var(--depth-x), var(--depth-y), 0) scale(1); } }
@keyframes orbitSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes orbitSpinReverse { to { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes orbitSpinFlat { to { transform: rotate(360deg); } }
@keyframes signal { 70% { box-shadow: 0 0 0 0.55rem transparent; } }
@keyframes scrollLine { 0%, 25% { transform: translateX(-100%); } 70%, 100% { transform: translateX(100%); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes preparingBounce { 0%, 80%, 100% { opacity: 0.45; transform: scale(0.6); } 40% { opacity: 1; transform: scale(1); } }
@keyframes typingBounce { 30% { transform: translateY(-5px); } }
@keyframes messageAppear { from { opacity: 0; transform: translateY(0.6rem); } }

.magnetic { position: relative; transition: transform 450ms var(--ease); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1120px) {
  .logo-meta { display: none; }
  .nav-links { gap: 0.8rem; }
  .nav-links a { font-size: 0.58rem; }
  .hero-inner { grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr); gap: 3rem; }
  .hero-copy-footer { padding-left: 0; }
  .hero-title { font-size: clamp(4.5rem, 8.7vw, 7.5rem); }
  .project-card { grid-column: span 3; }
  .featured-project { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .github-stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); gap: 1.5rem; }
  .hero-copy-footer { display: block; }
  .hero-actions { max-width: 31rem; flex-direction: row; margin-top: 1.5rem; }
  .hero-action { flex: 1; }
  .hero-visual { min-height: 430px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-highlights { grid-template-columns: repeat(3, 1fr); }
  .highlight-card { padding-right: 1rem; }
  .skills-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-card { min-height: 24rem; }
}

@media (max-width: 768px) {
  :root { --section-space: 5.5rem; }
  .navbar { height: 64px; }
  .navbar.scrolled { height: 58px; }
  .mobile-menu-btn { display: grid; place-items: center; }
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(88vw, 380px);
    height: 100svh;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6rem 1.5rem 2rem;
    border-left: 1px solid var(--line);
    background: var(--bg);
    box-shadow: -20px 0 80px rgba(0, 0, 0, 0.2);
    transition: right 450ms var(--ease);
  }
  .nav-links.active { right: 0; }
  .nav-links li:not(.nav-actions) { border-bottom: 1px solid var(--line); }
  .nav-links a { display: block; padding: 1rem 0; font-family: var(--display); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.03em; text-transform: none; }
  .nav-actions { margin-top: 1.5rem; margin-left: 0; }
  .mobile-menu-btn { position: relative; z-index: 1001; }
  .mobile-menu-btn.active svg { transform: rotate(90deg); }

  .hero { min-height: calc(100svh - 64px); }
  .hero::before { background: linear-gradient(180deg, transparent 73%, var(--line) calc(73% + 1px), transparent calc(73% + 2px)); }
  .hero::after { display: none; }
  .hero-grid-lines { opacity: 0.45; mask-image: linear-gradient(to bottom, #000, transparent 75%); }
  .hero-inner { min-height: calc(100svh - 64px); display: block; padding-block: 3rem 4rem; }
  .hero-copy { position: relative; z-index: 2; }
  .hero-title { font-size: clamp(3.7rem, 16.8vw, 6.4rem); }
  .hero-copy-footer { max-width: 32rem; margin-top: 2rem; }
  .hero-description { max-width: 28rem; }
  .hero-stack { width: min(100%, 34rem); margin-top: 2rem; }
  .hero-visual { position: absolute; right: -8rem; bottom: -3rem; z-index: 0; width: 21rem; min-height: 21rem; border: 0; }
  .visual-index, .visual-footer { display: none; }
  .orbit-scene { width: 100%; }
  .orbit-node { background: var(--surface); }
  .hero-scroll-cue { display: none; }

  .section-title { margin-bottom: 3.5rem; font-size: clamp(3rem, 13vw, 5rem); }
  .section-title::before { margin-bottom: 2.5rem; }
  .section-subtitle { margin: -1.5rem 0 2.5rem; }
  .about-text p { padding-left: 2.5rem; font-size: 1.1rem; }
  .about-highlights { grid-template-columns: 1fr; }
  .timeline-content { grid-template-columns: 1fr; gap: 1.5rem; }
  .timeline-content:hover { padding-inline: 0.5rem; }
  .project-card,
  .featured-project { grid-column: 1 / -1; }
  .featured-project { grid-template-columns: 1fr; }
  .featured-project .project-image { min-height: 280px; height: 280px; }
  .featured-project .project-content { min-height: 0; }
  .project-content { min-height: 0; }
  .projects-grid.project-remainder-1 > .project-card:last-child:not(.featured-project) {
    display: flex;
    grid-template-columns: none;
  }
  .projects-grid.project-remainder-1 > .project-card:last-child:not(.featured-project) .project-image {
    height: clamp(190px, 17vw, 250px);
    min-height: 0;
  }
  .project-filter-bar { margin-top: -1.5rem; }
  .github-stats-grid { grid-template-columns: 1fr 1fr; }
  .github-stat-card { min-height: 13rem; }
  .github-stat-icon { margin-bottom: 2.75rem; }
  .chat-active { height: min(620px, calc(100svh - 9rem)); }
  .chat-message { max-width: 90%; }
  .footer .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  :root { --gutter: 1.15rem; }
  .logo-mark { width: 2.2rem; height: 2.2rem; }
  .hero-inner { padding-top: 2.4rem; }
  .hero-kicker [data-i18n='location-label'],
  .hero-kicker-separator { display: none; }
  .hero-title { font-size: clamp(3.35rem, 17.3vw, 5rem); }
  .hero-title-indent { margin-left: 0.65rem; }
  .hero-subtitle { font-size: 1.1rem; }
  .hero-description { max-width: 21rem; font-size: 0.86rem; line-height: 1.6; }
  .hero-actions { max-width: 21rem; flex-direction: column; gap: 0.45rem; }
  .hero-action { width: 100%; }
  .hero-stack { max-width: 21rem; flex-wrap: wrap; gap: 0.5rem 0.8rem; }
  .hero-stack-label { width: 100%; }
  .hero-visual { right: -7rem; bottom: -1rem; width: 16rem; min-height: 16rem; }
  .orbit-node { display: none; }
  .capability-set span { padding-inline: 1.25rem; }
  .section-title { font-size: 2.8rem; }
  .project-image, .skeleton-image { height: 200px; }
  .featured-project .project-image { min-height: 220px; height: 220px; }
  .project-card h3 { font-size: 2rem; }
  .project-actions { flex-direction: column; }
  .project-link { justify-content: center; }
  .skills-wrapper { height: 390px; }
  .skills-groups { grid-template-columns: 1fr; }
  .skill-group-card { min-height: 10rem; }
  .skill-group-card h3 { margin-bottom: 1.5rem; }
  .github-stats-grid { grid-template-columns: 1fr; }
  .github-stat-card { min-height: 11rem; }
  .github-stat-icon { margin-bottom: 1.75rem; }
  .github-link-container { text-align: left; }
  .chat-container::before { font-size: 0.5rem; }
  .chat-initial, .chat-preparing { min-height: 350px; padding: 3rem 1.25rem; }
  .chat-messages { padding: 1rem; }
  .chat-suggestions { padding-inline: 1rem; }
  .chat-input-area { padding: 0.8rem 1rem 1rem; }
  .contact-description { font-size: 1.65rem; }
  .contact-card { min-height: 27rem; padding: 1.5rem; }
  .contact-card h3 { font-size: 3rem; }
  .contact-card-actions { flex-direction: column; }
  .contact-links { grid-template-columns: 1fr; }
  .contact-link, .copy-email-btn { min-height: 4.5rem; }
  .back-to-top { right: 1rem; bottom: 1rem; }
}

@media (pointer: coarse) {
  .cursor-spotlight { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-aos],
  .section-title,
  .about-content,
  .timeline-item,
  .github-stat-card,
  .skill-group-card,
  .contact-content,
  .hero-kicker,
  .hero-title > span,
  .hero-copy-footer,
  .hero-stack,
  .hero-visual,
  .hero-scroll-cue { opacity: 1; transform: none; }
  .capability-track { width: 100%; flex-wrap: wrap; }
  .capability-set:last-child { display: none; }
}
