/*
 * Norelyn Learn / Color system v4 — Norelyn official Mist Blue
 * One palette for public pages, Learning, articles, profile and account controls.
 * Loaded after legacy styles and square.css so colors are not scattered across
 * old, conflicting stylesheets. This file deliberately changes color, not layout.
 *
 * Light tokens match Norelyn-site/home.css (official Mist Blue). Dark mode uses a true-black canvas, neutral charcoal surfaces, and the existing brand accent.
 * Text/accent pairings meet WCAG AA for normal-sized text.
 */
:root {
  --bg: #F6F9FA;
  --surface: #FFFFFF;
  --ink: #171A1C;
  --muted: #68747C;
  --line: #DDE3E6;
  --soft: #DCE7ED;
  --accent: #5F7F96;
  --accent-soft: #DCE7ED;
  --accent-text: #314B5D; /* Norelyn site's --accent-deep: accessible on white */
  --brand-primary: #314B5D;
  --brand-primary-hover: #526F84; /* Norelyn site's --accent-hover */

  --brand-cta-ink: #FFFFFF;
  --brand-header: rgba(246, 249, 250, .86);
  --brand-border-strong: #C8D3D8;
  --brand-panel-hover: #F8FAFB;
  --brand-row-hover: rgba(95, 127, 150, .045);
  --brand-code-bg: #171A1C;
  --brand-code-ink: #F6F9FA;
  --brand-warning-bg: #FFF4DB;
  --brand-warning-ink: #6B4410;
  --brand-warning-border: #E9C77A;
  accent-color: var(--accent);
}

html:not([data-theme="dark"]) body {
  background: var(--bg);
  color: var(--ink);
}

/* Dark mode deliberately has no navy or purple-tinted backgrounds:
   every Learn route uses a true-black canvas and neutral charcoal surfaces. */
html[data-theme="dark"] body {
  --bg: #000000;
  --surface: #0C0C0C;
  --ink: #F5F5F5;
  --muted: #BDBDBD;
  --line: #303030;
  --soft: #181818;
  --accent: #B4CEDD;
  --accent-soft: #252525;
  --accent-text: #B4CEDD;
  --brand-primary: #B4CEDD;
  --brand-primary-hover: #D2E3EC;

  --brand-cta-ink: #0B0B0B;
  --brand-header: #000000;
  --brand-border-strong: #565656;
  --brand-panel-hover: #171717;
  --brand-row-hover: rgba(255, 255, 255, .045);
  --brand-code-bg: #101010;
  --brand-code-ink: #F5F5F5;
  --brand-warning-bg: #2B2112;
  --brand-warning-ink: #F6DCA8;
  --brand-warning-border: #66522B;

  background: #000000;
  color: var(--ink);
}

/* 01. Site chrome — low-contrast surface, readable active navigation. */
body .site-header {
  background: var(--brand-header);
  border-bottom-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] body .site-header {
  background: var(--brand-header);
  border-bottom-color: var(--line);
}

/* Cover the shared shell and all major product surfaces with the same
   black/charcoal treatment, instead of inheriting older blue-green overlays. */
html[data-theme="dark"] body .site-footer,
html[data-theme="dark"] body .site-header,
html[data-theme="dark"] body .nav {
  background: #000000;
}
html[data-theme="dark"] body .site-tools,
html[data-theme="dark"] body .theme-toggle,
html[data-theme="dark"] body .learning-account-inner,
html[data-theme="dark"] body .my-learning-item,
html[data-theme="dark"] body .profile-panel,
html[data-theme="dark"] body .profile-stats article,
html[data-theme="dark"] body .agent-card,
html[data-theme="dark"] body .agent-library-main,
html[data-theme="dark"] body .agent-library-side {
  background: var(--surface);
  border-color: var(--line);
}
html[data-theme="dark"] body .article-note,
html[data-theme="dark"] body .article-flow,
html[data-theme="dark"] body .learn-search-control,
html[data-theme="dark"] body .explore-search-wrap {
  background: var(--surface);
  border-color: var(--line);
}
html[data-theme="dark"] body .article-body pre,
html[data-theme="dark"] body .toolkit-app-facts,
html[data-theme="dark"] body .article-body code:not(pre code) {
  border-color: var(--line);
}
html[data-theme="dark"] body .article-body pre {
  background: var(--brand-code-bg);
}
html[data-theme="dark"] body .article-body code:not(pre code) {
  background: var(--soft);
}


.site-header .nav a,
body .nav a,
.site-footer,
.site-footer a,
.footer-product-label {
  color: var(--muted);
}

.site-header .nav a:hover,
.site-header .nav a:focus-visible,
.site-header .nav a[aria-current="page"],
.site-footer a:hover {
  color: var(--ink);
}

html[data-theme="dark"] body .site-header .nav a {
  color: var(--muted);
}

html[data-theme="dark"] body .site-header .nav a:hover,
html[data-theme="dark"] body .site-header .nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  text-decoration-color: var(--accent);
}

body .site-footer {
  border-top-color: var(--line);
  background: var(--bg);
}

body .site-tools {
  border-color: var(--line);
}

body .theme-toggle {
  color: var(--ink);
}

body .brand-product,
body .footer-brand,
body .section-kicker span:first-child {
  color: var(--ink);
}

/* 02. Homepage — restrained Mist Blue actions and quiet editorial panels. */
.agent-product {
  --agent-panel: var(--surface);
  --agent-panel-strong: var(--surface);
  --agent-accent-soft: var(--accent-soft);
}

.agent-product .agent-kicker,
.agent-product .agent-card small,
.article-kicker,
.profile-kicker {
  color: var(--accent-text);
}

.agent-product .agent-hero h1,
.learn-hero h1,
.article-header h1,
.profile-hero h1 {
  color: var(--ink);
}

.agent-product .agent-button,
.profile-button,
.learning-inline-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.agent-product .agent-button:hover,
.profile-button:hover,
.learning-inline-button:hover {
  background: var(--brand-panel-hover);
  border-color: var(--brand-border-strong);
}

.agent-product .agent-button.primary,
.profile-button.primary,
.learning-inline-button.primary,
.button.primary {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-cta-ink);
}

.agent-product .agent-button.primary:hover,
.profile-button.primary:hover,
.learning-inline-button.primary:hover,
.button.primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  color: var(--brand-cta-ink);
}

.learning-inline-button.primary span,
.learning-track-button.primary span {
  color: var(--brand-cta-ink);
}

.agent-product .agent-card,
.agent-product .agent-library-main,
.agent-product .agent-library-side {
  background: var(--surface);
  border-color: var(--line);
}

.agent-product .agent-card:hover {
  background: var(--brand-panel-hover);
  border-color: var(--brand-border-strong);
}

.agent-product .agent-card-foot,
.agent-product .agent-link-list,
.agent-product .agent-link-list a {
  border-color: var(--line);
}

/* 03. Courses and the public library — neutral reading surfaces. */
.learn-list,
.learn-card,
.learn-search-result,
.article-related-card,
.section-kicker {
  border-color: var(--line);
}

a.learn-card:hover,
a.learn-search-result:hover,
a.article-related-card:hover {
  background: var(--brand-row-hover);
}

.learning-account-inner,
.my-learning-item,
.profile-stats article,
.profile-panel {
  background: var(--surface);
  border-color: var(--line);
}

.learning-path-account-progress,
.learning-path-account-track,
.my-learning-progress,
.profile-progress-track {
  border-color: var(--line);
}

.my-learning-progress,
.learning-path-account-track,
.profile-progress-track {
  background: var(--soft);
}

.my-learning-progress > span,
.learning-path-account-track i,
.profile-progress-track i {
  background: var(--accent);
}

.learning-path-account-progress-copy strong,
.learning-course-continue,
.profile-panel h2 {
  color: var(--ink);
}

.learn-card-arrow,
.learn-search-result-state,
.profile-online-dot {
  color: var(--accent-text);
}

.profile-online-dot {
  background: var(--accent);
}

/* 04. Long-form lessons, links, and code blocks. */
.article-body a:not(.button),
.article-breadcrumb a:hover,
.article-side-toc a.is-active,
.article-side-toc a:hover {
  color: var(--accent-text);
}

.article-body pre {
  background: var(--brand-code-bg);
  color: var(--brand-code-ink);
  border-color: var(--line);
}

.article-body code:not(pre code) {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--line);
}

html[data-theme="dark"] body .article-body code:not(pre code) {
  background: var(--soft);
}

.article-body pre code {
  color: inherit;
}

.article-body blockquote {
  border-left-color: var(--accent);
}

body .article-side-toc,
body .article-toc-nav {
  color: var(--muted);
}

/* 05. Accessible inputs, status and selections. */
.profile-form input,
.profile-form textarea,
.learn-search-input {
  color: var(--ink);
  caret-color: var(--accent);
}

.profile-form input,
.profile-form textarea {
  background: var(--surface);
  border-color: var(--line);
}

.profile-form input:focus,
.profile-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

body .learn-search-control:focus-within,
body .explore-search-wrap:focus-within {
  border-bottom-color: var(--accent) !important;
}

:focus-visible {
  outline-color: var(--accent);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

.learn-sync-warning {
  border-color: var(--brand-warning-border);
  background: var(--brand-warning-bg);
  color: var(--brand-warning-ink);
}

/* Phone layouts keep the same visual hierarchy with no alternate hue drift. */
@media (max-width: 900px) {
  body.subpage .nav,
  html[data-theme="dark"] body .nav {
    background: var(--bg);
    border-bottom-color: var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-product .agent-card {
    transition: none;
  }
}
