@layer site {
/* Shared rules from orders 020–024 that more than one page type uses (order 027, DES-011, status in
   docs/orders/027-progress.md). Page-type, home-page and site-chrome rules have moved to their owners; what is left
   moves with its component in the planned order: editorial and reading surfaces with guides and the blog, tool cards
   and documents with the catalogue and the PDF library. */

/* Interaction identity of orders 020–022: focus ring, selection, link underline offset and control radius. Loaded after
   every page-type stylesheet on purpose, so it wins over their rules of the same weight (a page type that needs another
   focus ring writes a more specific rule). Order 027 tried it before the page types and the focus rings changed. */
[data-refined] ::selection { color: var(--primary-dark); background: #d1e2c9; }
[data-refined] :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
[data-refined] :is(a, summary) { text-underline-offset: .19em; }
[data-refined] :is(.btn-primary, .btn-secondary, .hk-btn, .fc-btn, .cx-btn) { border-radius: var(--control-radius); }

/* Line icons in editorial rows. */
.editorial-emblem, .editorial-read svg {
  fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  [data-refined] :is(.cx-dialog, .editorial-entry, .product-nav, .hk-panel) { animation: none; transition: none; }
}

/* Headings on tool pages and the document library pages. */
[data-refined] .page-container:has(.tool-page) .page-header h1 {
  font-size: clamp(1.93rem, 4.2vw, 3.55rem);
  text-wrap: pretty;
}
[data-refined="vab"] .guide > .meta { text-align: start; }
@media (max-width: 640px) {
  [data-refined] .page-container:has(.tool-page) .page-header { margin-top: 8px; }
}

/* Reading surfaces. Paper gives context to summaries and links, with long passages on one reading column. */
:is([data-refined="guides"], [data-refined="vab"], [data-refined="diary"], [data-refined="preschoolstart"],
    [data-refined="glossary"], [data-refined="about"], [data-refined="faq"],
    [data-refined="contact"], [data-refined="privacy"], [data-refined="terms"], [data-refined="accessibility"]) #main-content {
  background: var(--surface);
}
[data-refined] .guide-lead { max-width: 65ch; text-wrap: pretty; }
:is([data-refined="guides"], [data-refined="vab"], [data-refined="diary"], [data-refined="preschoolstart"],
    [data-refined="glossary"], [data-refined="privacy"]) .summary-card {
  background: var(--note-paper); border-color: #d7c8b7; padding: clamp(14px, 3vw, 24px);
}
.family-page .family-glossary > div { padding-block: 12px; border-block-end: 1px solid var(--line); }
[data-refined="about"] .about-copy .about-lead { padding: 18px clamp(16px, 3vw, 28px); border-radius: var(--panel-radius); background: var(--note-paper); }
[data-refined="contact"] .contact-copy p:first-child { padding: 18px clamp(16px, 3vw, 28px); border-radius: var(--panel-radius); background: var(--sage-wash); }
:is([data-refined="privacy"], [data-refined="terms"], [data-refined="accessibility"]) .info-box {
  padding: 12px 0 18px; background: transparent; border: 0; border-radius: 0; border-bottom: 1px solid var(--line);
}
:is([data-refined="privacy"], [data-refined="terms"], [data-refined="accessibility"]) .policy-part { margin-top: 34px; }

/* Order 024. Product actions, documents and editorial links each have one visual role. */
:is(.home-dash, .tools-catalog-page) .text-link {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  min-height: 44px;
  text-decoration: none;
}
:is(.home-dash, .tools-catalog-page) .text-link:hover { text-decoration: underline; }

.home-health__more > summary, .hs-details > summary, .hk-compact-details > summary { color: #294652; cursor: pointer; font-weight: 650; padding-block: 8px; }
.hs-details > summary { font-size: .875rem; }
.hs-details > .hs-src { padding: 0; border: 0; }
.hs-card--trend .st-chart { margin-block: 4px; }
.hs-card--trend .st-chart .st-grid { stroke: #cad9dd; }


.tb-card .tb-svg { max-width: 100%; max-height: 88px; }
.tb-card .tb-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tb-card .tb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: auto; padding-top: 8px; }
.tb-card .tb-open, .tb-card .tb-pdf, .tb-doc-card .tb-pdf, .guide .tb-card .tb-actions a:is(.tb-open, .tb-pdf) {
  text-decoration: none; padding-inline: 10px;
}
.tb-catalog .tb-card[hidden] { display: none; }
.catalog-more { position: static; display: flex; flex-wrap: wrap; gap: 5px 22px; background: transparent; border: 0; }
:is(.tb-library, .tb-print-view) .tb-doc-card__thumb {
  display: grid; place-items: center; height: clamp(140px, 21vw, 235px);
  padding: clamp(8px, 1.4vw, 18px); background: #eceadf; box-shadow: none;
}
:is(.tb-library, .tb-print-view) .tb-doc-card__thumb img {
  width: 100%; height: 100%; min-height: 0; max-height: none; object-fit: contain; object-position: center;
}
.tb-doc-card > div { display: grid; align-content: start; grid-template-rows: 1fr auto auto; gap: 2px; flex: 1; }
.tb-doc-card .tb-pdf { justify-self: start; }

.guide .data-related { display: flex; gap: 8px 24px; flex-wrap: wrap; margin-block: 4px 14px; }
.guide .data-related .text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; }
.guide .data-related .text-link:hover { text-decoration: underline; }
}
