/* ─────────────────────────────────────────────────────────────────────────────
   SVGeneration — Stylesheet v2
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f9fc;
  --surface:   #ffffff;
  --surface2:  #f1f3f9;
  --border:    #e2e6f0;
  --accent:    #6366f1;
  --accent2:   #8b5cf6;
  --accent-dk: #4f52d8;
  --text:      #1e293b;
  --muted:     #64748b;
  --light:     #94a3b8;
  --success:   #22c55e;
  --hero-bg:   #0f0e2e;
  --radius:    10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08);
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --ease:      cubic-bezier(.4, 0, .2, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Global link — keep plain links styled, but NOT buttons */
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; color: var(--text); }
h1 { font-size: clamp(1.9rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
h3 { font-size: 1.1rem; }
p  { color: var(--muted); }
code {
  font-family: var(--mono);
  background: var(--surface2);
  padding: .15em .4em;
  border-radius: 5px;
  font-size: .875em;
  color: var(--accent);
}

.gradient-text {
  background: linear-gradient(135deg, #6366f1 0%, #a78bfa 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem 1.4rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none !important;  /* override global a:hover */
  transition: background .2s var(--ease), box-shadow .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
  white-space: nowrap;
}

/* ── Force correct text colours on ALL btn variants, regardless of context ── */
.btn-primary,
a.btn-primary,
.article-body a.btn-primary,
.article-cta a.btn-primary { color: #ffffff !important; background: var(--accent); box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.btn-primary:hover,
a.btn-primary:hover { background: var(--accent-dk); box-shadow: 0 6px 20px rgba(99,102,241,.5); transform: translateY(-1px); color: #fff !important; }

.btn-ghost,
a.btn-ghost { color: #ffffff !important; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.btn-ghost:hover,
a.btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff !important; }

.btn-outline,
a.btn-outline,
.article-body a.btn-outline,
.article-cta a.btn-outline { color: var(--accent) !important; background: transparent; border: 1.5px solid var(--accent); }
.btn-outline:hover,
a.btn-outline:hover { background: var(--accent); color: #ffffff !important; }

.btn-sm { padding: .42rem .9rem; font-size: .82rem; }
.btn-full { width: 100%; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 62px;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text) !important;
  flex-shrink: 0;
}
.logo:hover { color: var(--accent) !important; text-decoration: none !important; }

.site-nav { display: flex; gap: .2rem; align-items: center; margin-left: auto; }
.site-nav a {
  padding: .42rem .85rem;
  border-radius: 6px;
  color: var(--muted) !important;
  font-size: .88rem;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.site-nav a:hover,
.site-nav a.active { color: var(--accent) !important; background: rgba(99,102,241,.08); text-decoration: none !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: .2s; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--hero-bg);
  padding: 6rem 0 5rem;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,.38) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.32) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, rgba(96,165,250,.22) 0%, transparent 50%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; color: #fff; text-align: center; }
.hero h1 { color: #fff; margin-bottom: 1.25rem; }
.hero-lead { font-size: 1.1rem; color: rgba(255,255,255,.75); max-width: 560px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.hero-stats { display: flex; gap: 3rem; justify-content: center; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.stat strong { font-size: 1.5rem; font-weight: 800; color: #fff; }
.stat span { font-size: .78rem; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .08em; }

/* ── Pattern Grid ─────────────────────────────────────────────────────────── */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2.5rem 0 2rem;
}
.page-heading { padding: 2.5rem 0 0; }
.page-heading h2 { font-size: 1.4rem; }

/* ── Pattern Card ─────────────────────────────────────────────────────────── */
.pattern-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.pattern-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.card-preview {
  display: block;
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  cursor: pointer;
}
.card-bg {
  position: absolute;
  inset: 0;
  background-size: auto;
  background-repeat: repeat;
  transition: transform .4s ease;
}
.card-preview:hover .card-bg { transform: scale(1.06); }

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s var(--ease);
}
.card-preview:hover .card-overlay { background: rgba(0,0,0,.45); }

.card-cta {
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  opacity: 0;
  transition: opacity .2s var(--ease);
  letter-spacing: .02em;
}
.card-preview:hover .card-cta { opacity: 1; }

.card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex: 1;
}
.card-title { font-size: .97rem; font-weight: 700; }
.card-title a { color: var(--text) !important; }
.card-title a:hover { color: var(--accent) !important; text-decoration: none !important; }

.card-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 500;
}
.tag-author { background: rgba(99,102,241,.1); color: var(--accent); }
.tag-size   { background: rgba(100,116,139,.1); color: var(--muted); }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 2.5rem 0 3.5rem;
  flex-wrap: wrap;
}
.page-numbers { display: flex; gap: .3rem; align-items: center; }

.page-num, .page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 .5rem;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--muted) !important;
  border: 1.5px solid var(--border);
  transition: border-color .15s, color .15s, background .15s;
  text-decoration: none !important;
}
.page-btn { padding: 0 1rem; }
.page-num:hover, .page-btn:hover { border-color: var(--accent); color: var(--accent) !important; }
.page-num.active { background: var(--accent); color: #fff !important; border-color: var(--accent); }

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 38px;
  font-size: .88rem;
  color: var(--light);
  user-select: none;
}

/* ── Editor Layout ────────────────────────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: calc(100vh - 62px);
}
.editor-preview {
  position: relative;
  background-repeat: repeat;
  background-size: auto;
  display: flex;
  align-items: flex-end;
  min-height: 60vh;
}
.preview-overlay { padding: 2.5rem 3rem; width: 100%; }
.preview-overlay.shade-dark {
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
}
.preview-overlay.shade-light {
  background: linear-gradient(to top, rgba(255,255,255,.75) 0%, transparent 100%);
}
.preview-overlay.shade-dark .preview-title,
.preview-overlay.shade-dark .preview-meta,
.preview-overlay.shade-dark .preview-desc { color: #fff; }
.preview-overlay.shade-light .preview-title { color: var(--text); }
.preview-overlay.shade-light .preview-meta,
.preview-overlay.shade-light .preview-desc  { color: var(--muted); }
.preview-title { font-size: clamp(1.4rem, 4vw, 2.6rem); margin-bottom: .4rem; }
.preview-meta { display: flex; gap: 1.2rem; font-size: .82rem; margin-bottom: .55rem; opacity: .8; }
.preview-desc { font-size: .93rem; max-width: 520px; }

/* ── Editor Panel ─────────────────────────────────────────────────────────── */
.editor-panel { background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; }
.editor-panel-inner { padding: 1.75rem 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; }
.panel-heading { font-size: 1rem; font-weight: 700; color: var(--text); }
.panel-divider { border: none; border-top: 1px solid var(--border); }

.control-group { display: flex; flex-direction: column; gap: .45rem; }
.control-group label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.control-group select,
.control-group input[type="text"] {
  width: 100%;
  padding: .52rem .75rem;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  font-family: var(--font);
  font-size: .88rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.control-group select:focus,
.control-group input[type="text"]:focus { border-color: var(--accent); }

.color-row { display: flex; gap: .6rem; align-items: center; }
.color-row input[type="color"] {
  width: 40px; height: 38px;
  border-radius: 7px; border: 1.5px solid var(--border);
  padding: 2px; cursor: pointer; flex-shrink: 0;
}
.color-row input[type="text"] { flex: 1; }

.slider-row { display: flex; gap: .75rem; align-items: center; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); cursor: pointer; }
.slider-val { font-size: .82rem; font-weight: 600; color: var(--muted); width: 40px; text-align: right; flex-shrink: 0; }

.code-box-wrapper { position: relative; }
.code-box {
  width: 100%;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.55;
  padding: .7rem .8rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  resize: vertical;
  outline: none;
}
.code-box:focus { border-color: var(--accent); }
.code-box.tall { min-height: 160px; }

.copy-btn {
  position: absolute;
  top: .45rem; right: .45rem;
  display: flex; align-items: center; gap: .3rem;
  padding: .28rem .6rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted) !important;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent) !important; }
.copy-btn.inline { position: static; margin-top: .4rem; }

.license-note { font-size: .78rem; color: var(--light); text-align: center; line-height: 1.6; }
.license-note a { color: var(--accent); }

/* ── Related Patterns ─────────────────────────────────────────────────────── */
.related-section { padding: 3rem 0 4rem; }
.section-title { font-size: 1.25rem; margin-bottom: 1.5rem; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.related-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3/2;
  display: flex;
  align-items: flex-end;
  text-decoration: none !important;
  transition: box-shadow .2s, transform .2s;
  border: 1px solid var(--border);
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.related-bg {
  position: absolute;
  inset: 0;
  background-size: auto;
  background-repeat: repeat;
  transition: transform .4s ease;
}
.related-card:hover .related-bg { transform: scale(1.06); }
.related-name {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: .45rem .7rem;
  font-size: .78rem;
  font-weight: 700;
  background: rgba(0,0,0,.55);
  color: #fff !important;
  backdrop-filter: blur(4px);
}
.related-card.shade-light .related-name { background: rgba(255,255,255,.82); color: var(--text) !important; }
.center-link { text-align: center; margin-top: 1rem; }

/* ── Page Content (static pages) ─────────────────────────────────────────── */
.page-content { padding: 3rem 0 5rem; }
.page-header { margin-bottom: 2.5rem; }
.page-header.centered { text-align: center; }
.page-lead { font-size: 1.05rem; margin-top: .65rem; max-width: 600px; }
.page-header.centered .page-lead { margin: .65rem auto 0; }

/* ── Resources ────────────────────────────────────────────────────────────── */
.resources-grid { display: grid; gap: 3rem; }
.resource-section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}
.resource-list { list-style: none; display: flex; flex-direction: column; gap: 1.2rem; }
.resource-list li a { font-weight: 600; font-size: .93rem; color: var(--accent) !important; }
.resource-list li a:hover { text-decoration: underline !important; }
.resource-list li p { font-size: .86rem; margin-top: .2rem; }

/* ── Learn / Article ──────────────────────────────────────────────────────── */
.page-article { max-width: 760px; margin-left: auto; margin-right: auto; }

.article-header { margin-bottom: 2rem; }
.breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: .65rem; }
.breadcrumb a { color: var(--accent) !important; }
.article-meta { display: flex; gap: 1.25rem; font-size: .8rem; color: var(--light); margin-top: .5rem; }

.article-body { display: flex; flex-direction: column; gap: 1.5rem; }
.article-body h2 { font-size: 1.3rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.article-body h3 { font-size: 1.05rem; color: var(--text); }
.article-body p { color: var(--muted); }
.article-body ul { padding-left: 1.4rem; display: flex; flex-direction: column; gap: .4rem; }
.article-body li { color: var(--muted); }

/* ⚠️  plain links inside article get accent colour, but .btn overrides below */
.article-body a:not(.btn) { color: var(--accent) !important; }
.article-body a:not(.btn):hover { text-decoration: underline !important; }

.code-block {
  background: #0f172a;
  border-radius: var(--radius);
  overflow: auto;
  padding: 1.2rem 1.4rem;
  margin: 0;
}
.code-block code {
  font-family: var(--mono);
  font-size: .83rem;
  color: #a5f3fc;
  background: none;
  padding: 0;
  border-radius: 0;
  -webkit-text-fill-color: #a5f3fc;
}

.article-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

/* ── Browser Support Table ────────────────────────────────────────────────── */
.support-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.support-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.support-table th, .support-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
.support-table th { font-weight: 600; background: var(--surface2); }
.support-table td.ok { color: var(--success); font-weight: 700; text-align: center; }
.support-table td:not(:first-child) { text-align: center; }

/* ── Static Pages ─────────────────────────────────────────────────────────── */
.static-page { max-width: 700px; margin: 0 auto; }

.donate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}
.donate-icon { font-size: 2.8rem; margin-bottom: 1rem; }
.donate-card h2 { margin-bottom: .65rem; }
.donate-card > p { margin-bottom: 1.5rem; }
.donate-amounts { display: flex; gap: .55rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.amount-btn {
  padding: .5rem 1.3rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  color: var(--text);
}
.amount-btn:hover, .amount-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.donate-note { font-size: .8rem; color: var(--light); }

.other-ways h2 { margin-bottom: 1.2rem; }
.help-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.help-list li { display: flex; gap: .85rem; align-items: flex-start; }
.help-list li svg { flex-shrink: 0; color: var(--accent); margin-top: .15rem; }
.help-list li span { color: var(--muted); font-size: .93rem; }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.2rem; margin-bottom: 2rem; }
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.4rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.contact-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.contact-icon { color: var(--accent); margin: 0 auto .9rem; }
.contact-card h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.contact-card p { font-size: .86rem; margin-bottom: .9rem; }
.contact-link { font-weight: 600; color: var(--accent) !important; font-size: .88rem; }
.contact-link:hover { text-decoration: underline !important; }

.contact-note {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.4rem 1.65rem;
  border: 1px solid var(--border);
}
.contact-note h3 { margin-bottom: .55rem; }
.contact-note p { font-size: .9rem; }

.license-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}
.license-badge {
  display: inline-flex;
  padding: .28rem .8rem;
  border-radius: 100px;
  background: rgba(99,102,241,.1);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1.2rem;
}
.license-card h2 { margin-bottom: .3rem; }
.license-card > p { font-size: .88rem; margin-bottom: 0; }
.license-text {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin: 1.4rem 0;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  border: 1px solid var(--border);
}
.license-text p { font-size: .86rem; }
.license-summary h3 { margin-bottom: .7rem; }
.license-summary ul { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.license-summary li { font-size: .9rem; color: var(--muted); }

/* ── Tools ────────────────────────────────────────────────────────────────── */
.tool-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.tool-input-section { display: flex; flex-direction: column; gap: .7rem; }
.tool-input-section label { font-weight: 600; font-size: .85rem; color: var(--muted); }
.tool-output-section { display: flex; flex-direction: column; gap: 1rem; }
.tool-preview-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  aspect-ratio: 16/9;
  min-height: 180px;
}
.decoded-preview {
  width: 100%;
  height: 100%;
  background-repeat: repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
.preview-placeholder { color: var(--light); font-size: .86rem; }
.tool-svg-output { display: flex; flex-direction: column; gap: .55rem; }
.tool-svg-output label { font-weight: 600; font-size: .85rem; color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer { background: #08080f; color: rgba(255,255,255,.6); padding-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap; padding-bottom: 2.5rem; }
.footer-brand .logo { color: #fff !important; margin-bottom: .7rem; }
.footer-brand p { font-size: .84rem; line-height: 1.75; max-width: 210px; color: rgba(255,255,255,.5); }
.footer-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.footer-nav a { color: rgba(255,255,255,.5) !important; font-size: .86rem; transition: color .15s; }
.footer-nav a:hover { color: #fff !important; text-decoration: none !important; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.07); }
.footer-bottom .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 1.5rem;
  font-size: .78rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-bottom span { color: rgba(255,255,255,.4); }
.footer-bottom a { color: rgba(255,255,255,.35) !important; }
.footer-bottom a:hover { color: rgba(255,255,255,.7) !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-panel { border-left: none; border-top: 1px solid var(--border); overflow-y: visible; }
  .tool-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: fixed;
    top: 62px; left: 0; right: 0;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: stretch;
    padding: .75rem;
    box-shadow: var(--shadow-lg);
    border-top: 1px solid var(--border);
    z-index: 99;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .75rem 1rem; border-radius: 8px; }

  .hero { padding: 4rem 0 3rem; }
  .hero-stats { gap: 2rem; }
  .pattern-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
  .preview-overlay { padding: 1.5rem; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  .footer-bottom .container { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .pattern-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-actions { flex-direction: column; align-items: center; }
  .pagination { gap: .4rem; }
  .page-btn { padding: 0 .75rem; }
  .article-cta { flex-direction: column; }
  .article-cta .btn { width: 100%; }
}

/* ── Documentation ────────────────────────────────────────────────────────── */
.docs-hero {
  background: linear-gradient(135deg, #f5f5ff 0%, #faf5ff 100%);
  border-bottom: 1px solid var(--border);
  padding: 4rem 0 3rem;
  text-align: center;
}
.docs-hero-badge {
  display: inline-flex;
  padding: .25rem .75rem;
  border-radius: 100px;
  background: rgba(99,102,241,.12);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1rem;
}
.docs-hero h1 { margin-bottom: .75rem; }
.docs-hero-lead { font-size: 1.05rem; max-width: 580px; margin: 0 auto 2rem; }
.docs-hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
}
.dstat { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.dstat strong { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.dstat span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }

.docs-main { padding: 3rem 0 5rem; display: flex; flex-direction: column; gap: 3rem; }

.docs-category {}
.docs-cat-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}
.docs-cat-badge {
  display: inline-flex;
  padding: .2rem .65rem;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
}
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.docs-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none !important;
  transition: box-shadow .2s, transform .2s;
  box-shadow: var(--shadow-sm);
}
.docs-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.docs-card-accent { height: 4px; flex-shrink: 0; }
.docs-card-body { padding: 1.25rem 1.4rem 1.2rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.docs-card-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.docs-tag {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  background: rgba(99,102,241,.08);
  padding: .15rem .5rem;
  border-radius: 100px;
}
.docs-read-time { font-size: .75rem; color: var(--light); }
.docs-card h3 { font-size: .97rem; color: var(--text) !important; line-height: 1.35; }
.docs-card p { font-size: .84rem; color: var(--muted); line-height: 1.55; flex: 1; }
.docs-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: .25rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.docs-pdf-count { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); font-weight: 500; }
.docs-pdf-count svg { color: var(--accent); }
.docs-card-arrow { font-size: .82rem; font-weight: 600; color: var(--accent) !important; }

/* ── Article Layout ───────────────────────────────────────────────────────── */
.article-hero {
  padding: 3rem 0 2.5rem;
}
.article-hero h1 { font-size: clamp(1.5rem, 4vw, 2.4rem); margin: .75rem 0 .6rem; }
.article-hero-badge {
  display: inline-flex;
  padding: .22rem .65rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .4rem;
}
.article-hero-lead { font-size: 1rem; color: var(--muted); max-width: 660px; margin-bottom: 1rem; }
.article-hero-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--light);
}
.article-hero-meta span { display: flex; align-items: center; gap: .35rem; }

.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  padding: 3rem 0 5rem;
  align-items: start;
}

.article-content {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.article-content h2 {
  font-size: 1.3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
  scroll-margin-top: 80px;
}
.article-content h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.article-content p { color: var(--muted); font-size: .95rem; line-height: 1.75; }
.article-content strong { color: var(--text); }
.article-content a:not(.btn) { color: var(--accent) !important; }
.article-content code {
  font-family: var(--mono);
  background: var(--surface2);
  padding: .12em .38em;
  border-radius: 4px;
  font-size: .875em;
  color: var(--accent);
}
.article-content pre.code-block { margin: 0; }
.article-content pre.code-block code { -webkit-text-fill-color: #a5f3fc; color: #a5f3fc; background: none; padding: 0; }

/* Related articles in content */
.related-articles { margin-top: 2rem; padding-top: 2rem; border-top: 2px solid var(--border); }
.related-articles h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.related-articles-grid { display: flex; flex-direction: column; gap: .75rem; }
.related-article-card {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none !important;
  transition: box-shadow .15s, transform .15s;
  background: var(--surface);
}
.related-article-card:hover { box-shadow: var(--shadow-sm); transform: translateX(3px); }
.rac-accent { width: 4px; align-self: stretch; flex-shrink: 0; }
.rac-body { padding: .75rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.rac-cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--light); font-weight: 600; }
.rac-body strong { font-size: .88rem; color: var(--text) !important; font-weight: 600; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.article-sidebar { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1rem; }

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sidebar-card-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: .9rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.toc-list { list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.toc-list a {
  font-size: .82rem;
  color: var(--muted) !important;
  padding: .25rem .5rem;
  border-radius: 5px;
  display: block;
  line-height: 1.4;
  transition: color .15s, background .15s;
}
.toc-list a:hover { color: var(--accent) !important; background: rgba(99,102,241,.06); text-decoration: none !important; }

/* PDF Downloads */
.sidebar-pdfs { display: flex; flex-direction: column; gap: .5rem; }
.pdf-download-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  text-decoration: none !important;
  transition: border-color .15s, background .15s;
  background: var(--surface);
  cursor: pointer;
}
.pdf-download-btn:hover { border-color: var(--accent); background: rgba(99,102,241,.04); }
.pdf-icon { color: #ef4444; flex-shrink: 0; }
.pdf-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.pdf-info strong { font-size: .82rem; color: var(--text) !important; font-weight: 600; line-height: 1.3; }
.pdf-info span { font-size: .72rem; color: var(--light); }
.pdf-dl { color: var(--accent); flex-shrink: 0; }
.pdf-note { font-size: .72rem; color: var(--light); text-align: center; margin-top: .25rem; }

.sidebar-back { margin-top: .25rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
}
@media (max-width: 640px) {
  .docs-grid { grid-template-columns: 1fr; }
  .docs-hero-stats { gap: 2rem; }
}

/* ── Landing Home Page ──────────────────────────────────────────────────────── */

/* Hero */
.landing-hero {
  position: relative;
  background: var(--hero-bg);
  overflow: hidden;
  padding: 6rem 0 5rem;
  text-align: center;
}
.lh-pattern {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGRlZnM+PHBhdHRlcm4gaWQ9InAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PGNpcmNsZSBjeD0iMTAiIGN5PSIxMCIgcj0iMiIgZmlsbD0iIzYzNjZmMSIgZmlsbC1vcGFjaXR5PSIuMTIiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0idXJsKCNwKSIvPjwvc3ZnPg==");
  opacity: .7;
  pointer-events: none;
}
.lh-inner { position: relative; z-index: 1; }
.lh-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(99,102,241,.1);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,.2);
  padding: .3rem .85rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1.5rem;
}
.landing-hero h1 {
  font-size: clamp(2rem, 6vw, 3.75rem);
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.lh-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lh-lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}
.lh-actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 3rem; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }
.lh-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  border-top: 1px solid rgba(99,102,241,.15);
  padding-top: 2rem;
  margin-top: 1rem;
}
.lh-stat { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.lh-stat strong { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.lh-stat span { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--light); }

/* Modules */
.landing-modules { padding: 5rem 0; }
.lm-title { font-size: clamp(1.5rem, 3vw, 2.2rem); text-align: center; margin-bottom: .6rem; }
.lm-lead { text-align: center; color: var(--muted); margin-bottom: 3rem; font-size: 1.05rem; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.module-card {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  padding: 1.5rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none !important;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  position: relative;
}
.module-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: rgba(99,102,241,.3); }
.mod-primary { border-left: 3px solid var(--accent); }
.mod-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(99,102,241,.1);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.mod-icon--violet { background: rgba(139,92,246,.1); color: #8b5cf6; }
.mod-icon--teal   { background: rgba(20,184,166,.1);  color: #0d9488; }
.mod-icon--rose   { background: rgba(244,63,94,.1);   color: #e11d48; }
.mod-icon--amber  { background: rgba(245,158,11,.1);  color: #d97706; }
.mod-icon--green  { background: rgba(34,197,94,.1);   color: #16a34a; }
.mod-body { flex: 1; min-width: 0; }
.mod-body h3 { font-size: 1rem; font-weight: 700; color: var(--text) !important; margin-bottom: .35rem; }
.mod-body p { font-size: .875rem; color: var(--muted); line-height: 1.6; margin-bottom: .6rem; }
.mod-meta { font-size: .72rem; font-weight: 600; color: var(--light); text-transform: uppercase; letter-spacing: .06em; }
.mod-arrow { font-size: 1.1rem; color: var(--accent) !important; opacity: .5; align-self: center; transition: opacity .15s, transform .15s; }
.module-card:hover .mod-arrow { opacity: 1; transform: translateX(3px); }

/* Preview strip */
.landing-preview { padding: 4rem 0 5rem; background: var(--surface2); }
.lp-title { font-size: clamp(1.3rem, 2.5vw, 1.9rem); text-align: center; margin-bottom: 2rem; }
.preview-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}
.strip-card { text-decoration: none !important; }
.strip-preview {
  height: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
}
.strip-card:hover .strip-preview { transform: translateY(-3px); box-shadow: var(--shadow); }
.strip-label { font-size: .72rem; color: var(--muted); text-align: center; margin-top: .4rem; }

/* CTA */
.landing-cta {
  padding: 5rem 0;
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  text-align: center;
}
.lc-inner h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); color: #fff; margin-bottom: .75rem; }
.lc-inner p { color: rgba(255,255,255,.65); font-size: 1.05rem; margin-bottom: 2rem; }

/* Responsive */
@media (max-width: 900px) {
  .preview-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .landing-hero { padding: 4rem 0 3.5rem; }
  .lh-stats { gap: 2rem; }
  .modules-grid { grid-template-columns: 1fr; }
  .preview-strip { grid-template-columns: repeat(2, 1fr); }
}
