/* homelab.streamgrove.org — dark terminal-ish theme, no external assets. */

:root {
  --bg: #0b0f14;
  --bg-panel: #121821;
  --border: #22303f;
  --border-bright: #2f4459;
  --text: #dbe4ee;
  --text-dim: #7d90a5;
  --accent: #4dd6c1;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 50% -10%, #16202c 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- masthead ---------- */

.masthead { padding-bottom: 2.5rem; }

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-prompt { color: var(--accent); font-weight: 700; }
.brand-dim { color: var(--text-dim); }
.brand:hover .brand-dim { color: var(--text); }

/* ---------- intro ---------- */

main { flex: 1; }

.intro { margin-bottom: 2.5rem; }

.intro h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0;
  max-width: 62ch;
  color: var(--text-dim);
}

.breadcrumb { margin-bottom: 1.25rem !important; font-family: var(--mono); font-size: 0.85rem; }
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.status-code { font-family: var(--mono); color: var(--accent); }

/* ---------- tool buttons ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-button {
  display: block;
  border-radius: 14px;
  outline-offset: 4px;
  transition: transform 160ms ease, filter 160ms ease;
}

.tool-button img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.tool-button:hover,
.tool-button:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.12);
}

.tool-button:focus-visible { outline: 2px solid var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .tool-button { transition: none; }
  .tool-button:hover, .tool-button:focus-visible { transform: none; }
}

/* ---------- panel ---------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  max-width: 70ch;
}

.panel > p { color: var(--text-dim); margin: 0 0 1.25rem; }

.panel h2 {
  margin: 1.75rem 0 0.75rem;
  font-size: 0.8rem;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.badge {
  display: inline-block;
  margin: 0 0 1rem !important;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  background: #0d1620;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent) !important;
}

.planned { margin: 0; padding-left: 1.2rem; color: var(--text-dim); }
.planned li { margin-bottom: 0.4rem; }
.planned li::marker { color: var(--accent); }

/* ---------- what is my ip ---------- */

.ip-hero {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
  max-width: 70ch;
}

.ip-label {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.ip-address {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  /* Long IPv6 addresses have to shrink rather than overflow the panel. */
  font-size: clamp(1.3rem, 5vw, 2.25rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--accent);
  word-break: break-all;
}

.ip-unknown { color: var(--text-dim); }

.ip-family {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.panel + .panel, .ip-hero + .panel { margin-top: 1.5rem; }

.panel-warn { border-color: #6b4d2a; }
.badge-warn { color: #f2b45c !important; border-color: #6b4d2a; }

.panel h2:first-child { margin-top: 0; }

/* Key/value grid. Collapses to stacked rows on narrow screens. */
.kv {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) 1fr;
  gap: 0.6rem 1.5rem;
  margin: 0;
}

.kv dt {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  padding-top: 0.15rem;
}

.kv dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.kv-line {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.kv-empty { color: var(--text-dim); font-style: italic; }

@media (max-width: 34rem) {
  .kv { grid-template-columns: 1fr; gap: 0.2rem; }
  .kv dd { margin-bottom: 0.8rem; }
}

/* Forwarding chain. Ordered list, but the numbering carries no meaning here. */
.hops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hop {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1219;
}

.hop-addr {
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.hop-infra { opacity: 0.55; }
.hop-infra .hop-addr { color: var(--text-dim); }

.hop-chosen {
  border-color: var(--accent);
  opacity: 1;
  background: #0d1a1c;
}

.hop-chosen .hop-addr { color: var(--accent); font-weight: 600; }

.hop-tag {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.hop-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-left: auto;
}

.snippet {
  margin: 0 0 0.75rem;
  padding: 0.85rem 1rem;
  background: #0b1219;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

.snippet code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre;
}

.note {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.note code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}

/* ---------- dns lookup ---------- */

.lookup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-grow { flex: 1 1 16rem; min-width: 0; }

.field label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field input,
.field select,
.field button {
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
  background: #0b1219;
  color: var(--text);
  /* Stop iOS zooming the page when a field takes focus. */
  max-width: 100%;
}

.field input:focus-visible,
.field select:focus-visible,
.field button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field button {
  background: var(--accent);
  border-color: var(--accent);
  color: #06231f;
  font-weight: 600;
  cursor: pointer;
}

.field button:hover { filter: brightness(1.1); }

.form-error {
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #6b3a3a;
  border-radius: 8px;
  background: #1a1012;
  color: #e8a3a3;
  font-size: 0.9rem;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-head h2 { margin: 0 !important; font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--text); }

.result-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Wide record values must scroll inside the panel, never widen the page. */
.table-scroll { overflow-x: auto; }

.records {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.records th {
  text-align: left;
  padding: 0 0.9rem 0.5rem 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.records td {
  padding: 0.5rem 0.9rem 0.5rem 0;
  border-bottom: 1px solid #182430;
  vertical-align: top;
}

.records tr:last-child td { border-bottom: none; }
.records .num { text-align: right; padding-right: 1.2rem; }
.records .mono { font-family: var(--mono); }
.records .type-tag { color: var(--accent); white-space: nowrap; }

.chain {
  margin: 1rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.9;
  word-break: break-all;
}

.chain-link {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0b1219;
}

.chain-arrow { color: var(--accent); }

.note-lead { margin: 0 !important; }

/* ---------- footer ---------- */

.footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer-dot { margin: 0 0.5rem; }
