/* ============================================================
   Rapid CRO — Main Stylesheet
   Layer order defines cascade priority (lowest → highest):
   tokens → reset → base → components → layout
   ============================================================ */

@layer tokens, reset, base, components, layout;


/* ============================================================
   TOKENS — Design system single source of truth
   ============================================================ */
@layer tokens {
  :root {
    /* Colors */
    --color-sage:         #f7f7f5;
    --color-canvas:       #ffffff;
    --color-ink:          #0e0f0c;
    --color-body:         #454745;
    --color-mute:         #868685;
    --color-primary:      #9fe870;
    --color-primary-pale:   #e2f6d5;
    --color-ink-deep:       #163300;
    --color-accent-orange:  #ffc091;

    /* Typography */
    --font-display: "Manrope", "Inter", system-ui, sans-serif;
    --font-body:    "Inter", system-ui, sans-serif;

    --text-xs:   12px;
    --text-sm:   13px;
    --text-sm-b: 13.5px;
    --text-base: 14px;
    --text-md:   16px;
    --text-lg:   19px;
    --text-xl:   20px;
    --text-2xl:  22px;
    --text-3xl:  28px;
    --text-4xl:  36px;
    --text-5xl:  40px;
    --text-6xl:  48px;
    --text-7xl:  64px;

    /* Spacing */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-7:  28px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-14: 56px;
    --space-16: 64px;
    --space-18: 72px;
    --space-24: 96px;

    /* Radii */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  24px;
    --radius-full: 9999px;

    /* Max widths */
    --max-content: 760px;
    --max-wide:    1200px;
  }
}


/* ============================================================
   RESET — Minimal, modern
   ============================================================ */
@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html, body {
    background: var(--color-sage);
  }

  img, video, svg {
    display: block;
    max-width: 100%;
  }

  ul, ol { list-style: none; }

  button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
  }

  a { text-decoration: none; color: inherit; }
}


/* ============================================================
   BASE — Body defaults and global type scale
   ============================================================ */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: var(--text-md);
    color: var(--color-ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.025em;
    text-wrap: pretty;
    color: var(--color-ink);
  }

  h2 {
    font-size: var(--text-6xl);
    text-align: center;
  }

  p {
    text-wrap: pretty;
    color: var(--color-body);
  }
}


/* ============================================================
   COMPONENTS — Reusable UI elements (nav, buttons, pills)
   ============================================================ */
@layer components {

  /* ── Navigation ── */
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-14);
    background: var(--color-canvas);
    position: relative;
    z-index: 10;
  }

  .nav__logo {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .nav__logo-mark {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--color-ink);
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .nav__logo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
  }

  .nav__logo-name {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--color-ink);
  }

  .nav__logo-name span {
    color: var(--color-body);
    font-weight: 800;
  }

  .nav__links {
    display: flex;
    gap: var(--space-8);
  }

  .nav__links a {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-ink);
    transition: opacity 0.15s;
  }

  .nav__links a:hover { opacity: 0.6; }

  .nav__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  /* ── Buttons ── */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 600;
    transition: filter 0.15s, opacity 0.15s;
    white-space: nowrap;
  }

  .btn--ghost {
    background: transparent;
    color: var(--color-ink);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
  }

  .btn--ghost:hover { opacity: 0.6; }

  .btn--primary {
    background: var(--color-primary);
    color: var(--color-ink);
    padding: var(--space-3) 22px;
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
  }

  .btn--primary:hover { filter: brightness(0.93); }

  .btn--cta {
    background: var(--color-primary);
    color: var(--color-ink);
    padding: 18px 28px;
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    font-weight: 700;
    letter-spacing: -0.005em;
  }

  .btn--cta:hover { filter: brightness(0.93); }

  /* ── Pill / badge ── */
  .pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--color-canvas);
    color: var(--color-ink);
    padding: var(--space-2) 14px var(--space-2) 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
  }

  .pill__icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary-pale);
    color: var(--color-ink-deep);
    display: grid;
    place-items: center;
    font-size: var(--text-xs);
    font-weight: 800;
    flex-shrink: 0;
  }

  /* ── Trust row ── */
  .trust-row {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--color-body);
    font-size: var(--text-sm-b);
    font-weight: 500;
    flex-wrap: wrap;
  }

  .trust-row__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
  }

  .trust-row__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
  }

  .trust-row__sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-mute);
  }

  /* ── Highlight chip (inline text accent) ── */
  .highlight {
    background: var(--color-primary);
    padding: 0 10px;
    border-radius: var(--radius-md);
    display: inline-block;
    line-height: 1.05;
  }

  /* ── Timeline rows (pill + description, divided) ── */
  .timeline-rows {
    display: flex;
    flex-direction: column;
  }

  .timeline-rows__item {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-5) 0;
    border-bottom: 1px solid rgba(14, 15, 12, 0.1);
  }

  .timeline-rows__item:first-child {
    border-top: 1px solid rgba(14, 15, 12, 0.1);
  }

  .timeline-rows__pill {
    background: var(--color-primary);
    color: var(--color-ink-deep);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-base);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    white-space: nowrap;
    min-width: 84px;
    text-align: center;
    flex-shrink: 0;
  }

  .timeline-rows__desc {
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--color-ink);
    line-height: 1.4;
  }

  /* ── Insight list ── */
  .insight-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .insight-list__item {
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: start;
    column-gap: var(--space-4);
  }

  .insight-list__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    display: grid;
    place-items: center;
    margin-top: 3px;
    color: var(--color-ink);
    font-weight: 900;
    font-size: var(--text-base);
    font-family: var(--font-display);
    flex-shrink: 0;
  }

  .insight-list__icon--neg {
    background: var(--color-accent-orange);
  }

  .insight-list__text {
    font-size: 21px;
    line-height: 1.45;
    color: var(--color-ink);
    font-weight: 500;
  }
}


/* ============================================================
   LAYOUT — Section scaffolding, hero, page sections
   ============================================================ */
@layer layout {

  /* ── Shared section shell ── */
  .section {
    padding: var(--space-24) var(--space-6) var(--space-16);
    background: var(--color-sage);
  }

  .section__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  /* ── Hero ── */
  .hero {
    background: var(--color-sage);
    padding: var(--space-18) var(--space-6) var(--space-8);
    display: flex;
    flex-direction: column;
  }

  .hero__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .hero__pill {
    margin-bottom: var(--space-7);
    align-self: flex-start;
  }

  .hero__h1 {
    font-size: var(--text-7xl);
    line-height: 0.96;
    color: var(--color-ink);
  }

  .hero__h1 .dim { color: var(--color-body); }

  .hero__h2 {
    font-size: var(--text-5xl);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-7);
  }

  .hero__sub {
    font-size: var(--text-lg);
    line-height: 1.5;
    color: var(--color-body);
    font-weight: 400;
    margin-top: var(--space-8) ;
    margin-bottom: var(--space-7);
  }

  .hero__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
    flex-wrap: wrap;
  }

  .hero__trust {
    margin-top: 22px;
  }

  /* ── Broken Industry section ── */
  .broken {
    background: var(--color-sage);
    padding: var(--space-12) var(--space-6) var(--space-16);
  }

  /* ── Admit / Dark section ── */
  .admit {
    background: var(--color-ink);
    padding: var(--space-12) var(--space-6) var(--space-16);
  }

  .admit__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  .admit__h2 {
    color: var(--color-primary);
    line-height: 1.0;
    text-wrap: pretty;
  }

  .admit__continuation {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.6);
    margin-top: var(--space-5);
  }

  .admit__list {
    margin-top: var(--space-7);
  }

  .admit .insight-list__text {
    color: rgba(255, 255, 255, 0.85);
  }

  .admit__punch-pair {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    margin-top: var(--space-10);
  }

  .admit__punch {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-3xl);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-canvas);
    text-wrap: balance;
  }

  .admit__closing {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.6);
    margin-top: var(--space-10);
  }

  .broken__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  .broken__lead {
    line-height: 1.0;
    text-wrap: pretty;
  }

  .broken__sub-lead {
    font-size: var(--text-2xl);
    line-height: 1.5;
    color: var(--color-body);
    font-weight: 400;
    margin-top: var(--space-7);
  }

  .broken__para {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: var(--color-body);
    margin-top: var(--space-6);
  }

  .broken__punch {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-3xl);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-10);
    text-wrap: balance;
  }

  .broken__h2 {
    line-height: 1.1;
    margin-top: var(--space-14);
  }

  .broken__h2-continuation {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: var(--color-body);
    margin-top: var(--space-5);
  }

  .broken__list {
    margin-top: var(--space-7);
  }

  .broken__punch-pair {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    margin-top: var(--space-10);
  }

  .broken__punch-pair .broken__punch {
    margin-top: 0;
  }

  .broken__closing {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: var(--color-body);
    margin-top: var(--space-10);
  }

  /* ── Pivot / That's Why We Built Rapid CRO ── */
  .pivot {
    background: var(--color-sage);
    padding: var(--space-12) var(--space-6) var(--space-16);
  }

  .pivot__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  .pivot__lead {
    line-height: 1.0;
    text-wrap: pretty;
  }

  .pivot__sub-lead {
    font-size: var(--text-2xl);
    line-height: 1.5;
    color: var(--color-body);
    font-weight: 400;
    margin-top: var(--space-7);
  }

  .pivot__para {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: var(--color-body);
    margin-top: var(--space-6);
  }

  .pivot__punch {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-3xl);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-10);
    text-wrap: balance;
  }

  .pivot__list {
    margin-top: var(--space-7);
  }

  .pivot__cta {
    display: flex;
    justify-content: center;
    margin-top: var(--space-10);
  }

  /* ── Foundation / Desire-First ── */
  .foundation {
    background: var(--color-sage);
    padding: var(--space-8) var(--space-6) var(--space-16);
  }

  .foundation__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  .foundation__lead {
    line-height: 1.0;
    text-wrap: pretty;
    margin-bottom: var(--space-8);
  }

  .foundation__para {
    font-size: var(--text-xl);
    line-height: 1.55;
    color: var(--color-body);
    margin-top: var(--space-6);
  }

  .foundation__table-head {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-14);
    margin-bottom: var(--space-6);
  }

  .compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-canvas);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .compare-table__th {
    padding: var(--space-5) var(--space-6);
    text-align: left;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-base);
    letter-spacing: -0.01em;
  }

  .compare-table__th--typical {
    background: var(--color-canvas);
    color: var(--color-body);
    width: 50%;
    border-bottom: 1px solid rgba(14, 15, 12, 0.1);
  }

  .compare-table__th--rapid {
    background: var(--color-primary);
    color: var(--color-ink-deep);
  }

  .compare-table__subhead {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(22, 51, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
  }

  .compare-table tbody tr {
    border-top: 1px solid rgba(14, 15, 12, 0.08);
  }

  .compare-table tbody td {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-md);
    line-height: 1.5;
  }

  .compare-table tbody td:first-child {
    color: var(--color-mute);
    font-weight: 500;
    background: var(--color-canvas);
  }

  .compare-table tbody td:last-child {
    color: var(--color-ink);
    font-weight: 600;
    background: var(--color-canvas);
    border-left: 1px solid rgba(14, 15, 12, 0.08);
  }

  .foundation__punch {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-3xl);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-14);
    text-wrap: balance;
  }

  .foundation__question {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-2xl);
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-top: var(--space-6);
  }

  .foundation__question em {
    font-style: italic;
    color: var(--color-body);
  }

  /* ── Responsive ── */
  @media (max-width: 768px) {
    .nav {
      padding: var(--space-4) var(--space-6);
    }

    .nav__links {
      display: none;
    }

    /* Hero — display-md (40px) is the spec's section headline ceiling */
    .hero__h1        { font-size: var(--text-5xl); }   /* 64 → 40px */
    .hero__h2        { font-size: var(--text-3xl); }   /* 40 → 28px */

    /* Section H2s */
    h2,
    .broken__lead,
    .pivot__lead,
    .foundation__lead,
    .admit__h2       { font-size: var(--text-4xl); }   /* 48 → 36px */

    /* H3 punches — must target classes, bare h3 loses to these */
    .broken__punch,
    .pivot__punch,
    .admit__punch,
    .foundation__punch { font-size: var(--text-xl); }  /* 28 → 20px */

    .insight-list__text { font-size: var(--text-md); }
  }

  @media (max-width: 480px) {
    .hero__h1        { font-size: var(--text-4xl); }   /* 40 → 36px */
    .hero__h2        { font-size: var(--text-2xl); }   /* 28 → 22px */

    h2,
    .broken__lead,
    .pivot__lead,
    .foundation__lead,
    .admit__h2       { font-size: var(--text-3xl); }   /* 36 → 28px */

    .broken__punch,
    .pivot__punch,
    .admit__punch,
    .foundation__punch { font-size: var(--text-lg); }  /* 20 → 19px */

    .btn--cta {
      font-size: var(--text-base);
      padding: var(--space-4) 22px;
    }
  }
}
