:root {
  --valor-font-body: aptos, 'Aptos', century-gothic, 'Century Gothic', system-ui, sans-serif;
  --valor-font-heading: century-gothic, 'Century Gothic', aptos, 'Aptos', system-ui, sans-serif;
  /* Shared roles: identical geometry in Light, Dark and Valor. */
  --valor-root-size: 93.75%;
  --valor-size-caption: .8rem;
  --valor-size-secondary: .875rem;
  --valor-size-control: .9rem;
  --valor-size-body: 1rem;
  --valor-size-lead: 1.125rem;
  --valor-size-card-title: 1.2rem;
  --valor-size-subsection-title: 1.35rem;
  --valor-size-section-title: clamp(1.5rem, 1.25rem + .8vw, 1.9rem);
  --valor-size-page-title: clamp(1.8rem, 1.4rem + 1.6vw, 2.5rem);
  --valor-size-display-title: clamp(2rem, 1.5rem + 2.4vw, 3rem);
  --valor-line-body: 1.5;
  --valor-line-control: 1.3;
  --valor-line-heading: 1.2;
  --valor-space-dense: 12px;
  --valor-space-card: 16px;
  --valor-space-grid: 16px;
  --valor-space-layout: 24px;
  --valor-space-section: clamp(24px, 4vw, 48px);
  --valor-field-size: max(1rem, 16px);
  --valor-touch-target: 44px;
  --valor-size-metric: 1.25rem;
  --valor-size-profile-title: clamp(1.6rem, 1.3rem + .9vw, 2rem);
  --valor-line-metric: 1.2;
  --valor-space-metric: 8px;
  --valor-radius-metric: 8px;
  --valor-space-card-compact: 12px;
  --valor-space-section-compact: 24px;
}
body { font-family: var(--valor-font-body); }
h1, h2, h3, h4, h5, h6 { font-family: var(--valor-font-heading); }
button, input, select, textarea { font-family: var(--valor-font-body); }

/* Screen only: printed documents retain their page budgets and typesetting.
   Relative root size preserves the reader's default font setting and zoom. */
@media screen {
  html { font-size: var(--valor-root-size); }
  body { font-size: var(--valor-size-body); line-height: var(--valor-line-body); }
  h1 { font-size: var(--valor-size-page-title); }
  h2 { font-size: var(--valor-size-section-title); }
  h3, h4 { font-size: var(--valor-size-card-title); }
  h1, h2, h3, h4, h5, h6 { line-height: var(--valor-line-heading); }

  /* CV portfolio adapter. The reading panel keeps the same useful width in
     every theme; decoration must never add theme-specific padding. */
  body:has(> .topbar) { --valor-radius-card: 12px; }
  body:has(> .topbar) .topbar { gap: 6px; padding: 6px 16px; }
  body:has(> .topbar) main > section {
    max-width: 1280px;
    padding: var(--valor-space-section-compact) clamp(16px, 2.5vw, 32px);
  }
  body:has(> .topbar) .hero { gap: var(--valor-space-layout); }
  body:has(> .topbar) .hero-text { padding: var(--valor-space-dense); }
  body:has(> .topbar) .hero h1 { font-size: var(--valor-size-page-title); }
  body:has(> .topbar) h2 { font-size: var(--valor-size-section-title); margin-bottom: var(--valor-space-card); }
  body:has(> .topbar) h3.sub { font-size: var(--valor-size-secondary); margin-block: var(--valor-space-layout) var(--valor-space-dense); }
  body:has(> .topbar) :is(.card h3, .card h4, .timeline h3) {
    font-size: var(--valor-size-card-title); min-width: 0;
    overflow-wrap: anywhere; hyphens: auto;
  }
  body:has(> .topbar) :is(.headline, .lead) { font-size: var(--valor-size-lead); }
  body:has(> .topbar) :is(.eyebrow, .tags, .when, .figures span, .note, .site-footer) { font-size: var(--valor-size-secondary); }
  body:has(> .topbar) :is(.topbar nav, .lang, .btn, .chip) { font-size: var(--valor-size-control); line-height: var(--valor-line-control); }
  body:has(> .topbar) :is(.lang, .btn, .chip, .topbar nav a) { min-height: var(--valor-touch-target); }
  body:has(> .topbar) :is(.clarity-settings, .clarity-consent button) {
    min-height: var(--valor-touch-target);
    font-size: var(--valor-size-control);
    line-height: var(--valor-line-control);
  }
  body:has(> .topbar) .topbar nav a { display: inline-flex; align-items: center; }
  body:has(> .topbar) .grid { gap: var(--valor-space-card-compact); }
  body:has(> .topbar) .figures:not(.valor-metrics) { gap: var(--valor-space-grid); }
  body:has(> .topbar) :is(.card, .figures:not(.valor-metrics) li) { padding: var(--valor-space-card-compact); }
  body:has(> .topbar) .card.media { padding: 0; }
  body:has(> .topbar) .card.media > div { padding: var(--valor-space-card-compact); }
  body:has(> .topbar) .figures:not(.valor-metrics) strong { font-size: var(--valor-size-section-title); }
  body:has(> .topbar) .cta { margin-top: var(--valor-space-card); }
  body:has(> .topbar) :is(.btn, .chip) { gap: .5rem; padding-inline: var(--valor-space-dense); }
  body:has(> .topbar) .timeline > li { padding-bottom: 16px; }
  body:has(> .topbar) .timeline ul { margin-block: 8px 0; padding-inline-start: 20px; }
  body:has(> .topbar) :is(.steps li, .timeline li) { overflow-wrap: anywhere; hyphens: auto; }
  body:has(> .topbar) meter { max-width: 100%; min-width: 0; }
  body:has(> .topbar) :is(input, select, textarea) { font-size: var(--valor-field-size); }

  /* Passive facts share one small surface instead of four raised cards.
     No fixed height, truncation or interactive affordance. */
  :root .valor-metrics {
    --valor-metric-ink: var(--valor-primary, var(--blue, #00517a));
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0; padding: 0; margin: 0; list-style: none;
    border: 1px solid color-mix(in srgb, var(--valor-metric-ink) 18%, transparent);
    border-radius: var(--valor-radius-metric);
    background: var(--valor-reading, var(--surface, var(--paper, #fcfdfe)));
  }
  :root .valor-metrics > li {
    display: flex; align-items: center; gap: var(--valor-space-metric);
    min-width: 0; padding: var(--valor-space-metric);
    border: 0; border-inline-end: 1px solid color-mix(in srgb, var(--valor-metric-ink) 18%, transparent);
    border-radius: 0; background: transparent; box-shadow: none;
    transform: none; transition: none;
  }
  :root .valor-metrics > li:last-child { border-inline-end: 0; }
  :root .valor-metrics strong {
    flex: 0 0 auto; font: 700 var(--valor-size-metric)/var(--valor-line-metric) var(--valor-font-body);
    font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--valor-metric-ink);
  }
  :root .valor-metrics span {
    min-width: 0; font-size: var(--valor-size-secondary); line-height: 1.3;
    overflow-wrap: anywhere; hyphens: auto;
  }

  /* The compact CV layout presents identity/actions, facts and detail in that
     reading order. On desktop the detail shares a row with the identity. */
  body:has(> .topbar) .hero--compact {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
    grid-template-areas: 'intro summary' 'metrics metrics';
    align-items: start; gap: 16px 24px;
    margin-top: var(--valor-space-card-compact);
    border-radius: var(--valor-radius-card); background: var(--valor-reading);
  }
  body:has(> .topbar) .hero--compact .hero-text { grid-area: intro; padding: 0; background: transparent; }
  body:has(> .topbar) .hero--compact .hero-summary { grid-area: summary; min-width: 0; }
  body:has(> .topbar) .hero--compact .valor-metrics { grid-area: metrics; }
  body:has(> .topbar) .hero--compact h1 { font-size: var(--valor-size-profile-title); }
  body:has(> .topbar) .hero--compact .eyebrow { margin: 0 0 6px; }
  body:has(> .topbar) .hero--compact .headline { font-size: var(--valor-size-body); margin: 8px 0 12px; }
  body:has(> .topbar) .hero--compact .hero-summary p { margin: 0 0 8px; }
  body:has(> .topbar) .hero--compact .hero-summary p:last-child { margin-bottom: 0; }
  body:has(> .topbar) .hero--compact .cta { gap: 8px; margin: 12px 0 0; }
  body:has(> .topbar) .card p { margin-block: 8px 0; }
  body:has(> .topbar) .expertise-card {
    display: grid; grid-template-columns: 32px minmax(0, 1fr);
    align-content: start; gap: 6px 8px;
  }
  body:has(> .topbar) .expertise-card > .visual-icon {
    width: 32px; height: 32px; padding: 5px; margin: 0;
  }
  body:has(> .topbar) .expertise-card > h3 { align-self: center; margin: 0; }
  body:has(> .topbar) .expertise-card > p { grid-column: 1 / -1; margin: 0; }
  body:has(> .topbar) .card .product-title { gap: 8px; }
  body:has(> .topbar) .card .product-title .visual-icon-large { width: 32px; height: 32px; }
  body:has(> .topbar) .card.media > img {
    width: 100%; height: 160px; object-fit: contain;
    background: var(--valor-bg);
  }
}
@media screen and (max-width: 800px) {
  body:has(> .topbar) .hero--compact {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'intro' 'metrics' 'summary'; gap: 12px;
  }
}
@media screen and (min-width: 1100px) {
  body:has(> .topbar) .grid.two .card.media {
    display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1.65fr);
    align-items: start;
  }
  body:has(> .topbar) .grid.two .card.media > img { height: 128px; }
}
@media screen and (max-width: 680px) {
  :root .valor-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root .valor-metrics > li { display: block; padding: var(--valor-space-metric); }
  :root .valor-metrics > li:nth-child(even) { border-inline-end: 0; }
  :root .valor-metrics > li:nth-child(n + 3) { border-block-start: 1px solid color-mix(in srgb, var(--valor-metric-ink) 18%, transparent); }
  :root .valor-metrics span { display: block; margin-top: 4px; }
}
@media screen and (max-width: 900px) {
  body:has(> .topbar) .langs li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Consumer adapters for the shared type/spacing tokens.
   :has(.site-header) identifies valor.cloud; data-showcase identifies the four
   product sites. CV_EDK has its own adapter. Theme changes only affect materials.
   Keep this layer after the local styles, including their responsive rules. */
@media screen {
  :is(:root:has(.site-header), :root[data-showcase]) body {
    font-size: var(--valor-size-body);
    line-height: var(--valor-line-body);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(p, main li, dd) {
    font-size: var(--valor-size-body);
    line-height: var(--valor-line-body);
  }
  :is(:root:has(.site-header), :root[data-showcase]) h1 {
    font-size: var(--valor-size-page-title);
    line-height: var(--valor-line-heading);
  }
  :is(:root:has(.site-header), :root[data-showcase]) h2 {
    font-size: var(--valor-size-section-title);
    line-height: var(--valor-line-heading);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(h3, h4) {
    font-size: var(--valor-size-card-title);
    line-height: var(--valor-line-heading);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(.btn, .button, .text-link,
    .site-preferences button, .language-switch button, .demo-tabs button,
    .journey-controls button, .license-reset, .license-segments button) {
    font-size: var(--valor-size-control);
    line-height: var(--valor-line-control);
    min-height: var(--valor-touch-target);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(.site-preferences button, .language-switch button) { min-width: var(--valor-touch-target); }
  :is(:root:has(.site-header), :root[data-showcase]) :is(.valor-audience-control, .valor-audience-actions button),
  :root[data-showcase] button.menu {
    min-width: var(--valor-touch-target);
    min-height: var(--valor-touch-target);
    font-size: var(--valor-size-control);
    line-height: var(--valor-line-control);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(.btn, .button) {
    min-height: var(--valor-touch-target);
    padding: 8px 12px;
    gap: var(--valor-space-dense);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(input, select, textarea) {
    font-size: var(--valor-field-size);
    line-height: var(--valor-line-control);
  }
  /* Calculator CSS follows BaseLayout in previews; its font shorthand must not
     reset the field floor when the central production bundle is unavailable. */
  :root:has(.site-header) .license-table input[type='number'] {
    min-height: var(--valor-touch-target);
    font-size: var(--valor-field-size);
    line-height: var(--valor-line-control);
  }
  :is(:root:has(.site-header), :root[data-showcase]) :is(.grid2, .grid3, .gallery-grid,
    .card-grid, .member-grid, .reference-grid, .app-grid, .service-grid, .solution-grid) {
    gap: var(--valor-space-grid);
  }

  /* valor.cloud: reuse the existing layouts, sizes and responsive column changes. */
  :root:has(.site-header) :is(.hero__title) { font-size: var(--valor-size-display-title); }
  :root:has(.site-header) :is(.section-heading h2, .section__title, .expertise-intro h2,
    .metier__title, .closing-card h2, .prose h2, .license-heading h2) {
    font-size: var(--valor-size-section-title);
  }
  :root:has(.site-header) :is(.page-hero h1, .article__header h1, .license-hero h1) {
    font-size: var(--valor-size-page-title);
  }
  :root:has(.site-header) :is(.post-card__title, .partner__title, .reference__sector, .member__name,
    .consultant__name, .app__name, .prose .service-tile__body h3,
    .prose .solution-tile h2) { font-size: var(--valor-size-card-title); }
  :root:has(.site-header) :is(.prose h3, .license-details h3) {
    font-size: var(--valor-size-subsection-title);
  }
  :root:has(.site-header) :is(.hero__lead, .page-hero__lead) {
    font-size: var(--valor-size-lead); line-height: var(--valor-line-body);
  }
  :root:has(.site-header) :is(.post-card__meta, .article__meta, .consultant__role,
    .member__role, .member__detail, .member__phone, .form__required, .form__privacy,
    .reference__clients li, .license-table, .license-table th, .license-table td) {
    font-size: var(--valor-size-secondary);
  }
  :root:has(.site-header) :is(small, .eyebrow, .topbar, .topbar__inner,
    .hero__eyebrow, .hero__signature, .hero__footnote, .page-hero__kicker,
    .cloud-scene .cloud-tile small, .cloud-scene__caption, .card-index,
    .expertise__number, .metier__caption, .consultant__badge-heading,
    .footer__bottom, .resource-status, .resource-nav__count, .publication-metrics dt,
    .publication-metrics__note, .migration-hook__copy .migration-hook__note,
    .catalogue-status, .license-eyebrow, .license-table small,
    .license-summary__intro span:first-child) {
    font-size: var(--valor-size-caption); line-height: var(--valor-line-control);
  }
  /* The older footer declared this size !important; keep the legibility floor. */
  :root:has(.site-header) .footer__credits { font-size: var(--valor-size-caption) !important; }
  :root:has(.site-header) :is(.cloud-scene .cloud-tile strong, .cloud-core,
    .nav--mobile summary, .ambassador-index a, .footer-group h3) {
    font-size: var(--valor-size-secondary); line-height: var(--valor-line-control);
  }
  :root:has(.site-header) :is(.section, .resource-section) { padding-block: var(--valor-space-section); }
  :root:has(.site-header) .hero__layout { padding-block: var(--valor-space-section); gap: var(--valor-space-layout); }
  :root:has(.site-header) :is(.expertise-layout, .metier) { gap: var(--valor-space-layout); }
  :root:has(.site-header) .section-heading { gap: var(--valor-space-grid); margin-bottom: var(--valor-space-layout); }
  /* A long title must still reflow when the reader doubles text size. */
  :root:has(.site-header) .section-heading h2 { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
  :root:has(.site-header) :is(.partner, .offer:not(.offer--illustrated), .app,
    .post-card__body, .member, .reference, .contact-form, .consultant,
    .metier__text, .offer__body, .service-tile__body, .prose .solution-tile,
    .closing-card, .footer__grid > *) { padding: var(--valor-space-card); }
  :root:has(.site-header) :is(.page-hero > .container, .article) { padding: var(--valor-space-layout); }
  :root:has(.site-header) .page-hero { padding-block: var(--valor-space-card); }
  :root:has(.site-header) .prose { line-height: var(--valor-line-body); }

  /* The four showcases: explicit h1 variants avoid fixed-pixel mobile overrides. */
  :root[data-showcase] :is(.hero h1, .producthero h1, .hero-copy h1) { font-size: var(--valor-size-display-title); }
  :root[data-showcase] :is(.pagehero h1, .content h1) { font-size: var(--valor-size-page-title); }
  :root[data-showcase] :is(.content h2, .language-section h2, .contact-section h2) { font-size: var(--valor-size-section-title); }
  :root[data-showcase] :is(.feature h3, .language-section .feature h3, .person h3,
    .directory h3, .step h3, .purpose-grid h3, .anchor-list h3, .roadmap h3,
    .journey-state h3, .demo-panel h3, .context-sheet > strong) {
    font-size: var(--valor-size-card-title);
  }
  :root[data-showcase] :is(.hero > div > p:not(.eyebrow):not(.note), .pagehero > p,
    .hero-copy .lead, .vision-intro > p) { font-size: var(--valor-size-lead); }
  :root[data-showcase] :is(.hero-copy .actions a, .faq summary, .faq-layout summary) { font-size: var(--valor-size-control); }
  :root[data-showcase] :is(.person .role, .footer p, .footer-group a,
    .screenshot-card figcaption, .record-row, .sheet-line) { font-size: var(--valor-size-secondary); }
  :root[data-showcase] :is(small, .brand small, .topline, .topline .copy-en,
    .eyebrow, .hero-note, .hero-bottom, .nav-label-en, .product-row small,
    .product-row small .copy-en, .visual-label, .visual-foot, .cloud-core span,
    .demo-label, .demo-footer, .demo-state, .signal b, .signal small,
    .footer-bottom, .footer-group h3, .sheet-top, .sheet-foot,
    .assistant-node, .assistant-node small, .art-caption, .purpose-number,
    .journey-label, .step-index, .record-header, .record-label,
    .next-action > span:first-child, .journey-bottom p, .journey-bottom a,
    .roadmap-status, #contact .band .booking-note) {
    font-size: var(--valor-size-caption); line-height: var(--valor-line-control);
  }
  :root[data-showcase] :is(.btn.dual .copy-en, h3 .heading-en) { font-size: var(--valor-size-caption); }
  /* Existing fixed sizes use !important in site.css. */
  :root[data-showcase] .note { font-size: var(--valor-size-caption) !important; line-height: var(--valor-line-body) !important; }
  :root[data-showcase] .demo-panel p { font-size: var(--valor-size-body) !important; }
  :root[data-showcase] :is(.section, .status-section, .contact-section, .language-section, #contact) { padding-block: var(--valor-space-section); }
  :root[data-showcase] :is(.hero, .hero-grid) { padding-block: var(--valor-space-section); gap: var(--valor-space-layout); }
  :root[data-showcase] .pagehero { padding-block: var(--valor-space-layout); }
  :root[data-showcase] .section-head { gap: var(--valor-space-layout); margin-bottom: var(--valor-space-layout); }
  :root[data-showcase] :is(.purpose-grid, .usage-layout, .faq-layout, .journey-grid,
    .roadmap, .footer-top, #contact .band) { gap: var(--valor-space-layout); }
  :root[data-showcase] :is(.person, .journey-state, .screenshot-card figcaption, .appbody) { padding: var(--valor-space-card); }
  :root[data-showcase] :is(.feature, .anchor-list article, .faq details, .faq-layout details) { padding-block: var(--valor-space-card); }
  :root[data-showcase] .actions { gap: var(--valor-space-dense); margin-top: var(--valor-space-card); }
}
