/* =========================================================================
   NextToYourPlace — components.css
   Atomic + composed components. Pair with colors_and_type.css.
   ========================================================================= */

/* ==================== BUTTON ==================== */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: var(--fw-semi);
  line-height: 1;
  padding: 12px 20px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius-1);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
  background: transparent;
  color: var(--ink);
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* Primary — terracotta filled */
.btn--primary {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--paper);
}
.btn--primary:hover { background: var(--terracotta-deep); border-color: var(--terracotta-deep); box-shadow: var(--shadow-2); transform: translate(-1px, -1px); }
.btn--primary:active { transform: translate(0, 0); box-shadow: none; }

/* Secondary — outlined ink */
.btn--secondary { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: var(--paper); }

/* Ghost — text on paper */
.btn--ghost { border-color: transparent; padding: 12px 12px; }
.btn--ghost:hover { background: var(--paper-warm); }

/* Link — inline serif underline */
.btn--link {
  border: 0; padding: 0;
  font-family: var(--font-body); font-weight: var(--fw-medium);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  color: var(--terracotta);
}
.btn--link:hover { color: var(--terracotta-deep); }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }
.btn--small { padding: 8px 14px; font-size: var(--fs-caption); }
.btn--large { padding: 16px 28px; font-size: var(--fs-body-l); }

/* ==================== INPUT / SELECT / TEXTAREA ==================== */
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field__label { font-family: var(--font-body); font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--fg-soft); }
.field__hint  { font-family: var(--font-body); font-size: var(--fs-micro); color: var(--fg-muted); font-style: italic; }
.field__error { font-family: var(--font-body); font-size: var(--fs-caption); color: var(--terracotta); }

.input, .select, .textarea {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.4;
  padding: 12px 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink-subtle);
  border-radius: var(--radius-1);
  color: var(--fg);
  width: 100%;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px var(--terracotta-wash); }
.input::placeholder, .textarea::placeholder { color: var(--ink-subtle); font-style: italic; }
.textarea { min-height: 96px; resize: vertical; }

.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%231A1A1A' stroke-width='1.5'><path d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px;
}

/* ==================== CHECKBOX / RADIO ==================== */
.check, .radio { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-family: var(--font-body); font-size: var(--fs-body); }
.check input, .radio input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--ink); background: var(--paper); cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); flex-shrink: 0; }
.check input { border-radius: var(--radius-1); }
.radio input { border-radius: 50%; }
.check input:checked { background: var(--ink); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23F5EFE0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M3 8.5l3.5 3.5L13 4.5'/></svg>"); background-repeat: no-repeat; background-position: center; }
.radio input:checked { background: var(--paper); border-width: 5px; border-color: var(--ink); }
.check input:focus-visible, .radio input:focus-visible { box-shadow: var(--shadow-focus); }

/* ==================== SWITCH ==================== */
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-family: var(--font-body); font-size: var(--fs-body); }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; background: var(--ink-subtle); border: 1.5px solid var(--ink); border-radius: var(--radius-pill); position: relative; cursor: pointer; transition: background var(--dur-2) var(--ease); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; background: var(--paper); border-radius: 50%; transition: transform var(--dur-2) var(--ease); }
.switch input:checked { background: var(--terracotta); border-color: var(--terracotta); }
.switch input:checked::after { transform: translateX(18px); }

/* ==================== BADGE / TAG / KICKER ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: var(--fw-medium);
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: var(--radius-2);
  background: var(--ink); color: var(--paper);
  line-height: 1.2;
}
.badge--partner { background: var(--sepia); color: var(--paper); }
.badge--source  { background: transparent; color: var(--fg-muted); border: 1px solid var(--ink-subtle); }
.badge--ok      { background: var(--forest); color: var(--paper); }
.badge--warn    { background: var(--sepia); color: var(--paper); }
.badge--risk    { background: var(--terracotta); color: var(--paper); }

.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-body); font-size: var(--fs-caption);
  padding: 2px 10px; border-radius: var(--radius-2);
  background: var(--paper-ridge); color: var(--fg-soft);
  border: 1px solid var(--ink-faint);
}

.kicker {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-micro); font-weight: var(--fw-medium);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--profile-color, var(--terracotta));
  margin-bottom: var(--sp-2);
}

/* ==================== SOURCE-CITE ==================== */
.source-cite {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-style: italic;
  color: var(--fg-muted);
  display: inline-flex; align-items: baseline; gap: 4px;
}
.source-cite::before { content: "—"; color: var(--ink-subtle); margin-right: 2px; font-style: normal; }
.source-cite__org { font-style: normal; font-weight: var(--fw-medium); color: var(--fg-soft); }

/* ==================== PROFILE-PILL ==================== */
.profile-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display); font-weight: var(--fw-semi);
  font-size: var(--fs-body);
  padding: 8px 16px;
  background: var(--paper);
  border: 1.5px solid var(--ink-subtle);
  border-radius: var(--radius-pill);
  color: var(--fg);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  white-space: nowrap;
}
.profile-pill:hover { border-color: var(--ink); }
.profile-pill__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--profile-color);
  flex-shrink: 0;
}
.profile-pill[aria-selected="true"] {
  background: var(--profile-wash);
  border-color: var(--profile-color);
  color: var(--profile-color);
}
[data-profile="investisseur"] .profile-pill[aria-selected="true"] { color: var(--ink); border-color: var(--ink); background: var(--paper-ridge); }

/* ==================== SCORE-BAR ==================== */
.score-bar { display: grid; gap: var(--sp-2); font-family: var(--font-body); }
.score-bar__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.score-bar__label { font-size: var(--fs-caption); color: var(--fg-soft); }
.score-bar__value { font-family: var(--font-display); font-weight: var(--fw-semi); font-size: var(--fs-h2); color: var(--fg); font-variant-numeric: tabular-nums; line-height: 1; }
.score-bar__value sub { font-size: 0.45em; color: var(--fg-muted); margin-left: 2px; vertical-align: baseline; }
.score-bar__track { height: 6px; background: var(--paper-ridge); border-radius: 0; position: relative; overflow: hidden; }
.score-bar__fill  { height: 100%; background: var(--profile-color, var(--terracotta)); }

/* ==================== DIVIDER / SEPARATOR / FLEURON ==================== */
.divider { border: 0; border-top: var(--border-regular); margin: var(--sp-8) 0; }
.divider--fine { border-top: var(--border-fine); margin: var(--sp-6) 0; }

.fleuron {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  margin: var(--sp-12) 0;
  color: var(--sepia);
}
.fleuron::before, .fleuron::after { content: ""; flex: 1; border-top: var(--border-fine); }
.fleuron__mark { font-family: var(--font-display); font-size: 22px; line-height: 1; }

/* ==================== PICTOGRAM WRAPPER ==================== */
.pictogram {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  flex-shrink: 0;
}
.pictogram svg { width: 100%; height: 100%; display: block; }
.pictogram--16 { width: 16px; height: 16px; }
.pictogram--20 { width: 20px; height: 20px; }
.pictogram--24 { width: 24px; height: 24px; }
.pictogram--32 { width: 32px; height: 32px; }
.pictogram--48 { width: 48px; height: 48px; }
.pictogram--96 { width: 96px; height: 96px; }
.pictogram--128 { width: 128px; height: 128px; }

/* line-only mode hides watercolor wash inside SVG */
.pictogram--line-only svg [fill]:not([fill="none"]):not([fill="currentColor"]) { opacity: 0 !important; }

/* ==================== CARD ==================== */
.card {
  background: var(--paper);
  border: var(--border-regular);
  border-radius: var(--radius-0);
  padding: var(--sp-6);
  display: grid; gap: var(--sp-3);
}
.card--ridge { background: var(--paper-ridge); }
.card--shadow { box-shadow: var(--shadow-1); }

/* ==================== ENCART-EDITORIAL ==================== */
.encart-editorial {
  display: grid; gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-6);
  border-top: var(--border-strong);
  border-bottom: var(--border-fine);
  background: var(--paper);
}
.encart-editorial__kicker  { color: var(--profile-color, var(--terracotta)); font-family: var(--font-body); font-size: var(--fs-micro); font-weight: var(--fw-medium); letter-spacing: 0.1em; text-transform: uppercase; }
.encart-editorial__head    { font-family: var(--font-display); font-size: var(--fs-display-m); font-weight: var(--fw-semi); line-height: 1.12; letter-spacing: -0.01em; margin: 0; max-width: 28ch; text-wrap: balance; }
.encart-editorial__sub     { font-family: var(--font-display); font-size: var(--fs-h3); font-style: italic; font-weight: var(--fw-regular); color: var(--fg-soft); margin: 0; max-width: 48ch; }
.encart-editorial__body    { font-family: var(--font-body); font-size: var(--fs-body-l); line-height: 1.65; max-width: var(--measure); margin: 0; }

/* ==================== DL-STAT-GRID ==================== */
.dl-stat-grid {
  display: grid; gap: var(--sp-6);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0;
}
.dl-stat-grid__cell { display: grid; gap: var(--sp-1); border-top: var(--border-fine); padding-top: var(--sp-3); }
.dl-stat-grid dt {
  font-family: var(--font-body); font-size: var(--fs-caption); color: var(--fg-muted);
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: var(--fw-medium);
}
.dl-stat-grid dd { margin: 0; }
.dl-stat-grid__val {
  font-family: var(--font-display); font-weight: var(--fw-semi);
  font-size: var(--fs-h1); line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  display: block;
}
.dl-stat-grid__unit { font-size: 0.6em; font-weight: var(--fw-regular); color: var(--fg-soft); margin-left: 4px; }
.dl-stat-grid__cite { display: block; margin-top: var(--sp-1); }

/* Investisseur — chiffres encore plus gros */
[data-profile="investisseur"] .dl-stat-grid__val { font-size: clamp(40px, 4vw, 56px); }

/* ==================== PROFILE-PANEL ==================== */
.profile-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-8);
  padding: var(--sp-8);
  background: var(--paper);
  border: var(--border-regular);
  border-left: 4px solid var(--profile-color);
}
@media (min-width: 768px) {
  .profile-panel { grid-template-columns: 1.1fr 1fr; align-items: center; }
}
.profile-panel__copy   { display: grid; gap: var(--sp-3); }
.profile-panel__head   { font-family: var(--font-display); font-size: var(--fs-display-m); font-weight: var(--fw-semi); line-height: 1.1; letter-spacing: -0.01em; max-width: 18ch; text-wrap: balance; margin: 0; }
.profile-panel__sub    { font-family: var(--font-display); font-style: italic; font-size: var(--fs-h3); color: var(--fg-soft); margin: 0; }
.profile-panel__body   { font-family: var(--font-body); font-size: var(--fs-body-l); line-height: 1.65; max-width: 56ch; margin: 0; }
.profile-panel__art    { background: var(--paper-warm); border: var(--border-fine); aspect-ratio: 16/9; overflow: hidden; }
.profile-panel__art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ==================== SOURCE-LINE ==================== */
.source-line {
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6);
  padding-top: var(--sp-3);
  border-top: var(--border-fine);
  font-family: var(--font-body); font-size: var(--fs-caption); font-style: italic;
  color: var(--fg-muted);
}
.source-line__item { display: inline-flex; gap: 4px; }
.source-line__item strong { font-style: normal; font-weight: var(--fw-medium); color: var(--fg-soft); }

/* ==================== CTA-CARD (anti-bias rule §5.6) ==================== */
.cta-card {
  display: grid; gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--paper-warm);
  border: 1.5px dashed var(--sepia);
  border-radius: var(--radius-3);
  position: relative;
}
.cta-card__badge {
  position: absolute; top: -10px; left: var(--sp-4);
  background: var(--sepia); color: var(--paper);
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: var(--fw-medium);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-2);
}
.cta-card__head    { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: var(--fw-semi); margin: 0; max-width: 26ch; }
.cta-card__sub     { font-family: var(--font-body); font-size: var(--fs-body); color: var(--fg-soft); margin: 0; max-width: 48ch; }
.cta-card__action  {
  align-self: start; margin-top: var(--sp-2);
  font-family: var(--font-body); font-weight: var(--fw-medium);
  color: var(--sepia-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.cta-card__action::after { content: " →"; }

/* Insight (niveau 2) — pas un CTA, ton informatif */
.insight {
  padding: var(--sp-4) var(--sp-6);
  background: var(--paper-ridge);
  border-left: 3px solid var(--sepia);
  font-family: var(--font-body); font-size: var(--fs-body);
}
.insight__kicker { font-family: var(--font-body); font-size: var(--fs-micro); font-weight: var(--fw-medium); letter-spacing: 0.08em; text-transform: uppercase; color: var(--sepia-deep); display: block; margin-bottom: var(--sp-1); }

/* ==================== EXPAT — overlay components ==================== */
.expat-banner {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-6);
  background: var(--sepia-wash);
  border-bottom: 1px solid var(--sepia);
  font-family: var(--font-body); font-size: var(--fs-caption);
  color: var(--ink);
}
.expat-banner__label {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-size: var(--fs-micro); font-weight: var(--fw-medium);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sepia-deep);
  white-space: nowrap;
}
.expat-banner__label::before { content: ""; width: 8px; height: 8px; background: var(--sepia); border-radius: 50%; }
.expat-banner__copy  { flex: 1; font-style: italic; }
.expat-banner__close { background: transparent; border: 0; cursor: pointer; color: var(--ink-muted); font-size: 20px; padding: 4px; line-height: 1; }
.expat-banner__close:hover { color: var(--ink); }

.expat-tile-set {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: var(--sp-6);
  background: var(--paper);
  border: 1px solid var(--sepia);
  border-radius: var(--radius-2);
}
.expat-tile-set__head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.expat-tile-set__head h3 { margin: 0; font-size: var(--fs-h3); }
.expat-tile-set__head em { font-family: var(--font-body); font-style: italic; color: var(--sepia-deep); font-size: var(--fs-caption); }

.expat-tile {
  display: grid; gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--sepia-wash);
  border: 1px solid var(--sepia);
  border-radius: var(--radius-2);
}
.expat-tile__title { font-family: var(--font-display); font-size: var(--fs-body-l); font-weight: var(--fw-semi); margin: 0; }
.expat-tile__sub   { font-family: var(--font-body); font-size: var(--fs-caption); color: var(--fg-soft); font-style: italic; margin: 0; }

.expat-cta-pack { /* extends cta-card */
  background: var(--sepia-wash);
  border-color: var(--sepia);
  border-style: solid;
}
.expat-cta-pack .cta-card__badge { background: var(--sepia-deep); }
.expat-cta-pack .cta-card__action { color: var(--sepia-deep); }

/* ==================== FOOTER-CREDIT ==================== */
.footer-credit {
  display: grid; gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-6);
  border-top: var(--border-strong);
  background: var(--paper);
  font-family: var(--font-body); font-size: var(--fs-caption);
  color: var(--fg-muted);
}
.footer-credit__row { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: baseline; justify-content: space-between; }
.footer-credit__forge {
  display: inline-flex; align-items: center; gap: 6px;
  font-style: italic;
}
.footer-credit__forge::before {
  content: "";
  width: 14px; height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1 L11 4 L13 3 L13 6 L15 8 L13 10 L13 13 L11 12 L8 15 L5 12 L3 13 L3 10 L1 8 L3 6 L3 3 L5 4 Z' fill='black'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1 L11 4 L13 3 L13 6 L15 8 L13 10 L13 13 L11 12 L8 15 L5 12 L3 13 L3 10 L1 8 L3 6 L3 3 L5 4 Z' fill='black'/></svg>") no-repeat center / contain;
}
.footer-credit nav { display: inline-flex; gap: var(--sp-4); flex-wrap: wrap; }

/* ==================== LOGO LOCKUP ==================== */
.logo {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  font-family: var(--font-display);
  text-decoration: none; color: var(--ink);
  line-height: 1;
}
.logo__wordmark {
  font-size: 22px; font-weight: var(--fw-semi);
  letter-spacing: -0.01em;
  position: relative;
  display: inline-block;
}
.logo__wordmark::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -6px;
  height: 6px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'><path d='M2 7 C 30 3, 60 11, 100 6 S 170 2, 198 8' stroke='%23C4582D' stroke-width='2.4' fill='none' stroke-linecap='round'/></svg>") no-repeat center / 100% 100%;
}
.logo__fleuron {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.5em;
  color: var(--sepia);
  vertical-align: super;
}
.logo--lg .logo__wordmark { font-size: 32px; }

/* ==================== UTILITIES ==================== */
.stack { display: grid; }
.stack > * + * { margin-top: var(--sp-4); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.stack-8 > * + * { margin-top: var(--sp-8); }

.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.cluster--tight { gap: var(--sp-2); }
.cluster--loose { gap: var(--sp-4); }

.measure { max-width: var(--measure); }
.page-wrap { max-width: var(--w-page); margin-inline: auto; padding-inline: var(--sp-6); }
.page-wrap--narrow { max-width: var(--w-narrow); }
.page-wrap--wide   { max-width: var(--w-wide); }

/* ==================== PRINT ==================== */
@media print {
  :root { --bg: #fff; --paper: #fff; --paper-warm: #fff; --paper-ridge: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.45; }
  h1 { font-size: 22pt; }
  h2 { font-size: 16pt; }
  h3 { font-size: 13pt; }
  .btn, .switch, .check, .radio, nav, .expat-banner__close { display: none !important; }
  .cta-card, .expat-cta-pack { display: none !important; }
  .card, .encart-editorial, .profile-panel, .expat-tile-set { box-shadow: none; border: 1px solid #000; break-inside: avoid; }
  .dim, .profile-panel { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .source-cite { color: #000; }
  .fleuron { display: none; }
  @page { size: A4; margin: 18mm; }
}
