/* ConfidentIQ website, styles part four of four: tables, tick lists, stages, the solutions blocks, the form, legal text and motion.
   It reads the tokens in styles.css and loads last. */

/* Data tables */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.975rem; font-variant-numeric: tabular-nums; }
.table caption { text-align: left; color: var(--muted); font: 500 0.75rem/1.4 var(--mono); letter-spacing: 0.02em; caption-side: bottom; padding-top: 0.9rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: 0.9rem 1.25rem 0.9rem 0; border-bottom: 1px solid var(--line); }
.table tr > :last-child { padding-right: 0; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table thead th { font: 500 0.75rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; padding-top: 0; }
.table tbody th { font-weight: 600; color: var(--ink); }
.table .flag { color: var(--warn); font-weight: 600; }
.table .nw { white-space: nowrap; }
/* A comparison: the last column is ours. */
.table--compare thead th:last-child { color: var(--accent); }
.table--compare td:last-child { color: var(--ink); font-weight: 500; }
/* A priority or status tag inside a table or a list. */
.tag { display: inline-flex; align-items: center; min-height: 1.6rem; padding: 0 0.6rem; border-radius: 999px; border: 1px solid var(--line-strong); font: 600 0.78rem/1 var(--mono); color: var(--text); white-space: nowrap; }
.tag--hot { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
/* On phones each table row becomes a stacked block and every cell carries its column name. */
@media (max-width: 640px) {
  .table-scroll { overflow-x: visible; }
  .table tbody, .table tr, .table th, .table td, .table caption { display: block; }
  .table { display: flex; flex-direction: column; }
  .table caption { order: 1; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table tr { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .table tbody tr:first-child { padding-top: 0; }
  .table tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .table th, .table td { padding: 0.15rem 0; border: 0; white-space: normal; }
  .table tbody th { font-size: 1.05rem; margin-bottom: 0.2rem; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 500; }
}

/* Tick list */
.checks > li { position: relative; padding: 0.85rem 0 0.85rem 2rem; border-bottom: 1px solid var(--line); }
.checks > li:first-child { border-top: 1px solid var(--line); }
.checks > li::before { content: ""; position: absolute; left: 0.1rem; top: 1.25rem; width: 0.95rem; height: 0.5rem; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.checks strong { color: var(--ink); font-weight: 600; }

/* A list of things that never happen: each row is struck through at the marker. */
.nevers { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.nevers > li { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.nevers > li::before { content: ""; width: 1.5rem; height: 1.5rem; margin-bottom: 0.6rem; border: 1.5px solid var(--accent); border-radius: 5px; background: linear-gradient(to top right, transparent calc(50% - 1px), var(--accent) calc(50% - 1px), var(--accent) calc(50% + 1px), transparent calc(50% + 1px)); }
.nevers strong { font: 600 1.0625rem/1.3 var(--display); letter-spacing: -0.01em; color: var(--ink); }
.nevers span { font-size: 0.975rem; line-height: 1.5; color: var(--muted); }

/* Ordered stages: the order is the information. */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 0; }
.steps > li { counter-increment: step; position: relative; padding: 2.6rem 1.25rem 0.5rem 0; }
.steps > li::before { content: counter(step, decimal-leading-zero); position: absolute; top: 0; left: 0; z-index: 1; padding-right: 0.75rem; background: var(--step-bg, var(--bg)); font: 500 0.8125rem/1.5rem var(--mono); letter-spacing: 0.04em; color: var(--accent); }
.steps > li::after { content: ""; position: absolute; top: 0.75rem; left: 0; right: 0; height: 1px; background: var(--line-strong); }
.steps strong { display: block; color: var(--ink); font: 600 1.125rem/1.25 var(--display); letter-spacing: -0.01em; }
.steps span { display: block; margin-top: 0.4rem; font-size: 0.95rem; line-height: 1.5; color: var(--muted); }
.section--tint .steps { --step-bg: var(--tint); }
.panel .steps, .hero .steps { --step-bg: transparent; }
.panel .steps > li::before, .hero .steps > li::before { padding-right: 0; }
.panel .steps > li::after, .hero .steps > li::after { left: 2rem; right: 1.25rem; }
/* The same stages as one column, with the line running down the side. */
.steps--stack { grid-template-columns: minmax(0, 1fr); gap: 0; }
.steps--stack > li { padding: 0 0 1.4rem 2.75rem; }
.steps--stack > li:last-child { padding-bottom: 0; }
.steps--stack > li::before { top: 0.05rem; padding: 0; }
.steps--stack > li::after, .panel .steps--stack > li::after, .hero .steps--stack > li::after { top: 1.7rem; bottom: 0.2rem; left: 0.55rem; right: auto; width: 1px; height: auto; }
.steps--stack > li:last-child::after { display: none; }
/* On a phone every set of stages takes the one-column form. */
@media (max-width: 520px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps > li { padding: 0 0 1.4rem 2.75rem; }
  .steps > li:last-child { padding-bottom: 0; }
  .steps > li::before { top: 0.05rem; padding: 0; }
  .steps > li::after, .panel .steps > li::after, .hero .steps > li::after { top: 1.7rem; bottom: 0.2rem; left: 0.55rem; right: auto; width: 1px; height: auto; }
  .steps > li:last-child::after { display: none; }
}

/* Plain inline list of terms */
.terms { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.terms li { padding: 0.4rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 500 0.8125rem/1.4 var(--mono); color: var(--ink); }

/* Two-column split: a heading block beside its content. */
.split { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.split-copy > * + * { margin-top: 1.15rem; }
.split-copy .eyebrow + h2, .split-copy .eyebrow + h1 { margin-top: 1rem; }
.split-copy .link-arrow { margin-top: 0.6rem; }
@media (min-width: 901px) { .split-copy--sticky { position: sticky; top: 104px; } }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* A numbered need on the solutions page. */
.need { padding: clamp(1.5rem, 3.5vw, 3rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.need + .need { margin-top: 1.25rem; }
.need .row { gap: clamp(1.75rem, 4vw, 3.5rem); align-items: start; }
.need .panel { background: var(--bg); box-shadow: none; }
.need h3 { font-size: clamp(1.6rem, 1.5vw + 1.05rem, 2.25rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.need .card-num + h3 { margin-top: 0.9rem; }
.need-problem { font: 500 clamp(1.1rem, 0.5vw + 1rem, 1.3rem)/1.45 var(--display); letter-spacing: -0.01em; color: var(--ink); }
.answered { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.5rem; }
.answered dt { font: 500 0.75rem/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 0.25rem; }
.answered dd { padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 500 0.8125rem/1.4 var(--mono); }

/* Form */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2.5rem); display: grid; gap: 1.15rem; box-shadow: var(--shadow); }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; align-items: start; }
@media (max-width: 560px) { .form-pair { grid-template-columns: 1fr; } }
.field { display: grid; gap: 0.45rem; }
.field label { font-weight: 600; font-size: 0.9375rem; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 0.75rem 0.95rem;
  font: 400 1rem/1.4 var(--body); color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--muted); border-radius: var(--radius-sm);
  caret-color: var(--accent);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { min-height: 8.5rem; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink); }
.field select {
  appearance: none; padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 55%, calc(100% - 0.875rem) 55%;
  background-size: 0.375rem 0.375rem; background-repeat: no-repeat;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); border-radius: var(--radius-sm); }
.field input:user-invalid, .field select:user-invalid, .field textarea:user-invalid { border-color: var(--danger); }
.form-status { font-size: 0.9375rem; color: var(--danger); }
.form .consent { font-size: 0.9rem; color: var(--muted); }
.form .btn { justify-self: start; }
.hp { position: absolute; left: -100vw; }

/* Legal and long-form text */
.legal { max-width: 44rem; padding: clamp(3rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem); }
.legal h2 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2.75rem; }
.legal > h2:first-child { margin-top: 0; }
.legal p { margin-top: 1rem; }
.updated { font: 500 0.8125rem/1.4 var(--mono); letter-spacing: 0.02em; color: var(--muted); }

/* Motion. Everything below is decoration: the page is complete without it. */
@media (prefers-reduced-motion: no-preference) {
  /* The hero settles in once, on load. */
  .hero-copy > *, .hero-figure, .hero .strip-row, .hero-facts { animation: rise 0.9s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.06s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.12s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.18s; }
  .hero-figure { animation-delay: 0.16s; }
  .hero .strip-row, .hero-facts { animation-delay: 0.3s; }
  /* One authored moment: the home diagram draws its chain of trust from the root down. */
  .dg--draw .dg-line, .dg--draw .dg-accent-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) 0.45s forwards; }
  .dg--draw .dg-leaf, .dg--draw .dg-accent-box, .dg--draw .dg-late { opacity: 0; animation: appear 0.6s var(--ease) 1.05s forwards; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes appear { to { opacity: 1; } }
  /* Blocks further down rise into place as they enter the screen, where the browser can tie an animation to scrolling.
     Position only, never opacity: text that has stopped half way on to the screen must still be at full contrast.
     No fill mode on purpose: a block that has not reached the screen yet keeps its normal place,
     so print, page captures and anything else that never scrolls still show the page as laid out. */
  @supports (animation-timeline: view()) {
    .section-head, .card, .panel, .need, .row-copy, .split-copy, .spec > div, .nevers > li, .steps > li, .band .wrap {
      animation: enter linear; animation-timeline: view(); animation-range: entry 0 entry 200px;
    }
    @keyframes enter { from { transform: translateY(28px); } }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; }
}
