/* ==========================================================
   rkdev.biz — shared styles for "rule of thumb" tool pages.
   Loaded after styles.css. Reuse these classes in every tool.
   ========================================================== */

:root {
  /* Status colors, readable on white, told apart by text labels too */
  --ok: #2F7D4F;
  --watch: #B7791F;
  --warn: #C05621;
  --bad: #B83232;
}

.tool-hero {
  padding-top: 72px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tool-hero h1 {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.05;
  max-width: 900px;
}

.tool {
  padding-bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tool__panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
}

.tool__how {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-muted);
}

.tool__how strong {
  color: var(--navy);
}

/* ---------- One question with a 1–5 rating ---------- */
/* Fieldset grid: heading across the top, question on the left, 1–5 buttons on the right */
.rating {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 32px;
  align-items: center;
}

.rating:first-of-type {
  border-top: 0;
  padding-top: 0;
}

/* float makes the legend sit inside the fieldset's grid like a normal row */
.rating legend {
  float: left;
  width: 100%;
  grid-column: 1 / -1;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  color: var(--navy);
}

.rating__q {
  grid-column: 1;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-muted);
}

.rating__scale {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.rating__options {
  display: flex;
  gap: 6px;
}

.rating__options input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.rating__options label {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  font-size: 18px;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  user-select: none;
}

.rating__options label:hover {
  border-color: var(--navy);
}

.rating__options input:checked + label {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.rating__options input:focus-visible + label {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.rating__ends {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.rating.is-missing legend::after {
  content: "  · please choose 1–5";
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--bad);
}

@media (max-width: 760px) {
  .rating {
    grid-template-columns: 1fr;
  }

  .rating__scale {
    grid-column: 1;
    grid-row: auto;
    margin-top: 8px;
  }

  .rating__options label {
    flex: 1;
    width: auto;
  }
}

/* Make the hidden attribute win over .btn's display rule */
[hidden] {
  display: none !important;
}

/* ---------- Buttons under the form ---------- */
.tool__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.tool__actions button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tool__actions .btn--outline {
  background: transparent;
}

.tool__error {
  font-weight: 600;
  color: var(--bad);
}

/* ---------- Results ---------- */
.result__score {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
}

.result__status {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.result__text {
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
}

.metric {
  margin-top: 24px;
}

.metric__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  font-weight: 600;
}

.metric__note {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
}

.metric__track {
  height: 18px;
  margin-top: 8px;
  background: var(--panel);
  border-radius: 9px;
  overflow: hidden;
}

.metric__bar {
  height: 100%;
  width: 0;
  border-radius: 9px;
  transition: width 0.6s ease;
}

.is-ok { background: var(--ok); }
.is-watch { background: var(--watch); }
.is-warn { background: var(--warn); }
.is-bad { background: var(--bad); }

.text-ok { color: var(--ok); }
.text-watch { color: var(--watch); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }

/* ---------- Call to action under a tool ---------- */
.tool__cta {
  background: var(--navy);
  color: var(--ground);
  border-radius: 12px;
  padding: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.tool__cta h2 {
  font-size: 26px;
}

.tool__cta p {
  margin-top: 6px;
  color: var(--text-on-dark);
}

.tool__cta .btn--solid {
  background: var(--accent);
  color: var(--navy);
}

.tool__cta .btn--solid:hover {
  filter: brightness(1.08);
  background: var(--accent);
  color: var(--navy);
}

@media (prefers-reduced-motion: reduce) {
  .metric__bar {
    transition: none;
  }
}

/* ---------- Printing: keep the answers and results, drop the chrome ---------- */
@media print {
  .site-header,
  .site-footer,
  .tool__actions,
  .tool__cta,
  .back-link {
    display: none;
  }

  body {
    background: #fff;
  }

  .tool__panel {
    border: 0;
    padding: 0;
  }

  .rating__options label {
    border-width: 1px;
  }

  .metric__bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Text for screen readers only */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
