/* ============================================================
   Thibault Lapeyre — Portfolio
   Pure HTML/CSS/JS — Mistral-inspired minimal design
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 1200px;
  --nav-h: 64px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.3s;

  --transition-theme: background-color var(--dur) var(--ease),
                      color var(--dur) var(--ease),
                      border-color var(--dur) var(--ease),
                      fill var(--dur) var(--ease);
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-2: #0f0f0f;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --border: #262626;
  --text: #fafafa;
  --text-2: #a3a3a3;
  --text-3: #737373;
  --accent: #ffffff;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.55);
  --mesh-1: rgba(120, 120, 120, 0.10);
  --mesh-2: rgba(60, 60, 60, 0.10);
  color-scheme: dark;
}

/* Light theme */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e5e5e5;
  --text: #0a0a0a;
  --text-2: #525252;
  --text-3: #a3a3a3;
  --accent: #0a0a0a;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.10);
  --mesh-1: rgba(0, 0, 0, 0.04);
  --mesh-2: rgba(0, 0, 0, 0.03);
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: var(--transition-theme);
  position: relative;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
svg { display: block; }

::selection { background: var(--text); color: var(--bg); }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.skip-link:focus { top: 16px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 120px 0;
  position: relative;
}

@media (max-width: 768px) {
  .section { padding: 80px 0; }
  .partners { padding: 24px 0 48px; }
}

/* ---------- Progress bar ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--text);
  z-index: 100;
  transition: width 0.1s linear;
}

/* ---------- Background mesh ---------- */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 1;
  transition: var(--transition-theme);
}
.mesh-orb-1 {
  width: 600px; height: 600px;
  background: var(--mesh-1);
  top: -200px; right: -100px;
  animation: float 20s ease-in-out infinite;
}
.mesh-orb-2 {
  width: 500px; height: 500px;
  background: var(--mesh-2);
  bottom: -150px; left: -100px;
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.05); }
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 50;
  transition: var(--transition-theme), backdrop-filter var(--dur);
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 0;
  color: var(--text);
  transform: rotate(-4deg);
  display: inline-block;
  transition: transform var(--dur) var(--ease);
}
.nav-logo:hover {
  transform: rotate(-2deg) scale(1.05);
}
.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}
.nav-link {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  position: relative;
  transition: color var(--dur) var(--ease);
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--text);
  transition: width var(--dur) var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-toggle {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: var(--transition-theme);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}
.nav-toggle:hover {
  background: var(--surface);
  color: var(--text);
}
#langToggle {
  width: auto;
  padding: 0 10px;
  letter-spacing: 0.05em;
}
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Burger */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
}
.nav-burger span {
  width: 18px; height: 2px;
  background: var(--text);
  transition: var(--dur) var(--ease);
  border-radius: 2px;
}
.nav-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    transform: translateY(calc(-100% - var(--nav-h) - 20px));
    visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
    z-index: 49;
  }
  .nav-links.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform var(--dur) var(--ease), visibility 0s;
  }
  .nav-burger { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 40px) 0 80px;
  position: relative;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: center;
  width: 100%;
}
.hero-tag {
  display: inline-block;
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 24px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}
.hero-title .word,
.hero-title .dot {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  animation: wordIn 0.8s var(--ease) forwards;
}
.hero-title .dot {
  color: var(--text-3);
  margin: 0 0.1em;
}
.hero-title .word:nth-child(1) { animation-delay: 0.1s; }
.hero-title .dot:nth-child(2) { animation-delay: 0.25s; }
.hero-title .word:nth-child(3) { animation-delay: 0.4s; }
.hero-title .dot:nth-child(4) { animation-delay: 0.55s; }
.hero-title .word:nth-child(5) { animation-delay: 0.7s; }

@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); }
}

.hero-desc {
  font-size: 18px;
  color: var(--text-2);
  max-width: 520px;
  margin-bottom: 40px;
  line-height: 1.65;
}
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Photo */
.hero-photo {
  display: flex;
  justify-content: center;
}
.photo-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.photo-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, transparent 60%, color-mix(in srgb, var(--bg) 30%, transparent));
  pointer-events: none;
}
.photo-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition-theme), transform var(--dur) var(--ease);
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn-ghost:hover {
  border-color: var(--text);
  transform: translateY(-2px);
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.5;
}
.mouse {
  display: block;
  width: 22px; height: 36px;
  border: 1.5px solid var(--text-2);
  border-radius: 12px;
  position: relative;
}
.wheel {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 7px;
  background: var(--text-2);
  border-radius: 2px;
  animation: wheel 1.6s ease infinite;
}
@keyframes wheel {
  0% { opacity: 1; top: 6px; }
  100% { opacity: 0; top: 18px; }
}

@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: left;
  }
  .hero-photo { order: -1; }
  .photo-wrap { max-width: 200px; }
  .scroll-hint { display: none; }
}

/* ---------- Section heads ---------- */
.section-head {
  margin-bottom: 64px;
}
.section-num {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.section-sub {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 17px;
  max-width: 600px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 64px;
  align-items: start;
}
.about-text p {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.75;
  margin-bottom: 20px;
}
.about-text p:last-child { margin-bottom: 0; }

.about-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 640px) {
  .about-cards { grid-template-columns: 1fr; }
}

/* ---------- Partners ---------- */
.partners { padding: 32px 0 64px; }
.partners .section-head { margin-bottom: 24px; text-align: center; }
.partners .section-title { font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 500; }
.partners .section-sub { margin-top: 8px; margin-inline: auto; font-size: 14px; }
.partners-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.partner-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  min-width: 200px;
  max-width: 200px;
  padding: 20px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition-theme), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.partner-logo img {
  width: auto;
  height: 40px;
  max-width: 100%;
  object-fit: contain;
  display: block;
  filter: grayscale(1) brightness(1.6) opacity(0.7);
  transition: filter var(--dur) var(--ease);
}
.partner-logo img[src$=".svg"] {
  filter: brightness(0) invert(1) opacity(0.7);
}
.partner-logo img[src*="bunny"] {
  filter: brightness(0) invert(1) opacity(0.7);
}
.partner-logo:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
  box-shadow: var(--shadow-hover);
}
.partner-logo:hover img {
  filter: grayscale(0) opacity(1);
}
.partner-logo:hover img[src$=".svg"] {
  filter: none;
}
.partner-logo:hover img[src*="bunny"] {
  filter: none;
}
[data-theme="light"] .partner-logo img {
  filter: grayscale(1) brightness(0.25) opacity(0.7);
}
[data-theme="light"] .partner-logo img[src$=".svg"] {
  filter: brightness(0) opacity(0.7);
}
[data-theme="light"] .partner-logo img[src*="bunny"] {
  filter: brightness(0) opacity(0.7);
}
[data-theme="light"] .partner-logo:hover img {
  filter: grayscale(0) brightness(1) opacity(1);
}
[data-theme="light"] .partner-logo:hover img[src$=".svg"] {
  filter: none;
}
[data-theme="light"] .partner-logo:hover img[src*="bunny"] {
  filter: none;
}
@media (max-width: 640px) {
  .partners-grid { gap: 12px; }
  .partner-logo { height: 64px; min-width: 0; max-width: calc(50% - 6px); padding: 12px 16px; }
  .partner-logo img { height: 28px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: var(--transition-theme), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
  box-shadow: var(--shadow-hover);
}
.card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  margin-bottom: 20px;
}
.card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.card p {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .skills-grid { grid-template-columns: 1fr; }
}

/* ---------- Projects ---------- */
.projects-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: block;
  transition: var(--transition-theme), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--text) 25%, var(--border));
  box-shadow: var(--shadow-hover);
}
.project-featured {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.badge {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.badge-featured {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}
.project-arrow {
  color: var(--text-2);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.project-card:hover .project-arrow {
  color: var(--text);
  transform: translate(4px, -4px);
}
.project-card h3 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.project-card p {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.65;
  max-width: 700px;
  margin-bottom: 24px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

@media (max-width: 640px) {
  .project-card { padding: 28px; }
}

/* ---------- Resources ---------- */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.resource-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-theme), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.resource-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
}
.resource-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.resource-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}
.resource-card p {
  color: var(--text-2);
  font-size: 14px;
}
@media (max-width: 768px) {
  .resources-grid { grid-template-columns: 1fr; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition-theme), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.contact-card:not(.no-link):hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
}
.contact-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  margin-bottom: 4px;
}
.contact-label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.contact-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}
@media (max-width: 1024px) {
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  background: var(--bg-2);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  display: block;
  margin-bottom: 4px;
}
.footer-copy {
  font-size: 13px;
  color: var(--text-3);
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links a {
  font-size: 14px;
  color: var(--text-2);
  transition: color var(--dur) var(--ease);
}
.footer-links a:hover { color: var(--text); }

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children inside grids */
.skills-grid .card.reveal.in:nth-child(1),
.about-cards .card.reveal.in:nth-child(1) { transition-delay: 0s; }
.skills-grid .card.reveal.in:nth-child(2),
.about-cards .card.reveal.in:nth-child(2) { transition-delay: 0.08s; }
.skills-grid .card.reveal.in:nth-child(3),
.about-cards .card.reveal.in:nth-child(3) { transition-delay: 0.16s; }
.skills-grid .card.reveal.in:nth-child(4) { transition-delay: 0.24s; }
.skills-grid .card.reveal.in:nth-child(5) { transition-delay: 0.32s; }
.skills-grid .card.reveal.in:nth-child(6) { transition-delay: 0.40s; }
.contact-grid .contact-card.reveal.in:nth-child(2) { transition-delay: 0.08s; }
.contact-grid .contact-card.reveal.in:nth-child(3) { transition-delay: 0.16s; }
.contact-grid .contact-card.reveal.in:nth-child(4) { transition-delay: 0.24s; }
.resources-grid .resource-card.reveal.in:nth-child(2) { transition-delay: 0.08s; }
.resources-grid .resource-card.reveal.in:nth-child(3) { transition-delay: 0.16s; }
.partners-grid .partner-logo.reveal.in:nth-child(1) { transition-delay: 0s; }
.partners-grid .partner-logo.reveal.in:nth-child(2) { transition-delay: 0.08s; }
.partners-grid .partner-logo.reveal.in:nth-child(3) { transition-delay: 0.16s; }
.partners-grid .partner-logo.reveal.in:nth-child(4) { transition-delay: 0.24s; }
.partners-grid .partner-logo.reveal.in:nth-child(5) { transition-delay: 0.32s; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--dur) var(--ease);
  overflow: hidden;
}
.modal.open .modal-panel {
  transform: translateY(0) scale(1);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: var(--transition-theme);
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-body {
  padding: 24px 28px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.modal-body p {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 16px;
}
.modal-body h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 8px;
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p:last-child { margin-bottom: 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-title .word, .hero-title .dot { opacity: 1; transform: none; }
  .mesh-orb { animation: none; }
}
