/* =====================================================================
   piMark design system  ·  dark-first, indigo + electric-cyan, six agents
   Font standard: self-hosted IBM Plex Sans + Mono (shared with piRevenue).
   Layer 1 of 2 — tokens, reset, type, and primitives.
   ===================================================================== */

/* ---------- self-hosted IBM Plex (no CDN dependency) ---------- */
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body, h1, h2, h3, h4, h5, p, ul, ol, li, figure, blockquote, dd, dl { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

/* =====================================================================
   TOKENS — dark is the default (piMark is a command center)
   ===================================================================== */
:root {
  /* surfaces (three-level elevation + hover) — deep purple-navy ground */
  --bg: #0C0A14;
  --bg-2: #100D1C;
  --surface: #15111F;
  --surface-2: #1D1830;
  --hover: #262038;

  /* borders */
  --border: #2A2440;
  --border-subtle: #201B33;
  --border-strong: #3B3358;

  /* text */
  --text: #ECEAF3;
  --text-muted: #A39EB8;
  --text-faint: #6E6889;

  /* brand — Marketing Purple (official) */
  --brand: #8553D3;
  --brand-ink: #B48CF7;         /* text on dark surfaces */
  --brand-hover: #9C63F4;
  --brand-tint: rgba(133,83,211,.18);
  --brand-line: rgba(133,83,211,.42);

  /* accent — Vibrant Violet (official; the logo's second colour) */
  --accent: #A855F7;
  --accent-ink: #C7A2FF;
  --accent-tint: rgba(168,85,247,.14);
  --accent-line: rgba(168,85,247,.34);

  /* supporting official brand colours */
  --pink: #F472B6; --pink-tint: rgba(244,114,182,.14);
  --saffron: #E4901F; --saffron-tint: rgba(228,144,31,.14);
  --sky: #60A5FA;  --sky-tint: rgba(96,165,250,.14);

  /* the six agents — cohesive blue→violet→pink brand spectrum */
  --boss: #60A5FA;      --boss-tint: rgba(96,165,250,.14);
  --analyst: #818CF8;   --analyst-tint: rgba(129,140,248,.14);
  --hustler: #F472B6;   --hustler-tint: rgba(244,114,182,.14);
  --writer: #A855F7;    --writer-tint: rgba(168,85,247,.14);
  --wildcard: #C084FC;  --wildcard-tint: rgba(192,132,252,.14);
  --observer: #F0729B;  --observer-tint: rgba(240,114,155,.14);

  /* semantic status */
  --success: #34D399;  --success-tint: rgba(52,211,153,.14);
  --warning: #F5B23D;  --warning-tint: rgba(245,178,61,.14);
  --danger: #F0729B;   --danger-tint: rgba(240,114,155,.14);
  --info: #60A5FA;     --info-tint: rgba(96,165,250,.14);

  /* effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.28);
  --shadow-md: 0 6px 20px rgba(0,0,0,.36);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.50), 0 0 0 1px rgba(0,0,0,.22);
  --glow-brand: 0 0 40px rgba(133,83,211,.34);
  --glow-accent: 0 0 42px rgba(168,85,247,.30);
  --grid-line: rgba(180,140,247,.05);
  --focus: #B48CF7;
  --on-brand: #FFFFFF;
  --on-accent: #1A0B22;

  /* radius / spacing */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px; --r-full: 9999px;
  --wrap: 1240px; --wrap-wide: 1440px; --read: 720px;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;

  color-scheme: dark;
}

/* ---------- light theme (system preference, unless forced dark) ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FFFFFF; --bg-2: #FBFBFA; --surface: #FBFBFA; --surface-2: #FFFFFF; --hover: #F3F3F1;
    --border: #E4E4E1; --border-subtle: #EDEDEB; --border-strong: #D2D2CE;
    --text: #1B1C1F; --text-muted: #5C616B; --text-faint: #8C909A;
    --brand: #8553D3; --brand-ink: #6D28D9; --brand-hover: #6D28D9;
    --brand-tint: rgba(133,83,211,.10); --brand-line: rgba(133,83,211,.30);
    --accent: #9333EA; --accent-ink: #7E22CE; --accent-tint: rgba(147,51,234,.10); --accent-line: rgba(147,51,234,.28);
    --boss: #2563EB; --analyst: #4F46E5; --hustler: #DB2777; --writer: #8553D3; --wildcard: #9333EA; --observer: #E11D63;
    --success: #059669; --warning: #B45309; --danger: #E11D63; --info: #2563EB;
    --shadow-sm: 0 1px 2px rgba(23,20,35,.06);
    --shadow-md: 0 6px 20px rgba(23,20,35,.08);
    --shadow-lg: 0 20px 48px rgba(23,20,35,.12), 0 0 0 1px rgba(23,20,35,.04);
    --glow-brand: 0 0 40px rgba(133,83,211,.18); --glow-accent: 0 0 42px rgba(147,51,234,.16);
    --grid-line: rgba(133,83,211,.06); --focus: #8553D3; --on-brand: #FFFFFF; --on-accent: #FFFFFF;
    color-scheme: light;
  }
}
/* forced light */
:root[data-theme="light"] {
  --bg: #FFFFFF; --bg-2: #FBFBFA; --surface: #FBFBFA; --surface-2: #FFFFFF; --hover: #F3F3F1;
  --border: #E4E4E1; --border-subtle: #EDEDEB; --border-strong: #D2D2CE;
  --text: #1B1C1F; --text-muted: #5C616B; --text-faint: #8C909A;
  --brand: #8553D3; --brand-ink: #6D28D9; --brand-hover: #6D28D9;
  --brand-tint: rgba(133,83,211,.10); --brand-line: rgba(133,83,211,.30);
  --accent: #9333EA; --accent-ink: #7E22CE; --accent-tint: rgba(147,51,234,.10); --accent-line: rgba(147,51,234,.28);
  --boss: #2563EB; --analyst: #4F46E5; --hustler: #DB2777; --writer: #8553D3; --wildcard: #9333EA; --observer: #E11D63;
  --success: #059669; --warning: #B45309; --danger: #E11D63; --info: #2563EB;
  --shadow-sm: 0 1px 2px rgba(23,20,35,.06);
  --shadow-md: 0 6px 20px rgba(23,20,35,.08);
  --shadow-lg: 0 20px 48px rgba(23,20,35,.12), 0 0 0 1px rgba(23,20,35,.04);
  --glow-brand: 0 0 40px rgba(133,83,211,.18); --glow-accent: 0 0 42px rgba(147,51,234,.16);
  --grid-line: rgba(133,83,211,.06); --focus: #8553D3; --on-brand: #FFFFFF; --on-accent: #FFFFFF;
  color-scheme: light;
}
/* forced dark (toggle wins over light system pref) */
:root[data-theme="dark"] { color-scheme: dark; }

/* =====================================================================
   BASE
   ===================================================================== */
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--brand-tint); color: var(--text); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

/* =====================================================================
   TYPOGRAPHY
   ===================================================================== */
h1, h2, h3, h4 { line-height: 1.12; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; color: var(--text); }
h1 { font-size: clamp(2.35rem, 5.6vw, 4rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); letter-spacing: -.03em; }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); }
h4 { font-size: 1.05rem; }
p { text-wrap: pretty; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent);
}
.eyebrow.no-rule::before { display: none; }

.lede { font-size: clamp(1.05rem, 1.7vw, 1.28rem); color: var(--text-muted); line-height: 1.6; max-width: 40ch; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

.gradient-text {
  background: linear-gradient(100deg, var(--text) 30%, var(--brand-ink) 62%, var(--accent-ink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* =====================================================================
   LAYOUT PRIMITIVES
   ===================================================================== */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.4rem); }
.wrap-wide { max-width: var(--wrap-wide); }
.wrap-read { max-width: var(--read); }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); position: relative; }
.section-sm { padding-block: clamp(2.4rem, 5vw, 3.6rem); }
.center { text-align: center; }
.center .lede, .center .eyebrow { margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.section-head { max-width: 60ch; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head.center { margin-inline: auto; }
.section-head h2 { margin-top: .6rem; }
.section-head p { margin-top: .9rem; color: var(--text-muted); font-size: 1.08rem; }

.grid { display: grid; gap: clamp(1rem, 2vw, 1.5rem); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  --_bg: var(--surface-2); --_fg: var(--text); --_bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .95rem; line-height: 1;
  padding: .78rem 1.25rem; border-radius: var(--r-sm);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.05em; height: 1.05em; }

.btn-primary { --_bg: var(--brand); --_fg: var(--on-brand); --_bd: transparent; box-shadow: var(--glow-brand); }
.btn-primary:hover { --_bg: var(--brand-hover); box-shadow: 0 0 52px rgba(133,83,211,.44); }

.btn-accent { --_bg: transparent; --_fg: var(--accent-ink); --_bd: var(--accent-line); }
.btn-accent:hover { background: var(--accent-tint); }

.btn-ghost { --_bg: transparent; --_fg: var(--text); --_bd: var(--border-strong); }
.btn-ghost:hover { background: var(--hover); border-color: var(--text-faint); }

.btn-lg { padding: .95rem 1.6rem; font-size: 1rem; }
.btn-sm { padding: .55rem .9rem; font-size: .85rem; }
.btn-block { width: 100%; }

.btn-link { color: var(--brand-ink); font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.btn-link .arr { transition: transform .16s ease; }
.btn-link:hover .arr { transform: translateX(3px); }

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: clamp(1.4rem, 2.4vw, 1.9rem);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.card-hover:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card-raised { background: var(--surface-2); }
.card h3 { font-weight: 600; }
.card .card-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md);
  background: var(--brand-tint); color: var(--brand-ink); margin-bottom: 1rem;
}
.card .card-icon svg { width: 22px; height: 22px; }

.card-link { display: block; }
.card-link:hover { border-color: var(--brand-line); }

/* =====================================================================
   BADGES / PILLS / CHIPS
   ===================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: .68rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; padding: .28rem .6rem; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-live { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-tint); }
.badge-soon { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-tint); }
.badge-new { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-tint); }

.pill {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .45rem .9rem; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.dot-live { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.dot-live::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--success); opacity: .5; animation: ping 2s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot-live::after { animation: none; } }

/* =====================================================================
   AGENT TOKENS — colored monogram avatars + chips
   ===================================================================== */
.agent-avatar {
  width: 40px; height: 40px; border-radius: var(--r-full); display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: .95rem; color: #fff; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.a-boss { background: var(--boss); } .a-analyst { background: var(--analyst); }
.a-hustler { background: var(--hustler); } .a-writer { background: var(--writer); }
.a-wildcard { background: var(--wildcard); } .a-observer { background: var(--observer); }

.agent-chip {
  display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .7rem .3rem .35rem;
  border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--border);
  font-size: .85rem; font-weight: 500;
}
.agent-chip .adot { width: 10px; height: 10px; border-radius: 50%; }

/* =====================================================================
   PROSE (blog / glossary / guides / legal reading column)
   ===================================================================== */
.prose { max-width: var(--read); color: var(--text); font-size: 1.075rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.15rem; }
.prose h2 { font-size: 1.6rem; margin-top: 2.6rem; }
.prose h3 { font-size: 1.25rem; margin-top: 2rem; }
.prose p { color: var(--text); }
.prose a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brand-line); }
.prose a:hover { text-decoration-color: var(--brand-ink); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose li { margin-top: .5rem; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); font-weight: 600; }
.prose blockquote {
  border-left: 3px solid var(--brand); padding: .4rem 0 .4rem 1.25rem; margin-left: 0;
  color: var(--text-muted); font-size: 1.15rem;
}
.prose code {
  font-family: var(--font-mono); font-size: .88em; background: var(--surface-2);
  padding: .15em .4em; border-radius: 4px; border: 1px solid var(--border);
}
.prose figure figcaption { color: var(--text-faint); font-size: .85rem; margin-top: .5rem; text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* callout inside prose */
.callout {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 1.1rem 1.3rem; margin-top: 1.5rem;
}
.callout .callout-label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }

/* =====================================================================
   TABLES (compare / pricing / data)
   ===================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
table.data { font-size: .95rem; }
table.data th, table.data td { padding: .9rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border-subtle); }
table.data thead th { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); background: var(--surface-2); }
table.data tbody tr:hover { background: var(--hover); }
table.data td.yes { color: var(--success); } table.data td.no { color: var(--text-faint); }

/* =====================================================================
   FORMS
   ===================================================================== */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: .8rem 1rem; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.textarea { min-height: 120px; resize: vertical; }
.form-note { font-size: .82rem; color: var(--text-faint); }

/* =====================================================================
   MISC UTILITIES
   ===================================================================== */
.divider { height: 1px; background: var(--border); border: 0; }
.kicker-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.hairline-grid {
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
}
.noise-none { }
.avatar-img { border-radius: var(--r-full); object-fit: cover; }
.tag {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
}

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.16,1,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }
.reveal[data-delay="5"] { transition-delay: .40s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
