/* Marketiism OS base: reset, typography, layout utilities, focus ring. Values come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--s-4)); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; }
img, video { display: block; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:disabled { cursor: not-allowed; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
::selection { background: var(--selection); color: var(--ink); }
[hidden] { display: none !important; }

/* Typography */
h1, .h1 { font-size: var(--fs-24); line-height: var(--lh-snug); font-weight: var(--fw-bold); letter-spacing: var(--track-tight); }
h2, .h2 { font-size: var(--fs-18); line-height: var(--lh-snug); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
h3, .h3 { font-size: var(--fs-16); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
h4, .h4 { font-size: var(--fs-14); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
.display { font-size: var(--fs-56); line-height: 1.04; font-weight: var(--fw-bold); letter-spacing: var(--track-display); }
.title-xl { font-size: var(--fs-44); line-height: 1.08; font-weight: var(--fw-bold); letter-spacing: var(--track-display); }
.title-lg { font-size: var(--fs-32); line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: var(--track-tight); }
.lead { font-size: var(--fs-18); line-height: var(--lh-loose); color: var(--ink-2); }
.text-16 { font-size: var(--fs-16); }
.small, .text-12 { font-size: var(--fs-12); }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.strong { font-weight: var(--fw-semibold); color: var(--ink); }
.eyebrow { font-size: var(--fs-12); font-weight: var(--fw-semibold); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.mono, code, kbd, samp { font-family: var(--mono); font-size: 0.92em; }
.tnum, .num { font-variant-numeric: tabular-nums; }
.num { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wrap-any { overflow-wrap: anywhere; }
code { background: var(--surface-3); border-radius: var(--r-sm); padding: 1px 5px; }
kbd { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-sm); color: var(--muted); background: var(--surface); }
.prose { max-width: 68ch; font-size: var(--fs-16); line-height: var(--lh-loose); color: var(--ink-2); }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 2em; color: var(--ink); }
.prose h3 { margin-top: 1.5em; color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
.link-quiet { color: inherit; }
.link-quiet:hover { color: var(--link); }
.link-ext { display: inline-flex; align-items: center; gap: 4px; }

/* Focus: one ring everywhere */
:focus { outline: none; }
:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.skip { position: absolute; left: var(--s-3); top: -60px; z-index: var(--z-toast); padding: var(--s-2) var(--s-3); background: var(--surface); color: var(--link); border: 1px solid var(--line); border-radius: var(--r); font-weight: var(--fw-semibold); }
.skip:focus { top: var(--s-3); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Icons */
.i { flex: none; display: inline-block; vertical-align: middle; }
svg.i { overflow: visible; }

/* Layout utilities */
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row-lg { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.span-all { grid-column: 1 / -1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.w-full { width: 100%; }
.center { text-align: center; }
.right { text-align: right; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-6); }
.sticky { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--s-4) 0; }

/* Dynamic values: templates may set only custom properties in style="" (see CONTRACT_UI.md) */
.u-w { width: var(--w, auto); }

@media (max-width: 1100px) {
  .grid-detail { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky { position: static; }
  .hide-md { display: none !important; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-main, .grid-form { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: 0 var(--s-4); }
  .hide-sm { display: none !important; }
  h1, .h1 { font-size: var(--fs-20); }
  .display { font-size: 36px; }
  .title-xl { font-size: var(--fs-32); }
  .title-lg { font-size: var(--fs-24); }
  .lead { font-size: var(--fs-16); }
}
@media (max-width: 420px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 761px) { .show-sm { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
