/* Shared chrome for the demo pages. Hand-tuned; keep changes deliberate. */

:root {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #151a21;
  --surface-2: #1a212b;
  --border: #232b36;
  --border-strong: #313c4b;
  --text: #aebccd;
  --heading: #e8eff8;
  --dim: #7d8ea1;
  --accent: #45c6a5;
  --accent-soft: rgba(69, 198, 165, 0.12);
  --accent-border: rgba(69, 198, 165, 0.35);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 56px;
}

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

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0 18px;
}

.top a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
}

.top a:hover {
  color: var(--heading);
  border-color: var(--border);
  background: var(--surface);
}

.top-links {
  display: flex;
  gap: 4px;
}

/* Page intro ----------------------------------------------------------- */

.intro {
  margin: 0 0 18px;
}

.intro h1 {
  color: var(--heading);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

.intro p {
  margin: 0;
  max-width: 72ch;
  color: var(--text);
}

.intro code,
.note code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Canvas card (also the README screenshot target) ---------------------- */

.card {
  border-radius: 12px;
  overflow: hidden;
  background: #0c1016;
  border: 1px solid var(--border);
}

.frame {
  position: relative;
  line-height: 0;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.tag {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: rgba(10, 14, 19, 0.78);
  color: #e8eff8;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
}

.caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--dim);
  border-top: 1px solid var(--border);
  line-height: 1.45;
}

.caption strong {
  color: var(--heading);
  font-weight: 600;
}

.caption code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  flex: none;
}

/* Controls panel ------------------------------------------------------- */

.controls {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
}

.control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.control > label {
  font-size: 13px;
  color: var(--dim);
  white-space: nowrap;
  line-height: 1;
}

.control output {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--heading);
  min-width: 44px;
  text-align: right;
  line-height: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  outline: none;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

select {
  appearance: none;
  font: inherit;
  font-size: 13px;
  color: var(--heading);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  height: 30px;
  padding: 0 26px 0 10px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d8ea1' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

select:hover {
  border-color: var(--accent-border);
}

button.toggle {
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  line-height: 1;
  white-space: nowrap;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}

button.toggle:hover {
  border-color: var(--accent-border);
  color: var(--heading);
}

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

/* Footnote ------------------------------------------------------------- */

.note {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--dim);
  max-width: 78ch;
}

.note a {
  color: var(--text);
}

@media (max-width: 720px) {
  .caption {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  input[type="range"] {
    width: 110px;
  }
}
