/* ==========================================================================
   MIRAI — Page d'accueil « Obsidian & Emerald Aurora »
   Spécification visuelle fidèle à la référence :
   1. Hero centré sur fond obsidienne + plumeau lumineux aurore émeraude
   2. Grille 3 colonnes de cartes sombres à aperçu micro-UI & lueur inférieure
   3. Bande de veille automatique avec ligne aurore lumineuse
   4. Rangée 3 colonnes « Ton espace privé » sobre à filets fins
   ========================================================================== */

.home-page {
  padding: clamp(1.5rem, 3.5vw, 3rem) var(--gutter) 3rem;
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 6vw, 5rem);
}

/* ---------- 1. Hero centré + lueur aurore émeraude ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: clamp(2.8rem, 6vw, 4.75rem) clamp(1.4rem, 4vw, 3rem) 0;
  background: var(--surface-opaque);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 4vw, 3.25rem);
}

.hero__aurora {
  position: absolute;
  top: -110px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 120%);
  height: 320px;
  background: radial-gradient(ellipse at 50% 35%, rgba(78, 224, 181, 0.28) 0%, rgba(28, 126, 102, 0.14) 44%, transparent 72%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
}

html.theme-clair .hero__aurora {
  background: radial-gradient(ellipse at 50% 35%, rgba(11, 110, 88, 0.14) 0%, transparent 70%);
}

.hero__center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.05rem;
  max-width: 700px;
}

.hero__emblem {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(78, 224, 181, 0.18), rgba(12, 18, 19, 0.92));
  border: 1px solid var(--gold-rule);
  display: grid;
  place-items: center;
  font-family: var(--f-jp);
  font-size: 0.85rem;
  color: var(--accent-ink);
  box-shadow: 0 0 28px rgba(78, 224, 181, 0.22);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

.hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-ink);
  flex-shrink: 0;
}

.hero__title {
  font-family: var(--f-text);
  font-weight: 600;
  font-size: clamp(2.15rem, 5.2vw, 3.85rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero__title em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent-ink);
}

.hero__lead {
  font-size: clamp(0.96rem, 1.3vw, 1.08rem);
  line-height: 1.62;
  color: var(--muted);
  max-width: 54ch;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.68rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), border-color var(--dur-fast);
}

.hero-btn:hover {
  transform: translateY(-1px);
}

.hero-btn--primary {
  background: var(--signal);
  color: var(--on-signal);
}

.hero-btn--primary:hover {
  background: var(--accent-ink);
  color: #060A0A;
}

.hero-btn--frame {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.hero-btn--frame:hover {
  border-color: var(--accent-ink);
}

/* Barre tabulaire 4 colonnes au pied du Hero (façon panneau d'aperçu référence) */
.hero__statbar {
  position: relative;
  z-index: 1;
  width: calc(100% + clamp(2.8rem, 8vw, 6rem));
  margin-left: calc(-1 * clamp(1.4rem, 4vw, 3rem));
  margin-right: calc(-1 * clamp(1.4rem, 4vw, 3rem));
  padding: 1.1rem clamp(1.4rem, 4vw, 3rem);
  background: rgba(6, 10, 10, 0.76);
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem 1.25rem;
}

html.theme-clair .hero__statbar {
  background: rgba(243, 246, 245, 0.9);
}

.hero__statcell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.9rem;
  border-left: 1px solid var(--hair);
}

.hero__statcell:first-child {
  padding-left: 0;
  border-left: 0;
}

.hero__statcell-label {
  color: var(--muted);
  font-size: 0.68rem;
}

.hero__statcell-val {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.3;
}

.hero__statcell-val--urgent {
  color: var(--accent-ink);
}

/* ---------- 2. Grille 3 colonnes des espaces (cartes sombres + micro-UI) ---------- */
.spaces-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.65rem 1.5rem;
}

.section-heading__title {
  font-family: var(--f-text);
  font-weight: 600;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
  color: var(--text);
}

.section-heading__title em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent-ink);
}

.section-heading__sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.spaces-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

/* ---------- Trois losanges distincts en rotation continue (sans gêner la lecture) ---------- */
.spaces-grid--diamonds {
  align-items: center;
  justify-items: center;
  padding: 1.5rem 0;
}

.space-card.diamond-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  padding: 2.1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  display: grid;
  place-items: center;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease);
}

.space-card.diamond-card:hover {
  transform: translateY(-4px);
  box-shadow: none;
}

.diamond-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.diamond-shape {
  position: absolute;
  border-radius: 18px;
  will-change: transform;
}

.diamond-shape--outer {
  width: 72%;
  height: 72%;
  background:
    radial-gradient(80% 80% at 50% 85%, rgba(78, 224, 181, 0.18) 0%, rgba(11, 17, 18, 0.88) 72%);
  border: 1.5px solid var(--gold-rule);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55), inset 0 0 24px rgba(78, 224, 181, 0.08);
  animation: diamondSpin 28s linear infinite;
}

.diamond-shape--inner {
  width: 60%;
  height: 60%;
  border: 1px solid var(--hair);
  border-radius: 14px;
  animation: diamondSpin 40s linear infinite reverse;
}

.space-card--bourses .diamond-shape--outer {
  background:
    radial-gradient(85% 85% at 50% 90%, rgba(78, 224, 181, 0.30) 0%, rgba(14, 23, 24, 0.92) 74%);
  border-color: var(--accent-ink);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6), 0 0 32px rgba(78, 224, 181, 0.16);
}

.space-card--urgent .diamond-shape--outer {
  border-color: var(--accent-ink);
  box-shadow: 0 0 36px rgba(78, 224, 181, 0.28);
}

html.theme-clair .diamond-shape--outer {
  background: rgba(255, 255, 255, 0.90);
  border-color: var(--gold-rule);
  box-shadow: var(--shadow-soft);
}

html.theme-clair .space-card--bourses .diamond-shape--outer {
  background:
    radial-gradient(85% 85% at 50% 90%, rgba(11, 110, 88, 0.14) 0%, rgba(255, 255, 255, 0.94) 75%);
  border-color: var(--accent-ink);
}

@keyframes diamondSpin {
  from { transform: rotate(45deg); }
  to { transform: rotate(405deg); }
}

.diamond-card__content {
  position: relative;
  z-index: 2;
  max-width: 240px;
  padding: 0.95rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(8, 13, 14, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

html.theme-clair .diamond-card__content {
  background: rgba(255, 255, 255, 0.88);
}

.diamond-card__cta {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.space-card.diamond-card .space-card__desc {
  font-size: 0.82rem;
  line-height: 1.48;
}

.space-card.diamond-card .space-card__urgent-line {
  align-self: center;
}

@media (prefers-reduced-motion: reduce) {
  .diamond-shape--outer,
  .diamond-shape--inner {
    animation: none !important;
    transform: rotate(45deg);
  }
}

.space-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  padding: 1.35rem;
  background: var(--surface-opaque);
  border: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.space-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-rule);
  box-shadow: var(--shadow-soft);
}

/* Lueur ascendante émeraude sur la carte mise en avant (panneau 2 de la référence) */
.space-card--bourses {
  background:
    radial-gradient(90% 65% at 50% 108%, rgba(78, 224, 181, 0.24) 0%, rgba(20, 88, 72, 0.14) 48%, transparent 78%),
    var(--surface-opaque);
  border-color: var(--gold-rule);
}

html.theme-clair .space-card--bourses {
  background:
    radial-gradient(90% 65% at 50% 108%, rgba(11, 110, 88, 0.12) 0%, transparent 72%),
    var(--surface-opaque);
}

.space-card--urgent {
  border-color: var(--accent-ink);
}

/* Aperçu micro-UI sombre encastré en haut de chaque carte (panneau 1 de la référence) */
.space-card__preview {
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hair);
}

.mini-row--hi {
  border-color: var(--gold-rule);
  background: var(--halo-sage);
}

.mini-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-ink);
  flex-shrink: 0;
}

.mini-dot--dim {
  background: var(--muted);
  opacity: 0.45;
}

.mini-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  flex: 1;
}

.mini-bar--lg { max-width: 76%; }
.mini-bar--md { max-width: 56%; }
.mini-bar--sm { max-width: 40%; }

.mini-tag {
  font-size: 0.62rem;
  color: var(--accent-ink);
  margin-left: auto;
}

.space-card__content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.space-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.space-card__kicker {
  color: var(--muted);
  font-size: 0.68rem;
}

.space-card__pill {
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--hair);
  background: var(--surface-alt);
  color: var(--accent-ink);
  font-size: 0.66rem;
}

.space-card__pill--urgent {
  background: var(--accent-ink);
  color: #060A0A;
  border-color: transparent;
  font-weight: 600;
}

.space-card__title {
  font-family: var(--f-text);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.space-card__urgent-line {
  display: inline-block;
  align-self: flex-start;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--halo-sage);
  border: 1px solid var(--gold-rule);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 600;
}

.space-card__desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.space-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hair);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

.space-card__arrow {
  color: var(--accent-ink);
  transition: transform var(--dur-fast) var(--ease);
}

.space-card:hover .space-card__arrow {
  transform: translateX(4px);
}

/* ---------- 3. Bande de veille automatique avec ligne aurore lumineuse (panneau 3) ---------- */
.watch-strip {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(65% 120% at 50% 115%, rgba(78, 224, 181, 0.22) 0%, transparent 68%),
    var(--surface-opaque);
  border: 1px solid var(--hair);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.watch-strip--alert {
  border-color: var(--accent-ink);
}

.watch-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem 1.25rem;
}

.watch-bar__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  min-width: 0;
}

.watch-bar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-ink);
  flex-shrink: 0;
}

.watch-bar__dot--alert {
  box-shadow: 0 0 12px var(--accent-ink);
}

.watch-bar__label {
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 600;
}

.watch-bar__text {
  color: var(--text);
  font-size: 0.9rem;
}

.watch-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.watch-bar__bilan {
  padding: 0.46rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}

.watch-bar__bilan:hover {
  border-color: var(--accent-ink);
  background: var(--halo-sage);
}

.watch-bar__launch {
  padding: 0.48rem 1.05rem;
  border-radius: var(--radius-sm);
  background: var(--signal);
  color: var(--on-signal);
  font-size: 0.82rem;
  font-weight: 600;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}

.watch-bar__launch:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.watch-demand {
  padding-top: 0.85rem;
  border-top: 1px solid var(--hair);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.watch-demand__info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.watch-demand__pill {
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
}

.watch-demand__pill--enregistree,
.watch-demand__pill--en_attente,
.watch-demand__pill--en_cours {
  background: var(--accent-ink);
  color: #060A0A;
  border-color: transparent;
}

.watch-demand__pill--terminee {
  background: var(--signal);
  color: var(--on-signal);
  border-color: transparent;
}

.watch-demand__pill--echouee {
  background: var(--danger, #c44b4b);
  color: #ffffff;
  border-color: transparent;
}

.watch-demand__text {
  color: var(--muted);
  font-size: 0.85rem;
}

.watch-demand__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Panneau bilan de veille */
.watch-panel__alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-ink);
  background: var(--halo-sage);
  color: var(--text);
  font-size: 0.88rem;
}

.watch-panel__dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}

.watch-panel__row dt {
  font-size: 0.7rem;
  color: var(--accent-ink);
  margin-bottom: 0.2rem;
}

.watch-panel__row dd {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
}

.watch-panel__list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ---------- 4. Rangée 3 colonnes « Ton espace privé » (panneau 3 bas) ---------- */
.reperes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
}

.repere-card {
  position: relative;
  background: var(--surface-opaque);
  border: 1px solid var(--hair);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color var(--dur-fast);
}

.repere-card:hover {
  border-color: var(--gold-rule);
}

.repere-card__label {
  color: var(--accent-ink);
  margin-bottom: 0.4rem;
  display: block;
  font-size: 0.7rem;
}

.repere-card__title {
  font-family: var(--f-text);
  font-weight: 600;
  font-size: 1.04rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.repere-card__text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.repere-card__action {
  align-self: flex-start;
  padding: 0.44rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}

.repere-card__action:hover {
  border-color: var(--accent-ink);
  background: var(--halo-sage);
}

/* ---------- Apparition sobre ---------- */
.fade-up {
  animation: fadeUp 460ms var(--ease) both;
}

.fade-up-2 {
  animation: fadeUp 540ms var(--ease) 60ms both;
}

.fade-up-3 {
  animation: fadeUp 600ms var(--ease) 110ms both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive (tablette & mobile 360 px) ---------- */
@media (max-width: 960px) {
  .hero__statbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero__statcell:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .spaces-grid,
  .reperes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-page {
    padding-top: 1rem;
    gap: 2.25rem;
  }
  .hero {
    padding: 1.85rem 1.1rem 0;
    border-radius: var(--radius-md);
  }
  .hero__statbar {
    width: calc(100% + 2.2rem);
    margin-left: -1.1rem;
    margin-right: -1.1rem;
    padding: 0.95rem 1.1rem;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .hero__statcell {
    padding-left: 0;
    border-left: 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--hair);
  }
  .hero__statcell:first-child {
    padding-top: 0;
    border-top: 0;
  }
  .hero__cta {
    flex-direction: column;
    width: 100%;
  }
  .hero-btn {
    width: 100%;
  }
  .watch-strip {
    padding: 0.95rem 1rem;
  }
  .watch-bar__actions {
    width: 100%;
  }
  .watch-bar__launch {
    flex: 1;
    text-align: center;
  }
  .spaces-grid--diamonds {
    padding: 0.5rem 0;
    gap: 1.75rem;
  }
  .space-card.diamond-card {
    max-width: 300px;
    padding: 1.25rem;
  }
  .diamond-card__content {
    max-width: 220px;
    padding: 0.8rem 0.75rem;
  }
}
