/*
 * AffiliaOS design system — shared by the fifteen themes (cahier des charges v2).
 * Each theme sets its brand tokens on :root; components only use the tokens.
 * Readability floor: body 17px, small text never below 13px.
 */
:root {
  --ds-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ds-font-display: var(--ds-font);
  --ds-brand: #1d4ed8;
  --ds-brand-strong: #1e40af;
  --ds-brand-contrast: #fff;
  --ds-ink: #0b1220;
  --ds-ink-text: #e8eefc;
  --ds-ink-muted: #a9b6d3;
  --ds-accent: #38bdf8;
  --ds-bg: #fff;
  --ds-surface: #f6f8fc;
  --ds-text: #101828;
  --ds-muted: #475467;
  --ds-border: #e2e8f0;
  --ds-radius: 14px;
  --ds-radius-lg: 22px;
  --ds-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 6%);
  --ds-container: 1200px;
  --ds-gutter: clamp(16px, 4vw, 32px);
}

.ds, .ds-header, .ds-footer { font-family: var(--ds-font); color: var(--ds-text); font-size: 1.0625rem; line-height: 1.65; -webkit-font-smoothing: antialiased; }
.ds { background: var(--ds-bg); }
/* WordPress adds a block gap between header, main and footer; full-bleed sections must touch. */
.wp-site-blocks:has(.ds-header) > * { margin-block-start: 0; }
.ds *, .ds-header *, .ds-footer * { box-sizing: border-box; }
.ds :where(h1, h2, h3, h4), .ds-footer :where(h2, h3) { font-family: var(--ds-font-display); color: inherit; letter-spacing: -0.02em; margin: 0; }
.ds :where(p) { margin: 0; }
.ds a { color: var(--ds-brand); }
.ds img { display: block; max-width: 100%; height: auto; }

.ds-container { width: 100%; max-width: calc(var(--ds-container) + 2 * var(--ds-gutter)); margin: 0 auto; padding: 0 var(--ds-gutter); }
.ds-section { padding: clamp(48px, 7vw, 88px) 0; }
.ds-section--tint { background: var(--ds-surface); }
.ds-section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: clamp(24px, 3vw, 36px); }
.ds-section-head h2 { font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.25rem); line-height: 1.2; }
.ds-section-head p { color: var(--ds-muted); max-width: 640px; margin-top: 8px; }
.ds-eyebrow { display: inline-block; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ds-brand); margin-bottom: 12px; }
.ds-link { font-weight: 650; text-decoration: none; white-space: nowrap; }
.ds-link:hover { text-decoration: underline; }

/* Buttons */
.ds-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: 1rem; text-decoration: none; border: 2px solid transparent; transition: background .15s, border-color .15s, color .15s; }
.ds-btn--primary { background: var(--ds-brand); color: var(--ds-brand-contrast) !important; }
.ds-btn--primary:hover { background: var(--ds-brand-strong); }
.ds-btn--ghost { border-color: currentColor; color: inherit !important; }
.ds-btn--ghost:hover { background: rgb(255 255 255 / 8%); }
.ds a:focus-visible, .ds-header a:focus-visible, .ds-footer a:focus-visible, .ds-btn:focus-visible { outline: 3px solid var(--ds-accent); outline-offset: 3px; }

/* Header */
.ds-header { background: var(--ds-ink); color: var(--ds-ink-text); position: relative; z-index: 20; }
.ds-header a { color: inherit; text-decoration: none; }
.ds-header__bar { display: flex; align-items: center; gap: 20px; min-height: 72px; }
.ds-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--ds-font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; white-space: nowrap; }
.ds-brand__mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ds-brand); color: var(--ds-brand-contrast); font-size: 1rem; }
.ds-brand__accent { color: var(--ds-accent); }
.ds-header .wp-block-search, .ds-header form[role="search"] { flex: 1 1 320px; max-width: 460px; margin: 0 0 0 auto; }
.ds-header .wp-block-search__inside-wrapper { display: flex; border: 1px solid rgb(255 255 255 / 18%); border-radius: 999px; background: rgb(255 255 255 / 6%); padding: 4px 4px 4px 16px; }
.ds-header .wp-block-search__input, .ds-header input[type="search"] { flex: 1; min-width: 0; background: transparent; border: 0; color: inherit; font: inherit; font-size: .9375rem; padding: 8px 0; outline: none; }
.ds-header .wp-block-search__input::placeholder, .ds-header input[type="search"]::placeholder { color: var(--ds-ink-muted); }
.ds-header .wp-block-search__button, .ds-header form[role="search"] button { background: var(--ds-brand); color: var(--ds-brand-contrast); border: 0; border-radius: 999px; min-width: 40px; height: 40px; padding: 0 12px; cursor: pointer; }
.ds-header .wp-block-search__button svg { fill: currentColor; }
.ds-header__tools { display: flex; align-items: center; gap: 10px; }
.ds-header .affiliaos-language-switcher summary { font-size: .875rem; border-color: rgb(255 255 255 / 30%); }
.ds-header .affiliaos-language-options small { font-size: .8125rem; }
.ds-nav { border-top: 1px solid rgb(255 255 255 / 10%); }
.ds-nav__list { display: flex; flex-wrap: wrap; gap: 4px 28px; list-style: none; }
.ds-nav p { margin: 0; }
.ds-nav a { display: inline-block; padding: 14px 0; font-size: .9375rem; font-weight: 600; color: var(--ds-ink-muted); border-bottom: 2px solid transparent; }
.ds-nav a:hover, .ds-nav a[aria-current="page"] { color: var(--ds-ink-text); border-bottom-color: var(--ds-accent); }

/* Hero */
.ds-hero { background: var(--ds-ink); color: var(--ds-ink-text); overflow: hidden; }
.ds-hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(28px, 5vw, 64px); align-items: center; padding-block: clamp(44px, 7vw, 96px); }
.ds-hero .ds-eyebrow { color: var(--ds-accent); }
.ds-hero h1 { font-size: clamp(2.375rem, 1.4rem + 3.4vw, 3.75rem); line-height: 1.06; color: #fff; }
.ds-hero__lead { font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem); color: var(--ds-ink-muted); margin-top: 20px; max-width: 560px; }
.ds-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.ds-hero__media img { border-radius: var(--ds-radius-lg); box-shadow: 0 24px 60px rgb(0 0 0 / 35%); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.ds-trust { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 28px 0 0; padding: 0; list-style: none; font-size: .9375rem; color: var(--ds-ink-text); }
.ds-trust li { display: inline-flex; align-items: center; gap: 8px; }
.ds-trust li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--ds-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%23001' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; flex: none; }
.ds-disclosure { font-size: .875rem; color: var(--ds-ink-muted); margin-top: 20px; }
.ds-disclosure a { color: inherit; text-decoration: underline; }
/* Light hero for sites with a bright identity; the header and footer stay on --ds-ink. */
.ds-hero--light { background: var(--ds-hero-bg, var(--ds-surface)); color: var(--ds-text); }
.ds-hero--light h1 { color: var(--ds-text); }
.ds-hero--light .ds-eyebrow { color: var(--ds-brand); }
.ds-hero--light .ds-hero__lead, .ds-hero--light .ds-disclosure { color: var(--ds-muted); }
.ds-hero--light .ds-trust { color: var(--ds-text); }
.ds-hero--light .ds-btn--ghost { color: var(--ds-text) !important; }
.ds-hero--light .ds-btn--ghost:hover { background: rgb(0 0 0 / 5%); }
.ds-hero--light .ds-hero__media img { box-shadow: var(--ds-shadow); }

/* Grids and cards */
.ds-grid { display: grid; gap: clamp(16px, 2vw, 24px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.ds-grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.ds-card { display: flex; flex-direction: column; background: var(--ds-bg); border: 1px solid var(--ds-border); border-radius: var(--ds-radius); overflow: hidden; color: var(--ds-text) !important; text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ds-card:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow); border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-border)); }
.ds-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; background: var(--ds-surface); }
.ds-card__body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 24px; flex: 1; }
.ds-card__tag { font-size: .8125rem; font-weight: 700; color: var(--ds-brand); text-transform: uppercase; letter-spacing: .06em; }
.ds-card h3 { font-size: 1.1875rem; line-height: 1.35; }
.ds-card p { color: var(--ds-muted); font-size: 1rem; }
.ds-pick { padding: 24px; gap: 10px; }
.ds-pick__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: color-mix(in srgb, var(--ds-brand) 12%, transparent); color: var(--ds-brand); font-size: 1.375rem; margin-bottom: 6px; }
.ds-pick h3 { font-size: 1.1875rem; }
.ds-pick .ds-link { margin-top: auto; padding-top: 8px; color: var(--ds-brand); }

/* Feature */
.ds-feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; background: var(--ds-bg); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); padding: clamp(20px, 3vw, 36px); box-shadow: var(--ds-shadow); }
.ds-feature img { border-radius: var(--ds-radius); aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.ds-feature h2 { font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.125rem); line-height: 1.2; margin-bottom: 14px; }
.ds-feature > div > p { color: var(--ds-muted); }
.ds-checklist { list-style: none; padding: 0; margin: 20px 0 28px; display: grid; gap: 10px; }
.ds-checklist li { display: flex; gap: 10px; }
.ds-checklist li::before { content: "✓"; color: var(--ds-brand); font-weight: 800; }

/* Comparison table */
.ds-table-wrap { overflow-x: auto; border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-bg); }
.ds-table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: 1rem; }
.ds-table th, .ds-table td { text-align: left; padding: 16px 20px; border-bottom: 1px solid var(--ds-border); vertical-align: top; }
.ds-table thead th { background: var(--ds-surface); font-size: .875rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ds-muted); }
.ds-table tbody th { font-weight: 700; white-space: nowrap; }
.ds-table tbody tr:last-child > * { border-bottom: 0; }
.ds-table td a { font-weight: 650; }
.ds-note { font-size: .875rem; color: var(--ds-muted); margin-top: 12px; }

/* Steps */
.ds-steps { counter-reset: step; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); list-style: none; padding: 0; margin: 0; }
.ds-steps li { counter-increment: step; background: var(--ds-bg); border: 1px solid var(--ds-border); border-radius: var(--ds-radius); padding: 24px; }
.ds-steps li::before { content: counter(step, decimal-leading-zero); display: block; font-weight: 800; font-size: .9375rem; color: var(--ds-brand); margin-bottom: 10px; }
.ds-steps h3 { font-size: 1.125rem; margin-bottom: 6px; }
.ds-steps p { color: var(--ds-muted); font-size: 1rem; }

/* Topic chips */
.ds-chips { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; padding: 0; margin: 0; }
.ds-chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--ds-border); background: var(--ds-bg); color: var(--ds-text); font-weight: 650; text-decoration: none; }
.ds-chips a:hover { border-color: var(--ds-brand); color: var(--ds-brand); }

/* Footer */
.ds-footer { background: var(--ds-ink); color: var(--ds-ink-muted); padding: clamp(48px, 6vw, 72px) 0 24px; font-size: 1rem; }
.ds-footer a { color: var(--ds-ink-text); text-decoration: none; }
.ds-footer a:hover { text-decoration: underline; }
.ds-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.ds-footer h2 { font-size: 1.25rem; color: #fff; margin-bottom: 12px; }
.ds-footer h3 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ds-ink-text); margin-bottom: 14px; }
.ds-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ds-footer p { margin: 0; max-width: 360px; }
.ds-footer__bottom { border-top: 1px solid rgb(255 255 255 / 10%); margin-top: 40px; padding-top: 20px; font-size: .875rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.ds-footer .ds-footer__bottom p { max-width: none; }
.ds-footer .affiliaos-information-links { justify-content: flex-start; padding: 0; border: 0; margin: 0; gap: 8px 20px; font-size: .875rem; }
.ds-footer .affiliaos-information-links a { padding: 0; color: var(--ds-ink-muted); text-decoration: none; }

/* Comparison tables inside articles (Gutenberg wp-block-table markup).
   Colours derive from the article's own text colour so tables read on light and dark themes. */
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table { margin: 32px 0; overflow-x: auto; }
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-family: var(--ds-font); font-size: 1rem; line-height: 1.5; color: inherit; background: color-mix(in srgb, currentColor 3%, transparent); border: 1px solid color-mix(in srgb, currentColor 20%, transparent); border-radius: var(--ds-radius); }
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table th,
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table td { padding: 12px 16px; border: 0; border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent); color: inherit; text-align: left; vertical-align: top; }
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table thead th { background: color-mix(in srgb, currentColor 8%, transparent); font-size: .8125rem; letter-spacing: .05em; text-transform: uppercase; opacity: .85; }
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table tbody tr:last-child > * { border-bottom: 0; }
.wp-site-blocks:has(.ds-header) .affiliaos-article-shell .wp-block-table figcaption { margin-top: 10px; font-size: .875rem; color: inherit; opacity: .75; }

/* Archive pages */
.wp-site-blocks:has(.ds-header) .affiliaos-archive-shell { font-family: var(--ds-font); color: var(--ds-text); }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-shell .wp-block-query-title { font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem); letter-spacing: -0.02em; margin-bottom: 28px; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card { display: flex; flex-direction: column; gap: 8px; height: 100%; border: 1px solid var(--ds-border); border-radius: var(--ds-radius); overflow: hidden; background: var(--ds-bg); padding-bottom: 22px; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card > * { margin: 0 !important; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card > :not(.wp-block-post-featured-image) { padding-inline: 22px; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-featured-image { margin-bottom: 10px !important; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-terms { font-size: .8125rem !important; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-terms a { color: var(--ds-brand); text-decoration: none; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-title { font-size: 1.25rem !important; line-height: 1.35; letter-spacing: -0.01em; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-title a { color: var(--ds-text); text-decoration: none; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-excerpt { color: var(--ds-muted); font-size: 1rem; }
.wp-site-blocks:has(.ds-header) .affiliaos-archive-card .wp-block-post-excerpt__more-link { font-weight: 650; color: var(--ds-brand); }

@media (max-width: 960px) {
  .ds-hero__grid, .ds-feature { grid-template-columns: 1fr; }
  .ds-hero__media { order: -1; }
  .ds-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 781px) {
  .ds-header__bar { flex-wrap: wrap; min-height: 64px; padding-block: 10px; gap: 12px; }
  .ds-header .wp-block-search, .ds-header form[role="search"] { order: 3; flex-basis: 100%; max-width: none; margin: 0 0 6px; }
  .ds-header__tools { margin-left: auto; }
  .ds-nav__list { flex-direction: column; gap: 0; padding-block: 4px 12px; }
  .ds-nav a { padding: 12px 0; display: block; }
  body .ds-nav.affiliaos-mobile-nav.is-open { padding-inline: var(--ds-gutter); padding-bottom: 16px; }
  body .ds-nav.affiliaos-mobile-nav.is-open p { border-bottom-color: rgb(255 255 255 / 10%); }
  .ds-footer__grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* Comparison tables become stacked cards; cells carry their column name in data-label. */
  .ds-table-wrap { overflow: visible; }
  .ds-table { min-width: 0; }
  .ds-table thead { display: none; }
  .ds-table, .ds-table tbody, .ds-table tr, .ds-table th, .ds-table td { display: block; }
  .ds-table tr { padding: 14px 0; border-bottom: 1px solid var(--ds-border); }
  .ds-table tbody tr:last-child { border-bottom: 0; }
  .ds-table th, .ds-table td { border: 0; padding: 6px 18px; }
  .ds-table tbody th { font-size: 1.125rem; white-space: normal; }
  .ds-table td[data-label]::before { content: attr(data-label); display: block; font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ds-muted); }
}
@media (prefers-reduced-motion: reduce) { .ds-card, .ds-btn { transition: none; } .ds-card:hover { transform: none; } }
