/* v86-presentation: flexbox layout, WCAG 2.2 AA contrast and focus, both
   colour schemes. Colours live on :root so the terminal theme in
   static/js/terminal.js can read them. */

:root {
  color-scheme: light dark;
  --bg: #0b0d10;
  --panel: #151a21;
  --border: #2a313b;
  --fg: #e6e6e6;
  --muted: #a3adba;
  --accent: #4ade80;
  --on-accent: #0b0d10;
  --danger: #f87171;
  --focus: #ffbf47;
  --term-bg: #0b0d10;
  --term-fg: #e6e6e6;
  --term-cursor: #4ade80;
  --radius: 6px;
  --gutter: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa;
    --panel: #ffffff;
    --border: #d0d5db;
    --fg: #111111;
    --muted: #4a5460;
    --accent: #0f7b3a;
    --on-accent: #ffffff;
    --danger: #b42318;
    --focus: #0b57d0;
  }
}

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

/* Flex rules below would otherwise win over the browser's [hidden] styling. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
}

/* Keyboard users land on the main content without tabbing through chrome. */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus {
  top: var(--gutter);
}

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

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

header.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem var(--gutter);
  padding: 0.5rem var(--gutter);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header.bar h1 {
  font-size: 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header.bar .spacer {
  flex: 1;
}

.status {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
}

.status[data-tone="live"] {
  color: var(--accent);
}

.status[data-tone="error"] {
  color: var(--danger);
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* The terminal fills whatever is left; the canvas inside is scaled to fit
   its fixed column/row grid (see terminal.js). */
.terminal-host {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--term-bg);
  padding: var(--gutter);
  overflow: hidden;
}

.transcript {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: var(--gutter);
  overflow: auto;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Controls: at least 24x24 CSS pixels (WCAG 2.2 2.5.8), plainly bordered. */
button,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

button.primary,
.button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

button.danger {
  color: var(--danger);
}

button[aria-pressed="true"] {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
  flex: none;
}

/* Landing page */
.page {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page h1 {
  margin: 0;
}

.lede {
  color: var(--muted);
  margin: 0;
}

form.create {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: var(--gutter);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field .hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.row > .field {
  flex: 1 1 10rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem 1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

legend {
  padding: 0 0.25rem;
}

label.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2rem;
}

label.choice input {
  margin-top: 0.4rem;
  width: 1.1rem;
  height: 1.1rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: var(--gutter);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.link-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.link-row .url {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  word-break: break-all;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.link-row .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.error {
  color: var(--danger);
}

.error:empty {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
