/* ==========================================================================
   Green Olive Tree DNS Tools: additions on top of the "Grove" site.css
   ========================================================================== */

:root {
  --pass-bg: var(--olive-100); --pass-fg: var(--olive-700);
  --warn-bg: #fbf0d6;          --warn-fg: #7a5200;
  --fail-bg: #fbe9e7;          --fail-fg: #9b2c1c;
  --info-bg: var(--teal-100);  --info-fg: var(--teal-700);
}
@media (prefers-color-scheme: dark) {
  :root {
    --pass-fg: var(--olive-400);
    --warn-bg: #3a2c0c; --warn-fg: #f2c66b;
    --fail-bg: #3a1712; --fail-fg: #f4b4a8;
    --info-fg: #8fd0ec;
  }
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mono, code, pre { font-family: var(--font-mono); }

/* ---------- Brand lock-up ---------- */
.brand--tools { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand__tag {
  font: 700 .72rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-2); background: var(--olive-100); padding: .45em .65em; border-radius: 6px; white-space: nowrap;
}
@media (max-width: 380px) { .brand img { height: 38px; } .brand__tag { font-size: .64rem; } }

/* ---------- Home hero ---------- */
.hero--tools h1 { max-width: 18ch; }
.quick-search {
  display: grid; gap: 10px; max-width: 860px; margin-top: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-lg);
}
@media (min-width: 760px) { .quick-search { grid-template-columns: 1fr 260px auto; } }
.quick-search input, .quick-search select, .tool-form input, .tool-form select {
  width: 100%; min-height: 50px; padding: .7rem .95rem; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.quick-search input, .tool-form input { font-family: var(--font-mono); font-size: .95rem; }
.quick-search input:focus, .quick-search select:focus, .tool-form input:focus, .tool-form select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.quick-search .btn, .tool-form .btn { min-height: 50px; padding-inline: 1.5rem; }
.your-ip { margin-top: 1.25rem; color: var(--ink-soft); font-size: .95rem; }
.your-ip a { font-weight: 600; }

/* ---------- Tool page header + form ---------- */
.page-hero--tool { padding-block: clamp(32px, 5vw, 56px) clamp(28px, 4vw, 44px); }
.page-hero--tool h1 { font-size: clamp(2rem, 4.2vw, 3rem); margin-bottom: .25em; max-width: none; }
.page-hero--tool .lede { margin-bottom: 0; }
.tool-title { display: flex; gap: 1.1rem; align-items: flex-start; margin-bottom: 1.75rem; }
.tool-title .icon-badge { flex-shrink: 0; margin: .35rem 0 0; width: 54px; height: 54px; }
.tool-title .icon-badge svg { width: 28px; height: 28px; }
@media (max-width: 560px) { .tool-title .icon-badge { display: none; } }

.tool-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 2vw, 20px);
  box-shadow: var(--shadow); max-width: 980px;
}
.tool-form__fields { display: grid; gap: 14px; }
@media (min-width: 760px) {
  .tool-form__fields { grid-template-columns: minmax(0, 2fr) repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
  .tool-form__fields .field--submit { justify-self: start; }
}
.tool-form .field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .35rem; color: var(--ink-soft); }
.field--submit label { visibility: hidden; }

/* Busy state */
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.is-busy .spinner { display: inline-block; }
.is-busy .btn { pointer-events: none; opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Results ---------- */
.results .wrap > * + * { margin-top: 18px; }
.results__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; font: 500 .8rem/1.4 var(--font-mono); color: var(--muted); letter-spacing: .02em; }
.empty-state { color: var(--muted); padding: 1rem 0; }

.alert { display: flex; gap: .8rem; align-items: flex-start; padding: 14px 18px; border-radius: 12px; font-weight: 550; }
.alert svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: .1rem; }
.alert p { margin: 0; }
.alert--ok   { background: var(--pass-bg); color: var(--pass-fg); }
.alert--warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert--err  { background: var(--fail-bg); color: var(--fail-fg); }
.alert--info { background: var(--surface-2); color: var(--ink-soft); font-weight: 450; font-size: .95rem; }

.metric-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.metric__label { display: block; font: 600 .72rem/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .45rem; }
.metric__value { display: block; font: 600 1.45rem/1.15 var(--font-display); letter-spacing: -.02em; color: var(--ink); overflow-wrap: anywhere; }

.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.4vw, 24px); min-width: 0; }
.result-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .9rem; }
.result-card__head .result-card__title { margin: 0; }
.result-card__head .copy-btn { margin-left: auto; }
.result-card__title { font-size: 1.15rem; margin-bottom: .9rem; overflow-wrap: anywhere; }
.result-card__sub { color: var(--muted); font: 500 .8rem/1.4 var(--font-mono); margin: -.5rem 0 .9rem; }
.result-card__head .result-card__sub, summary .result-card__sub { margin: 0; }
.result-card .facts { border-top: 0; }
.result-card .facts dt:first-of-type, .result-card .facts dt:first-of-type + dd { padding-top: 0; }
.result-card .table-wrap { margin: 0 calc(-1 * clamp(16px, 2.4vw, 24px)); padding: 0 clamp(16px, 2.4vw, 24px); }

.result-card--details summary { cursor: pointer; font: 600 1rem/1.3 var(--font-display); display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.result-card--details[open] summary { margin-bottom: 1rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data thead th { font: 600 .72rem/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.mono { font-size: .84rem; overflow-wrap: anywhere; word-break: break-word; }
table.data td { min-width: 4.5rem; }

@media (max-width: 640px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  table.data tbody tr:last-child { border-bottom: 0; }
  table.data td { border: 0; padding: .2rem 0; }
  table.data td[data-label]:not([data-label=""])::before {
    content: attr(data-label); display: block; font: 600 .68rem/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }
}

.badge { display: inline-block; padding: .28em .62em; border-radius: 999px; font: 700 .72rem/1.2 var(--font-body); letter-spacing: .03em; white-space: nowrap; }
.badge--pass { background: var(--pass-bg); color: var(--pass-fg); }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge--fail { background: var(--fail-bg); color: var(--fail-fg); }
.badge--info { background: var(--info-bg); color: var(--info-fg); }

pre.code {
  margin: 0; background: var(--teal-900); color: #d7e6ea; padding: 1rem 1.15rem; border-radius: var(--radius-sm);
  overflow: auto; max-height: 640px; font-size: .82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
@media (prefers-color-scheme: dark) { pre.code { background: #071116; } }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Tool cards ---------- */
.tool-card h3 { font-size: 1.12rem; }
.tool-card p { font-size: .94rem; }
.tool-grid--small .card { flex-direction: row; align-items: center; gap: .9rem; padding: 16px 18px; }
.tool-grid--small .icon-badge { margin: 0; width: 40px; height: 40px; flex-shrink: 0; }
.tool-grid--small .icon-badge svg { width: 20px; height: 20px; }
.tool-grid--small h3 { margin: 0; font-size: 1rem; }
.tool-section + .tool-section { padding-top: 0; }
.tool-section .section-head { margin-bottom: 24px; }
.tool-section .eyebrow { font-size: .85rem; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--teal-900); color: #dbe7ea; margin-top: clamp(40px, 6vw, 72px); position: relative; overflow: hidden; }
.cta-band::after {
  content: ""; position: absolute; right: -40px; bottom: -50px; width: min(300px, 45vw); aspect-ratio: 400/437;
  background: url("/assets/img/tree-mark-white.png") no-repeat center / contain; opacity: .07; pointer-events: none;
}
.cta-band__inner { position: relative; z-index: 1; display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 900px) { .cta-band__inner { grid-template-columns: 1.4fr auto; } }
.cta-band h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.cta-band .lede { color: #b9cdd3; margin-bottom: 0; }
.cta-band .eyebrow { color: var(--olive-400); }
.btn--on-ink { --btn-fg: #fff; --btn-bd: rgb(255 255 255 / 35%); }
.btn--on-ink:hover { --btn-bd: #fff; }
.cta-band + .site-footer { margin-top: 0; }
.cta-band + .site-footer .footer-main { border-top: 1px solid rgb(255 255 255 / 10%); }

/* Keep top-level nav labels on one line, but let dropdown descriptions wrap */
@media (min-width: 1040px) {
  .primary-nav > ul > li > a, .primary-nav > ul > li > button { white-space: nowrap; padding-inline: .65rem; }
  .submenu a { white-space: normal; overflow-wrap: break-word; }
}
@media (min-width: 1040px) and (max-width: 1359px) { .nav-cta .btn--ghost { display: none; } }

/* ---------- Menu layout switch: dropdown menus vs. tile view ---------- */
.nav-tiles-li { display: none; }
.view-tiles .nav-tiles-li { display: block; }
.view-tiles .primary-nav .nav-group { display: none; }
.nav-tiles-btn svg:first-child { width: 16px; height: 16px; }
.primary-nav .nav-tiles-btn {
  display: flex; width: 100%; align-items: center; gap: .45rem;
  padding: .85rem .25rem; border: 0; border-bottom: 1px solid var(--line); background: none;
  color: var(--ink); font: 550 1rem/1.2 var(--font-body); cursor: pointer; text-align: left;
}
.primary-nav .nav-tiles-btn svg:last-child { margin-left: auto; transition: transform .2s; }
.nav-tiles-btn[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
@media (min-width: 1040px) {
  .primary-nav .nav-tiles-btn { width: auto; border: 0; padding: .55rem .8rem; border-radius: 8px; font-size: .95rem; white-space: nowrap; }
  .primary-nav .nav-tiles-btn:hover { background: var(--surface-2); }
  .primary-nav .nav-tiles-btn svg:last-child { margin-left: .1rem; }
}

.view-switch {
  display: inline-flex; flex-shrink: 0; padding: 3px; gap: 2px; margin-left: auto;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.view-switch button {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer;
}
.view-switch button svg { width: 17px; height: 17px; }
.view-switch button:hover { color: var(--ink); background: var(--surface-2); }
.view-switch button[aria-pressed="true"] { background: var(--teal-100); color: var(--accent); }
@media (min-width: 1040px) { .view-switch { margin-left: 0; } }
.nav-bar { gap: .75rem; }

.tile-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 120px); overflow-y: auto; padding-block: 22px 28px;
}
.tile-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 14px; }
.tile-panel__title { margin: 0; font: 600 1.15rem/1.2 var(--font-display); letter-spacing: -.01em; }
/* Header fit: drop secondary items as the bar narrows */
@media (min-width: 1040px) and (max-width: 1239px) { .nav-cta { display: none; } }
@media (max-width: 1039px) { .view-switch button { width: 32px; height: 32px; } }
@media (max-width: 479px) { .brand__tag { display: none; } .nav-bar { gap: .5rem; } }

/* ---------- Quick-run tiles ("paste and go") ---------- */
.home-tiles { display: none; padding-top: 28px; }
.view-tiles .home-tiles { display: block; }
.view-tiles .home-cards { display: none; }
.home-tiles__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1.5rem; margin-bottom: 18px; }
.home-tiles__head h1 { margin: 0; font-size: 1.5rem; }
.home-tiles__head p { margin: 0; }

.qgroups { display: grid; gap: 22px; }
.qgroup__h { font: 700 .74rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 .65rem; }
.qtiles { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .qtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .qtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qtile {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; height: 136px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.qtile:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.qtile--current { border-color: var(--accent); }
.qtile__head { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.02rem; }
.qtile__head:hover .qtile__name { color: var(--accent); text-decoration: underline; }
.qtile__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qtile__icon { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px; background: var(--teal-100); color: var(--accent); }
.qtile__icon svg { width: 19px; height: 19px; }
.qgroup:nth-child(n+3) .qtile__icon { background: var(--olive-100); color: var(--accent-2); }
.qtile__row { display: flex; gap: 6px; margin-top: auto; min-width: 0; }
.qtile__row input, .qtile__row select {
  min-width: 0; height: 48px; padding: 0 .85rem; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--paper); color: var(--ink); font: 500 .95rem/1 var(--font-mono);
}
.qtile__row input { flex: 1 1 auto; width: 100%; }
.qtile__row select { flex: 0 0 auto; width: 84px; padding-right: .2rem; font-size: .88rem; }
.qtile__row input:focus, .qtile__row select:focus { outline: none; border-color: var(--accent); }
.qtile__static { flex: 1; display: flex; align-items: center; height: 48px; padding: 0 .85rem; border-radius: 10px; background: var(--surface-2); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qtile__go {
  flex: 0 0 48px; display: grid; place-items: center; height: 48px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.qtile__go:hover { filter: brightness(1.08); }
.qtile__go svg { width: 20px; height: 20px; }
.qtile__go .spinner { width: 16px; height: 16px; }
.is-busy .qtile__go svg { display: none; }
.is-busy .qtile__go { pointer-events: none; }

.tile-panel .qtile { background: var(--paper); }
.tile-panel .qtile__row input, .tile-panel .qtile__row select { background: var(--surface); }
