:root {
  --bg: #f1f5fb;
  --bg-2: #f7faff;
  --surface: #fbfcff;
  --surface-blue: #e9f1ff;
  --line: #dfe6f0;
  --ink: #2c3042;
  --ink-soft: #6d7388;
  --accent: #7f8abf;
  --accent-soft: #d7deef;
  --ok: #ffd84a;
  --no: #c9d3ec;
  --radius: 3px;
  --skew: -8deg;
  --shadow: 0 2px 10px rgba(44, 48, 66, 0.05);
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

body.no-scroll { overflow: hidden; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  min-height: 100vh;
}

body.with-page-pattern {
  background-color: var(--bg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><g fill='none' stroke='%235684b8' stroke-opacity='0.18' stroke-width='1.4' stroke-linecap='round'><path d='M18 32c6-4 10 4 16 0s10-6 18-2 10 8 18 4'/><path d='M140 18c4 6 12 2 16 8s-2 12 4 16'/><circle cx='54' cy='88' r='10'/><circle cx='54' cy='88' r='6'/><path d='M100 70l12 14-4 4 6 8-10 2'/><path d='M170 110c-8 2-6 12-14 12s-10-8-18-4'/><path d='M30 150q10-12 22-2t22-2 22 4'/><path d='M190 170l-8 8 6 6-10 4 4 8'/><path d='M110 180c-6-2-2-10-8-12s-10 4-14-2'/><path d='M60 200c8 2 14-6 22-2'/></g></svg>");
  background-size: 440px 440px;
}

h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 0 0 0.75rem; }

#engage .card h2 {
  background: #ffd84a;
  color: var(--ink);
  padding: 0.1em 0.4em;
  width: fit-content;
  border-radius: 2px;
}
p { line-height: 1.6; }
.lead { font-size: 1.1rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-size: 0.95rem; }

/* ---- Top bar : brand | tabs center | lang right ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  height: var(--topbar-h);
  padding: 0 1.5rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  justify-self: start;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-self: center;
  justify-content: center;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-soft);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: var(--line); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--ink); }

.topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.lang-btn:hover { background: var(--ink-soft); transform: translateY(-1px); }

/* ---- Main ---- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
main:has(.page-home:not([hidden])),
main:has(.page-full:not([hidden])) {
  max-width: none;
  padding: 0;
}

.page { animation: fade 0.2s ease-out; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Cards : skewed background via ::before (for docs + engage).
   Overridden to a plain rectangle for questionnaire, infos and carte. */
.card {
  position: relative;
  isolation: isolate;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 1.75rem 2rem;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: skewX(var(--skew));
  z-index: -1;
}

/* Non-skewed containers : questionnaire, infos, carte */
.q-card,
.q-summary-inner,
#carte .card {
  background: var(--surface-blue);
  border: 1px solid #cad9f3;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(68, 102, 156, 0.12);
  isolation: auto;
}
#carte .card { padding: 0.5rem 0.5rem; }
#carte .card::before { content: none; }

#infos .card h2 {
  display: inline;
  background: #ffd84a;
  color: var(--ink);
  padding: 0.05em 0.35em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: 1.35;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

/* Documentation : pastel backgrounds, rotating palette, no border */
#docs .doc-card::before { border: none; }
#docs .doc-card:nth-child(4n+1)::before { background: #e6a06a; } /* orange */
#docs .doc-card:nth-child(4n+2)::before { background: #74a8e5; } /* blue */
#docs .doc-card:nth-child(4n+3)::before { background: #79c792; } /* green */
#docs .doc-card:nth-child(4n)::before   { background: #be84c7; } /* purple */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

/* ---- HOME : title / banner photo / CTA, three full-width rows ---- */
.page-home {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
}

.home-banner {
  position: relative;
  width: 100%;
  min-height: calc(100vh - var(--topbar-h));
  /* Blue base: the grayscale image will blend on top to create a duotone */
  background-color: #2d4a7a;
  overflow: hidden;
}
/* The photo itself — converted to grayscale and blended with the blue base */
.home-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/hero.png");
  background-size: cover;
  background-position: center;
  filter: grayscale(1) contrast(1.45) brightness(1.05);
  mix-blend-mode: luminosity;
}
.home-banner-veil {
  position: absolute;
  inset: 0;
  /* Darken slightly for text readability + a touch of extra blue */
  background:
    linear-gradient(180deg, rgba(15, 30, 60, 0.25) 0%, rgba(15, 30, 60, 0.55) 100%);
}

/* Both test containers (title + CTA) stacked and centered inside the image */
.home-banner-stack {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - var(--topbar-h));
  padding: clamp(1.5rem, 5vw, 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  color: #ffffff;
  text-align: center;
}

.home-banner-content { max-width: min(1100px, 94vw); }

/* Yellow "subtitle" highlight — per-line boxes, no gap between lines */
.home-banner-content .highlight {
  background: #ffd84a;
  color: var(--ink);
  padding: 0.05em 0.35em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: 1.35;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.home-banner-content h1 { line-height: 1.4; }
.home-banner-content .lead { line-height: 2.1; }
.home-banner-content h1 {
  font-size: clamp(1rem, 3.3vw, 2.8rem);
  margin: 0 0 1.25rem;
  line-height: 1.2;
  white-space: nowrap;
}
.home-banner-content h1 .highlight { white-space: nowrap; }
.home-banner-content .lead {
  color: rgba(255, 255, 255, 0.95);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  margin: 0;
}

.home-cta { display: flex; justify-content: center; }

/* Artsy thick hero button — skewed parallelogram */
.btn-hero {
  position: relative;
  isolation: isolate;
  font-family: "Permanent Marker", "Brush Script MT", cursive;
  font-weight: 400;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 1.1rem 2.6rem;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.btn-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #ffd84a;
  border: 3px solid var(--ink);
  border-radius: 4px;
  box-shadow: 6px 6px 0 var(--ink);
  transform: skewX(var(--skew));
  z-index: -1;
  transition: box-shadow 0.12s ease;
}
.btn-hero:hover { transform: translate(-2px, -2px); }
.btn-hero:hover::before { box-shadow: 10px 10px 0 var(--ink); }
.btn-hero:active { transform: translate(2px, 2px); }
.btn-hero:active::before { box-shadow: 2px 2px 0 var(--ink); }

/* ---- Buttons : skewed parallelograms ---- */
.btn {
  position: relative;
  isolation: isolate;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transform: skewX(var(--skew));
  z-index: -1;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:hover::before { box-shadow: 0 6px 14px rgba(44, 48, 66, 0.12); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn:disabled::before { box-shadow: none; }

.btn-primary { color: #fff; }
.btn-primary::before { background: var(--ink); border-color: var(--ink); }

.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }

.btn-yes::before { background: var(--ok); border-color: #d9b73b; transform: none; }
.btn-no::before  { background: var(--no); border-color: #a9b4d4; transform: none; }

/* ---- QUESTIONNAIRE : full page, fixed button position ---- */
.page-full { margin: 0; padding: 0; }

.q-stage {
  min-height: calc(100vh - var(--topbar-h));
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 2rem;
}

#q-running {
  min-height: calc(100vh - var(--topbar-h) - 3.5rem);
  display: flex;
  flex-direction: column;
}

.q-middle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.q-progress {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.q-progress-label { margin-bottom: 0.1rem; }
.q-steps { margin-top: 0.4rem; }

.q-progress-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.q-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--line);
  overflow: hidden;
  border-radius: 0;
  transform: skewX(-20deg);
}
#q-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.q-card {
  padding: clamp(1.5rem, 4vw, 3rem);
  width: 100%;
  max-width: 820px;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 380px;
  text-align: center;
}

/* Fixed-height slot keeps buttons at the same Y regardless of text length */
.q-question-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 1rem 0 2rem;
}

.q-question {
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
  line-height: 1.4;
  margin: 0;
  max-width: 700px;
}

.q-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

.q-actions .btn {
  min-width: 210px;
  padding: 0.95rem 3rem;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  transition: transform 0.12s ease;
}

.q-actions .btn::before {
  background: var(--surface);
  border: none;
  border-radius: 4px;
  box-shadow: 4px 4px 0 rgba(44, 48, 66, 0.35);
  transition: box-shadow 0.12s ease;
}

.q-actions .btn-yes::before {
  background: var(--ok);
}

.q-actions .btn-no::before {
  background: var(--no);
}

.q-actions .btn:hover {
  transform: translate(-2px, -2px);
}

.q-actions .btn:hover::before {
  box-shadow: 7px 7px 0 rgba(44, 48, 66, 0.35);
}

.q-actions .btn:active {
  transform: translate(2px, 2px);
}

.q-actions .btn:active::before {
  box-shadow: 2px 2px 0 rgba(44, 48, 66, 0.3);
}

/* Notched step bar for the current tree (sits right under themes bar) */
.q-steps {
  display: flex;
  gap: 6px;
  width: 100%;
}
.q-steps .step {
  flex: 1;
  height: 6px;
  border-radius: 0;
  background: var(--line);
  transform: skewX(-20deg);
  transition: background 0.2s ease;
}
.q-steps .step.done { background: #d9b73b; }
.q-steps .step.current { background: var(--ok); }

/* Summary — full stage, centered. Must respect [hidden]. */
[hidden] { display: none !important; }

.q-summary {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 0;
}
.q-summary-inner {
  padding: 2rem;
  max-width: 820px;
  width: 100%;
}
.q-summary-inner ul { padding-left: 0; list-style: none; margin: 1.25rem 0; }
.q-summary-inner li {
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  background: #f1f6ff;
  border-left: 3px solid var(--accent);
}
.q-summary-inner li.skipped { border-left-color: var(--line); color: var(--ink-soft); }
.q-summary-inner li strong { display: block; margin-bottom: 0.15rem; }

/* ---- Infos tables ---- */
.hours { width: 100%; border-collapse: collapse; }
.hours th, .hours td {
  text-align: left;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px dashed rgba(59, 59, 84, 0.12);
}
.hours th {
  color: var(--ink-soft);
  font-weight: 600;
  width: 35%;
}

.hours .day-label {
  position: relative;
  isolation: isolate;
  display: inline-block;
  padding: 0.05em 0.35em;
  line-height: 1.35;
  color: var(--day-ink, var(--ink-soft));
}

.hours .day-label::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--day-bg, transparent);
  border-radius: 2px;
  transform: skewX(var(--skew));
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  z-index: -1;
}

.hours tr.day-mon,
.hours tr.day-thu {
  --day-bg: #24c06f;
  --day-ink: #053820;
}

.hours tr.day-tue,
.hours tr.day-fri {
  --day-bg: #ff8a2a;
  --day-ink: #5a2400;
}

.hours tr.day-wed,
.hours tr.day-sat,
.hours tr.day-sun {
  --day-bg: transparent;
  --day-ink: var(--ink-soft);
}

/* ---- Map ---- */
#carte {
  display: flex;
  flex-direction: column;
}
.map-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.map-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.map-card {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 100%;
}
.map-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
@media (max-width: 768px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- Docs ---- */
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.doc-card:hover {
  transform: translateY(-6px);
}
.doc-card::before {
  transition: box-shadow 0.2s ease;
}
.doc-card:hover::before {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}
.doc-card .tag {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--ink);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Engage ---- */
#engage .card::before,
#infos .card::before {
  background: var(--surface-blue);
  border-color: #c3d5f5;
  box-shadow: 0 6px 18px rgba(68, 102, 156, 0.14);
  transform: none;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 0.6rem 1rem;
    row-gap: 0.4rem;
  }
  .brand { grid-column: 1; }
  .topbar-right { grid-column: 2; }
  .tabs { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  main { padding: 1.25rem 1rem 3rem; }
  .home-hero-content { padding: 1.5rem; }
  .q-card { min-height: 360px; }
  .q-question-slot { min-height: 140px; }
  .q-actions .btn { min-width: 170px; }
}
