/* Shared blue palette and complete light/dark appearance. Load after all page styles. */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --paper: #fff;
  --sheet: #fff;
  --sheet-2: #f4f7fc;
  --ink: #162a43;
  --ink-2: #405570;
  --ink-3: #566a82;
  --rule: #d3deeb;
  --rule-2: #b7c8dd;
  --cobalt: #2458b8;
  --cobalt-ink: #184695;
  --cobalt-tint: #edf3ff;
  --rose: #2458b8;
  --rose-light: #edf3ff;
  --theme-action: #2458b8;
  --theme-action-hover: #194796;
  --theme-accent-line: #b8cdef;
  --theme-icon: #486b9a;
  --theme-hero: #f0f5ff;
  --theme-header: #fffffff5;
  --theme-shadow: 0 16px 45px -30px #1a3e7070;
  --focus-ring: 0 0 0 3px #2458b82b;
  --scrim: #0c193c70;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0a1424;
  --sheet: #101f34;
  --sheet-2: #15283f;
  --ink: #e8f0fc;
  --ink-2: #bdcde3;
  --ink-3: #a0b3ce;
  --rule: #2a405d;
  --rule-2: #456181;
  --cobalt: #96baff;
  --cobalt-ink: #c1d6ff;
  --cobalt-tint: #1b3255;
  --rose: #96baff;
  --rose-light: #1b3255;
  --theme-action: #3265c6;
  --theme-action-hover: #3a6dd0;
  --theme-accent-line: #42669c;
  --theme-icon: #a6c4ee;
  --theme-hero: #162d4d;
  --theme-header: #0d1a2df5;
  --theme-shadow: 0 18px 48px -26px #000b;
  --focus-ring: 0 0 0 3px #96baff40;
  --scrim: #030916b8;
  --ok: #a4e1bd;
  --ok-tint: #11372c;
  --warn: #f2cf91;
  --warn-tint: #3c301b;
  --bad: #ffb8b2;
  --bad-tint: #42272c;
}

html[data-theme] body,
html[data-theme] .product-front {
  --portal-ink: var(--ink);
  --portal-copy: var(--ink-2);
  --portal-muted: var(--ink-3);
  --portal-line: var(--rule);
  background: var(--paper);
  color: var(--ink);
}

/* The switch shows the current theme as its visible label. */
.theme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  height: 42px;
  min-width: 42px;
  padding: 8px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink-2);
  font: 500 .875rem/1.4 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}
.theme-toggle:hover { color: var(--cobalt-ink); background: var(--cobalt-tint); border-color: var(--theme-accent-line); }
.theme-toggle svg { width: 18px; height: 18px; flex: none; }
.portal-header .theme-toggle { margin-left: 0; }
.header-tools .theme-toggle { height: 39px; }

/* Headers, navigation and common controls. */
html[data-theme] .site-header,
html[data-theme] .portal-header { background: var(--theme-header); border-color: var(--rule); }
html[data-theme] .studio-sidebar,
html[data-theme] .rail,
html[data-theme] .site-footer,
html[data-theme] .portal-footer { background: var(--paper); border-color: var(--rule); }
html[data-theme] .brand-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 36' fill='none'%3E%3Cpath d='M16 2 30 10v16l-14 8L2 26V10Z' stroke='%232458b8' stroke-width='1.5'/%3E%3Cpath d='m2 10 14 8 14-8M16 18v16M9 14V9l7-4 7 4v5M9 21l7 4 7-4' stroke='%237c9dcb' stroke-width='1.4'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .brand-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 36' fill='none'%3E%3Cpath d='M16 2 30 10v16l-14 8L2 26V10Z' stroke='%2396baff' stroke-width='1.5'/%3E%3Cpath d='m2 10 14 8 14-8M16 18v16M9 14V9l7-4 7 4v5M9 21l7 4 7-4' stroke='%236d98d8' stroke-width='1.4'/%3E%3C/svg%3E");
}
html[data-theme] .btn-primary,
html[data-theme] .product-front .btn-primary,
html[data-theme] .btn-primary:hover,
html[data-theme] .product-front .btn-primary:hover {
  background: var(--theme-action);
  border-color: var(--theme-action);
  color: #fff;
}
html[data-theme] .btn-primary:hover,
html[data-theme] .product-front .btn-primary:hover { background: var(--theme-action-hover); border-color: var(--theme-action-hover); }
html[data-theme] .btn-secondary { background: var(--sheet); border-color: var(--rule-2); color: var(--ink); }
html[data-theme] .btn-secondary:hover { background: var(--sheet-2); border-color: var(--theme-icon); color: var(--ink); }
html[data-theme] .btn-quiet { color: var(--cobalt-ink); }
html[data-theme] .btn-quiet:hover,
html[data-theme] .icon-btn:hover { background: var(--cobalt-tint); color: var(--cobalt-ink); }
html[data-theme] .inline-link,
html[data-theme] .guide-terms a,
html[data-theme] .portal-text-link,
html[data-theme] .portal-details a,
html[data-theme] .portal-chain { color: var(--cobalt-ink); }
html[data-theme] .inline-link:hover,
html[data-theme] .guide-terms a:hover,
html[data-theme] .portal-text-link:hover { color: var(--cobalt); }
html[data-theme] :focus-visible { outline-color: var(--cobalt); }
html[data-theme] .studio-nav-link:hover,
html[data-theme] .rail a:hover,
html[data-theme] .portal-sidebar nav a:hover { background: var(--sheet-2); color: var(--ink); }
html[data-theme] .studio-nav-link[aria-current="page"],
html[data-theme] .rail a[aria-current="page"],
html[data-theme] .portal-sidebar nav a.is-active { color: var(--cobalt-ink); background: var(--cobalt-tint); border-color: var(--theme-accent-line); }
html[data-theme] .studio-nav-link svg,
html[data-theme] .rail a svg,
html[data-theme] .metric-label svg,
html[data-theme] .card-label svg,
html[data-theme] .studio-search svg,
html[data-theme] .resource-card svg,
html[data-theme] .sidebar-bottom > div,
html[data-theme] .research-file,
html[data-theme] .quick-actions > a > [data-icon],
html[data-theme] .quick-plus { color: var(--theme-icon); }
html[data-theme] .studio-nav-link[aria-current="page"] svg,
html[data-theme] .rail a[aria-current="page"] svg { color: var(--cobalt-ink); }
html[data-theme] .net { background: var(--sheet); }
html[data-theme] .rail .count { background: var(--sheet-2); border-color: var(--rule); }
html[data-theme] .breadcrumb > span { color: var(--ink-3); }

/* Portal surfaces retain the same proportions and hierarchy in both modes. */
html[data-theme] .portal-hero { background: linear-gradient(110deg, var(--sheet) 40%, var(--theme-hero) 100%); }
html[data-theme] .portal-entry,
html[data-theme] .portal-details { background: var(--sheet); }
html[data-theme] .portal-entry:hover { background: var(--sheet-2); border-color: var(--theme-icon); box-shadow: var(--theme-shadow); }
html[data-theme] .portal-entry-icon,
html[data-theme] .portal-art-chip,
html[data-theme] .portal-step-icon { background: var(--cobalt-tint); border-color: var(--theme-accent-line); color: var(--cobalt-ink); }
html[data-theme] .portal-entry-bottom { color: var(--cobalt-ink); border-color: var(--rule); }
html[data-theme] .portal-assurance svg,
html[data-theme] .portal-sidebar-note > svg,
html[data-theme] .portal-details summary svg,
html[data-theme] .portal-detail-plus,
html[data-theme] .portal-art figcaption > svg { color: var(--cobalt); }
html[data-theme] .portal-eyebrow,
html[data-theme] .product-front h1 > span { color: var(--cobalt-ink); }
html[data-theme] .portal-protocol { background: var(--sheet-2); }
html[data-theme] .portal-art > figcaption { background: var(--sheet); border-color: var(--rule-2); }
html[data-theme] .portal-art-grid { background-image: radial-gradient(circle, var(--theme-icon) .6px, transparent .8px); opacity: .48; }
html[data-theme] .portal-art > img { filter: hue-rotate(25deg); }
html[data-theme="dark"] .portal-art > img { filter: hue-rotate(25deg) brightness(.86); }
html[data-theme] .portal-mobile-tabs a.is-active { color: var(--cobalt-ink); border-color: var(--cobalt); }
html[data-theme] .front-mobile-nav summary { color: var(--ink); border-color: var(--rule-2); }
html[data-theme] .front-mobile-nav > nav { background: var(--sheet); border-color: var(--rule); box-shadow: var(--theme-shadow); }
html[data-theme] .front-mobile-nav nav a { color: var(--ink); }

/* Workspace cards, listing tables, filters and protocol illustrations. */
html[data-theme] .metric-card,
html[data-theme] .studio-card,
html[data-theme] .panel,
html[data-theme] .capsule,
html[data-theme] .capsule-body,
html[data-theme] .capsule-foot,
html[data-theme] .research-file,
html[data-theme] .market-toolbar,
html[data-theme] .search-field,
html[data-theme] .studio-search,
html[data-theme] .empty,
html[data-theme] .is-empty .empty,
html[data-theme] .page-head-row #market-count,
html[data-theme] .guide-tabs button { background: var(--sheet); border-color: var(--rule); }
html[data-theme] .studio-chip { background: var(--sheet-2); color: var(--ink-3); border-color: var(--rule-2); }
html[data-theme] .quick-actions > a:hover { background: var(--sheet-2); }
html[data-theme] .research-table th { background: var(--sheet-2); color: var(--ink-2); }
html[data-theme] .research-table tbody tr:hover { background: var(--sheet-2); }
html[data-theme] .research-table .mode,
html[data-theme] .capsule .mode,
html[data-theme] .guidance-icon { background: var(--cobalt-tint); border-color: var(--theme-accent-line); color: var(--cobalt-ink); }
html[data-theme] .research-table .mode svg,
html[data-theme] .capsule .mode svg { color: var(--theme-icon); }
html[data-theme] .redact-bar { background: var(--rule-2); }
html[data-theme] .guide-label,
html[data-theme] .studio-exchange li::before { color: var(--cobalt-ink); border-color: var(--theme-accent-line); }
html[data-theme] .guide-comparison li::before { background: var(--theme-icon); }
html[data-theme] .welcome-art-back { background: var(--sheet-2); border-color: var(--rule); }
html[data-theme] .welcome-art-front,
html[data-theme] .art-corner { background: var(--sheet); border-color: var(--rule-2); }
html[data-theme] .welcome-art-front i { background: var(--rule-2); }
html[data-theme] .guide-tabs button[aria-selected="true"] { color: var(--cobalt-ink); border-color: var(--cobalt); }
html[data-theme] .skeleton { background: var(--sheet-2); border-color: var(--rule); }
html[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, #7a9ac11c, transparent); }

/* Forms, key material, Terms and modal surfaces. */
html[data-theme] .input,
html[data-theme] .textarea,
html[data-theme] .select,
html[data-theme] .choice .choice-body { background-color: var(--sheet); color: var(--ink); border-color: var(--rule-2); }
html[data-theme] .input:hover,
html[data-theme] .textarea:hover,
html[data-theme] .select:hover { border-color: var(--theme-icon); }
html[data-theme] .input:focus,
html[data-theme] .textarea:focus,
html[data-theme] .select:focus,
html[data-theme] .studio-search:focus-within { border-color: var(--cobalt); box-shadow: var(--focus-ring); }
html[data-theme] .input.is-invalid,
html[data-theme] .textarea.is-invalid { border-color: var(--bad); }
html[data-theme] .choice input:checked + .choice-body { background: var(--cobalt-tint); border-color: var(--cobalt); box-shadow: inset 0 0 0 1px var(--cobalt); }
html[data-theme] .step-n { background: var(--sheet); color: var(--ink-3); border-color: var(--rule-2); }
html[data-theme] .step[data-done="true"] .step-n { background: var(--theme-action); color: #fff; border-color: var(--theme-action); }
html[data-theme] .terms-doc,
html[data-theme] .terms-side,
html[data-theme] .menu-pop,
html[data-theme] .dialog,
html[data-theme] .toast,
html[data-theme] .wallet-option { background: var(--sheet); color: var(--ink); border-color: var(--rule); }
html[data-theme] .dialog,
html[data-theme] .menu-pop { box-shadow: var(--theme-shadow); }
html[data-theme] .dialog-backdrop { background: var(--scrim); }
html[data-theme] .menu-item:hover { background: var(--sheet-2); }
html[data-theme] .callout:not([data-tone]),
html[data-theme] .callout[data-tone="info"],
html[data-theme] .key-value,
html[data-theme] .reveal-box,
html[data-theme] .hexbox { background: var(--sheet-2); border-color: var(--rule); }
html[data-theme] .terms-doc .terms-lede { background: var(--cobalt-tint); color: var(--ink-2); border-color: var(--cobalt); }
html[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='m1 1 5 5 5-5' stroke='%23bdcde3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Semantic notices keep their green, amber and red meanings in dark appearance. */
html[data-theme="dark"] .callout[data-tone="warn"],
html[data-theme="dark"] .notice-bar[data-tone="warn"],
html[data-theme="dark"] .tag[data-tone="warn"],
html[data-theme="dark"] .net[data-state="warn"] { color: var(--warn); background: var(--warn-tint); border-color: #785f34; }
html[data-theme="dark"] .callout[data-tone="bad"],
html[data-theme="dark"] .notice-bar[data-tone="bad"],
html[data-theme="dark"] .tag[data-tone="bad"],
html[data-theme="dark"] .net[data-state="bad"] { color: var(--bad); background: var(--bad-tint); border-color: #80515b; }
html[data-theme="dark"] .callout[data-tone="ok"],
html[data-theme="dark"] .tag[data-tone="ok"] { color: var(--ok); background: var(--ok-tint); border-color: #3d705d; }
html[data-theme="dark"] .callout[data-tone="warn"] strong { color: var(--warn); }
html[data-theme="dark"] .callout[data-tone="bad"] strong { color: var(--bad); }
html[data-theme="dark"] .callout[data-tone="ok"] strong { color: var(--ok); }
html[data-theme="dark"] .setup-list li.is-done > span { color: var(--ok); background: var(--ok-tint); border-color: #3d705d; }
html[data-theme="dark"] .btn-danger { background: var(--sheet); color: var(--bad); border-color: #80515b; }
html[data-theme="dark"] .btn-danger:hover { background: var(--bad-tint); }
html[data-theme="dark"] .erased-note { color: var(--warn); }

/* A concise notice leads to the full protocol disclaimer. */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 19px 21px;
  margin-block: 22px 0;
  background: var(--sheet-2);
  border: 1px solid var(--rule);
  border-radius: 7px;
  color: var(--ink-2);
  text-align: left;
}
.disclaimer-banner-icon { flex: 0 0 auto; color: var(--cobalt); margin-top: 2px; }
.disclaimer-banner-icon svg { width: 21px; height: 21px; }
.disclaimer-banner-copy { flex: 1 1 auto; min-width: 0; }
.disclaimer-banner-copy strong { display: block; color: var(--ink); font-size: .9375rem; font-weight: 500; line-height: 1.5; }
.disclaimer-banner-copy p { margin: 5px 0 0; color: var(--ink-2); font-size: .875rem; line-height: 1.75; max-width: 85ch; }
.disclaimer-banner-link { color: var(--cobalt-ink); font-size: .875rem; font-weight: 500; line-height: 1.6; flex-shrink: 0; text-underline-offset: 3px; }
.disclaimer-page { padding-block: 38px 44px; }
.disclaimer-page > h1,
.disclaimer-page .page-head h1 { font-size: clamp(2rem, 3.5vw, 3rem); color: var(--ink); line-height: 1.15; }
.disclaimer-summary { max-width: 820px; font-size: 1.125rem; line-height: 1.8; color: var(--ink-2); margin: 20px 0 30px; }
.disclaimer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.disclaimer-panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 27px 29px; min-width: 0; scroll-margin-top: 95px; }
.disclaimer-panel h2 { font-size: 1.375rem; line-height: 1.4; color: var(--ink); margin: 0 0 14px; }
.disclaimer-panel p,
.disclaimer-panel li { font-size: 1rem; line-height: 1.85; color: var(--ink-2); }
.disclaimer-panel p:last-child { margin-bottom: 0; }
.disclaimer-panel li + li { margin-top: 8px; }
.disclaimer-panel a,
.disclaimer-note a { color: var(--cobalt-ink); text-underline-offset: 3px; }
.disclaimer-note { background: var(--cobalt-tint); border: 1px solid var(--theme-accent-line); color: var(--ink-2); padding: 23px 27px; border-radius: 8px; font-size: 1rem; line-height: 1.85; margin-block: 25px; }
.disclaimer-note strong { color: var(--ink); }

@media (max-width: 1380px) {
  .portal-header > .portal-container { gap: 18px; }
  .portal-desktop-nav { gap: 23px; }
}
@media (max-width: 960px) {
  .portal-header > .portal-container { gap: 15px; }
  .theme-toggle { padding-inline: 10px; }
}
@media (max-width: 740px) {
  .theme-toggle { width: 40px; min-width: 40px; padding-inline: 0; }
  .theme-toggle-label { display: none; }
  .portal-header .theme-toggle { margin-left: auto; }
  .portal-header .portal-header-cta { margin-left: 0; }
  html[data-theme] .portal-art { background: var(--theme-hero); border-color: var(--rule); }
  .header-tools { gap: 9px; }
  .header-tools .theme-toggle { width: 38px; min-width: 38px; }
  .disclaimer-banner { flex-wrap: wrap; gap: 11px; padding: 18px; }
  .disclaimer-banner-link { margin-left: 32px; }
  .disclaimer-grid { grid-template-columns: 1fr; gap: 16px; }
  .disclaimer-page { padding-block: 30px; }
  .disclaimer-panel { padding: 24px; }
  .disclaimer-summary { font-size: 1.0625rem; }
}
@media (max-width: 500px) {
  .portal-header > .portal-container { gap: 8px; }
  .portal-header .theme-toggle { width: 36px; min-width: 36px; height: 40px; }
  .portal-header .portal-header-cta { padding-inline: 10px; }
  .front-mobile-nav summary { width: 38px; height: 40px; }
  .site-header > .container { gap: 9px; }
  .header-tools { gap: 7px; }
  .header-tools .theme-toggle { width: 34px; min-width: 34px; height: 37px; }
  .disclaimer-banner-copy p { font-size: .875rem; }
  .disclaimer-panel { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { .theme-toggle { transition: none; } }

/* The disclosure page shares the portal header but keeps long-form text measured. */
.disclaimer-summary { max-width: 1030px; }
.disclaimer-summary h1 { font-size: clamp(2.125rem, 3.8vw, 3.3rem); line-height: 1.15; max-width: 980px; margin: 0; }
.disclaimer-summary > p:not(.portal-eyebrow) { max-width: 84ch; font-size: 1.125rem; line-height: 1.8; margin: 22px 0 15px; color: var(--ink-2); }
.disclaimer-summary .portal-eyebrow { margin-bottom: 17px; }
.disclaimer-updated { display: block; font-size: .875rem; line-height: 1.6; color: var(--ink-3); }
.disclaimer-note { display: flex; align-items: flex-start; gap: 18px; }
.disclaimer-note > svg { width: 28px; height: 28px; color: var(--cobalt); flex: 0 0 auto; margin-top: 2px; }
.disclaimer-note > div { min-width: 0; }
.disclaimer-note h2 { font-size: 1.25rem; line-height: 1.5; margin: 0 0 9px; color: var(--ink); }
.disclaimer-note p { font-size: 1rem; line-height: 1.85; margin: 0; color: var(--ink-2); }
.disclaimer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px 26px; margin-top: 28px; }
.portal-content-notice .disclaimer-banner { margin-top: 18px; }
.site-footer .disclaimer-banner { margin: 0 0 24px; }
html[data-theme="dark"] .disclaimer-panel strong { color: var(--ink); }
@media (max-width: 740px) {
  .disclaimer-summary h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
  .disclaimer-summary > p:not(.portal-eyebrow) { font-size: 1.0625rem; }
  .disclaimer-note { padding: 21px; gap: 13px; }
  .disclaimer-note > svg { width: 23px; height: 23px; }
  .disclaimer-note h2 { font-size: 1.125rem; }
}

/* Network availability keeps its warning/error tint in either appearance. */
html[data-theme] .net[data-state="warn"] { color: var(--warn); background: var(--warn-tint); }
html[data-theme] .net[data-state="bad"] { color: var(--bad); background: var(--bad-tint); }
