/*
 * DYOR legibility and interaction floor.
 * This is deliberately the final stylesheet: legacy prototype experiments must
 * not be able to shrink essential copy, focus indicators, or touch targets.
 */

:root {
  --legible-small: .875rem;
  --legible-body: 1rem;
  --legible-line: 1.55;
  --legible-focus: #ffd166;
  --legible-focus-light: #2930ff;
}

html { font-size: 100%; }
body { font-size: var(--legible-body); line-height: var(--legible-line); text-rendering: optimizeLegibility; }

main :where(p, li, dd, figcaption, blockquote) { line-height: 1.6; }
main :where(p, li, dd, dt, figcaption, blockquote, label, small, time, span, b, strong, em) {
  font-size: max(var(--legible-small), 1em) !important;
}
main :where(.label, dt, small, time, .eyebrow, .asset-tag, .saved-workflow-state,
  .workspace-context span, .workspace-context dd, .workspace-prompts span,
  .watchlist-card-read dt, .watchlist-card-read dd, .saved-state-control span,
  .saved-evidence-reason, .provider-intelligence-subheading,
  .provider-metric-grid small, .provider-event-list small, .score-history-delta,
  .evidence-link, .server-evidence-summary, .source-freshness) {
  font-size: var(--legible-small) !important;
  line-height: 1.5 !important;
}

main :where(h1, h2, h3, h4) { line-height: 1.14 !important; text-wrap: balance; }
main :where(p, li, dd, figcaption) { text-wrap: pretty; }
main :where(.panel-copy, .section-intro, .research-narrative, .tooltip-panel p,
  .source-record p, .buddy-answer p, .report-preview p) { max-width: 70ch; }

button, input, select, textarea { font: inherit; }
main :where(button, input:not([type="checkbox"]):not([type="radio"]), select, textarea, summary) {
  min-height: 44px;
}
main button { min-width: 44px; }
main :where(.text-button, .text-link) { width: auto; max-width: 100%; white-space: normal; }

main .tooltip-actions { display: flex; flex-wrap: wrap; gap: 8px; }
html body main#main-content .tooltip-actions > button.info-dot,
html body main#main-content .tooltip-actions > button.buddy-tooltip-button {
  flex: 0 0 44px !important;
  inline-size: 44px !important;
  block-size: 44px !important;
  min-inline-size: 44px !important;
  min-block-size: 44px !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
}

.buddy-send-button { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; }
body main .source-methodology summary, body main .source-record summary, body main .buddy-answer summary { min-height: 44px !important; padding-block: 10px; }
.source-record-link, .buddy-sources a { display: inline-flex; min-height: 44px; align-items: center; padding-block: 8px; font-size: var(--legible-small) !important; }
.site-footer a { display: inline-flex; min-height: 44px; align-items: center; padding-block: 8px; }
.site-footer, .site-footer a, .buddy-launcher small, .buddy-launcher kbd { font-size: var(--legible-small) !important; line-height: 1.45 !important; }
.dyor-buddy :where(p, li, summary, label, small, time, span, b, strong) { font-size: max(var(--legible-small), 1em) !important; }
.server-evidence-summary a { display: inline-flex; min-height: 44px; align-items: center; padding-block: 8px; }

/* Numbered citations stay visually compact while their surrounding row is readable. */
.evidence-link > span:first-child { font-size: .8125rem !important; }
.asset-logo-fallback { font-size: .8125rem !important; }
.constellation-core small, .constellation-node { font-size: .8125rem !important; line-height: 1.35 !important; }

:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--legible-focus) !important;
  outline-offset: 3px !important;
}
main :where(.panel, article, section):focus-within { scroll-margin-block: 88px 24px; }

@media (prefers-contrast: more) {
  :root { --muted: #ded7ca; --line: rgba(255, 255, 255, .48); }
  :where(.panel, .card, article, input, select, textarea) { border-width: 2px !important; }
  a { text-decoration-thickness: 2px; text-underline-offset: .2em; }
}

@media (forced-colors: active) {
  :where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid Highlight !important;
  }
  .info-icon-svg, .buddy-icon-svg { forced-color-adjust: auto; }
}

@media (max-width: 760px) {
  main { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  main :where(button, input:not([type="checkbox"]):not([type="radio"]), select, textarea, summary) { min-height: 48px; }
  main button { min-width: 48px; }
  html body main#main-content .tooltip-actions > button.info-dot,
  html body main#main-content .tooltip-actions > button.buddy-tooltip-button {
    flex-basis: 48px !important;
    inline-size: 48px !important;
    block-size: 48px !important;
    min-inline-size: 48px !important;
    min-block-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
  }
  .source-record-link, .buddy-sources a, .site-footer a, .server-evidence-summary a { min-height: 48px; }
  .workspace-context, .workspace-prompts, .provider-metric-grid { gap: 12px !important; }
  .workspace-context > div, .workspace-prompts > *, .provider-metric-grid > div { min-width: 0; }
}

/* August annotation pass: navigation, marketing hierarchy, and research cards. */
.info-icon-svg > circle:first-child,
.buddy-icon-tooltip > circle:nth-child(1),
.buddy-icon-tooltip > circle:nth-child(2) { display: none; }

.side-nav { border-bottom: 0 !important; box-shadow: none !important; }
.side-nav .nav-link,
.side-nav .secondary-nav-menu > summary {
  border-radius: 12px !important;
  white-space: nowrap !important;
}
.side-nav .nav-link > span:last-child { white-space: nowrap !important; }
.secondary-nav-links .gated-nav-link {
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.nav-gated-badge {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #11100f !important;
  font-size: .75rem !important;
  font-weight: 850;
  text-transform: uppercase;
}

#home-view .marketing-hero-copy h1 { max-width: 720px; }
#home-view .marketing-product-preview { display: flex; min-height: 420px; flex-direction: column; }
#home-view .marketing-product-preview .preview-facts { margin-top: auto; }
#home-view .marketing-product-preview .preview-price small {
  color: #3f403b !important;
  font-size: var(--legible-small) !important;
  font-weight: 800;
  opacity: 1 !important;
}
#home-view .marketing-product-preview .preview-open {
  width: fit-content;
  min-width: 190px;
  align-self: flex-end;
  justify-content: center;
  gap: 18px;
  margin-top: auto;
  padding: 12px 18px !important;
  border: 2px solid #11100f !important;
  border-radius: 12px;
  background: #cfff5e !important;
  box-shadow: 5px 6px 0 #ff5b04;
}
#home-view .marketing-product-preview .preview-open:hover,
#home-view .marketing-product-preview .preview-open:focus-visible { background: #fff8e8 !important; }

#home-view .marketing-problem .marketing-section-heading h2 {
  max-width: 980px;
  font-size: clamp(36px, 3.4vw, 50px) !important;
  line-height: 1.08 !important;
}
#home-view .marketing-benefit-grid { align-items: stretch; }
#home-view .marketing-benefit-grid article { display: grid; grid-template-rows: auto 1fr; }
#home-view .marketing-benefit-grid article h3 {
  min-height: 72px;
  font-size: 20px !important;
  line-height: 1.25 !important;
}
#home-view .marketing-benefit-grid article p { align-self: start; margin: 0; }

/* Content-viability rules: editorial cards reflow before their copy becomes narrow. */
#home-view :where(.marketing-benefit-grid,.marketing-role-grid) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--card-min-editorial, 17rem)), 1fr));
  gap: var(--grid-gutter, 1.25rem);
}

#home-view :where(.marketing-benefit-grid,.marketing-role-grid) :where(h2,h3) {
  max-width: 20ch;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  text-wrap: balance;
}

#home-view :where(.marketing-benefit-grid,.marketing-role-grid) p {
  max-width: 62ch;
  word-break: normal;
  overflow-wrap: normal;
  text-wrap: pretty;
}
#home-view #membership-title > span { color: #ff5b04 !important; }

/* Keep the outer universe cards unchanged while scaling their interior rhythm. */
#asset-browser-grid .universe-asset-card > .universe-card-main-link {
  padding: 24px !important;
}
#asset-browser-grid .universe-asset-card :where(h2, p, strong, small, span) {
  line-height: 1.35 !important;
}
#asset-browser-grid .universe-asset-card h2 { font-size: 1.275rem !important; }
#asset-browser-grid .universe-asset-card p { font-size: .875rem !important; }
#asset-browser-grid .universe-asset-card .asset-logo,
#asset-browser-grid .universe-asset-card .asset-logo-fallback { transform: scale(.85); transform-origin: center; }
#asset-browser-grid .universe-asset-card .universe-card-top,
#asset-browser-grid .universe-asset-card .universe-card-identity { gap: 12px !important; }

#asset-read-accordion > .asset-research-card-header {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, .38fr) minmax(310px, .72fr) !important;
  grid-template-areas:
    "topline topline topline"
    "identity grip price"
    "tags grip price" !important;
  align-items: center !important;
  gap: 18px 28px !important;
  min-height: 310px;
  padding: 28px !important;
}
#asset-read-accordion .asset-card-topline { grid-area: topline; display: flex; align-items: center; justify-content: space-between; }
#asset-read-accordion .asset-card-identity-row { grid-area: identity; min-width: 0; }
#asset-read-accordion .asset-tag-strip { grid-area: tags; }
#asset-read-accordion .asset-grip-lockup {
  grid-area: grip;
  display: grid !important;
  grid-template-columns: auto auto;
  align-content: center;
  justify-content: center;
  gap: 2px 4px;
  min-width: 150px;
  min-height: 150px;
  padding: 18px;
  border: 2px solid #cfff5e;
  border-radius: 50%;
  text-align: center;
}
#asset-read-accordion .asset-grip-lockup strong { font-size: 2.4rem !important; line-height: 1 !important; }
#asset-read-accordion .asset-grip-lockup > span { align-self: end; }
#asset-read-accordion .asset-grip-lockup small { grid-column: 1 / -1; color: #fff8e8 !important; }
#asset-read-accordion .asset-price {
  grid-area: price;
  display: grid !important;
  justify-items: end;
  align-content: center;
  gap: 10px;
  min-width: 0;
  text-align: right;
}
#asset-read-accordion .asset-price-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
#asset-read-accordion .asset-price-actions :where(button, summary) {
  width: auto !important;
  min-width: 70px !important;
  min-height: 44px !important;
  padding: 10px !important;
  white-space: nowrap !important;
}
#asset-read-accordion .asset-back-button { position: relative; z-index: 2; width: auto; min-width: 0; min-height: 44px; margin: 0; padding: 8px 10px; }

@media (max-width: 980px) {
  #asset-read-accordion > .asset-research-card-header {
    grid-template-columns: minmax(0, 1fr) minmax(150px, .45fr) !important;
    grid-template-areas: "topline topline" "identity grip" "tags grip" "price price" !important;
  }
  #asset-read-accordion .asset-price { justify-items: start; text-align: left; }
  #asset-read-accordion .asset-price-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  #asset-read-accordion > .asset-research-card-header {
    grid-template-columns: 1fr !important;
    grid-template-areas: "topline" "identity" "tags" "grip" "price" !important;
    min-height: 0;
    padding: 22px !important;
  }
  #asset-read-accordion .asset-grip-lockup { justify-self: start; min-width: 132px; min-height: 132px; }
  #asset-read-accordion .asset-price-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #asset-read-accordion .asset-price-actions :where(button, summary) { width: 100% !important; min-height: 48px !important; }
}
