/* ============================================================
   v2 skin for the editorial kit (kit.css + kit-detail.css)
   ------------------------------------------------------------
   Every inner page is built from the same editorial components
   (case-hero, chapter, moves, outcomes, proof-shelf, case-quote,
   case-cta…). Instead of rewriting each template, this file
   re-points the kit's design tokens at the v2 palette and
   restyles those components to match the homepage. Load it
   AFTER kit-detail.css and v2.css, on body.brainz-body.v2.
   ============================================================ */

/* ---------- 1. Token remap ---------- */
body.v2 {
  --navy:          var(--bg);
  --navy-light:    var(--bg-2);
  --navy-card:     #101016;
  --navy-border:   var(--line);
  --text-primary:  var(--fg);
  --text-secondary: var(--fg-2);
  --text-muted:    var(--fg-3);
  --text-dim:      var(--fg-3);
  --text-faint:    var(--line-hi);
  --rule:          var(--line);
  --rule-strong:   var(--line-hi);
  --cream-soft:    var(--fg);
  --cream-warm:    #A78BFA;
  --gold-quiet:    #9D7BFF;
  --gold-glow:     #9D7BFF;
  --brand:         #2BA6FF;
  --brand-light:   #5BBAFF;
  --brand-grad:    var(--grad);
  --brainz-gradient: var(--grad);
  --header-bg:     color-mix(in srgb, var(--bg) 78%, transparent);
  --surface-hover: var(--card-hi);
  --surface-faint: var(--card);
  /* Tailwind-layer names used by journey / errors / subscribe form */
  --text-muted-pal: var(--fg-3);
  --rule-color:    var(--line);
  /* The editorial serif + mono become the v2 sans everywhere */
  --font-serif:    "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:     "Inter", system-ui, -apple-system, sans-serif;
  --reading-meas:  44rem;
  --display-meas:  60rem;
  --chapter-pad:   clamp(4.5rem, 9vw, 7.5rem);
  background: var(--bg);
}
html.light body.v2 { --navy-card: #FFFFFF; }
body.v2 code, body.v2 pre, body.v2 kbd { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* Old decorative layers the v2 hero replaces */
body.v2 .brainz-bg-glow, body.v2 .pal-bg-glow { display: none; }

/* Container matches the v2 wrap */
body.v2 .pal-section-inner { max-width: var(--wrap); padding: 0 24px; }

/* Italic serif accents → upright, quieter grey (v2 headline idiom) */
body.v2 :is(.case-hero__pull, .chapter__title, .case-cta__title, .proof-shelf__title, .case-pager__title) em {
  font-style: normal; color: var(--fg-3); font-weight: inherit;
}

/* ---------- 2. Buttons ---------- */
body.v2 .pal-btn-primary,
body.v2 .pal-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px !important;
  border-radius: 10px;
  font: 600 15px/1 "Inter", sans-serif !important;
  letter-spacing: 0; text-transform: none;
  text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
body.v2 .pal-btn-primary {
  background: var(--grad); color: #fff !important; border: 0;
  box-shadow: 0 8px 30px -8px var(--glow-a), inset 0 1px 0 rgba(255,255,255,.25);
}
body.v2 .pal-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 40px -8px var(--glow-a), inset 0 1px 0 rgba(255,255,255,.25); }
body.v2 .pal-btn-secondary {
  background: var(--card); color: var(--fg) !important; border: 1px solid var(--line-hi);
}
body.v2 .pal-btn-secondary:hover { border-color: var(--fg-3); background: var(--card-hi); }

/* ---------- 3. Hero ---------- */
body.v2 .case-hero { padding: 88px 0 56px; isolation: isolate; }
body.v2 .case-hero::before {
  background:
    radial-gradient(40% 60% at 25% 20%, var(--glow-a), transparent 70%),
    radial-gradient(40% 60% at 70% 25%, var(--glow-b), transparent 70%);
  opacity: .85;
}
body.v2 .case-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(55% 60% at 30% 25%, #000 15%, transparent 75%);
  -webkit-mask-image: radial-gradient(55% 60% at 30% 25%, #000 15%, transparent 75%);
  opacity: .5;
}
body.v2 .case-hero__chapter {
  display: inline-flex; gap: 8px; align-items: center;
  margin: 0 0 28px; padding: 6px 14px;
  border: 1px solid var(--line-hi); border-radius: 999px; background: var(--card);
  font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--fg-2);
}
body.v2 .case-hero__chapter::before, body.v2 .case-hero__chapter::after { display: none; }
body.v2 .case-hero__chapter .n { font-style: normal; font-size: 13px; color: var(--fg-3); letter-spacing: 0; }
body.v2 .case-hero__chapter a { color: var(--fg); border-bottom: 0; }
body.v2 .case-hero__pull {
  font-weight: 650; font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.03; letter-spacing: -0.045em;
  margin: 0 0 24px; max-width: 18ch;
}
body.v2 .case-hero__pull .accent {
  font-style: normal; font-weight: inherit;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 .case-hero__signoff { margin-top: 0; gap: 10px 16px; }
body.v2 .case-hero__signoff .name {
  font-weight: 450; font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.55;
  letter-spacing: 0; color: var(--fg-2); max-width: 40rem;
}
body.v2 .case-hero__signoff .meta { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--fg-3); }

/* Meta strip → a single bordered card */
body.v2 .case-meta {
  margin: 48px 0 0;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); overflow: hidden;
}
body.v2 .case-meta__cell,
body.v2 .case-meta__cell:first-child,
body.v2 .case-meta__cell:last-child { padding: 20px 22px; border-right: 1px solid var(--line); }
body.v2 .case-meta__cell:last-child { border-right: 0; }
body.v2 .case-meta__label { font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--fg-3); margin-bottom: 6px; }
body.v2 .case-meta__value,
body.v2 .case-meta__value--mono { font-size: 15.5px; font-weight: 550; letter-spacing: -0.01em; line-height: 1.4; color: var(--fg); }

/* ---------- 4. Eyebrows / overlines → gradient label ---------- */
body.v2 :is(.proof-shelf__overline, .case-cta__overline, .case-signoff__mark, .pal-overline) {
  font-size: 13px; font-weight: 600; letter-spacing: .01em; text-transform: none;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 :is(.proof-shelf__overline, .case-cta__overline)::before,
body.v2 :is(.proof-shelf__overline, .case-cta__overline)::after { display: none; }

/* ---------- 5. Proof shelf → stat card ---------- */
body.v2 .proof-shelf { border: 0; padding: 56px 0 24px; }
body.v2 .proof-shelf__header { margin-bottom: 28px; }
body.v2 .proof-shelf__title { font-style: normal; font-weight: 400; font-size: 1.0625rem; line-height: 1.55; color: var(--fg-2); max-width: 40rem; }
body.v2 .proof-shelf__grid {
  border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden;
}
body.v2 .proof-shelf__cell,
body.v2 .proof-shelf__cell:first-child,
body.v2 .proof-shelf__cell:last-child { padding: 28px 24px; border-right: 1px solid var(--line); }
body.v2 .proof-shelf__cell:last-child { border-right: 0; }
body.v2 .proof-shelf__cell::before { display: none; }
body.v2 .proof-shelf__value { font-weight: 650; font-size: clamp(2rem, 3.6vw, 2.75rem); letter-spacing: -0.04em; }
body.v2 .proof-shelf__value em { font-style: normal; font-weight: 650; }
body.v2 .proof-shelf__label { font-size: 14px; line-height: 1.5; letter-spacing: 0; color: var(--fg-2); max-width: none; }

/* ---------- 6. Chapters → stacked sections with an eyebrow ---------- */
body.v2 .chapter { padding: var(--chapter-pad) 0 0; }
body.v2 .chapter:not(:last-child) { border-bottom: 0; }
body.v2 .chapter__inner { grid-template-columns: 1fr; gap: 14px; max-width: none; }
body.v2 .chapter__rail { position: static; display: flex; align-items: center; gap: 10px; }
body.v2 .chapter__rail-mark {
  margin: 0; font-style: normal; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  min-width: 26px; height: 22px; padding: 0 7px; border-radius: 6px;
  display: inline-grid; place-items: center;
  background: var(--card-hi); border: 1px solid var(--line-hi); color: var(--fg-2);
}
body.v2 .chapter__rail-dash { display: none; }
body.v2 .chapter__rail-label {
  font-size: 13px; font-weight: 600; letter-spacing: .01em; text-transform: none;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 .chapter__body { max-width: none; }
body.v2 .chapter__rail > * { margin: 0; line-height: 1; }
body.v2 .chapter__title {
  font-weight: 650; font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.06; letter-spacing: -0.04em; margin: 0 0 22px; max-width: 22ch;
  text-wrap: balance;
}
body.v2 .chapter p { font-size: 1.0625rem; line-height: 1.7; color: var(--fg-2); }
body.v2 .chapter p em, body.v2 .moves__body em { font-style: normal; color: var(--fg); }
body.v2 .chapter p a, body.v2 .moves__body a, body.v2 .outcomes__body a {
  color: var(--fg); font-weight: 600;
  background-image: var(--grad); background-size: 100% 1px;
}
body.v2 .chapter__body > p:first-of-type::first-letter {
  float: none; font: inherit; color: inherit; margin: 0; letter-spacing: inherit; line-height: inherit;
}

/* Moves → card grid */
body.v2 .moves {
  max-width: none; margin-top: 32px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
body.v2 .moves__item,
body.v2 .moves__item:first-child {
  padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  transition: border-color .2s ease, background .2s ease;
}
body.v2 .moves__item:hover { border-color: var(--line-hi); background: var(--card-hi); }
body.v2 .moves__roman {
  font-style: normal; font-size: 13px; font-weight: 600; letter-spacing: .01em; margin: 0 0 10px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 .moves__lead { font-weight: 650; font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.02em; margin: 0 0 10px; }
body.v2 .moves__body { font-size: 15px; line-height: 1.6; color: var(--fg-2); }

/* Outcomes ledger → bordered list card */
body.v2 .outcomes {
  max-width: none; margin-top: 32px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden;
}
body.v2 .outcomes__item { padding: 20px 24px; gap: 24px; border-bottom: 1px solid var(--line); }
body.v2 .outcomes__item:last-child { border-bottom: 0; }
body.v2 .outcomes__metric {
  font-weight: 650; font-size: 1.5rem; letter-spacing: -0.03em; line-height: 1.15;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 .outcomes__metric em { font-style: normal; -webkit-text-fill-color: var(--fg); color: var(--fg); }
body.v2 .outcomes__body { font-size: 15px; line-height: 1.6; color: var(--fg-2); }

/* ---------- 7. Pull quote → centered card ---------- */
body.v2 .case-quote { padding: var(--chapter-pad) 0 0; border: 0; }
body.v2 .case-quote::before { display: none; }
body.v2 .case-quote > .pal-section-inner {
  max-width: calc(var(--wrap) - 48px);
  padding: 48px 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--card);
}
body.v2 .case-quote__mark {
  font-style: normal; font-weight: 700; font-size: 3.5rem; line-height: .8;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
body.v2 .case-quote__body {
  font-style: normal; font-weight: 550; font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.4; letter-spacing: -0.02em; color: var(--fg);
  max-width: 44rem; margin-left: auto; margin-right: auto;
}
body.v2 .case-quote__body em { font-style: normal; color: var(--fg-3); }
body.v2 .case-quote__rule { background: var(--grad); }
body.v2 .case-quote__attr { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--fg-3); }
body.v2 .case-quote__attr strong { color: var(--fg-2); font-weight: 600; }

/* ---------- 8. Closing CTA → glowing panel ---------- */
body.v2 .case-cta { padding: 120px 0 0; border-top: 0; background: none; }
body.v2 .case-cta > .pal-section-inner {
  max-width: calc(var(--wrap) - 48px);
  padding: 72px 40px; border-radius: 28px; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line-hi); background: var(--bg-2);
}
body.v2 .case-cta > .pal-section-inner::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(50% 80% at 20% 0%, var(--glow-a), transparent 70%),
    radial-gradient(50% 80% at 80% 100%, var(--glow-b), transparent 70%);
}
body.v2 .case-cta__title { font-weight: 650; font-size: clamp(2rem, 4.6vw, 3.5rem); line-height: 1.05; letter-spacing: -0.045em; max-width: 40rem; }
body.v2 .case-cta__sub { font-style: normal; font-weight: 400; font-size: 1.0625rem; line-height: 1.6; color: var(--fg-2); max-width: 36rem; }
body.v2 .case-cta__actions { gap: 12px; }

/* ---------- 9. Small pieces ---------- */
body.v2 .case-stack__item {
  font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--fg-2);
  border: 1px solid var(--line-hi); background: var(--card); border-radius: 999px;
}
body.v2 .case-placeholder { border: 1px dashed var(--line-hi); background: var(--card); border-radius: 12px; }
body.v2 .case-signoff { border-top: 0; }
body.v2 .case-signoff__signed, body.v2 .case-pager__title { font-style: normal; font-weight: 650; letter-spacing: -0.03em; }
body.v2 .case-signoff__by, body.v2 .case-pager__dir { font-size: 13px; letter-spacing: 0; text-transform: none; }
body.v2 .case-pager { border-color: var(--line); }
body.v2 .case-image__frame { border-radius: 16px; border-color: var(--line); }
body.v2 .case-image__caption { font-style: normal; font-size: 13px; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 900px) {
  body.v2 .case-meta__cell:nth-child(2n) { border-right: 0; }
  body.v2 .case-meta__cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  body.v2 .case-meta__cell:nth-child(2n+1),
  body.v2 .case-meta__cell:nth-child(2n) { padding: 18px 20px; }
  body.v2 .proof-shelf__cell:nth-child(2n) { border-right: 0; }
  body.v2 .proof-shelf__cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  body.v2 .proof-shelf__cell:nth-child(odd),
  body.v2 .proof-shelf__cell:nth-child(even) { padding: 22px 20px; }
}
@media (max-width: 680px) {
  body.v2 .case-hero { padding-top: 56px; }
  body.v2 .moves { grid-template-columns: 1fr; }
  body.v2 .outcomes__item { grid-template-columns: 1fr; gap: 8px; }
  body.v2 .case-quote > .pal-section-inner { padding: 36px 22px; }
  body.v2 .case-cta { padding-top: 88px; }
  body.v2 .case-cta > .pal-section-inner { padding: 52px 22px; border-radius: 22px; }
  body.v2 .case-cta__actions > a { flex: 1 1 100%; }
}

/* ---------- 11. Polish ---------- */
/* Draft placeholders ("drop a screenshot here", "to be filled") never ship */
body.v2 .case-placeholder,
body.v2 .case-image:has(.case-image__hint) { display: none; }

/* A soft gradient hairline separates consecutive chapters */
body.v2 .chapter + .chapter > .pal-section-inner::before {
  content: ""; display: block; height: 1px; margin: 0 0 var(--chapter-pad);
  background: linear-gradient(90deg, transparent, var(--line-hi) 20%, var(--line-hi) 80%, transparent);
}
body.v2 .chapter + .chapter { padding-top: 0; }

/* ---------- 12. Founder hero with portrait ---------- */
body.v2 .case-hero--portrait [data-hero] {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 56px; align-items: start;
}
body.v2 .case-hero--portrait [data-hero] > * { grid-column: 1; }
body.v2 .case-hero--portrait .case-hero__chapter { justify-self: start; }
body.v2 .case-hero--portrait .case-hero__portrait {
  grid-column: 2; grid-row: 1 / span 3; margin: 0; position: relative;
}
body.v2 .case-hero--portrait .case-hero__portrait::before {
  content: ""; position: absolute; inset: -18px; z-index: -1; border-radius: 40px;
  background: var(--grad); opacity: .35; filter: blur(40px);
}
body.v2 .case-hero__portrait img {
  display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 28px; border: 1px solid var(--line-hi);
}
body.v2 .case-hero--portrait .case-meta { grid-column: 1 / -1; }
@media (max-width: 860px) {
  body.v2 .case-hero--portrait [data-hero] { grid-template-columns: 1fr; }
  body.v2 .case-hero--portrait .case-hero__portrait { grid-column: 1; grid-row: auto; width: 160px; margin-bottom: 24px; order: -1; }
  body.v2 .case-hero__portrait img { border-radius: 24px; }
}

/* ---------- 13. Hero CTAs ---------- */
body.v2 .case-hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
body.v2 .case-hero--portrait .case-hero__ctas { grid-column: 1; }
@media (max-width: 680px) { body.v2 .case-hero__ctas > a { flex: 1 1 100%; } }

/* ---------- 14. Cursor spotlight on cards (vars set by the header script) ---------- */
body.v2 :is(.v2-product, .v2-case, .v2-tier, .v2-feature, .v2-phase, .moves__item, .pf-card, .v2-card) {
  background-image: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--cyan) 9%, transparent), transparent 60%);
}
body.v2 .v2-tier--featured {
  background:
    radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--cyan) 9%, transparent), transparent 60%) padding-box,
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    var(--grad) border-box;
}

/* ---------- 15. Responsive polish ---------- */
/* Long values (URLs, handles) wrap inside the meta strip instead of overflowing */
body.v2 .case-meta__value, body.v2 .case-meta__value a { overflow-wrap: anywhere; }

/* Portfolio card labels: readable size (were 10.4px) */
body.v2 .pf-card__cat, body.v2 .pf-card__stage { font-size: 11.5px; letter-spacing: .06em; }

/* Buttons may wrap on narrow screens rather than clip long labels (ES/FR/IT) */
@media (max-width: 680px) {
  body.v2 :is(.pal-btn-primary, .pal-btn-secondary) { white-space: normal; text-align: center; line-height: 1.3 !important; padding-top: 12px !important; padding-bottom: 12px !important; height: auto; }
}
