/* === Sections — Kajsa & Axel === */

const SECTIONS = [
{ id: 'hem', num: 'I', label: 'Välkommen' },
{ id: 'program', num: 'II', label: 'Program' },
{ id: 'plats', num: 'III', label: 'Plats' },
{ id: 'boende', num: 'IV', label: 'Boende' },
{ id: 'kladkod', num: 'V', label: 'Klädkod' },
{ id: 'presenter', num: 'VI', label: 'Presenter' },
{ id: 'osa', num: 'VII', label: 'OSA' },
{ id: 'fragor', num: 'VIII', label: 'Frågor' }];


function getC() { return window.CONTENT || window.CONTENT_DEFAULTS || {}; }
function useContentTick() {
  const [, setT] = React.useState(0);
  React.useEffect(() => {
    const h = () => setT(x => x + 1);
    window.addEventListener('content:update', h);
    return () => window.removeEventListener('content:update', h);
  }, []);
}
const WEDDING_DATE = new Date(getC().date?.iso || '2026-08-15T15:00:00+02:00');

// --- Crest / faux logotype ---
function Crest({ small, top, year, sub }) {
  return (
    <div className="crest" style={small ? { transform: 'scale(0.85)' } : null}>
      <svg className="crest-shield" viewBox="0 0 64 76" xmlns="http://www.w3.org/2000/svg">
        <path d="M4 4 L60 4 L60 44 Q60 64 32 72 Q4 64 4 44 Z" fill="#2f6a5a" stroke="#2a1c0a" strokeWidth="1.5" />
        <path d="M8 8 L56 8 L56 44 Q56 60 32 68 Q8 60 8 44 Z" fill="none" stroke="#a8431f" strokeWidth="0.8" />
        {/* Crossed keys */}
        <g transform="translate(32 38) rotate(-30)">
          <circle cx="-12" cy="0" r="5" fill="none" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="-7" y1="0" x2="14" y2="0" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="10" y1="0" x2="10" y2="4" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="14" y1="0" x2="14" y2="4" stroke="#f7d635" strokeWidth="1.5" />
        </g>
        <g transform="translate(32 38) rotate(30)">
          <circle cx="-12" cy="0" r="5" fill="none" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="-7" y1="0" x2="14" y2="0" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="10" y1="0" x2="10" y2="4" stroke="#f7d635" strokeWidth="1.5" />
          <line x1="14" y1="0" x2="14" y2="4" stroke="#f7d635" strokeWidth="1.5" />
        </g>
        <text x="32" y="22" textAnchor="middle" fontFamily="Playfair Display, serif" fontStyle="italic" fontSize="11" fontWeight="600" fill="#2a1c0a">K&amp;A</text>
      </svg>
      <div className="crest-line">{top || '— Hôtel —'}</div>
      <div className="crest-year">{year || 'MMXXVI'}</div>
      <div className="crest-line">{sub || 'Österlen · Anno Domini'}</div>
    </div>);

}

function HotelFacade() {
  const ink = "#2a1c0a";
  const tile = "#b8451f";        // terracotta tile
  const tileShade = "#8e2e10";   // darker tile bands
  const wall = "#f6e6b8";        // creamy white-ish (palette-friendly)
  const door = "#a8431f";
  const chimney = "#c98818";
  const trim = "#2a1c0a";
  const garden = "#1f4a3e";
  const lavender = "#2f6a5a";
  return (
    <svg className="hotel-facade" viewBox="0 0 360 200" xmlns="http://www.w3.org/2000/svg">
      {/* ground */}
      <rect x="0" y="170" width="360" height="30" fill="#1f4a3e" opacity="0.18" />
      <rect x="0" y="184" width="360" height="16" fill="#a8431f" opacity="0.18" />
      {/* tree on right edge — tucked outside the right wing */}
      <g opacity="0.5">
        <ellipse cx="354" cy="68" rx="18" ry="30" fill="#1f4a3e" />
        <ellipse cx="346" cy="86" rx="14" ry="22" fill="#2f6a5a" />
      </g>
      {/* main body */}
      <g>
        {/* low side wings (left + right) — set back, lower */}
        <rect x="4" y="124" width="70" height="46" fill={wall} stroke={trim} strokeWidth="1.2" />
        <rect x="286" y="124" width="70" height="46" fill={wall} stroke={trim} strokeWidth="1.2" />
        {/* main central block */}
        <rect x="80" y="92" width="200" height="78" fill={wall} stroke={trim} strokeWidth="1.4" />
        {/* roofs — long low pitch */}
        <path d="M0 124 L40 100 L78 124 Z" fill={tile} stroke={trim} strokeWidth="1.2" />
        <path d="M282 124 L320 100 L360 124 Z" fill={tile} stroke={trim} strokeWidth="1.2" />
        <path d="M76 92 L180 50 L284 92 Z" fill={tile} stroke={trim} strokeWidth="1.4" />
        {/* tile bands */}
        {[60, 70].map((y, i) => (
          <line key={i} x1={120 - i*10} y1={y + 22} x2={240 + i*10} y2={y + 22} stroke={tileShade} strokeWidth="0.6" opacity="0.5" />
        ))}
        {[104, 112].map((y, i) => (
          <line key={i} x1="4" y1={y} x2="74" y2={y} stroke={tileShade} strokeWidth="0.5" opacity="0.5" />
        ))}
        {[104, 112].map((y, i) => (
          <line key={i} x1="286" y1={y} x2="356" y2={y} stroke={tileShade} strokeWidth="0.5" opacity="0.5" />
        ))}
        {/* central pediment / dormer */}
        <rect x="150" y="60" width="60" height="34" fill={wall} stroke={trim} strokeWidth="1.2" />
        <path d="M148 60 L180 38 L212 60 Z" fill={tile} stroke={trim} strokeWidth="1.2" />
        {/* dormer windows (two arched) */}
        <path d="M158 70 v18 h12 v-18 a6 6 0 0 0 -12 0 z" fill="#2f6a5a" stroke={trim} strokeWidth="0.8" />
        <path d="M190 70 v18 h12 v-18 a6 6 0 0 0 -12 0 z" fill="#2f6a5a" stroke={trim} strokeWidth="0.8" />
        <line x1="164" y1="70" x2="164" y2="88" stroke={trim} strokeWidth="0.5" />
        <line x1="196" y1="70" x2="196" y2="88" stroke={trim} strokeWidth="0.5" />
        {/* balcony rail under dormer */}
        <line x1="148" y1="94" x2="212" y2="94" stroke={trim} strokeWidth="1.2" />
        {[150,158,166,174,182,190,198,206].map((x,i)=>(
          <line key={i} x1={x} y1="94" x2={x} y2="100" stroke={trim} strokeWidth="0.6" />
        ))}
        {/* chimneys */}
        <rect x="124" y="56" width="8" height="14" fill={chimney} stroke={trim} strokeWidth="0.8" />
        <rect x="228" y="56" width="8" height="14" fill={chimney} stroke={trim} strokeWidth="0.8" />
        {/* portico — four columns flanking the door */}
        {[152, 168, 192, 208].map((x, i) => (
          <rect key={i} x={x} y="122" width="4" height="46" fill={wall} stroke={trim} strokeWidth="0.6" />
        ))}
        {/* portico entablature */}
        <rect x="146" y="116" width="70" height="6" fill={wall} stroke={trim} strokeWidth="0.8" />
        {/* red door (between the two inner columns) */}
        <rect x="173" y="134" width="14" height="34" fill={door} stroke={trim} strokeWidth="1" />
        <line x1="180" y1="134" x2="180" y2="168" stroke={trim} strokeWidth="0.5" />
        <circle cx="184" cy="152" r="0.8" fill="#f7d635" />
        {/* ground-floor windows — three left of portico, three right, no overlap with columns */}
        {[
          { x: 86 }, { x: 106 }, { x: 126 },
          { x: 220 }, { x: 240 }, { x: 260 }
        ].map((w, i) => (
          <g key={i}>
            <rect x={w.x} y="122" width="14" height="22" fill="#2f6a5a" stroke={trim} strokeWidth="0.8" />
            <line x1={w.x + 7} y1="122" x2={w.x + 7} y2="144" stroke={trim} strokeWidth="0.4" />
            <line x1={w.x} y1="133" x2={w.x + 14} y2="133" stroke={trim} strokeWidth="0.4" />
          </g>
        ))}
        {/* side wing windows — two each, breathing room */}
        {[16, 46, 298, 328].map((x, i) => (
          <g key={i}>
            <rect x={x} y="138" width="12" height="20" fill="#2f6a5a" stroke={trim} strokeWidth="0.7" />
            <line x1={x + 6} y1="138" x2={x + 6} y2="158" stroke={trim} strokeWidth="0.4" />
          </g>
        ))}
        {/* fountain in front */}
        <rect x="176" y="170" width="8" height="6" fill={chimney} stroke={trim} strokeWidth="0.6" />
        <circle cx="180" cy="170" r="3" fill={chimney} stroke={trim} strokeWidth="0.6" />
        {/* shrubs / hedge boxes — sit between windows, not in front of them */}
        {[100, 144, 214, 258].map((x, i) => (
          <ellipse key={i} cx={x} cy="172" rx="7" ry="4" fill={garden} />
        ))}
        {/* flower urns flanking portico */}
        <g>
          <path d="M140 162 l8 0 l-2 8 l-4 0 z" fill={chimney} stroke={trim} strokeWidth="0.6" />
          <ellipse cx="144" cy="160" rx="6" ry="4" fill={door} />
          <path d="M212 162 l8 0 l-2 8 l-4 0 z" fill={chimney} stroke={trim} strokeWidth="0.6" />
          <ellipse cx="216" cy="160" rx="6" ry="4" fill={door} />
        </g>
        {/* picket fence */}
        <g stroke={trim} strokeWidth="0.7">
          {Array.from({ length: 14 }).map((_, i) => {
            const x = 4 + i*9;
            return <g key={`l${i}`}>
              <rect x={x} y="172" width="3" height="14" fill={wall} />
              <path d={`M${x} 172 l1.5 -2 l1.5 2 z`} fill={wall} />
            </g>;
          })}
          {Array.from({ length: 14 }).map((_, i) => {
            const x = 230 + i*9;
            return <g key={`r${i}`}>
              <rect x={x} y="172" width="3" height="14" fill={wall} />
              <path d={`M${x} 172 l1.5 -2 l1.5 2 z`} fill={wall} />
            </g>;
          })}
          <line x1="4" y1="178" x2="135" y2="178" />
          <line x1="225" y1="178" x2="356" y2="178" />
        </g>
        {/* hand-lettered sign on cream banner across pediment top */}
        <text x="180" y="46" textAnchor="middle" fontFamily="Playfair Display, serif" fontStyle="italic" fontWeight="600" fontSize="9" letterSpacing="1.5" fill={ink}>HÔTEL ÖSTERLEN</text>
      </g>
    </svg>);

}

// --- Section header (chapter tag + title + ornament) ---
function SectionHead({ num, kicker, title, italicTitle, sub }) {
  return (
    <div className="section-head">
      <div className="divider-rule">
        <div className="seg thin"></div>
        <span className="star">✦</span>
        <span className="roman">DEL {num}</span>
        <span className="star">✦</span>
        <div className="seg thin"></div>
      </div>
      <div className="chapter-tag">{kicker}</div>
      <h2 className="section-title">
        {title} {italicTitle && <em>{italicTitle}</em>}
      </h2>
      {sub && <p className="section-sub">{sub}</p>}
      <div className="ornament">
        <div className="line"></div>
        <div className="diamond"></div>
        <div className="dot"></div>
        <div className="diamond"></div>
        <div className="line"></div>
      </div>
    </div>);

}

// --- Countdown ---
function Countdown() {
  useContentTick();
  const target = new Date(getC().date?.iso || WEDDING_DATE).getTime();
  const [now, setNow] = React.useState(Date.now());
  React.useEffect(() => {
    const id = setInterval(() => setNow(Date.now()), 1000);
    return () => clearInterval(id);
  }, []);
  const diff = Math.max(0, target - now);
  const d = Math.floor(diff / 86400000);
  const h = Math.floor(diff % 86400000 / 3600000);
  const m = Math.floor(diff % 3600000 / 60000);
  const s = Math.floor(diff % 60000 / 1000);
  const cells = [
  { n: d, l: 'Dagar' },
  { n: h, l: 'Timmar' },
  { n: m, l: 'Minuter' },
  { n: s, l: 'Sekunder' }];

  return (
    <div className="countdown" aria-label="Nedräkning till bröllopsdagen">
      {cells.map((c, i) =>
      <div className="cell" key={i}>
          <span className="num">{String(c.n).padStart(2, '0')}</span>
          <span className="lbl">{c.l}</span>
        </div>
      )}
    </div>);

}

// --- Hero ---
function Hero() {
  useContentTick();
  const c = getC();
  const h = c.hero || {};
  return (
    <section id="hem" className="hero" data-screen-label="01 Hem">
      <div className="container">
        <HotelFacade />
        <div className="hero-frame">
          <span className="hero-corner tl"></span>
          <span className="hero-corner tr"></span>
          <span className="hero-corner bl"></span>
          <span className="hero-corner br"></span>
          <div className="hero-eyebrow">
            <span>{h.eyebrow || 'En liten tillställning · Lördag den 15 augusti · Anno 2026'}</span>
          </div>
          <Crest />
          <h1 className="hero-names">
            {h.coupleA || 'Kajsa'}<span className="amp">&amp;</span>
            <span className="second">{h.coupleB || 'Axel'}</span>
          </h1>
          <div className="hero-meta">
            <div className="l">{h.ceremony || 'Vigsel kl. 15.00'}</div>
            <div className="c">— {h.tagline || 'gifter sig på Österlen'} —</div>
            <div className="r">{h.after || 'Middag & dans följer'}</div>
          </div>
        </div>
        <Countdown />
        <div className="hero-stamps-row" style={{ display: 'flex', justifyContent: 'center', gap: 18, marginTop: 36 }}>
          <span className="stamp">{h.stamp1 || 'Var god OSA före 15 juni'}</span>
          <span className="stamp tilt-r" style={{ color: 'var(--sage-deep)' }}>{h.stamp2 || 'Hjärtligt välkomna'}</span>
        </div>
      </div>
    </section>);

}

// --- Program ---
const PROGRAM = [
{ time: '14.30', what: 'Ankomst', sub: 'Mingel med bubbel & saft i trädgården', where: 'Stenladan' },
{ time: '15.00', what: 'Vigsel', sub: 'Borgerlig ceremoni under äppelträden', where: 'Trädgården' },
{ time: '16.00', what: 'Gruppfoto & fördrink', sub: 'För den som vill — eller bara vill ha en till bubbel', where: 'Allén' },
{ time: '17.30', what: 'Bröllopsmiddag', sub: 'Tre rätter från trakten, tal & sång', where: 'Logen' },
{ time: '21.00', what: 'Tårta & kaffe', sub: 'Och möjligen ett glas calvados', where: 'Logen' },
{ time: '22.00', what: 'Dans till smått omöjliga timmar', sub: 'Live-band följt av DJ Farbror Bertil', where: 'Logen' },
{ time: '01.00', what: 'Nattamat & farväl', sub: 'Korv med bröd för de modiga', where: 'Köksingången' }];


function Program() {
  useContentTick();
  const items = getC().program || PROGRAM;
  return (
    <section id="program" data-screen-label="02 Program">
      <div className="container">
        <SectionHead num="II" kicker="Schema för dagen" title="Dagens" italicTitle="program" sub="Tider är ungefärliga och föremål för spontan glädje." />
        <div className="program-list">
          {items.map((p, i) =>
          <div className="program-row" key={i}>
              <div className="time">{p.time}</div>
              <div className="what">
                {p.what}
                <em>{p.sub}</em>
              </div>
              <div className="where">{p.where}</div>
            </div>
          )}
        </div>
      </div>
    </section>);

}

// --- Map (illustrated SVG placeholder) ---
function MapSVG() {
  return (
    <svg className="map-svg" viewBox="0 0 800 440" xmlns="http://www.w3.org/2000/svg">
      {/* Sea */}
      <rect x="0" y="0" width="800" height="440" fill="#e6a72c" />
      <rect x="520" y="0" width="280" height="440" fill="#2f6a5a" />
      {/* coastline curves */}
      <path d="M520,0 C500,80 540,140 510,220 C480,300 540,360 520,440" fill="none" stroke="#2a1c0a" strokeWidth="1.5" />
      {/* fields */}
      <path d="M0,0 L520,0 C500,80 540,140 510,220 C480,300 540,360 520,440 L0,440 Z" fill="#f0c14a" />
      {/* field stripes */}
      {Array.from({ length: 12 }).map((_, i) =>
      <line key={i} x1="0" y1={40 + i * 32} x2="500" y2={50 + i * 32} stroke="#a8431f" strokeWidth="0.8" opacity="0.5" />
      )}
      {/* hills */}
      <ellipse cx="180" cy="320" rx="120" ry="22" fill="#2f6a5a" opacity="0.6" />
      <ellipse cx="350" cy="280" rx="140" ry="26" fill="#2f6a5a" opacity="0.5" />
      {/* trees */}
      {[[80, 180], [140, 200], [110, 360], [260, 150], [300, 360], [420, 310]].map(([cx, cy], i) =>
      <g key={i}>
          <circle cx={cx} cy={cy} r="9" fill="#1f4a3e" />
          <line x1={cx} y1={cy + 4} x2={cx} y2={cy + 18} stroke="#2a1c0a" strokeWidth="1.2" />
        </g>
      )}
      {/* roads */}
      <path d="M40,420 Q200,300 320,260 T520,140" fill="none" stroke="#2a1c0a" strokeWidth="1.2" strokeDasharray="4 4" />
      <path d="M180,420 Q260,360 360,320 T520,300" fill="none" stroke="#2a1c0a" strokeWidth="1.2" strokeDasharray="4 4" />
      {/* compass */}
      <g transform="translate(720,60)">
        <circle r="22" fill="#f0c14a" stroke="#2a1c0a" strokeWidth="1.2" />
        <polygon points="0,-18 4,0 0,18 -4,0" fill="#a8431f" />
        <text y="-26" textAnchor="middle" fontFamily="JetBrains Mono, monospace" fontSize="9" fill="#2a1c0a" letterSpacing="2">N</text>
      </g>
      {/* pins */}
      <Pin x={300} y={260} color="#a8431f" label="Stenladan" sub="Vigsel & fest" />
      <Pin x={150} y={170} color="#f7d635" label="Kivik Pensionat" sub="Boende A" />
      <Pin x={420} y={210} color="#2f6a5a" label="Simrishamn" sub="Boende B" />
      <Pin x={240} y={380} color="#2a1c0a" label="Tåg: Tomelilla" sub="Skjuts ordnas" />
      {/* fish doodle — swimming */}
      <g className="fish-swim" opacity="0.5">
        <path d="M0,0 q12,-10 24,0 q-12,10 -24,0 z" fill="#2a1c0a" />
        <path d="M24,0 l8,-6 l0,12 z" fill="#2a1c0a" />
      </g>
      {/* dotted sea waves — drifting */}
      {Array.from({ length: 6 }).map((_, i) =>
      <path key={i} className={`wave wave-${i % 3}`} d={`M540,${60 + i * 60} q10,-6 20,0 t20,0 t20,0 t20,0 t20,0 t20,0 t20,0`} fill="none" stroke="#2a1c0a" strokeWidth="0.8" opacity="0.4" />
      )}
    </svg>);

}

function Pin({ x, y, color, label, sub }) {
  return (
    <g transform={`translate(${x},${y})`}>
      <circle r="9" fill={color} stroke="#2a1c0a" strokeWidth="1.5" />
      <circle r="3" fill="#f6e6b8" />
      <g transform="translate(14,-2)">
        <text fontFamily="Playfair Display, serif" fontStyle="italic" fontSize="14" fill="#2a1c0a">{label}</text>
        <text y="14" fontFamily="JetBrains Mono, monospace" fontSize="8" fill="#5a4322" letterSpacing="1.2">{sub.toUpperCase()}</text>
      </g>
    </g>);

}

function Plats() {
  return (
    <section id="plats" data-screen-label="03 Plats">
      <div className="container">
        <SectionHead num="III" kicker="Plats & resa" title="Vägen till" italicTitle="Österlen" sub="En dryg timme från Köpenhamn, lite längre från resten — och alldeles värt det." />
        <div className="map-wrap">
          <MapSVG />
          <div className="map-legend">
            <div className="item"><span className="pin" style={{ background: '#a8431f' }}></span>Festplats</div>
            <div className="item"><span className="pin" style={{ background: '#f7d635' }}></span>Boende A</div>
            <div className="item"><span className="pin" style={{ background: '#1f4a3e' }}></span>Boende B</div>
            <div className="item"><span className="pin" style={{ background: '#2a1c0a' }}></span>Tågstation</div>
          </div>
        </div>
        <div className="cols" style={{ marginTop: 48 }}>
          <div className="info-card">
            <span className="num">01 — Med bil</span>
            <h3>Genom rapsfält</h3>
            <p>E22 söderut till Tomelilla, sedan väg 11 mot Simrishamn. Cirka 1 t 20 min från Malmö, 1 t 40 min från Köpenhamn.</p>
            <p>Fri parkering på ängen vid Stenladan. Följ skyltarna med <em>K&amp;A</em>.</p>
          </div>
          <div className="info-card">
            <span className="num">02 — Med tåg</span>
            <h3>Pågatåg & skjuts</h3>
            <p>Pågatåget går från Malmö till Tomelilla. Vi ordnar gratis skjuts från stationen kl. 13.30 och 14.15.</p>
            <p>Bocka i rutan i OSA-formuläret så vet vi att vi väntar på er.</p>
            <span className="tag">Skjuts ordnas</span>
          </div>
        </div>
      </div>
    </section>);

}

// --- Boende ---
function Boende() {
  useContentTick();
  const places = getC().boende || [
  { tag: 'A', name: 'Kivik Pensionat', meta: '10 minuter med bil', body: 'Charmig pension i gamla Kivik. Vi har förbokat 12 rum till rabatterat pris — uppge "Bröllop K&A" vid bokning.', price: 'Från 1 450 kr/natt' },
  { tag: 'B', name: 'Hotell Svea, Simrishamn', meta: '20 minuter med bil', body: 'Klassiskt sjöhotell vid hamnen. Trevligt promenadläge och frukost med utsikt över Östersjön.', price: 'Från 1 890 kr/natt' },
  { tag: 'C', name: 'Vandrarhem & stugor', meta: '5 minuter till fots', body: 'Enklare stugor på gården intill — perfekta för gänget som ändå tänker stanna länge på dansgolvet.', price: 'Från 590 kr/natt' }];

  return (
    <section id="boende" data-screen-label="04 Boende">
      <div className="container">
        <SectionHead num="IV" kicker="Var ska vi sova?" title="Tre" italicTitle="förslag" sub="Vi har förbokat rum hos följande — först till kvarn." />
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24, maxWidth: 1000, margin: '0 auto' }} className="boende-grid">
          {places.map((p, i) =>
          <div className="info-card" key={i}>
              <span className="num">Alternativ {p.tag}</span>
              <h3>{p.name}</h3>
              <p style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--terra)' }}>{p.meta}</p>
              <p>{p.body}</p>
              <span className="tag">{p.price}</span>
            </div>
          )}
        </div>
        <style>{`@media (max-width: 880px) { .boende-grid { grid-template-columns: 1fr !important; } }`}</style>
      </div>
    </section>);

}

// --- Klädkod ---
function Kladkod() {
  useContentTick();
  const d = getC().dress || {};
  const swatches = (d.swatches && d.swatches.length) ? d.swatches : [
    { color: '#7a8a6a', label: 'Salviagrön' },
    { color: '#d4a04a', label: 'Senap' },
    { color: '#8a4a3a', label: 'Terrakotta' },
    { color: '#cfc3a3', label: 'Linnesand' },
    { color: '#3a4a5a', label: 'Havsblå' },
  ];
  return (
    <section id="kladkod" data-screen-label="05 Klädkod">
      <div className="container">
        <SectionHead num="V" kicker="Vad ska man ha på sig?" title={d.title || 'Klädkod:'} italicTitle={d.italicTitle || 'kavaj'} />
        <div className="dress">
          <p className="dress-quote">
            {d.quote || '"Klä er som om ni vore på väg till en sommarpicknick — men en alldeles särskilt fin sådan."'}
          </p>
          <p style={{ color: 'var(--ink-soft)', fontSize: 17, maxWidth: 540, margin: '0 auto' }}>
            {d.body || 'Kavaj för herrar, klänning eller dräkt för damer. Bekväma skor rekommenderas — gräsmatta, grus och dans väntar. Färgskalan nedan är ett varmt förslag, ingen lag.'}
          </p>
          <div className="dress-swatches">
            {swatches.map((s, i) => (
              <div className="swatch" key={i}><div className="chip" style={{ background: s.color }}></div>{s.label}</div>
            ))}
          </div>
          {(d.footer || 'Undvik gärna helvitt · brudens privilegium') && (
            <p style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--ink-soft)', marginTop: 24 }}>
              {d.footer || 'Undvik gärna helvitt · brudens privilegium'}
            </p>
          )}
        </div>
      </div>
    </section>);

}

// --- Presenter / Gifts ---
function Presenter() {
  useContentTick();
  const p = getC().presenter || {};
  const titleLines = (p.mendlsTitle || 'Smekmånads-\nkassan').split('\n');
  return (
    <section id="presenter" data-screen-label="06 Presenter">
      <div className="container">
        <SectionHead num="VI" kicker={p.kicker || 'Önskelista'} title={p.title || 'En liten'} italicTitle={p.italicTitle || 'bröllopspresent'} sub={p.sub || 'Er närvaro är den finaste presenten. Men för den som ändå vill skänka något:'} />
        <div className="gifts">
          <div className="mendls-box">
            <div className="mendls-inner">
              <div className="mendls-label">{p.mendlsLabel || "— Mendl's patisserie —"}</div>
              <h3 className="mendls-title">
                {titleLines.map((line, i) => (
                  <React.Fragment key={i}>{line}{i < titleLines.length - 1 && <br />}</React.Fragment>
                ))}
              </h3>
              <div className="mendls-sub">{p.mendlsSub || 'à la maison K&A'}</div>
              <div className="mendls-row">
                <div className="col">
                  <span className="lbl">Mottagare</span>
                  <span className="val">{p.receiver || 'Kajsa & Axel'}</span>
                </div>
                <div className="col">
                  <span className="lbl">Swish</span>
                  <span className="val">{p.swish || '073 — 123 45 67'}</span>
                </div>
              </div>
            </div>
          </div>
          {p.footnote && (
            <p style={{ marginTop: 28, color: 'var(--ink-soft)', fontStyle: 'italic' }}>
              {p.footnote}
            </p>
          )}
        </div>
      </div>
    </section>);

}

// --- Under construction (small screen) ---
function UnderConstruction() {
  useContentTick();
  const c = getC();
  const u = c.construction || {};
  return (
    <div className="mini-screen mini-construction" data-screen-label="Under konstruktion">
      <div className="mini-frame">
        <span className="hero-corner tl"></span>
        <span className="hero-corner tr"></span>
        <span className="hero-corner bl"></span>
        <span className="hero-corner br"></span>

        <div className="mini-eyebrow">
          <span>{u.eyebrow || 'Hôtel Österlen · Anno MMXXVI'}</span>
        </div>

        <Crest top={u.crestTop} year={u.crestYear} sub={u.crestSub} />

        <div className="mini-construction-art" aria-hidden="true">
          <svg viewBox="0 0 220 80" xmlns="http://www.w3.org/2000/svg">
            {/* sawhorse + plank */}
            <line x1="20" y1="60" x2="40" y2="30" stroke="var(--ink)" strokeWidth="2" />
            <line x1="40" y1="30" x2="60" y2="60" stroke="var(--ink)" strokeWidth="2" />
            <line x1="160" y1="60" x2="180" y2="30" stroke="var(--ink)" strokeWidth="2" />
            <line x1="180" y1="30" x2="200" y2="60" stroke="var(--ink)" strokeWidth="2" />
            <rect x="20" y="22" width="180" height="10" fill="var(--oxblood)" stroke="var(--ink)" strokeWidth="1.5" />
            {/* striped barricade legs */}
            <g stroke="var(--paper)" strokeWidth="1.6">
              {Array.from({length:9}).map((_,i)=> <line key={i} x1={28+i*20} y1="22" x2={36+i*20} y2="32" />)}
            </g>
            {/* hammer */}
            <g transform="translate(95 8) rotate(-18)">
              <rect x="0" y="0" width="22" height="9" fill="var(--ink)" stroke="var(--ink)" strokeWidth="0.6" />
              <rect x="9" y="9" width="3" height="22" fill="var(--gold-deep)" stroke="var(--ink)" strokeWidth="0.6" />
            </g>
            {/* ladder */}
            <g stroke="var(--ink)" strokeWidth="1.4" fill="none">
              <line x1="78" y1="60" x2="92" y2="14" />
              <line x1="92" y1="60" x2="106" y2="14" />
              {[22,32,42,52].map((y,i)=> <line key={i} x1={84-(y-14)*0.06} y1={y} x2={100+(y-14)*0.06} y2={y} />)}
            </g>
          </svg>
        </div>

        <h1 className="mini-title">
          {u.title || 'Snart'} {u.italicTitle && <em>{u.italicTitle}</em>}
        </h1>
        {u.sub && <p className="mini-sub">{u.sub}</p>}

        <div className="ornament" style={{ marginTop: 28 }}>
          <div className="line"></div>
          <div className="diamond"></div>
          <div className="dot"></div>
          <div className="diamond"></div>
          <div className="line"></div>
        </div>

        <div className="mini-stamp-row">
          <span className="stamp tilt-l">{u.stamp || 'Under konstruktion'}</span>
        </div>
      </div>
    </div>
  );
}

// --- Save the date (small screen) ---
function SaveTheDate() {
  useContentTick();
  const c = getC();
  const s = c.saveTheDate || {};
  const dStamp = c.date?.stamp || '15 · VIII · MMXXVI';
  const dDisplay = c.date?.display || '15 augusti 2026';
  // Split display into day / month / year roughly
  const m = (dDisplay || '').match(/^(\d+)\s+(\S+)\s+(\d+)/);
  const day = m ? m[1] : '15';
  const month = m ? m[2] : 'augusti';
  const year = m ? m[3] : '2026';
  return (
    <div className="mini-screen mini-savedate" data-screen-label="Save the date">
      <div className="mini-frame">
        <span className="hero-corner tl"></span>
        <span className="hero-corner tr"></span>
        <span className="hero-corner bl"></span>
        <span className="hero-corner br"></span>

        <div className="mini-eyebrow">
          <span>{s.eyebrow || 'Save the date'}</span>
        </div>

        <Crest />

        <h1 className="mini-names">
          {s.coupleA || 'Kajsa'}<span className="amp">&amp;</span>
          <span className="second">{s.coupleB || 'Axel'}</span>
        </h1>

        <div className="mini-tagline">— {s.tagline || 'gifter sig'} —</div>

        <div className="big-date">
          <div className="bd-col">
            <span className="bd-lbl">Anno</span>
            <span className="bd-val">{year}</span>
          </div>
          <div className="bd-col bd-day">
            <span className="bd-lbl">Den</span>
            <span className="bd-val bd-day-num">{day}</span>
            <span className="bd-month">{month}</span>
          </div>
          <div className="bd-col">
            <span className="bd-lbl">Roman.</span>
            <span className="bd-val">{dStamp.split('·')[1]?.trim() || 'VIII'}</span>
          </div>
        </div>

        <div className="ornament" style={{ marginTop: 4, marginBottom: 24 }}>
          <div className="line"></div>
          <div className="diamond"></div>
          <div className="dot"></div>
          <div className="diamond"></div>
          <div className="line"></div>
        </div>

        <div className="mini-location">{s.location || 'Stenladan, Kivik · Österlen'}</div>

        <Countdown />

        <div className="mini-stamp-row">
          <span className="stamp">{s.footnote || 'Inbjudan & detaljer följer'}</span>
        </div>
      </div>

      <div className="mini-foot">
        <span>Hôtel Österlen</span>
        <span className="dot-sep">·</span>
        <span>{dStamp}</span>
      </div>
    </div>
  );
}

Object.assign(window, {
  SECTIONS, WEDDING_DATE,
  Crest, HotelFacade, SectionHead, Countdown,
  Hero, Program, Plats, Boende, Kladkod, Presenter,
  UnderConstruction, SaveTheDate
});