// sig-doorways.jsx — Section 03. Three Doorways.
//
// Three Levels of depth. Same foundation. Same community. Same
// seven days. Chosen by you.
//
// Per direction: equal visual weight across the three. Each
// layout option preserves that — no Level III "premium tier"
// styling. The differentiation is in copy + depth-of-included,
// not in size or color hierarchy.
//
// Layout options (tweak: doorways):
//   columns      — three equal columns (default, conversion-led)
//   editorial    — three full-width rows, each a doorway essay
//   architectural — three architectural arch "portals" side-by-side,
//                   each cinematic, each opens to the level's brief.

const DOORWAYS = [
  {
    level: 'Level I',
    name: 'Learn',
    sub: 'The Foundation',
    price: '$49',
    seats: '7 seats',
    headline:
      'Build the foundation for a way of living with technology — grounded, intentional, yours.',
    includes: [
      'Your full Core Curriculum',
      'Seven days inside The Tech Lifestyle',
      'The inaugural cohort experience',
    ],
    outcome: 'You leave with: skills, a community, and a foundation that\'s yours.',
    away:
      'A foundation. Skills you can use the same day you learn them. A community that\'s still there when the seven days end.',
    cta: 'Walk in through Foundation',
    href: 'https://connect.livingdigitally.co/make-an-inquiry/ols/products/7-days-of-living-digitally-level-i-learn-the-foundation',
  },
  {
    level: 'Level II',
    name: 'Apply',
    sub: 'The Founding 21',
    price: '$97',
    seats: '21 seats',
    headline:
      'Take the foundation into the world — and leave with a custom AI prompt for one real moment in your life.',
    includes: [
      'Everything in The Foundation',
      '15-minute Prompt Precision Session — one prompt, refined for your real life, yours to use again.',
    ],
    outcome: 'You leave with: skills, a community, and a custom prompt that\'s yours.',
    away:
      'A foundation, applied. A custom resource you\'ll use long after the cohort ends. A community that\'s still there when the seven days end.',
    cta: 'Walk in with The Founding 21',
    href: 'https://connect.livingdigitally.co/make-an-inquiry/ols/products/7-days-of-living-digitally-level-ii-apply-the-founding-21',
  },
  {
    level: 'Level III',
    name: 'Access',
    sub: 'The Seven of Access',
    price: '$397',
    seats: '7 seats',
    headline:
      'Design a personalized AI system that runs alongside your real life, every day.',
    includes: [
      'Everything in The Foundation',
      '45–60 minute AI Workflow Design Session — a personalized AI system, designed with you, built for your daily life.',
    ],
    outcome: 'You leave with: skills, a community, and a personalized AI system that\'s yours.',
    away:
      'A foundation, scaled. A personalized AI system — yours to run every day. A community that\'s still there when the seven days end.',
    cta: 'Walk in through Access',
    href: 'https://connect.livingdigitally.co/make-an-inquiry/ols/products/7-days-of-living-digitally-level-iii-access-the-seven-of-access',
  },
];

// Shared frame — pearl ground breaks the navy register here.
// This is THE conversion section, so the page lifts into pearl
// for a moment, then returns to navy in the next beat.
const DoorwaysFrame = ({ children }) => (
  <section id="doorways" data-screen-label="03 Three Doorways"
    style={{
      background: 'var(--ld-pearl-50)',
      color: 'var(--ld-navy)',
      padding: '56px 32px 56px',
      position: 'relative', overflow: 'hidden',
      borderTop: '1px solid rgba(95,224,230,0.18)',
      borderBottom: '1px solid var(--ld-line)',
    }}>
    <div style={{ maxWidth: 1320, margin: '0 auto', position: 'relative' }}>
      <div style={{ textAlign: 'center', marginBottom: 32 }}>
        <h2 style={{
          fontFamily: 'var(--font-display)', fontWeight: 300,
          fontSize: 'clamp(34px, 4.5vw, 56px)', lineHeight: 1.04,
          letterSpacing: '-0.014em',
          color: 'var(--ld-navy)', margin: '0 0 14px',
          textWrap: 'balance',
        }}>
          Choose the Doorway<br />
          <em style={{ fontStyle: 'italic', color: 'var(--ld-bronze)' }}>
            that feels like home.
          </em>
        </h2>
        <p style={{
          fontFamily: 'var(--font-display)', fontStyle: 'italic',
          fontWeight: 400, fontSize: 18, lineHeight: 1.5,
          color: 'var(--ld-ink-2)', margin: '0 auto', maxWidth: 580,
        }}>
          Same Core Curriculum. Same cohort. Same community.<br />
          Your Level shapes the depth.
        </p>
      </div>
      {children}
      {/* Footnote */}
      <p style={{
        textAlign: 'center',
        fontFamily: 'var(--font-body)', fontSize: 12.5, lineHeight: 1.65,
        color: 'var(--ld-ink-3)', maxWidth: 720, margin: '22px auto 0',
        textWrap: 'pretty',
      }}>
        A note on Level III: the AI Workflow Design Session{' '}
        <em style={{ fontStyle: 'italic' }}>replaces</em>{' '}
        the Level II Prompt Precision Session. Every Resident, at every Level,
        shares the same Core Curriculum, cohort, and community.
      </p>
    </div>
  </section>
);

// Roman numeral helper
const ROMAN = ['I', 'II', 'III'];

// ─────────────────────────────────────────────────────────────
// LAYOUT A · COLUMNS (default)
// Three equal columns. Conversion-led but editorially designed.
// All three identical scaffolding — only copy differs. Equal
// weight, equal visual treatment.
// ─────────────────────────────────────────────────────────────
const DoorwaysColumns = () => (
  <DoorwaysFrame>
    <div style={{
      display: 'grid',
      gridTemplateColumns: 'repeat(3, 1fr)',
      gap: 24,
    }} className="sig-doorways-cols">
      {DOORWAYS.map((D, i) => (
        <article key={D.level} style={{
          background: '#FFFDF7',
          border: '1px solid var(--ld-line)',
          borderTop: '3px solid var(--ld-bronze)',
          borderRadius: 2,
          padding: '36px 28px 32px',
          display: 'flex', flexDirection: 'column',
          boxShadow: '0 12px 32px rgba(13,27,61,0.08)',
        }}>
          {/* Roman numeral */}
          <div aria-hidden="true" style={{
            fontFamily: 'var(--font-display)', fontWeight: 300,
            fontSize: 64, lineHeight: 0.85, letterSpacing: '-0.03em',
            color: 'var(--ld-bronze)', margin: '0 0 16px',
          }}>{ROMAN[i]}</div>

          <div style={{
            fontFamily: 'var(--font-body)', fontWeight: 700,
            fontSize: 10.5, letterSpacing: '0.28em', textTransform: 'uppercase',
            color: 'var(--ld-aqua-700)', marginBottom: 10,
          }}>{D.level} · {D.name}</div>

          <h3 style={{
            fontFamily: 'var(--font-display)', fontWeight: 400,
            fontStyle: 'italic',
            fontSize: 30, lineHeight: 1.1, letterSpacing: '-0.012em',
            color: 'var(--ld-navy)', margin: '0 0 20px',
          }}>{D.sub}</h3>

          <div style={{
            display: 'flex', alignItems: 'baseline', gap: 14,
            paddingBottom: 18, borderBottom: '1px solid var(--ld-line)',
            marginBottom: 18,
          }}>
            <span style={{
              fontFamily: 'var(--font-display)', fontWeight: 400,
              fontSize: 36, lineHeight: 1, letterSpacing: '-0.018em',
              color: 'var(--ld-navy)',
            }}>{D.price}</span>
            <span style={{
              fontFamily: 'var(--font-body)', fontWeight: 600,
              fontSize: 10, letterSpacing: '0.24em', textTransform: 'uppercase',
              color: 'var(--ld-ink-3)',
            }}>· {D.seats}</span>
          </div>

          <p style={{
            fontFamily: 'var(--font-body)', fontSize: 14, lineHeight: 1.65,
            color: 'var(--ld-ink-2)', margin: '0 0 20px',
            textWrap: 'pretty',
          }}>{D.headline}</p>

          <div style={{
            fontFamily: 'var(--font-body)', fontWeight: 700,
            fontSize: 9.5, letterSpacing: '0.26em', textTransform: 'uppercase',
            color: 'var(--ld-ink-3)', marginBottom: 10,
          }}>Included</div>
          <ul style={{
            listStyle: 'none', padding: 0, margin: '0 0 26px',
            display: 'flex', flexDirection: 'column', gap: 12,
          }}>
            {D.includes.map((it, j) => (
              <li key={j} style={{
                display: 'flex', gap: 10, alignItems: 'flex-start',
                fontFamily: 'var(--font-body)', fontSize: 13.5, lineHeight: 1.55,
                color: 'var(--ld-ink-2)',
              }}>
                <span aria-hidden="true" style={{
                  flex: 'none', width: 6, height: 6, marginTop: 8,
                  background: 'var(--ld-bronze)', borderRadius: 6,
                }} />
                <span>{it}</span>
              </li>
            ))}
          </ul>

          <div style={{
            paddingTop: 18, borderTop: '1px solid var(--ld-line)',
            marginTop: 'auto',
          }}>
            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 9.5, letterSpacing: '0.26em', textTransform: 'uppercase',
              color: 'var(--ld-aqua-700)', marginBottom: 8,
            }}>You walk away with</div>
            <p style={{
              fontFamily: 'var(--font-display)', fontStyle: 'italic',
              fontWeight: 400, fontSize: 15.5, lineHeight: 1.45,
              color: 'var(--ld-navy)', margin: '0 0 22px',
              textWrap: 'pretty',
            }}>{D.away}</p>
            <a href={D.href} style={{
              display: 'inline-flex', alignItems: 'center',
              justifyContent: 'space-between', gap: 12,
              width: '100%', padding: '14px 18px',
              background: 'var(--ld-navy)', color: 'var(--ld-pearl-100)',
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 10.5, letterSpacing: '0.22em', textTransform: 'uppercase',
              borderRadius: 2, borderBottom: 'none',
              boxShadow: '0 0 22px rgba(13,27,61,0.18)',
            }}>
              <span>{D.cta}</span>
              <span aria-hidden="true" style={{ color: 'var(--ld-aqua)' }}>→</span>
            </a>
          </div>
        </article>
      ))}
    </div>
    <style>{`
      @media (max-width: 1080px) {
        .sig-doorways-cols { grid-template-columns: 1fr !important; max-width: 540px; margin: 0 auto !important; }
      }
    `}</style>
  </DoorwaysFrame>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT B · EDITORIAL
// Three full-width rows. Each Doorway is its own essay — long
// columns of editorial text with the Roman numeral as a large
// initial, price/seats as a hairline rail, included list inline.
// Equal weight; the form repeats identically for each level.
// ─────────────────────────────────────────────────────────────
const DoorwaysEditorial = () => (
  <DoorwaysFrame>
    <div style={{ display: 'flex', flexDirection: 'column' }}>
      {DOORWAYS.map((D, i) => (
        <article key={D.level} style={{
          padding: '40px 0',
          borderTop: '1px solid var(--ld-line)',
          ...(i === DOORWAYS.length - 1 ? { borderBottom: '1px solid var(--ld-line)' } : {}),
          display: 'grid',
          gridTemplateColumns: '160px minmax(0, 1fr) minmax(0, 320px)',
          gap: 36, alignItems: 'start',
        }} className="sig-doorways-ed-row">
          {/* LEFT — Roman numeral + level eyebrow */}
          <div>
            <div aria-hidden="true" style={{
              fontFamily: 'var(--font-display)', fontWeight: 300,
              fontSize: 'clamp(72px, 8vw, 120px)', lineHeight: 0.85,
              letterSpacing: '-0.04em',
              color: 'var(--ld-bronze)', margin: '0 0 14px',
            }}>{ROMAN[i]}</div>
            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 10, letterSpacing: '0.26em', textTransform: 'uppercase',
              color: 'var(--ld-aqua-700)',
            }}>{D.level}</div>
            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 600,
              fontSize: 10, letterSpacing: '0.24em', textTransform: 'uppercase',
              color: 'var(--ld-ink-3)', marginTop: 4,
            }}>{D.name}</div>
          </div>

          {/* CENTER — essay */}
          <div>
            <h3 style={{
              fontFamily: 'var(--font-display)', fontWeight: 400,
              fontStyle: 'italic',
              fontSize: 'clamp(28px, 2.6vw, 36px)', lineHeight: 1.1,
              letterSpacing: '-0.012em',
              color: 'var(--ld-navy)', margin: '0 0 8px',
            }}>{D.sub}</h3>
            <p style={{
              fontFamily: 'var(--font-body)', fontSize: 15, lineHeight: 1.7,
              color: 'var(--ld-ink-2)', margin: '0 0 22px',
              textWrap: 'pretty', maxWidth: 580,
            }}>{D.headline}</p>

            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 9.5, letterSpacing: '0.26em', textTransform: 'uppercase',
              color: 'var(--ld-ink-3)', marginBottom: 8,
            }}>Included</div>
            <ul style={{
              listStyle: 'none', padding: 0, margin: '0 0 22px',
              display: 'flex', flexDirection: 'column', gap: 10,
            }}>
              {D.includes.map((it, j) => (
                <li key={j} style={{
                  display: 'flex', gap: 10, alignItems: 'flex-start',
                  fontFamily: 'var(--font-body)', fontSize: 13.5, lineHeight: 1.55,
                  color: 'var(--ld-ink-2)',
                }}>
                  <span aria-hidden="true" style={{
                    flex: 'none', width: 6, height: 6, marginTop: 8,
                    background: 'var(--ld-bronze)', borderRadius: 6,
                  }} />
                  <span>{it}</span>
                </li>
              ))}
            </ul>
            <p style={{
              fontFamily: 'var(--font-display)', fontStyle: 'italic',
              fontWeight: 400, fontSize: 17, lineHeight: 1.5,
              color: 'var(--ld-navy)', margin: 0,
              textWrap: 'pretty', maxWidth: 580,
            }}>
              <span style={{
                fontFamily: 'var(--font-body)', fontWeight: 700, fontStyle: 'normal',
                fontSize: 9.5, letterSpacing: '0.26em', textTransform: 'uppercase',
                color: 'var(--ld-aqua-700)', marginRight: 10,
              }}>You walk away with —</span>
              {D.away}
            </p>
          </div>

          {/* RIGHT — price card + CTA */}
          <div style={{
            background: '#FFFDF7',
            border: '1px solid var(--ld-line)',
            borderRadius: 2,
            padding: '24px 22px',
          }}>
            <div style={{
              fontFamily: 'var(--font-display)', fontWeight: 400,
              fontSize: 40, lineHeight: 1, letterSpacing: '-0.018em',
              color: 'var(--ld-navy)', margin: '0 0 4px',
            }}>{D.price}</div>
            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 600,
              fontSize: 10, letterSpacing: '0.24em', textTransform: 'uppercase',
              color: 'var(--ld-ink-3)', marginBottom: 22,
            }}>{D.seats}</div>
            <a href={D.href} style={{
              display: 'inline-flex', alignItems: 'center', gap: 10,
              padding: '13px 18px',
              background: 'var(--ld-navy)', color: 'var(--ld-pearl-100)',
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 10.5, letterSpacing: '0.22em', textTransform: 'uppercase',
              borderRadius: 2, borderBottom: 'none',
              width: '100%', justifyContent: 'space-between',
            }}>
              <span>{D.cta}</span>
              <span aria-hidden="true" style={{ color: 'var(--ld-aqua)' }}>→</span>
            </a>
          </div>
        </article>
      ))}
    </div>
    <style>{`
      @media (max-width: 960px) {
        .sig-doorways-ed-row { grid-template-columns: 1fr !important; gap: 18px !important; }
      }
    `}</style>
  </DoorwaysFrame>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT C · ARCHITECTURAL
// Three architectural arches side by side. Each "doorway" is a
// literal portal — a tall arched card with the Roman numeral
// glowing in the arch and the level brief beneath. Cinematic;
// keeps equal weight by making every arch identical in form.
// ─────────────────────────────────────────────────────────────
const DoorwaysArchitectural = () => (
  <DoorwaysFrame>
    <div style={{
      display: 'grid',
      gridTemplateColumns: 'repeat(3, 1fr)',
      gap: 20,
    }} className="sig-doorways-arch">
      {DOORWAYS.map((D, i) => (
        <a key={D.level} href={D.href} style={{
          display: 'flex', flexDirection: 'column',
          background: 'var(--ld-navy)',
          color: 'var(--ld-pearl-100)',
          borderRadius: '50% 50% 4px 4px / 24% 24% 4px 4px',
          padding: '64px 28px 32px',
          textDecoration: 'none', borderBottom: 'none',
          position: 'relative', overflow: 'hidden',
          boxShadow: '0 24px 56px rgba(13,27,61,0.32), inset 0 -1px 0 var(--ld-aqua)',
          minHeight: 580,
        }}>
          {/* Inner arch glow */}
          <span aria-hidden="true" style={{
            position: 'absolute', top: 24, left: '50%', transform: 'translateX(-50%)',
            width: 'calc(100% - 36px)', height: 'calc(100% - 60px)',
            borderRadius: '50% 50% 2px 2px / 22% 22% 2px 2px',
            border: '1px solid rgba(95,224,230,0.32)',
            boxShadow: 'inset 0 0 64px rgba(95,224,230,0.12)',
          }} />
          {/* aqua floor line */}
          <span aria-hidden="true" style={{
            position: 'absolute', bottom: 0, left: 18, right: 18, height: 2,
            background: 'var(--ld-aqua)',
            boxShadow: '0 0 18px var(--ld-aqua)',
          }} />

          <div style={{
            position: 'relative', textAlign: 'center',
            display: 'flex', flexDirection: 'column', height: '100%',
          }}>
            {/* Roman numeral in the arch */}
            <div aria-hidden="true" style={{
              fontFamily: 'var(--font-display)', fontWeight: 300,
              fontSize: 'clamp(72px, 6vw, 96px)', lineHeight: 0.85,
              letterSpacing: '-0.04em',
              color: 'var(--ld-aqua)',
              textShadow: '0 0 32px rgba(95,224,230,0.7)',
              margin: '0 0 20px',
            }}>{ROMAN[i]}</div>

            <div style={{
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 10, letterSpacing: '0.30em', textTransform: 'uppercase',
              color: 'var(--ld-gold)', marginBottom: 8,
            }}>{D.level} · {D.name}</div>

            <h3 style={{
              fontFamily: 'var(--font-display)', fontWeight: 400,
              fontStyle: 'italic',
              fontSize: 28, lineHeight: 1.1, letterSpacing: '-0.012em',
              color: 'var(--ld-pearl-100)', margin: '0 0 14px',
            }}>{D.sub}</h3>

            <div style={{
              display: 'flex', alignItems: 'baseline',
              justifyContent: 'center', gap: 10,
              marginBottom: 18,
            }}>
              <span style={{
                fontFamily: 'var(--font-display)', fontWeight: 400,
                fontSize: 32, lineHeight: 1, color: 'var(--ld-pearl-100)',
              }}>{D.price}</span>
              <span style={{
                fontFamily: 'var(--font-body)', fontWeight: 600,
                fontSize: 9.5, letterSpacing: '0.22em', textTransform: 'uppercase',
                color: 'rgba(235,221,197,0.6)',
              }}>· {D.seats}</span>
            </div>

            <p style={{
              fontFamily: 'var(--font-body)', fontSize: 13.5, lineHeight: 1.6,
              color: 'rgba(235,221,197,0.78)', margin: '0 0 22px', textAlign: 'left',
              textWrap: 'pretty',
            }}>{D.headline}</p>

            <div style={{ textAlign: 'left', marginBottom: 'auto' }}>
              <div style={{
                fontFamily: 'var(--font-body)', fontWeight: 700,
                fontSize: 9, letterSpacing: '0.28em', textTransform: 'uppercase',
                color: 'var(--ld-aqua)', marginBottom: 8,
              }}>Included</div>
              <ul style={{
                listStyle: 'none', padding: 0, margin: '0 0 0',
                display: 'flex', flexDirection: 'column', gap: 8,
              }}>
                {D.includes.map((it, j) => (
                  <li key={j} style={{
                    display: 'flex', gap: 8, alignItems: 'flex-start',
                    fontFamily: 'var(--font-body)', fontSize: 12, lineHeight: 1.5,
                    color: 'rgba(235,221,197,0.78)',
                  }}>
                    <span aria-hidden="true" style={{
                      flex: 'none', width: 5, height: 5, marginTop: 7,
                      background: 'var(--ld-aqua)', borderRadius: 5,
                    }} />
                    <span>{it}</span>
                  </li>
                ))}
              </ul>
            </div>

            <div style={{
              marginTop: 22, paddingTop: 16,
              borderTop: '1px solid rgba(95,224,230,0.24)',
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 10, letterSpacing: '0.22em', textTransform: 'uppercase',
              color: 'var(--ld-pearl-100)',
            }}>
              <span>{D.cta}</span>
              <span aria-hidden="true" style={{ color: 'var(--ld-aqua)' }}>→</span>
            </div>
          </div>
        </a>
      ))}
    </div>
    <style>{`
      @media (max-width: 960px) {
        .sig-doorways-arch { grid-template-columns: 1fr !important; max-width: 480px; margin: 0 auto !important; }
      }
    `}</style>
  </DoorwaysFrame>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT D · DOORS — literal door panels that "open" on hover/tap
// Each Doorway is rendered as a tall door with a frame, panels,
// and a brass handle. Resting state: the door is closed; only the
// Level (I/II/III) and sub-title are visible on the door face.
// On hover (desktop) or tap (mobile) the door "opens" — the
// content (price, included list, walk-away, CTA) reveals from
// behind. Equal weight; all three doors identical in form.
// ─────────────────────────────────────────────────────────────
const DoorsCard = ({ D, i, openId, setOpenId }) => {
  const id = D.level;
  const isOpen = openId === id;
  const handleEnter = () => setOpenId(id);
  const handleLeave = () => setOpenId(null);
  const handleClick = (e) => {
    // On touch / narrow viewports, click toggles open state.
    if (window.matchMedia('(hover: none)').matches) {
      e.preventDefault();
      setOpenId(isOpen ? null : id);
    }
  };

  return (
    <a
      href={D.href}
      onMouseEnter={handleEnter}
      onMouseLeave={handleLeave}
      onFocus={handleEnter}
      onBlur={handleLeave}
      onClick={handleClick}
      aria-expanded={isOpen}
      style={{
        position: 'relative',
        display: 'block',
        height: 560,
        background: 'var(--ld-navy)',
        borderRadius: '6px 6px 2px 2px',
        boxShadow: '0 24px 56px rgba(13,27,61,0.32)',
        overflow: 'hidden',
        textDecoration: 'none',
        borderBottom: 'none',
        color: 'var(--ld-pearl-100)',
        // Frame around the door — gold rule, slightly inset
        outline: '1px solid rgba(201,162,74,0.3)',
        outlineOffset: -8,
      }}
      className="sig-door"
    >
      {/* ── DOOR FACE (closed state) ─────────────────────────── */}
      <div aria-hidden={isOpen ? 'true' : undefined} style={{
        position: 'absolute', inset: 0,
        background:
          'linear-gradient(180deg, #142647 0%, #0D1B3D 50%, #0A1531 100%)',
        transition: 'transform 700ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 400ms ease',
        transform: isOpen ? 'translateY(-100%)' : 'translateY(0)',
        boxShadow: isOpen
          ? '0 24px 40px rgba(0,0,0,0.5)'
          : 'inset 0 0 0 1px rgba(201,162,74,0.18)',
        zIndex: 2,
      }}>
        {/* Inner door panels — three stacked rectangles, classic
            paneled door */}
        <div style={{
          position: 'absolute', inset: '36px 28px',
          display: 'grid', gridTemplateRows: '1fr 1fr 1.4fr', gap: 14,
        }}>
          {[0,1,2].map((p) => (
            <div key={p} aria-hidden="true" style={{
              border: '1px solid rgba(201,162,74,0.32)',
              borderRadius: 2,
              background:
                'linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.18) 100%)',
              boxShadow:
                'inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.4)',
              position: 'relative',
              display: 'flex', alignItems: 'center', justifyContent: 'center',
            }}>
              {/* Top panel carries the Roman numeral */}
              {p === 0 && (
                <span style={{
                  fontFamily: 'var(--font-display)', fontWeight: 300,
                  fontSize: 76, lineHeight: 1, letterSpacing: '-0.04em',
                  color: 'var(--ld-gold)',
                  textShadow: '0 0 24px rgba(201,162,74,0.5)',
                }}>{ROMAN[i]}</span>
              )}
              {/* Middle panel carries the Level eyebrow */}
              {p === 1 && (
                <div style={{ textAlign: 'center', padding: '0 18px' }}>
                  <div style={{
                    fontFamily: 'var(--font-body)', fontWeight: 700,
                    fontSize: 10, letterSpacing: '0.30em',
                    textTransform: 'uppercase',
                    color: 'var(--ld-aqua)', marginBottom: 8,
                  }}>{D.level} · {D.name}</div>
                  <div style={{
                    fontFamily: 'var(--font-display)', fontStyle: 'italic',
                    fontWeight: 400, fontSize: 22, lineHeight: 1.15,
                    color: 'var(--ld-pearl-100)',
                  }}>{D.sub}</div>
                </div>
              )}
              {/* Bottom panel carries the price + the "press"
                  invitation copy */}
              {p === 2 && (
                <div style={{ textAlign: 'center', padding: '0 18px' }}>
                  <div style={{
                    fontFamily: 'var(--font-display)', fontWeight: 400,
                    fontSize: 36, lineHeight: 1, letterSpacing: '-0.018em',
                    color: 'var(--ld-pearl-100)',
                  }}>{D.price}</div>
                  <div style={{
                    marginTop: 6,
                    fontFamily: 'var(--font-body)', fontWeight: 600,
                    fontSize: 9.5, letterSpacing: '0.24em',
                    textTransform: 'uppercase',
                    color: 'rgba(235,221,197,0.55)',
                  }}>{D.seats}</div>
                  <div style={{
                    marginTop: 18,
                    fontFamily: 'var(--font-body)', fontWeight: 700,
                    fontSize: 9.5, letterSpacing: '0.28em',
                    textTransform: 'uppercase',
                    color: 'var(--ld-aqua)',
                  }}>Touch to lift ↑</div>
                </div>
              )}
            </div>
          ))}
        </div>

        {/* brass pull-loop at the bottom — the thing you grab
            to lift a roll-up door */}
        <span aria-hidden="true" style={{
          position: 'absolute',
          left: '50%', bottom: 14, transform: 'translateX(-50%)',
          width: 44, height: 10,
          borderRadius: 10,
          background: 'linear-gradient(180deg, #E2C079 0%, var(--ld-gold) 50%, #8B6A1E 100%)',
          boxShadow: '0 0 12px rgba(201,162,74,0.4), inset 0 1px 0 rgba(255,255,255,0.25)',
        }} />
      </div>

      {/* ── INTERIOR (revealed state) ───────────────────────── */}
      <div style={{
        position: 'absolute', inset: 0,
        padding: '32px 28px 28px',
        background:
          'radial-gradient(ellipse at 50% 0%, rgba(95,224,230,0.18) 0%, transparent 60%),' +
          'linear-gradient(180deg, #0A1531 0%, #050913 100%)',
        display: 'flex', flexDirection: 'column',
        zIndex: 1,
      }}>
        {/* aqua threshold line at the bottom */}
        <span aria-hidden="true" style={{
          position: 'absolute', left: 16, right: 16, bottom: 0, height: 2,
          background: 'var(--ld-aqua)',
          boxShadow: '0 0 16px var(--ld-aqua)',
        }} />

        <div style={{
          fontFamily: 'var(--font-body)', fontWeight: 700,
          fontSize: 10, letterSpacing: '0.30em', textTransform: 'uppercase',
          color: 'var(--ld-aqua)', marginBottom: 8,
        }}>{D.level} · {D.name}</div>

        <h3 style={{
          fontFamily: 'var(--font-display)', fontWeight: 400,
          fontStyle: 'italic',
          fontSize: 26, lineHeight: 1.1, letterSpacing: '-0.012em',
          color: 'var(--ld-pearl-100)', margin: '0 0 16px',
        }}>{D.sub}</h3>

        <p style={{
          fontFamily: 'var(--font-body)', fontSize: 13, lineHeight: 1.6,
          color: 'rgba(235,221,197,0.78)', margin: '0 0 16px',
          textWrap: 'pretty',
        }}>{D.headline}</p>

        <div style={{
          fontFamily: 'var(--font-body)', fontWeight: 700,
          fontSize: 9, letterSpacing: '0.28em', textTransform: 'uppercase',
          color: 'var(--ld-gold)', marginBottom: 8,
        }}>Included</div>
        <ul style={{
          listStyle: 'none', padding: 0, margin: '0 0 16px',
          display: 'flex', flexDirection: 'column', gap: 8,
        }}>
          {D.includes.map((it, j) => (
            <li key={j} style={{
              display: 'flex', gap: 8, alignItems: 'flex-start',
              fontFamily: 'var(--font-body)', fontSize: 12, lineHeight: 1.5,
              color: 'rgba(235,221,197,0.75)',
            }}>
              <span aria-hidden="true" style={{
                flex: 'none', width: 5, height: 5, marginTop: 7,
                background: 'var(--ld-gold)', borderRadius: 5,
              }} />
              <span>{it}</span>
            </li>
          ))}
        </ul>

        {/* Outcome line — what you walk away with */}
        {D.outcome && (
          <p style={{
            fontFamily: 'var(--font-display)', fontStyle: 'italic',
            fontWeight: 400, fontSize: 13.5, lineHeight: 1.5,
            color: 'var(--ld-pearl-100)', margin: '0 0 16px',
            paddingTop: 12,
            borderTop: '1px solid rgba(201,162,74,0.32)',
            textWrap: 'pretty',
          }}>{D.outcome}</p>
        )}

        <div style={{
          marginTop: 'auto',
          paddingTop: 14, borderTop: '1px solid rgba(95,224,230,0.24)',
          display: 'flex', alignItems: 'center', justifyContent: 'space-between',
          fontFamily: 'var(--font-body)', fontWeight: 700,
          fontSize: 10.5, letterSpacing: '0.22em', textTransform: 'uppercase',
          color: 'var(--ld-aqua)',
        }}>
          <span>{D.cta}</span>
          <span aria-hidden="true">→</span>
        </div>
      </div>
    </a>
  );
};

const DoorwaysDoors = () => {
  const [openId, setOpenId] = React.useState(null);
  return (
    <DoorwaysFrame>
      <div style={{
        display: 'grid',
        gridTemplateColumns: 'repeat(3, 1fr)',
        gap: 20,
        perspective: '1200px',
      }} className="sig-doorways-doors">
        {DOORWAYS.map((D, i) => (
          <DoorsCard key={D.level} D={D} i={i}
                     openId={openId} setOpenId={setOpenId} />
        ))}
      </div>
      <style>{`
        @media (max-width: 960px) {
          .sig-doorways-doors { grid-template-columns: 1fr !important; max-width: 420px; margin: 0 auto !important; }
        }
        .sig-door:focus { outline: 2px solid var(--ld-aqua); outline-offset: 4px; }
      `}</style>
    </DoorwaysFrame>
  );
};

// ─────────────────────────────────────────────────────────────
// Router
// ──────────────────────────────────────────���──────────────────
const SigDoorways = ({ variant = 'doors' }) => {
  if (variant === 'doors')         return <DoorwaysDoors />;
  if (variant === 'editorial')     return <DoorwaysEditorial />;
  if (variant === 'architectural') return <DoorwaysArchitectural />;
  return <DoorwaysColumns />;
};

Object.assign(window, { SigDoorways });
