/** Long-scroll Foundations + Components + Examples sections.
 *  These follow the structure of the source repo's showcase sections. */

function FoundationsSection() {
  return (
    <section className="section">
      <BrSectionHead
        idx="01"
        eyebrow="FOUNDATIONS"
        title="The building blocks."
        lede="Three variants, one accent, one ethos. Color, type, elevation — calibrated so the system holds together at every density."
      />
      <div className="container-br">
        <div className="specimen-grid">
          {[
            { name: 'Fire',       hex: '#E74011', mood: 'BR signature' },
            { name: 'Terracotta', hex: '#C8462A', mood: 'Stonowane' },
            { name: 'Cognac',     hex: '#8C5A2C', mood: 'Warm bronze' },
            { name: 'Slate',      hex: '#3A3833', mood: 'Mono elegance' },
          ].map(s => (
            <div key={s.hex} className="swatch-card">
              <div className="swatch-block" style={{ background: s.hex }} />
              <div>
                <div style={{ fontFamily: 'var(--font-display)', fontSize: 18, fontWeight: 500 }}>{s.name}</div>
                <div className="mono" style={{ color: 'var(--text-subtle)' }}>{s.hex} · {s.mood}</div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function ButtonsSection() {
  return (
    <section className="section">
      <BrSectionHead
        idx="02"
        eyebrow="COMPONENTS · BUTTONS"
        title="Five intents."
        lede="One primary per screen — the accent. Everything else is ink, ghost, quiet, or danger."
      />
      <div className="container-br">
        <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', marginBottom: 18 }}>
          <BrButton variant="primary" iconRight={<L name="arrow-right" size={14} />}>Sign in</BrButton>
          <BrButton variant="ink">Read more</BrButton>
          <BrButton variant="ghost" icon={<L name="filter" size={14} />}>Filter</BrButton>
          <BrButton variant="quiet">Forgot password?</BrButton>
          <BrButton variant="danger">Delete</BrButton>
        </div>
        <div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
          <BrButton variant="primary" size="sm">Small · 30px</BrButton>
          <BrButton variant="primary">Default · 38px</BrButton>
          <BrButton variant="primary" size="lg">Large · 48px</BrButton>
          <BrButton variant="primary" size="sm" icon={<L name="plus" size={12} />} />
          <BrButton variant="ghost" icon={<L name="bell" size={14} />} />
        </div>
      </div>
    </section>
  );
}

function CardsSection() {
  return (
    <section className="section">
      <BrSectionHead
        idx="03"
        eyebrow="COMPONENTS · CARDS"
        title="Three card families."
        lede="Card — neutral content. StatCard — KPI with sparkline. CaseCard — portfolio plate."
      />
      <div className="container-br">
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 18 }}>
          <BrStatCard label="Q4 · Revenue"  value="€ 12.4k" trend="14.2%" spark={[8, 12, 10, 18, 15, 22, 19, 26, 24, 28]} />
          <BrStatCard label="Active cases"  value="07"      trend="2"    spark={[10, 11, 14, 13, 16, 18, 17, 20, 22, 21]} />
          <BrStatCard label="Burn rate"     value="-3.1%"   trend="0.6%" spark={[22, 20, 22, 19, 18, 16, 17, 14, 15, 12]} />
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 18, marginTop: 18 }}>
          <BrCaseCard year="2026" days="12" title="Process audit"
            desc="Three weeks. One ICP. Bottlenecks identified and shipped."
            tags={['ops','audit','ai']} />
          <BrCaseCard year="2025" days="42" title="RetailGap v2"
            desc="Price-arbitrage detection across 4 retailers."
            tags={['data','retail']} />
          <BrCaseCard year="2025" days="28" title="Meso delivery"
            desc="POS + delivery orchestration for a smart-asian comfort brand."
            tags={['pos','fulfillment']} />
        </div>
      </div>
    </section>
  );
}

function FormsSection() {
  return (
    <section className="section">
      <BrSectionHead
        idx="04"
        eyebrow="COMPONENTS · FORMS"
        title="Quiet fields."
        lede="40px hairline. Eyebrow labels above. Accent halo on focus — that's the entire interaction language."
      />
      <div className="container-br" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 32 }}>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
          <BrField label="EMAIL" placeholder="you@studio.com" icon="mail" />
          <BrField label="PASSWORD" type="password" value="••••••••" affix="⌘↩" focusedStart />
          <BrField label="HOURLY RATE" affix="€/h" placeholder="240" />
          <div style={{ display: 'flex', gap: 12, marginTop: 4 }}>
            <BrButton variant="primary" iconRight={<L name="arrow-right" size={14} />}>Sign in</BrButton>
            <BrButton variant="quiet">Forgot password?</BrButton>
          </div>
        </div>
        <BrCard eyebrow="ANATOMY" title="Hairline + halo.">
          <p style={{ margin: 0 }}>
            Border is a hairline (8% opacity). On focus, the border darkens to <code style={{ fontFamily: 'var(--font-mono)', color: 'var(--accent)' }}>var(--accent)</code> and a 14% accent halo blooms (<code style={{ fontFamily: 'var(--font-mono)' }}>0 0 0 3px var(--accent-soft)</code>). That single signal stands in for hover, focus, success.
          </p>
          <p style={{ margin: '12px 0 0' }}>
            Icon left in a 38px column. Suffix on the right in <code style={{ fontFamily: 'var(--font-mono)' }}>--font-mono</code> on the <code style={{ fontFamily: 'var(--font-mono)' }}>--surface-3</code> chip.
          </p>
        </BrCard>
      </div>
    </section>
  );
}

function ExamplesSection() {
  return (
    <section className="section">
      <BrSectionHead
        idx="05"
        eyebrow="EXAMPLES · DASHBOARD"
        title="A workspace, composed."
        lede="Sidebar + topbar + page header + four stat cards + a table — the system's full vocabulary in one screen."
      />
      <div className="container-br">
        <div className="glass-card" style={{ padding: 0, overflow: 'hidden' }}>
          <div style={{ display: 'flex', minHeight: 520 }}>
            <div style={{ padding: 16, paddingRight: 0 }}>
              <BrSidebar active="cases" />
            </div>
            <div style={{ flex: 1, padding: 24 }}>
              {/* Page head */}
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 24 }}>
                <div>
                  <div style={{
                    fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '.14em',
                    textTransform: 'uppercase', color: 'var(--text-subtle)', marginBottom: 6,
                  }}>Q4 · 2026 · Edition 01</div>
                  <h3 style={{
                    fontFamily: 'var(--font-display)', fontSize: 38, fontWeight: 500,
                    margin: 0, letterSpacing: '-.024em', lineHeight: 1.02,
                  }}>Cases <em style={{ fontStyle: 'normal', color: 'var(--accent)' }}>· active.</em></h3>
                  <p style={{ fontSize: 14, color: 'var(--text-muted)', margin: '8px 0 0', maxWidth: 480 }}>
                    Seven open engagements. Two shipped this week.
                  </p>
                </div>
                <div style={{ display: 'flex', gap: 8 }}>
                  <BrButton variant="ghost" size="sm" icon={<L name="filter" size={13} />}>Filter</BrButton>
                  <BrButton variant="primary" size="sm" icon={<L name="plus" size={13} />}>New case</BrButton>
                </div>
              </div>

              {/* Stats row */}
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 12, marginBottom: 24 }}>
                <BrStatCard label="REVENUE" value="€ 12.4k" trend="14.2%" spark={[8, 12, 10, 18, 15, 22, 24, 28]} />
                <BrStatCard label="ACTIVE"  value="07"      trend="2"    spark={[10, 11, 14, 13, 16, 18, 20, 22]} />
                <BrStatCard label="SHIPPED" value="23"      trend="3"    spark={[6, 9, 12, 14, 16, 19, 22, 25]} />
                <BrStatCard label="HOURS"   value="148"     trend="6%"   spark={[14, 16, 15, 18, 17, 20, 21, 24]} />
              </div>

              {/* Table */}
              <div className="glass-card" style={{ padding: 0, overflow: 'hidden' }}>
                <table className="table">
                  <thead>
                    <tr>
                      <th>Case</th><th>Client</th><th>Status</th>
                      <th className="num">Days</th><th className="num">Hours</th><th className="num">Amount</th>
                    </tr>
                  </thead>
                  <tbody>
                    {[
                      { case: 'Process audit',   client: 'RetailGap',     status: 'active',  days: 12, hours:  42, amount: '€ 3,200' },
                      { case: 'AI implementation', client: 'Med4You',     status: 'review',  days:  6, hours:  18, amount: '€ 2,100' },
                      { case: 'Brand voice',     client: 'Stylista AI',   status: 'active',  days: 23, hours:  84, amount: '€ 5,600' },
                      { case: 'Dashboard build', client: 'Damen Shipping',status: 'shipped', days: 47, hours: 162, amount: '€ 9,400' },
                    ].map(r => (
                      <tr key={r.case}>
                        <td>
                          <div className="row-flex">
                            <div className="avatar-sm">{r.client[0]}</div>
                            <div>
                              <div style={{ fontWeight: 500 }}>{r.case}</div>
                              <div className="mono" style={{ color: 'var(--text-subtle)' }}>case · 2026</div>
                            </div>
                          </div>
                        </td>
                        <td>{r.client}</td>
                        <td>
                          {r.status === 'active'  && <BrBadge variant="accent" dot>active</BrBadge>}
                          {r.status === 'review'  && <BrBadge dot>review</BrBadge>}
                          {r.status === 'shipped' && <BrBadge variant="success" dot>shipped</BrBadge>}
                        </td>
                        <td className="num">{r.days}</td>
                        <td className="num">{r.hours}</td>
                        <td className="num">{r.amount}</td>
                      </tr>
                    ))}
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function ColophonSection() {
  return (
    <section className="section" style={{ paddingBottom: 120 }}>
      <BrSectionHead
        idx="06"
        eyebrow="COLOPHON"
        title="Built with quiet conviction."
        lede="One person, one accent, one set of rules. Type by Indian Type Foundry × Tokotype."
      />
      <div className="container-br" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 32 }}>
        <BrBrandCard />
        <BrCard eyebrow="EDITION · 01" title="What's next.">
          <p style={{ margin: 0 }}>The Showcase is the design surface. The next step is publishing the
          <code style={{ fontFamily: 'var(--font-mono)', color: 'var(--accent)' }}> registry/br-ui/* </code>
          items as a hosted shadcn registry, so other projects can install components with one CLI line.</p>
          <p style={{ margin: '12px 0 0' }}>Three variants ship together. One swap, and the entire surface speaks differently.</p>
        </BrCard>
      </div>
    </section>
  );
}
