/*
  The console in ip.rev3rse.dev's design: the site's tokens, type stacks and components
  (site/src/styles/globals.css and ip.css), copied rather than linked, so the console still loads
  nothing from another origin. Light only, like the site. One accent, hairlines, sharp corners;
  no gradients, glow or rounded cards.

  The first sections restate the site's rules under the site's class names; "Console" at the end
  is what only the console has. A change to the site's look belongs in both.
*/

:root {
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas,
    monospace;

  --paper: #ffffff;
  --surface: #f5f8fc;
  --surface-2: #eaf0f8;
  --line: #dce4ee;
  --line-lit: #b9c7d8;
  --text: #0b1b2e;
  --muted: #4b6075;
  --faint: #8295a8; /* 3.4:1: timestamps and scaffolding only, never a sentence */

  --accent: #1348c4;
  --accent-lit: #2f6fe8;
  --accent-dim: #5b74a8;
  --accent-ghost: #1348c40f;

  --crit: #c8102e;
  --warn: #8a5200;

  color-scheme: light;
}

/* The wordmark's face: Martian Mono, subset to the glyphs of "rev3rse." (the site's file). */
@font-face {
  font-family: "Rev3rse Mark";
  src: url("/fonts/rev3rse-wordmark.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

/* ── base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-size: inherit; font-weight: inherit; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9875rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Grain, at the light theme's 0.04. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: var(--accent); color: #fff; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--surface); padding: 0.5rem 0.75rem; }

/* ── layout ──────────────────────────────────────────────────────────── */
.shell {
  max-width: 74rem;
  margin-inline: auto;
  padding-inline: 2rem;
}
@media (max-width: 640px) { .shell { padding-inline: 1.25rem; } }

/* The spec-sheet grid: the label in a narrow left rail, the content beside it, a hairline above. */
.spec {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0 3rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--line);
  margin-top: 3.5rem;
}
.spec > * { min-width: 0; }
.spec > .eyebrow {
  margin: 0;
  position: sticky;
  top: 5.5rem;
  align-self: start;
}
@media (max-width: 860px) {
  .spec {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 2rem;
    margin-top: 2.5rem;
  }
  .spec > .eyebrow { position: static; margin-bottom: 1rem; }
}

/* The technical grid behind the first screen, fading out downward. */
.grid-field {
  position: relative;
  isolation: isolate;
}
.grid-field::before {
  content: "";
  position: absolute;
  inset: -1.5rem -50vw 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 88%);
  opacity: 0.9;
}
@media (max-width: 640px) { .grid-field::before { opacity: 0.6; } }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 3.5rem;
  align-items: end;
  padding: 3.5rem 0 4rem;
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2.5rem; padding: 2.25rem 0 3rem; }
}

/* ── type ────────────────────────────────────────────────────────────── */
.display {
  font-family: var(--font-mono);
  font-size: clamp(2.35rem, 7.4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 700;
  text-wrap: balance;
  margin: 0;
  max-width: 15ch;
}
.display em {
  font-style: normal;
  color: var(--accent);
}

.h2 {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  letter-spacing: -0.03em;
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
}

.h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0;
}

/* Eyebrow marked with `//`: a code comment, not an ornament. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}
.eyebrow::before {
  content: "// ";
  color: var(--accent-dim);
}

.lede {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
  max-width: 58ch;
  margin: 1.6rem 0 0;
  text-wrap: pretty;
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.7375rem;
  letter-spacing: 0.03em;
  color: var(--faint);
}

/* ── controls ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8375rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  padding: 0.62rem 1.05rem;
  border: 1px solid var(--line-lit);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s linear, color 0.12s linear, background 0.12s linear;
}
.btn:hover { border-color: var(--text); }

.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-ghost);
}
.btn-primary:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── proof band ──────────────────────────────────────────────────────── */
.proof {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.proof-cell {
  background: var(--surface);
  padding: 1.15rem 1.2rem;
  min-width: 0;
}
.proof-value {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--accent);
}
.proof-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.55rem;
  line-height: 1.4;
}

/* ── prose (the trial agreement and the privacy notice) ──────────────── */
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  margin-top: 2.3em;
  margin-bottom: 0.15em;
  text-wrap: balance;
}
.prose h3 {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-top: 1.7em;
  margin-bottom: 0.15em;
}
.prose ul, .prose ol { padding-inline-start: 1.15em; }
.prose li::marker { color: var(--accent-dim); }
.prose li + li { margin-top: 0.35em; }
.prose strong { font-weight: 600; color: var(--text); }

/* ── chrome ──────────────────────────────────────────────────────────── */
.site-head {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(10px);
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.02em;
  font-family: "Rev3rse Mark", var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.09em;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--accent-dim);
}
.wordmark em {
  font-style: normal;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.04em 0.14em;
  margin-inline: 0.07em;
  background: var(--accent-ghost);
  text-shadow: none;
}
.wordmark::after {
  content: "";
  width: 0.4em;
  height: 0.92em;
  background: var(--accent);
  margin-left: 0.34em;
  align-self: center;
  animation: cursor 1.15s steps(2, start) infinite;
}
@keyframes cursor { 0%, 100% { opacity: 1 } 50% { opacity: 0.15 } }
.wordmark:hover em { background: var(--accent); color: #fff; }
.wordmark:hover { text-shadow: 2px 2px 0 var(--accent); }

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s linear;
}
.nav-link:hover { color: var(--accent); }

.site-foot { margin-top: 6rem; border-top: 1px solid var(--line); }
.foot-link {
  font-family: var(--font-mono);
  font-size: 0.7375rem;
  color: var(--faint);
  text-decoration: none;
}
.foot-link:hover { color: var(--accent); }

/* ── console ─────────────────────────────────────────────────────────── */
.head-row, .foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-block: 1rem;
}
.head-row { min-height: 4.2rem; } /* the site's header height, which its button sets */
.foot-row { padding-block: 2rem; }
.push { margin-left: auto; }
/* The product beside the firm's mark, as a path segment of it. */
.product {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line-lit);
}
.product span { color: var(--muted); }
.head-nav { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.head-user { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.head-user:empty { display: none; }
.head-user .meta { color: var(--muted); overflow-wrap: anywhere; }

main.shell { padding-top: 3rem; padding-bottom: 2rem; }
/* The grid field reaches 50vw past its section on each side; this clips it at the viewport's
   edges, so a phone does not scroll sideways. clip, not hidden: it makes no scroll container. */
.bleed { overflow-x: clip; }
.flow > * + * { margin-top: 1rem; }
.flow > .h3 { margin-top: 2.25rem; }
.note { color: var(--muted); max-width: 62ch; }
.cta { font-family: var(--font-mono); font-size: 0.8125rem; }

/* What to do next, beside a headline: the site's pattern block. */
.panel {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-dim);
  background: var(--surface);
  padding: 1.35rem 1.5rem;
  min-width: 0;
}
/* Above the workspace's grid field, which reaches up into the space over it. */
.panel.secret { border-left-color: var(--warn); position: relative; z-index: 1; margin-bottom: 1.5rem; }
.panel + .spec { margin-top: 2.5rem; }
.stack { display: grid; gap: 0.75rem; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.78rem; }
.btn.wide { width: 100%; text-align: left; }
.btn:disabled { opacity: 0.55; cursor: wait; }

form { display: grid; gap: 0.9rem; max-width: 36rem; }
form > .btn { justify-self: start; }
.panel form { max-width: none; }
.result:empty { display: none; }
label { display: grid; gap: 0.3rem; }
label > span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-lit);
  border-radius: 0;
  background-color: var(--paper);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
}
input::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible { border-color: var(--accent); outline-offset: 0; }
select {
  appearance: none;
  padding-right: 2.25rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}
label.check { display: flex; gap: 0.65rem; align-items: flex-start; }
label.check input { width: auto; margin: 0.3rem 0 0; accent-color: var(--accent); }
label.check span {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.08em 0.35em;
  color: var(--accent);
  overflow-wrap: anywhere;
}
td code { background: none; border: 0; padding: 0; color: var(--text); }
td code.digest { font-size: 0.75rem; color: var(--muted); }
.proof-value code { font-size: inherit; background: none; border: 0; padding: 0; color: inherit; }
.proof-value.small { font-size: 1.05rem; letter-spacing: -0.01em; line-height: 1.3; word-break: break-all; }

/* A value to copy, set like the site's code blocks. */
.copy {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-dim);
  padding: 1rem 1.1rem;
}
.copy code {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
}
.copy .btn { flex: none; }

.error {
  color: var(--crit);
  border-left: 2px solid var(--crit);
  padding-left: 0.75rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: var(--surface-2);
  white-space: nowrap;
}
td.when { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
  td { border: 0; padding: 0.15rem 0; }
}

/* A state, set like the site's chips: --accent for a pass, --warn for what needs doing. */
.tag {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tag.ok { color: var(--accent); }
.tag.warn { color: var(--warn); }

/* The workspace's name: the display face, at the size a heading needs. */
.display.name { font-size: clamp(1.9rem, 5vw, 3rem); max-width: none; overflow-wrap: anywhere; }
.ws-head { padding: 1.5rem 0 0; }
.ws-head .proof { margin-top: 2rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .wordmark::after { animation: none; opacity: 0.9; }
}
