/* ui2-components.css — Reusable UI2 visual primitives.
 *
 * Class names use `ui2-` prefix to avoid colliding with any prod CSS that
 * already defines `.btn`, `.card`, `.chip`, etc. Loading order:
 *
 *   1) ui2-fonts.css
 *   2) ui2-tokens.css      (defines --ui2-* vars)
 *   3) ui2-components.css  (THIS file; consumes vars)
 *   4) <page>.css          (page-specific layouts)
 *
 * Every selector is scoped under `body.ui2` so this stylesheet is inert
 * on pages that haven't opted in.
 */

/* ─── Container ─────────────────────────────────────────────── */

body.ui2 .ui2-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}
@media (max-width: 768px) {
  body.ui2 .ui2-container { padding: 0 20px; }
}

/* ─── Display + editorial type ──────────────────────────────── */

body.ui2 .ui2-display {
  font-family: var(--ui2-font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.22;
  color: var(--ui2-ink);
  padding-bottom: 0.22em;
  margin: 0;
}

body.ui2 .ui2-italic-em {
  font-family: var(--ui2-font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ui2-amber-600);
}

body.ui2 .ui2-eyebrow {
  font-family: var(--ui2-font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ui2-ink-4);
  font-weight: 500;
}

/* §-prefixed eyebrow (mockup convention). Use .ui2-eyebrow.section-mark
   to add the marker; opt-in to keep .ui2-eyebrow neutral. */
body.ui2 .ui2-eyebrow.section-mark::before {
  content: "§ ";
  color: var(--ui2-amber-600);
}

body.ui2 .ui2-label-mono {
  font-family: var(--ui2-font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ui2-ink-4);
}

body.ui2 .ui2-mono   { font-family: var(--ui2-font-mono); }
body.ui2 .ui2-serif  { font-family: var(--ui2-font-serif); }
body.ui2 .ui2-italic { font-style: italic; }
body.ui2 .ui2-muted  { color: var(--ui2-ink-4); }
body.ui2 .ui2-amber  { color: var(--ui2-amber-600); }

body.ui2 .ui2-bignum {
  font-family: var(--ui2-font-serif);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--ui2-ink);
}

/* Hand-note ("↑ Goal 92 by May 31"). Used sparingly. */
body.ui2 .ui2-handnote {
  font-family: var(--ui2-font-hand);
  font-size: 18px;
  color: var(--ui2-amber-700);
  display: inline-block;
}

/* ─── Rules ─────────────────────────────────────────────────── */

body.ui2 .ui2-rule {
  height: 1px;
  background: var(--ui2-rule);
  border: none;
  margin: 0;
}
body.ui2 .ui2-rule-thick {
  height: 2px;
  background: var(--ui2-ink);
  border: none;
  margin: 0;
}

/* ─── Buttons ───────────────────────────────────────────────── */

body.ui2 .ui2-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--ui2-font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: var(--ui2-radius);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--ui2-ink);
  transition: transform 0.12s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
body.ui2 .ui2-btn:hover  { transform: translateY(-1px); }
body.ui2 .ui2-btn:active { transform: translateY(0); }

body.ui2 .ui2-btn-primary {
  background: var(--ui2-ink);
  color: var(--ui2-cream);
  border-color: var(--ui2-ink);
}
body.ui2 .ui2-btn-primary:hover {
  background: var(--ui2-amber-500);
  border-color: var(--ui2-amber-500);
  color: white;
}

body.ui2 .ui2-btn-amber {
  background: var(--ui2-amber-500);
  color: white;
  border-color: var(--ui2-amber-500);
}
body.ui2 .ui2-btn-amber:hover {
  background: var(--ui2-amber-600);
  border-color: var(--ui2-amber-600);
}

body.ui2 .ui2-btn-ghost {
  background: transparent;
  color: var(--ui2-ink);
  border-color: var(--ui2-rule);
}
body.ui2 .ui2-btn-ghost:hover {
  border-color: var(--ui2-ink);
  background: var(--ui2-paper);
}

body.ui2 .ui2-btn-link {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--ui2-ink);
  border-bottom: 1px solid var(--ui2-ink);
  border-radius: 0;
  padding-bottom: 2px;
}
body.ui2 .ui2-btn-link:hover {
  color: var(--ui2-amber-600);
  border-color: var(--ui2-amber-600);
}

body.ui2 .ui2-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Chips / pills ─────────────────────────────────────────── */

body.ui2 .ui2-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--ui2-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--ui2-paper);
  border: 1px solid var(--ui2-rule);
  border-radius: 100px;
  color: var(--ui2-ink-3);
  text-transform: uppercase;
}
body.ui2 .ui2-chip-amber {
  background: var(--ui2-amber-100);
  border-color: var(--ui2-amber-200);
  color: var(--ui2-amber-700);
}
body.ui2 .ui2-chip-good { background: #E5EDE2; border-color: #C8D6C2; color: var(--ui2-good); }
body.ui2 .ui2-chip-warn { background: #F4E8CC; border-color: #E0D0A0; color: var(--ui2-warn); }
body.ui2 .ui2-chip-bad  { background: #F2DCD4; border-color: #E0BBA8; color: var(--ui2-bad); }

/* ─── Cards ─────────────────────────────────────────────────── */

body.ui2 .ui2-card {
  background: white;
  border: 1px solid var(--ui2-rule);
  border-radius: var(--ui2-radius-lg);
  position: relative;
}
body.ui2 .ui2-card-paper {
  background: var(--ui2-paper);
  border-color: var(--ui2-rule);
}
body.ui2 .ui2-card-pad     { padding: 24px; }
body.ui2 .ui2-card-pad-lg  { padding: 32px; }

body.ui2 .ui2-card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--ui2-rule);
}
body.ui2 .ui2-card-head h3 {
  margin: 0;
  font-family: var(--ui2-font-serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--ui2-ink);
}
body.ui2 .ui2-card-head .ui2-spacer { flex: 1; }

/* ─── Section spacing ───────────────────────────────────────── */

body.ui2 .ui2-section-pad    { padding: 96px 0; }
body.ui2 .ui2-section-pad-sm { padding: 64px 0; }
@media (max-width: 768px) {
  body.ui2 .ui2-section-pad    { padding: 64px 0; }
  body.ui2 .ui2-section-pad-sm { padding: 48px 0; }
}

/* ─── Reveal-on-scroll ──────────────────────────────────────── */

/* HISTORY: An earlier version of this file set
 *   body.ui2 .ui2-reveal { opacity: 0; transform: translateY(12px); ... }
 * with `.visible / .is-visible` to restore opacity:1. That broke prod
 * pages where /shared/ui2-interactions.js auto-tags many elements
 * (.hero, .plan, etc.) with `.ui2-reveal` for its OWN scroll reveal
 * system. Those elements ended up stuck at opacity:0 because the
 * interactions.js toggle didn't always end on a class our selector
 * recognized.
 *
 * Fix: do NOT default `.ui2-reveal` to opacity:0 globally. Defer the
 * reveal mechanic entirely to /shared/ui2-interactions.js (prod's
 * existing system) and the fadeUp keyframe animations baked into
 * page-level inline styles. ui2-fx.js's initReveal() still adds
 * `.visible` for opt-in elements that explicitly want our system, but
 * the visibility transition is now ADDITIVE to prod styles, not a
 * mandatory hidden-by-default override.
 *
 * If a page truly wants the UI2 hidden-then-fade-in pattern, opt in
 * with the explicit `.ui2-reveal-init` class and our fx.js handles it. */

body.ui2 .ui2-reveal-init {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
body.ui2 .ui2-reveal-init.visible,
body.ui2 .ui2-reveal-init.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Nav auth-state populator safety net.
 * Prod page inline CSS:  .nav-actions{opacity:0} + .nav-actions.ready{opacity:1}
 * On some pages (/free-tools, /blog) the .ready class is added but the
 * computed opacity stays at 0 — root cause is timing-related (transition
 * starting before CSS finishes parsing on subsequent loads). Force the
 * winning state with !important so the auth-rendered nav buttons / user
 * pill never disappear. */
body.ui2 .nav-actions.ready {
  opacity: 1 !important;
}

/* ─── FAQ accordion (works with <details> or [data-faq-item]) ─ */

body.ui2 .ui2-faq {
  border-bottom: 1px solid var(--ui2-rule);
  padding: 20px 0;
}
body.ui2 details.ui2-faq summary,
body.ui2 .ui2-faq [data-faq-toggle] {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--ui2-font-serif);
  font-size: 22px;
  color: var(--ui2-ink);
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
}
body.ui2 details.ui2-faq summary::-webkit-details-marker { display: none; }
body.ui2 details.ui2-faq summary::after,
body.ui2 .ui2-faq [data-faq-toggle]::after {
  content: "+";
  font-family: var(--ui2-font-sans);
  font-size: 24px;
  color: var(--ui2-amber-600);
  transition: transform 0.2s ease;
}
body.ui2 details.ui2-faq[open] summary::after,
body.ui2 .ui2-faq.open [data-faq-toggle]::after {
  transform: rotate(45deg);
}
body.ui2 .ui2-faq-answer,
body.ui2 details.ui2-faq > p {
  font-size: 15px;
  color: var(--ui2-ink-3);
  line-height: 1.6;
  margin-top: 12px;
  max-width: 700px;
}
body.ui2 .ui2-faq:not(.open) .ui2-faq-answer { display: none; }

/* ─── Marquee (small "currently citing" ticker) ─────────────── */

body.ui2 .ui2-marquee {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
body.ui2 .ui2-marquee-track {
  display: inline-flex;
  gap: 48px;
  animation: ui2-marquee 40s linear infinite;
  padding-right: 48px;
}
@keyframes ui2-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ─── Utility ───────────────────────────────────────────────── */

body.ui2 .ui2-grid    { display: grid; gap: 24px; }
body.ui2 .ui2-flex    { display: flex; }
body.ui2 .ui2-row     { display: flex; align-items: center; gap: 12px; }
body.ui2 .ui2-col     { display: flex; flex-direction: column; gap: 12px; }
body.ui2 .ui2-between { justify-content: space-between; }
body.ui2 .ui2-center  { align-items: center; }
body.ui2 .ui2-wrap    { flex-wrap: wrap; }

body.ui2 .ui2-no-scrollbar::-webkit-scrollbar { display: none; }
body.ui2 .ui2-no-scrollbar { scrollbar-width: none; }
