/* src/style.css — flat surfaces, hairline rules, no shadows, no gradients.
   One accent, deep prussian blue #0d3b66, reserved for focus and selection.
   Works in both colour schemes via prefers-color-scheme. */

:root {
  color-scheme: light dark;
  --paper: #f6f3ea;
  --ink: #1d1d1b;
  --accent: #0d3b66;
  --hairline: #c9c4b6;
  --panel: #efece1;
  --warn: #a03020;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171c;
    --ink: #e7e4dc;
    --accent: #7aa5d8;
    --hairline: #3a3e48;
    --panel: #1b1e25;
    --warn: #e08a7a;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  z-index: 20;
}

#topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#dirty-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

#canvas {
  position: fixed;
  top: 40px;
  bottom: 28px;
  left: 0;
  right: 0;
  overflow: hidden;
  cursor: default;
}

#canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The HUD: one fixed status line at the bottom of the canvas. */
#hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  border-top: 1px solid var(--hairline);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  z-index: 20;
}

#hud-mode {
  color: var(--accent);
  font-weight: 700;
  min-width: 70px;
}

#hud-info {
  overflow: hidden;
  text-overflow: ellipsis;
}

#hud-info.error {
  color: var(--warn);
}

#hud-hint {
  margin-left: auto;
  opacity: 0.65;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The source panel slides over the right third. Read-only (Decision 3). */
#panel {
  position: fixed;
  top: 40px;
  right: 0;
  bottom: 28px;
  width: 33.333%;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--hairline);
  transform: translateX(102%);
  transition: transform 160ms ease-out;
  z-index: 15;
}

#panel.open {
  transform: translateX(0);
}

.panel-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

#src,
#src-errors {
  margin: 0;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}

#src {
  flex: 1;
}

#src-errors {
  flex: 0 0 auto;
  max-height: 32%;
  border-top: 1px solid var(--hairline);
  color: var(--warn);
}

/* The bump-feedback ruling (ruling 18): the focus ring nudges 2 px toward
   the pressed direction and back over 120 ms. Nothing else moves. */
@keyframes bump-nudge {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(var(--bx, 0px), var(--by, 0px)); }
}

.focus-ring.bump {
  animation: bump-nudge 120ms ease-out;
}
