/* ============================================================
   BUSY SEASON SHARED BUILD CORE — core.css
   Every demo/client site sits on this file. It carries the laws
   from agents/LESSONS.md so no site can re-introduce a fixed bug.
   Sites add their own palette/type tokens ON TOP — never edit
   this file per-site.
   L-07: px fallback before every clamp() — this file declares px
         first everywhere; site CSS must do the same.
   L-13: data-label stacked tables under 700px.
   L-15: reveal-safety (opacity is never the only path to content).
   L-16: one --sec-pad rhythm, no per-section padding.
   ============================================================ */

/* ---------- Reset + global safety ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg, video, canvas { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid currentColor; outline-offset: 2px;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: 10px 16px; background: #000; color: #fff;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Rhythm (L-16): ONE spacing token ---------- */
:root {
  --sec-pad: 64px;
  --container: 1080px;
  --gutter: 20px;
}
@media (max-width: 700px) { :root { --sec-pad: 44px; } }
.sec { padding: var(--sec-pad) 0; }
.sec > .wrap > :first-child { margin-top: 0; }
.sec > .wrap > :last-child { margin-bottom: 0; }
.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: 20px; padding-left: var(--gutter);
  padding-right: 20px; padding-right: var(--gutter);
}

/* ---------- Reveal machinery (L-15: failure-proof) ----------
   JS adds .rv-on. If JS never runs, html lacks .js and everything
   stays visible. Reduced-motion kills it entirely. */
html.js .rv { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
html.js .rv.rv-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .rv { opacity: 1 !important; transform: none !important; transition: none !important; }
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Stacked tables under 700px (L-13) ---------- */
.tablebox { overflow-x: auto; }
@media (max-width: 700px) {
  /* Stacking is gated on html.js: without JS the data-label attributes may be
     absent (the labeler runs in core.js), and a headerless stack is worse than
     a scrollable table. No-JS users get the normal table inside .tablebox. */
  html.js table.stack thead { display: none; }
  html.js table.stack, html.js table.stack tbody, html.js table.stack tr, html.js table.stack td { display: block; width: 100%; }
  html.js table.stack tr { border: 1px solid rgba(128,128,128,.35); border-radius: 10px; margin: 0 0 12px; padding: 6px 12px; }
  html.js table.stack td { border: none; padding: 8px 0; }
  html.js table.stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .65;
    margin-bottom: 2px;
  }
}

/* ---------- Tier switch machinery (dog brand + tire demo) ----------
   Page sets body[data-tier="essential|signature|flagship"].
   Elements opt in with data-tier-show="signature flagship" (space list).
   Default tier if JS fails: markup ships with body data-tier already set,
   so content is never JS-gated. */
body[data-tier="essential"] [data-tier-show]:not([data-tier-show~="essential"]),
body[data-tier="signature"] [data-tier-show]:not([data-tier-show~="signature"]),
body[data-tier="flagship"]  [data-tier-show]:not([data-tier-show~="flagship"]) { display: none !important; }
.tierbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tierbar [data-tier-btn] {
  cursor: pointer; border: 1px solid currentColor; background: transparent; color: inherit;
  font: inherit; padding: 8px 14px; border-radius: 999px; min-height: 44px;
}
.tierbar [data-tier-btn][aria-pressed="true"] { background: currentColor; }
.tierbar [data-tier-btn][aria-pressed="true"] > span { filter: invert(1); }

/* ---------- Dual-mode theming hook ----------
   Sites define tokens under html[data-mode="a"] and html[data-mode="b"].
   The toggle button carries data-mode-toggle. Content identical in both. */
[data-mode-toggle] { cursor: pointer; min-height: 44px; }

/* ---------- Labeled placeholders (client fills later) ----------
   The rule: a placeholder is VISIBLY labeled in the layout, never a footnote. */
.ph {
  outline: 2px dashed rgba(200,80,80,.75); outline-offset: 2px;
  position: relative; border-radius: 4px;
}
.ph::after {
  content: attr(data-ph); /* e.g. "PLACEHOLDER — you set the real number" */
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: #b33; margin-top: 4px;
}
.ph-media {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 180px; border: 2px dashed rgba(128,128,128,.6);
  border-radius: 12px; padding: 24px; text-align: center;
}
.ph-media strong { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.ph-media small { font-size: 12px; opacity: .75; }

/* ---------- Demo banner (showcase sites only) ----------
   Every fictional site says so IN THE LAYOUT, not the footer. */
.demo-banner {
  text-align: center; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 12px;
}

/* ---------- Edge set + next-up blocks (Law 3) ---------- */
.edge-set ul, .next-up ul { padding-left: 1.2em; }
.edge-set li, .next-up li { margin: 6px 0; }

/* ---------- Buttons: honest tap targets ---------- */
.btn { display: inline-block; min-height: 44px; padding: 12px 22px; border-radius: 10px;
  text-decoration: none; font-weight: 700; cursor: pointer; border: none; font-size: 16px; }

/* ---------- Print: keep it to paper basics ---------- */
@media print {
  .rv { opacity: 1 !important; transform: none !important; }
  [data-mode-toggle], .tierbar { display: none !important; }
}
