/* ---------- Theme: "visualquimia" ----------
   Inspired by visualquimia.com.ar — pure black canvas, hot-magenta accent,
   Helvetica type, small UPPERCASE labels, flat and sharp. Links flip from
   magenta to the foreground colour on hover. A light counterpart keeps the
   same magenta / Helvetica / uppercase character on white.
   (The previous soft/blue theme is preserved in styles.classic.css.) */

:root {
  color-scheme: light dark;

  --bg: light-dark(#f4f4f5, #0b0b0d);
  --surface: light-dark(#ffffff, #17171a);
  --surface-2: light-dark(#ececed, #212125);
  --field: light-dark(#e9e9ea, #1d1d20);
  --text: light-dark(#141414, #f4f4f6);
  --muted: light-dark(#666666, #9a9a9e);
  --border: light-dark(#e0e0e1, #2b2b30);
  /* Accent = Ocean (fixed brand colour); --accent-2/-soft/-contrast derive from it. */
  --accent: light-dark(#0b63c4, #57a5ff);
  --accent-2: color-mix(in srgb, var(--accent), light-dark(#000000, #ffffff) 34%);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --accent-contrast: light-dark(#ffffff, #0a0a0a);
  --chip-bg: light-dark(#ececed, #202020);
  --ok: light-dark(#137a34, #46d17f);
  --ok-soft: light-dark(rgba(19, 122, 52, 0.12), rgba(70, 209, 127, 0.15));
  --err: light-dark(#c02a21, #f2b8b5);
  --warn: light-dark(#8a5300, #ffce85);

  /* shadows can't use light-dark() (that's color-only); set per-theme below */
  --shadow: 0 2px 14px rgba(20, 20, 20, 0.1);
  --shadow-xs: 0 1px 2px rgba(20, 20, 20, 0.08);

  --radius: 3px;
  --radius-lg: 4px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --shadow: 0 2px 14px rgba(20, 20, 20, 0.1);
  --shadow-xs: 0 1px 2px rgba(20, 20, 20, 0.08);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Smooth cross-fade while switching themes. main.js adds .theme-transition
   for ~0.5s around the change so ordinary hovers stay instant. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transition,
  html.theme-transition *,
  html.theme-transition *::before,
  html.theme-transition *::after {
    transition:
      background-color 0.5s ease,
      background-image 0.5s ease,
      border-color 0.5s ease,
      color 0.5s ease,
      fill 0.5s ease,
      box-shadow 0.5s ease !important;
  }
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  max-width: 46rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  accent-color: var(--accent);
}

/* single, subtle magenta glow — flat otherwise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(44rem 30rem at 108% -6%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 68%);
}

main { flex: 1; width: 100%; }

/* Signature interaction: links are magenta, flip to the foreground on hover. */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

h1, h2, h3 { line-height: 1.2; }

.mono { font-family: var(--mono); font-size: 0.925em; }
.muted { color: var(--muted); }

:is(select, input, button, summary, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}

.wordmark {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.wordmark:hover { color: var(--text); }
.wordmark span { color: var(--accent); }
body.hero .wordmark { visibility: hidden; }

/* segmented controls (theme switch, view switch) — flat, uppercase */
.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--chip-bg);
  border-radius: var(--radius);
}
.seg button {
  font: inherit;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.7rem;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ---------- Hero vs compact layout ---------- */

body.hero main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 10vh;
}

.hero-head { text-align: center; margin-bottom: 1.5rem; }
.hero-head h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hero-head .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
.hero-head .tld { color: var(--muted); font-weight: 600; }
.hero-head .tagline { margin: 0.7rem 0 0; color: var(--muted); font-size: 1.02rem; }

/* once a query has run, the big header collapses (kept for screen readers) */
body:not(.hero) .hero-head {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body.hero form { text-align: center; }

.examples {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.1rem;
  font-size: 0.85rem;
}
.examples > .muted {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.examples button {
  font: inherit;
  font-size: 0.82rem;
  font-family: var(--mono);
  padding: 0.3rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.examples button:hover { color: var(--accent); }
body:not(.hero) .examples { display: none; }

.examples .clear {
  border: 0;
  background: none;
  box-shadow: none;
  font-family: var(--font);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}
.examples .clear:hover { color: var(--accent); }
.examples.recent { margin-top: 0.55rem; }

/* ---------- "What is RDAP?" explainer ---------- */

.about-rdap {
  display: flex;
  gap: 0.7rem;
  max-width: 34rem;
  margin: 1.4rem auto 0;
  padding: 0.85rem 1.05rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-align: left;
}
.about-rdap .about-icon {
  flex: none;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.4;
}
.about-rdap p { margin: 0; }
body:not(.hero) .about-rdap { display: none; }

/* ---------- Form ---------- */

.controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.controls select,
.controls input,
.controls button {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
}

body.hero .controls select,
body.hero .controls input,
body.hero .controls button { padding: 0.8rem 0.95rem; font-size: 1.05rem; }

.controls input { flex: 1; min-width: 12rem; font-family: var(--mono); }
.controls input::placeholder { font-family: var(--font); color: var(--muted); }

.controls button {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.controls button:disabled { opacity: 0.55; cursor: default; }

.option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

#status { min-height: 1.2rem; margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--muted); }

.results-bar { display: flex; justify-content: flex-end; margin-top: 0.9rem; }
.results-bar[hidden] { display: none; }

/* ---------- Result cards ---------- */

.card {
  margin-top: 0.9rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card > header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.card > header h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.card > header .src { margin-left: auto; font-size: 0.8rem; white-space: nowrap; }

.badge {
  padding: 0.14rem 0.5rem;
  background: var(--accent);
  border-radius: 2px;
  color: var(--accent-contrast);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.chip {
  padding: 0.14rem 0.55rem;
  background: var(--chip-bg);
  border-radius: 2px;
  font-size: 0.78rem;
}

.card section { margin-top: 0.9rem; }
.card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
}

/* key/value summary */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 1rem; margin: 0.6rem 0 0; }
dl.kv dt { color: var(--muted); font-size: 0.9rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* simple mode */
.card.simple { padding: 1.3rem 1.4rem; }
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.22rem 0.7rem 0.22rem 0.6rem;
  background: var(--ok-soft);
  border-radius: 2px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok);
}
.verdict .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.card.simple h2 { margin: 0.6rem 0 0.4rem; font-size: 1.7rem; overflow-wrap: anywhere; }
dl.kv.roomy { gap: 0.55rem 1.4rem; margin-top: 0.9rem; }
dl.kv.roomy dt { padding-top: 0.1rem; }
dl.kv.roomy .chips { margin-top: 0.1rem; }
.rel { color: var(--muted); font-size: 0.85em; margin-left: 0.4rem; }
.card-src { margin-top: 1.1rem; font-size: 0.8rem; }
.linklike {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.linklike:hover { color: var(--text); }

/* plain-English helpers */
.help {
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  vertical-align: 1px;
}
.help:hover { color: var(--accent-contrast); background: var(--accent); }
.tip {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0.35rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--muted);
}
.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); font-weight: 600; }
.chip.has-help { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; }

/* tables */
.tblwrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
th, td { padding: 0.3rem 0.9rem 0.3rem 0; vertical-align: top; }
td.mono { overflow-wrap: anywhere; }

/* entities */
.entity {
  margin-top: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.entity .entity { background: color-mix(in srgb, var(--chip-bg) 55%, transparent); }
.entity header { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.entity header strong { overflow-wrap: anywhere; }
.entity .note { margin: 0.3rem 0 0; font-size: 0.82rem; font-style: italic; color: var(--muted); }

ul.plain { margin: 0.2rem 0 0; padding-left: 1.1rem; }
ul.plain li { margin: 0.15rem 0; overflow-wrap: anywhere; }

/* details / raw JSON */
details { margin-top: 0.9rem; }
summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
pre {
  margin: 0.5rem 0 0;
  padding: 0.8rem;
  max-height: 24rem;
  overflow: auto;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
}
code { font-family: var(--mono); font-size: 0.85em; overflow-wrap: anywhere; }

/* ---------- Errors & notices ---------- */

.card.error { border-left: 3px solid var(--err); }
.card.error h2 { font-size: 1.05rem; }
.card p { margin: 0.5rem 0 0; }

.notice {
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 0.85rem;
  color: var(--muted);
}

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.85rem; }
.actions a, .actions button {
  font: inherit;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.actions a:hover, .actions button:hover { color: var(--accent); }

/* shared action bar + calendar options (both view modes) */
.result-actions { margin-top: 0.9rem; }
.result-actions .actions { margin-top: 0; }

.cal-panel {
  max-width: 26rem;
  margin-top: 0.7rem;
  padding: 0.9rem 1.05rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  font-size: 0.88rem;
}
.cal-panel[hidden] { display: none; }
.cal-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.cal-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  cursor: pointer;
}
.cal-row input[type="number"] {
  width: 4rem;
  padding: 0.3rem 0.45rem;
  border: 0;
  border-radius: 2px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  text-align: right;
}
.cal-actions { margin-top: 0.85rem; }
.cal-actions .primary {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
}
.cal-hint { margin: 0.6rem 0 0; font-size: 0.78rem; }

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}
/* soft, fading divider instead of a hard hairline */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .card, .notice { animation: rise 0.2s ease-out both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
  .controls select, .controls input, .controls button { transition: padding 0.15s ease, font-size 0.15s ease; }
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .controls select, .controls button { flex: 1 1 100%; }
  .controls input { min-width: 0; flex: 1 1 100%; }
  dl.kv { grid-template-columns: 1fr; gap: 0; }
  dl.kv dt { margin-top: 0.35rem; }
  dl.kv.roomy { gap: 0; }
  body.hero main { padding-bottom: 4vh; }
}
