/* ==========================================================================
   Ziya Abdurahimli — portfolio stylesheet
   Adapted from Tooplate 2162 StackCraft (https://www.tooplate.com/view/2162-stackcraft)
   Recoloured, re-typeset and extended with styles for about / projects / contact.
   Motion and page transitions live in motion.css.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #07070d;
  --surface: #0f1020;
  --surface-2: #14162a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);

  --text: #eef0f8;
  --muted: #9296ae;
  --muted-dim: #8d92a9;

  --violet: #8b5cff;
  --cyan: #35e0ff;
  --pink: #ff75b5;
  --lime: #c8ff5c;

  --grad: linear-gradient(115deg, var(--violet) 0%, var(--cyan) 55%, var(--pink) 100%);

  --radius: 22px;
  --radius-sm: 13px;
  --radius-pill: 999px;

  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  --font-display: "Sora", "Manrope", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --shadow: 0 40px 90px -45px rgba(0, 0, 0, 0.95);
  --ease: cubic-bezier(0.22, 0.68, 0.24, 1);
  --nav-h: 76px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 600px at 82% -8%, rgba(139, 92, 255, 0.20), transparent 62%),
    radial-gradient(760px 520px at 6% 12%, rgba(53, 224, 255, 0.12), transparent 60%),
    radial-gradient(900px 700px at 50% 108%, rgba(255, 117, 181, 0.09), transparent 65%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.72;
  font-weight: 400;
  letter-spacing: 0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

::selection {
  background: rgba(139, 92, 255, 0.45);
  color: #fff;
}

/* ---------- Layout helpers ---------- */
.section {
  position: relative;
  z-index: 1;
  padding: clamp(72px, 9vw, 130px) 0;
}

.section-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 52px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.section-label::before {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--grad);
}

.display {
  font-size: clamp(2rem, 4vw, 3.15rem);
  max-width: 22ch;
}

.display em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.16em;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-right: 0.06em;
}

.section-sub {
  color: var(--muted);
  max-width: 52ch;
  margin-top: 16px;
  font-size: 1.02rem;
}

.divider {
  height: 1px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

main { display: block; }

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -200%);
  z-index: 100;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  background: var(--grad);
  color: #08040f;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
}

.skip-link:focus { transform: translate(-50%, 0); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.actions--spaced { margin: 32px 0 0; }
.section--tight { padding-top: 0; }
.section--lead { padding-top: 24px; }
.footer-credit { font-size: 0.8rem; }
.skill-note { color: var(--muted-dim); font-style: normal; }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
  will-change: transform;
}

.btn svg { width: 17px; height: 17px; }

.btn-primary {
  background: var(--grad);
  color: #0a0616;
  font-weight: 600;
  box-shadow: 0 18px 40px -18px rgba(139, 92, 255, 0.85);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 55px -18px rgba(53, 224, 255, 0.7);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--grad);
  z-index: 90;
}

/* ---------- Top of the page ----------
   The glow is painted on the page, not on the nav, and is always lit. */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(72% 118% at 50% -12%, rgba(139, 92, 255, 0.26), rgba(53, 224, 255, 0.09) 46%, transparent 74%),
    radial-gradient(46% 90% at 12% -18%, rgba(255, 117, 181, 0.14), transparent 70%);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  height: var(--nav-h);
  display: flex;
  align-items: center;
}

/* Once scrolled: only a feathered blur, never a dark bar */
.nav.scrolled::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 58%, transparent 100%);
}

.nav-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 5px 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.nav-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #08040f;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 24px -12px rgba(139, 92, 255, 0.9);
}

.nav-logo span.name-muted { color: var(--muted); font-weight: 400; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--grad);
}

.nav-links a.nav-cta {
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 10px 20px;
  margin-left: 8px;
}

.nav-links a.nav-cta.active::after { display: none; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 1.6px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s ease;
}

.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 48px) 0 64px;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.85;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  z-index: -2;
  animation: float 16s var(--ease) infinite alternate;
}

.hero-orb-1 { width: 380px; height: 380px; top: -60px; right: 6%; background: rgba(139, 92, 255, 0.5); }
.hero-orb-2 { width: 300px; height: 300px; bottom: 4%; left: -70px; background: rgba(53, 224, 255, 0.32); animation-delay: -6s; }
.hero-orb-3 { width: 220px; height: 220px; top: 42%; right: 34%; background: rgba(255, 117, 181, 0.22); animation-delay: -11s; }

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(26px, -38px, 0) scale(1.14); }
}

.hero-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 26px;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(200, 255, 92, 0.7);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(200, 255, 92, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(200, 255, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 255, 92, 0); }
}

.hero-title {
  font-size: clamp(2.6rem, 6.4vw, 4.7rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.hero-title .line { display: block; }

.hero-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.12em;
  font-weight: 400;
  letter-spacing: -0.04em;
  background: var(--grad);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-right: 0.08em;
}

.hero-tagline {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 46ch;
  margin-bottom: 34px;
}

.type-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 30px;
  min-height: 26px;
}

.type-line .type-prefix { color: var(--muted-dim); font-family: var(--font-body); font-size: 0.9rem; }
#typewriter { color: var(--cyan); }

.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--cyan);
  translate: 0 2px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 46px;
}

/* ---------- Hero code window ---------- */
.hero-visual {
  position: relative;
  animation: breathe 16s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.013) translateY(-6px); }
}

.code-card {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #15172b, #09090f);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: perspective(1200px) rotateY(-7deg) rotateX(3deg);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), border-color 0.45s var(--ease);
}

.code-card:hover {
  transform: perspective(900px) rotateY(5deg) rotateX(-4deg) translateY(-14px) scale(1.02);
  border-color: rgba(139, 92, 255, 0.45);
  box-shadow: 0 60px 120px -45px rgba(139, 92, 255, 0.6);
}

.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

/* three plain dots, the way macOS actually draws them; each one also
   carries the glyph its hover state draws */
.code-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.code-dot:nth-child(1) {
  background: #ff6b81;
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.4 2.4 7.6 7.6M7.6 2.4 2.4 7.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.code-dot:nth-child(2) {
  background: #ffd166;
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.2 5h5.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.code-dot:nth-child(3) {
  background: #4ade80;
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M9 1v6.2L2.8 1z' fill='%23fff'/%3E%3Cpath d='M1 9V2.8L7.2 9z' fill='%23fff'/%3E%3C/svg%3E");
}

/* window controls: close, minimise and expand, drawn as masks over the dot */
.code-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 5, 10, 0.66);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
  -webkit-mask-image: var(--glyph);
  mask-image: var(--glyph);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 66% 66%;
  mask-size: 66% 66%;
}

.code-title {
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted-dim);
  letter-spacing: 0.04em;
}

.code-badge {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
  padding: 5px 11px 5px 23px;
  border-radius: var(--radius-pill);
  background: rgba(139, 92, 255, 0.12);
  border: 1px solid rgba(139, 92, 255, 0.35);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.code-badge::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 9px rgba(200, 255, 92, 0.75);
}

.code-body {
  padding: 24px 22px 30px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.85;
  color: #cdd2e6;
  overflow-x: auto;
}

.code-body .cm { color: #5d6382; }
.code-body .kw { color: #c792ea; }
.code-body .typ { color: #7dd3fc; }
.code-body .pr { color: #a5e8c1; }
.code-body .str { color: #ffd48a; }
.code-body .fn { color: #8b9dff; }
.code-body .op { color: #8d93b0; }
.code-body .num { color: var(--pink); }

.code-line {
  display: block;
  padding: 0 8px;
  margin: 0 -8px;
  border-radius: 6px;
  animation: lineIn 0.45s var(--ease) both;
  transition: background 0.18s ease, transform 0.18s var(--ease);
}

@keyframes lineIn {
  from { opacity: 0; transform: translateX(-7px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  gap: 48px;
  animation: marquee 34s linear infinite;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.4s var(--ease);
}

.marquee-item::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
  opacity: 0.8;
}

.marquee:hover .marquee-item { color: var(--text); }

/* ---------- Work: shared card parts ---------- */
.project-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, #15172b, #0a0a13);
  overflow: hidden;
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  transform-style: preserve-3d;
  will-change: transform;
}

.project-card:hover {
  border-color: rgba(139, 92, 255, 0.5);
  box-shadow: 0 40px 70px -40px rgba(139, 92, 255, 0.65);
}

.project-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.9) contrast(1.02);
}

.project-card:hover .project-thumb img { transform: scale(1.06); filter: saturate(1.1); }

.project-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(7, 7, 13, 0.85));
  pointer-events: none;
}

.project-info { padding: 24px 24px 26px; }

.project-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.project-tag {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.02);
}

.project-name {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  transition: color 0.3s var(--ease);
}

.project-card:hover .project-name { color: #fff; }

.project-desc { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.project-link svg { width: 15px; height: 15px; transition: transform 0.3s var(--ease); }
.project-link:hover { color: var(--cyan); }
.project-link:hover svg { transform: translate(3px, -3px); }

.featured-grid { display: grid; gap: 26px; grid-template-columns: repeat(3, 1fr); }

/* ---------- Work index: numbered editorial rows ---------- */
.card-grid {
  counter-reset: proj;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  perspective: 1400px;
}

.card-grid .project-card {
  counter-increment: proj;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 250px;
  align-items: center;
  gap: 26px;
  padding: 22px 26px;
  border-radius: 20px;
  background: linear-gradient(100deg, #101224 0%, #0a0a13 58%, #0c0c19 100%);
  transform: none;
  transform-style: flat;
  will-change: auto;
  transition: border-color 0.5s var(--ease), transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.card-grid .project-card::before {
  content: counter(proj, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.2);
  transition: color 0.45s var(--ease), transform 0.45s var(--ease);
}

.card-grid .project-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.75s var(--ease);
}

.card-grid .project-card:hover {
  border-color: rgba(139, 92, 255, 0.42);
  transform: translateY(-4px);
  box-shadow: 0 44px 80px -55px rgba(139, 92, 255, 0.9);
}

.card-grid .project-card:hover::before { color: var(--cyan); transform: translateX(2px); }
.card-grid .project-card:hover::after { transform: scaleX(1); }

.card-grid .project-thumb {
  grid-column: 3;
  grid-row: 1;
  aspect-ratio: 16 / 11;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.card-grid .project-thumb img {
  filter: saturate(0.92) contrast(1.03);
  transition: transform 1s var(--ease), filter 0.7s var(--ease);
}

.card-grid .project-card:hover .project-thumb img {
  transform: scale(1.07);
  filter: saturate(1.08);
}

.card-grid .project-info { grid-column: 2; grid-row: 1; min-width: 0; }
.card-grid .project-tags { margin-bottom: 10px; }
.card-grid .project-name { font-size: 1.3rem; margin-bottom: 8px; }
.card-grid .project-desc { font-size: 0.92rem; line-height: 1.66; margin-bottom: 0; max-width: 64ch; }

.project-card.is-hidden { display: none; }

.card-grid .project-card.card-leaving {
  opacity: 0;
  transform: translateY(-8px) scale(0.975);
  filter: blur(4px);
  transition: opacity 0.26s ease, transform 0.34s var(--ease), filter 0.3s ease;
  pointer-events: none;
}

.card-grid .project-card.card-entering {
  animation: rowIn 0.78s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* each arriving row draws its own gradient underline once */
.card-grid .project-card.card-entering::after {
  animation: rowSweep 0.95s var(--ease) both;
}

@keyframes rowIn {
  0% { opacity: 0; transform: translate3d(-18px, 32px, 0) scale(0.965); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

@keyframes rowSweep {
  0% { transform: scaleX(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ---------- Stats ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 38px 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin-top: 6px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(32px, 5vw, 68px);
  align-items: center;
}

.portrait {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow);
}

.portrait img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.portrait:hover img { transform: scale(1.035); }

.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(139, 92, 255, 0.16), transparent 45%, rgba(7, 7, 13, 0.55));
}

.portrait-tag {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: rgba(7, 7, 13, 0.72);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  font-family: var(--font-display);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.about-text h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  margin-bottom: 18px;
  letter-spacing: -0.03em;
}

.about-text p { color: var(--muted); }

.fact-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.fact-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.95rem;
}

.fact-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 10px;
  flex: 0 0 auto;
  background: var(--grad);
}

/* ---------- The road so far ---------- */
.timeline {
  position: relative;
  display: grid;
  gap: 2px;
  padding-left: 34px;
  counter-reset: step;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg,
    rgba(139, 92, 255, 0.95),
    rgba(53, 224, 255, 0.9) 58%,
    rgba(255, 117, 181, 0.75));
  box-shadow: 0 0 20px rgba(139, 92, 255, 0.35);
  opacity: 0.7;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.5s cubic-bezier(0.19, 1, 0.22, 1) 0.1s;
}

.timeline.is-drawn::before { transform: scaleY(1); }

.timeline-item {
  position: relative;
  counter-increment: step;
  padding: 26px 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.timeline-item:hover {
  background: linear-gradient(100deg, rgba(139, 92, 255, 0.09), rgba(139, 92, 255, 0) 62%);
  border-left-color: rgba(139, 92, 255, 0.45);
  transform: translateX(5px);
}

/* chapter numeral sits with the title, not stranded in the margin */
.timeline-role::before {
  content: counter(step, decimal-leading-zero);
  margin-right: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.3);
  vertical-align: 2px;
  transition: color 0.4s var(--ease);
}

.timeline-item:hover .timeline-role::before { color: rgba(53, 224, 255, 0.85); }

/* connector from the rail into each entry */
.timeline-item::after {
  content: "";
  position: absolute;
  left: -28px;
  top: 38px;
  width: 27px;
  height: 1px;
  background: linear-gradient(90deg, rgba(139, 92, 255, 0.6), rgba(139, 92, 255, 0.05));
}

.timeline-dot {
  position: absolute;
  left: -34px;
  top: 33px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid rgba(139, 92, 255, 0.75);
  box-shadow: 0 0 0 5px rgba(139, 92, 255, 0.08);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}

.timeline-item:hover .timeline-dot {
  background: var(--violet);
  border-color: transparent;
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(139, 92, 255, 0.16), 0 0 20px rgba(139, 92, 255, 0.75);
}

.timeline-date {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline-role { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
.timeline-org { font-size: 0.86rem; color: var(--muted-dim); margin-bottom: 10px; }
.timeline-desc { color: var(--muted); font-size: 0.94rem; margin: 0; max-width: 62ch; }

/* the entry you are living in now */
.timeline-item:last-child .timeline-dot {
  border-color: rgba(200, 255, 92, 0.8);
  box-shadow: 0 0 0 5px rgba(200, 255, 92, 0.1), 0 0 18px rgba(200, 255, 92, 0.45);
}

.timeline-item:last-child .timeline-date {
  color: var(--lime);
  border-color: rgba(200, 255, 92, 0.32);
  background: rgba(200, 255, 92, 0.07);
}

.timeline-item:last-child::after {
  background: linear-gradient(90deg, rgba(200, 255, 92, 0.5), rgba(200, 255, 92, 0.04));
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(26px, 4vw, 52px);
}

.skill-group {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}

.skill-group h3 {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
  font-weight: 500;
}

.skill-bar + .skill-bar { margin-top: 20px; }

.skill-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 9px;
  font-size: 0.92rem;
}

.skill-bar-pct { font-family: var(--font-display); font-size: 0.78rem; color: var(--muted-dim); }

.skill-track {
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--grad);
  transition: width 1.4s var(--ease);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.85rem;
  color: var(--muted);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease);
}

.chip:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 255, 0.55);
  color: var(--text);
  background: rgba(139, 92, 255, 0.1);
}

.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }

/* ---------- Page header (inner pages) ---------- */
.page-head {
  position: relative;
  z-index: 1;
  padding: calc(var(--nav-h) + 84px) 0 64px;
  overflow: hidden;
}

.page-head-inner { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.page-title {
  font-size: clamp(2.3rem, 5.4vw, 3.9rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 14px 0 20px;
  max-width: 20ch;
}

.page-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.16em;
  font-weight: 400;
  letter-spacing: -0.04em;
  white-space: nowrap;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-sub { color: var(--muted); max-width: 56ch; font-size: 1.04rem; }

.page-head-glow {
  position: absolute;
  top: -160px;
  right: -80px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 255, 0.28), transparent 65%);
  filter: blur(40px);
  z-index: -1;
}

/* ---------- Project filters: one sliding pill ---------- */
.filters {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  margin-bottom: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.025);
}

.filter-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.84rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.35s var(--ease), background 0.35s var(--ease);
}

.filter-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.filter-btn.active {
  color: #08040f;
  font-weight: 600;
  box-shadow: 0 14px 32px -16px rgba(139, 92, 255, 0.95);
}

.filter-indicator {
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--grad);
  box-shadow: 0 16px 34px -18px rgba(139, 92, 255, 0.95);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s var(--ease);
}

/* ---------- Contact ---------- */
.contact-page {
  position: relative;
  z-index: 1;
  padding: calc(var(--nav-h) + 84px) 0 clamp(8px, 2vw, 24px);
  overflow-x: clip;
}

.contact-page-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.16fr 0.84fr;
  column-gap: clamp(32px, 5.5vw, 76px);
  row-gap: clamp(36px, 4vw, 56px);
  align-items: start;
}

.contact-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background:
    radial-gradient(420px 240px at 4% 0%, rgba(139, 92, 255, 0.16), transparent 62%),
    linear-gradient(165deg, #15172b, #0a0a13);
}

.contact-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grad);
  opacity: 0.55;
}

/* the card drops past the eyebrow so its heading sits on the headline's
   first line, spans both rows, and rides along while the form scrolls */
@media (min-width: 1001px) {
  .contact-copy { grid-column: 1; grid-row: 1; }
  .form { grid-column: 1; grid-row: 2; }

  .contact-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    margin-top: 30px;
  }
}

.contact-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.contact-panel h2 { font-size: 1.45rem; }

.contact-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(200, 255, 92, 0.28);
  border-radius: var(--radius-pill);
  background: rgba(200, 255, 92, 0.06);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}

.contact-panel > p { color: var(--muted); font-size: 0.95rem; margin-bottom: 22px; }

.contact-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
}

.contact-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--grad);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s var(--ease);
}

.contact-item:hover {
  border-color: rgba(139, 92, 255, 0.5);
  background: rgba(139, 92, 255, 0.07);
  transform: translateX(4px);
}

.contact-item:hover::before { transform: scaleY(1); }

.contact-item .ico {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(139, 92, 255, 0.14);
  border: 1px solid rgba(139, 92, 255, 0.3);
  color: var(--text);
  transition: transform 0.38s var(--ease), background 0.38s var(--ease);
}

.contact-item:hover .ico { transform: rotate(-8deg) scale(1.07); background: rgba(139, 92, 255, 0.24); }

.contact-item .ico svg { width: 18px; height: 18px; }
.contact-item b { display: block; font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-dim); font-weight: 500; }
.contact-item span { font-size: 0.94rem; overflow-wrap: break-word; }
.contact-item > span:nth-child(2) { flex: 1; min-width: 0; }

.contact-arrow {
  margin-left: auto;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: transform 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
}

.contact-arrow svg { width: 14px; height: 14px; }

.contact-item:hover .contact-arrow {
  transform: translate(3px, -3px);
  color: var(--text);
  border-color: rgba(139, 92, 255, 0.55);
  background: rgba(139, 92, 255, 0.16);
}

.contact-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.contact-facts b { display: block; font-family: var(--font-display); font-size: 1.02rem; font-weight: 500; letter-spacing: -0.01em; }
.contact-facts span { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-dim); }

.form {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background: rgba(255, 255, 255, 0.018);
}

.form::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}

.form:focus-within::before { transform: scaleX(1); }

.form-head { margin-bottom: 24px; }
.form-head h2 { font-size: 1.45rem; margin-bottom: 8px; }
.form-head p { color: var(--muted); font-size: 0.92rem; }

.field { margin-bottom: 20px; }

.field label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.field-index {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: rgba(139, 92, 255, 0.9);
}

.input,
.textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(7, 7, 13, 0.6);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.textarea {
  min-height: 148px;
  max-height: 420px;
  resize: none;
  overflow-y: auto;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.textarea::-webkit-scrollbar { width: 8px; }
.textarea::-webkit-scrollbar-track { background: transparent; }
.textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.input::placeholder,
.textarea::placeholder { color: var(--muted-dim); }

.input:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(139, 92, 255, 0.13);
  background: rgba(7, 7, 13, 0.85);
}

.field.invalid .input,
.field.invalid .textarea { border-color: rgba(255, 117, 181, 0.8); }

.field .error {
  display: none;
  color: var(--pink);
  font-size: 0.8rem;
  margin-top: 6px;
}

.field.invalid .error { display: block; }

.field-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted-dim);
}

.form-status {
  margin-top: 18px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  padding: 0;
  color: var(--cyan);
  min-height: 1px;
}

.form-status.error { color: var(--pink); }

/* ---------- Contact outro ---------- */
.contact-outro {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding-top: clamp(30px, 4vw, 48px);
  border-top: 1px solid var(--line);
}

.contact-outro .section-label { display: flex; margin-bottom: 8px; }

.contact-mail {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.75rem, 4.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: var(--grad);
  background-size: 220% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-position 0.9s var(--ease);
  word-break: break-word;
}

.contact-mail svg {
  flex: 0 0 auto;
  width: clamp(22px, 3vw, 34px);
  height: clamp(22px, 3vw, 34px);
  stroke: var(--cyan);
  transition: transform 0.4s var(--ease);
}

.contact-mail:hover { background-position: 100% 50%; }
.contact-mail:hover svg { transform: translateX(6px); }

.contact-outro-note { color: var(--muted); font-size: 0.98rem; max-width: 44ch; }

.contact-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.contact-meta li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.contact-meta li:last-child { border-bottom: 0; padding-bottom: 0; }

.contact-meta span {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-dim);
}

.contact-meta b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.92rem;
  text-align: right;
}

.contact-meta [data-clock] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

/* ---------- CTA band ---------- */
.cta-band {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(36px, 6vw, 64px);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  overflow: hidden;
}

.cta-band h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); letter-spacing: -0.03em; max-width: 18ch; }
.cta-band p { color: var(--muted); margin-top: 12px; max-width: 44ch; }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  margin-top: clamp(60px, 8vw, 100px);
  border-top: 1px solid var(--line);
  padding: 46px 0 40px;
}

.footer-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}

.footer p { margin: 0; font-size: 0.86rem; color: var(--muted-dim); }
.footer a { color: var(--muted); border-bottom: 1px solid transparent; }
.footer a:hover { color: var(--text); border-bottom-color: var(--line-strong); }
.footer-links { display: flex; gap: 22px; font-size: 0.86rem; }
.footer-links a { display: inline-block; padding: 10px 0; }

/* ---------- Text that behaves like UI, not like an article ---------- */
.nav,
.btn,
.hero-label,
.code-badge,
.marquee,
.chip,
.portrait-tag,
.filter-btn,
.project-tag,
.stat-label,
.footer-links {
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) and (min-width: 761px) {
  .card-grid .project-card { grid-template-columns: 52px minmax(0, 1fr) 180px; gap: 18px; padding: 18px 20px; }
  .card-grid .project-card::before { font-size: 1.3rem; }
}

@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { max-width: 560px; margin-bottom: 40px; animation: none; }
  /* no 3D tilt on touch: the card should never jump and snap back */
  .code-card,
  .code-card:hover {
    transform: none;
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
  }
  .hero { min-height: auto; padding-bottom: 60px; }
  .featured-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 380px; }
  .contact-page-inner { grid-template-columns: 1fr; }
  .contact-page { padding-top: calc(var(--nav-h) + 60px); }
  .contact-outro { grid-template-columns: 1fr; align-items: start; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 30px 20px; }
}

/* ---------- Mobile menu: a full sheet, numbered, not a floating list ---------- */
@media (max-width: 820px) {
  body.menu-open { overflow: hidden; }
  .nav.menu-open { background: #09090f; }

  .nav-toggle { display: block; border-radius: 50%; }
  .nav-toggle.open { background: rgba(255, 255, 255, 0.06); border-color: rgba(139, 92, 255, 0.55); }

  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 22px 30px;
    background:
      radial-gradient(70% 46% at 92% -6%, rgba(139, 92, 255, 0.16), transparent 70%),
      #08080f;
    border: 0;
    overflow-y: auto;
    counter-reset: navlink;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.28s var(--ease), transform 0.4s var(--ease);
  }

  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }

  .nav-links li {
    position: relative;
    border-bottom: 1px solid var(--line);
    counter-increment: navlink;
  }

  .nav-links li:not(:last-child)::after {
    content: counter(navlink, decimal-leading-zero);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.28);
    pointer-events: none;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 21px 6px;
    border-radius: 0;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 5.6vw, 1.7rem);
    letter-spacing: -0.02em;
    color: var(--text);
    background: transparent;
  }

  .nav-links a:hover { background: transparent; color: var(--text); }
  .nav-links a.active::after { display: none; }

  .nav-links li:last-child { border-bottom: 0; margin-top: 26px; }

  .nav-links a.nav-cta {
    justify-content: center;
    margin: 0;
    padding: 16px 24px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--grad);
    color: #08040f;
    font-weight: 600;
    font-size: 1rem;
  }

  .nav-links a.nav-cta:hover { background: var(--grad); color: #08040f; }
}

@media (max-width: 760px) {
  .card-grid .project-card { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .card-grid .project-card::before { display: none; }

  .card-grid .project-info::before {
    content: counter(proj, decimal-leading-zero);
    display: block;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.34);
  }

  .card-grid .project-thumb,
  .card-grid .project-info { grid-column: auto; grid-row: auto; }
  .card-grid .project-thumb { aspect-ratio: 16 / 9; }

  .filters { width: 100%; }
  .filter-btn { flex: 1 1 auto; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .section-inner, .nav-inner, .page-head-inner, .contact-page-inner, .footer-inner, .cta-band, .divider {
    width: calc(100% - 36px);
  }
  .featured-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .skill-group, .form, .contact-panel { padding: 24px; }
  .hero-title { font-size: clamp(2.3rem, 10vw, 3.2rem); }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .code-body { font-size: 0.74rem; }
  .code-badge { font-size: 0.6rem; padding: 4px 9px 4px 20px; letter-spacing: 0.02em; }
  .code-badge::before { left: 9px; width: 5px; height: 5px; margin-top: -2.5px; }
  .form .btn { width: 100%; justify-content: center; }
  .marquee-item { font-size: 0.82rem; }

  .timeline { padding-left: 28px; }
  .timeline::before { left: 4px; }
  .timeline-item { padding: 20px 18px; }
  .timeline-role::before { font-size: 0.66rem; margin-right: 9px; }
  .timeline-item::after { left: -24px; width: 23px; top: 32px; }
  .timeline-dot { left: -28px; top: 27px; width: 10px; height: 10px; }
  .timeline-role { font-size: 1.08rem; }

  /* three chips on a phone: drop the arrow so the address fits one line */
  .contact-item { gap: 12px; padding: 14px; }
  .contact-item .ico { width: 34px; height: 34px; border-radius: 10px; }
  .contact-item > span:nth-child(2) > span { font-size: 0.86rem; }
  .contact-arrow { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
  html::before, html::after { display: none; }
}
