/* ============================================================
   AFTER — Design System CSS
   Loi 8 : le fond n'est jamais noir. Il est pré-aube.
   Loi 7 : une seule couleur vivante.
   Loi 12 : serif pour les résonances, sans-serif pour la nav.
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Fond cosmique — jamais #000 */
  --sky:        #080c1a;
  --sky-mid:    #0d1225;
  --sky-surface:#111830;
  --sky-raised: #16203a;

  /* Texte */
  --text-primary:   #ddd9cc;
  --text-secondary: #7a8098;
  --text-muted:     #3a4260;

  /* Bordures */
  --border:         rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.14);

  /* Couleur vivante — ambre très doux, utilisée avec parcimonie */
  --accent:         #c8a96e;
  --accent-dim:     rgba(200, 169, 110, 0.15);
  --accent-glow:    rgba(200, 169, 110, 0.08);

  /* Étoiles */
  --star-color:     #d4cdb8;
  --star-dim:       rgba(212, 205, 184, 0.4);

  /* Typographie */
  --font-serif:  'EB Garamond', Georgia, serif;
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', monospace;

  /* Tempo — valeurs protégées par le Tempo Contract */
  --t-star-in:      800ms;
  --t-line-in:      1200ms;
  --t-phrase-in:    1400ms;
  --t-ease:         cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Espace */
  --radius:  8px;
  --radius-lg: 16px;

  /* Max width */
  --max-w: 1080px;
  --max-w-text: 680px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--sky);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--text-primary); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }

/* ── Accessibilité ─────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--sky);
  padding: 8px 16px; border-radius: 0 0 var(--radius) 0;
  font-size: 14px; font-weight: 500;
  z-index: 9999;
}
.skip-link:focus { left: 0; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 12, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}
.wordmark:hover { color: var(--text-primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.nav-links a { color: var(--text-secondary); transition: color 0.25s ease; }
.nav-links a:hover { color: var(--text-primary); }

.nav-cta {
  padding: 7px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  color: var(--text-primary) !important;
  font-size: 12px;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.nav-cta:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ── Layout général ─────────────────────────────────────────── */
main {
  flex: 1;
  padding-top: 56px; /* hauteur header */
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

.container-text {
  max-width: var(--max-w-text);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Typographie ─────────────────────────────────────────────── */
/* Loi 12 : les résonances et insights parlent en serif */
.serif { font-family: var(--font-serif); }

h1, h2, h3 { font-weight: 400; line-height: 1.25; }
h1 { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.5rem); font-style: italic; }
h2 { font-family: var(--font-serif); font-size: clamp(1.4rem, 3vw, 2rem); font-style: italic; }
h3 { font-size: 1rem; font-weight: 500; letter-spacing: 0.04em; color: var(--text-secondary); text-transform: uppercase; font-size: 11px; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.lead {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 28px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  transition: all 0.3s var(--t-ease);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-dim);
  border-color: rgba(200,169,110,0.3);
  color: var(--accent);
}
.btn-primary:hover {
  background: rgba(200,169,110,0.22);
  border-color: rgba(200,169,110,0.6);
  color: var(--accent);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text-primary);
}

/* ── Formulaires ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--sky-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.25s ease;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-strong);
}

textarea { resize: vertical; min-height: 120px; }

.form-error {
  font-size: 12px;
  color: #e07070;
  margin-top: 4px;
}

.form-card {
  background: var(--sky-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 420px;
  margin: 0 auto;
}

/* ── Alertes ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1.25rem;
  border: 1px solid;
}
.alert-error   { background: rgba(200,70,70,0.1);  border-color: rgba(200,70,70,0.3);  color: #e09090; }
.alert-success { background: rgba(70,160,100,0.1); border-color: rgba(70,160,100,0.3); color: #80c8a0; }
.alert-info    { background: var(--accent-glow);   border-color: rgba(200,169,110,0.2); color: var(--accent); }

/* ── Cartes films ─────────────────────────────────────────────── */
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.film-card {
  background: var(--sky-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}
.film-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.film-poster {
  aspect-ratio: 2/3;
  background: var(--sky-raised);
  position: relative;
  overflow: hidden;
}
.film-poster img { width: 100%; height: 100%; object-fit: cover; }
.film-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  padding: 1rem;
}

.film-info {
  padding: 0.75rem;
}
.film-title-sm {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.film-meta-sm {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Constellation (canvas sky) ───────────────────────────────── */
.sky-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 400px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--sky);
  border: 1px solid var(--border);
}

#skyCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Dépôt d'étoile ────────────────────────────────────────────── */
.deposit-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid rgba(212,205,184,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.5s var(--t-ease), transform 0.35s var(--t-ease), box-shadow 0.5s ease;
  margin: 0 auto;
}
.deposit-ring:hover {
  border-color: rgba(212,205,184,0.45);
  box-shadow: 0 0 24px rgba(212,205,184,0.06);
}
.deposit-ring:active { transform: scale(0.9); }

.deposit-ring svg {
  width: 26px;
  height: 26px;
  opacity: 0.4;
  transition: opacity 0.3s ease;
  fill: var(--star-color);
}
.deposit-ring:hover svg { opacity: 0.75; }

/* Mots flottants résonances */
.resonance-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

.resonance-word {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
  background: none;
  border-left: none;
  border-top: none;
  border-right: none;
}
.resonance-word:hover { color: var(--text-primary); border-bottom-color: var(--border); }
.resonance-word.picked { color: var(--star-color); border-bottom-color: rgba(212,205,184,0.5); }

/* Insight phrase */
.insight-phrase {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.75;
  text-align: center;
  opacity: 0;
  transition: opacity var(--t-phrase-in) var(--t-ease);
}
.insight-phrase.visible { opacity: 1; }

/* ── Section hero ───────────────────────────────────────────── */
.hero {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.5rem, 7vw, 5rem);
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.wordmark-sm {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--text-muted);
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text-secondary); }

.footer-right { font-size: 12px; color: var(--text-muted); }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ── Section spacing ────────────────────────────────────────── */
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }

/* ── Utilitaires ────────────────────────────────────────────── */
.text-center   { text-align: center; }
.text-muted    { color: var(--text-secondary); }
.text-accent   { color: var(--accent); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { gap: 1.2rem; }
  .nav-links a:not(.nav-cta) { display: none; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  .film-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-card { padding: 1.75rem; }
}

@media (max-width: 480px) {
  .container, .container-text { padding: 0 1.25rem; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.7s var(--t-ease) both; }
.fade-up-delay-1 { animation-delay: 0.15s; }
.fade-up-delay-2 { animation-delay: 0.3s; }
.fade-up-delay-3 { animation-delay: 0.45s; }

@keyframes starPulse {
  0%   { box-shadow: 0 0 0 0 rgba(212,205,184,0.3); }
  70%  { box-shadow: 0 0 0 10px rgba(212,205,184,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,205,184,0); }
}
.star-pulse { animation: starPulse 2s ease-out; }

/* ── Page auth ──────────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.auth-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.75rem;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
}
