/* ============================================================
   cimo.business — resources / lead-magnet surface
   Screen layer + the print layer that is the PDF.

   TOKEN-ONLY. Every value resolves to /design/tokens.css (loaded
   before this file). No root token block, no local custom property,
   no colour literal, no off-ladder px. The only literals are the
   designer-ratified print geometry (mm), the focus ring and
   the registered hero line. Spec:
   projects/cimo/specs/resources-designer-spec-2026-10-31.yaml
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ---------- shared resource column + sheet ---------- */

.res-col {
  width: min(100%, var(--measure-prose));
  margin-inline: auto;
}

.res-sheet {
  margin-block-start: var(--space-5);
  padding: var(--space-5);
  background: var(--color-surface);
  border: var(--border-width-hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.res-sheet h1 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-hero);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: var(--track-display);
}

.res-sheet .res-standfirst {
  margin: 0 0 var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--type-h3);
  line-height: 1.6;
}

.res-sheet p,
.res-sheet li {
  font-size: var(--type-h3);
  line-height: 1.6;
  color: var(--color-text);
}

.res-sheet p {
  margin: 0 0 var(--space-4);
}

.res-sheet ul,
.res-sheet ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-4);
}

.res-sheet li {
  margin: var(--space-1) 0;
}

.res-sheet strong {
  font-weight: 700;
}

.res-h2 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--type-title);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: var(--track-tight);
  break-after: avoid;
}

.res-h2:first-of-type {
  margin-block-start: var(--space-5);
}

.res-sheet .res-source {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: var(--type-caption);
  line-height: 1.6;
}

/* ---------- visually hidden (table captions / region names) ---------- */

.res-visually-hidden {
  position: absolute;
  width: var(--border-width-hairline);
  height: var(--border-width-hairline);
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- compact topbar (asset pages) ---------- */

.res-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: calc(var(--touch-target) + 2 * var(--space-3) + var(--border-width-hairline));
  border-bottom: var(--border-width-hairline) solid var(--color-border);
}

.res-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.res-back {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  color: var(--color-text);
  font-size: var(--type-sm);
  font-weight: 600;
  text-decoration: none;
}

@media (hover: hover) {
  .res-back:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: var(--border-width-hairline);
    text-underline-offset: var(--space-1);
  }
}

.res-back:focus-visible,
.res-btn-secondary:focus-visible,
.hub-card__body:focus-visible,
.res-table-wrap:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* ---------- secondary control (PDF / Print) ---------- */

.res-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  padding-inline: var(--space-5);
  border: var(--border-width-hairline) solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--type-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}

@media (hover: hover) {
  .res-btn-secondary:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
  }
}

.res-btn-secondary:active {
  background: var(--color-surface-raised);
  transform: translateY(var(--border-width-hairline));
}

/* ---------- hub toolkit ---------- */

.res-toolkit {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-block: var(--space-5) 0;
}

@media (max-width: 1023px) {
  .res-toolkit {
    grid-template-columns: 1fr;
  }
}

.res-toolkit .hub-card:hover {
  border-color: var(--color-border);
  color: var(--color-text);
}

.res-toolkit .hub-card:active {
  transform: none;
}

.hub-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: var(--touch-target);
  color: var(--color-text);
  text-decoration: none;
}

.hub-card__body:hover {
  color: var(--color-text);
}

.hub-card__body .hub-card__read {
  text-decoration: underline;
  text-decoration-thickness: var(--border-width-hairline);
  text-underline-offset: var(--space-1);
}

@media (hover: hover) {
  .hub-card__body:hover .hub-card__read {
    color: var(--color-accent);
  }
}

.hub-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
}

.res-footnote {
  flex-basis: 100%;
  margin: 0 0 var(--space-2);
}

/* ---------- table plate + tick cells ---------- */

.res-table-wrap {
  margin-block: var(--space-5);
  min-width: 0;
}

.resource-table td.yesno {
  padding: var(--space-2);
  text-align: center;
}

.res-tick {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  cursor: pointer;
}

.res-tick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.res-box {
  position: relative;
  flex: 0 0 auto;
  width: var(--space-5);
  height: var(--space-5);
  border: var(--border-width-hairline) solid var(--color-border-strong);
  border-radius: 0;
  background: none;
}

.res-tick input:checked + .res-box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--space-2);
  height: var(--space-3);
  border-inline-end: var(--border-width-hairline) solid var(--color-text);
  border-block-end: var(--border-width-hairline) solid var(--color-text);
  transform: translate(-50%, -50%) rotate(45deg);
}

.res-tick input:focus-visible + .res-box {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* ---------- scoring list ---------- */

.res-score {
  margin: var(--space-3) 0 0;
}

.res-score__row {
  padding-block-start: var(--space-3);
  border-top: var(--border-width-hairline) solid var(--color-border);
}

.res-score dt {
  font-size: var(--type-sm);
  font-weight: 700;
  color: var(--color-text);
}

.res-score dd {
  margin: 0;
  padding-block-end: var(--space-3);
  font-size: var(--type-h3);
  line-height: 1.6;
  color: var(--color-text);
}

/* ---------- pull-out rule band ---------- */

.res-rule {
  margin-block: var(--space-5);
  padding-block: var(--space-3);
  border-block: var(--border-width-hairline) solid var(--color-border);
}

.res-sheet .res-rule p {
  margin: 0;
}

.res-sheet .res-rule strong {
  font-weight: 700;
}

/* ---------- scripts ---------- */

.res-scripts {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
}

.script-card {
  padding-block: var(--space-3) var(--space-4);
  border-top: var(--border-width-hairline) solid var(--color-border);
  break-inside: avoid;
}

.res-sheet .res-script__trigger {
  margin: 0 0 var(--space-1);
  font-size: var(--type-sm);
  font-weight: 700;
  color: var(--color-text);
}

.res-sheet .res-script__reply {
  margin: 0;
  font-size: var(--type-h3);
  line-height: 1.6;
  color: var(--color-text);
}

.res-sheet .res-script__why {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--type-caption);
  line-height: 1.6;
}

.res-script__actions {
  display: flex;
  margin-top: var(--space-2);
}

/* ---------- closing CTA + print footer ---------- */

.res-cta {
  display: flex;
  justify-content: flex-start;
  margin-block-start: var(--space-8);
}

.print-footer,
.res-print-foot {
  display: none;
}

/* ---------- responsive ---------- */

@media (max-width: 767px) {
  .res-sheet {
    padding: var(--space-4);
  }

  .res-topbar {
    flex-wrap: wrap;
    padding-block: var(--space-2);
  }

  .res-topbar__actions {
    width: 100%;
  }

  .res-topbar__actions .res-btn-secondary {
    flex: 1 1 0;
  }
}

@media (prefers-contrast: more) {
  .res-sheet,
  .res-table-wrap,
  .res-rule,
  .res-box,
  .res-btn-secondary,
  .res-score__row {
    border-color: var(--color-text);
  }

  .res-sheet .res-standfirst,
  .res-sheet .res-script__why,
  .res-sheet .res-source,
  .hub-card__meta,
  .hub-card p {
    color: var(--color-text);
  }
}

/* ---------- print layer: the PDF is the source of truth ---------- */

@page {
  size: A4;
  margin: 12mm 14mm;
}

@media print {
  html,
  body {
    margin: 0;
    padding: 0;
    background: none;
  }

  body {
    orphans: 3;
    widows: 3;
  }

  .cimo-skip-link,
  .site-header,
  .site-footer,
  .breadcrumb,
  .res-topbar,
  .no-print {
    display: none !important;
  }

  .res-page {
    width: 100%;
    max-width: none;
    padding-block: 0;
  }

  .res-col {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .res-sheet {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
  }

  .res-sheet__header {
    padding-bottom: var(--space-3);
    border-bottom: var(--border-width-hairline) solid var(--color-text);
  }

  .res-sheet h1,
  .res-sheet h2 {
    break-after: avoid;
  }

  a {
    color: var(--color-text);
    text-decoration: none;
  }

  .res-cta {
    display: flex;
    margin-block-start: var(--space-5);
  }

  .res-cta .btn {
    background: none;
    color: var(--color-text);
    padding-inline: 0;
    text-decoration: underline;
    text-decoration-thickness: var(--border-width-hairline);
    text-underline-offset: var(--space-1);
  }

  .res-rule,
  .res-score__row,
  .res-table-wrap,
  .res-box {
    border-color: var(--color-text);
  }

  .res-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .resource-table th,
  .resource-table td {
    border-color: var(--color-text);
    padding-block: var(--space-2);
  }

  .resource-table thead {
    display: table-header-group;
  }

  .res-rule {
    margin-block: var(--space-4);
  }

  .res-cta {
    display: flex;
    margin-block-start: var(--space-4);
  }

  tr,
  li,
  .script-card {
    break-inside: avoid;
  }

  .print-footer,
  .res-print-foot {
    display: block;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    padding-top: var(--space-1);
    border-top: var(--border-width-hairline) solid var(--color-text);
    background: none;
    color: var(--color-text);
    font-size: var(--type-caption);
    line-height: 1.4;
  }
}
