/* Bloc « Organisez tout au même endroit » (section aria-labelledby="titre-espace"), travail du 26/11.
   Remplace dans la feuille commune : .espace, .espace__texte, .outils, .outils__picto et la ligne .espace du palier 1000 px
   (le titre garde les règles de « .tete h2 »). Toutes les couleurs viennent des jetons de deux-sites.css. */

.bloc-espace {
  --esp-nuit-profonde: color-mix(in srgb, var(--nuit) 72%, #000);
  --esp-coin: clamp(34px, 5vw, 56px);
  padding-bottom: clamp(24px, 3.5vw, 48px);
  /* Deux lueurs d'or très légères derrière la grille : du relief, sans cadre autour du bloc */
  background:
    radial-gradient(38% 46% at 94% 36%, color-mix(in srgb, var(--or) 14%, transparent), transparent 72%),
    radial-gradient(34% 40% at 3% 80%, color-mix(in srgb, var(--or) 10%, transparent), transparent 72%);
}
.bloc-espace .icone { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- La grille : cinq cartes de tailles inégales */
.esp-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.esp-carte {
  --r: 22px;
  position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border-radius: var(--r); background: var(--bande); color: var(--texte);
  box-shadow: inset 0 0 0 1px var(--bande-bord), var(--ombre);
  transition: transform .4s var(--courbe), box-shadow .4s var(--courbe);
}
.esp-carte--large { grid-column: 1 / -1; }
/* Un grand coin arrondi par carte, tourné vers l'extérieur : le groupe n'a pas de cadre mais une silhouette */
.esp-carte--demandes { --r: var(--esp-coin) 22px 22px 22px; }
.esp-carte--invites { --r: 22px 22px var(--esp-coin) 22px; }

.esp-carte__corps { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 18px; min-width: 0; padding: 18px 16px 20px; }
.esp-carte--large .esp-carte__corps { padding: 22px 22px 18px; }
.esp-carte__texte { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; margin-top: auto; }
.esp-carte h3 { margin: 0; color: var(--titre); font: 800 1.12rem/1.2 var(--police); letter-spacing: -.02em; text-wrap: balance; }
.esp-carte--large h3 { font-size: clamp(1.3rem, 1.05rem + .9vw, 1.6rem); }
.esp-carte p { margin: 0; max-width: 34ch; font-size: .94rem; line-height: 1.5; }

/* Pictogramme : une pastille d'or aux bords irréguliers, en haut à gauche */
.esp-picto {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px;
  border-radius: 58% 42% 52% 48% / 46% 56% 44% 54%;
  background: var(--accent); color: var(--accent-texte);
  /* conseil D7 des vidéos du 28/11 : une ombre de contact (or brun) sous la lueur d'or, allégée */
  box-shadow: inset 0 0 0 1px var(--accent-bord), inset 0 2px 0 rgba(255, 255, 255, .4), 0 1px 2px color-mix(in srgb, var(--bouton-ombre) 50%, transparent), 0 12px 20px -12px color-mix(in srgb, var(--bouton-lueur) 80%, transparent);
}
.esp-picto .icone { width: 22px; height: 22px; }

/* Lien de couleur : toute la carte est cliquable (la zone est portée par le lien) */
.esp-lien { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 2px; color: var(--accent-lien); font-weight: 700; font-size: .95rem; text-decoration: none; }
.esp-lien:hover { color: var(--accent-lien); text-decoration: underline; text-underline-offset: 4px; }
.esp-lien::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: var(--r); }
.esp-lien .icone { flex: none; width: 18px; height: 18px; transition: transform .3s var(--courbe); }
.esp-lien:focus-visible { outline: none; }
.esp-lien:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---------------------------------------------------------------- Cartes à photo : la photo remplit son côté, coupée par une courbe bordée d'or.
   Au téléphone la photo est en haut (courbe en bas) ; à partir de 700 px elle est sur le côté. */
.esp-photo { position: relative; order: -1; flex: none; height: 176px; background: var(--accent); clip-path: ellipse(86% 100% at 50% 0%); }
.esp-photo__cadre { position: absolute; inset: 0 0 5px 0; overflow: hidden; clip-path: ellipse(86% 100% at 50% 0%); }
.esp-photo img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: transform .9s var(--courbe); }

/* ---------------------------------------------------------------- Carte nuit : photo de fête sous un voile marine, liseré et cercles d'or */
.esp-carte--nuit {
  min-height: 300px; color: rgba(255, 255, 255, .88);
  background: linear-gradient(150deg, var(--esp-nuit-profonde) 0%, var(--nuit) 46%, var(--nuit-2) 100%);
  box-shadow: var(--ombre-forte);
}
.esp-fond { position: absolute; inset: 0; z-index: -3; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 38%; transition: transform .9s var(--courbe); }
.esp-voile {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(70% 80% at 100% 0%, var(--lueur-1), transparent 62%),
    radial-gradient(80% 80% at 0% 100%, var(--lueur-2), transparent 66%),
    linear-gradient(180deg, color-mix(in srgb, var(--nuit) 26%, transparent) 0%, color-mix(in srgb, var(--nuit) 58%, transparent) 40%, color-mix(in srgb, var(--esp-nuit-profonde) 95%, transparent) 100%);
}
.esp-carte--nuit::before {
  content: ""; position: absolute; z-index: -1; top: -100px; right: -90px; width: 250px; height: 250px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--or) 62%, transparent);
  outline: 1px solid color-mix(in srgb, var(--or) 30%, transparent); outline-offset: 32px;
  box-shadow: 0 0 0 32px color-mix(in srgb, var(--or) 6%, transparent), 0 0 70px 30px color-mix(in srgb, var(--or) 10%, transparent);
}
.esp-carte--nuit::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: var(--r);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--or) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
  background: linear-gradient(90deg, transparent, var(--or), transparent) 50% 0 / 64% 2px no-repeat;
}
.esp-carte--nuit h3 { color: #fff; }
.esp-carte--nuit h3, .esp-carte--nuit p { text-shadow: 0 1px 14px rgba(4, 9, 26, .7); }
.esp-carte--nuit p { max-width: 30ch; }
.esp-carte--nuit .esp-lien, .esp-carte--nuit .esp-lien:hover { color: var(--accent-clair-uni); }
/* sur la carte dorée, le lien passe au marine : l'or brun sur l'or ne se lit pas */
.esp-carte--or .esp-lien, .esp-carte--or .esp-lien:hover { color: var(--titre); }

/* ---------------------------------------------------------------- Petites cartes : crème soutenue et or, un motif en haut à droite */
.esp-carte--creme {
  background: radial-gradient(90% 70% at 0% 0%, rgba(255, 255, 255, .78), transparent 62%), linear-gradient(165deg, var(--fond-2) 0%, var(--accent-teinte) 100%);
  box-shadow: inset 0 0 0 1px var(--ligne-forte), var(--ombre);
}
.esp-carte--creme::before {
  content: ""; position: absolute; z-index: -1; top: -52px; right: -44px; width: 150px; height: 150px;
  border-radius: 46% 54% 50% 50% / 55% 45% 55% 45%;
  background: linear-gradient(200deg, color-mix(in srgb, var(--or) 38%, transparent), color-mix(in srgb, var(--or) 6%, transparent));
}
.esp-carte--or {
  color: var(--encre);
  background: radial-gradient(80% 70% at 0% 0%, rgba(255, 255, 255, .7), transparent 60%), linear-gradient(155deg, var(--accent-teinte) 0%, var(--accent-clair-uni) 100%);
  /* conseil D7 du 28/11 : contact, moyenne, puis la grande ombre or brun déjà là, allégée */
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--or-brun) 42%, transparent), 0 1px 2px color-mix(in srgb, var(--bouton-ombre) 30%, transparent), 0 5px 10px -6px color-mix(in srgb, var(--bouton-ombre) 40%, transparent), 0 14px 28px -18px color-mix(in srgb, var(--bouton-ombre) 85%, transparent);
}
.esp-carte--or::before {
  content: ""; position: absolute; z-index: -1; top: -62px; right: -54px; width: 150px; height: 150px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--or-brun) 50%, transparent);
  box-shadow: 0 0 0 20px rgba(255, 255, 255, .26), 0 0 0 21px color-mix(in srgb, var(--or-brun) 30%, transparent);
}
.esp-carte--or .esp-picto {
  background: linear-gradient(150deg, var(--nuit-2), var(--nuit)); color: var(--accent-clair-uni);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 2px 0 rgba(255, 255, 255, .16), 0 1px 2px color-mix(in srgb, var(--nuit) 30%, transparent), 0 12px 20px -12px color-mix(in srgb, var(--nuit) 58%, transparent);   /* conseil D7 du 28/11 */
}

/* ---------------------------------------------------------------- Le bouton, au centre, entre deux filets d'or */
.esp-action { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 24px); margin: clamp(26px, 3.4vw, 44px) 0 0; }
.esp-action::before, .esp-action::after { content: ""; flex: 1 1 0; max-width: 220px; height: 1px; background: linear-gradient(90deg, transparent, var(--or)); }
.esp-action::after { background: linear-gradient(90deg, var(--or), transparent); }
/* Conseils des vidéos du 28/11 : D20 le bouton principal nettement plus gros (texte 18,4 px au lieu de 16,6, 60 px de haut au lieu de 54) ;
   D7 contact + moyenne sous la lueur d'or, allégée ; A4 il se réduit à 0,97 à l'appui */
.esp-action .bouton { flex: none; min-height: 60px; padding-inline: clamp(26px, 3.4vw, 44px); font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px var(--accent-bord), inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 2px color-mix(in srgb, var(--bouton-ombre) 55%, transparent), 0 6px 12px -6px color-mix(in srgb, var(--bouton-lueur) 55%, transparent), 0 16px 30px -14px color-mix(in srgb, var(--bouton-lueur) 80%, transparent);
  transition: background .2s, box-shadow .2s, color .2s, scale .12s var(--courbe); }
@media (prefers-reduced-motion: no-preference) { .esp-action .bouton:active { scale: .97; } }

/* ---------------------------------------------------------------- Tablette : la photo passe sur le côté, coupée par une grande courbe */
@media (min-width: 700px) {
  .esp-grille { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
  .esp-carte { grid-column: span 3; }
  .esp-carte--large { grid-column: 1 / -1; }
  .esp-carte__corps { padding: 24px 24px 26px; }
  .esp-carte--large .esp-carte__corps { padding: 30px 30px 22px; }
  .esp-carte--creme, .esp-carte--or { min-height: 230px; }
  .esp-carte--nuit { min-height: 280px; }
  .esp-carte--photo { flex-direction: row; min-height: 290px; }
  .esp-carte--photo .esp-carte__corps { flex: 1 1 0; padding-right: 16px; }
  .esp-photo { order: 0; flex: 0 0 46%; height: auto; clip-path: ellipse(100% 92% at 100% 50%); }
  .esp-photo__cadre { inset: 0 0 0 5px; clip-path: ellipse(100% 92% at 100% 50%); }
  .esp-carte--miroir { flex-direction: row-reverse; }
  .esp-carte--miroir .esp-carte__corps { padding-right: 30px; padding-left: 26px; }
  .esp-carte--miroir .esp-photo { clip-path: ellipse(100% 92% at 0% 50%); }
  .esp-carte--miroir .esp-photo__cadre { inset: 0 5px 0 0; clip-path: ellipse(100% 92% at 0% 50%); }
}

/* ---------------------------------------------------------------- Ordinateur : 7 + 5 en haut, 3 + 3 + 6 en bas */
@media (min-width: 1100px) {
  .esp-grille { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
  .esp-carte--demandes { grid-column: span 7; min-height: 320px; }
  .esp-carte--nuit { grid-column: span 5; --r: 22px var(--esp-coin) 22px 22px; }
  .esp-carte--creme, .esp-carte--or { grid-column: span 3; }
  .esp-carte--creme { --r: 22px 22px 22px var(--esp-coin); }
  .esp-carte--invites { grid-column: span 6; min-height: 270px; }
  .esp-carte--large .esp-carte__corps { padding: 32px 32px 24px; }
  .esp-carte--photo .esp-carte__corps { padding-right: 16px; }
  .esp-carte--miroir .esp-carte__corps { padding-right: 32px; padding-left: 26px; }
}

/* ---------------------------------------------------------------- Survol (cartes cliquables seulement) */
@media (hover: hover) {
  .esp-carte--lien:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px var(--bande-bord), var(--ombre-forte); }
  .esp-carte--nuit.esp-carte--lien:hover { box-shadow: 0 4px 8px rgba(16, 24, 40, .1), 0 28px 46px -18px color-mix(in srgb, var(--nuit) 70%, transparent); }
  .esp-carte--lien:hover .esp-photo img, .esp-carte--lien:hover .esp-fond { transform: scale(1.05); }
  .esp-carte--lien:hover .esp-lien .icone { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .esp-carte, .esp-photo img, .esp-fond, .esp-lien .icone { transition: none; }
  .esp-carte--lien:hover, .esp-carte--lien:hover .esp-photo img, .esp-carte--lien:hover .esp-fond, .esp-carte--lien:hover .esp-lien .icone { transform: none; }
}

/* ---------------------------------------------------------------- Finitions de la reprise (26/11) */
/* Le titre sur deux lignes, comme sur le dessin : la fin en or brun passe toujours à la ligne */
.bloc-espace h2 .t-fin { display: block; width: fit-content; }
/* Cadrage des deux photos : au téléphone la bande est basse, on remonte sur le tournesol */
.esp-carte--demandes .esp-photo img { object-position: 50% 8%; }
.esp-carte--invites .esp-photo img { object-position: 50% 55%; }
@media (min-width: 700px) { .esp-carte--demandes .esp-photo img { object-position: 50% 30%; } }
