/* ─── DEMO PAGES ──────────────────────────────────────── */

/* The menu bar lines up with the demo: the logo with the title, the search icon with the stage's right edge */
.nav-inner { width: 100%; max-width: 1416px; padding: 0 48px; }
body:has(.demo-top.is-wide) .nav-inner { max-width: none; }
.nav-search { margin-right: -11px; } /* the icon sits in the middle of a 40px button */
@media (max-width: 1024px) { .nav-inner { padding: 0 32px; } }
@media (max-width: 768px) { .nav-inner { padding: 0 20px; } .nav-hamburger { margin-right: -11px; } }
@media (max-width: 600px) { .nav-inner { padding: 0 16px; } }

/* Top band: title, then the stage (live chart + play rail) */
.demo-top {
  position: relative; overflow: hidden; overflow: clip; /* clip, so the chart can stick inside it on phones */
  background: linear-gradient(90deg, #1e1e1e 0%, #0a0a0a 100%);
  color: #e8e8f0; padding: 26px 48px 36px;
}
.demo-top::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 70% at 0% 0%, rgba(255,107,53,0.14) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 100% 100%, rgba(232,35,58,0.10) 0%, transparent 60%);
}
.demo-top-inner { position: relative; max-width: 1320px; margin: 0 auto; }

.demo-crumbs { font-size: 0.8125rem; color: #8888a8; }
.demo-crumbs a { color: #8888a8; text-decoration: none; }
.demo-crumbs a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.demo-crumbs .sep { margin: 0 8px; opacity: 0.6; }

/* previous / next demo, at the right of the breadcrumb row */
.demo-crumbs-row { display: flex; justify-content: space-between; align-items: center; gap: 6px 24px; flex-wrap: wrap; }
.demo-pager { display: flex; gap: 20px; font-size: 0.8125rem; }
.demo-pager a { display: inline-flex; align-items: center; gap: 5px; max-width: 240px; color: #8888a8; text-decoration: none; }
.demo-pager a:hover { color: #fff; }
.demo-pager a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.demo-pager span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-pager svg { flex: none; width: 14px; height: 14px; }

.demo-head { margin: 10px 0 20px; }
.demo-head h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 900; letter-spacing: -0.03em;
  line-height: 1.08; color: #fff;
}
.demo-lead { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,0.68); margin-top: 8px; }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 300; background: #fff; color: #1a1a2e; font-weight: 600; padding: 10px 16px; }
.skip-link:focus { left: 8px; top: 8px; }

/* The stage */
.demo-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  border-radius: 16px; overflow: hidden; overflow: clip; background: #1b1b24;
  border: 1px solid rgba(255,255,255,0.10); scroll-margin-top: 64px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}
.demo-canvas { position: relative; display: flex; flex-direction: column; min-width: 0; background: #ffffff; transition: background .25s; }
#demo-host { flex: 1; padding: 12px; }
/* a single chart shrinks on short windows, so the whole stage stays on the first screen */
:root { --chart-h: clamp(380px, calc(100vh - 364px), 536px); }
#demo-host > div:only-child { height: var(--chart-h) !important; }
.demo-toast {
  position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 3; pointer-events: none;
  font-size: 0.8125rem; font-weight: 600; color: #fff; white-space: nowrap;
  background: rgba(20,20,30,0.88); border-radius: 999px; padding: 8px 16px;
}
.demo-toast[hidden] { display: none; }

/* The strip under the chart: things to try on the left, the chart's buttons on the right */
.demo-bar { display: flex; align-items: center; gap: 8px 16px; padding: 6px 8px 6px 16px; border-top: 1px solid rgba(0,0,0,0.07); }
/* one line high: a hint that wraps falls out of sight, and the page hides them all then (is-cut) */
.demo-hints { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; font-size: 0.8125rem; line-height: 20px; max-height: 20px; overflow: hidden; color: #5a5a6e; }
.demo-hints.is-cut { visibility: hidden; }
.demo-hints li::before { content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: rgba(0,0,0,0.3); margin-right: 8px; vertical-align: 2px; }
.demo-hints b { font-weight: 700; color: #1a1a2e; margin-right: 2px; }
.demo-hints .demo-hints-label::before { display: none; }
.demo-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
/* Canvas | SVG: two small buttons, the chosen one filled */
.demo-renderer { display: flex; margin-right: 8px; padding: 2px; border-radius: 7px; background: rgba(0,0,0,0.05); }
.demo-renderer[hidden] { display: none; }
.demo-renderer button {
  font-family: var(--font); font-size: 0.6875rem; font-weight: 600; color: #6a6a7e; line-height: 1;
  background: none; border: none; border-radius: 5px; padding: 6px 9px; cursor: pointer; transition: background .15s, color .15s;
}
.demo-renderer button:hover { color: #1a1a2e; }
.demo-renderer button[aria-pressed="true"] { color: #1a1a2e; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.demo-renderer button:focus-visible { outline: 2px solid rgba(0,0,0,0.45); outline-offset: 1px; }
.demo-stage.is-dark .demo-renderer { background: rgba(255,255,255,0.07); }
.demo-stage.is-dark .demo-renderer button { color: #a8a8bc; }
.demo-stage.is-dark .demo-renderer button:hover { color: #fff; }
.demo-stage.is-dark .demo-renderer button[aria-pressed="true"] { color: #fff; background: rgba(255,255,255,0.14); box-shadow: none; }
.demo-tool {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  color: #5a5a6e; background: none; border: none; border-radius: 6px; cursor: pointer; transition: background .15s, color .15s;
}
.demo-tool svg { width: 17px; height: 17px; }
.demo-tool:hover { color: #1a1a2e; background: rgba(0,0,0,0.05); }
.demo-tool:focus-visible { outline: 2px solid rgba(0,0,0,0.45); outline-offset: 1px; }
.demo-tool:disabled { opacity: 0.35; cursor: default; color: #5a5a6e; background: none; }
.demo-tool .i-exit, .demo-tool.is-on .i-enter { display: none; }
.demo-tool.is-on .i-exit { display: block; }
/* the name shows at once, above the button */
.demo-tool:hover::after, .demo-tool:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 5; white-space: nowrap; pointer-events: none;
  font-family: var(--font); font-size: 0.75rem; font-weight: 600; color: #fff; background: #1a1a2e; border-radius: 6px; padding: 5px 9px;
}
/* dark looks: the strip follows the canvas */
.demo-stage.is-dark .demo-bar { border-color: rgba(255,255,255,0.09); }
.demo-stage.is-dark .demo-hints { color: #a8a8bc; }
.demo-stage.is-dark .demo-hints li::before { background: rgba(255,255,255,0.3); }
.demo-stage.is-dark .demo-hints b { color: #fff; }
.demo-stage.is-dark .demo-tool { color: #b0b0c0; }
.demo-stage.is-dark .demo-tool:hover { color: #fff; background: rgba(255,255,255,0.08); }
.demo-stage.is-dark .demo-tool:disabled { color: #b0b0c0; background: none; }
.demo-stage.is-dark .demo-tool:focus-visible { outline-color: rgba(255,255,255,0.6); }
.demo-stage.is-dark .demo-tool:hover::after { background: #000; }

.demo-stage:fullscreen { border-radius: 0; border: none; grid-template-rows: minmax(0, 1fr); }
.demo-stage:fullscreen #demo-host { display: flex; }
.demo-stage:fullscreen #demo-host > div:only-child { height: auto !important; flex: 1; }
/* full screen browsing: previous and next show in full screen, and the next demo opens inside the stage as a page
   that shows only its stage (?embed=1) */
.demo-gonav { display: none; align-items: center; gap: 16px; margin-left: auto; min-width: 0; }
.demo-stage:fullscreen .demo-gonav, html.is-embed .demo-stage .demo-gonav { display: flex; }
.demo-stage:fullscreen .demo-tools, html.is-embed .demo-stage .demo-tools { margin-left: 12px; }
.demo-go { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 220px; font-size: 0.75rem; color: #5a5a6e; text-decoration: none; }
.demo-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-go svg { flex: none; width: 14px; height: 14px; }
.demo-go:hover { color: #1a1a2e; }
.demo-go:hover span { text-decoration: underline; text-underline-offset: 3px; }
.demo-go:focus-visible { outline: 2px solid rgba(0,0,0,0.45); outline-offset: 2px; border-radius: 3px; }
.demo-stage.is-dark .demo-go { color: #b0b0c0; }
.demo-stage.is-dark .demo-go:hover { color: #fff; }
.demo-frame { position: absolute; inset: 0; z-index: 30; width: 100%; height: 100%; border: 0; background: #ffffff; }
html.is-embed, html.is-embed body { height: 100%; overflow: hidden; }
html.is-embed .demo-stage { position: fixed; inset: 0; z-index: 1000; border-radius: 0; border: none; grid-template-rows: minmax(0, 1fr); }
html.is-embed .demo-stage #demo-host { display: flex; }
html.is-embed .demo-stage #demo-host > div:only-child { height: auto !important; flex: 1; }
/* the cookie notice belongs to the page around it */
html.is-embed #amcharts-utils-consent { display: none !important; }

/* A stage without the rail (stock and Gantt charts): the chart takes the whole stage, and the theme picker and the
   Dark switch sit in the strip under it, next to Canvas | SVG, in the strip's colors; the theme list opens upwards */
.demo-stage.no-rail { grid-template-columns: minmax(0, 1fr); }
.demo-stage.no-rail .demo-bar { position: relative; z-index: 4; flex-wrap: wrap; }
.demo-look .rail-group { display: flex; align-items: center; gap: 16px; margin-right: 16px; padding: 0; }
.demo-look .ctl { display: flex; align-items: center; gap: 8px; margin: 0; }
.demo-look .ctl label, .demo-look .ctl-label { color: #5a5a6e; }
.demo-look .theme-btn, .demo-look .theme-step { color: #1a1a2e; background: #fff; border-color: rgba(0,0,0,0.12); }
.demo-look .theme-btn:hover, .demo-look .theme-step:hover { color: #1a1a2e; border-color: rgba(0,0,0,0.3); }
.demo-look .theme-chev { color: #6a6a7e; }
.demo-look .theme-btn:focus-visible, .demo-look .theme-step:focus-visible { outline-color: rgba(0,0,0,0.45); }
.demo-look .switch i { background: rgba(0,0,0,0.12); }
.demo-look .switch input:focus-visible + i { outline-color: rgba(0,0,0,0.45); }
.demo-look .theme-list { position: absolute; bottom: calc(100% + 6px); right: 8px; width: 340px; max-width: calc(100% - 16px); margin: 0; background: #22222c; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 16px 40px rgba(0,0,0,0.45); }
.demo-stage.is-dark .demo-look .ctl label, .demo-stage.is-dark .demo-look .ctl-label { color: #a8a8bc; }
.demo-stage.is-dark .demo-look .theme-btn, .demo-stage.is-dark .demo-look .theme-step { color: #fff; background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.14); }
.demo-stage.is-dark .demo-look .theme-btn:hover, .demo-stage.is-dark .demo-look .theme-step:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.demo-stage.is-dark .demo-look .theme-chev { color: #9a9db0; }
.demo-stage.is-dark .demo-look .theme-btn:focus-visible, .demo-stage.is-dark .demo-look .theme-step:focus-visible { outline-color: rgba(255,255,255,0.6); }
.demo-stage.is-dark .demo-look .switch i { background: rgba(255,255,255,0.12); }
.demo-stage.is-dark .demo-look .switch input:checked + i { background: rgba(255,255,255,0.42); }
.demo-stage.is-dark .demo-look .switch input:focus-visible + i { outline-color: rgba(255,255,255,0.6); }

/* The rail: a small slice of the editor */
.demo-rail {
  display: flex; flex-direction: column; min-height: 0;
  background: #1b1b24; color: #e8e8f0; border-left: 1px solid rgba(255,255,255,0.08);
}
.rail-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 4px 18px 14px; }
.rail-body.has-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
.rail-group { padding: 14px 0 4px; }
.rail-group + .rail-group { padding-top: 10px; }

/* Theme picker: the current theme in a button, the others in a list that opens under it */
.theme-strip { display: inline-flex; flex: none; width: 32px; height: 12px; border-radius: 3px; overflow: hidden; }
.theme-strip i { flex: 1; }
.theme-strip i:nth-child(1) { background: var(--a); }
.theme-strip i:nth-child(2) { background: var(--b); }
.theme-strip i:nth-child(3) { background: var(--c); }
.theme-strip i:nth-child(4) { background: var(--d); }
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font); font-size: 0.8125rem; color: #fff;
  background: #2a2a36; border: 1px solid rgba(255,255,255,0.14); border-radius: 6px; padding: 5px 8px;
}
.theme-btn:hover { border-color: rgba(255,255,255,0.28); }
.theme-chev { color: #9a9db0; transition: transform .15s; }
.theme-pick { display: flex; align-items: stretch; gap: 4px; }
.theme-step {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; padding: 0; cursor: pointer;
  color: #c4c7d0; background: #2a2a36; border: 1px solid rgba(255,255,255,0.14); border-radius: 6px;
}
.theme-step:hover { color: #fff; border-color: rgba(255,255,255,0.28); }
.theme-step:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 1px; }
.theme-step svg { width: 14px; height: 14px; }
.theme-btn[aria-expanded="true"] .theme-chev { transform: rotate(180deg); }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: -4px 0 12px; padding: 4px; border-radius: 8px; background: rgba(255,255,255,0.04); }
.theme-list[hidden] { display: none; }
.theme-opt[hidden] { display: none; } /* the one theme a demo with its own colors keeps, for the Dark switch */
.theme-opt {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 8px; cursor: pointer; text-align: left;
  font-family: var(--font); font-size: 0.8125rem; color: #c4c7d0;
  background: none; border: 1px solid transparent; border-radius: 6px;
}
.theme-opt:hover { color: #fff; background: rgba(255,255,255,0.06); }
.theme-opt[aria-pressed="true"] { color: #fff; background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.18); }
.theme-btn:focus-visible, .theme-opt:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 1px; }

/* One control: label, current value, input. Kept in quiet greys so the chart has the color. */
.ctl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; margin-bottom: 12px; }
.ctl label, .ctl-label { font-size: 0.8125rem; color: #d6d7e0; }
/* two switches on one row, "Grid  X [ ]  Y [ ]": the vertical and the horizontal grid */
.ctl-pair .pair { display: flex; align-items: center; gap: 18px; }
.ctl-pair .pair .ctl { display: flex; align-items: center; gap: 8px; margin: 0; }
/* a row of buttons (legend position): the label above, the buttons across the rail */
.ctl-seg { grid-template-columns: 1fr; }
.ctl[hidden] { display: none; } /* a control that follows another, like the legend position */
.seg { display: flex; padding: 2px; border-radius: 7px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.seg button { flex: 1; min-width: 0; padding: 4px 6px; border: 0; border-radius: 5px; background: none; font: inherit; font-size: 0.75rem; color: #a8aab8; cursor: pointer; }
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { color: #fff; background: rgba(255,255,255,0.16); }
.seg button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.ctl output { font-family: var(--mono); font-size: 0.75rem; color: #9a9db0; }
/* a slider's value with a play button before it */
.ctl-value { display: inline-flex; align-items: center; gap: 6px; }
.ctl-play { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,0.12); color: #d6d7e0; cursor: pointer; }
.ctl-play:hover { background: rgba(255,255,255,0.22); color: #fff; }
.ctl-play:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.ctl-play svg { width: 10px; height: 10px; fill: currentColor; }
.ctl-play .i-pause, .ctl-play.is-on .i-play { display: none; }
.ctl-play.is-on .i-pause { display: inline; }
/* a date and time field across the rail, with the browser's dark calendar */
.ctl-wide { grid-template-columns: 1fr; }
/* a list with < > buttons that step through it */
.ctl-steps { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ctl .ctl-steps select { flex: 1; min-width: 0; max-width: none; }
.ctl input[type="datetime-local"] { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; background: rgba(255,255,255,0.06); color: #d6d7e0; font: inherit; font-size: 0.75rem; color-scheme: dark; }
.ctl input[type="datetime-local"]:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
/* --f, the filled part from 0 to 1, is set by demos.js; Firefox fills by itself */
.ctl input[type="range"] {
  grid-column: 1 / -1; width: 100%; height: 18px; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.ctl input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0.45)) 0 0 / calc(7px + var(--f, 0.5) * (100% - 14px)) 100% no-repeat, rgba(255,255,255,0.12);
}
.ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border: none; border-radius: 50%;
  background: #d6d7e0; transition: box-shadow .15s;
}
.ctl input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); }
.ctl input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.45); }
.ctl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #d6d7e0; transition: box-shadow .15s; }
.ctl input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(255,255,255,0.08); }
.ctl input[type="range"]:hover::-moz-range-thumb { box-shadow: 0 0 0 5px rgba(255,255,255,0.08); }
.ctl input[type="range"]:focus-visible { outline: none; }
.ctl input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255,255,255,0.45); }
.ctl input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(255,255,255,0.45); }
.ctl select {
  font-family: var(--font); font-size: 0.8125rem; color: #fff; max-width: 170px;
  background: #2a2a36; border: 1px solid rgba(255,255,255,0.14); border-radius: 6px; padding: 5px 8px;
}
/* the color input as a plain square swatch: no frame, slightly rounded */
.ctl input[type="color"] {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; padding: 0; cursor: pointer;
  background: none; border: none; border-radius: 4px; overflow: hidden;
}
.ctl input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ctl input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.ctl input[type="color"]::-moz-color-swatch { border: none; border-radius: 4px; }
.ctl input[type="color"]:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { pointer-events: none; display: block; height: 100%; border-radius: 999px; background: rgba(255,255,255,0.12); transition: background .15s; }
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #8b8ea3; transition: transform .15s, background .15s;
}
.switch input:checked + i { background: rgba(255,255,255,0.42); }
.switch input:checked + i::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }


.rail-cta { padding: 16px 18px 18px; border-top: 1px solid rgba(255,255,255,0.08); background: #16161e; }
.rail-cta .btn-primary { width: 100%; justify-content: center; padding: 13px 16px; }

/* Row under the stage: straight to the code, for developers */
.demo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.demo-actions-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #8888a8; margin-right: 4px; }
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 0.8125rem; font-weight: 600; color: #d6d7e0; text-decoration: none;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.demo-chip:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.28); color: #fff; }
.demo-chip.copied { color: #27c93f; border-color: rgba(39,201,63,0.4); }

/* ─── ABOUT THIS CHART ────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.about-grid .section-h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.about-text p { font-size: 1rem; line-height: 1.75; color: var(--text); }
.about-text p + p { margin-top: 14px; }
/* setting, class and function names in the texts, on the dark header and the light page alike */
.demo-lead code, .demo-hints code, .about-grid code { font-family: var(--mono); font-size: 0.875em; padding: 1px 5px; border-radius: 4px; background: rgba(127,127,127,0.16); }
.about-cards { display: grid; gap: 14px; }
.about-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; }
.about-card h3 { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--heading); margin-bottom: 10px; }
.about-card ul { list-style: none; }
.about-card li { position: relative; padding: 4px 0 4px 24px; font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.about-card li::before { content: ''; position: absolute; left: 2px; top: 11px; width: 12px; height: 6px; border-left: 2px solid #1a8a3a; border-bottom: 2px solid #1a8a3a; transform: rotate(-45deg); transform-origin: left bottom; }
.about-card.think li::before { top: 13px; height: 0; border-left: none; border-bottom: 2px solid #b0b0c0; transform: none; }

/* ─── CODE ────────────────────────────────────────────── */
.code-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 48px; flex-wrap: wrap; margin-bottom: 24px; }
.code-head .section-h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 10px; }
.code-head .section-lead { max-width: 620px; font-size: 0.9375rem; line-height: 1.65; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 420px; }
.doc-chips span { font-size: 0.75rem; font-weight: 600; color: var(--muted); margin-right: 4px; }
.doc-chips a {
  font-size: 0.75rem; font-weight: 600; color: var(--text); text-decoration: none;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px;
}
.doc-chips a:hover { border-color: rgba(0,0,0,0.25); color: var(--heading); }

.demo-code { background: #0c0c12; border-radius: 14px; overflow: hidden; scroll-margin-top: 72px; }
.code-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 0 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.code-tabs { display: flex; }
.code-tab {
  font-family: var(--font); font-size: 0.8125rem; font-weight: 600; color: #9a9db0;
  background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer;
}
.code-tab:hover { color: #fff; }
.code-tab[aria-selected="true"] { color: #fff; border-bottom-color: #ff6b35; }
.code-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.code-btn {
  font-family: var(--font); font-size: 0.75rem; font-weight: 600; color: #d6d7e0;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
  padding: 6px 11px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.code-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.code-btn.copied { color: #27c93f; border-color: rgba(39,201,63,0.4); }
.code-note { font-size: 0.8125rem; line-height: 1.55; color: #a8a8bc; padding: 12px 18px 0; }
.code-note a { color: #ff8a5c; text-underline-offset: 3px; }
.code-note code { font-family: var(--mono); font-size: 0.75rem; color: #e8e8f0; background: rgba(255,255,255,0.08); border-radius: 4px; padding: 1px 6px; }
.code-note [hidden] { display: none; }
.code-view {
  /* long code scrolls inside its box, like any code viewer */
  margin: 0; padding: 14px 18px 18px; max-height: 480px; overflow: auto; position: relative;
  font-family: var(--mono); font-size: 0.8125rem; line-height: 1.65; color: #e8e8f0;
  white-space: pre; tab-size: 2; font-variant-ligatures: none;
}
.code-view code { font: inherit; display: block; }
.code-view code.code-prompt { white-space: pre-wrap; font-family: var(--font); font-size: 0.9375rem; line-height: 1.7; }
.code-view .c { color: #7c7f95; }
.code-view .s { color: #a9dc76; }
.code-view .w { color: #ff8a5c; }
.code-view .n { color: #67b7dc; }
.code-view .k { color: #67b7dc; }

/* ─── RELATED DEMOS ───────────────────────────────────── */
.rel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.rel-head .section-h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0; }
.rel-links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.875rem; font-weight: 600; }
.rel-links a { color: var(--orange-text); text-decoration: underline; text-decoration-color: rgba(255,107,53,0.35); text-underline-offset: 3px; }
.rel-links a:hover { text-decoration-color: var(--orange); }
.rel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rel-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .3s, border-color .3s;
}
.rel-card:hover, .rel-card:focus-visible { box-shadow: 0 10px 30px rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.18); }
.rel-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: center; background: #fff; border-bottom: 1px solid var(--border); }
.rel-card span { font-size: 0.875rem; font-weight: 600; color: var(--heading); padding: 11px 14px 13px; }

/* ─── RELATED TOOLS ───────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 28px; }
.tool-tile {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .3s, border-color .3s;
}
.tool-tile:hover, .tool-tile:focus-visible { box-shadow: 0 12px 36px rgba(0,0,0,0.10); border-color: rgba(0,0,0,0.18); }
.tool-tile img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; background: #16161f; }
.tool-tile-body { padding: 16px 18px 18px; }
.tool-tile-kicker { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-text); }
.tool-tile-title { font-size: 1.0625rem; font-weight: 700; color: var(--heading); margin-top: 6px; }
.tool-tile-desc { font-size: 0.8125rem; color: var(--muted); line-height: 1.55; margin-top: 4px; }

/* ─── IN THE DOJO ─────────────────────────────────────── */
.dojo-lead { font-size: 0.9375rem; color: var(--muted); margin: -12px 0 0; }
.dojo-lead + .tool-grid { margin-top: 20px; }
.dojo-tile img { object-position: center; }

/* ─── WIDE DEMOS (stage.wide) ────────────────────────── */
/* The same stage, as wide as the window allows, for charts that need the width. The title and the code row follow
   its left edge; the sections below keep the usual width. */
.demo-top.is-wide .demo-top-inner { max-width: none; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .demo-top { padding: 22px 32px 32px; }
  .demo-stage { grid-template-columns: 1fr; }
  .demo-rail { border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .rail-body { flex: none; overflow: visible; }
  .rail-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
  .rail-group + .rail-group { padding-top: 14px; }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .rel-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .demo-top { padding: 18px 20px 28px; }
}
@media (max-width: 600px) {
  .demo-top { padding: 16px 12px 24px; }
  .demo-crumbs-row, .demo-head, .demo-actions { padding: 0 4px; }
  .demo-crumbs-row { flex-wrap: nowrap; }
  .demo-pager { gap: 4px; }
  .demo-pager span { display: none; } /* only the chevrons, so the row stays one line */
  .gallery-top .demo-pager span { display: inline; } /* the gallery's amCharts 4 link keeps its words */
  .demo-pager a { padding: 6px; margin: -6px 0; }
  /* the chart stays in view under the menu while the visitor works the controls below it */
  .demo-canvas { position: sticky; top: 51px; z-index: 5; }
  #demo-host { padding: 6px 8px 4px; }
  #demo-host > div:only-child { height: 300px !important; }
  .demo-hints { display: none; } /* they talk about hovering and the mouse wheel */
  .demo-bar { padding: 4px 4px 4px 8px; }
  /* the strip under a stock or Gantt chart: the theme's colors alone, no word or arrows, so it stays one line */
  .demo-look #demo-theme-label, .demo-look #demo-theme-name, .demo-look .theme-step { display: none; }
  .demo-look .rail-group { gap: 12px; margin-right: 8px; }
  .rail-panel { display: block; }
  .rail-group + .rail-group { padding-top: 10px; }
  .code-tabs { overflow-x: auto; max-width: 100%; }
  .code-tab { white-space: nowrap; }
  .code-view { font-size: 0.75rem; padding: 12px 14px 16px; }
}

/* ─── GALLERY (/demos/) ───────────────────────────────── */
.gallery-top { padding-bottom: 0; display: flow-root; } /* flow-root: the lead's margin stays inside the dark band */
.gallery-top .demo-lead { max-width: 720px; }
/* only the top left glow: the bar below goes on with the same background, with no edge between them */
.gallery-top::before { background: radial-gradient(ellipse 50% 70% at 0% 0%, rgba(255,107,53,0.14) 0%, transparent 60%); }
/* The categories and the search stick under the menu (51px) while the gallery scrolls */
.gallery-bar {
  position: sticky; top: 51px; z-index: 50; padding: 12px 48px;
  background: linear-gradient(90deg, #1e1e1e 0%, #0a0a0a 100%); transition: box-shadow .2s;
}
.gallery-bar.is-stuck { box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
/* the dark band goes on a little below the bar, and scrolls away under it */
#gallery::before { content: ''; display: block; height: 18px; background: linear-gradient(90deg, #1e1e1e 0%, #0a0a0a 100%); }
.gallery-bar-inner { max-width: 1320px; margin: 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 24px; }
.gallery-chips { position: relative; display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 600px; min-width: 0; }
.gallery-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; color: #d8d8e4; text-decoration: none;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); transition: background .2s, border-color .2s;
}
.gallery-chip:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.22); color: #fff; }
.gallery-chip span { font-weight: 500; color: #8888a8; }
/* the category in view */
.gallery-chip.is-active { background: rgba(255,107,53,0.16); border-color: rgba(255,107,53,0.55); color: #fff; }
.gallery-chip.is-active span { color: #ffb08f; }
.gallery-search input {
  width: 240px; max-width: 100%; padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 0.875rem;
  color: #fff; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.16);
}
.gallery-search input::placeholder { color: #8888a8; }
.gallery-search input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* a jump to a category stops below the menu and the bar (the page sets the bar's height) */
.gallery-section { scroll-margin-top: calc(51px + var(--gallery-bar-h, 92px)); }
.gallery-h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 24px; }
.gallery-count { font-size: 0.55em; font-weight: 600; color: var(--text-muted, #8888a8); vertical-align: middle; }
.gallery-section[hidden], .gallery-grid .rel-card[hidden] { display: none; }
.gallery-none { max-width: 1136px; margin: 48px auto 64px; padding: 0 24px; color: var(--text-muted, #8888a8); }
/* narrower screens: the chips make one row that scrolls sideways, so the bar stays one row tall */
@media (max-width: 1024px) {
  .gallery-bar { padding: 10px 32px; }
  .gallery-bar-inner { align-items: center; gap: 12px; }
  .gallery-chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .gallery-chips::-webkit-scrollbar { display: none; }
  .gallery-chips.at-end { -webkit-mask-image: none; mask-image: none; }
  .gallery-chip { flex: none; }
  .gallery-search input { width: 200px; }
}
@media (max-width: 768px) {
  .gallery-bar { padding: 10px 20px; }
  .gallery-search input { width: 150px; }
}
@media (max-width: 600px) {
  .gallery-bar { padding: 10px 16px; }
  .gallery-search input { width: 116px; }
}
