/* ============================================================
   5i.fi/ip — IP tools. Inherits tokens + background from ../styles.css
   ============================================================ */

:root {
  --field:   #0F141A;   /* input wells, a touch darker than panel */
  --danger:  #F2686B;
  --ok:      #3FE0C8;
}

/* ---------- Layout ---------- */
.ip-wrap {
  max-width: var(--maxw);   /* shared site width, from ../styles.css */
  margin: 0 auto;
  padding: 0 24px 40px;
}

.node-id__path { color: var(--muted); }

.share-btn {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hairline-2);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}
.share-btn:hover { color: var(--aqua); border-color: var(--aqua-dim); }

/* ---------- Page hero ---------- */
.page-hero {
  padding: clamp(48px, 9vw, 96px) 0 clamp(28px, 5vw, 44px);
}
.page-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.page-hero__lede {
  max-width: 56ch;
  color: #C4CCD4;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  margin: 0;
}

/* ---------- Tool tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline);
}
.tab {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.tab:hover { color: var(--text); border-color: var(--hairline-2); background: var(--panel); }
.tab.is-active {
  color: var(--bg);
  background: var(--aqua);
  border-color: var(--aqua);
  font-weight: 600;
}

/* ---------- Tool card ---------- */
.tool {
  display: none;
  padding: clamp(24px, 4vw, 36px) 0 8px;
  scroll-margin-top: 20px;
}
.tool.is-active { display: block; animation: toolIn .28s ease; }
.tool:focus-visible { outline: none; }
@keyframes toolIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tool.is-active { animation: none; }
}
.tool__head { margin-bottom: 22px; }
.tool__head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.tool__desc { color: var(--muted); margin: 0; font-size: 0.95rem; max-width: 62ch; }

/* ---------- Fields ---------- */
.field { margin-bottom: 18px; }
.field--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.field__grow { flex: 1 1 200px; }
.field--inline > div { min-width: 0; }

.lbl {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.inp {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--hairline-2);
  border-radius: 9px;
  padding: 11px 13px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.inp::placeholder { color: var(--muted-dim); }
.inp:focus {
  outline: none;
  border-color: var(--aqua-dim);
  box-shadow: 0 0 0 3px rgba(63,224,200,0.14);
}
select.inp { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea.inp { resize: vertical; line-height: 1.5; }

.btn {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--hairline-2);
  border-radius: 9px;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease;
}
.btn:hover { color: var(--aqua); border-color: var(--aqua-dim); }

/* ---------- Output ---------- */
.out:empty { display: none; }
.out { margin-top: 4px; }
.err {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--danger);
  border: 1px solid rgba(242,104,107,0.35);
  background: rgba(242,104,107,0.06);
  border-radius: 9px;
  padding: 11px 14px;
}
.hint {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted-dim);
}

/* Result grid (label / value rows) */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.res {
  background: var(--panel);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.res__k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}
.res__v {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  word-break: break-all;
}
.res__v.accent { color: var(--aqua); }

/* Copyable value */
.copyable { cursor: pointer; border-bottom: 1px dotted transparent; transition: border-color .15s ease; }
.copyable:hover { border-bottom-color: var(--aqua-dim); }

/* ---------- Simple data tables ---------- */
.dtable {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13.5px;
}
.dtable th, .dtable td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.dtable th {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.dtable td { color: var(--text); }
.dtable td.idx { color: var(--muted-dim); }
.dtable tr:hover td { background: var(--panel-2); }
.table-scroll {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 460px;
}
.count-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  margin: 12px 2px 0;
}
.count-note b { color: var(--amber); font-weight: 600; }

.cidr-list {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.cidr-list .accent { color: var(--aqua); }

/* ---------- Subnet splitter tree ---------- */
.tree { display: flex; flex-direction: column; gap: 6px; }
.node { display: flex; flex-direction: column; }
.node__head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding: 3px 2px 5px;
  cursor: pointer;
  user-select: none;
}
.node__head:hover { color: var(--aqua); }
.node__head .join {
  font-size: 11px;
  border: 1px solid var(--hairline-2);
  border-radius: 5px;
  padding: 1px 7px;
}
.node__kids {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 16px;
  border-left: 1px solid var(--hairline-2);
}
.leaf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid var(--leaf-bd, var(--hairline-2));
  border-left: 3px solid var(--leaf-ac, var(--aqua));
  background: var(--leaf-bg, var(--panel));
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.leaf:hover { transform: translateX(2px); filter: brightness(1.15); }
.leaf__cidr { font-family: var(--font-mono); font-size: 14px; color: var(--text); font-weight: 600; }
.leaf__meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.split-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--panel-2);
  border: 1px solid var(--aqua-dim);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer spacing on this page ---------- */
.ip-page .footer { max-width: var(--maxw); }

@media (max-width: 560px) {
  .field--inline { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .leaf:hover { transform: none; }
}
