// Home-page teaser sections — small previews linking out to full pages.

function SkillsTeaser() {
  // First 3 from TENTACLES — same card style as the full Skills page but lighter
  const featured = TENTACLES.slice(0, 3);
  return (
    <section className="skills-teaser" id="capabilities">
      <div className="container">
        <header className="teaser-head">
          <div>
            <div className="eyebrow">Capabilities</div>
            <h2>
              One coworker.<br/>
              <em>Every kind of work.</em>
            </h2>
          </div>
          <a className="teaser-cta" href="Capabilities.html">
            See all 23 capabilities {Icons.arrow({ width: 14, height: 14 })}
          </a>
        </header>

        <div className="skills-teaser-grid">
          {featured.map((t, i) => (
            <a className="st-card" key={t.id} href="Capabilities.html">
              <div className="st-card-meta">
                <div className="st-card-icon">
                  {Icons[t.icon]({ width: 22, height: 22 })}
                </div>
                <div className="st-num">{String(i + 1).padStart(2, '0')}</div>
              </div>
              <div className="st-body">
                <div className="st-tag">{t.label}</div>
                <h3 className="st-headline">{t.one}</h3>
                <p className="st-deep">{t.deep}</p>
              </div>
              <div className="st-foot">
                <span>Learn more</span>
                {Icons.arrow({ width: 14, height: 14 })}
              </div>
            </a>
          ))}
        </div>
      </div>

      <style>{`
        .skills-teaser {
          padding: 120px 0;
          border-top: 1px solid var(--border);
        }
        .teaser-head {
          display: flex;
          justify-content: space-between;
          align-items: flex-end;
          gap: 24px;
          margin-bottom: 48px;
          flex-wrap: wrap;
        }
        .teaser-head h2 {
          font-size: clamp(2.2rem, 4vw, 3.4rem);
          line-height: 1.0;
          letter-spacing: -0.04em;
          margin-top: 12px;
        }
        .teaser-head h2 em {
          font-style: normal;
          color: var(--accent-light);
        }
        .teaser-cta {
          display: inline-flex;
          align-items: center;
          gap: 10px;
          font-family: var(--font-mono);
          font-size: 13px;
          letter-spacing: 0.05em;
          color: var(--text-secondary);
          padding: 12px 18px;
          border: 1px solid var(--border-light);
          border-radius: 999px;
          white-space: nowrap;
          transition: color 200ms var(--ease-out), border-color 200ms var(--ease-out), background 200ms var(--ease-out);
        }
        .teaser-cta:hover {
          color: var(--accent-light);
          border-color: var(--accent-tint-50);
          background: var(--accent-soft);
        }

        .skills-teaser-grid {
          display: grid;
          grid-template-columns: repeat(3, 1fr);
          gap: 1px;
          background: var(--border);
          border: 1px solid var(--border);
          border-radius: 16px;
          overflow: hidden;
        }
        @media (max-width: 760px) { .skills-teaser-grid { grid-template-columns: 1fr; } }

        .st-card {
          padding: 32px 28px 26px;
          background: var(--bg);
          transition: background 240ms var(--ease-out);
          display: flex;
          flex-direction: column;
          gap: 24px;
          color: inherit;
          position: relative;
        }
        .st-card:hover { background: var(--bg-card); }
        .st-card::after {
          content: "";
          position: absolute;
          left: 0; right: 0; bottom: 0;
          height: 2px;
          background: var(--accent);
          transform: scaleX(0);
          transform-origin: left;
          transition: transform 320ms var(--ease-out);
        }
        .st-card:hover::after { transform: scaleX(1); }

        .st-card-meta {
          display: flex; justify-content: space-between; align-items: center;
        }
        .st-card-icon {
          width: 44px; height: 44px;
          border-radius: 10px;
          background: var(--accent-soft);
          color: var(--accent-light);
          display: flex; align-items: center; justify-content: center;
          border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent);
        }
        .st-num {
          font-family: var(--font-mono);
          font-size: 11px;
          color: var(--text-muted);
          letter-spacing: 0.18em;
        }
        .st-body { flex: 1; }
        .st-tag {
          font-family: var(--font-mono);
          font-size: 11px;
          font-weight: 500;
          letter-spacing: 0.2em;
          text-transform: uppercase;
          color: var(--accent-light);
          margin-bottom: 12px;
        }
        .st-headline {
          font-size: 22px;
          font-weight: 700;
          letter-spacing: -0.025em;
          line-height: 1.2;
          margin-bottom: 12px;
        }
        .st-deep {
          font-size: 14.5px;
          line-height: 1.6;
          color: var(--text-secondary);
        }
        .st-foot {
          display: inline-flex;
          align-items: center;
          gap: 8px;
          font-family: var(--font-mono);
          font-size: 11.5px;
          letter-spacing: 0.1em;
          color: var(--text-muted);
          text-transform: uppercase;
          transition: color 200ms var(--ease-out);
          white-space: nowrap;
        }
        .st-card:hover .st-foot { color: var(--accent-light); }
      `}</style>
    </section>
  );
}

function StoriesTeaser() {
  // Featured: Ana (story 04 — $240K grant, programme lead)
  const featured = STORIES.find((s) => s.n === '04') || STORIES[0];
  const supporting = STORIES.filter((s) => s.n !== featured.n).slice(0, 3);

  return (
    <section className="stories-teaser">
      <div className="container">
        {/* Featured spotlight — editorial pull-quote */}
        <article className="spotlight">
          <div className="spotlight-rule">
            <span className="eyebrow">Field story · {featured.n} / 06</span>
            <span className="spotlight-line" />
            <a className="spotlight-skip" href="Stories.html">See all stories →</a>
          </div>

          <div className="spotlight-grid">
            <div className="spotlight-quote">
              <span className="spotlight-mark" aria-hidden="true">&ldquo;</span>
              <h2 className="spotlight-headline" dangerouslySetInnerHTML={{ __html: featured.title.replace('\n', '<br/>') }} />
              <p className="spotlight-blurb">{featured.blurb}</p>
              <div className="spotlight-author">
                <div className="spotlight-avatar"><img src={featured.avatar} alt={featured.name} loading="lazy" /></div>
                <div>
                  <div className="spotlight-name">{featured.name}</div>
                  <div className="spotlight-role">{featured.role}</div>
                </div>
                <a className="spotlight-cta" href="Stories.html">
                  Read story {Icons.arrow({ width: 14, height: 14 })}
                </a>
              </div>
            </div>

            <aside className="spotlight-stat" aria-hidden="true">
              <div className="spotlight-stat-eyebrow">In her thread</div>
              <div className="spotlight-stat-val">{featured.metric}</div>
              <div className="spotlight-stat-unit">{featured.unit}</div>
              <div className="spotlight-stat-grid">
                <div><span>5</span> orgs aligned</div>
                <div><span>0</span> project managers</div>
                <div><span>1</span> deadline hit</div>
              </div>
            </aside>
          </div>
        </article>

        {/* Header for supporting cards */}
        <div className="teaser-head teaser-head-secondary">
          <div>
            <div className="eyebrow">Five more like it</div>
            <h3>Different jobs. Same coworker.</h3>
          </div>
          <a className="teaser-cta" href="Stories.html">
            All stories {Icons.arrow({ width: 14, height: 14 })}
          </a>
        </div>

        {/* Supporting cards row */}
        <div className="stories-teaser-grid">
          {supporting.map((s) => (
            <a className="stt" key={s.n} href="Stories.html">
              <div className="stt-frame">
                <div className="stt-head">
                  <span className="stt-num">{s.n}</span>
                  <div className="stt-spark">
                    <span /><span /><span />
                  </div>
                </div>

                <div className="stt-metric">
                  <div className="stt-metric-val">{s.metric}</div>
                  <div className="stt-metric-unit">{s.unit}</div>
                </div>

                <h3 className="stt-headline">{s.title}</h3>

                <div className="stt-author">
                  <div className="stt-avatar"><img src={s.avatar} alt={s.name} loading="lazy"/></div>
                  <div>
                    <div className="stt-name">{s.name}</div>
                    <div className="stt-role">{s.role}</div>
                  </div>
                </div>
              </div>
            </a>
          ))}
        </div>
      </div>

      <style>{`
        .stories-teaser {
          padding: 120px 0;
          border-top: 1px solid var(--border);
          background:
            radial-gradient(ellipse 40% 30% at 80% 100%, var(--accent-tint-06), transparent 70%);
        }

        /* ── Spotlight (featured story) ── */
        .spotlight {
          position: relative;
          padding: 40px 44px 44px;
          border-radius: 28px;
          background:
            linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elev) 100%);
          border: 1px solid var(--border);
          overflow: hidden;
        }
        @media (max-width: 720px) {
          .spotlight { padding: 28px 22px 32px; border-radius: 22px; }
        }
        .spotlight::before {
          content: "";
          position: absolute; inset: -1px;
          border-radius: 28px; padding: 1px;
          background: linear-gradient(135deg, rgba(192,132,252,0.35), transparent 60%);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
          -webkit-mask-composite: xor;
          pointer-events: none;
        }

        .spotlight-rule {
          display: flex;
          align-items: center;
          gap: 18px;
          margin-bottom: 32px;
        }
        .spotlight-line {
          flex: 1;
          height: 1px;
          background: var(--border);
        }
        .spotlight-skip {
          font-family: var(--font-mono);
          font-size: 11.5px;
          letter-spacing: 0.06em;
          color: var(--text-muted);
          transition: color 200ms var(--ease-out);
        }
        .spotlight-skip:hover { color: var(--accent-light); }

        .spotlight-grid {
          display: grid;
          grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
          gap: 48px;
          align-items: center;
          position: relative;
          z-index: 1;
        }
        @media (max-width: 880px) {
          .spotlight-grid { grid-template-columns: 1fr; gap: 36px; }
        }

        .spotlight-quote {
          position: relative;
        }
        .spotlight-mark {
          position: absolute;
          top: -52px; left: -8px;
          font-family: var(--font-heading);
          font-size: 160px;
          line-height: 1;
          color: var(--t-plan);
          opacity: 0.25;
          font-weight: 700;
          pointer-events: none;
        }
        .spotlight-headline {
          font-size: clamp(2rem, 4vw, 3.4rem);
          line-height: 1.05;
          letter-spacing: -0.04em;
          color: var(--text);
          margin-bottom: 24px;
          max-width: 580px;
        }
        .spotlight-blurb {
          font-size: clamp(15px, 1.5vw, 17px);
          line-height: 1.6;
          color: var(--text-secondary);
          max-width: 560px;
          margin-bottom: 32px;
          text-wrap: pretty;
        }
        .spotlight-author {
          display: flex;
          align-items: center;
          gap: 14px;
          padding-top: 22px;
          border-top: 1px dashed var(--border);
          flex-wrap: wrap;
        }
        .spotlight-avatar {
          width: 44px; height: 44px;
          border-radius: 50%;
          overflow: hidden;
          flex-shrink: 0;
          border: 2px solid color-mix(in oklch, var(--t-plan) 45%, var(--border));
        }
        .spotlight-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .spotlight-name {
          font-size: 15px;
          font-weight: 600;
          color: var(--text);
        }
        .spotlight-role {
          font-family: var(--font-mono);
          font-size: 11.5px;
          color: var(--text-muted);
          letter-spacing: 0.05em;
        }
        .spotlight-cta {
          margin-left: auto;
          display: inline-flex;
          align-items: center;
          gap: 8px;
          padding: 9px 16px;
          border-radius: 999px;
          border: 1px solid var(--border-light);
          font-family: var(--font-mono);
          font-size: 12px;
          letter-spacing: 0.04em;
          color: var(--text-secondary);
          white-space: nowrap;
          transition: color 200ms var(--ease-out), border-color 200ms var(--ease-out), background 200ms var(--ease-out);
        }
        .spotlight-cta:hover {
          color: var(--accent-light);
          border-color: var(--accent-tint-45);
          background: var(--accent-soft);
        }

        .spotlight-stat {
          padding: 28px 24px;
          background: var(--bg);
          border: 1px dashed var(--border-light);
          border-radius: 18px;
          display: flex;
          flex-direction: column;
          gap: 4px;
        }
        .spotlight-stat-eyebrow {
          font-family: var(--font-mono);
          font-size: 11px;
          letter-spacing: 0.18em;
          text-transform: uppercase;
          color: var(--text-muted);
        }
        .spotlight-stat-val {
          margin-top: 6px;
          font-family: var(--font-heading);
          font-size: clamp(3rem, 5vw, 4.4rem);
          font-weight: 800;
          letter-spacing: -0.05em;
          line-height: 0.95;
          background: linear-gradient(180deg, var(--text) 0%, var(--t-plan) 120%);
          -webkit-background-clip: text;
          background-clip: text;
          color: transparent;
        }
        .spotlight-stat-unit {
          font-family: var(--font-mono);
          font-size: 11.5px;
          letter-spacing: 0.14em;
          text-transform: uppercase;
          color: var(--text-muted);
        }
        .spotlight-stat-grid {
          margin-top: 22px;
          padding-top: 18px;
          border-top: 1px dashed var(--border);
          display: flex;
          flex-direction: column;
          gap: 12px;
          font-family: var(--font-mono);
          font-size: 13px;
          color: var(--text-secondary);
        }
        .spotlight-stat-grid > div {
          display: grid;
          grid-template-columns: 28px 1fr;
          align-items: baseline;
        }
        .spotlight-stat-grid span {
          font-family: var(--font-heading);
          font-size: 22px;
          font-weight: 700;
          color: var(--text);
          letter-spacing: -0.03em;
        }

        /* ── Supporting row ── */
        .teaser-head-secondary {
          margin-top: 80px;
          margin-bottom: 28px;
        }
        .teaser-head-secondary h3 {
          font-family: var(--font-heading);
          font-size: clamp(1.4rem, 2.4vw, 1.9rem);
          font-weight: 700;
          letter-spacing: -0.03em;
          line-height: 1.1;
          margin-top: 8px;
        }

        .stories-teaser-grid {
          display: grid;
          grid-template-columns: repeat(3, 1fr);
          gap: 16px;
        }
        @media (max-width: 760px) { .stories-teaser-grid { grid-template-columns: 1fr; } }

        .stt {
          display: block;
          color: inherit;
          transition: transform 240ms var(--ease-out);
        }
        .stt:hover { transform: translateY(-4px); }
        .stt-frame {
          padding: 24px 22px 20px;
          background: var(--bg-card);
          border: 1px solid var(--border);
          border-radius: 16px;
          display: flex; flex-direction: column;
          height: 100%;
          transition: border-color 240ms var(--ease-out), background 240ms var(--ease-out);
        }
        .stt:hover .stt-frame {
          background: var(--bg-card-hover);
          border-color: color-mix(in oklch, var(--accent) 30%, var(--border));
        }
        .stt-head {
          display: flex; justify-content: space-between; align-items: center;
          margin-bottom: 12px;
        }
        .stt-num {
          font-family: var(--font-mono);
          font-size: 11.5px;
          letter-spacing: 0.2em;
          color: var(--accent-light);
          font-weight: 600;
        }
        .stt-spark { display: flex; gap: 4px; }
        .stt-spark span {
          width: 4px; height: 4px; border-radius: 50%;
          background: var(--text-muted);
        }
        .stt-metric { margin-bottom: 14px; }
        .stt-metric-val {
          font-family: var(--font-heading);
          font-size: clamp(2rem, 3.2vw, 2.8rem);
          font-weight: 800;
          letter-spacing: -0.05em;
          line-height: 0.95;
          background: linear-gradient(180deg, var(--text) 0%, var(--accent-light) 120%);
          -webkit-background-clip: text;
          background-clip: text;
          color: transparent;
        }
        .stt-metric-unit {
          margin-top: 6px;
          font-family: var(--font-mono);
          font-size: 10.5px;
          letter-spacing: 0.14em;
          text-transform: uppercase;
          color: var(--text-muted);
        }
        .stt-headline {
          font-size: 16px;
          line-height: 1.3;
          letter-spacing: -0.015em;
          margin-bottom: 16px;
          white-space: pre-line;
          flex: 1;
        }
        .stt-author {
          display: flex; align-items: center; gap: 10px;
          padding-top: 14px;
          border-top: 1px dashed var(--border);
        }
        .stt-avatar {
          width: 28px; height: 28px;
          border-radius: 50%;
          overflow: hidden;
          flex-shrink: 0;
          border: 1.5px solid color-mix(in oklch, var(--accent) 35%, var(--border));
        }
        .stt-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .stt-name { font-size: 13px; font-weight: 600; }
        .stt-role {
          font-family: var(--font-mono);
          font-size: 10.5px;
          color: var(--text-muted);
          letter-spacing: 0.05em;
        }
      `}</style>
    </section>
  );
}

Object.assign(window, { SkillsTeaser, StoriesTeaser });
