/* ============================================================
   VAILS / VVL site — shared stylesheet
   Hybrid: ornamented parchment + Zalta indigo/amber + readable tech
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Parchment */
  --parchment-0: #f5ecd6;
  --parchment-1: #ecdfbf;
  --parchment-2: #e3d2a4;
  --parchment-3: #c9b489;
  --parchment-edge: #8b6e3a;

  /* Ink */
  --ink-1: #2a2010;     /* darkest, body */
  --ink-2: #4a3a1f;
  --ink-3: #6e5a35;
  --ink-faint: rgba(60, 45, 20, 0.55);

  /* Zalta accents */
  --indigo: #2c3a78;
  --indigo-deep: #1a2456;
  --indigo-soft: #4a5aa0;
  --amber: #c08a2e;
  --amber-deep: #8c5e1a;
  --amber-soft: #e0b56a;

  /* VDOM */
  --vdom-red: #d8222b;
  --vdom-red-deep: #8a0e15;
  --vdom-black: #0c0a0a;

  /* Terminal */
  --term-bg: #0e0d0b;
  --term-bg-2: #16140f;
  --term-green: #6ed26a;
  --term-cyan: #6ed8e0;
  --term-amber: #e6b450;
  --term-rose: #e07a8f;
  --term-violet: #b890e0;
  --term-fg: #d6cfba;

  /* Misc */
  --seal: #6a1320;
  --gold: #b88a3a;
  --shadow-soft: 0 6px 18px rgba(60, 40, 15, 0.18);
  --shadow-deep: 0 18px 48px rgba(40, 25, 5, 0.35);

  /* Type */
  --f-display: 'Cormorant Garamond', 'Cambria', Georgia, serif;
  --f-serif: 'Lora', 'Cambria', Georgia, serif;
  --f-ui: 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--f-serif);
  color: var(--ink-1);
  font-size: 18px;
  line-height: 1.7;
  background: #d8c79a;
}

/* Parchment background — repeating tiled vintage paper.
   `background-attachment: fixed` est notoirement coûteux au scroll (repaint
   complet du viewport à chaque frame). On l'a retiré : le fond défile
   naturellement avec le contenu, visuellement très proche du fixed sur la
   plupart des viewports. Les radial-gradients ponctuels (taches lumineuses)
   sont conservés mais sans le coût de la re-composition par frame. */
body {
  position: relative;
  background-color: #e3d2a4;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(255, 240, 200, 0.55), transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 90%, rgba(255, 230, 180, 0.5), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 245, 215, 0.35), transparent 75%),
    radial-gradient(circle at 15% 80%, rgba(120, 80, 30, 0.08), transparent 30%),
    radial-gradient(circle at 85% 25%, rgba(120, 80, 30, 0.07), transparent 35%),
    radial-gradient(circle at 50% 35%, rgba(140, 90, 40, 0.06), transparent 25%),
    repeating-linear-gradient(43deg, rgba(140, 100, 40, 0.025) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(127deg, rgba(140, 100, 40, 0.02) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #e8d7ac 0%, #ddc999 50%, #d8c08e 100%);
  min-height: 100vh;
}

/* Page-wide noise overlay — `position: absolute` + opacity simple (sans
   `mix-blend-mode: multiply` qui force une couche de composition coûteuse à
   chaque frame de scroll). Le rendu visuel reste très proche. */
body::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyMDAnIGhlaWdodD0nMjAwJz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMS40JyBudW1PY3RhdmVzPSczJyBzZWVkPSc1Jy8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPScwIDAgMCAwIDAuNDUgMCAwIDAgMCAwLjMyIDAgMCAwIDAgMC4xMCAwIDAgMCAwLjE4IDAnLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0nMjAwJyBoZWlnaHQ9JzIwMCcgZmlsdGVyPSd1cmwoI24pJy8+PC9zdmc+");
  opacity: 0.22;
}

/* ===================== TOP NAV ===================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background:
    linear-gradient(180deg, rgba(232, 215, 172, 0.96), rgba(217, 196, 145, 0.96));
  border-bottom: 2px solid var(--amber-deep);
  box-shadow: 0 4px 16px rgba(60, 40, 10, 0.18);
  backdrop-filter: blur(2px);
}
.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink-1);
}
.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 1px;
  line-height: 1;
}
.brand-sub {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.nav-links {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}
.nav-links a {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  transition: all 150ms ease;
  position: relative;
}
.nav-links a:hover {
  color: var(--indigo-deep);
  background: rgba(192, 138, 46, 0.12);
}
.nav-links a.active {
  color: var(--indigo-deep);
}
.nav-links a.btn-primary,
.nav-links a.btn-primary:hover,
.nav-links a.btn-primary:visited {
  color: #f5ecd6;
}
.nav-links a.btn-primary:hover {
  background: linear-gradient(180deg, var(--indigo-deep), #0e1640);
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--amber-deep), transparent);
}
.nav-cta {
  margin-left: 12px;
}

/* Sélecteur de langue à drapeaux (CountrySelect) injecté par /static/assets/i18n.js */
.cty-trigger {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  height: 30px; padding: 0 8px; margin-left: 12px; border-radius: 8px;
  border: 1.5px solid rgba(192,138,46,0.35); background: rgba(243,230,194,0.55);
  color: var(--ink-2, #5a4830); font-family: var(--f-ui, system-ui); font-size: 13px; line-height: 1;
  transition: border-color .12s ease, background .12s ease;
}
.cty-trigger:hover { border-color: var(--amber-deep, #8c5e1a); }
.cty-trigger.has-value { border-color: var(--amber-deep, #8c5e1a); }
.cty-trigger .fi { width: 20px; height: 15px; }
.cty-empty { font-size: 15px; line-height: 1; filter: grayscale(.3); opacity: .8; }
.cty-caret { font-size: 9px; color: var(--ink-3, #7a684a); }
.cty-panel {
  position: fixed; z-index: 13000; background: #f3e6c2;
  border: 1.5px solid var(--amber-deep, #8c5e1a); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(20,12,0,0.25); padding: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.cty-search {
  width: 100%; box-sizing: border-box; padding: 7px 10px;
  font-family: var(--f-ui, system-ui); font-size: 13px;
  border: 1.5px solid rgba(192,138,46,0.5); border-radius: 8px;
  background: #fff; color: var(--ink-1, #2c1f0e);
}
.cty-search:focus { outline: none; border-color: var(--indigo-deep, #1a2456); }
.cty-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.cty-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; padding: 6px 8px; border-radius: 7px;
  font-family: var(--f-ui, system-ui); font-size: 13.5px; color: var(--ink-1, #2c1f0e);
}
.cty-row:hover { background: rgba(192,138,46,0.18); }
.cty-row.is-sel { background: rgba(192,138,46,0.30); font-weight: 600; }
.cty-row .fi { flex: 0 0 auto; width: 22px; height: 16.5px; }
.cty-none { flex: 0 0 22px; text-align: center; color: var(--ink-3, #7a684a); }
.cty-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hamburger toggle — hidden on desktop, shown in the mobile breakpoint */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  background: rgba(192, 138, 46, 0.10);
  border: 1.5px solid var(--amber-deep);
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: var(--ink-1);
  border-radius: 2px;
  transition: transform 220ms ease, opacity 160ms ease;
}
.top-nav.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.top-nav.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.top-nav.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.6px;
  padding: 10px 20px;
  border-radius: 4px;
  border: 1.5px solid var(--amber-deep);
  background: linear-gradient(180deg, #ecd9a9, #d4b878);
  color: var(--ink-1);
  cursor: pointer;
  text-decoration: none;
  transition: all 200ms ease;
  box-shadow: 0 2px 6px rgba(80, 50, 10, 0.2), inset 0 1px 0 rgba(255, 240, 200, 0.5);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(80, 50, 10, 0.28), inset 0 1px 0 rgba(255, 240, 200, 0.5);
  background: linear-gradient(180deg, #f0deaf, #d8bc7c);
}
.btn-primary {
  background: linear-gradient(180deg, var(--indigo-soft), var(--indigo-deep));
  color: #f5ecd6;
  border-color: var(--indigo-deep);
  box-shadow: 0 3px 10px rgba(20, 30, 80, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #5a6cb0, var(--indigo));
  box-shadow: 0 6px 18px rgba(20, 30, 80, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--ink-faint);
  color: var(--ink-2);
  box-shadow: none;
}
.btn-ghost:hover {
  border-color: var(--indigo-deep);
  color: var(--indigo-deep);
  background: rgba(44, 58, 120, 0.06);
}

/* ===================== PARCHMENT CARTOUCHE ===================== */
.cartouche {
  position: relative;
  background:
    radial-gradient(ellipse 60% 80% at 50% 50%, rgba(255, 245, 220, 0.5), transparent 80%),
    linear-gradient(180deg, #f3e6c2 0%, #ecdcb0 100%);
  border: 1px solid var(--parchment-edge);
  border-radius: 6px;
  padding: 28px 32px;
  box-shadow:
    inset 0 0 30px rgba(140, 90, 30, 0.12),
    inset 0 0 80px rgba(140, 90, 30, 0.08),
    0 4px 16px rgba(60, 40, 10, 0.15);
}
.cartouche::before, .cartouche::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--amber-deep);
  opacity: 0.55;
}
.cartouche::before { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.cartouche::after { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.cartouche-dark {
  background:
    radial-gradient(ellipse 80% 100% at 50% 0%, rgba(60, 80, 160, 0.18), transparent 70%),
    linear-gradient(180deg, #1c1810 0%, #0e0c08 100%);
  border: 1px solid var(--amber-deep);
  color: var(--term-fg);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.6),
    0 8px 32px rgba(0, 0, 0, 0.4);
}
.cartouche-dark::before, .cartouche-dark::after {
  border-color: var(--amber);
}

/* ===================== SECTIONS ===================== */
.page {
  position: relative;
  z-index: 1;
}
/* Sticky footer — sur les pages de contenu (celles qui ont un <main class="page">
   + un <footer> injecté par renderFooter()), on fait du <body> une colonne flex
   pour que le footer reste collé au bas du viewport même quand le contenu est
   court. Scopé via :has(> .page) afin que les pages SPA notebook (app/admin/login,
   sans .page) conservent leur propre mise en page plein écran. */
body:has(> .page) { display: flex; flex-direction: column; }
body:has(> .page) > .page { flex: 1 0 auto; }
body:has(> .page) > .site-foot { flex-shrink: 0; }
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 32px;
}
.section-narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 32px;
}

/* ===================== TYPOGRAPHY ===================== */
.eyebrow {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 15px;
  color: var(--amber-deep);
  letter-spacing: 1px;
  text-transform: lowercase;
  margin: 0 0 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before, .eyebrow::after {
  content: '❦';
  font-style: normal;
  color: var(--amber);
  font-size: 14px;
  opacity: 0.7;
}
.eyebrow.left::before { display: inline; }
.eyebrow.left::after { display: none; }

h1.display, .h-display {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 1.0;
  color: var(--indigo-deep);
  letter-spacing: -1.5px;
  margin: 0;
  text-shadow: 0 1px 0 rgba(255, 245, 215, 0.4);
}
h1.display em, .h-display em {
  font-style: italic;
  color: var(--amber-deep);
  font-weight: 500;
}

h2.section-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(34px, 4.5vw, 54px);
  line-height: 1.05;
  color: var(--indigo-deep);
  letter-spacing: -0.5px;
  margin: 0 0 18px 0;
  text-align: center;
}
h2.section-title em {
  font-style: italic;
  color: var(--amber-deep);
}

h3.sub-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 28px;
  color: var(--ink-1);
  margin: 0 0 12px 0;
  letter-spacing: -0.2px;
}

.lead {
  font-family: var(--f-serif);
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-2);
  font-weight: 400;
  text-wrap: pretty;
}

.lede-italic {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-2);
}

p { text-wrap: pretty; }

/* Drop cap */
.dropcap::first-letter {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 76px;
  line-height: 0.85;
  float: left;
  margin: 6px 12px 0 0;
  color: var(--amber-deep);
  text-shadow: 1px 1px 0 rgba(255, 240, 200, 0.6);
}

/* Decorative divider */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px 0;
  color: var(--amber-deep);
  font-size: 18px;
  letter-spacing: 8px;
  opacity: 0.7;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  max-width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-deep), transparent);
  margin: 0 16px;
}

/* ===================== TERMINAL BLOCK ===================== */
.terminal {
  font-family: var(--f-mono);
  font-size: 14px;
  line-height: 1.55;
  color: var(--term-fg);
  background: var(--term-bg);
  border-radius: 4px;
  padding: 20px 24px;
  overflow-x: auto;
  white-space: pre;
}
.terminal .t-green { color: var(--term-green); }
.terminal .t-cyan { color: var(--term-cyan); }
.terminal .t-amber { color: var(--term-amber); }
.terminal .t-rose { color: var(--term-rose); }
.terminal .t-violet { color: var(--term-violet); }
.terminal .t-muted { color: #7a7464; }
.terminal .t-bold { font-weight: 600; }
.terminal .prompt { color: var(--term-cyan); font-weight: 600; }
.terminal .cursor {
  display: inline-block;
  width: 9px;
  height: 17px;
  background: var(--term-cyan);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===================== FOOTER ===================== */
.site-foot {
  margin-top: 80px;
  padding: 48px 32px 36px;
  background: linear-gradient(180deg, transparent, rgba(80, 55, 20, 0.10));
  border-top: 1px double var(--amber-deep);
  text-align: center;
  color: var(--ink-3);
  font-family: var(--f-display);
  font-style: italic;
  position: relative;
  z-index: 1;
}
.site-foot .motto {
  font-size: 22px;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.site-foot .meta {
  font-family: var(--f-serif);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--ink-3);
}
.site-foot a { color: var(--indigo-deep); }

/* ===================== UTIL ===================== */
.center { text-align: center; }
.spacer-sm { height: 24px; }
.spacer-md { height: 48px; }
.spacer-lg { height: 80px; }

/* ===================== ORNAMENTS (corner flourishes) ===================== */
.corner-flourish {
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: none;
  opacity: 0.55;
}

/* small chip / pill */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(192, 138, 46, 0.18);
  color: var(--amber-deep);
  border: 1px solid var(--amber-deep);
}
.chip.indigo {
  background: rgba(44, 58, 120, 0.12);
  color: var(--indigo-deep);
  border-color: var(--indigo);
}
.chip.red {
  background: rgba(216, 34, 43, 0.12);
  color: var(--vdom-red-deep);
  border-color: var(--vdom-red);
}

/* Wax seal */
.wax-seal {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #b03240 0%, #8a0e15 50%, #5a0810 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-style: italic;
  color: #f0d8b8;
  font-size: 16px;
  text-align: center;
  line-height: 1;
  box-shadow:
    inset 0 -6px 12px rgba(0, 0, 0, 0.5),
    inset 0 4px 8px rgba(255, 200, 200, 0.2),
    0 6px 14px rgba(60, 10, 10, 0.4);
  border: 2px solid #5a0810;
  letter-spacing: 0.5px;
}

/* ===================== RESPONSIVE / MOBILE NAV ===================== */
@media (max-width: 860px) {
  .top-nav-inner {
    padding: 12px 18px;
    gap: 14px;
  }
  .nav-toggle { display: inline-flex; }

  /* nav-links collapses into a drawer dropping below the bar */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    padding: 8px 14px 16px;
    background: linear-gradient(180deg, rgba(232, 215, 172, 0.985), rgba(217, 196, 145, 0.985));
    border-bottom: 2px solid var(--amber-deep);
    box-shadow: 0 14px 28px rgba(60, 40, 10, 0.28);
    backdrop-filter: blur(2px);
    /* collapsed state */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: max-height 300ms ease, opacity 200ms ease,
                transform 220ms ease, visibility 300ms;
  }
  .top-nav.nav-open .nav-links {
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a {
    font-size: 19px;
    padding: 14px 12px;
    border-radius: 6px;
    border-bottom: 1px solid rgba(139, 110, 58, 0.20);
  }
  .nav-links a:last-of-type { border-bottom: none; }
  /* active-link underline doesn't read in a stacked list */
  .nav-links a.active {
    background: rgba(192, 138, 46, 0.14);
  }
  .nav-links a.active::after { display: none; }

  /* CTA becomes a full-width button at the bottom of the drawer */
  .nav-cta {
    display: block;
    margin: 14px 0 2px;
    padding: 14px 20px;
    text-align: center;
    border-bottom: none;
  }
}

/* General layout breakpoint */
@media (max-width: 760px) {
  .brand-text { font-size: 20px; }
  .brand-sub { display: none; }
  .section, .section-narrow { padding: 36px 18px; }
}
