/* Pixel Paint — shared styles for content-hub pages */
:root {
  --bg: #fff9ef;
  --surface: #ffffff;
  --surface-muted: #f3e9d8;
  --text: #221c18;
  --muted: #75675a;
  --border: #e6d8c7;
  --accent: #25b99a;
  --accent-dark: #15846e;
  --gold: #f7b642;
  --pink: #ff5ea8;
  --violet: #7d5cff;
  --cyan: #33c7f0;
  --shadow: 0 24px 70px rgba(59, 43, 24, 0.15);
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 94, 168, 0.14), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(51, 199, 240, 0.16), transparent 26rem),
    linear-gradient(180deg, #fff9ef 0%, #fffdf8 48%, #fff9ef 100%);
}

a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }

.page { overflow: hidden; }

.section {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(230, 216, 199, 0.76);
  background: rgba(255, 249, 239, 0.86);
  backdrop-filter: blur(18px);
}

.nav {
  position: relative;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(34, 28, 24, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 50%, rgba(255, 255, 255, 0.25) 50%),
    linear-gradient(0deg, transparent 50%, rgba(255, 255, 255, 0.25) 50%),
    conic-gradient(from 45deg, var(--pink), var(--gold), var(--accent), var(--cyan), var(--violet), var(--pink));
  background-size: 50% 50%, 50% 50%, 100% 100%;
  box-shadow: 0 10px 24px rgba(37, 185, 154, 0.24);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.nav-links a { text-decoration: none; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }

/* Tools dropdown */
.nav-dd { position: relative; }
.nav-dd-trigger {
  font: inherit; font-size: 0.92rem; font-weight: 700; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.nav-dd-trigger:hover,
.nav-dd:hover .nav-dd-trigger,
.nav-dd:focus-within .nav-dd-trigger { color: var(--text); }
.nav-caret { font-size: 0.62em; transition: transform 160ms ease; }
.nav-dd:hover .nav-caret, .nav-dd:focus-within .nav-caret { transform: rotate(180deg); }
.nav-dd-menu {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  display: none; min-width: 244px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); z-index: 40;
}
.nav-dd-menu::before { content: ""; position: absolute; top: -14px; left: 0; right: 0; height: 14px; }
.nav-dd:hover .nav-dd-menu, .nav-dd:focus-within .nav-dd-menu { display: block; }
.nav-dd-menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 8px; color: var(--text);
}
.nav-dd-menu a:hover, .nav-dd-menu a:focus-visible { background: var(--surface-muted); }
.nav-dd-menu .px { flex: none; }
.nav-dd-menu b { display: block; font-weight: 800; font-size: 0.9rem; }
.nav-dd-menu small { display: block; color: var(--muted); font-weight: 700; font-size: 0.76rem; margin-top: 1px; }

/* Hamburger toggle — visible on mobile, hidden on desktop (see 720px query) */
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 9px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform 180ms ease, opacity 140ms ease; }
.nav.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav panel (< 720px): dropdown flattens into a plain list */
@media (max-width: 719px) {
  .nav.open .nav-links { display: flex; }
  .nav-links {
    position: absolute;
    top: calc(100% + 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 10px; margin: 0;
    background: rgba(255, 249, 239, 0.98); backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(59, 43, 24, 0.12);
  }
  .nav-links > a { padding: 12px; border-radius: 8px; font-size: 1rem; }
  .nav-links > a:hover, .nav-links > a:focus-visible { background: var(--surface-muted); }
  .nav-dd-trigger { display: none; }
  .nav-dd-menu {
    position: static; display: block; transform: none;
    min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none;
  }
  .nav-dd-menu::before { display: none; }
  .nav-dd-menu a { padding: 12px; }
}

/* Breadcrumb */
.crumbs {
  width: min(920px, calc(100% - 32px));
  margin: 20px auto 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}
.crumbs a { text-decoration: none; color: var(--accent-dark); }
.crumbs a:hover { text-decoration: underline; }

/* Hero */
.hero { padding: 26px 0 8px; }

.hero h1 {
  max-width: 15ch;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 0.98;
  font-weight: 900;
}

.lede {
  max-width: 640px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(1.05rem, 3.4vw, 1.3rem);
  line-height: 1.45;
  font-weight: 700;
}

/* Prose */
.prose {
  max-width: 680px;
  margin-top: 18px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.65;
  font-weight: 500;
}
.prose.muted { color: var(--muted); font-weight: 600; }
.prose a {
  color: var(--accent-dark);
  text-decoration-color: rgba(37, 185, 154, 0.5);
  text-underline-offset: 3px;
  font-weight: 800;
}

.block { padding: 34px 0; }
.block h2 {
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}
.block h2 + .prose { margin-top: 14px; }

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Pixel-art gallery */
.gallery {
  display: grid;
  gap: 16px;
  margin-top: 26px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(59, 43, 24, 0.06);
  text-align: center;
}

.tile figcaption {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}
.tile small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
}

/* Pixel renderer */
.px {
  display: grid;
  gap: 2px;
  background: transparent;
}
.px.framed {
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-muted);
}
.px i { aspect-ratio: 1; border-radius: 1px; }
.px.lg { width: 128px; }
.px.md { width: 84px; }
.px.sm { width: 52px; }
.px.grid-lines { gap: 1px; background: var(--border); padding: 1px; }
.px.grid-lines i { border-radius: 0; background: var(--surface); }
.px.grid-lines i.on { background: var(--accent); }

/* Steps */
.steps {
  counter-reset: step;
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding: 0;
  list-style: none;
}
.steps li {
  position: relative;
  padding: 16px 18px 16px 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  line-height: 1.5;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 0.95rem;
}
.steps li strong { font-weight: 900; }

/* Tips list */
.ticks { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ticks li { padding-left: 30px; position: relative; font-weight: 600; line-height: 1.5; }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.65);
}

/* Related links */
.related {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  grid-template-columns: 1fr;
}
.related a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease;
}
.related a:hover, .related a:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 185, 154, 0.5);
}
.related span small { display: block; color: var(--muted); font-weight: 700; font-size: 0.82rem; margin-top: 2px; }

/* FAQ */
.faq { display: grid; gap: 10px; margin-top: 22px; }
.faq details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 2px 18px;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 0;
  font-weight: 900;
  font-size: 1.02rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--accent); font-weight: 900; }
.faq details[open] summary::after { content: "\2013"; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq p { padding: 14px 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; font-weight: 600; }

/* CTA */
.cta { padding: 44px 0; }
.cta-panel {
  position: relative;
  overflow: hidden;
  padding: 32px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 185, 154, 0.16), rgba(255, 94, 168, 0.12)),
    var(--surface);
  box-shadow: 0 20px 60px rgba(59, 43, 24, 0.12);
}
.cta-panel h2 {
  position: relative;
  z-index: 1;
  max-width: 620px;
  font-size: clamp(1.6rem, 5.5vw, 2.6rem);
  line-height: 1.02;
  font-weight: 900;
}
.cta-panel .prose { position: relative; z-index: 1; }

.store-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.store-badge {
  display: inline-flex;
  filter: drop-shadow(0 12px 22px rgba(34, 28, 24, 0.16));
  border-radius: 8px;
}
.store-badge svg { width: 168px; height: 56px; display: block; }
.store-badge:focus-visible {
  outline: 3px solid rgba(37, 185, 154, 0.38);
  outline-offset: 4px;
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: #fffdf8; }
.footer-inner {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.footer-inner a { color: var(--text); text-decoration-color: rgba(37, 185, 154, 0.5); text-underline-offset: 4px; }

/* ── Interactive tools (grid maker + converter) ── */
.tool-panel {
  margin-top: 26px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(59, 43, 24, 0.08);
}
@media (min-width: 720px) { .tool-panel { padding: 24px; } }

.gm { display: flex; flex-direction: column; gap: 16px; }
.gm-bar { display: flex; flex-wrap: wrap; gap: 16px 22px; }
.gm-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.gm-label {
  font-size: 0.72rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin-right: 2px;
}
.gm-chip, .gm-tool {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit;
  font-size: 0.86rem; font-weight: 800; cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.gm-chip:hover, .gm-tool:hover { border-color: rgba(37, 185, 154, 0.5); }
.gm-chip.is-on, .gm-tool.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.gm-num {
  width: 62px; padding: 7px 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); font: inherit;
  font-weight: 800; color: var(--text);
}
.gm-swatch {
  width: 28px; height: 28px; padding: 0; border: 2px solid rgba(34,28,24,0.12);
  border-radius: 6px; cursor: pointer; transition: transform 120ms ease;
}
.gm-swatch:hover { transform: translateY(-1px); }
.gm-swatch.is-on { outline: 3px solid rgba(37,185,154,0.5); outline-offset: 2px; }
.gm-picker {
  width: 34px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); cursor: pointer;
}
.gm-stage {
  display: flex; justify-content: center; padding: 8px;
  border-radius: 8px; background: var(--surface-muted);
}
.gm-canvas {
  touch-action: none; image-rendering: pixelated;
  border-radius: 4px; box-shadow: 0 6px 20px rgba(59,43,24,0.12);
  cursor: crosshair; max-width: 100%;
}
.gm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gm-btn {
  padding: 12px 18px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
  font-weight: 800; cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}
.gm-btn:hover { transform: translateY(-1px); border-color: rgba(37,185,154,0.5); }
.gm-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.gm-btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.gm-hint { margin: 0; color: var(--muted); font-size: 0.86rem; font-weight: 700; line-height: 1.5; }

/* Converter-specific */
.cv-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 34px 18px; text-align: center;
  border: 2px dashed var(--border); border-radius: 8px;
  background: var(--surface-muted); cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.cv-drop.is-over { border-color: var(--accent); background: rgba(37,185,154,0.08); }
.cv-drop strong { font-weight: 900; }
.cv-drop small { color: var(--muted); font-weight: 700; }
.cv-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .cv-grid { grid-template-columns: 1fr 1fr; } }
.cv-figure { margin: 0; text-align: center; }
.cv-figure canvas, .cv-figure img {
  width: 100%; max-width: 320px; border-radius: 8px; image-rendering: pixelated;
  background: var(--surface-muted); box-shadow: 0 6px 20px rgba(59,43,24,0.10);
}
.cv-figure figcaption {
  margin-top: 8px; font-size: 0.8rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.cv-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-control input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.cv-val { font-weight: 900; min-width: 3.4em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

@media (min-width: 720px) {
  .nav-toggle { display: none; }
  .nav-links { display: flex; }
  .hero { padding: 44px 0 12px; }
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-panel { padding: 44px; }
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
