@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500&display=swap');

:root {
  --bg:      #F4FAFF;
  --surface: #C2E5FF;
  --border:  #8EC8F6;
  --accent:  #0090FF;
  --text:    #113264;
  --muted:   #4a7fb5;
}

[data-theme="dark"] {
  --bg:      #0D1520;
  --surface: #003362;
  --border:  #104D87;
  --accent:  #0090FF;
  --text:    #C2E6FF;
  --muted:   #7ab8e8;
}

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

html {
  scroll-snap-type: y mandatory;
}

body {
  background-color: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--text);
  min-height: 100vh;
}

.section {
  height: 100vh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 18px;
}

/* ── Theme toggle ── */
#theme-toggle {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 9999;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

#theme-checkbox {
  display: none;
}

.toggle-track {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
}

#theme-checkbox:checked + .toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

#theme-checkbox:checked + .toggle-track .toggle-thumb {
  transform: translateX(24px);
}


/* ── Page 1 ── */
#page1 {
  position: relative;
  background-image: url('/images/kirikitr.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#page1::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(5, 15, 35, 0.55);
}

#page1 > * {
  position: relative;
  z-index: 1;
}

#page1 h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 4rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  animation: fadeDown 0.8s ease both;
}

#page1 h1 span.cursor {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 300;
  animation: blink 1s step-end infinite;
}

#page1 h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.01em;
  text-align: center;
  max-width: 620px;
  line-height: 1.8;
  animation: fadeDown 0.8s ease 0.15s both;
}

.divider {
  width: 52px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  margin: 4px 0;
  animation: fadeDown 0.8s ease 0.25s both;
}

.pdp {
  height: 160px;
  width: auto;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.4);
}

#page1 .cv-btn {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

#page1 .cv-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
}

#page1 .logo {
  opacity: 0.8;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5));
}

.bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  margin-top: 12px;
}

.cv-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  padding: 11px 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.cv-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.logos {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  opacity: 0.75;
}

/* ── Page 2 ── */
#page2 {
  background: var(--bg);
  gap: 28px;
  justify-content: center;
}

#page2 > h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: 14px;
}

#page2 > h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 2px;
  background: var(--accent);
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
  width: 100%;
}

.about-body p {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.9;
}

p {
  max-width: 5000px;
}

/* Blocs mobiles cachés sur desktop */
.p3-mobile-title,
.proj-info-mobile {
  display: none;
}

/* ── Page 3 ── */
#page3 {
  scroll-snap-align: start;
  background: var(--bg);
}

.p3-layout {
  display: flex;
  flex-direction: row;
}

/* Colonne gauche : images qui scrollent */
.p3-left {
  flex: 1;
}

.proj-slide {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px 48px 60px;
}

/* ── Carousel ── */
.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px rgba(0, 144, 255, 0.1);
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.carousel-track img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  background: var(--bg);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  opacity: 0.85;
}

.carousel-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  opacity: 1;
}

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.carousel-dots .dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* Colonne droite : sticky */
.p3-right {
  flex: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 60px 60px 40px;
  gap: 20px;
}

.p3-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.proj-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.proj-info.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.proj-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.proj-tech {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.proj-desc {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.8;
  max-width: 420px;
}

.proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.proj-stack i {
  font-size: 1.8rem;
  line-height: 1;
}

.proj-stack-img {
  width: 1.8rem;
  height: 1.8rem;
  object-fit: contain;
}

.proj-stack .devicon-express-original,
.proj-stack .devicon-github-original,
.proj-stack .devicon-fastify-plain {
  color: var(--text);
}

.proj-link {
  align-self: flex-start;
  margin-top: 8px;
}

/* ── Page 4 ── */
#page4 {
  background: var(--bg);
  gap: 32px;
  justify-content: center;
  padding: 48px 60px;
}

#page4 > h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-align: center;
}

.stack-grid {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
}

.stack-category {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px;
  border-right: 1px solid var(--border);
}

.stack-category:last-child {
  border-right: none;
}

.stack-category h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 12px;
  text-align: center;
}

.tech-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.tech-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  min-width: 72px;
  cursor: default;
}

.tech-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(0, 144, 255, 0.14);
}

.tech-card i {
  font-size: 2rem;
  line-height: 1;
}

.tech-card span {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* Icônes noires → texte adapté selon le thème */
.devicon-express-original,
.devicon-github-original {
  color: var(--text);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════
   RESPONSIVE — mobile / tablette
   ══════════════════════════════════════ */
@media (max-width: 768px) {

  html {
    scroll-snap-type: none;
  }

  .section {
    height: auto;
    min-height: 100svh;
    scroll-snap-align: none;
    padding: 60px 20px 40px;
  }

  /* ── Toggle ── */
  #theme-toggle {
    top: 14px;
    right: 14px;
  }

  /* ── Page 1 ── */
  #page1 h1 {
    font-size: 2.4rem;
    text-align: center;
  }

  #page1 h2 {
    font-size: 0.95rem;
  }

  .pdp {
    height: 110px;
  }

  .bottom-row {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
  }

  .logos {
    gap: 20px;
  }

  .logo {
    height: 44px;
  }

  /* ── Page 2 ── */
  #page2 > h1 {
    font-size: 1.5rem;
  }

  .about-body p {
    font-size: 0.9rem;
  }

  /* ── Page 3 ── */
  #page3 {
    scroll-snap-align: none;
  }

  .p3-layout {
    flex-direction: column;
  }

  .p3-left {
    width: 100%;
  }

  .p3-mobile-title {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    padding: 24px 16px 8px;
  }

  .proj-slide {
    display: block !important;
    height: auto !important;
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }

  .proj-slide .carousel {
    display: block;
    width: 100%;
    height: 55vw;
    min-height: 180px;
    max-height: 280px;
    border-radius: 12px;
    margin-bottom: 0;
  }

  .proj-info-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 4px 24px;
    width: 100%;
  }

  .proj-name-m {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
  }

  .proj-desc-m {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.75;
  }

  .proj-stack-m {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .proj-stack-m i { font-size: 1.6rem; }
  .proj-stack-m .proj-stack-img { width: 1.6rem; height: 1.6rem; object-fit: contain; }

  .proj-stack-m .devicon-express-original,
  .proj-stack-m .devicon-github-original,
  .proj-stack-m .devicon-fastify-plain {
    color: var(--text);
  }

  /* Cache le panneau sticky desktop */
  .p3-right {
    display: none;
  }

  /* ── Page 4 ── */
  #page4 {
    padding: 60px 20px 40px;
    height: auto;
    min-height: 100svh;
    gap: 24px;
  }

  .stack-grid {
    flex-direction: column;
    gap: 28px;
  }

  .stack-category {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 24px 0;
    width: 100%;
  }

  .stack-category:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}
