/*
 * Specialist Snapshot Clinical Editorial Design System
 *
 * This file is intentionally loaded after the implementation stylesheets. It is
 * the public contract for future UI work: semantic tokens first, then a small
 * set of role mappings. Component geometry remains with the component that owns it.
 */

:root {
  /* Typography families: two families, three semantic roles. */
  --font-ui:"Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-editorial:"Newsreader Variable", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --font-data:var(--font-ui);
  --font-code:"IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Legacy aliases keep existing components on the same semantic contract. */
  --font-sans:var(--font-ui);
  --font-serif:var(--font-editorial);
  --font-brand:var(--font-editorial);
  --font-mono:var(--font-code);

  /* Type scale. Compact exceptions must be documented next to the component. */
  --type-display:clamp(2.75rem,6vw,4.5rem);
  --type-page-title:clamp(2.15rem,4.5vw,3.5rem);
  --type-profile-title:clamp(1.8rem,3vw,2.3rem);
  --type-section-title:clamp(1.2rem,2vw,1.45rem);
  --type-card-title:1.0625rem;
  --type-body:1rem;
  --type-ui:.875rem;
  --type-meta:.8125rem;
  --type-caption:.75rem;

  --weight-regular:400;
  --weight-medium:500;
  --weight-semibold:600;
  --weight-bold:700;

  --leading-display:1.02;
  --leading-title:1.12;
  --leading-body:1.55;
  --leading-ui:1.35;
  --leading-meta:1.4;
  --tracking-display:-.018em;
  --tracking-title:-.01em;
  --tracking-ui:0;

  /* Four-point spacing foundation. */
  --space-1:.25rem;
  --space-2:.5rem;
  --space-3:.75rem;
  --space-4:1rem;
  --space-6:1.5rem;
  --space-8:2rem;
  --space-12:3rem;
  --space-16:4rem;

  /* One responsive page edge keeps narrow headers, controls, and content aligned. */
  --edge-gutter-narrow:clamp(1rem,4.2vw,1.25rem);

  /* Semantic surface and signal roles. */
  --color-text:var(--ink);
  --color-text-subtle:var(--ink-2);
  --color-text-muted:var(--muted);
  --color-border:var(--line);
  --color-border-subtle:var(--line-soft);
  --color-canvas:var(--canvas);
  --color-panel:var(--panel);
  --color-surface:var(--surface);
  --color-action:var(--indigo);
  --color-action-strong:var(--indigo-strong);
  --color-action-soft:var(--indigo-bg);
  --color-positive:var(--good);
  --color-caution:var(--mod);
  --color-critical:var(--long);

  /* Shape, motion, measure, and interaction contracts. */
  --radius-control:var(--r-sm);
  --radius-panel:var(--r-md);
  --radius-feature:var(--r-lg);
  --motion-fast:120ms;
  --motion-standard:180ms;
  --motion-slow:260ms;
  --motion-ease:cubic-bezier(.22,1,.36,1);
  --measure-body:68ch;
  --target-comfortable:44px;
}

html {
  font-family:var(--font-ui);
  text-rendering:optimizeLegibility;
}

body {
  font-family:var(--font-ui);
  font-size:var(--type-body);
  line-height:var(--leading-body);
}

button,
input,
select,
textarea {
  font-family:var(--font-ui);
  line-height:var(--leading-ui);
}

::placeholder { color:var(--color-text-muted); }

:is(.field-label,.snap-label,.contact-label,.referral-control-label) {
  font-size:var(--type-meta);
  font-weight:var(--weight-semibold);
  line-height:1.3;
}

:is(.activity-card-heading p,.activity-disclosure-copy small,.contribution-summary small) {
  font-size:var(--type-meta);
  line-height:var(--leading-meta);
}

/* Editorial type identifies people, places, and major content structure. */
.explore-hero-copy h2 {
  font-family:var(--font-editorial);
  font-size:var(--type-display);
  font-weight:var(--weight-medium);
  line-height:var(--leading-display);
  letter-spacing:var(--tracking-display);
}

:is(.page-hero h2,.about-hero h2,.legal-main h1) {
  font-family:var(--font-editorial);
  font-size:var(--type-page-title);
  font-weight:var(--weight-medium);
  line-height:var(--leading-title);
  letter-spacing:var(--tracking-display);
}

:is(.profile-header h2,.profile-header h3) {
  font-family:var(--font-editorial);
  font-size:var(--type-profile-title);
  font-weight:var(--weight-semibold);
  line-height:var(--leading-title);
  letter-spacing:var(--tracking-title);
}

:is(
  .section-heading h2,
  .profile-section-head h3,
  .summary-section > h3,
  .activity-card-heading h3,
  .snapshot-form-head h3,
  .at-glance > h3,
  .auth-heading,
  .location-details h3,
  .rail-card-head h3
) {
  font-family:var(--font-editorial);
  font-weight:var(--weight-semibold);
  line-height:var(--leading-title);
  letter-spacing:var(--tracking-title);
}

:is(.result-title,.loc-name,.activity-disclosure-copy strong,.snapshot-toggle-copy strong) {
  font-family:var(--font-editorial);
  font-weight:var(--weight-semibold);
  letter-spacing:var(--tracking-title);
}

.result-title { font-size:var(--type-card-title); }

.result-specialty { font-size:var(--type-caption); }

body[data-view="explore"][data-explore-stage="results"] .result-rating-label {
  font-size:var(--type-caption);
}

/* Navigation, controls, labels, and actions always use the interface voice. */
.app-header,
.primary-nav,
.primary-nav a,
.primary-nav-toggle,
#account-menu-toggle,
#account-menu-toggle :is(strong,small),
.search-submit,
.refinement-disclosure,
.advanced-filters,
.activity-table {
  font-family:var(--font-ui);
  letter-spacing:var(--tracking-ui);
}

/* The wordmark is editorial identity even though it lives inside UI chrome. */
.app-header .brand-name {
  font-family:var(--font-editorial);
  letter-spacing:var(--tracking-title);
}

.activity-table { font-size:var(--type-meta); }
.activity-table thead th { font-size:var(--type-caption); }

/* Measured values align without making ordinary clinical information look like code. */
:is(
  .result-rank,
  .result-metric,
  .result-distance,
  .loc-distance,
  .results-count,
  .filter-count,
  .activity-count,
  .multi-option-count,
  .summary-item-value,
  .rating-summary-value,
  time,
  input[type="date"]
) {
  font-family:var(--font-data);
  font-variant-numeric:tabular-nums lining-nums;
}

.mono {
  font-family:var(--font-code);
  font-variant-numeric:tabular-nums lining-nums;
}

/* Reading copy is deliberately bounded; task controls and tables are not. */
:is(.page-hero p,.about-hero p,.legal-main p,.legal-main li,.referral-note p,.auth-disclaimer) {
  max-width:var(--measure-body);
  line-height:var(--leading-body);
}

@media (max-width:620px) {
  :root {
    --type-display:clamp(2.4rem,12vw,3.35rem);
    --type-page-title:clamp(2rem,9vw,2.8rem);
    --type-profile-title:clamp(1.55rem,7vw,1.9rem);
  }

  .result-title { font-size:1rem; }
}

@media (prefers-reduced-motion:reduce) {
  :root {
    --motion-fast:1ms;
    --motion-standard:1ms;
    --motion-slow:1ms;
  }
}
