/* DNS DOJO — style.css
   Dark arcade / retro-terminal. Matches The Lab tokens (lab.css).
   Pixel type (Press Start 2P) lives in the masthead, panel HUD labels and
   key actions; the working controls stay legible and utilitarian. */

/* ---------- fonts (self-hosted, shared with the lab root) ---------- */
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

/* ---------- tokens ---------- */
:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --control-line: #5e5e80; /* >=3:1 against --surface for form-field boundaries */
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;

  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 8px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-normal: 300ms;
  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --space-gutter: clamp(16px, 4vw, 48px);
}

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

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 50% -8%, rgba(69, 240, 255, 0.06), transparent 70%),
    radial-gradient(900px 420px at 92% 8%, rgba(255, 61, 139, 0.05), transparent 72%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(69, 240, 255, 0.3); color: #05050d; }

[hidden] { display: none !important; }

a { color: var(--cyan); }

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

code {
  font-family: var(--mono);
  font-size: 0.95em;
}

h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.16);
  border-radius: 3px;
}

.shell {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--space-gutter);
}

/* ---------- skip + back link ---------- */
.skip-link {
  position: absolute;
  left: 12px; top: -56px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--dur-normal) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(68px); }

.lab-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 8px 12px;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-decoration: none;
  background: rgba(10, 10, 18, 0.78);
  border: 1px solid var(--line);
  border-radius: 6px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    text-shadow var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.lab-link__chev { transition: transform var(--dur-fast) var(--ease-out); }
.lab-link:hover,
.lab-link:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: var(--glow-cyan);
}
.lab-link:hover .lab-link__chev,
.lab-link:focus-visible .lab-link__chev { transform: translateX(-3px); }

/* ---------- scanlines / CRT texture ---------- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}
.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.34) 100%);
}

/* ---------- masthead ---------- */
.masthead {
  padding-top: clamp(56px, 9vw, 96px);
  padding-bottom: clamp(20px, 4vw, 40px);
}
.masthead .shell {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.masthead__level {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 200, 87, 0.3);
}

.masthead__title {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(1.7rem, 0.6rem + 6.2vw, 4rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(69, 240, 255, 0.4), 0 0 52px rgba(69, 240, 255, 0.16);
}

.masthead__tag {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  max-width: 46rem;
  color: var(--dim);
  font-size: clamp(0.95rem, 0.9rem + 0.4vw, 1.1rem);
}
.cursor {
  display: inline-block;
  color: var(--cyan);
  animation: blink 1.1s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- glitch title ---------- */
.glitch { position: relative; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}
.glitch::before { color: var(--cyan); }
.glitch::after { color: var(--magenta); }
.glitch:hover::before { animation: glitch-a 0.42s steps(3, jump-none) 1; }
.glitch:hover::after { animation: glitch-b 0.42s steps(3, jump-none) 1; }
@keyframes glitch-a {
  0%   { opacity: 0.85; clip-path: inset(8% 0 72% 0);  transform: translate3d(-5px, -2px, 0); }
  33%  { opacity: 0.85; clip-path: inset(54% 0 22% 0); transform: translate3d(4px, 1px, 0); }
  66%  { opacity: 0.85; clip-path: inset(28% 0 50% 0); transform: translate3d(-3px, 2px, 0); }
  100% { opacity: 0;    clip-path: inset(45% 0 45% 0); transform: translate3d(0, 0, 0); }
}
@keyframes glitch-b {
  0%   { opacity: 0.85; clip-path: inset(64% 0 16% 0); transform: translate3d(5px, 2px, 0); }
  33%  { opacity: 0.85; clip-path: inset(12% 0 70% 0); transform: translate3d(-4px, -1px, 0); }
  66%  { opacity: 0.85; clip-path: inset(42% 0 36% 0); transform: translate3d(3px, -2px, 0); }
  100% { opacity: 0;    clip-path: inset(45% 0 45% 0); transform: translate3d(0, 0, 0); }
}

/* ---------- layout ---------- */
.app-layout {
  flex: 1;
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
  padding-bottom: clamp(40px, 6vw, 72px);
  align-items: start;
}

/* ---------- panels ---------- */
.panel {
  position: relative;
  padding: clamp(16px, 3vw, 28px);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 64%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel::before {
  /* cabinet vent strip — matches lab card detailing */
  content: "";
  position: absolute;
  top: 9px;
  right: clamp(16px, 3vw, 28px);
  width: 42px;
  height: 8px;
  background: repeating-linear-gradient(180deg, var(--line) 0 2px, transparent 2px 4px);
  border-radius: 2px;
  opacity: 0.7;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.1rem;
}

.panel-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55em;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(11px, 2.2vw, 14px);
  letter-spacing: 0.06em;
  color: var(--text);
  text-shadow: 0 0 14px rgba(69, 240, 255, 0.22);
}
.panel-title__num { color: var(--magenta); text-shadow: 0 0 12px rgba(255, 61, 139, 0.4); }

.panel-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--dim);
}

/* ---------- lookup form ---------- */
.lookup-form { display: grid; gap: 1.4rem; }

.field-group { display: grid; gap: 0.5rem; }

.field-label {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(69, 240, 255, 0.25);
}

.prompt-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: #05050d;
  overflow: hidden;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.prompt-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.prompt-sigil {
  display: grid;
  place-items: center;
  padding-inline: 0.9rem;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--green);
  background: rgba(65, 255, 139, 0.06);
  border-right: 1px solid var(--line);
}
.domain-input {
  flex: 1;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0.7rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}
.domain-input:focus-visible { outline: none; box-shadow: none; }
.domain-input::placeholder { color: color-mix(in srgb, var(--dim) 62%, transparent); }

.help-text {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  overflow-wrap: anywhere;
}

/* ---------- record-type toggles ---------- */
.record-types { min-width: 0; margin: 0; padding: 0; border: 0; }

.type-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.7rem 0; }

.chip-btn {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.7rem 0.85rem;
  min-height: 40px;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.chip-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--cyan);
  transform: translateY(-2px);
}
.chip-btn:active:not(:disabled) { transform: translateY(0); }

.record-type-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.record-type-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}
.record-type-option:hover { border-color: var(--control-line); transform: translateY(-1px); }
.record-type-option:has(input:checked) {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(69, 240, 255, 0.08), var(--surface));
  box-shadow: inset 0 0 0 1px rgba(69, 240, 255, 0.25);
}
.record-type-option:has(input:focus-visible) {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.record-type-option input {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  accent-color: var(--cyan);
}
.record-type-option__text { display: grid; gap: 0.05rem; min-width: 0; }
.record-type-option__text strong {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
}
.record-type-option:has(input:checked) .record-type-option__text strong { color: var(--cyan); }
.record-type-option__text small {
  font-size: 0.74rem;
  color: var(--dim);
}

/* ---------- buttons ---------- */
.form-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 2.9rem;
  padding: 0.7rem 1.1rem;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: 6px;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease,
    background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.btn:hover:not(:disabled) { border-color: var(--cyan); transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-primary {
  color: #05050d;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--bg), 0 0 22px rgba(69, 240, 255, 0.4);
}
.btn-primary:hover:not(:disabled) {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--bg), 0 0 34px rgba(69, 240, 255, 0.6);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--dim);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--dim); }

/* ---------- status panel ---------- */
.status-message {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.status-led {
  flex: 0 0 auto;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 3px rgba(154, 160, 181, 0.12);
}
.status-message[data-state="idle"] .status-led { background: var(--dim); }
.status-message[data-state="loading"] {
  color: var(--cyan);
}
.status-message[data-state="loading"] .status-led {
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(69, 240, 255, 0.16), 0 0 12px rgba(69, 240, 255, 0.6);
  animation: led-pulse 0.9s ease-in-out infinite;
}
@keyframes led-pulse { 50% { opacity: 0.3; } }
.status-message[data-state="success"] { color: var(--green); }
.status-message[data-state="success"] .status-led { background: var(--green); box-shadow: 0 0 0 3px rgba(65, 255, 139, 0.16), 0 0 12px rgba(65, 255, 139, 0.55); }
.status-message[data-state="warn"] { color: var(--gold); }
.status-message[data-state="warn"] .status-led { background: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.16), 0 0 12px rgba(255, 200, 87, 0.55); }
.status-message[data-state="empty"] { color: var(--dim); }
.status-message[data-state="error"] { color: var(--red); }
.status-message[data-state="error"] .status-led { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 85, 96, 0.16), 0 0 12px rgba(255, 85, 96, 0.55); }

.resolver-note {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--dim);
}
.resolver-note strong { color: var(--text); }
.resolver-note code {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #05050d;
  border: 1px solid var(--line);
  color: var(--cyan);
}

/* ---------- results ---------- */
.results-header { align-items: flex-end; }

.query-summary {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--dim);
}

.issue-panel {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
}
.issue-panel__title {
  margin-bottom: 0.5rem;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.issue-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding-left: 1.2rem;
  font-family: var(--mono);
  font-size: 0.86rem;
}
.issue-item strong { font-family: var(--mono); }
.issue-item--error { color: var(--red); }
.issue-item--warn { color: var(--gold); }

.results-grid { display: grid; gap: 1rem; }

.empty-state {
  display: grid;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
  color: var(--dim);
}
.empty-state strong {
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.empty-state span { font-family: var(--mono); font-size: 0.85rem; }

/* ---------- record groups ---------- */
.record-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.record-group__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.record-group h3 {
  font-family: var(--pixel);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(69, 240, 255, 0.3);
}
.record-group__header p {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
}
.record-group__header > div { display: grid; gap: 0.15rem; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.record-table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.86rem;
}
.record-table caption {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.record-table th,
.record-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.record-table tbody tr:last-child th,
.record-table tbody tr:last-child td { border-bottom: 0; }
.record-table tbody tr:hover { background: rgba(69, 240, 255, 0.04); }
.record-table thead th {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--dim);
  font-weight: 400;
}
.record-table tbody th { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.record-table td { color: var(--dim); }

.record-value {
  display: block;
  max-width: 42rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  background: #05050d;
  border: 1px solid var(--line);
  color: var(--green);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ---------- copy buttons + status ---------- */
.copy-button {
  min-height: 2.3rem;
  padding: 0.5rem 0.75rem;
  font-size: 8px;
}

.copy-status {
  min-height: 1.4rem;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dim);
}
.copy-status[data-state="success"] { color: var(--green); }
.copy-status[data-state="error"] { color: var(--red); }

.clipboard-fallback {
  position: fixed;
  left: -100vw; top: 0;
  width: 1px; height: 1px;
  opacity: 0;
}

/* ---------- footer ---------- */
.site-footer {
  display: grid;
  gap: 0.4rem;
  padding-block: clamp(24px, 4vw, 40px);
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--dim);
}
.site-footer a { color: var(--cyan); }
.footer__by { color: var(--dim); }

/* ---------- responsive ---------- */
@media (min-width: 600px) {
  .record-type-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 880px) {
  .lookup-form {
    grid-template-columns: minmax(16rem, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
    column-gap: clamp(1.4rem, 3vw, 2.4rem);
  }
  .form-actions { grid-column: 1 / -1; }
  .record-type-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .record-type-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* very narrow phones: keep the toolbar buttons from overflowing */
@media (max-width: 360px) {
  .type-toolbar { gap: 0.4rem; }
  .chip-btn { padding: 0.65rem 0.6rem; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cursor { animation: none; }
  .glitch:hover::before,
  .glitch:hover::after { animation: none; opacity: 0; }
  .btn:hover:not(:disabled),
  .chip-btn:hover:not(:disabled),
  .record-type-option:hover,
  .lab-link:hover { transform: none; }
}
