/* styles.css — mobile-first. Palette « parchemin & nuit », typographie éditoriale. */

:root {
  --bg: #150f1b;
  --bg-2: #1d1526;
  --bg-soft: #241a2e;
  --parch: #f4ead7;
  --gold: #e8c976;
  --gold-deep: #d9a441;
  --muted: #b7a6bf;
  --line: rgba(244, 233, 216, 0.12);
  --radius: 18px;
  --maxw: 660px;
  font-size: 17px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--parch);
  font-family: 'Spectral', 'Iowan Old Style', Georgia, serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 50% -8%, rgba(232,201,118,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(125,91,166,.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, .display { font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif; }

/* ---------- Barre supérieure ---------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .9rem 1.25rem .2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  color: var(--parch); text-decoration: none; font-weight: 600;
  font-size: 1rem; opacity: .9; display: inline-flex; gap: .5rem; align-items: center;
  max-width: 68%; white-space: nowrap;
}
.brand:hover { opacity: 1; }
.brand__logo { width: 30px; height: 30px; flex: 0 0 auto; display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.brand__name { font-family: 'Fraunces', Georgia, serif; overflow: hidden; text-overflow: ellipsis; }
.lang-switch {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .5rem .25rem .7rem;
}
.lang-switch__globe { font-size: .95rem; }
#lang-select {
  background: transparent; border: 0; color: var(--parch);
  font-family: inherit; font-size: .9rem; padding: .2rem .1rem; cursor: pointer;
  max-width: 9rem;
}
#lang-select:focus { outline: none; }
#lang-select option { background: var(--bg-2); color: var(--parch); }

/* ---------- Hero / saisie ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.8rem 1.25rem 1.5rem;
  text-align: center;
}
.hero__title {
  font-size: clamp(2.1rem, 8.5vw, 3.4rem);
  line-height: 1.04;
  margin: 0 0 .85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero__title .hl {
  background: linear-gradient(115deg, var(--gold), #f0d999 55%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold);
}
.hero__sub {
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0 auto 1.9rem;
  max-width: 40ch;
}

/* Frise des époques sous le hero (montre la promesse d'un coup d'œil) */
.era-strip {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .55rem;
  font-size: 1.45rem; line-height: 1; margin: 0 auto 1.6rem; max-width: 30rem;
  filter: saturate(1.05);
}
.era-strip span { transition: transform .15s ease; cursor: default; }
.era-strip span:hover { transform: translateY(-3px) scale(1.18); }

.income-form { display: flex; flex-direction: column; gap: .75rem; max-width: 460px; margin: 0 auto; }

/* Sélecteur segmenté mois / an */
.seg {
  display: flex; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .3rem; gap: .3rem;
}
.seg__btn {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font-family: inherit; font-size: .98rem; padding: .6rem .5rem; border-radius: 12px;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.seg__btn.is-active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 26%, var(--bg-soft)), color-mix(in srgb, var(--gold) 14%, var(--bg-soft)));
  color: var(--parch); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Ligne de crédibilité sous le formulaire */
.trust-line {
  text-align: center; color: var(--muted); font-size: .85rem; margin: 1.1rem auto 0;
  max-width: 38ch; opacity: .85;
}
.field {
  display: flex;
  gap: .5rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .35rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.25);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field:focus-within { border-color: rgba(232,201,118,.5); box-shadow: 0 0 0 3px rgba(232,201,118,.12); }
#income {
  flex: 1 1 auto; min-width: 0;
  background: transparent; border: 0; color: var(--parch);
  font-size: 1.45rem; font-family: inherit; padding: .65rem .8rem; font-weight: 500;
}
#income:focus { outline: none; }
#income::placeholder { color: #7c6f82; }
#period {
  background: transparent; border: 0;
  color: var(--muted); font-family: inherit; font-size: .98rem; padding: .55rem .6rem; cursor: pointer; width: 100%;
}
#period option, .cur-select option { background: var(--bg-2); color: var(--parch); }
.cur-select {
  background: transparent; border: 0; border-left: 1px solid var(--line);
  color: var(--parch); font-family: inherit; font-size: .98rem; padding: 0 .5rem; cursor: pointer;
  max-width: 8.5rem; flex: 0 0 auto;
}
.cur-select:focus, #period:focus { outline: none; }
.field--period { padding: .15rem .35rem; }
[dir="rtl"] .cur-select { border-left: 0; border-right: 1px solid var(--line); }

.btn {
  font-family: inherit; font-size: 1.12rem; border: 0; border-radius: var(--radius);
  padding: .95rem 1.25rem; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #2a1d0a; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 10px 26px rgba(216,164,65,.28);
}
.btn--primary:hover { filter: brightness(1.05); box-shadow: 0 12px 30px rgba(216,164,65,.36); }

.status { color: var(--muted); font-size: .9rem; min-height: 1.2em; margin: .25rem 0 0; }

/* ---------- Pub ---------- */
.ad-slot {
  max-width: var(--maxw); margin: 1rem auto; padding: 1rem;
  border: 1px dashed var(--line); border-radius: var(--radius);
  text-align: center; color: #6d6172; font-size: .8rem;
  letter-spacing: .05em; text-transform: uppercase;
}

/* ---------- Résultats ---------- */
.results-section { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem 3rem; }

/* Hero de résultat : accroche marketing en tête */
.result-hero {
  text-align: center; margin: .5rem auto 1.7rem; max-width: 34rem;
  padding: 1.3rem 1.25rem; border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, var(--bg-2)), var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--gold) 22%, var(--line));
  box-shadow: 0 12px 34px rgba(0,0,0,.3);
}
.summary-line {
  margin: 0 0 .5rem; font-family: 'Fraunces', Georgia, serif;
  font-size: 1.32rem; font-weight: 600; line-height: 1.2; color: var(--parch);
}
.summary-line b { color: var(--gold); }
.ratio-readout {
  text-align: center; color: var(--muted); font-size: 1rem;
  font-weight: 400; margin: 0;
}
.results-grid { display: flex; flex-direction: column; gap: 1.05rem; }

.card {
  position: relative;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--bg-soft)), var(--bg-soft) 42%);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent, #555);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  overflow: hidden;
  animation: cardIn .5s cubic-bezier(.2,.7,.3,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.card::after { /* lueur d'accent en haut à droite */
  content: ""; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%);
  opacity: .5; pointer-events: none;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

.card__head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; position: relative; z-index: 1; }
.card__emoji { font-size: 2.1rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.card__head > div { min-width: 0; flex: 1; }
.card__title { margin: 0; font-size: 1.3rem; font-weight: 600; line-height: 1.1; }
.card__period { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }

/* Pastille-avatar illustrée du statut, teintée à la couleur de l'époque */
.card__avatar {
  flex: 0 0 auto;
  width: 62px; height: 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
  background: #15101a;
  border: 3px solid var(--accent);
  box-shadow: 0 3px 12px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.3) inset;
}
.card__avatar svg { width: 100%; height: 100%; display: block; }
.card__avatar-emoji { font-size: 2rem; line-height: 1; }

.card__verdict { margin: .25rem 0 .85rem; position: relative; z-index: 1; }
.card__rank {
  margin: 0; color: var(--gold); font-weight: 700; font-size: .82rem;
  letter-spacing: .08em; text-transform: uppercase;
}
.card__status { margin: .2rem 0; font-size: 1.85rem; font-weight: 600; line-height: 1.08; font-family: 'Fraunces', Georgia, serif; }
.card__income { margin: 0; color: var(--muted); font-size: .92rem; font-style: italic; }

.card__blurb { margin: .6rem 0 1.1rem; font-size: 1.02rem; position: relative; z-index: 1; }

/* Vie quotidienne (accordéon) */
.card__life {
  margin: 0 0 .85rem; border: 1px solid var(--line); border-radius: 13px;
  background: rgba(0,0,0,.16); position: relative; z-index: 1; overflow: hidden;
}
.card__life > summary {
  list-style: none; cursor: pointer; padding: .65rem .9rem;
  color: var(--gold); font-size: .9rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem;
}
.card__life > summary::-webkit-details-marker { display: none; }
.card__life > summary::before { content: "🗓️"; }
.card__life > summary::after { content: "▾"; margin-left: auto; transition: transform .2s ease; opacity: .7; }
.card__life[open] > summary::after { transform: rotate(180deg); }
.card__life ul { list-style: none; margin: 0; padding: 0 .9rem .85rem; display: flex; flex-direction: column; gap: .5rem; }
.card__life li { font-size: .92rem; line-height: 1.45; }
.card__life .life-k { color: var(--gold); font-weight: 600; }
[dir="rtl"] .card__life > summary::after { margin-left: 0; margin-right: auto; }

.card__concrete {
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.04);
  border-radius: 13px; padding: .85rem 1rem; position: relative; z-index: 1;
}
.card__concrete-label { margin: 0 0 .55rem; color: var(--muted); font-size: .85rem; }
.goods { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem 1rem; }
.goods li { font-size: .95rem; }
.goods strong { color: var(--gold); }

.card__foot { margin-top: 1rem; position: relative; z-index: 1; }
.reliability {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .22rem .65rem;
}
.reliability--attested { color: #7ed3a0; border-color: rgba(126,211,160,.35); }
.reliability--model { color: #e8c976; border-color: rgba(232,201,118,.35); }
.reliability--estimate { color: #e0996b; border-color: rgba(224,153,107,.35); }
.reliability--calibration { color: #9db4e0; border-color: rgba(157,180,224,.35); }

/* ---------- Partage ---------- */
.share-block {
  text-align: center; margin-top: 2.5rem; padding: 1.8rem 1.25rem;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.share-block__title { margin: 0 0 1rem; font-size: 1.2rem; color: var(--parch); }

.share-preview { margin: 0 auto 1.2rem; max-width: 290px; }
.share-preview img {
  width: 100%; display: block; border-radius: 14px;
  border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.5);
  cursor: pointer; transition: transform .12s ease;
}
.share-preview img:hover { transform: translateY(-3px) scale(1.01); }
.share-preview__hint { margin: .55rem 0 0; color: var(--muted); font-size: .82rem; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(18px);
  background: #2a1d2e; color: var(--parch); border: 1px solid var(--gold);
  border-radius: 12px; padding: .7rem 1.1rem; font-size: .92rem; max-width: 88vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; z-index: 60;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.btn--share {
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 18%, var(--bg-soft)), var(--bg-soft));
  border: 1px solid var(--gold); color: var(--gold); font-weight: 700;
}
.btn--share:hover { background: color-mix(in srgb, var(--gold) 22%, var(--bg-soft)); }

.social-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; margin: 1.1rem 0 .4rem;
}
.social {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .8rem; border-radius: 999px;
  color: #fff; text-decoration: none; font-size: .9rem; font-weight: 600;
  background: var(--brand, #555); border: 1px solid rgba(255,255,255,.12);
  transition: transform .1s ease, filter .15s ease;
}
.social:hover { transform: translateY(-2px); filter: brightness(1.08); }
.social svg { width: 17px; height: 17px; }
.social__label { line-height: 1; }
.social--whatsapp { --brand: #25D366; color: #06251a; }
.social--x        { --brand: #000; border-color: rgba(255,255,255,.3); }
.social--facebook { --brand: #1877F2; }
.social--linkedin { --brand: #0A66C2; }
.social--telegram { --brand: #229ED9; }
.social--reddit   { --brand: #FF4500; }
.social--email    { --brand: #5b6168; }

.share-aux { margin-top: .9rem; display: flex; gap: .6rem; justify-content: center; align-items: center; flex-wrap: wrap; }
.link-btn {
  background: none; border: 0; color: var(--gold); font-family: inherit;
  font-size: .9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: .2rem;
}
.link-btn:hover { color: #f0d999; }
.share-aux .dot { color: var(--muted); }
.share-note { color: var(--muted); font-size: .85rem; margin: .9rem 0 0; }

/* ---------- Footer ---------- */
.site-foot {
  max-width: var(--maxw); margin: 2rem auto 0; padding: 2.2rem 1.25rem 3rem;
  text-align: center; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--line);
}
.site-foot__brand { font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; color: var(--parch); font-weight: 600; }
.site-foot__tag { margin: .35rem auto .9rem; color: var(--muted); max-width: 40ch; }
.site-foot__links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.site-foot a { color: var(--gold); text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

/* ---------- RTL (arabe) ---------- */
[dir="rtl"] .card { border-left: 1px solid var(--line); border-right: 5px solid var(--accent, #555); }
[dir="rtl"] .card::after { right: auto; left: -40px; }
[dir="rtl"] #period { border-left: 0; border-right: 1px solid var(--line); }

/* ---------- Desktop : grille 2 colonnes ---------- */
@media (min-width: 760px) {
  :root { --maxw: 980px; }
  .results-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .share-block { grid-column: 1 / -1; }
}
