/* plotui.xyz — shared styles (tokens, header, terminal chrome, sections, footer).
   Page-specific rules stay inline in each page's <style> block. */

:root {
  /* palette derived from plotui's own default chrome:
     grid (26,32,36) · frame (43,50,55) · ink (103,111,118) */
  --bg:        #101418;
  --bg-raise:  #14191e;
  --bg-term:   #0b0e11;
  --grid:      #1a2026;
  --frame:     #2b3237;
  --ink:       #676f76;
  --body:      #aeb7bf;
  --bright:    #e9eef3;
  --trace-1:   #ec4c86;  /* the README's (230, 60, 120) */
  --trace-2:   #45c8d1;
  --trace-3:   #f0a13c;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--trace-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--trace-2); outline-offset: 3px; border-radius: 2px; }
::selection { background: rgba(236, 76, 134, .35); color: var(--bright); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */
header {
  border-bottom: 1px solid var(--grid);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  /* Vertical only — a `padding` shorthand here would zero out .wrap's side
     padding (same element, same specificity) and go edge-to-edge on phones. */
  padding-top: 20px; padding-bottom: 20px;
}
.wordmark {
  font-family: var(--mono); font-weight: 800; font-size: 18px;
  letter-spacing: -.02em; color: var(--bright);
}
a.wordmark:hover { text-decoration: none; color: var(--bright); }
.wordmark .t1 { color: var(--trace-1); }
.wordmark .t2 { color: var(--trace-2); }
.wordmark .t3 { color: var(--trace-3); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--body); letter-spacing: .02em;
}
.nav-links a:hover { color: var(--bright); text-decoration: none; }
.nav-links a.gh {
  color: var(--bg); background: var(--trace-3);
  padding: 8px 14px; border-radius: 6px;
}
.nav-links a.gh:hover { background: #f7b968; }
.nav-links a[aria-current="page"] { color: var(--bright); }

/* ---------- buttons ---------- */
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.btn {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 12px 20px; border-radius: 7px; display: inline-block;
}
.btn-primary { background: var(--trace-1); color: #fff; }
.btn-primary:hover { background: #f0619a; text-decoration: none; }
.btn-ghost {
  color: var(--body); border: 1px solid var(--frame);
}
.btn-ghost:hover { color: var(--bright); border-color: var(--ink); text-decoration: none; }

/* ---------- the terminal ---------- */
.term {
  background: var(--bg-term);
  border: 1px solid var(--frame);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-raise);
  border-bottom: 1px solid var(--grid);
}
.term-bar .b { width: 11px; height: 11px; border-radius: 50%; background: var(--frame); }
.term-title {
  flex: 1; text-align: center; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink);
}
.term-body { position: relative; }
.term-prompt {
  position: absolute; top: 12px; left: 16px; z-index: 2;
  font-family: var(--mono); font-size: 11px; color: var(--ink);
  pointer-events: none;
}
.term-prompt .ps1 { color: var(--trace-2); }
.term-legend {
  position: absolute; top: 12px; right: 16px; z-index: 2;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.9;
  color: var(--body);
  background: rgba(11, 14, 17, .72);
  border: 1px solid var(--grid);
  border-radius: 5px; padding: 6px 12px;
}
.term-legend .li {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; line-height: inherit;
  cursor: pointer; transition: opacity .2s;
}
.term-legend .li.off { opacity: .4; }
.term-legend .li.off .sw { filter: saturate(0); }
.term-legend .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; }
.term-tip {
  position: absolute; z-index: 3; pointer-events: none;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.6;
  color: var(--body);
  background: rgba(11, 14, 17, .85);
  border: 1px solid var(--grid);
  border-radius: 5px; padding: 5px 9px;
  white-space: nowrap;
}
.term-tip[hidden] { display: none; }
.term-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.term-foot {
  display: flex; gap: 2px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px;
  background: var(--bg-raise); border-top: 1px solid var(--grid);
  padding: 5px 10px; color: var(--ink);
}
.term-foot .key {
  background: var(--frame); color: var(--bright);
  padding: 1px 6px; border-radius: 3px; margin-right: 6px;
}
.term-foot span.act { margin-right: 12px; white-space: nowrap; }
.term-foot button.btn {
  background: var(--frame); color: var(--ink);
  padding: 1px 8px; border-radius: 3px; margin-right: 6px;
  border: 0; font: inherit; cursor: pointer;
}
.term-foot button.btn:hover { color: var(--bright); }
.term-foot button.btn.on { background: var(--trace-2); color: #0b0e11; }

/* ---------- sections ---------- */
section { padding: 72px 0; border-top: 1px solid var(--grid); }
.sec-label {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.sec-label .sw { width: 9px; height: 9px; border-radius: 2px; }
h2 {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(21px, 2.4vw, 27px); letter-spacing: -.02em;
  color: var(--bright); margin-bottom: 16px; line-height: 1.3;
}
.sec-intro { max-width: 62ch; margin-bottom: 40px; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--grid); padding: 36px 0 48px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
}
.foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer a { color: var(--body); }

/* ---------- card grid ---------- */
.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 26px; }

/* ---------- interactive example cards (examples.html) ---------- */
.ex-canvas {
  display: block; width: 100%; height: 300px;
  background: var(--bg-term);
  touch-action: none; cursor: grab;
}
.ex-canvas:active { cursor: grabbing; }
.ex-canvas.crosshair { cursor: crosshair; }
.ex-fallback { padding: 24px; color: var(--body); font: 12px/1.6 var(--mono); }
.ex-code {
  background: var(--bg-term); border-top: 1px solid var(--grid);
  padding: 16px 18px; margin: 0;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.9;
  overflow-x: auto; color: var(--body);
}
.ex-code[hidden] { display: none; }
.ex-code .kw { color: var(--trace-1); }
.ex-code .fn { color: var(--trace-2); }
.ex-code .str { color: var(--trace-3); }
.ex-code .cm { color: var(--ink); }

/* ---------- responsive (shared) ---------- */
@media (max-width: 920px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .term-legend { display: none; }
}
@media (max-width: 640px) {
  .nav-links a:not(.gh):not(.ex) { display: none; }
  section { padding: 56px 0; }
}
