/* =========================================================
   CGDC – UI layer (phase 1 + 2)
   One signature moment: the emblem reveals with a circular sweep
   that follows the arcs of the logo. Everything else answers the
   visitor's actions (scroll, hover, click) and stays quiet.
   ========================================================= */

:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --header-h: 76px;
  --shadow-soft: 0 18px 50px -24px color-mix(in srgb, var(--navy) 45%, transparent);
}

@property --sweep {
  syntax: '<angle>';
  inherits: false;
  initial-value: 360deg;
}

html { scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Remove generic template tells ---------- */
.eyebrow,
[dir=rtl] .eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: .98rem;
  font-weight: 600;
  color: var(--blue);
}
.band .eyebrow { color: var(--sun); }
.hero h1 em { font-style: normal; color: inherit; background: none; }
.link-more::after,
[dir=rtl] .link-more::after { content: none; }
.link-more {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat;
  padding-bottom: 2px;
  transition: background-size .35s var(--ease-out);
}
[dir=rtl] .link-more { background-position: 100% 100%; }
.link-more:hover, .link-more:focus-visible { background-size: 100% 2px; }

/* ---------- Page transitions between pages ---------- */
@view-transition { navigation: auto; }
header.site { view-transition-name: site-header; }
.topbar { view-transition-name: site-topbar; }
::view-transition-old(root) { animation: vt-out .22s var(--ease-io) both; }
::view-transition-new(root) { animation: vt-in .38s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero::before {
  /* one large, faint arc that echoes the logo, bleeding off the edge */
  content: "";
  position: absolute;
  width: min(900px, 120vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--navy) 10%, transparent);
  inset-inline-end: -28%;
  top: -40%;
  pointer-events: none;
}
.hero h1 { font-size: clamp(2.3rem, 5.6vw, 4.1rem); line-height: 1.04; }
[dir=rtl] .hero h1 { line-height: 1.3; }

.emblem-stage {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  perspective: 900px;
}
.emblem-disc {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-soft), 0 0 0 1px color-mix(in srgb, var(--navy) 8%, transparent);
  display: grid;
  place-items: center;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease-out);
  will-change: transform;
}
.emblem-disc img {
  width: 82%;
  height: auto;
  display: block;
  -webkit-mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0);
          mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0);
}
.emblem-disc::after {
  /* light that follows the pointer */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 25%), rgba(255,255,255,.55), transparent 45%);
  mix-blend-mode: soft-light;
  opacity: var(--glow, 0);
  transition: opacity .4s;
  pointer-events: none;
}
.emblem-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.emblem-ring circle { fill: none; stroke: color-mix(in srgb, var(--blue) 22%, transparent); stroke-width: 1; }
.emblem-stage .float-card { inset-inline-end: -4%; bottom: 2%; }

@media (prefers-reduced-motion: no-preference) {
  .js .emblem-disc { animation: disc-in .9s var(--ease-out) both; }
  .js .emblem-disc img { animation: sweep 1.5s var(--ease-io) .2s both; }
  .js .emblem-ring circle { stroke-dasharray: 1300; animation: ring-draw 1.8s var(--ease-io) .1s both; }
  .js .hero-text > * { animation: rise .8s var(--ease-out) both; }
  .js .hero-text > :nth-child(1) { animation-delay: .35s; }
  .js .hero-text > :nth-child(2) { animation-delay: .47s; }
  .js .hero-text > :nth-child(3) { animation-delay: .6s; }
  .js .hero-text > :nth-child(4) { animation-delay: .72s; }
  .js .emblem-stage .float-card { animation: rise .7s var(--ease-out) 1.35s both; }
}
@keyframes sweep { from { --sweep: 0deg; } to { --sweep: 360deg; } }
@keyframes disc-in { from { opacity: 0; scale: .92; } }
@keyframes ring-draw { from { stroke-dashoffset: 1300; } to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; translate: 0 14px; } }

/* ---------- Smart header ---------- */
header.site {
  transition: transform .35s var(--ease-out), box-shadow .3s, background-color .3s;
}
header.site .logo img { transition: height .3s var(--ease-out); }
header.site.is-scrolled {
  box-shadow: 0 10px 30px -18px color-mix(in srgb, var(--navy) 55%, transparent);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
          backdrop-filter: saturate(1.4) blur(12px);
}
header.site.is-scrolled .logo img { height: 38px; }
header.site.is-hidden { transform: translateY(calc(-100% - 6px)); }

/* ---------- Sliding indicators (nav + language switch) ---------- */
[data-ink] { position: relative; }
.ink {
  position: absolute;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: transform .45s var(--ease-out), width .45s var(--ease-out), opacity .25s;
}
nav.main .ink { bottom: 2px; height: 3px; border-radius: 3px; background: var(--sun); }
nav.main.has-ink a[aria-current=page] { box-shadow: none; }
.langs { padding: 3px; border-radius: 999px; background: var(--mist); }
.langs .ink { top: 3px; bottom: 3px; border-radius: 999px; background: var(--paper); box-shadow: 0 1px 4px color-mix(in srgb, var(--navy) 25%, transparent); z-index: 0; }
.langs a, .langs button { position: relative; z-index: 1; border: 0 !important; }
.langs a[aria-current], .langs button[aria-pressed=true] { color: var(--blue); }

/* ---------- Mobile menu ---------- */
@media (max-width: 1020px) {
  nav.main {
    display: flex !important;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .25s, transform .35s var(--ease-out), visibility 0s .35s;
    gap: .1rem;
    box-shadow: 0 30px 40px -30px color-mix(in srgb, var(--navy) 50%, transparent);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }
  nav.main.open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .25s, transform .35s var(--ease-out);
  }
  nav.main a { font-size: 1.15rem; padding: .75em .6em; border-bottom: 1px solid var(--line); border-radius: 0; }
  nav.main a[aria-current=page] { box-shadow: inset 4px 0 0 var(--sun); }
  [dir=rtl] nav.main a[aria-current=page] { box-shadow: inset -4px 0 0 var(--sun); }
  nav.main .ink { display: none; }
  nav.main.open a { animation: rise .45s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
  .burger { transition: background .2s; }
  .burger[aria-expanded=true] { background: var(--mist); }
}
body.menu-open { overflow: hidden; }
.menu-scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 30%, transparent);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
body.menu-open .menu-scrim { opacity: 1; pointer-events: auto; }

/* ---------- Reading progress ---------- */
.read-progress {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 3px;
  z-index: 40;
  pointer-events: none;
}
.read-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--blue) 60%, var(--sun));
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
}
[dir=rtl] .read-progress span { transform-origin: 100% 50%; background: linear-gradient(-90deg, var(--navy), var(--blue) 60%, var(--sun)); }

/* ---------- Back to top: two arcs that fill with the page ---------- */
.to-top {
  position: fixed;
  inset-inline-end: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--paper);
  box-shadow: var(--shadow-soft), 0 0 0 1px var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 30;
  opacity: 0;
  transform: translateY(12px) scale(.9);
  pointer-events: none;
  transition: opacity .3s, transform .4s var(--ease-out);
  color: var(--navy);
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top .track { fill: none; stroke: var(--line); stroke-width: 3; }
.to-top .bar { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 138.2; stroke-dashoffset: calc(138.2 * (1 - var(--p, 0))); }
.to-top .bar.sun { stroke: var(--sun); stroke-dasharray: 34 104.2; stroke-dashoffset: calc(34 - 138.2 * var(--p, 0)); opacity: .9; }
.to-top b { font-size: 1.1rem; line-height: 1; position: relative; }
.to-top:hover { transform: translateY(-2px); }

/* ---------- Toast (form confirmations) ---------- */
.toast-live {
  position: fixed;
  inset-inline: 0;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  gap: .7rem;
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  padding: .85rem 1.1rem;
  border-radius: 14px;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.45);
  z-index: 60;
  font-weight: 500;
  animation: toast-in .5s var(--ease-out) both;
}
.toast-live.is-leaving { animation: toast-out .3s var(--ease-io) both; }
.toast-live i { width: 26px; height: 26px; border-radius: 50%; background: var(--sun); color: #1A1A1A; display: grid; place-items: center; font-style: normal; font-weight: 700; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }
.alert { animation: rise .5s var(--ease-out) both; }

/* ---------- Responsive states to the visitor's actions ---------- */
.btn { transition: transform .2s var(--ease-out), background-color .2s, box-shadow .2s, border-color .2s; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-navy:hover { box-shadow: 0 10px 24px -12px var(--blue); }
.btn-sun:hover { box-shadow: 0 10px 24px -12px var(--sun); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* clickable cards: the image zooms, the title takes the link colour */
.card .cover, .card .news-thumb { overflow: hidden; }
.card:has(a.link-more) img.cover { transition: transform .6s var(--ease-out); }
.card:has(a.link-more):hover img.cover { transform: scale(1.04); }
.card:has(a.link-more) h3 { transition: color .2s; }
.card:has(a.link-more):hover h3 { color: var(--blue); }
.card:has(a.link-more) { transition: border-color .25s; }
.card:has(a.link-more):hover { border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); }

.feature img { transition: transform .6s var(--ease-out); }
.feature:hover img { transform: rotate(-1deg) scale(1.02); }

.pillar-ic { transition: background-color .3s, color .3s, transform .4s var(--ease-out); }
.card:hover .pillar-ic { background: var(--blue); color: #fff; transform: rotate(-6deg); }

input, textarea, select { transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 15%, transparent); outline: none; }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: #C0362C; }

/* counters */
.stats b { font-variant-numeric: tabular-nums; }

/* footer e-mail copy */
.copy-mail {
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
  border-radius: 999px;
  padding: .2em .8em;
  font: 500 .8rem var(--f-body);
  cursor: pointer;
  margin-inline-start: .4rem;
  transition: border-color .2s, color .2s;
}
.copy-mail:hover { border-color: var(--sun); color: var(--sun); }

/* ---------- Legal pages: table of contents with scroll spy ---------- */
.legal-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; align-items: start; }
.legal-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  gap: .15rem;
  font-size: .9rem;
  border-inline-start: 2px solid var(--line);
}
.legal-toc a {
  color: var(--muted);
  text-decoration: none;
  padding: .35em .9em;
  margin-inline-start: -2px;
  border-inline-start: 2px solid transparent;
  transition: color .2s, border-color .25s;
}
.legal-toc a:hover { color: var(--ink); }
.legal-toc a.is-active { color: var(--blue); border-inline-start-color: var(--sun); font-weight: 600; }
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .legal-toc { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}

/* sentence-case labels instead of tracked capitals */
.facts dt, [dir=rtl] .facts dt, th, .float-card small {
  text-transform: none;
  letter-spacing: 0;
  font-size: .85rem;
}
@media (max-width: 860px) {
  .emblem-stage { width: min(300px, 78vw); margin-top: .5rem; }
  .emblem-stage .float-card { inset-inline-end: -2%; bottom: -6%; }
  .hero::before { width: 140vw; top: -55%; inset-inline-end: -70%; }
}

/* admin preview banner */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  align-items: center;
  justify-content: center;
  padding: .55rem max(16px, env(safe-area-inset-right, 0px)) .55rem max(16px, env(safe-area-inset-left, 0px));
  background: #1E2F7D;
  color: #fff;
  font-size: .88rem;
}
.preview-bar a { color: #F4B812; font-weight: 600; }

/* ---------- Donations with Swiss QR-bill ---------- */
.support-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.donate-card { grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2rem; align-items: start; }
.donate-text { display: grid; gap: .8rem; min-width: 0; }
.qr-steps { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .3rem; color: var(--muted); }
.qr-box { margin: 0; display: grid; gap: .6rem; justify-items: center; }
.swiss-qr { width: 220px; max-width: 100%; aspect-ratio: 1; background: #fff; padding: 14px; border-radius: 12px; box-shadow: 0 0 0 1px var(--line), var(--shadow-soft); box-sizing: content-box; }
.swiss-qr svg { width: 100%; height: 100%; display: block; }
.qr-box figcaption { font-size: .85rem; color: var(--muted); text-align: center; max-width: 230px; }
@media (max-width: 960px) {
  .support-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .donate-card { grid-template-columns: 1fr; }
  .qr-box { justify-self: center; }
}

/* ---------- Social links ---------- */
.social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.social a { display: inline-flex; align-items: center; gap: .45rem; min-width: 40px; height: 40px; padding: 0 .55rem; justify-content: center; border-radius: 999px; border: 1px solid var(--line); color: var(--navy); text-decoration: none; font-weight: 500; transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease-out); }
.social a:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-1px); }
.social svg { width: 20px; height: 20px; }
.social.on-band a { border-color: rgba(255,255,255,.3); color: #fff; }
.social.on-band a:hover { background: var(--sun); border-color: var(--sun); color: #1A1A1A; }

/* ---------- Hosted in Switzerland ---------- */
.hosted-ch { display: inline-flex; align-items: center; gap: .45rem; }
.ch-flag { width: 16px; height: 16px; flex: none; }
@media (max-width: 600px) { .phero::after { width: 190px; height: 190px; border-width: 14px; inset-inline-end: -110px; top: -120px; } }

/* Réseaux sociaux bien visibles : barre du haut + pied de page */
.tb-follow { display: flex; align-items: center; gap: .6rem; }
.tb-follow > span { color: var(--muted, #555); font-size: .85rem; }
.social.mini { gap: .35rem; }
.social.mini a { min-width: 30px; height: 30px; padding: 0 .4rem; }
.social.mini svg { width: 16px; height: 16px; }
.foot-follow { display: grid; gap: .6rem; }
.foot-follow .h4 { margin: 0; }
.social.on-band a { padding: 0 .9rem; }
@media (max-width: 520px) { .tb-follow > span { display: none; } }
