/* Data128 — chrome for the standalone tool pages.
 *
 * Tool pages are self-contained apps with their own inline <style>, so this
 * file must not fight them. Two rules keep the peace:
 *   1. Chrome variables are namespaced --d128-*. Several tools define their
 *      own --accent / --bg / --rule, and an un-namespaced token would be
 *      silently repainted by whichever tool loaded it.
 *   2. Every chrome rule is scoped under a class. Tool CSS styles bare
 *      elements (a, h1, section), and a class selector always outranks those,
 *      so the header and footer survive regardless of what the tool does.
 */

:root {
  --d128-ink: #1A1A18;
  --d128-muted: #4A4A45;
  --d128-faint: #6B6B65;
  --d128-rule: #CFCFCA;
  --d128-rule-light: #E4E4DF;
  --d128-accent: #1B3F9E;
  --d128-accent-dark: #122C70;
  --d128-bg: #FCFCFA;
  --d128-tint: #F0F1F4;
  --d128-code-bg: #F3F3EF;
  --d128-serif: "Source Serif 4", "Source Serif Pro", Charter, Georgia, serif;
  --d128-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --d128-surface: #FFFFFF;
  --d128-success: #1E7A3C;
  --d128-danger: #A33100;
  --d128-warning: #8A6100;
  --d128-mark: #FFF1A8;
  --d128-mono: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* dark mode — same tokens, repainted. Matches site.css so the chrome on a tool
   page and the chrome on an article page stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --d128-ink: #E9E9E3;
    --d128-muted: #B0B0A8;
    --d128-faint: #8C8C84;
    --d128-rule: #3A3A34;
    --d128-rule-light: #2A2A26;
    --d128-accent: #93B4FF;
    --d128-accent-dark: #BFD2FF;
    --d128-bg: #131312;
    --d128-tint: #1C1C1A;
    --d128-code-bg: #1B1B19;
    --d128-surface: #1A1A18;
    --d128-success: #7BC496;
    --d128-danger: #F0A08C;
    --d128-warning: #D9B45E;
    --d128-mark: #5C4B10;
    color-scheme: dark;
  }
}

/* ---------- chrome: header + footer ---------- */

.tool-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px;
}
.tool-shell.wide { max-width: 1040px; }

.tool-chrome { font-family: var(--d128-serif); }

.tool-chrome.site-header {
  border-bottom: 1px solid var(--d128-rule);
  background: var(--d128-bg);
}
.tool-chrome.site-header .tool-shell,
.tool-chrome.site-footer .tool-shell {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.tool-chrome.site-header .tool-shell { padding-top: 22px; padding-bottom: 16px; }

.tool-chrome .wordmark {
  font-family: var(--d128-serif);
  font-size: 30px; line-height: 1; letter-spacing: -0.01em;
  color: var(--d128-ink); text-decoration: none;
}
.tool-chrome .wordmark:hover { color: var(--d128-ink); text-decoration: none; }
.tool-chrome .wordmark.small { font-size: 26px; }
.tool-chrome .accent { color: var(--d128-accent); }

.tool-chrome .site-nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.tool-chrome .site-nav a,
.tool-chrome nav a {
  font-family: var(--d128-serif);
  font-size: 16px;
  color: var(--d128-ink);
  text-decoration: none;
}
.tool-chrome .site-nav a:hover,
.tool-chrome nav a:hover { color: var(--d128-accent); text-decoration: underline; text-underline-offset: 3px; }
.tool-chrome .site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }

.tool-chrome.site-footer {
  border-top: 1px solid var(--d128-rule);
  margin-top: 56px;
  background: var(--d128-bg);
}
.tool-chrome.site-footer .tool-shell { padding-top: 24px; padding-bottom: 36px; }
.tool-chrome.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.tool-chrome .colophon {
  flex-basis: 100%; margin: 4px 0 0;
  font-family: var(--d128-serif); font-size: 14px; color: var(--d128-faint);
}

/* Tools that fill the viewport (explorer-style layouts) keep their own
   scrolling area; the chrome simply sits above and below it. */
.tool-chrome.site-header.flush,
.tool-chrome.site-footer.flush { padding-left: 20px; padding-right: 20px; }
.tool-chrome.site-footer.flush { margin-top: 0; }

/* ---------- Bulma subset, redrawn in the Data128 idiom ----------
 * Two older tools (Databricks instances, Spark memory calculator) are written
 * against Bulma classes. Rather than rewrite their markup, these rules give
 * the handful of classes they use a Data128 look.
 */

.section { padding: 32px 0; }
.container { max-width: 960px; margin: 0 auto; padding: 0 32px; }

.columns { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.columns.is-multiline { flex-wrap: wrap; }
.column { flex: 1 1 0; min-width: 0; padding: 12px; }
.column.is-1  { flex: none; width: 8.3333%; }
.column.is-2  { flex: none; width: 16.6666%; }
.column.is-3, .column.is-one-quarter { flex: none; width: 25%; }
.column.is-4  { flex: none; width: 33.3333%; }
.column.is-5  { flex: none; width: 41.6666%; }
.column.is-6  { flex: none; width: 50%; }
.column.is-7  { flex: none; width: 58.3333%; }
.column.is-8  { flex: none; width: 66.6666%; }
.column.is-9  { flex: none; width: 75%; }
.column.is-10 { flex: none; width: 83.3333%; }
.column.is-11 { flex: none; width: 91.6666%; }
.column.is-12 { flex: none; width: 100%; }

@media (max-width: 768px) {
  .column, .column[class*="is-"] { flex: none; width: 100%; }
  .container, .tool-shell { padding-left: 20px; padding-right: 20px; }
}

.content { font-family: var(--d128-serif); color: var(--d128-ink); line-height: 1.6; }
.content h1, .content h2, .content h3 { font-family: var(--d128-serif); font-weight: 600; line-height: 1.2; }
.content a { color: var(--d128-accent); }
.content code { font-family: var(--d128-mono); background: var(--d128-code-bg); padding: 1px 4px; border-radius: 2px; }

.box {
  background: var(--d128-surface);
  border: 1px solid var(--d128-rule);
  border-radius: 3px;
  padding: 20px;
}

.label {
  display: block; margin-bottom: 6px;
  font-family: var(--d128-serif); font-size: 15px; font-weight: 600; color: var(--d128-muted);
}
.field { margin-bottom: 16px; }
.control { position: relative; }
.input {
  width: 100%;
  font-family: var(--d128-mono); font-size: 17px;
  color: var(--d128-ink); background: var(--d128-surface);
  border: 1px solid var(--d128-rule);
  border-radius: 3px;
  padding: 8px 10px;
}
.input:focus { outline: 2px solid var(--d128-accent); outline-offset: -1px; border-color: var(--d128-accent); }

.button {
  display: inline-block; cursor: pointer;
  font-family: var(--d128-serif); font-size: 16px;
  padding: 8px 16px; border-radius: 3px;
  border: 1px solid var(--d128-rule); background: var(--d128-surface); color: var(--d128-ink);
}
.button:hover { border-color: var(--d128-accent); color: var(--d128-accent); }
.button.is-primary { background: var(--d128-accent); border-color: var(--d128-accent); color: #fff; }
.button.is-primary:hover { background: var(--d128-accent-dark); color: #fff; }

.is-size-1 { font-size: 40px; line-height: 1.15; }
.is-size-2 { font-size: 32px; line-height: 1.2; }
.is-size-3 { font-size: 26px; line-height: 1.25; }
.is-size-4 { font-size: 22px; }
.is-size-5 { font-size: 19px; }
.is-size-6 { font-size: 16px; }

.has-text-weight-bold { font-weight: 600; }
.has-text-info    { color: var(--d128-accent); }
.has-text-primary { color: var(--d128-accent); }
.has-text-success { color: var(--d128-success); }
.has-text-danger  { color: var(--d128-danger); }
.has-text-warning { color: var(--d128-warning); }

.intro { display: block; font-family: var(--d128-serif); font-size: 19px; color: var(--d128-muted); }
.text--highlight { background: var(--d128-mark); color: var(--d128-ink); padding: 0 2px; }
.link--nav { font-family: var(--d128-serif); color: var(--d128-ink); }
.link--nav:hover { color: var(--d128-accent); }

.mt-0 { margin-top: 0; }    .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }  .mb-2 { margin-bottom: 8px; }
.mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.pt-0 { padding-top: 0; }   .pb-0 { padding-bottom: 0; }
.pt-4 { padding-top: 16px; }.pb-4 { padding-bottom: 16px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
