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

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

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

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

.family-routine-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(94, 196, 201, 0.06);
}

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

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

.family-routine-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-routine-guide;
}

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

.family-routine-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-routine-cluster-list a::before {
  content: counter(family-routine-guide, decimal-leading-zero);
  color: var(--accent, #5ec4c9);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.875rem;
  font-weight: 700;
}

.family-routine-cluster-list a:hover,
.family-routine-cluster-list a[aria-current="page"] {
  border-color: var(--accent, #5ec4c9);
  background: rgba(94, 196, 201, 0.09);
  color: var(--text, #f4f2ed);
}

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

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

.family-routine-support-links a {
  color: var(--accent-bright, #a8ecb9);
  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(94, 196, 201, 0.36);
  border-radius: var(--radius-md, 14px);
  background:
    linear-gradient(145deg, rgba(94, 196, 201, 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, #5ec4c9);
  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, #a8ecb9);
  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, #a8ecb9);
  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-routine"] .breadcrumb {
    flex-wrap: wrap;
    row-gap: 0.375rem;
  }

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

  .family-routine-utility-grid,
  .family-routine-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;
  }
}

@media (prefers-reduced-motion: reduce) {
  .family-routine-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;
  }
}
