/*
 * SureHarbor Tools: shared styles.
 *
 * Token block: the ONLY place hex values are allowed in this plugin. Each one
 * names its source. Every other rule uses var(--sht-*) and is scoped under
 * .sh-tool. The single exception is the print rule at the bottom, which has
 * to hide the site header and footer while the tool's Print button is used.
 */

/* ---- Tokens ------------------------------------------------------------ */
.sh-tool {
  /* Colors: tailwind.config.js sh palette */
  --sht-primary-teal: #0f425a; /* sh.primary */
  --sht-secondary-teal: #1a6880; /* sh.secondary */
  --sht-deep-harbor: #081e2e; /* sh.deep */
  --sht-gold: #f2c200; /* sh.gold */
  --sht-gold-dark: #c9a200; /* sh.goldDark */
  --sht-tint-teal: #d0e4ee; /* sh.tint */
  --sht-body-ink: #1a2830; /* sh.ink */
  --sht-muted-slate: #48535a; /* sh.slate */
  --sht-border: #e0dbd3; /* sh.border */
  --sht-canvas: #f5f3ef; /* sh.foreground */
  --sht-surface: #fdfcfa; /* sh.foregroundLight */
  --sht-white: #ffffff; /* Tailwind core white, used as bg-white by Content Feedback */

  /* Colors: PRD V4 Section 10 (not in the site palette yet) */
  --sht-input-border: #8c8378; /* PRD input-border, for controls */
  --sht-success: #1a7a3c; /* PRD success; also used by Content Feedback */
  --sht-success-bg: #eaf3ec; /* Content Feedback success bg (site wins over PRD #E8F5EC) */
  --sht-caution: #806400; /* PRD caution */
  --sht-caution-bg: #fcf4da; /* PRD caution-bg */

  /* Radii: PRD V4 Section 10 */
  --sht-radius-md: 10px; /* PRD radius-md, cards */
  --sht-radius-sm: 8px; /* PRD radius-sm, buttons and options */

  /* Spacing: PRD space-3/4/5, Tailwind default scale */
  --sht-space-2: 8px;
  --sht-space-3: 12px;
  --sht-space-4: 16px;
  --sht-space-5: 20px;
  --sht-space-6: 24px;
}

/* ---- Base -------------------------------------------------------------- */
.sh-tool {
  box-sizing: border-box;
  margin: var(--sht-space-6) auto;
  border: 1px solid var(--sht-border);
  border-radius: var(--sht-radius-md);
  background: var(--sht-surface);
  color: var(--sht-body-ink);
  font-family: "Nunito Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-align: left;
}

.sh-tool *,
.sh-tool *::before,
.sh-tool *::after {
  box-sizing: inherit;
}

.sh-tool--full {
  max-width: 700px;
}

.sh-tool--compact {
  max-width: 100%;
}

.sh-tool p {
  margin: 0;
}

.sh-tool .sht-loading {
  padding: var(--sht-space-6);
  color: var(--sht-muted-slate);
}

.sh-tool .sht-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sh-tool :focus-visible {
  outline: 2px solid var(--sht-secondary-teal);
  outline-offset: 2px;
}

.sh-tool [tabindex="-1"]:focus {
  outline: none;
}

/* ---- Draft banner (editors only) ---------------------------------------- */
.sh-tool .sht-draft-banner {
  padding: var(--sht-space-2) var(--sht-space-4);
  border-bottom: 1px solid var(--sht-caution);
  border-radius: var(--sht-radius-md) var(--sht-radius-md) 0 0;
  background: var(--sht-caution-bg);
  color: var(--sht-caution);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

/* ---- Header ------------------------------------------------------------ */
.sh-tool .sht-header {
  padding: var(--sht-space-6) var(--sht-space-5) var(--sht-space-4);
}

.sh-tool .sht-eyebrow {
  color: var(--sht-secondary-teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sh-tool .sht-title {
  margin: var(--sht-space-2) 0 0;
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: clamp(1.375rem, 3.2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
}

.sh-tool .sht-subtitle {
  margin-top: var(--sht-space-2);
  color: var(--sht-muted-slate);
}

/* ---- Tabs ---------------------------------------------------------------- */
.sh-tool .sht-tabs {
  display: flex;
  margin: 0;
  padding: 0 var(--sht-space-3);
  border-bottom: 1px solid var(--sht-border);
}

.sh-tool .sht-tab {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: var(--sht-space-3) 2px var(--sht-space-2);
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--sht-muted-slate);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.sh-tool .sht-tab:hover:not(:disabled),
.sh-tool .sht-tab:focus:not(:disabled) {
  background: transparent;
  color: var(--sht-primary-teal);
}

.sh-tool .sht-tab[aria-selected="true"] {
  border-bottom-color: var(--sht-primary-teal);
  color: var(--sht-primary-teal);
  font-weight: 700;
}

.sh-tool .sht-tab:disabled {
  color: var(--sht-input-border);
  cursor: not-allowed;
}

.sh-tool .sht-tab-icon {
  position: relative;
  display: inline-flex;
}

.sh-tool .sht-tab-icon svg {
  width: 18px;
  height: 18px;
}

.sh-tool .sht-tab-check {
  position: absolute;
  top: -5px;
  right: -9px;
  display: none;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--sht-success);
  color: var(--sht-white);
}

.sh-tool .sht-tab-check svg {
  width: 13px;
  height: 13px;
}

.sh-tool .sht-tab.is-answered .sht-tab-check {
  display: inline-flex;
}

.sh-tool .sht-tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Step body ---------------------------------------------------------- */
.sh-tool .sht-panel {
  padding: var(--sht-space-5) var(--sht-space-4);
}

.sh-tool--compact .sht-panel {
  padding-top: var(--sht-space-4);
  padding-bottom: var(--sht-space-4);
}

.sh-tool .sht-step-count {
  color: var(--sht-muted-slate);
  font-size: 13px;
  font-weight: 600;
}

.sh-tool .sht-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sh-tool .sht-legend {
  display: block;
  width: 100%;
  padding: 0;
}

.sh-tool .sht-question-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sht-space-3);
  margin-top: var(--sht-space-3);
}

.sh-tool .sht-question {
  margin: var(--sht-space-2) 0 0;
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: clamp(1.125rem, 2.6vw, 1.375rem);
  font-weight: 700;
  line-height: 1.3;
}

.sh-tool .sht-context {
  flex: 1 1 auto;
  color: var(--sht-muted-slate);
  font-size: 15px;
}

/* Info popover */
.sh-tool .sht-info {
  position: relative;
  flex: 0 0 auto;
}

.sh-tool .sht-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--sht-input-border);
  border-radius: 999px;
  background: var(--sht-white);
  color: var(--sht-primary-teal);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.sh-tool .sht-info-button:hover,
.sh-tool .sht-info-button[aria-expanded="true"] {
  border-color: var(--sht-primary-teal);
  background: var(--sht-tint-teal);
  color: var(--sht-primary-teal);
}

.sh-tool .sht-popover {
  margin-top: var(--sht-space-3);
  padding: var(--sht-space-4);
  border: 1px solid var(--sht-border);
  border-radius: var(--sht-radius-sm);
  background: var(--sht-white);
  font-size: 15px;
}

.sh-tool .sht-popover[hidden] {
  display: none;
}

.sh-tool .sht-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sht-space-3);
}

.sh-tool .sht-popover-title {
  margin: 0;
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.sh-tool .sht-popover p + p,
.sh-tool .sht-popover-head + p {
  margin-top: var(--sht-space-2);
}

.sh-tool .sht-popover-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--sht-radius-sm);
  background: transparent;
  color: var(--sht-muted-slate);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sh-tool .sht-popover-close:hover {
  background: var(--sht-canvas);
  color: var(--sht-primary-teal);
}

/* Options */
.sh-tool .sht-options {
  display: flex;
  flex-direction: column;
  gap: var(--sht-space-3);
  margin-top: var(--sht-space-5);
}

.sh-tool .sht-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sht-space-3);
  padding: var(--sht-space-4);
  border: 1.5px solid var(--sht-input-border);
  border-radius: var(--sht-radius-sm);
  background: var(--sht-white);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.sh-tool .sht-option:hover {
  border-color: var(--sht-primary-teal);
}

.sh-tool .sht-option.is-selected {
  border-color: var(--sht-primary-teal);
  background: var(--sht-tint-teal);
}

.sh-tool .sht-option:focus-within {
  outline: 2px solid var(--sht-secondary-teal);
  outline-offset: 2px;
}

.sh-tool .sht-radio {
  flex: 0 0 auto;
  display: inline-grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 2px solid var(--sht-input-border);
  border-radius: 999px;
  background: var(--sht-white);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.sh-tool .sht-radio::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--sht-white);
  transform: scale(0);
  transition: transform 0.12s ease;
}

.sh-tool .sht-radio:checked {
  border-color: var(--sht-primary-teal);
  background: var(--sht-primary-teal);
}

.sh-tool .sht-radio:checked::before {
  transform: scale(1);
}

.sh-tool .sht-radio:focus-visible {
  outline: none; /* the whole option card shows the ring */
}

.sh-tool .sht-option-label {
  display: block;
  color: var(--sht-body-ink);
  font-weight: 700;
}

.sh-tool .sht-option-hint {
  display: block;
  margin-top: 2px;
  color: var(--sht-muted-slate);
  font-size: 14px;
}

/* ---- Buttons --------------------------------------------------------------- */
.sh-tool .sht-nav,
.sh-tool .sht-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sht-space-3);
  margin-top: var(--sht-space-5);
}

.sh-tool .sht-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: var(--sh-button-action-padding-y, 12px) var(--sh-button-action-padding-x, 22px);
  border: 1.5px solid var(--sht-primary-teal);
  border-radius: var(--sh-button-action-radius, 10px);
  background: var(--sht-primary-teal);
  color: var(--sht-white);
  font-family: "Nunito Sans", system-ui, sans-serif;
  font-size: var(--sh-button-action-font-size, 16px);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
}

.sh-tool .sht-btn:hover:not(:disabled),
.sh-tool .sht-btn:focus-visible {
  border-color: var(--sht-secondary-teal);
  background: var(--sht-secondary-teal);
  color: var(--sht-white);
}

.sh-tool .sht-btn--primary {
  padding: var(--sh-button-primary-padding-y, 10px) var(--sh-button-primary-padding-x, 18px);
  border-color: var(--sht-gold);
  border-radius: var(--sh-button-primary-radius, 9px);
  background: var(--sht-gold);
  color: var(--sht-deep-harbor);
  font-size: var(--sh-button-primary-font-size, 15px);
}

.sh-tool .sht-btn--primary:hover:not(:disabled),
.sh-tool .sht-btn--primary:focus-visible {
  border-color: var(--sht-gold-dark);
  background: var(--sht-gold-dark);
  color: var(--sht-deep-harbor);
}

.sh-tool .sht-btn--ghost {
  border-color: var(--sht-border);
  background: var(--sht-white);
  color: var(--sht-muted-slate);
}

.sh-tool .sht-btn--ghost:hover:not(:disabled),
.sh-tool .sht-btn--ghost:focus-visible {
  border-color: var(--sht-secondary-teal);
  background: var(--sht-canvas);
  color: var(--sht-primary-teal);
}

.sh-tool .sht-btn:disabled {
  border-color: var(--sht-border);
  background: var(--sht-border);
  color: var(--sht-muted-slate);
  cursor: not-allowed;
}

/* ---- Results ------------------------------------------------------------- */
.sh-tool .sht-locked {
  color: var(--sht-muted-slate);
}

.sh-tool .sht-notice {
  margin-bottom: var(--sht-space-4);
  padding: var(--sht-space-3) var(--sht-space-4);
  border: 1px solid var(--sht-caution);
  border-radius: var(--sht-radius-sm);
  background: var(--sht-caution-bg);
  color: var(--sht-caution);
  font-weight: 700;
}

.sh-tool .sht-badge {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.sh-tool .sht-badge--strong {
  border-color: var(--sht-success);
  background: var(--sht-success-bg);
  color: var(--sht-success);
}

.sh-tool .sht-badge--good {
  border-color: var(--sht-primary-teal);
  background: var(--sht-tint-teal);
  color: var(--sht-primary-teal);
}

.sh-tool .sht-badge--caution {
  border-color: var(--sht-caution);
  background: var(--sht-caution-bg);
  color: var(--sht-caution);
}

.sh-tool .sht-headline {
  margin: var(--sht-space-3) 0 0;
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  font-weight: 700;
  line-height: 1.25;
}

.sh-tool .sht-lead {
  margin-top: var(--sht-space-3);
}

.sh-tool .sht-chips-heading {
  margin: var(--sht-space-4) 0 0;
  color: var(--sht-muted-slate);
  font-size: 13px;
  font-weight: 700;
}

.sh-tool .sht-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sht-space-2);
  margin: var(--sht-space-2) 0 0;
  padding: 0;
  list-style: none;
}

.sh-tool .sht-chip {
  margin: 0;
  padding: 3px 10px;
  border: 1px solid var(--sht-border);
  border-radius: 999px;
  background: var(--sht-canvas);
  color: var(--sht-body-ink);
  font-size: 13px;
}

.sh-tool .sht-path {
  margin-top: var(--sht-space-4);
  padding: var(--sht-space-4);
  border: 1px solid var(--sht-border);
  border-radius: var(--sht-radius-md);
  background: var(--sht-white);
}

.sh-tool .sht-path-label {
  color: var(--sht-secondary-teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sh-tool .sht-path--time-sensitive .sht-path-label {
  color: var(--sht-caution);
}

.sh-tool .sht-path-title {
  margin: 4px 0 0;
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.sh-tool .sht-path-body {
  margin-top: var(--sht-space-2);
}

.sh-tool .sht-path-note {
  margin-top: var(--sht-space-2);
  color: var(--sht-muted-slate);
  font-size: 14px;
}

.sh-tool .sht-va-line {
  margin-top: var(--sht-space-4);
  font-weight: 600;
}

.sh-tool .sht-box {
  margin-top: var(--sht-space-5);
  padding: var(--sht-space-4);
  border: 1px solid var(--sht-border);
  border-radius: var(--sht-radius-md);
  background: var(--sht-canvas);
}

.sh-tool .sht-box--next {
  border-color: var(--sht-primary-teal);
  background: var(--sht-tint-teal);
}

.sh-tool .sht-box-heading {
  margin: 0 0 var(--sht-space-2);
  color: var(--sht-primary-teal);
  font-family: Spectral, Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}

.sh-tool .sht-contacts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sh-tool .sht-contacts li {
  margin: 0;
  padding: var(--sht-space-2) 0;
  border-top: 1px solid var(--sht-border);
  overflow-wrap: anywhere;
}

.sh-tool .sht-contacts li:first-child {
  border-top: 0;
  padding-top: 0;
}

.sh-tool .sht-contacts a {
  color: var(--sht-primary-teal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sh-tool .sht-contacts a:hover {
  color: var(--sht-secondary-teal);
}

.sh-tool .sht-footer {
  margin-top: var(--sht-space-5);
  padding-top: var(--sht-space-4);
  border-top: 1px solid var(--sht-border);
  color: var(--sht-muted-slate);
  font-size: 13px;
}

.sh-tool .sht-footer p + p {
  margin-top: var(--sht-space-2);
}

.sh-tool .sht-legal-links a {
  color: var(--sht-primary-teal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sh-tool .sht-legal-links a:hover {
  color: var(--sht-secondary-teal);
}

.sh-tool .sht-print-only {
  display: none;
}

/* ---- Narrow screens ------------------------------------------------------ */
@media (max-width: 480px) {
  .sh-tool .sht-header {
    padding: var(--sht-space-5) var(--sht-space-4) var(--sht-space-3);
  }

  .sh-tool .sht-tabs {
    padding: 0 var(--sht-space-2);
  }

  .sh-tool .sht-tab {
    font-size: 11px;
  }

  .sh-tool .sht-tab-icon svg {
    width: 15px;
    height: 15px;
  }

  .sh-tool .sht-panel {
    padding: var(--sht-space-4) var(--sht-space-3);
  }

  .sh-tool .sht-nav .sht-btn,
  .sh-tool .sht-actions .sht-btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sh-tool .sht-option,
  .sh-tool .sht-radio::before,
  .sh-tool .sht-btn {
    transition: none;
  }
}

/* ---- Print --------------------------------------------------------------- */
@media print {
  /* Page-level exception: only while the tool's own Print button is used. */
  html.sh-tool-printing body * {
    visibility: hidden;
  }

  html.sh-tool-printing .sh-tool.is-printing,
  html.sh-tool-printing .sh-tool.is-printing * {
    visibility: visible;
  }

  html.sh-tool-printing .sh-tool.is-printing {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
  }

  .sh-tool .sht-tabs,
  .sh-tool .sht-panel[data-step],
  .sh-tool .sht-actions,
  .sh-tool .sht-draft-banner,
  .sh-tool .sht-subtitle {
    display: none !important;
  }

  .sh-tool .sht-print-only {
    display: block;
    margin-top: var(--sht-space-3);
    font-size: 12px;
  }

  .sh-tool .sht-path,
  .sh-tool .sht-box {
    break-inside: avoid;
  }

  .sh-tool .sht-contacts a::after {
    content: " (" attr(href) ")";
    font-weight: 400;
  }
}
