/* PumpFunBot shared product UI — calm paper instrument
   Load this FIRST, then optional page-specific styles.
   Pages should not redefine a second brand system.

   Contrast standard (target WCAG AA):
   · Body / secondary text on --paper or --card: ≥ 4.5:1
   · Large text (≥18px / 14px bold) & UI chrome: ≥ 3:1
   · Primary CTAs: solid ink/paper or accent/accent-ink pairs
   · --faint is for chrome only (borders-adjacent labels); body copy uses --dim
*/

:root {
  color-scheme: light;
  /* surfaces */
  --paper: #ffffff;
  --ink: #111111;
  --card: #ffffff;
  --line: #e6e6e6;
  /* text hierarchy — light */
  --dim: #45433c;      /* ~7:1 on paper — secondary body */
  --faint: #5c5a52;    /* ~4.6:1 — captions / meta (not body) */
  /* status */
  --ok: #0f7a42;
  --watch: #9a6a0a;
  --risk: #c42a22;
  --info: #2a5f8f;
  /* accent */
  --accent: #156b42;
  --accent-ink: #f4ffe8;
  --radius: 8px;
  --serif: "Instrument Serif", "Iowan Old Style", Palatino, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 24px 60px -36px rgba(18, 17, 12, 0.38);
  --max: 720px;
  --max-wide: 1040px;
  /* form / placeholder */
  --placeholder: #6a675e;
  --focus-ring: color-mix(in srgb, var(--accent) 55%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c0c0f;
    --ink: #f2efe6;
    --card: #141418;
    --line: #3a3842;
    --dim: #c4c0b4;      /* secondary body on dark */
    --faint: #a39f93;    /* captions — still ≥4.5:1 on paper */
    --ok: #3dce78;
    --watch: #e0a93a;
    --risk: #ff6b6b;
    --info: #7eb8e8;
    --accent: #d4f25a;
    --accent-ink: #12140a;
    --placeholder: #8a867c;
    --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.75);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c0c0f;
  --ink: #f2efe6;
  --card: #141418;
  --line: #3a3842;
  --dim: #c4c0b4;
  --faint: #a39f93;
  --ok: #3dce78;
  --watch: #e0a93a;
  --risk: #ff6b6b;
  --info: #7eb8e8;
  --accent: #d4f25a;
  --accent-ink: #12140a;
  --placeholder: #8a867c;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.75);
}
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #12110c;
  --card: #fbfaf6;
  --line: #cfcbc0;
  --dim: #45433c;
  --faint: #5c5a52;
  --ok: #0f7a42;
  --watch: #9a6a0a;
  --risk: #c42a22;
  --info: #2a5f8f;
  --accent: #156b42;
  --accent-ink: #f4ffe8;
  --placeholder: #6a675e;
  --shadow: 0 24px 60px -36px rgba(18, 17, 12, 0.38);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--ink); }
::placeholder { color: var(--placeholder); opacity: 1; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }

.wrap { width: min(var(--max), calc(100% - 2.75rem)); margin-inline: auto; }
.wrap-wide { width: min(var(--max-wide), calc(100% - 2.75rem)); margin-inline: auto; }

/* ── shared header ─────────────────────────────────────────── */
.shell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
  padding-top: 4px;
}
.shell-mark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none !important;
  color: var(--ink);
}
.shell-mark b {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.shell-mark span {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.shell-actions {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.shell-link {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  text-decoration: none !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 6px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.shell-link:hover { color: var(--ink); }
.shell-link.is-cta {
  background: var(--ink);
  color: var(--paper) !important;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
}
.shell-link.is-cta:hover { opacity: 0.92; }
.theme-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex: none;
}
.theme-btn:hover { color: var(--ink); border-color: var(--dim); background: var(--card); }

/* ── type ──────────────────────────────────────────────────── */
.kicker, .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 14px;
  font-weight: 600;
}
h1, .lede {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 5.2vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  color: var(--ink);
}
h1 em, .lede em { font-style: italic; color: var(--dim); }
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
  padding-top: 8px;
  color: var(--ink);
}
.sub, .lede-p {
  color: var(--dim);
  font-size: 1.02rem;
  max-width: 48ch;
  margin: 0 0 22px;
}
.muted { color: var(--dim); }

/* horizontal scroll guard for wide tables on mobile */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 520px; }

/* ── buttons ───────────────────────────────────────────────── */
.btn, a.btn, button.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover { border-color: var(--dim); background: color-mix(in srgb, var(--card) 80%, var(--ink) 4%); }
.btn-primary, a.btn-primary, button.btn-primary {
  background: var(--ink);
  color: var(--paper) !important;
  border-color: var(--ink);
}
.btn-primary:hover { opacity: 0.92; }
.btn-accent, a.btn-accent {
  background: var(--accent);
  color: var(--accent-ink) !important;
  border-color: var(--accent);
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 8px;
}

/* ── surfaces ──────────────────────────────────────────────── */
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px 18px;
  color: var(--ink);
}
.chip {
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 500;
}

/* FAQ details */
details.qa {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 2px;
  padding: 0;
  margin: 10px 0;
}
details.qa summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--ink);
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--mono);
  color: var(--dim);
  font-weight: 600;
}
details.qa[open] summary::after { content: "–"; }
details.qa .qa-body {
  color: var(--dim);
  margin: 0;
  padding: 0 16px 16px;
  line-height: 1.55;
  font-size: 14.5px;
}
details.qa .qa-body a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
details.qa .qa-body a:hover { color: var(--accent); }

/* steps */
.steps { display: grid; gap: 10px; margin: 18px 0 8px; }
.step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 16px 18px;
  border-radius: 2px;
  align-items: start;
}
.step b {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 0.06em;
  font-weight: 700;
}
.step h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.step p { margin: 0; color: var(--dim); font-size: 14.5px; }

/* matrix table */
.matrix {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13.5px;
  color: var(--ink);
}
.matrix th, .matrix td {
  border: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}
.matrix th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  background: var(--card);
  font-weight: 700;
}
.matrix td.yes { color: var(--ok); font-weight: 600; }
.matrix td.no { color: var(--risk); font-weight: 600; }
.matrix td.mid { color: var(--watch); font-weight: 600; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .step { grid-template-columns: 36px 1fr; gap: 10px; padding: 14px; }
  .shell-actions .shell-link:not(.is-cta):not(.keep) { display: none; }
  .shell-actions .shell-link.keep { display: inline-flex; }
}

/* footer — dim not faint so links stay readable */
.shell-foot {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding: 20px 0 48px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  line-height: 1.7;
}
.shell-foot a {
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
.shell-foot a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* kill legacy degen grid if class remains */
.pfb-grid-bg::before { display: none !important; }

/* ════════════════════════════════════════════════════════════
   MOBILE SYSTEM — all product pages that load pfb-brand.css
   Touch ≥44px · safe-area · type scale · no horizontal bleed
   ════════════════════════════════════════════════════════════ */
html { overflow-x: clip; }
body { overflow-x: clip; }

@media (max-width: 720px) {
  .wrap,
  .wrap-wide {
    width: min(100%, calc(100% - 1.5rem));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .wrap[style*="padding"],
  .wrap-wide[style*="padding"] {
    /* keep author top padding; ensure side breathing room via width */
  }

  .shell-top {
    margin-bottom: 28px;
    gap: 10px;
    align-items: flex-start;
  }
  .shell-mark b { font-size: 13px; }
  .shell-mark span { font-size: 10px; letter-spacing: 0.1em; }
  .shell-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .shell-link {
    min-height: 44px;
    padding: 10px 10px;
    font-size: 11px;
  }
  .shell-link.is-cta {
    padding: 11px 14px;
    min-height: 44px;
  }
  .theme-btn {
    width: 44px;
    height: 44px;
    flex: none;
  }

  h1, .lede {
    font-size: clamp(1.75rem, 8.5vw, 2.35rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  h2 {
    font-size: clamp(1.25rem, 5.5vw, 1.55rem);
    margin-top: 28px;
  }
  .sub, .lede-p {
    font-size: 0.98rem;
    max-width: none;
    margin-bottom: 18px;
  }
  .kicker, .eyebrow {
    font-size: 10px;
    margin-bottom: 10px;
  }

  .btn, a.btn, button.btn {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 11px;
    flex: 1 1 auto;
  }
  .cta-row {
    gap: 8px;
    margin: 20px 0 8px;
  }
  .cta-row .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .card, .panel {
    padding: 14px 14px;
  }
  details.qa summary {
    min-height: 52px;
    padding: 14px 14px;
    font-size: 14.5px;
    gap: 10px;
  }
  details.qa .qa-body {
    padding: 0 14px 16px;
    font-size: 14px;
  }

  .table-scroll {
    margin-left: -2px;
    margin-right: -2px;
    padding-bottom: 4px;
  }
  .table-scroll table,
  .matrix {
    min-width: 480px;
    font-size: 12.5px;
  }
  .matrix th, .matrix td {
    padding: 10px 8px;
  }

  .shell-foot {
    margin-top: 40px;
    padding: 16px 0 calc(28px + env(safe-area-inset-bottom, 0px));
    font-size: 11px;
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .wrap, .wrap-wide {
    width: min(100%, calc(100% - 1.1rem));
  }
  h1, .lede {
    font-size: clamp(1.55rem, 9vw, 1.95rem);
  }
  .cta-row .btn {
    flex: 1 1 100%;
  }
  .shell-actions .shell-link.keep:not(.is-cta) {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 10px;
  }
}

/* ── money CTAs (volume packs + buy) ─────────────────────────── */
.money-rail {
  position: sticky;
  bottom: 0;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.money-rail a {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none !important;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.money-rail a.hot {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.money-rail a.buy {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.money-rail .hint {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.04em;
  width: 100%;
  text-align: center;
}
@media (min-width: 720px) {
  .money-rail .hint { width: auto; margin-right: 8px; }
}

.cta-grid {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .cta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.cta-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
}
.cta-card:hover { border-color: var(--dim); }
.cta-card .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.cta-card strong {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
}
.cta-card span { font-size: 13px; color: var(--dim); line-height: 1.4; flex: 1; }
.cta-card em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

/* iOS tap highlight + form zoom guard for pages using brand inputs */
@media (pointer: coarse) {
  a, button, .btn, .shell-link, summary {
    -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 22%, transparent);
  }
  input, textarea, select {
    font-size: 16px !important; /* prevent iOS zoom */
  }
}
