/* Tools hub and shared tool-page layout. Uses the site tokens from styles.css. */

.tool-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;
}

/* ---------- Tools hub ---------- */
.tools-hub-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--ink); border: 1px solid var(--ink); }
.tools-hub-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 320px; padding: 28px; background: var(--paper); color: var(--ink); text-decoration: none; font-family: var(--ui-font); }
.tools-hub-card:hover { background: var(--lime); }
.tools-hub-card:focus-visible { outline: 3px solid var(--acid); outline-offset: 3px; }
.tools-hub-card h2 { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.25; letter-spacing: -.02em; word-break: keep-all; }
.tools-hub-card p { margin: 0; line-height: 1.6; }
.tools-hub-card dl { display: grid; gap: 10px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line-strong); font-size: 14px; line-height: 1.55; }
.tools-hub-card dt { font-weight: 700; }
.tools-hub-card dd { margin: 2px 0 0; }
.tools-hub-open { margin-top: auto; font-weight: 700; }
.tools-hub-guides { max-width: 740px; margin: 80px auto 0; padding-top: 24px; border-top: 1px solid var(--ink); font-family: var(--ui-font); }
.tools-hub-guides h2 { margin: 0 0 18px; font-size: 24px; }
.tools-hub-guides ul { list-style: none; margin: 0; padding: 0; }
.tools-hub-guides li { display: grid; gap: 4px; margin: 0 0 18px; line-height: 1.6; }
.tools-hub-guides a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Tool page frame ---------- */
.tool-page .tool-panel { margin-top: 56px; border: 1px solid var(--ink); background: var(--soft); font-family: var(--ui-font); }
.tool-panel [hidden] { display: none !important; }
.tool-panel-section { padding: 30px; }
.tool-panel-section + .tool-panel-section { border-top: 1px solid var(--ink); }
.tool-panel h2 { margin: 0 0 10px; font-size: clamp(24px, 3vw, 34px); line-height: 1.3; letter-spacing: -.02em; }
.tool-panel-lead { max-width: 680px; margin: 0 0 22px; line-height: 1.65; }
.tool-label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.tool-hint { max-width: 680px; margin: 14px 0 0; font-size: 14px; line-height: 1.6; opacity: .78; }
.tool-textarea, .tool-input {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui-font);
}
.tool-textarea { min-height: 190px; padding: 16px; font-size: 18px; line-height: 1.7; resize: vertical; }
.tool-input { min-height: 46px; padding: 0 12px; font-size: 17px; }
.tool-textarea:focus-visible, .tool-input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Tool notes ---------- */
.tool-notes { max-width: 740px; margin: 84px auto 0; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.tool-notes h2 { margin: 60px 0 18px; padding-top: 18px; border-top: 1px solid var(--line-strong); font-size: clamp(26px, 3.4vw, 38px); line-height: 1.3; letter-spacing: -.02em; word-break: keep-all; }
.tool-notes h2:first-child { margin-top: 0; }
.tool-notes p { margin: 0 0 20px; }
.tool-notes ul, .tool-notes ol { margin: 0 0 24px; padding-left: 1.35em; }
.tool-notes li { margin: 0 0 10px; padding-left: .2em; }
.tool-notes a { text-decoration: underline; text-underline-offset: 3px; }
.tool-notes code, .un-css { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }
.tool-credit { margin-top: 8px; padding: 18px 20px; border: 1px solid var(--line-strong); font-size: 14px; line-height: 1.7; }
.tool-faq { margin: 0 0 24px; }
.tool-faq dt { margin: 22px 0 6px; font-weight: 700; }
.tool-faq dt:first-child { margin-top: 0; }
.tool-faq dd { margin: 0; }

/* ---------- Units ---------- */
.un-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; }
.un-field { display: block; min-width: 0; }
.un-table { width: 100%; max-width: 680px; margin-top: 26px; border-collapse: collapse; font-size: 17px; }
.un-table th, .un-table td { padding: 12px 14px; border: 1px solid var(--line-strong); text-align: left; }
.un-table thead th { background: var(--paper-deep); font-size: 14px; }
.un-table tbody th { width: 80px; }
.un-table output { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.un-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 26px 0 0; background: var(--ink); border: 1px solid var(--ink); }
.un-results div { padding: 18px; background: var(--paper); }
.un-results dt { font-size: 14px; }
.un-results dd { margin: 8px 0 0; font-size: 18px; }
.un-results output { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .tools-hub-list { grid-template-columns: minmax(0, 1fr); }
  .tools-hub-card { min-height: 0; padding: 22px; }
  .tool-page .tool-panel { margin-top: 36px; }
  .tool-panel-section { padding: 20px 16px; }
  .tool-notes { margin-top: 56px; font-size: 16px; }
  .tool-notes h2 { margin-top: 44px; }
  .un-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .un-results { grid-template-columns: minmax(0, 1fr); }
}
