/* ScriptPop Brand Hub — light-first with dark mode preview */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,700;0,9..40,800;1,9..40,400&family=Space+Mono:wght@400;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F3F3F3;
  --border: #E6E6E6;
  --border-strong: #D4D4D4;
  --text: #0A0A0A;
  --text-muted: #666666;
  --text-faint: #A0A0A0;
  --accent: #FF5A1F;
  --accent-light: #FF8A4C;
  --ink: #0A0A0A;
  --dark-bg: #060606;
  --dark-surface: #111111;
  --dark-text: #F0F0F0;
  --dark-border: #1F1F1F;
}

html, body { background: var(--bg); color: var(--text); font-family: 'DM Sans', -apple-system, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }

.mono { font-family: 'Space Mono', monospace; }

/* ------- Layout ------- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar .brand svg { width: 36px; height: 36px; display: block; }
.sidebar .brand .bname { font-weight: 800; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
.sidebar .brand .bname .pop { color: var(--accent); }
.sidebar .brand .btag { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .nav-label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-faint); padding: 8px 12px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); font-weight: 500; }
.nav a .dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.4; }
.nav a.active .dot { background: var(--accent); opacity: 1; }

.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: 1px; line-height: 1.8; }

/* Main */
.main {
  min-width: 0;
  max-width: 100%;
}

/* Section */
.section { padding: 80px 80px; border-bottom: 1px solid var(--border); scroll-margin-top: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 48px; gap: 32px; flex-wrap: wrap; }
.section-head .label { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; display: block; }
.section-head h2 { font-size: 44px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.05; margin-bottom: 14px; }
.section-head p { font-size: 15px; color: var(--text-muted); max-width: 560px; line-height: 1.6; }

/* Hero */
.hero { padding: 120px 80px 80px; border-bottom: 1px solid var(--border); position: relative; overflow: hidden; }
.hero .kicker { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--accent); margin-bottom: 24px; }
.hero h1 { font-size: clamp(56px, 7vw, 96px); font-weight: 800; letter-spacing: -3px; line-height: 0.95; max-width: 1000px; text-wrap: balance; }
.hero h1 .pop { color: var(--accent); }
.hero .sub { margin-top: 28px; font-size: 18px; line-height: 1.55; color: var(--text-muted); max-width: 620px; text-wrap: pretty; }
.hero .hero-meta { margin-top: 48px; display: flex; gap: 40px; flex-wrap: wrap; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); }
.hero .hero-meta span b { color: var(--text); font-weight: 700; display: block; margin-top: 4px; letter-spacing: 1px; }

/* Mode toggle */
.mode-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  z-index: 50;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.mode-toggle button { background: transparent; border: none; padding: 8px 14px; cursor: pointer; color: var(--text-muted); border-radius: 999px; font-family: inherit; font-size: inherit; letter-spacing: inherit; text-transform: inherit; }
.mode-toggle button.active { background: var(--ink); color: #fff; }

/* Logo grid */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.logo-card {
  background: var(--surface);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}
.logo-card .preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  min-height: 220px;
}
.logo-card .preview.on-dark { background: #060606; }
.logo-card .preview.on-light { background: #FAFAFA; }
.logo-card .preview.on-accent { background: linear-gradient(135deg, #FF5A1F, #FF8A4C, #FFB86B); }
.logo-card .preview svg { max-width: 80%; max-height: 160px; }
.logo-card .preview .label-corner { position: absolute; top: 14px; left: 14px; font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); }
.logo-card .preview.on-dark .label-corner { color: rgba(255,255,255,0.4); }
.logo-card .preview.on-accent .label-corner { color: rgba(255,255,255,0.7); }

.logo-card .meta {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.logo-card .meta .name { font-weight: 600; font-size: 14px; }
.logo-card .meta .dims { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: 1px; }
.logo-card .actions { padding: 12px 20px 18px; display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); background: var(--surface-2); }
.btn-dl {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-dl:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-dl.copy:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Color swatches */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.swatch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.swatch-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.swatch-card .chip { height: 140px; display: flex; align-items: flex-end; padding: 14px 16px; }
.swatch-card .chip .chip-tag { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding: 4px 8px; background: rgba(255,255,255,0.8); border-radius: 3px; color: #0A0A0A; }
.swatch-card .chip.is-dark .chip-tag { background: rgba(0,0,0,0.4); color: #fff; }
.swatch-card .info { padding: 14px 16px 16px; }
.swatch-card .info .sname { font-weight: 700; font-size: 14px; margin-bottom: 4px; letter-spacing: -0.2px; }
.swatch-card .info .scode { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }
.swatch-card .info .svar { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: 0.5px; margin-top: 6px; }
.swatch-card .copy-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; }
.swatch-card.copied .copy-overlay { opacity: 1; }

/* Typography */
.type-stack { display: flex; flex-direction: column; gap: 2px; background: var(--border); border: 1px solid var(--border); }
.type-row { background: var(--surface); padding: 32px 28px; display: grid; grid-template-columns: 180px 1fr 220px; gap: 40px; align-items: center; }
.type-row .specimen { font-size: 56px; line-height: 1; letter-spacing: -1px; }
.type-row .specimen.dm { font-family: 'DM Sans', sans-serif; }
.type-row .specimen.mono { font-family: 'Space Mono', monospace; font-size: 42px; letter-spacing: 0; }
.type-row .label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); }
.type-row .label b { display: block; color: var(--text); font-weight: 700; font-size: 13px; margin-top: 4px; letter-spacing: 1px; }
.type-row .meta { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--text-muted); line-height: 1.7; }

.type-scale { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.scale-cell { background: var(--surface); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.scale-cell .preview { font-family: 'DM Sans', sans-serif; font-weight: 800; letter-spacing: -0.5px; line-height: 1; color: var(--text); }
.scale-cell .tag { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: 1px; text-transform: uppercase; }

.font-link-row { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.font-link-row a { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; border-radius: 6px; transition: all 0.15s ease; }
.font-link-row a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Voice & tone */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.voice-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 28px; }
.voice-card h3 { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.voice-card .quote { font-size: 22px; line-height: 1.35; font-weight: 500; letter-spacing: -0.3px; text-wrap: pretty; }
.voice-card .attrib { margin-top: 14px; font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 2px; color: var(--text-faint); text-transform: uppercase; }

.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); margin-top: 32px; }
.dodont-col { background: var(--surface); padding: 32px; }
.dodont-col .head { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.dodont-col.do .head { color: #0B8A4F; }
.dodont-col.dont .head { color: #C53030; }
.dodont-col ul { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.dodont-col li { font-size: 15px; line-height: 1.5; padding-left: 22px; position: relative; color: var(--text); }
.dodont-col.do li::before { content: '✓'; position: absolute; left: 0; color: #0B8A4F; font-weight: 700; }
.dodont-col.dont li::before { content: '✕'; position: absolute; left: 0; color: #C53030; font-weight: 700; }

.words-row { margin-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
.word-chip { padding: 8px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 1px; }
.word-chip.good { border-color: #B8E0C2; background: #EFFAF2; color: #0B8A4F; }
.word-chip.avoid { border-color: #F3C6C6; background: #FCEFEF; color: #C53030; text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* Messaging */
.msg-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 40px; display: grid; grid-template-columns: 180px 1fr; gap: 40px; align-items: start; }
.msg-card + .msg-card { margin-top: 16px; }
.msg-card .mlabel { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-faint); }
.msg-card .mtext { font-size: 20px; line-height: 1.45; letter-spacing: -0.2px; font-weight: 500; text-wrap: pretty; }
.msg-card .mtext.hero-line { font-size: 32px; font-weight: 700; letter-spacing: -0.8px; line-height: 1.15; }
.msg-card .mtext .pop { color: var(--accent); }
.msg-card .m-actions { margin-top: 12px; display: flex; gap: 8px; }

/* Social assets */
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.social-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.social-card .slot { aspect-ratio: 16/9; background: #060606; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.social-card .slot.square { aspect-ratio: 1/1; }
.social-card .slot.banner { aspect-ratio: 3/1; }
.social-card .slot.avatar { aspect-ratio: 1/1; background: #FAFAFA; padding: 20%; }
.social-card .slot.avatar.dark { background: #060606; }
.social-card .slot.og { aspect-ratio: 1200/630; }
.social-card .sfoot { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); background: var(--surface-2); }
.social-card .sfoot .sname { font-weight: 600; font-size: 13px; }
.social-card .sfoot .sdims { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: 1px; }

/* Email sig */
.sig-builder { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }
.sig-form { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.sig-form label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); display: block; margin-bottom: 6px; }
.sig-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 14px; background: var(--bg); color: var(--text); }
.sig-form input:focus { outline: none; border-color: var(--accent); }
.sig-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 32px; }
.sig-preview .pre-label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 18px; }
.sig-preview .sig-html { padding: 20px; background: var(--bg); border-radius: 6px; border: 1px dashed var(--border); }
.sig-html-raw { margin-top: 20px; background: #0A0A0A; color: #E4E4E4; padding: 16px; border-radius: 6px; font-family: 'Space Mono', monospace; font-size: 11px; line-height: 1.6; overflow-x: auto; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto; }

/* Press kit */
.press-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.press-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.press-card .icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 8px; font-family: 'Space Mono', monospace; font-weight: 700; color: var(--accent); font-size: 12px; letter-spacing: 1px; }
.press-card h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.press-card p { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.press-card .btn-dl { align-self: flex-start; margin-top: 4px; }

/* Motion */
.motion-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.motion-card { background: var(--surface); padding: 28px; display: flex; flex-direction: column; gap: 16px; min-height: 220px; }
.motion-card .demo { height: 100px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; }
.motion-card .label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); }
.motion-card h4 { font-size: 15px; font-weight: 600; }
.motion-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Product UI */
.product-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.product-frame { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.08); border: 1px solid var(--border); }

/* Dark mode preview wrapper — selectively dark-themed */
.app[data-preview="dark"] .logo-card .preview.on-light { background: #060606; }
.app[data-preview="dark"] .logo-card .preview.on-light svg * { /* no-op — each card renders correct variant */ }

/* Dark mode for everything — vars live on :root so body/html inherit too */
body.dark { --bg: #060606; --surface: #0E0E0E; --surface-2: #161616; --border: #1F1F1F; --border-strong: #2A2A2A; --text: #F0F0F0; --text-muted: #999999; --text-faint: #555555; --ink: #F0F0F0; }
body.dark .mode-toggle button.active { background: #fff; color: #0A0A0A; }
body.dark .btn-dl:hover { background: #fff; color: #0A0A0A; border-color: #fff; }
body.dark .swatch-card .chip .chip-tag { background: rgba(0,0,0,0.6); color: #fff; }
body.dark .swatch-card .chip.is-dark .chip-tag { background: rgba(255,255,255,0.15); }
body.dark .sig-html { background: #161616; }
body.dark .font-link-row a:hover { background: #fff; color: #0A0A0A; border-color: #fff; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 12px 22px; border-radius: 999px; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app.dark .toast { background: #F0F0F0; color: #0A0A0A; }

/* Tweaks panel */
.tweaks-panel { position: fixed; bottom: 24px; right: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: 280px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); z-index: 60; display: none; }
.tweaks-panel.open { display: block; }
.tweaks-panel h3 { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 14px; color: var(--text-muted); }
.tweaks-panel .tweak-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tweaks-panel .tweak-row label { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-faint); }
.tweaks-panel .tweak-row .options { display: flex; gap: 6px; flex-wrap: wrap; }
.tweaks-panel .tweak-row .options button { padding: 6px 10px; font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--text); }
.tweaks-panel .tweak-row .options button.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tweaks-panel .accent-swatches { display: flex; gap: 6px; }
.tweaks-panel .accent-swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.tweaks-panel .accent-swatches button.active { border-color: var(--text); transform: scale(1.1); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .section, .hero { padding: 60px 32px; }
  .section-head h2 { font-size: 32px; }
  .type-row { grid-template-columns: 1fr; gap: 16px; }
  .sig-builder { grid-template-columns: 1fr; }
  .msg-card { grid-template-columns: 1fr; gap: 16px; padding: 28px; }
}
