/* ==========================================================================
   Le Bastion — page de liens
   Palette tirée du logo : bleu encre, marine, crème. Aucune dépendance externe.
   ========================================================================== */

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("../fonts/space-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("../fonts/space-mono-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Couleurs de marque (échantillonnées sur les logos fournis) */
  --navy: #101928;
  --navy-deep: #0a111d;
  --navy-2: #16233a;
  --blue: #005c81;
  --blue-hi: #1593c7;
  --sky: #6fd0f2;
  --cream: #f1dcbb;
  --cream-dim: #b9a888;

  --line: rgba(241, 220, 187, 0.16);
  --line-strong: rgba(241, 220, 187, 0.45);

  --font-text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Géométrie du bandeau : --ww = largeur du logo, tout le reste en découle */
  --ww: 42vw;
  --gap: 0.32;

  --ease-out: cubic-bezier(0.2, 0.75, 0.1, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--navy-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--cream);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 12% 6%, rgba(0, 92, 129, 0.55), transparent 62%),
    radial-gradient(1100px 700px at 100% 100%, rgba(0, 92, 129, 0.28), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: var(--blue-hi);
  color: #fff;
}

/* --- Grain « linogravure » ------------------------------------------------ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .86 0 0 0 0 .73 0 0 0 1.6 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Mise en page --------------------------------------------------------- */
.page {
  position: relative;
  overflow-x: clip;
  padding: max(1.5rem, env(safe-area-inset-top)) 0 0;
}

/* --- Bandeau (porte + sentier + logo) ------------------------------------- */
.hero {
  position: relative;
  width: calc((1.9 + var(--gap)) * var(--ww));
  max-width: 100%;
  height: calc(var(--ww) * 1.29);
  margin: clamp(0.5rem, 3vh, 2rem) auto 0;
  z-index: 1;
}

.hero__art {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--ww) * 4.596);
  height: calc(var(--ww) * 2.117);
  animation: art-in 2.2s var(--ease-out) 0.1s both;
  pointer-events: none;
  will-change: transform;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
}
.hero__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}
/* Éclat crème qui voyage de la porte vers le sentier (masque en dégradé : fonctionne aussi hors ligne) */
.hero__art-sheen {
  opacity: 0.65;
  -webkit-mask-image: linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  mask-image: linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  -webkit-mask-size: 250% 100%;
  mask-size: 250% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  animation: sheen 11s ease-in-out 2.6s infinite;
}

.hero__glow {
  position: absolute;
  left: calc(var(--ww) * 0.45);
  top: calc(var(--ww) * 0.62);
  width: calc(var(--ww) * 2.6);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(241, 220, 187, 0.2) 0%,
    rgba(21, 147, 199, 0.2) 34%,
    transparent 66%
  );
  filter: blur(8px);
  animation: breathe 7s ease-in-out 1s infinite;
  pointer-events: none;
}

.hero__brand {
  position: absolute;
  left: calc((0.9 + var(--gap)) * var(--ww));
  top: 0;
  width: var(--ww);
  margin: 0;
  animation: rise 1.1s var(--ease-out) 0.55s both;
}
.hero__brand img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 26px rgba(0, 0, 0, 0.35));
}

/* --- Contenu -------------------------------------------------------------- */
.main {
  position: relative;
  z-index: 2;
  width: min(100% - 2.5rem, 36rem);
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
}

.intro {
  margin: 0 0 2.25rem;
  color: #eadbbf;
  text-shadow: 0 1px 14px var(--navy-deep), 0 0 4px var(--navy-deep);
  font-size: 1.0625rem;
  text-wrap: balance;
  animation: rise 0.9s var(--ease-out) 0.9s both;
}
.intro em {
  font-style: normal;
  color: var(--cream);
}
.intro strong {
  color: var(--cream);
  font-weight: 600;
}

.group {
  margin-bottom: 1.9rem;
}

.group__title {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-dim);
  animation: rise 0.8s var(--ease-out) both;
}
.group__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.cards {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Cartes de liens ------------------------------------------------------ */
.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem 0.85rem 0.85rem;
  min-height: 4.5rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  text-decoration: none;
  background:
    radial-gradient(260px circle at var(--mx) var(--my), rgba(111, 208, 242, 0.16), transparent 70%),
    rgba(17, 29, 49, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 1px 0 rgba(241, 220, 187, 0.05) inset, 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  transition:
    transform 0.35s var(--ease-out),
    border-color 0.25s ease,
    box-shadow 0.35s ease;
  -webkit-tap-highlight-color: transparent;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 1px 0 rgba(241, 220, 187, 0.08) inset, 0 20px 40px -18px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(111, 208, 242, 0.08);
}
.card:active {
  transform: translateY(-1px) scale(0.995);
}

/* Pastille d'icône : forme de porte (coins hauts coupés), comme le logo */
.card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3.3rem;
  color: var(--cream);
  background: linear-gradient(160deg, var(--blue-hi), var(--blue));
  clip-path: polygon(0 24%, 16% 0, 84% 0, 100% 24%, 100% 100%, 0 100%);
  transition: transform 0.35s var(--ease-out);
}
.card:hover .card__icon {
  transform: scale(1.06) rotate(-2deg);
}

.card:has(.card__desc) {
  align-items: flex-start;
}
.card:has(.card__desc) .card__arrow {
  margin-top: 0.2rem;
}

.card__text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sky);
  white-space: nowrap;
}

.card__sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--cream-dim);
  overflow-wrap: anywhere;
}
.card__desc {
  margin-top: 0.3rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #cdbd9d;
  text-wrap: pretty;
}

.card__arrow {
  flex: none;
  color: var(--cream-dim);
  transition: transform 0.35s var(--ease-out), color 0.2s ease;
}
.card:hover .card__arrow {
  color: var(--cream);
  transform: translate(3px, -3px);
}

/* Carte principale (Patreon) : crème plein, bien visible */
.card--primary {
  min-height: 5.25rem;
  color: var(--navy);
  border-color: transparent;
  background:
    radial-gradient(300px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.55), transparent 70%),
    linear-gradient(135deg, #f6e6c8, var(--cream) 55%, #e6cc9f);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 18px 44px -18px rgba(241, 220, 187, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  overflow: hidden;
}
.card--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.65) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: shine 6.5s ease-in-out 2.2s infinite;
  pointer-events: none;
}
.card--primary:hover {
  border-color: transparent;
  box-shadow: 0 24px 54px -16px rgba(241, 220, 187, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}
.card--primary .card__icon {
  color: var(--cream);
  background: linear-gradient(160deg, #16233a, var(--navy));
}
.card--primary .card__title {
  font-size: 1.2rem;
  font-weight: 700;
}
.card--primary .card__sub,
.card--primary .card__arrow {
  color: rgba(16, 25, 40, 0.8);
}
.card--primary:hover .card__arrow {
  color: var(--navy);
}

/* Apparition en cascade des cartes */
.cards li {
  animation: rise 0.8s var(--ease-out) both;
}
.main .d1 { animation-delay: 1.07s; }
.main .d2 { animation-delay: 1.14s; }
.main .d3 { animation-delay: 1.21s; }
.main .d4 { animation-delay: 1.28s; }
.main .d5 { animation-delay: 1.35s; }
.main .d6 { animation-delay: 1.42s; }
.main .d7 { animation-delay: 1.49s; }
.main .d8 { animation-delay: 1.56s; }
.main .d9 { animation-delay: 1.63s; }
.main .d10 { animation-delay: 1.70s; }
.main .d11 { animation-delay: 1.77s; }
.main .d12 { animation-delay: 1.84s; }
.main .d13 { animation-delay: 1.91s; }
.main .d14 { animation-delay: 1.98s; }
.main .d15 { animation-delay: 2.05s; }
.main .d16 { animation-delay: 2.12s; }
.main .d17 { animation-delay: 2.19s; }
.main .d18 { animation-delay: 2.26s; }
.main .d19 { animation-delay: 2.33s; }
.main .d20 { animation-delay: 2.40s; }

/* --- Carte vedette : Patreon ---------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.featured {
  position: relative;
  isolation: isolate;
  margin: 0 0 2.2rem;
  animation: rise 0.9s var(--ease-out) 0.85s both;
}
.featured::before {
  content: "";
  position: absolute;
  inset: -0.9rem -0.6rem;
  z-index: -1;
  border-radius: 2rem;
  background: radial-gradient(60% 100% at 50% 50%, rgba(241, 220, 187, 0.3), rgba(21, 147, 199, 0.14) 60%, transparent 78%);
  filter: blur(16px);
  animation: breathe 5.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}

.card--featured {
  gap: 1.1rem;
  min-height: 6.75rem;
  padding: 1.1rem 1.1rem 1.1rem 1rem;
  border-radius: 1.4rem;
}
.card--featured .card__icon {
  width: 3.6rem;
  height: 4rem;
}
.card--featured .card__icon svg {
  width: 1.8rem;
  height: 1.8rem;
}
.card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(16, 25, 40, 0.8);
}
.card--featured .card__title {
  font-size: clamp(1.3rem, 5.2vw, 1.6rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.card--featured .card__sub {
  margin-top: 0.1rem;
}
.card__cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cream);
  background: var(--navy);
  box-shadow: 0 10px 22px -10px rgba(16, 25, 40, 0.8);
  transition: transform 0.35s var(--ease-out), background 0.25s ease;
}
.card--featured:hover .card__cta {
  transform: translateX(3px);
  background: #0b1424;
}
@media (max-width: 420px) {
  .card--featured {
    gap: 0.85rem;
    padding-right: 0.85rem;
  }
  .card--featured .card__icon {
    width: 3.1rem;
    height: 3.5rem;
  }
  .card__eyebrow {
    letter-spacing: 0.08em;
  }
  .card__cta {
    padding: 0.7rem;
  }
  .card__cta-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* --- Accessibilité : pause des animations (WCAG 2.2.2) ----------------------- */
.footer__tools {
  margin-bottom: 1rem !important;
}
.motion-toggle {
  appearance: none;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 700 0.72rem/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}
.motion-toggle:hover {
  background: rgba(241, 220, 187, 0.1);
}
.motion-toggle[aria-pressed="true"] {
  background: var(--cream);
  color: var(--navy);
}
.motion-toggle[hidden] {
  display: none;
}

html.no-motion *,
html.no-motion *::before,
html.no-motion *::after {
  animation: none !important;
  transition: none !important;
}
html.no-motion .hero__art {
  transform: none !important;
}
/* Plus aucun déplacement au survol : seules les couleurs et bordures changent */
html.no-motion .card,
html.no-motion .card:hover,
html.no-motion .card:active,
html.no-motion .card:hover .card__icon,
html.no-motion .card:hover .card__arrow,
html.no-motion .card--featured:hover .card__cta,
html.no-motion .footer__logo:hover,
html.no-motion .btn:hover {
  transform: none !important;
}
html.no-motion .card {
  --mx: 50% !important;
  --my: 50% !important;
}

@media (forced-colors: active) {
  .card {
    border: 1px solid LinkText;
  }
  .card__icon {
    clip-path: none;
    border: 1px solid CanvasText;
    background: Canvas;
  }
  .card__cta {
    border: 1px solid ButtonText;
  }
  .grain,
  .hero__glow,
  .featured::before {
    display: none;
  }
}

/* --- Pied de page --------------------------------------------------------- */
.footer {
  position: relative;
  z-index: 2;
  width: min(100% - 2.5rem, 36rem);
  margin: 3.5rem auto 0;
  padding: 1.6rem 0 max(2rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  animation: rise 0.9s var(--ease-out) 2.4s both;
}
.footer p {
  margin: 0;
}
.footer__copy {
  font-size: 0.875rem;
  color: var(--cream-dim);
}
.footer__credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 1.1rem !important;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.footer__logo {
  display: inline-block;
  line-height: 0;
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.35s var(--ease-out);
}
.footer__logo:hover {
  opacity: 1;
  transform: translateY(-2px);
}
.footer__logo img {
  height: 1.9rem;
  width: auto;
}

/* --- Page 404 ------------------------------------------------------------- */
.notfound {
  text-align: center;
}
.notfound__code {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(3.5rem, 14vw, 6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--blue-hi);
  animation: rise 0.8s var(--ease-out) 0.9s both;
}
.notfound__title {
  margin: 0.6rem 0 0.5rem;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  line-height: 1.2;
  animation: rise 0.8s var(--ease-out) 1s both;
}
.notfound .intro {
  margin-bottom: 1.75rem;
  animation-delay: 1.1s;
}
.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  color: var(--navy);
  background: var(--cream);
  box-shadow: 0 14px 34px -14px rgba(241, 220, 187, 0.55);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
  animation: rise 0.8s var(--ease-out) 1.2s both;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -14px rgba(241, 220, 187, 0.7);
}

/* --- Animations ----------------------------------------------------------- */
@keyframes art-in {
  from { clip-path: inset(-5% 100% -5% 0); opacity: 0.4; }
  to   { clip-path: inset(-5% -5% -5% 0);  opacity: 1; }
}
@keyframes sheen {
  0%, 12% { mask-position: 100% 0; -webkit-mask-position: 100% 0; }
  55%, 100% { mask-position: 0% 0; -webkit-mask-position: 0% 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.65; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.06); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@keyframes shine {
  0%, 55% { transform: translateX(-120%); }
  80%, 100% { transform: translateX(120%); }
}

/* --- Tablette ------------------------------------------------------------- */
@media (min-width: 640px) {
  :root {
    --ww: min(26vw, 230px);
    --gap: 1;
  }
}

/* --- Bureau --------------------------------------------------------------- */
@media (min-width: 1024px) {
  :root {
    --ww: clamp(200px, 16vw, 250px);
    --gap: 2.3;
  }
  .page {
    padding-top: max(2rem, env(safe-area-inset-top));
  }
  .main {
    width: min(100% - 3rem, 38rem);
  }
  .card {
    padding: 0.95rem 1.2rem 0.95rem 0.95rem;
  }
}

/* --- Préférences utilisateur --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hero__art {
    transform: none !important;
  }
  .motion-toggle {
    display: none !important;
  }
}

@media (prefers-contrast: more) {
  .card {
    border-color: var(--line-strong);
    background: rgba(10, 17, 29, 0.92);
  }
  .grain {
    display: none;
  }
}

@media print {
  .grain, .hero__art, .hero__glow { display: none; }
  body { background: #fff; color: #000; }
}
