/* ---------- Design tokens ---------- */
:root {
  --bg: #f7f6f3;
  --bg-elev: #ffffff;
  --text: #1b1b1f;
  --text-soft: #5b5b66;
  --accent: #3b5bdb;
  --accent-soft: rgba(59, 91, 219, 0.10);
  --line: rgba(27, 27, 31, 0.12);
  --glow: rgba(59, 91, 219, 0.14);
  --shadow: 0 8px 30px rgba(27, 27, 31, 0.07);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #101014;
  --bg-elev: #18181f;
  --text: #ececf1;
  --text-soft: #9d9dab;
  --accent: #7b96ff;
  --accent-soft: rgba(123, 150, 255, 0.12);
  --line: rgba(236, 236, 241, 0.12);
  --glow: rgba(123, 150, 255, 0.10);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

/* ---------- Cursor glow ---------- */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: opacity 0.5s ease;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-glow { display: none; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1.25rem, 5vw, 4rem);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

.nav-links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--accent); }

.nav-actions { display: flex; gap: 0.5rem; align-items: center; }

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
}

.lang-switch button {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-switch button:hover { color: var(--accent); }

.lang-switch button.active {
  background: var(--accent);
  color: #fff;
}

.pill {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.pill:hover { border-color: var(--accent); transform: translateY(-1px); }

.nav-burger { display: none; }

@media (max-width: 640px) {
  .nav-burger { display: inline-flex; align-items: center; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem clamp(1.25rem, 5vw, 4rem) 1rem;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .nav.open .nav-links { display: flex; }

  .nav-links a {
    padding: 0.7rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .nav-links a:last-child { border-bottom: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(5rem, 14vh, 9rem) 1.5rem clamp(4rem, 10vh, 7rem);
  text-align: center;
}

.hero-kicker {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 600;
  line-height: 1.08;
  margin-bottom: 1.25rem;
}

.hero-sub {
  color: var(--text-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 620px;
  margin: 0 auto 2.25rem;
}

.hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-soft);
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--bg-elev);
}

.btn-ghost:hover { border-color: var(--accent); }

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 4.5rem) 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 600;
  margin-bottom: 2.25rem;
}

.section-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 0.6rem;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.25rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem + 1px);
  top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--accent);
  transition: background 0.3s ease;
}

.timeline-item:hover::before { background: var(--accent); }

.ti-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.ti-org { font-weight: 600; font-size: 1.05rem; }

a.ti-org {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a.ti-org:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.ti-date {
  color: var(--text-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.ti-role {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.ti-desc {
  color: var(--text-soft);
  font-size: 0.93rem;
}

.ti-desc li { margin-left: 1.1rem; margin-top: 0.2rem; }

/* ---------- Education cards ---------- */
.cards {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover { transform: translateY(-3px); border-color: var(--accent); }

.card .ti-meta { margin-bottom: 0.15rem; }

.card .ti-desc { margin-top: 0.35rem; }

/* ---------- Projects ---------- */
.proj-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.proj-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.15s ease;
  display: inline-block;
}

.proj-link:hover { transform: translateX(3px); }

/* ---------- Car animation (robotics card) ---------- */
.card-carwrap {
  position: relative;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 22px;
}

.card-carwrap .card { position: relative; z-index: 1; }

.car-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.car {
  position: absolute;
  top: 0;
  left: 0;
  offset-rotate: auto;
  offset-distance: 0%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.car-body { fill: var(--accent); }
.car-window { fill: var(--bg-elev); }
.car-light { fill: #ffd76b; }

.tlight {
  position: absolute;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  background: var(--text);
  transform: translate(8px, -22px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tlight-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.tlight.green .tlight-dot { background: #3fbf5f; box-shadow: 0 0 7px #3fbf5f; }
.tlight.red .tlight-dot { background: #e04545; box-shadow: 0 0 7px #e04545; }

.crosswalk {
  position: absolute;
  width: 28px;
  height: 32px;
  background: repeating-linear-gradient(
    to bottom,
    color-mix(in srgb, var(--text) 35%, transparent) 0 4px,
    transparent 4px 9px
  );
  border-radius: 2px;
}

.ped {
  position: absolute;
  font-size: 15px;
  line-height: 1;
  z-index: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

@supports not (offset-path: path("M 0 0 H 10")) {
  .car-track { display: none; }
  .card-carwrap { padding: 0; border: none; }
}

/* ---------- AI Lab ---------- */
.lab-intro {
  color: var(--text-soft);
  max-width: 640px;
  margin-bottom: 1.75rem;
}

.lab-box {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

#lab-start { text-align: center; padding: 1rem 0; }

.lab-note {
  color: var(--text-soft);
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.lab-pipeline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pstep {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  transition: all 0.3s ease;
}

.pstep.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.score-modes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.score-modes .lab-note { margin: 0; }

.score-mode {
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.score-mode:hover { border-color: var(--accent); color: var(--accent); }

.score-mode.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.lab-result-score b { font-weight: 400; }

.lab-result-score .score-on { font-weight: 600; color: var(--accent); }

#lab-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#lab-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease;
}

#lab-input:focus { border-color: var(--accent); }

.lab-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.chip {
  font-size: 0.8rem;
  font-family: var(--font-body);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

#lab-results { margin-top: 1.25rem; display: grid; gap: 0.75rem; }

.lab-result {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  animation: result-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--delay, 0s);
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.lab-result-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.lab-result-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lab-result-score {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.lab-result p { font-size: 0.9rem; color: var(--text-soft); }

.score-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-top: 0.6rem;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Contact ---------- */
.contact { text-align: center; padding-bottom: 5rem; }

.contact .section-title::after { margin-inline: auto; }

.contact p { color: var(--text-soft); margin-bottom: 1.75rem; }

.contact-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- "Under construction" badge (GitHub button) ---------- */
.btn-wip { position: relative; }

/* The badge wraps ribbon + hammer and shrink-wraps to the ribbon, so the
   hammer can anchor to the ribbon's left edge and track it in every language
   (the ribbon is shorter in FR/DE than in EN). */
.wip-badge {
  position: absolute;
  top: -0.75rem;
  right: -0.9rem;
  pointer-events: none;
}

.wip-ribbon {
  display: inline-block;
  background: #ffd60a;
  color: #1b1b1f;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.22rem 0.5rem;
  border-radius: 3px;
  transform: rotate(6deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.wip-hammer {
  position: absolute;
  top: -0.35rem;
  left: -0.4rem; /* left edge of the ribbon, whatever its width */
  font-size: 1.05rem;
  line-height: 1;
  transform-origin: 20% 80%;
  animation: wip-hammer 1.8s ease-in-out infinite;
}

/* scaleX(-1) mirrors the hammer so it strikes toward the button. */
@keyframes wip-hammer {
  0%, 50%, 100% { transform: scaleX(-1) rotate(0deg); }
  65% { transform: scaleX(-1) rotate(-38deg); }
  78% { transform: scaleX(-1) rotate(10deg); }
}

@media (prefers-reduced-motion: reduce) {
  .wip-hammer { animation: none; }
}

/* ---------- Game (Quantum Eavesdropper) ---------- */
.game-head { max-width: 720px; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover { border-color: var(--accent); color: var(--accent); }

.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#play-start { text-align: center; padding: 1rem 0; }

#play-start .lab-note { margin-bottom: 1rem; }

.hud {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.hud-item b { color: var(--text); font-variant-numeric: tabular-nums; }

.hud-risk { flex: 1; min-width: 180px; }

.risk-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-top: 0.3rem;
  overflow: visible;
}

.risk-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease, background 0.25s ease;
}

.risk-fill.danger { background: #d64545; }

.risk-threshold {
  position: absolute;
  top: -3px;
  left: 44%; /* 11% QBER on a 0–25% scale */
  width: 2px;
  height: 12px;
  background: #d64545;
  border-radius: 1px;
}

.qubit-stage {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0;
}

.qubit {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent);
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 30px var(--accent-soft);
}

.qubit.pulse { animation: qubit-in 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes qubit-in {
  from { transform: translateX(-60px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.act kbd {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  color: var(--text-soft);
}

.feedback {
  min-height: 2.6em;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-soft);
}

#btn-next { margin-top: 0.25rem; }

#play-end h3 {
  font-family: var(--font-display);
  margin-bottom: 0.75rem;
}

.end-stats {
  list-style: none;
  margin-bottom: 0.75rem;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.end-stats b { color: var(--text); }

.verdict { font-weight: 600; margin-bottom: 1rem; }

.verdict.bad { color: #d64545; }

#play-end .btn { margin-top: 0.5rem; }

#ai-area { margin-top: 1.25rem; }

#ai-curve {
  width: 100%;
  height: 140px;
  display: block;
  margin-top: 0.5rem;
  border-radius: 8px;
}

.game-foot { margin-top: 1.5rem; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 1.5rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--delay, 0s);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Print: replace the page with a QR card back to the site ---------- */
.print-card { display: none; }

@media print {
  body > *:not(.print-card) { display: none !important; }

  .print-card {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 92vh;
    gap: 0.25rem;
    color: #000;
  }

  .print-card .pc-qr { width: 210px; height: 210px; }
  .print-card .pc-qr svg { width: 100%; height: 100%; display: block; }

  .print-card .pc-name {
    font-family: var(--font-display);
    font-size: 1.7rem;
    margin-top: 1.1rem;
  }

  .print-card .pc-role { font-size: 1rem; color: #333; }

  .print-card .pc-url {
    font-size: 0.95rem;
    margin-top: 0.35rem;
    font-family: var(--font-body);
  }

  .print-card .pc-tag {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.7rem;
  }
}
