/* Quantum Cartography — editorial / reference-document aesthetic.
   Warm paper, ink type, one sober accent. No gradients, glow, or grid. */
:root {
  --paper: #f4f1ea;
  --paper-2: #efeae0;
  --card: #fbf9f4;
  --ink: #1c1a17;
  --ink-soft: #55504a;
  --muted: #8a837a;
  --rule: #d9d3c7;
  --rule-strong: #bcb4a4;
  --accent: #7c3a2d;      /* oxblood */
  --accent-ink: #5f2c22;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* small-caps section label */
.label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Access gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  z-index: 10;
  padding: 24px;
}
.gate-card {
  width: min(92vw, 400px);
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 48px 44px 40px;
  text-align: center;
}
.gate-card .mark { display: none; }
.gate-card h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 27px;
  letter-spacing: 0.01em;
  margin: 0 0 6px;
}
.gate-card .sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 30px;
  line-height: 1.5;
}
.gate-card input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--rule-strong);
  color: var(--ink);
  padding: 10px 2px;
  font-size: 20px;
  font-family: var(--serif);
  text-align: center;
  letter-spacing: 0.3em;
  outline: none;
  transition: border-color 0.15s;
}
.gate-card input::placeholder { letter-spacing: normal; font-size: 15px; color: var(--muted); }
.gate-card input:focus { border-color: var(--accent); }
.gate-card button {
  width: 100%;
  margin-top: 26px;
  padding: 13px;
  border: none;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.gate-card button:hover { background: var(--accent-ink); }
.gate-card button:disabled { opacity: 0.5; cursor: default; }
.gate-error { color: var(--accent); font-size: 13px; min-height: 18px; margin-top: 16px; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 22px 32px 16px;
  border-bottom: 1px solid var(--rule);
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}
.brand { font-family: var(--serif); font-size: 20px; }
.brand .mark-sm { display: none; }
.ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 2px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.ghost:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Translator ---------- */
.translator {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}
.panel { display: flex; flex-direction: column; min-height: 520px; padding: 0 0 0 0; }
.panel:first-child { border-right: 1px solid var(--rule); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 14px;
}
#situation {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  padding: 6px 32px 12px;
  font-size: 18px;
  line-height: 1.7;
  font-family: var(--serif);
}
#situation::placeholder { color: var(--muted); }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px 24px;
}
.primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 11px 22px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}
.primary:hover { background: var(--accent-ink); }
.primary:disabled { opacity: 0.45; cursor: default; }
.arrow { font-size: 14px; }

/* ---------- Output ---------- */
.output { flex: 1; padding: 6px 32px 28px; overflow-y: auto; }
.placeholder { color: var(--muted); font-size: 16px; font-family: var(--serif); font-style: italic; padding-top: 4px; }

.thinking-label {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.thinking-stream {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 340px;
  overflow-y: auto;
  border-left: 2px solid var(--rule);
  padding-left: 16px;
}

.result-block { margin-bottom: 32px; }
.result-block h2 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.laws { display: flex; flex-direction: column; gap: 20px; }
.law { display: block; }
.law-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.law-name { font-family: var(--serif); font-size: 18px; font-style: italic; }
.domain-tag {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.domain-tag::before { content: "— "; }
.law-why { color: var(--ink-soft); font-size: 15px; line-height: 1.6; }

.plan { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.plan li {
  counter-increment: step;
  position: relative;
  padding: 0 0 16px 38px;
  font-size: 15.5px;
  line-height: 1.65;
}
.plan li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.oneline {
  margin-top: 10px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
}
.error { color: var(--accent); font-size: 14px; padding-top: 6px; }

.footer {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  padding: 22px;
  max-width: 1160px;
  margin: 0 auto;
}

@media (max-width: 780px) {
  .translator { grid-template-columns: 1fr; }
  .panel:first-child { border-right: none; border-bottom: 1px solid var(--rule); }
  .panel { min-height: 340px; }
  .topbar, .panel-head, #situation, .panel-foot, .output { padding-left: 20px; padding-right: 20px; }
}
