/* ==========================================================================
   Gérer son bien immo, feuille de style principale
   Mobile-first, sans dépendance externe.
   ========================================================================== */

:root {
  --color-bg: #f7f5f1;
  --color-surface: #ffffff;
  --color-text: #1f2530;
  --color-text-muted: #565f6d;
  --color-border: #e3ddd2;
  --color-primary: #1c3b57;
  --color-primary-dark: #122740;
  --color-accent: #2f8f6e;
  --color-accent-dark: #236d54;
  --color-warning-bg: #fdf3e3;
  --color-warning-border: #e8c27a;
  --color-info-bg: #eaf2f6;
  --color-info-border: #9dc2d6;

  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;

  --shadow-card: 0 1px 3px rgba(20, 30, 40, 0.08), 0 1px 2px rgba(20, 30, 40, 0.06);
  --shadow-elevated: 0 10px 30px rgba(20, 30, 40, 0.12);

  --container-max: 1120px;
  --content-max: 760px;
}

/* ----- Reset ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  font-size: 1.0625rem;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--color-accent-dark);
}

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--color-primary-dark);
  font-weight: 700;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.15rem + 1vw, 1.75rem); margin-top: 2em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }

p { margin: 0 0 1.1em; }

ul, ol {
  margin: 0 0 1.1em;
  padding-left: 1.3em;
}

li + li { margin-top: 0.4em; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5em;
}

th, td {
  text-align: left;
  padding: 0.65em 0.75em;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

thead th {
  background: var(--color-primary);
  color: #fff;
}

tbody tr:nth-child(even) {
  background: rgba(28, 59, 87, 0.03);
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-s);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5em;
}

.table-scroll table {
  margin-bottom: 0;
}

code {
  background: rgba(28, 59, 87, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5em 0;
}

/* ----- Utilities ----- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.content {
  max-width: var(--content-max);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.6em 1em;
  border-radius: var(--radius-s);
  z-index: 1000;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ----- Header & navigation ----- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.9rem;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.1;
}

.brand__name {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-primary-dark);
}

.brand__tagline {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-s);
  padding: 0.5em 0.8em;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary-dark);
  cursor: pointer;
}

.nav-toggle__icon {
  width: 20px;
  height: 14px;
  position: relative;
}

.nav-toggle__icon span,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav-toggle__icon::before { top: 0; }
.nav-toggle__icon span { top: 6px; }
.nav-toggle__icon::after { top: 12px; }

.site-nav {
  display: none;
  border-top: 1px solid var(--color-border);
}

.site-nav.is-open {
  display: block;
}

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.site-nav__list li {
  margin-top: 0;
}

.site-nav__list a {
  display: block;
  padding: 0.6em 0.25em;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  border-radius: var(--radius-s);
  border-bottom: 2px solid transparent;
  line-height: 1.2;
}

.site-nav__list a:hover,
.site-nav__list a[aria-current="page"] {
  color: var(--color-accent-dark);
  background: rgba(47, 143, 110, 0.08);
  border-bottom-color: var(--color-accent);
}

@media (min-width: 800px) {
  .nav-toggle { display: none; }

  .site-nav {
    display: block;
    border-top: none;
  }

  .site-nav__list {
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
  }

  .site-nav__list a {
    padding: 0.5em 0.7em;
  }
}

/* ----- Hero ----- */
.hero {
  background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding-block: 3.5rem;
}

.hero h1 {
  color: #fff;
  max-width: 20ch;
}

.hero__lead {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.1rem;
  max-width: 62ch;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ----- Page header (internal pages) ----- */
.page-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding-block: 2.4rem;
}

.page-header h1 {
  max-width: 26ch;
}

.page-header__lead {
  color: var(--color-text-muted);
  font-size: 1.08rem;
  max-width: 68ch;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
}

/* ----- Breadcrumb ----- */
.breadcrumb {
  padding-block: 0.9rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  margin-top: 0;
}

.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 0.5em;
  color: var(--color-border);
}

.breadcrumb li[aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
}

/* ----- Main / sections ----- */
main {
  display: block;
}

.section {
  padding-block: 3rem;
}

.section--tight {
  padding-block: 2rem;
}

.section--alt {
  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
}

.section-heading {
  max-width: 62ch;
  margin-bottom: 2rem;
}

.section-heading h2 {
  margin-top: 0;
}

.section-heading p {
  color: var(--color-text-muted);
}

/* ----- Article layout ----- */
.article-layout {
  display: grid;
  gap: 2.5rem;
  padding-block: 2.5rem 4rem;
}

.article-body h2:first-of-type { margin-top: 0; }

.article-body {
  max-width: var(--content-max);
}

.toc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-m);
  padding: 1.1rem 1.3rem;
  margin-bottom: 2rem;
  max-width: var(--content-max);
}

.toc summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--color-primary-dark);
}

.toc ol {
  margin: 0.9rem 0 0;
  padding-left: 1.2em;
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

.callout {
  border-radius: var(--radius-m);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
  border: 1px solid var(--color-info-border);
  background: var(--color-info-bg);
}

.callout p:last-child { margin-bottom: 0; }

.callout--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
}

.callout__title {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 700;
  margin-bottom: 0.4em;
  color: var(--color-primary-dark);
}

.key-points {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-m);
  padding: 1.2rem 1.4rem;
  margin: 1.8rem 0;
}

.key-points h2,
.key-points h3 {
  margin-top: 0;
}

.key-points ul {
  margin-bottom: 0;
}

/* ----- FAQ ----- */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-m);
  background: var(--color-surface);
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  color: var(--color-accent-dark);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item__body {
  padding: 0 1.2rem 1.1rem;
  color: var(--color-text-muted);
}

.faq-item__body p:last-child { margin-bottom: 0; }

/* ----- Sources ----- */
.sources {
  max-width: var(--content-max);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-m);
  padding: 1.3rem 1.5rem;
  margin-top: 2.5rem;
}

.sources h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.sources ul {
  margin-bottom: 0;
  padding-left: 1.1em;
  font-size: 0.92rem;
}

.sources li { color: var(--color-text-muted); }

/* ----- Cards (homepage articles grid) ----- */
.card-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .card-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-l);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elevated);
}

.card__icon {
  width: 42px;
  height: 42px;
  color: var(--color-accent-dark);
  margin-bottom: 0.9rem;
}

.card h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.card p {
  color: var(--color-text-muted);
  flex-grow: 1;
}

.card__link {
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.8rem;
}

.card__link::after {
  content: "→";
  transition: transform 0.15s ease;
}

.card:hover .card__link::after {
  transform: translateX(3px);
}

/* ----- Related articles ----- */
.related {
  border-top: 1px solid var(--color-border);
  padding-top: 2rem;
  margin-top: 3rem;
}

/* ----- Two-column intro (homepage) ----- */
.split {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 860px) {
  .split--reverse { direction: rtl; }
  .split--reverse > * { direction: ltr; }
  .split { grid-template-columns: 1.1fr 0.9fr; }
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-m);
  padding: 1rem 1.2rem;
}

.stat strong {
  display: block;
  font-size: 1.4rem;
  color: var(--color-primary-dark);
}

.stat span {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.4em;
  border-radius: var(--radius-s);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.98rem;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-accent-dark);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ----- Footer ----- */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.85);
  padding-block: 2.6rem 2rem;
  margin-top: 3rem;
}

.site-footer a {
  color: #fff;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; }
}

.footer-grid h2 {
  color: #fff;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.9rem;
}

.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-grid li { margin-top: 0.5em; }

.footer-grid a { text-decoration: none; font-size: 0.92rem; }
.footer-grid a:hover { text-decoration: underline; }

.footer-note {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  max-width: 60ch;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 2rem;
  padding-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ----- Back to top ----- */
.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  z-index: 90;
}

.back-to-top.is-visible {
  display: flex;
}

.back-to-top:hover {
  background: var(--color-accent-dark);
}

/* ----- Focus states ----- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ----- Print ----- */
@media print {
  .site-header, .back-to-top, .site-footer, .nav-toggle { display: none; }
}
