/* ================================================================ */
/* tool-page.css — shared stylesheet for generated Chea tool pages   */
/* Editorial / Swiss. Ink ground, hairline rules, one red action.    */
/* Tokens only — no literal palette values. Reused across all tools. */
/* ================================================================ */

.tp {
  --rule: 1px solid var(--paper-border);
  --measure: 58ch;
  display: block;
}

/* ---------------- crumb ---------------- */
.tp-crumb {
  margin: 0 0 var(--space-4);
  padding: 22px 0 0;
  font: 700 10px var(--font-body);
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.tp-crumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out-expo);
}
.tp-crumb a:hover,
.tp-crumb a:focus-visible { color: var(--accent); }

/* ---------------- hero ---------------- */
.tp-hero { padding: 0 0 var(--space-4); }
.tp-hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}
.tp-hero .eyebrow { display: block; margin: 0 0 var(--space-2); }
.tp-hero h1 {
  max-width: none;
  margin: 0 0 var(--space-2);
  font-size: clamp(22px, 3.6vw, 34px);
  line-height: 1.05;
  letter-spacing: -.02em;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  max-width: 22ch;
}
.tp-thesis {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  color: var(--paper);
  font-size: clamp(15px, .9vw + 12px, 18px);
  line-height: 1.42;
}

/* right-column spec block: meta list + platform note, top-right on desktop */
.tp-hero__spec { min-width: 0; }

/* meta list (spec rows: Estado + platform fields + surviving meta) */
.tp-meta {
  margin: 0 0 var(--space-3);
  padding: 0;
  border-top: var(--rule);
  max-width: 44ch;
}
.tp-meta > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-2);
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: var(--rule);
}
.tp-meta dt {
  margin: 0;
  color: var(--muted);
  font: 700 10px var(--font-display);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tp-meta dd {
  margin: 0;
  color: var(--paper);
  font-size: 14px;
  text-align: right;
}
.tp-meta dd.is-live { color: var(--accent); font-weight: 700; }
.tp-meta dd.is-soon { color: var(--muted); font-weight: 700; }

/* ---------------- platform note (survives small, under the spec block) ---------------- */
.tp-platform__note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-width: 48ch;
}

/* ---------------- buttons ---------------- */
.tp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.tp-btn {
  display: inline-block;
  padding: 15px 22px;
  border: 1px solid var(--paper-border);
  color: var(--paper);
  font: 700 12px var(--font-display);
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color var(--dur-fast) var(--ease-out-expo),
              border-color var(--dur-fast) var(--ease-out-expo),
              color var(--dur-fast) var(--ease-out-expo),
              transform var(--dur-fast) var(--ease-out-expo);
}
.tp-btn:hover { border-color: var(--paper); background: var(--paper-ghost); }
.tp-btn:active { transform: translateY(1px); }
.tp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tp-btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.tp-btn--primary:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.tp-btn--primary:focus-visible { outline-color: var(--paper); }

.tp-sha {
  color: var(--muted);
  font: 700 11px var(--font-display);
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out-expo),
              border-color var(--dur-fast) var(--ease-out-expo);
}
.tp-sha:hover,
.tp-sha:focus-visible { color: var(--accent); border-color: var(--accent); }

/* ---------------- section frame ---------------- */
.tp-section {
  padding: var(--space-5) 0 0;
  border-top: var(--rule);
  margin-top: var(--space-5);
}
.tp-sechead { margin-bottom: var(--space-4); }
.tp-sechead__num {
  margin: 0 0 var(--space-1);
  color: var(--accent);
  font: 700 12px var(--font-display);
  letter-spacing: .16em;
}
.tp-sechead h2 {
  margin: 0 0 var(--space-2);
  font-size: clamp(28px, 5vw, 48px);
  line-height: .95;
}
.tp-sechead__lead {
  max-width: var(--measure);
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

/* ---------------- prose ---------------- */
.tp-prose p {
  max-width: var(--measure);
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

/* ---------------- generic lists ---------------- */
.tp-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: var(--rule);
}
.tp-list li {
  padding: 14px 0 14px 20px;
  border-bottom: var(--rule);
  position: relative;
  color: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  max-width: 60ch;
}
.tp-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  width: 10px;
  height: 1px;
  background: var(--accent);
}
.tp-list--needs li,
.tp-list--limits li { color: var(--muted); }

/* ---------------- howto steps ---------------- */
.tp-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: var(--rule);
  counter-reset: step;
}
.tp-steps li {
  min-width: 0;
  padding: var(--space-3) 0;
  border-bottom: var(--rule);
}
.tp-steps__n {
  margin: 0 0 var(--space-1);
  color: var(--accent);
  font: 700 11px var(--font-display);
  letter-spacing: .16em;
}
.tp-steps__text {
  max-width: 60ch;
  margin: 0 0 10px;
  color: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}
.tp-steps__text[lang="en"] { margin-top: 4px; }

/* code block inside a step — scrolls in its own container, never the page */
.tp-codewrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--paper-border);
  background: var(--surface-1);
  -webkit-overflow-scrolling: touch;
}
.tp-codewrap pre {
  margin: 0;
  padding: 12px 14px;
  width: max-content;
  max-width: none;
  white-space: pre;
}
.tp-codewrap code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--paper);
}

/* ---------------- illustrations ---------------- */
.tp-illuswrap { max-width: 100%; overflow-x: auto; padding-bottom: 6px; }
.tp-figure { margin: 0; width: max-content; min-width: 280px; max-width: none; }
.tp-illus {
  border: 1px solid var(--paper-border);
  background: var(--surface-1);
  box-shadow: 0 24px 60px var(--ink-hover);
}
.tp-illus__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border-bottom: var(--rule);
  background: var(--surface-2);
}
.tp-illus__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--paper-hover);
}
.tp-illus__title {
  margin: 0 0 0 auto;
  padding-right: 4px;
  color: var(--muted);
  font: 700 9px var(--font-display);
  letter-spacing: .16em;
}

/* table-kind illustration */
.tp-illus__pre {
  margin: 0;
  padding: 18px 16px;
  overflow-x: auto;
  color: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}

/* terminal-kind illustration */
.tp-term__body { padding: 16px; }
.tp-term__line {
  color: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.tp-term__line:empty { height: .8em; }

/* flow-kind illustration */
.tp-illus--flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  box-shadow: none;
}
.tp-flow__node {
  padding: 10px 14px;
  border: 1px solid var(--paper-border);
  background: var(--surface-2);
  color: var(--paper);
  font: 700 12px var(--font-display);
  letter-spacing: .04em;
  white-space: nowrap;
}
.tp-flow__arrow {
  flex: none;
  width: 20px;
  height: 1px;
  background: var(--accent);
  position: relative;
}
.tp-flow__arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 6px;
  height: 6px;
  border-right: 1px solid var(--accent);
  border-top: 1px solid var(--accent);
  transform: rotate(45deg);
}

.tp-figure figcaption {
  margin-top: var(--space-2);
  max-width: 60ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.tp-figure figcaption strong { color: var(--paper); }

/* ---------------- CTA ---------------- */
.tp-cta {
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-3);
  border: 1px solid var(--paper-border);
  border-top: 4px solid var(--accent);
  background: var(--surface-1);
}
.tp-cta .eyebrow { display: block; margin: 0 0 var(--space-2); }
.tp-cta h2 {
  margin: 0 0 var(--space-2);
  font-size: clamp(30px, 6vw, 58px);
  line-height: .95;
}
.tp-cta__lead {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}
.tp-fineprint {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: var(--rule);
  display: grid;
  gap: var(--space-2);
}
.tp-fineprint p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.tp-fineprint strong { color: var(--paper); }
.tp-fineprint a,
.tp-cta a { color: inherit; }
.tp-cta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
  padding: .05em .35em;
  border: 1px solid var(--paper-border);
  border-radius: 3px;
}

/* ================================================================ */
/* Breakpoints                                                      */
/* ================================================================ */
@media (min-width: 640px) {
  .tp-steps { grid-template-columns: 1fr 1fr; column-gap: var(--space-4); }
  .tp-steps li { padding-right: var(--space-3); }
}

@media (min-width: 900px) {
  .tp-hero { padding: 0 0 var(--space-6); }
  .tp-hero__grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(240px, 340px);
    gap: var(--space-6);
  }
  .tp-hero__spec { justify-self: end; width: 100%; padding-top: 4px; }
  .tp-hero__spec .tp-meta,
  .tp-hero__spec .tp-platform__note { margin-left: auto; }
  .tp-section { padding-top: var(--space-6); margin-top: var(--space-6); }
  .tp-sechead {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 0 var(--space-4);
    margin-bottom: var(--space-5);
  }
  .tp-sechead__num { grid-row: 1 / span 2; margin: 10px 0 0; }
  .tp-cta { padding: var(--space-6) var(--space-5); }
}

/* ================================================================ */
@media (prefers-reduced-motion: reduce) {
  .tp * {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
