/* ============================================================================
   IP ANIMALS — /tools/ styles
   Loaded alongside the main style.css (palette + page background).
   Generic building blocks so every tool page looks like one system.
   ============================================================================ */

.learn-top {
  max-width: 860px; margin: 0 auto 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.learn-home { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; font-weight: 800; color: var(--grass-dk); font-size: 1.05rem; }
.learn-home:hover { text-decoration: underline; }
.learn-nav a { text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: 0.92rem; margin-left: 0.9rem; }
.learn-nav a:hover { color: var(--grass-dk); }

.crumbs { max-width: 860px; margin: 0 auto 0.8rem; font-size: 0.85rem; color: var(--ink-soft); }
.crumbs a { color: var(--grass-dk); text-decoration: none; font-weight: 700; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { opacity: 0.6; margin: 0 0.35rem; }

/* main tool container */
.tool {
  max-width: 860px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--card-edge);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: clamp(1.4rem, 4vw, 2.6rem);
}
.tool .kicker {
  display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--grass-dk);
  background: #eef7ea; border: 1px solid var(--card-edge);
  padding: 0.25rem 0.7rem; border-radius: 999px; margin-bottom: 0.9rem;
}
.tool h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.15; margin: 0 0 0.5rem; color: var(--ink); }
.tool .lead { font-size: 1.12rem; color: var(--ink-soft); margin: 0 0 1.5rem; line-height: 1.6; }

/* ---- the interactive panel ---- */
.tool-panel {
  background: #f6faf4; border: 1px solid var(--card-edge);
  border-radius: 16px; padding: 1.3rem; margin: 0 0 1.4rem;
}
.tool-field { margin: 0 0 1rem; }
.tool-field:last-child { margin-bottom: 0; }
.tool-field label { display: block; font-weight: 800; font-size: 0.9rem; color: var(--ink); margin-bottom: 0.35rem; }
.tool-field .hint { font-weight: 600; color: var(--ink-soft); font-size: 0.82rem; }

.tool-input, textarea.tool-input, select.tool-input {
  width: 100%; padding: 0.65rem 0.85rem; border-radius: 10px;
  border: 2px solid var(--card-edge); background: #fff; color: var(--ink);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem;
  transition: border-color 0.16s ease;
}
.tool-input:focus, textarea.tool-input:focus, select.tool-input:focus { outline: none; border-color: var(--grass); }
textarea.tool-input { min-height: 120px; resize: vertical; line-height: 1.5; }
select.tool-input { font-family: inherit; cursor: pointer; }

.tool-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: flex-end; }
.tool-row .tool-field { flex: 1 1 180px; margin-bottom: 0; }

.tool-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.tool-btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 0.98rem;
  padding: 0.65rem 1.3rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--grass), var(--grass-dk)); color: #fff;
  box-shadow: var(--shadow-sm); transition: transform 0.12s ease, filter 0.16s ease;
}
.tool-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.tool-btn:active { transform: scale(0.97); }
.tool-btn.secondary { background: #fff; color: var(--ink); border: 2px solid var(--card-edge); box-shadow: none; }
.tool-btn.secondary:hover { border-color: var(--grass); }

/* checkbox / range rows */
.tool-check { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--ink); font-size: 0.92rem; cursor: pointer; }
.tool-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--grass-dk); cursor: pointer; }
.tool-range { display: flex; align-items: center; gap: 0.8rem; }
.tool-range input[type="range"] { flex: 1; accent-color: var(--grass-dk); }
.tool-range .rangeval { font-family: ui-monospace, monospace; font-weight: 800; min-width: 3ch; text-align: right; }

/* ---- output ---- */
.tool-output { margin-top: 1.2rem; }
.tool-output:empty { display: none; }
.out-box {
  background: #fff; border: 1px solid var(--card-edge); border-radius: 12px;
  padding: 1rem 1.1rem; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.98rem; word-break: break-word; white-space: pre-wrap; color: var(--ink);
  position: relative;
}
.out-box.big { font-size: 1.25rem; font-weight: 700; text-align: center; }
.tool-error { color: #b23b3b; font-weight: 700; background: #fdecec; border: 1px solid #f4c9c9; border-radius: 10px; padding: 0.7rem 0.9rem; margin-top: 0.8rem; }
.tool-error:empty { display: none; }

/* label/value result grid */
.result-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.result-grid dt { font-weight: 800; color: var(--ink-soft); font-family: inherit; }
.result-grid dd { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--ink); word-break: break-all; }

/* copy button */
.copy-inline {
  border: none; cursor: pointer; background: var(--sun); color: #5a4500;
  font-weight: 800; font-family: inherit; border-radius: 999px;
  padding: 0.28rem 0.7rem; font-size: 0.78rem; margin-left: 0.4rem;
}
.copy-inline:hover { background: var(--sun-dk); }
.copy-inline.copied { background: var(--good); color: #fff; }

/* reference tables (ports, status codes, etc.) */
.tool .table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.tool table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.tool th, .tool td { border: 1px solid var(--card-edge); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
.tool th { background: #eef7ea; font-weight: 800; color: var(--ink); position: sticky; top: 0; }
.tool td code, .tool .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.tool tr.is-hidden { display: none; }
.ref-filter { margin-bottom: 0.9rem; }

/* about / body copy under the tool */
.tool-about { margin-top: 1.8rem; }
.tool-about h2 { font-size: 1.35rem; margin: 1.6rem 0 0.6rem; color: var(--ink); border-bottom: 2px solid var(--card-edge); padding-bottom: 0.3rem; }
.tool-about h3 { font-size: 1.1rem; margin: 1.2rem 0 0.4rem; }
.tool-about p, .tool-about li { color: #333c44; line-height: 1.7; }
.tool-about p { margin: 0 0 0.9rem; }
.tool-about ul, .tool-about ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.tool-about a { color: var(--grass-dk); font-weight: 600; }
.tool-about code { background: #f1f5f0; border: 1px solid var(--card-edge); padding: 0.08rem 0.38rem; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 0.9em; color: #295c1f; }

.callout { background: linear-gradient(135deg, #eff9ee, #fff7e8); border: 1px solid var(--card-edge); border-left: 5px solid var(--grass); border-radius: 12px; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.callout .callout-title { font-weight: 800; color: var(--ink); display: block; margin-bottom: 0.3rem; }
.callout p:last-child { margin-bottom: 0; }

/* FAQ */
.tool-faq { margin-top: 1.6rem; }
.tool-faq details { border: 1px solid var(--card-edge); border-radius: 12px; padding: 0.4rem 1rem; margin: 0.6rem 0; background: #fbfdfa; }
.tool-faq summary { font-weight: 800; cursor: pointer; padding: 0.5rem 0; color: var(--ink); }
.tool-faq p { margin: 0.2rem 0 0.8rem; color: #333c44; }

/* related */
.related { max-width: 860px; margin: 1.6rem auto 0; background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.4rem 1.6rem; }
.related h2 { font-size: 1.2rem; margin: 0 0 0.8rem; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.related a { text-decoration: none; color: var(--grass-dk); font-weight: 700; }
.related a:hover { text-decoration: underline; }
.related a::before { content: "🛠️ "; }

.learn-cta { max-width: 860px; margin: 1.6rem auto 0; text-align: center; color: var(--ink-soft); font-size: 0.95rem; }
.learn-cta a { color: var(--grass-dk); font-weight: 800; text-decoration: none; }

/* ============================================================================
   HUB (/tools/index.html)
   ============================================================================ */
.hub-head { max-width: 900px; margin: 0 auto 1.4rem; text-align: center; }
.hub-head h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0.3rem 0; }
.hub-head p { color: var(--ink-soft); font-size: 1.1rem; max-width: 640px; margin: 0.4rem auto; }
.hub-search { display: block; width: 100%; max-width: 460px; margin: 1.2rem auto 0; padding: 0.7rem 1rem; border-radius: 999px; border: 2px solid var(--card-edge); font-family: inherit; font-size: 1rem; background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.hub-search:focus { outline: none; border-color: var(--grass); }

.hub-cat { max-width: 1000px; margin: 2.2rem auto 0; }
.hub-cat > h2 { font-size: 1.4rem; margin: 0 0 0.9rem; color: var(--ink); display: flex; align-items: center; gap: 0.5rem; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.9rem; }
.hub-card { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--card-edge); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.hub-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--grass); }
.hub-card h3 { margin: 0 0 0.3rem; font-size: 1.02rem; color: var(--ink); display: flex; align-items: center; gap: 0.4rem; }
.hub-card p { margin: 0; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.5; }
.hub-card.is-hidden { display: none; }
.hub-cat.is-hidden { display: none; }
