@import url('./ares-tokens.css');

/* Canonical dark-terminal guardrails used while legacy route markup is retired. */

html {
  background: var(--ares-color-bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body.ares-redesign,
body.ares-terminal,
body[data-ares-ui='terminal'],
body.ares-home-v5 {
  min-width: 320px;
  margin: 0;
  color: var(--ares-color-text);
  background: var(--ares-color-bg);
  font-family: var(--ares-font-body);
  overflow-wrap: anywhere;
}

body.ares-terminal :where(main,.main,.page-main,.wrap,.shell,.R) {
  max-width: 100%;
}

body.ares-terminal :where(img,svg,video,canvas) {
  max-width: 100%;
}

body.ares-redesign :where(.card,.modal-content,.dropdown-menu,.offcanvas,.list-group-item),
body.ares-terminal :where(.card,.modal-content,.dropdown-menu,.offcanvas,.list-group-item),
body[data-ares-ui='terminal'] :where(.card,.modal-content,.dropdown-menu,.offcanvas,.list-group-item) {
  color: var(--ares-color-text);
  background-color: var(--ares-color-surface-1);
  border-color: var(--ares-border-subtle);
  box-shadow: none;
}

body.ares-redesign :where(.form-control,.form-select,input,select,textarea),
body.ares-terminal :where(.form-control,.form-select,input,select,textarea),
body[data-ares-ui='terminal'] :where(.form-control,.form-select,input,select,textarea) {
  min-height: 44px;
  color: var(--ares-color-text);
  background-color: var(--ares-color-surface-2);
  border-color: var(--ares-border-strong);
}

body.ares-redesign :where(.form-control,.form-select,input,select,textarea)::placeholder,
body.ares-terminal :where(.form-control,.form-select,input,select,textarea)::placeholder,
body[data-ares-ui='terminal'] :where(.form-control,.form-select,input,select,textarea)::placeholder {
  color: var(--ares-color-text-dim);
  opacity: 1;
}

body.ares-terminal :where(button,.btn,[role='button'],a.btn,.ares-product-button) {
  min-height: 44px;
}

body.ares-terminal :where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline: 3px solid var(--ares-color-gold-bright) !important;
  outline-offset: 3px !important;
}

body.ares-redesign :where(table,.table),
body.ares-terminal :where(table,.table),
body[data-ares-ui='terminal'] :where(table,.table) {
  color: var(--ares-color-text);
  background: transparent;
}

body.ares-redesign :where(table,.table) :where(th,td),
body.ares-terminal :where(table,.table) :where(th,td),
body[data-ares-ui='terminal'] :where(table,.table) :where(th,td) {
  border-color: var(--ares-border-subtle);
}

body.ares-redesign :where(table,.table) th,
body.ares-terminal :where(table,.table) th,
body[data-ares-ui='terminal'] :where(table,.table) th {
  color: var(--ares-color-text-muted);
  background: var(--ares-color-surface-2);
  font-family: var(--ares-font-mono);
}

body.ares-terminal :where(.table-wrap,.data-table-wrap,.gtable-wrap) {
  position: relative;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible;
  scrollbar-gutter: stable;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

body.ares-terminal :where(.table-wrap,.data-table-wrap,.gtable-wrap) table {
  width: 100%;
  min-width: 760px;
}

body.ares-terminal :where(.table-wrap,.data-table-wrap,.gtable-wrap) .ares-priority-column {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ares-color-surface-1) !important;
  box-shadow: 1px 0 0 var(--ares-border-gold);
}

.ares-table-scroll-cue {
  display: none;
  margin: 0 0 8px;
  color: var(--ares-color-text-muted);
  font: 10px var(--ares-font-mono);
}

:where(.ares-market-value,.ares-market-score,[data-metric='market-score']) {
  color: var(--ares-color-text) !important;
}

:where(.ares-score-value,.ares-score,[data-metric='ares-score']) {
  color: var(--ares-color-gold-bright) !important;
}

:where(.ares-confidence-value,.ares-confidence,[data-metric='confidence']) {
  color: var(--ares-color-confidence) !important;
}

:where(.ares-risk-value,.ares-risk,[data-metric='risk']) {
  color: var(--ares-color-risk) !important;
}

:where(.ares-positive,.positive,[data-direction='up']) {
  color: var(--ares-color-positive) !important;
}

:where(.ares-negative,.negative,[data-direction='down']) {
  color: var(--ares-color-negative) !important;
}

:where(.meta,.small,.stat-d,.panel-sub,.cell-sub,.section-copy,.ares-metadata) {
  color: var(--ares-color-text-muted);
  font-size: max(var(--ares-text-meta), 0.625rem);
  line-height: 1.55;
}

:where(.dim,.ares-dim) {
  color: var(--ares-color-text-dim) !important;
}

/* V4 is the sole active shell when present. */
body:has(.ares-v4-shell-header) > :where(.nav,.site-header,.ares-topbar,.ares-mega-topbar,#ares-shared-navigation),
body:has(.ares-v4-shell-header) > :where(.ticker,.market-ticker,.ares-beta-strip) {
  display: none !important;
}

body:has(.ares-v4-footer) > :where(.footer,.foot,footer.site-footer,.ares-site-legal-footer) {
  display: none !important;
}

.ares-v4-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.ares-v4-legal-links a {
  color: var(--ares-color-text-muted);
  font: 9px var(--ares-font-mono);
  text-decoration: none;
}

.ares-v4-legal-links a:hover {
  color: var(--ares-color-gold-bright);
}

/* Public pages must not display implementation placeholders. */
:where(.ares-ad-slot,.ad,[class*='advertisement']):has(:where(strong,span,small):only-child) {
  display: none;
}

.ares-policy-notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1100;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--ares-border-gold);
  border-radius: var(--ares-radius-lg);
  background: var(--ares-color-surface-2);
  color: var(--ares-color-text-muted);
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  font-size: 12px;
}

.ares-policy-notice strong,
.ares-policy-notice a {
  color: var(--ares-color-gold-bright);
}

.ares-policy-notice button {
  min-height: 40px;
  border: 1px solid var(--ares-border-strong);
  border-radius: var(--ares-radius-sm);
  background: var(--ares-color-surface-1);
  color: var(--ares-color-text);
}

@media (max-width: 60rem) {
  body.ares-terminal :where(.main,.content-grid,.page-hero,.home-grid) {
    grid-template-columns: 1fr !important;
  }

  body.ares-terminal :where(.side,aside.side,aside.rail) {
    border-left: 0 !important;
  }
}

@media (max-width: 43rem) {
  html { scroll-padding-top: 78px; }

  :where(.meta,.small,.stat-d,.panel-sub,.cell-sub,.section-copy,.ares-metadata) {
    font-size: max(var(--ares-text-small), 0.6875rem);
  }

  .ares-table-scroll-cue { display: block; }

  body.ares-terminal :where(.table-wrap,.data-table-wrap,.gtable-wrap) table {
    min-width: 680px;
    font-size: 11px;
  }

  body.ares-terminal :where(.grid-2,.grid-3,.grid-4,.stats,.quick-grid,.metric-grid,.filter-console) {
    grid-template-columns: 1fr !important;
  }

  body.ares-terminal :where(.section-body,.hero-left,.hero-right,.page-hero,.main,.content) {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .ares-policy-notice {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,*::before,*::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
