/* TischTap Brand Guidelines — section components. Uses logo.jsx globals. */

const Head = ({ num, title, sub }) => (
  <React.Fragment>
    <div className="bb-top"><span className="bb-eyebrow">TischTap</span><span className="bb-num">{num}</span></div>
    <div className="bb-rule" />
    <h2 className="bb-h">{title}</h2>
    {sub && <p className="bb-sub">{sub}</p>}
  </React.Fragment>
);

function CoverSection() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', height: '100%', flex: 1 }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
        <span style={{ font: '700 14px/1 var(--tt-font-display)', letterSpacing: '0.16em', textTransform: 'uppercase', color: 'rgba(255,255,255,0.85)' }}>Brand Guidelines</span>
        <span style={{ font: '600 13px/1 var(--tt-font-display)', color: 'rgba(255,255,255,0.7)' }}>Essentials · v1.0</span>
      </div>
      <div style={{ height: 2, background: 'rgba(255,255,255,0.5)', margin: '14px 0 0' }} />
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 30, padding: '40px 0' }}>
        <LockupV scale={2.1} dark />
      </div>
      <div>
        <p style={{ font: '500 26px/1.3 var(--tt-font-display)', color: '#fff', margin: '0 0 6px', maxWidth: 560 }}>
          Mehr Umsatz für Restaurants — mit einem einfachen Scan.
        </p>
        <p style={{ font: 'var(--tt-text-body)', color: 'rgba(255,255,255,0.85)', margin: 0 }}>
          Logo · Color · Typography · Voice — the essentials for building on brand.
        </p>
      </div>
    </div>
  );
}

function LogoSection() {
  return (
    <React.Fragment>
      <Head num="01 · Logo" title="The logo" sub="The folded tabletop stand — the product itself, seen in perspective. Its leaning face carries the tap-dot above three menu lines; a rear easel leg gives it depth. One color, infinitely scalable." />
      <div className="bb-show bb-show--soft" style={{ minHeight: 200 }}><LockupH scale={2.4} /></div>
      <p className="bb-cap">Primary lockup — horizontal.</p>

      <div className="bb-eh">Lockups & elements</div>
      <div className="bb-grid3">
        <div><div className="bb-show"><LockupV scale={1.15} /></div><p className="bb-cap">Stacked — vertical contexts.</p></div>
        <div><div className="bb-show"><Logomark size={92} /></div><p className="bb-cap">Mark — the table stand.</p></div>
        <div><div className="bb-show bb-show--soft" style={{ gap: 18 }}><LogoIcon size={74} /><LogoTile size={74} /></div><p className="bb-cap">App icon (circle / tile).</p></div>
      </div>
    </React.Fragment>
  );
}

function UsageSection() {
  const wrong = { display: 'inline-flex', alignItems: 'center', justifyContent: 'center' };
  return (
    <React.Fragment>
      <Head num="02 · Logo Usage" title="Using the logo" sub="Give it room, keep it red, and never redraw it." />
      <div className="bb-grid2">
        <div>
          <div className="bb-eh" style={{ marginTop: 0 }}>Clear space</div>
          <div className="bb-show"><span style={{ outline: '1px dashed var(--tt-red-line)', padding: 30 }}><Logomark size={70} /></span></div>
          <p className="bb-cap">Keep clear space ≥ the height of the tap-dot on every side.</p>
        </div>
        <div>
          <div className="bb-eh" style={{ marginTop: 0 }}>Minimum size</div>
          <div className="bb-show" style={{ gap: 28 }}>
            <span style={{ textAlign: 'center' }}><Logomark size={26} /><div className="bb-cap">mark · 24px</div></span>
            <span style={{ textAlign: 'center' }}><LogoIcon size={22} /><div className="bb-cap">icon · 16px</div></span>
          </div>
          <p className="bb-cap">Below these sizes the menu lines close up — switch to the simplified mark.</p>
        </div>
      </div>

      <div className="bb-eh">Color variants</div>
      <div className="bb-grid3">
        <div><div className="bb-show"><Logomark size={70} /></div><p className="bb-cap">Red on light.</p></div>
        <div><div className="bb-show bb-show--red"><Logomark size={70} reversed /></div><p className="bb-cap">Reversed (white) on red.</p></div>
        <div><div className="bb-show" style={{ color: 'var(--tt-ink)' }}><Logomark size={70} color="var(--tt-ink)" /></div><p className="bb-cap">Ink — single-color / mono.</p></div>
      </div>

      <div className="bb-eh">Don’t</div>
      <div className="bb-grid2">
        <div className="dd dd--dont"><div className="frame"><span style={{ transform: 'scaleX(1.7)', ...wrong }}><Logomark size={56} /></span></div><div className="lbl"><span className="ic">✕</span> Don’t stretch or distort.</div></div>
        <div className="dd dd--dont"><div className="frame"><span style={wrong}><Logomark size={56} color="#2A6FDB" /></span></div><div className="lbl"><span className="ic">✕</span> Don’t recolor the mark.</div></div>
        <div className="dd dd--dont"><div className="frame"><span style={{ transform: 'rotate(-14deg)', ...wrong }}><Logomark size={56} /></span></div><div className="lbl"><span className="ic">✕</span> Don’t rotate or tilt.</div></div>
        <div className="dd dd--dont"><div className="frame"><span style={{ filter: 'drop-shadow(3px 4px 3px rgba(0,0,0,.4))', ...wrong }}><Logomark size={56} /></span></div><div className="lbl"><span className="ic">✕</span> Don’t add shadows or effects.</div></div>
      </div>
    </React.Fragment>
  );
}

function Swatch({ fill, nm, hex, on = '#fff', sub }) {
  return (
    <div className="sw">
      <div className="fill" style={{ background: fill }} />
      <div className="meta"><div className="nm">{nm}</div><div className="vals">{hex}{sub ? ' · ' + sub : ''}</div></div>
    </div>
  );
}
function ColorSection() {
  return (
    <React.Fragment>
      <Head num="03 · Color" title="Color" sub="One accent does the work. Brick red on white — confident, warm, unmistakably TischTap. No gradients, no second hue." />
      <div className="bb-grid2">
        <div className="sw"><div className="fill" style={{ background: 'var(--tt-red)', height: 200, display: 'flex', alignItems: 'flex-end', padding: 18 }}><span style={{ color: '#fff', font: '700 18px/1 var(--tt-font-display)' }}>Brand Red</span></div><div className="meta"><div className="vals" style={{ fontSize: 13 }}>HEX #AB1E03 · RGB 171 30 3 · the single accent</div></div></div>
        <div style={{ display: 'grid', gridTemplateRows: '1fr 1fr', gap: 18 }}>
          <Swatch fill="var(--tt-red-bright)" nm="Bright" hex="#C0290A" sub="large headers" />
          <Swatch fill="var(--tt-red-deep)" nm="Deep" hex="#8E1802" sub="pressed / hover" />
        </div>
      </div>
      <div className="bb-eh">Neutrals</div>
      <div className="bb-grid3">
        <Swatch fill="var(--tt-ink)" nm="Ink" hex="#2A2724" sub="body text" />
        <Swatch fill="var(--tt-ink-2)" nm="Ink 2" hex="#5E5853" sub="secondary" />
        <Swatch fill="var(--tt-ink-3)" nm="Ink 3" hex="#948D87" sub="tertiary" />
        <Swatch fill="var(--tt-bg-soft)" nm="Soft" hex="#FAF8F6" />
        <Swatch fill="var(--tt-red-tint)" nm="Tint" hex="#FBEFEC" />
        <Swatch fill="#FFFFFF" nm="Surface" hex="#FFFFFF" sub="line #E4E0DC" />
      </div>
    </React.Fragment>
  );
}

function TypeSection() {
  return (
    <React.Fragment>
      <Head num="04 · Typography" title="Typography" sub="One family — Poppins. Heavy weights for headers, regular for body. The weight contrast carries the brand’s friendly-geometric character." />
      <div style={{ border: '1px solid var(--tt-line)', borderRadius: 14, padding: '24px 28px' }}>
        <div className="ty-row"><span className="k">Display · 700</span><span style={{ font: '700 44px/1 var(--tt-font-display)', color: 'var(--tt-red)', letterSpacing: '-0.01em' }}>Tap &amp; Scan</span></div>
        <div className="ty-row"><span className="k">H2 · 700</span><span style={{ font: '700 30px/1 var(--tt-font-display)' }}>Was ist enthalten</span></div>
        <div className="ty-row"><span className="k">Lead · 400</span><span style={{ font: '400 22px/1.3 var(--tt-font-body)', color: 'var(--tt-ink-2)' }}>Mehr Umsatz mit einem Scan</span></div>
        <div className="ty-row"><span className="k">Body · 400</span><span style={{ font: '400 17px/1.4 var(--tt-font-body)' }}>Schnellere Bestellungen, mehr Bewertungen, weniger Aufwand.</span></div>
        <div className="ty-row" style={{ borderBottom: 0 }}><span className="k">Caption · 500</span><span style={{ font: '500 13px/1 var(--tt-font-body)', color: 'var(--tt-ink-3)', letterSpacing: '0.02em' }}>INTELLIGENTE QR &amp; NFC-TISCHKARTEN</span></div>
      </div>
      <p className="bb-cap" style={{ marginTop: 14 }}>⚠ Poppins is a stand-in for the deck’s licensed face — swap when the real files arrive.</p>
    </React.Fragment>
  );
}

function VoiceSection() {
  return (
    <React.Fragment>
      <Head num="05 · Voice & Tone" title="Voice & tone" sub="German, professional, benefit-first. We speak to the restaurant owner with respect and sell outcomes — not features." />
      <div className="bb-tags">
        {['Formal “Sie”', 'Benefit-led', 'Plainspoken', 'No emoji', 'Keep English product terms', 'Confident'].map(t => <span key={t} className="bb-tag">{t}</span>)}
      </div>
      <div className="bb-eh">In practice</div>
      <div className="vx">
        <div className="card yes"><div className="tag">✓ On voice</div><p>„Mehr Google-Bewertungen pro Woche — ohne Aufwand für Ihr Team.“</p></div>
        <div className="card no"><div className="tag">✕ Off voice</div><p>„Hol dir jetzt mega viele Reviews!! 🚀🔥“</p></div>
        <div className="card yes"><div className="tag">✓ On voice</div><p>„Keine verpflichtende monatliche Laufzeit.“</p></div>
        <div className="card no"><div className="tag">✕ Off voice</div><p>„Our synergistic platform leverages QR technology.“</p></div>
      </div>
      <p className="bb-p" style={{ marginTop: 20 }}><b>Casing:</b> ALL-CAPS letter-spaced eyebrow (TISCHTAP); Title-case headers and chips; German noun capitalization throughout. <b>Numbers:</b> „150 €“, „1.600 € / 1 Jahre“ — period thousands separator, space before €.</p>
    </React.Fragment>
  );
}

function Ring({ size = 70 }) {
  return (
    <span style={{ position: 'relative', width: size, height: size, display: 'inline-block' }}>
      <span style={{ position: 'absolute', inset: 0, border: `${size * 0.11}px solid var(--tt-red)`, borderRadius: '50%' }} />
      <span style={{ position: 'absolute', inset: size * 0.3, background: 'var(--tt-red)', borderRadius: '50%' }} />
    </span>
  );
}
function MotifSection() {
  return (
    <React.Fragment>
      <Head num="06 · Motif & Layout" title="Motif & layout" sub="Beyond the logo, two devices signal the brand: the tap-target and the framed page." />
      <div className="bb-grid2">
        <div>
          <div className="bb-eh" style={{ marginTop: 0 }}>The tap-target</div>
          <div className="bb-show" style={{ gap: 34 }}>
            <Ring size={76} />
            <span style={{ position: 'relative', width: 90, height: 90, display: 'inline-block' }}>
              <span style={{ position: 'absolute', inset: 0, border: '5px solid var(--tt-red)', borderRadius: '50%', opacity: 0.35 }} />
              <span style={{ position: 'absolute', inset: 18, border: '5px solid var(--tt-red)', borderRadius: '50%', opacity: 0.7 }} />
              <span style={{ position: 'absolute', inset: 36, background: 'var(--tt-red)', borderRadius: '50%' }} />
            </span>
          </div>
          <p className="bb-cap">Ring + dot, or concentric ripple. A scan/tap signal — for accents, never as the logo.</p>
        </div>
        <div>
          <div className="bb-eh" style={{ marginTop: 0 }}>The framed page</div>
          <div className="bb-show" style={{ flexDirection: 'column', alignItems: 'stretch', padding: 22 }}>
            <div style={{ display: 'flex', justifyContent: 'flex-end' }}><span className="bb-eyebrow">TischTap</span></div>
            <div className="bb-rule" style={{ marginTop: 6 }} />
            <div style={{ font: '700 22px/1 var(--tt-font-display)', color: 'var(--tt-red)', margin: '20px 0' }}>Preise</div>
            <div className="bb-rule" />
          </div>
          <p className="bb-cap">Every page: red rule top &amp; bottom, eyebrow top-right, generous white margins.</p>
        </div>
      </div>
      <div style={{ marginTop: 34, display: 'flex', alignItems: 'center', gap: 16 }}>
        <Logomark size={40} />
        <span className="bb-p" style={{ color: 'var(--tt-ink-2)' }}>Full system, tokens & UI kits live in the design system — this book is the essentials.</span>
      </div>
    </React.Fragment>
  );
}

Object.assign(window, { CoverSection, LogoSection, UsageSection, ColorSection, TypeSection, VoiceSection, MotifSection });
