/*
 * scaffold.css - Layout, reset, typography utilities, shared atoms
 * Provides the page chrome consumed by preview/component-*.html and
 * ui_kits/*.html. Component-specific styles live in components.css.
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-base-default);
  color: var(--text-default);
  font-family: var(--body-base-font-family);
  font-size: var(--body-base-font-size);
  line-height: var(--body-base-line-height);
  font-weight: var(--body-base-font-weight);
  letter-spacing: var(--body-base-letter-spacing);
  min-height: 100%;
}
/* avoid x-overflow inside the parent iframe */
html, body { overflow-x: hidden; max-width: 100%; }
body { padding: var(--spacer-32); }
img, svg, video, canvas { max-width: 100%; }
a { color: var(--text-default); text-decoration: none; }
a:hover { color: var(--text-default-hover); }
hr { border: 0; border-top: 1px solid var(--border-neutral-l1); margin: var(--spacer-24) 0; }

/* Section / heading helpers */
.h1 { font-family: var(--heading-2xl-font-family); font-size: var(--heading-2xl-font-size); line-height: var(--heading-2xl-line-height); font-weight: var(--heading-2xl-font-weight); color: var(--text-default); }
.h2 { font-family: var(--heading-md-font-family); font-size: var(--heading-md-font-size); line-height: var(--heading-md-line-height); font-weight: var(--heading-md-font-weight); color: var(--text-default); }
.h3 { font-family: var(--heading-sm-font-family); font-size: var(--heading-sm-font-size); line-height: var(--heading-sm-line-height); font-weight: var(--heading-sm-font-weight); color: var(--text-default); }
.eyebrow { font-size: var(--body-xs-font-size); line-height: var(--body-xs-line-height); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: var(--body-xs-letter-spacing); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* ===== Hero / brand title =====
 * Display title for marketing heroes ("The Real AI Engineer"-style). Each
 * brand-led letter (T / R / A / E or "T"-"R"-"A"-"E") gets its own brand
 * accent. Use the .ds-hero-title element with .brand1-.brand4 children.
 * Numerics inside any hero MUST inherit the body sans (NOT mono) — heroes
 * are typeset content, not data.
 */
.ds-hero-title {
  font-family: var(--heading-3xl-font-family);
  font-size: var(--heading-3xl-font-size);
  line-height: var(--heading-3xl-line-height);
  font-weight: var(--heading-3xl-font-weight);
  letter-spacing: var(--heading-3xl-letter-spacing);
  color: var(--text-default);
}
.ds-hero-title .brand1 { color: var(--bg-brand); }
.ds-hero-title .brand2 { color: var(--text-default); }
.ds-hero-title .brand3 { color: var(--bg-brand); }
.ds-hero-title .brand4 { color: var(--text-default); }
.ds-hero-title__sub {
  display: block;
  margin-top: var(--spacer-12);
  font-size: var(--heading-2xl-font-size);
  line-height: var(--heading-2xl-line-height);
  color: var(--text-secondary);
  letter-spacing: var(--heading-2xl-letter-spacing);
}

/* ===== Section title with mono index =====
 * Pattern: [00] brand-mono index above a 2-line section heading.
 * Reference: trae.ai value-section card titles.
 */
.ds-section-title__index {
  display: block;
  font-family: var(--code-editor-font-family);
  font-size: var(--body-sm-font-size);
  line-height: var(--body-sm-line-height);
  letter-spacing: var(--body-sm-letter-spacing);
  color: var(--bg-brand);
  margin-bottom: var(--spacer-12);
}
.ds-section-title {
  font-family: var(--heading-xl-font-family);
  font-size: var(--heading-xl-font-size);
  line-height: var(--heading-xl-line-height);
  letter-spacing: var(--heading-xl-letter-spacing);
  color: var(--text-default);
  font-weight: var(--heading-xl-font-weight);
  margin: 0;
}

/* ===== Layout helpers ===== */
.row { display: flex; gap: var(--spacer-12); flex-wrap: wrap; align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--spacer-12); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacer-24); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacer-24); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--spacer-24); }
.stack-8 { display: flex; flex-direction: column; gap: var(--spacer-8); }
.stack-12 { display: flex; flex-direction: column; gap: var(--spacer-12); }
.stack-16 { display: flex; flex-direction: column; gap: var(--spacer-16); }
.stack-24 { display: flex; flex-direction: column; gap: var(--spacer-24); }
.stack-40 { display: flex; flex-direction: column; gap: var(--spacer-40); }

/* preview header (per page) */
.pv-header { margin-bottom: var(--spacer-32); padding-bottom: var(--spacer-16); border-bottom: 1px solid var(--border-neutral-l1); }
.pv-header h1 { font-size: var(--heading-lg-font-size); line-height: var(--heading-lg-line-height); font-weight: var(--heading-lg-font-weight); margin-bottom: var(--spacer-4); }
.pv-header p { color: var(--text-secondary); font-size: var(--body-base-font-size); line-height: var(--body-base-line-height); }

.pv-section { margin-bottom: var(--spacer-32); }
.pv-section__title { font-size: var(--heading-sm-font-size); line-height: var(--heading-sm-line-height); font-weight: var(--heading-sm-font-weight); margin-bottom: var(--spacer-12); color: var(--text-default); }
.pv-section__sub { font-size: var(--body-base-font-size); line-height: var(--body-base-line-height); color: var(--text-tertiary); margin-bottom: var(--spacer-12); }

/* ===== Tooltip / Popover ===== */
.ds-tooltip {
  display: inline-flex; align-items: center; gap: var(--spacer-6);
  padding: var(--spacer-6) var(--spacer-8);
  background: var(--bg-tooltip);
  color: var(--text-default);
  border: 1px solid var(--border-neutral-l2);
  border-radius: var(--radius-8);
  font-size: var(--body-sm-font-size); line-height: var(--body-sm-line-height);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--text-default) 16%, transparent);
}

.ds-popover {
  background: var(--bg-base-default);
  border: 1px solid var(--border-neutral-l2);
  border-radius: var(--radius-12);
  padding: var(--spacer-8);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--text-default) 16%, transparent);
}

/* ===== Empty state ===== */
.ds-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--spacer-40) var(--spacer-24);
  color: var(--text-tertiary); text-align: center;
  border: 1px dashed var(--border-neutral-l1);
  border-radius: var(--radius-12);
}
.ds-empty__icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-neutral-l1); margin-bottom: var(--spacer-12);
  color: var(--icon-secondary);
  border-radius: var(--radius-8);
}
.ds-empty__title { color: var(--text-default); font-size: var(--body-base-font-size); font-weight: var(--font-weight-medium, 500); margin-bottom: var(--spacer-4); }
.ds-empty__desc { font-size: var(--body-sm-font-size); }

/* ===== Code block ===== */
.ds-code {
  background: var(--bg-overlay-l1);
  border: 1px solid var(--border-neutral-l1);
  border-radius: var(--radius-8);
  padding: var(--spacer-12) var(--spacer-16);
  color: var(--text-default);
  font-family: var(--code-editor-font-family);
  font-size: var(--code-editor-font-size);
  line-height: var(--code-editor-line-height);
  white-space: pre;
  overflow: auto;
}

/* ===== Kbd ===== */
.ds-kbd {
  display: inline-flex; align-items: center;
  padding: 0 var(--spacer-6); height: 20px;
  background: transparent;
  border: 1px solid var(--border-neutral-l1);
  border-radius: var(--radius-8);
  box-shadow: none;
  font-family: var(--body-md-font-family);
  font-size: var(--body-md-font-size);
  font-weight: var(--font-weight-default, 400);
  font-variant-numeric: normal;
  font-feature-settings: normal;
  letter-spacing: var(--body-md-letter-spacing);
  color: var(--text-secondary);
}

.icon,
.icon-img {
  display: inline-block;
  color: currentColor;
  flex: 0 0 auto;
  object-fit: contain;
  vertical-align: middle;
}

/* ===== Mono / Numeric utilities =====
 * Anything code-like or numeric (counts, currencies, percentages, IDs,
 * tabular cells, kbd, code) MUST use the mono token + tabular figures.
 */
.mono,
.num,
code, kbd, samp, pre {
  font-family: var(--code-editor-font-family);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.metric-value,
.kpi-value,
.scorecard-value {
  font-family: var(--font-family-metric);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

@media (max-width: 720px) {
  body { padding: var(--spacer-16); }
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
}
