/**
 * Astryx composition principles, expressed through Medallion's PHP components.
 * One visual language across public, auth and application frames. No resets,
 * runtime dependencies, layout offsets, event hooks or theme preference writes.
 */
:root {
  --mds-display: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mds-body: var(--mds-display);
  --mds-canvas: var(--mx-app-bg, #f6f4ef);
  --mds-surface: var(--mx-surface-primary, #ffffff);
  --mds-ink: var(--mx-text-primary, #141a2e);
  --mds-muted: var(--mx-text-secondary, #3a4254);
  --mds-line: var(--mx-border-default, #d8d7d2);
  --mds-gold: var(--mx-accent-gold, #f2cc76);
  --mds-focus: var(--mx-focus-ring-color, #845500);
  --mds-radius: 16px;
  --mds-control: 12px;
  --mds-motion: 180ms ease;
}

/* Application frame. Navigation geometry and collapse behavior stay owned by shell. */
body:has(.sidebar[data-sidebar]) h1 {
  font-family: var(--mds-display);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.15;
  text-wrap: balance;
}
.sidebar[data-sidebar] .nav-menu { padding-inline: 12px; }
.sidebar[data-sidebar] .nav-link {
  min-height: 48px;
  border-left: 0;
  border-radius: 10px;
  padding-inline: 12px;
  margin-block: 2px;
  transition: background-color var(--mds-motion), color var(--mds-motion);
}
.sidebar[data-sidebar] .nav-link.active {
  background: var(--mx-nav-active-bg);
  color: var(--mx-accent-gold-text);
  box-shadow: inset 3px 0 var(--mx-accent-gold-border);
}
.sidebar[data-sidebar] .sidebar-footer-link {
  border-radius: 10px;
  min-height: 44px;
}
.sidebar[data-sidebar] .sidebar-footer-link.active {
  background: var(--mx-nav-active-bg);
  box-shadow: inset 3px 0 var(--mx-accent-gold-border);
}
.sidebar[data-sidebar] .brand-name { letter-spacing: -.03em; }
.sidebar[data-sidebar] .nav-section-label { font-size: 10px; letter-spacing: .13em; }
.sidebar.sidebar--collapsed[data-sidebar] .nav-link { padding-inline: 0; }

/* Shared widgets and forms. Dense rows keep their existing divider layout. */
body .xui-card {
  border-radius: var(--mds-radius);
  border-color: var(--mds-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
}
body .xui-title { font-family: var(--mds-display); font-weight: 650; letter-spacing: -.035em; }
body .xui-btn { border-radius: var(--mds-control); }
body :is(.xui-input, .xui-select, .xui-textarea) { border-radius: var(--mds-control); }

/* Auth and onboarding share the same form, reading rhythm and context surface. */
body.ob .ob-top { background: var(--mx-elevated-bg); border-bottom: 1px solid var(--mds-line); }
body.ob .ob-card {
  border-radius: 20px;
  padding: clamp(22px, 3vw, 36px);
  border-color: var(--mds-line);
  box-shadow: 0 8px 28px rgba(var(--mx-shadow-rgb), .06);
}
body.ob .ob-card h1 {
  font-family: var(--mds-display);
  font-weight: 650;
  font-size: clamp(30px, 2.5vw, 40px);
  line-height: 1.12;
  letter-spacing: -.035em;
}
body.ob :is(.ob-input, .ob-select, .ob-textarea, .ob-btn) { border-radius: var(--mds-control); }
body.ob .ax-visual { border-radius: 20px; }
body.ob .ax-visual h2 { font-family: var(--mds-display); font-weight: 650; font-size: clamp(28px, 2.5vw, 38px); }
@media (max-width: 480px) {
  body.ob .ob-card { padding: 18px 16px; border-radius: 14px; }
}

/* Public variants retain their content, sections, illustration and CTA contracts. */
body.lp5 {
  --lp5-display: var(--mds-display);
  --lp5-radius: var(--mds-control);
  --lp5-radius-card: var(--mds-radius);
  --lp5-gold: #f2cc76;
}
body.lp5 :is(.lp5-display, .lp5-h2) { font-weight: 650; letter-spacing: -.045em; line-height: 1.06; }
body.lp5 .lp5-btn { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 650; }
body.lp5 .lp5-btn--sm { font-size: 13px; }
body.lp5 .lp5-tag { border-radius: 6px; }
body.lp5 .lp5-header { background: #fbfaf7; }
body.lp5 .cr-sentence { font-weight: 650; line-height: 1.06; }
body.lp5 :is(.cr-link, .cr-ask-go, .cr-billing label, .cr-reel-toggle) { font-family: var(--lp5-font); }
@media (max-width: 479px) {
  body.lp5 .cr-line { white-space: normal; }
}
@media (max-width: 360px) {
  body.lp5 .lp5-bar { gap: 8px; }
  body.lp5 .lp5-brand { font-size: 13px; gap: 8px; }
  body.lp5 .lp5-btn--sm { padding-inline: 12px; font-size: 12px; }
  body.lp5 .lp5-billing { max-width: 100%; flex-wrap: wrap; }
}
body.zc { --zc-display: var(--mds-display); background: #f6f4ef; }
body.zc :is(h1, h2) { font-weight: 650; }
body.zc .zc-header { background: #fbfaf7; border-bottom: 1px solid #d8d7d2; }
body.zc .zc-brand { font-family: var(--mds-body); font-weight: 650; letter-spacing: -.03em; }
body.zc .zc-button { border-radius: var(--mds-control); min-height: 44px; }
body.zc .zc-menu-toggle { min-width: 44px; min-height: 44px; border-radius: var(--mds-control); }
body.vnext {
  --body: var(--mds-body);
  --display: var(--mds-display);
  --sand: #f6f4ef;
  --paper: #fbfaf7;
  --radius: var(--mds-radius);
}
body.vnext .vnext-button { border-radius: var(--mds-control); }

/* Standalone documents retain their system appearance policy. */
body.mds-document {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-strong: #eeece6;
  --text: #141a2e;
  --muted: #495164;
  --faint: #5b6374;
  --border: #d8d7d2;
  --link: #805500;
  --linkHover: #644100;
  --shadow: 0 4px 18px rgba(20, 26, 46, .05);
  color-scheme: light;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mds-body);
}
body.mds-document :is(.card, .panel) { border-radius: var(--mds-radius); }
body.mds-document :is(.card-head h1, .card-head h2, main h1, main > h2) {
  font-family: var(--mds-display);
  font-weight: 650;
  letter-spacing: -.035em;
}
body.mds-document .btn { min-height: 44px; border-radius: var(--mds-control); }
body.mds-document footer { color: var(--muted); }
body.mds-marketing { background: #f6f4ef; }
body.mds-marketing :is(h1, h2) { font-family: var(--mds-display); font-weight: 650; letter-spacing: -.035em; }
body.mds-marketing #navbar { background: #fbfaf7; border-bottom: 1px solid #d8d7d2; }
body.mds-marketing .mds-back-link { color: #565f6d; }
/* Invitation links intentionally retain their existing dark public frame. */
body.mds-invite { font-family: var(--mds-body); --mds-focus: #f2cc76; }
body.mds-invite :is(h1, h2) { font-family: var(--mds-display); letter-spacing: -.025em; text-transform: none; }
body.mds-invite :is(.btn-accept, .btn-ghost) { border-radius: var(--mds-control); }
body.mds-invite :focus-visible { outline: 3px solid var(--mds-focus); outline-offset: 4px; }
@media (prefers-color-scheme: dark) {
  body.mds-document {
    --bg: #0c1421; --panel: #141f30; --panel-strong: #1c293c;
    --text: #f1f0eb; --muted: #c7cbd2; --faint: #a1aab8;
    --border: #344155; --link: #f2cc76; --linkHover: #ffe0a0;
    --mds-focus: #f2cc76;
    color-scheme: dark;
  }
}

/* Static geometry for state changes. Native keyboard and touch behavior retained. */
body:is(.lp5, .zc, .vnext, .mds-document, .mds-marketing) :focus-visible,
body.ob :focus-visible {
  outline: 3px solid var(--mds-focus);
  outline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
  body:is(.lp5, .zc, .vnext, .ob, .mds-document, .mds-marketing, .mds-invite) *,
  .sidebar[data-sidebar] *, body .xui-btn, body .xui-card {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  body:is(.lp5, .zc, .mds-document) :is(.lp5-btn, .zc-button, .btn):hover,
  body:is(.lp5, .zc, .mds-document) :is(.lp5-btn, .zc-button, .btn):active { transform: none; }
}
@media print {
  body.mds-document {
    --bg: #fff; --panel: #fff; --text: #111; --muted: #333;
    --border: #ccc; --link: #111; --shadow: none;
    color-scheme: light;
    background: #fff;
    color: #111;
  }
}

/* The selected header font is the platform-wide UI family. Keep technical
   monospace roles independent, and preserve every page's existing type scale. */
html body:is(.lp5, .zc, .vnext, .ob, .mds-document, .mds-marketing, .mds-invite, :has(.sidebar[data-sidebar])) {
  font-family: var(--mds-body);
}
body.lp5 { --lp5-font: var(--mds-body); }
body.zc { --zc-font: var(--mds-body); }
body.mds-document { --sans: var(--mds-body); }
