/* Family Screen Balance Learn cluster extensions v1.
 * The mature Family Lab article shell remains in child-temperament-learn.v1.css;
 * this versioned layer owns Family Screen Balance utilities, prose lists, comparison tables, directory, and citation UI.
 */

body[data-learn-cluster="family-screen-balance"] {
  --accent: var(--family);
  --accent-soft: var(--family-soft);
  --copy-bg: var(--family);
}


/* Ordinary article lists retain native semantics while using the Family accent.
 * Classed sources, directories, navigation, and footer lists keep their own UI. */
body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  :where(ul, ol):not([class]) {
  display: grid;
  gap: 0.75rem;
  margin: var(--space-5, 1.25rem) 0 var(--space-8, 2rem);
  padding-inline-start: 1.75rem;
  color: var(--text-secondary, #b4bac8);
}

body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  ol:not([class]) {
  padding-inline-start: 2.15rem;
}

body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  :where(ul, ol):not([class]) > li {
  min-width: 0;
  padding-inline-start: 0.35rem;
  color: var(--text-secondary, #b4bac8);
  font-size: 1.0625rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  ul:not([class]) > li::marker {
  color: var(--accent, #c98ad6);
  font-size: 1.08em;
}

body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  ol:not([class]) > li::marker {
  color: var(--child-temperament-accent-strong, #e0aae9);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.92em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
  :where(ul, ol):not([class]) > li > :where(ul, ol):not([class]) {
  margin-block: 0.75rem 0.25rem;
}

/* Comparison tables use the established Family Screen Balance hierarchy while their
 * wrapper remains the only horizontal scroller on narrow viewports. */
body[data-learn-cluster="family-screen-balance"] .article-body .cmp-wrap {
  max-width: 100%;
  margin: var(--space-8, 2rem) 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid rgba(201, 138, 214, 0.34);
  border-radius: var(--radius-md, 12px);
  background:
    linear-gradient(145deg, rgba(201, 138, 214, 0.055), rgba(16, 19, 26, 0)),
    var(--bg-raised, #10131a);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  scrollbar-color: var(--accent, #c98ad6) var(--bg-raised, #10131a);
  -webkit-overflow-scrolling: touch;
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-wrap:focus-visible {
  outline: 3px solid var(--accent, #c98ad6);
  outline-offset: 4px;
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-wrap > .cmp-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-secondary, #b4bac8);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table :where(th, td) {
  padding: 1rem 1.125rem;
  border: 0;
  text-align: left;
  vertical-align: top;
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table thead th {
  border-bottom: 1px solid rgba(201, 138, 214, 0.34);
  background: linear-gradient(
    180deg,
    rgba(201, 138, 214, 0.18),
    rgba(201, 138, 214, 0.10)
  );
  color: var(--child-temperament-accent-strong, #e0aae9);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  line-height: 1.5;
  text-transform: uppercase;
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table tbody tr + tr > * {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table tbody tr:nth-child(even) > * {
  background: rgba(255, 255, 255, 0.018);
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table tbody tr:hover > * {
  background: rgba(201, 138, 214, 0.055);
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table tbody td {
  color: var(--text-secondary, #b4bac8);
}

body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table tbody td:first-child {
  min-width: 9rem;
  color: var(--text, #f4f2ed);
  font-weight: 650;
}

.family-screen-balance-static-utility {
  border-color: rgba(201, 138, 214, 0.42);
  background:
    radial-gradient(circle at 95% 4%, rgba(201, 138, 214, 0.12), transparent 34%),
    var(--bg-raised, #10131a);
}

.family-screen-balance-utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.family-screen-balance-utility-grid > div {
  min-width: 0;
  padding: 1.15rem;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 8px);
  background: rgba(201, 138, 214, 0.06);
}

.family-screen-balance-utility-grid h3 {
  margin: 0 0 0.45rem;
  color: var(--accent-bright, #e0aae9);
  font-size: 1rem;
  line-height: 1.45;
}

.family-screen-balance-utility-grid p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary, #b4bac8);
  font-size: 1rem;
  line-height: 1.7;
}

.family-screen-balance-cluster-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: family-screen-balance-guide;
}

.family-screen-balance-cluster-list li {
  min-width: 0;
  counter-increment: family-screen-balance-guide;
}

.family-screen-balance-cluster-list a {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.7rem;
  height: 100%;
  padding: 1rem;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 8px);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary, #b4bac8);
  font-size: 1rem;
  line-height: 1.55;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.family-screen-balance-cluster-list a::before {
  content: counter(family-screen-balance-guide, decimal-leading-zero);
  color: var(--accent, #c98ad6);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.875rem;
  font-weight: 700;
}

.family-screen-balance-cluster-list a:hover,
.family-screen-balance-cluster-list a[aria-current="page"] {
  border-color: var(--accent, #c98ad6);
  background: rgba(201, 138, 214, 0.09);
  color: var(--text, #f4f2ed);
}

.family-screen-balance-cluster-list a:focus-visible,
.family-screen-balance-support-links a:focus-visible,
.how-to-cite a:focus-visible {
  outline: 3px solid var(--accent-bright, #e0aae9);
  outline-offset: 3px;
}

.family-screen-balance-support-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 1.35rem 0 0;
}

.family-screen-balance-support-links a {
  color: var(--accent-bright, #e0aae9);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
}

.how-to-cite {
  width: min(100% - 2rem, var(--content-width, 820px));
  max-width: var(--content-width, 820px);
  margin: clamp(2.5rem, 6vw, 4.5rem) auto 2rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid rgba(201, 138, 214, 0.36);
  border-radius: var(--radius-md, 14px);
  background:
    linear-gradient(145deg, rgba(201, 138, 214, 0.09), rgba(86, 184, 108, 0.04)),
    var(--bg-raised, #10131a);
  color: var(--text-secondary, #b4bac8);
  overflow: hidden;
}

.how-to-cite-eyebrow {
  margin-bottom: 0.55rem;
  color: var(--accent, #c98ad6);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

.how-to-cite h2 {
  margin: 0 0 0.8rem;
  color: var(--text, #f4f2ed);
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.2;
}

.how-to-cite-intro {
  max-width: 68ch;
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.75;
}

.how-to-cite-block {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
}

.how-to-cite-row {
  display: grid;
  grid-template-columns: minmax(9rem, 10rem) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
  background: rgba(8, 10, 14, 0.38);
}

.how-to-cite-row + .how-to-cite-row {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.12));
}

.how-to-cite-label {
  color: var(--accent-bright, #e0aae9);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.55;
}

.how-to-cite-text {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary, #b4bac8);
  font-size: 1rem;
  line-height: 1.75;
}

.how-to-cite-text a {
  color: var(--accent-bright, #e0aae9);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.how-to-cite-bibtex {
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  color: var(--text-secondary, #b4bac8);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1rem;
  line-height: 1.65;
  white-space: pre;
}

.how-to-cite-bibtex code {
  font: inherit;
}

@media (max-width: 700px) {
  body[data-learn-cluster="family-screen-balance"] .breadcrumb {
    flex-wrap: wrap;
    row-gap: 0.375rem;
  }

  body[data-learn-cluster="family-screen-balance"] .breadcrumb > .sep:nth-last-child(2),
  body[data-learn-cluster="family-screen-balance"] .breadcrumb > [aria-current="page"] {
    display: none;
  }

  .family-screen-balance-utility-grid,
  .family-screen-balance-cluster-list {
    grid-template-columns: 1fr;
  }

  .how-to-cite {
    width: min(100% - 1.25rem, var(--content-width, 820px));
    margin-top: 2.25rem;
  }

  .how-to-cite-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }


  body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
    :where(ul, ol):not([class]) {
    padding-inline-start: 1.45rem;
  }

  body[data-learn-cluster="family-screen-balance"] .article-body .guide-section
    ol:not([class]) {
    padding-inline-start: 1.85rem;
  }

  body[data-learn-cluster="family-screen-balance"] .article-body .cmp-table :where(th, td) {
    padding: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .family-screen-balance-cluster-list a {
    scroll-behavior: auto;
    transition: none !important;
  }
}

@media print {
  .how-to-cite {
    width: 100%;
    max-width: none;
    border-color: #888;
    background: transparent;
    color: #111;
    break-inside: avoid;
  }

  .how-to-cite h2,
  .how-to-cite-label,
  .how-to-cite-text,
  .how-to-cite-bibtex,
  .how-to-cite-text a {
    color: #111;
  }
}
