/* ════════════════════════════════════════════════════════════════════
   MyGrannySquare — article page styles (Memphis + Neobrutalism + Doodle)

   Targets every selector article.js writes to. Keeps the data contract
   (IDs, class names) identical to v1; only the visual layer changes.
   ════════════════════════════════════════════════════════════════════ */

/* ── Article hero ─────────────────────────────────────────────────── */
.hero-section {
  position: relative;
  padding: 60px 24px 56px;
  background: var(--bg);
  overflow: hidden;
  border-bottom: var(--bw) solid var(--text);
}
.hero-section::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  background: var(--secondary);
  border-radius: 50%;
  opacity: .22;
  z-index: 0;
}
.hero-section::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -40px;
  width: 240px; height: 240px;
  background:
    radial-gradient(circle, var(--accent) 30%, transparent 30%);
  background-size: 28px 28px;
  border-radius: 50%;
  opacity: .55;
  z-index: 0;
}
.hero-section .container {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
}

.article-breadcrumb {
  font-size: .85rem;
  color: var(--text-soft);
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.article-breadcrumb a {
  color: var(--primary-d);
  font-weight: 700;
}
.article-breadcrumb a:hover { color: var(--text); }
.article-breadcrumb span { opacity: .6; }
.article-breadcrumb #breadcrumbTitle {
  color: var(--text);
  font-weight: 700;
}

.decorative-elements {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.article-category-badge {
  background: var(--secondary);
  color: var(--surface);
  margin-bottom: 18px;
}

.hero-section .hero-title {
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.08;
  text-align: left;
  margin-bottom: 16px;
  max-width: 880px;
}
.article-desc {
  font-size: 1.1rem;
  color: var(--text-soft);
  line-height: 1.6;
  max-width: 720px;
  margin-bottom: 28px;
}

/* Pattern action bar */
.pattern-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.pab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  font-family: var(--font);
  font-weight: 700;
  font-size: .92rem;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  cursor: pointer;
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  transition: transform .12s, box-shadow .12s;
}
.pab-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--text);
}
.pab-solid { background: var(--primary); color: var(--surface); }
.pab-solid:nth-of-type(4) { background: var(--secondary); }
.pab-outline { background: var(--surface); color: var(--text); }
.pab-icon svg { display: block; width: 18px; height: 18px; }
.pab-icon.pin-color   svg { fill: #e60023; }
.pab-icon.share-color svg { fill: var(--secondary-d); }

.pab-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--accent);
  padding: 12px 22px;
  border: var(--bw) solid var(--accent);
  border-radius: var(--r-pill);
  box-shadow: 4px 4px 0 var(--primary);
  font-weight: 700;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
}
.pab-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hero stats inside article */
/* Hero stats — UNIFORM grid (4-up desktop, 2-up mobile, 1-up tiny).
   Renderer writes `<div class="stat"><span class="stat-number">…</span>
   <span class="stat-label">…</span></div>` so we style `.stat` here for
   the article context (the homepage uses .hero-stats > .stat with bigger
   sizes). */
#articleHeroStats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
#articleHeroStats .stat {
  background: var(--surface);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  padding: 14px 12px;
  text-align: center;
  /* Reset homepage rotation/per-child color overrides */
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
}
#articleHeroStats .stat:nth-child(1) { background: var(--primary);   color: var(--surface); }
#articleHeroStats .stat:nth-child(2) { background: var(--accent);    color: var(--text); }
#articleHeroStats .stat:nth-child(3) { background: var(--secondary); color: var(--surface); }
#articleHeroStats .stat:nth-child(4) { background: var(--surface);   color: var(--text); }
#articleHeroStats .stat:nth-child(5) { background: var(--primary);   color: var(--surface); }
#articleHeroStats .stat .stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1;
}
#articleHeroStats .stat .stat-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .82;
}
@media (max-width: 880px) {
  #articleHeroStats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  #articleHeroStats .stat .stat-number { font-size: 1.2rem; }
}

/* ── Hero image grid — BINARY 1-or-4 rule (matches article.js) ──────
   Renderer always emits `<div class="hero-thumbnail-grid"
   data-count="1|4">` regardless of layout, then we switch the grid
   template via the data-count attribute. Same approach as v1. */
.hero-image-grid-wrap { margin-top: 8px; }

.hero-thumbnail-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 6px;
  background: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.hero-tile {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
}
.hero-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.hero-tile:hover img { transform: scale(1.05); }

/* 1 photo  → single full-width tile (4:3 natural aspect) */
.hero-thumbnail-grid[data-count="1"] { grid-template-columns: 1fr; }
.hero-thumbnail-grid[data-count="1"] .hero-tile { aspect-ratio: 4 / 3; }

/* 4 photos → equal 2x2 grid, all tiles same square shape */
.hero-thumbnail-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows:    1fr 1fr;
}

/* Non-canonical 2 / 3 — collapse cleanly so a future renderer change
   doesn't break the layout. */
.hero-thumbnail-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.hero-thumbnail-grid[data-count="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

@media (max-width: 760px) {
  .hero-thumbnail-grid { gap: 6px; padding: 4px; }
  .hero-tile           { border-radius: 6px; border-width: 2px; }
}

/* ── Intro section (feature cards) ────────────────────────────────── */
.intro-section {
  padding: 70px 24px;
  background: var(--surface);
  border-bottom: var(--bw) solid var(--text);
  position: relative;
}
.intro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  max-width: var(--container);
  margin: 0 auto;
}
.intro-card {
  background: var(--bg);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  transition: transform .15s, box-shadow .15s;
}
.intro-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
}
.intro-card:nth-child(3n+1)::before { background: var(--primary); }
.intro-card:nth-child(3n+2)::before { background: var(--secondary); }
.intro-card:nth-child(3n+3)::before { background: var(--accent); }
.intro-card::before {
  content: '';
  position: absolute;
  top: -12px; left: 18px;
  width: 50px;
  height: 22px;
  border: var(--bw) solid var(--text);
  border-radius: var(--r-pill);
  box-shadow: 2px 2px 0 var(--text);
}
.intro-card .icon,
.intro-card .feat-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  filter: drop-shadow(2px 2px 0 var(--text));
}
.intro-card h3,
.intro-card .feat-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.01em;
}
.intro-card p,
.intro-card .feat-desc {
  font-size: .94rem;
  color: var(--text-soft);
  line-height: 1.55;
}

/* Why-love images grid */
.why-love-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  max-width: var(--container);
  margin: 32px auto 0;
}
.why-love-images-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* ── Content section (about + sidebar) ───────────────────────────── */
.content-section {
  padding: 70px 24px;
  background: var(--bg);
  position: relative;
  border-bottom: var(--bw) solid var(--text);
}
.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 36px;
  max-width: var(--container);
  margin: 0 auto;
}
.content-card {
  padding: 32px;
  margin-bottom: 24px;
}
.content-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 18px;
  position: relative;
  display: inline-block;
}
.content-title::after {
  content: '';
  display: block;
  width: 60%;
  height: 6px;
  background: var(--accent);
  border-radius: var(--r-pill);
  margin-top: 6px;
  transform: rotate(-1deg);
}
.content-card p {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 12px;
}
.content-card ul,
.content-card ol {
  padding-left: 24px;
  margin-bottom: 14px;
}
.content-card li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: var(--text-soft);
}
.content-card a {
  color: var(--primary-d);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}
.about-inline-image {
  width: 100%;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 16px 0;
}

/* Variation tips / common mistakes — bright themed callouts */
#variationTips, #commonMistakes {
  padding: 28px 32px;
  position: relative;
}
#variationTips {
  background: rgba(233, 185, 68, 0.18);
}
#commonMistakes {
  background: rgba(181, 80, 47, 0.16);
}
#variationTips h2, #commonMistakes h2 {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 14px;
}

/* Author card */
.author-card {
  padding: 28px;
  text-align: center;
  background: var(--secondary);
  color: var(--surface);
  position: relative;
}
.author-card::before {
  content: '★';
  position: absolute;
  top: -12px; right: 16px;
  background: var(--accent);
  color: var(--text);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--bw) solid var(--text);
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--text);
}
.author-name {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}
.author-bio {
  font-size: .97rem;
  line-height: 1.6;
  margin-bottom: 16px;
}
.social-links {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.social-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: 50%;
  text-decoration: none;
  font-weight: 800;
  transition: transform .12s;
}
.social-icon:hover { transform: rotate(-10deg) scale(1.08); }

/* Recommendations */
.recommendations {
  padding: 24px;
  background: var(--surface);
}
.recommendations-title {
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary-d);
  margin-bottom: 14px;
}
.pattern-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rec-card {
  display: block;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  transition: transform .12s, box-shadow .12s;
}
.rec-card:hover {
  background: var(--accent);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--text);
}

@media (max-width: 880px) {
  .content-grid { grid-template-columns: 1fr; }
}

/* ── Pattern section (the meat) ───────────────────────────────────── */
.pattern-section {
  padding: 70px 24px;
  background: var(--surface);
  border-bottom: var(--bw) solid var(--text);
  position: relative;
}
.pattern-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 36px;
  max-width: var(--container);
  margin: 0 auto;
  align-items: start;
}
.pattern-main { min-width: 0; }
.pattern-card {
  background: var(--bg);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 36px;
}
.pattern-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -.025em;
  margin-bottom: 12px;
  line-height: 1.1;
}
.pattern-description {
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 18px;
}
.skill-level {
  margin-bottom: 24px;
}
.content-featured-image {
  width: 100%;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

/* Materials + tools — bright bullet boxes */
#patternMaterials, #patternTools {
  margin-bottom: 30px;
}
.material-block {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 18px;
}
.material-block h3 {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.material-block h3::before {
  content: '';
  width: 16px;
  height: 16px;
  background: var(--primary);
  border: 2.5px solid var(--text);
  border-radius: 50%;
}
.material-block ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.material-block li {
  position: relative;
  padding: 10px 14px 10px 38px;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  font-size: .96rem;
  font-weight: 500;
  color: var(--text);
}
.material-block li::before {
  content: '';
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid var(--text);
  border-radius: 50%;
}
.material-block li:nth-child(3n+1)::before { background: var(--accent); }
.material-block li:nth-child(3n+2)::before { background: var(--secondary); }
.material-block li:nth-child(3n+3)::before { background: var(--primary); }

/* Pattern sections (rounds + parts) */
#patternSections {
  margin-bottom: 28px;
}
.pattern-part,
.pattern-section-block {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.section-title {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -.01em;
  margin-bottom: 14px;
  position: relative;
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  padding: 4px 14px;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  transform: rotate(-1deg);
}
.round-list,
.pattern-rows {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.round-row,
.pattern-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  font-size: .96rem;
  line-height: 1.5;
  transition: background .15s;
  cursor: pointer;
}
.round-row:hover,
.pattern-row:hover {
  background: rgba(233, 185, 68, .35);
}
.round-row.completed,
.pattern-row.completed {
  background: rgba(95, 122, 68, .25);
  text-decoration: line-through;
  opacity: .82;
}
.round-label,
.row-label {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--primary-d);
  min-width: 90px;
}
.round-value,
.row-value {
  flex: 1;
  color: var(--text);
}
.round-count {
  flex-shrink: 0;
  background: var(--secondary);
  color: var(--surface);
  padding: 2px 10px;
  border: 2px solid var(--text);
  border-radius: var(--r-pill);
  font-size: .82rem;
  font-weight: 700;
}

.row-info,
.pattern-row.info {
  background: rgba(181, 80, 47, .15);
  font-style: italic;
}

/* Inline step photos in rounds */
.inline-step-photo {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 12px auto;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.process-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.process-photos-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* Assembly + important notes + final thoughts */
#assemblyInstructions,
#importantNotes,
#finalThoughts {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 22px;
}
#assemblyInstructions h2,
#importantNotes h2,
#finalThoughts h2 {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 14px;
}
#assemblyInstructions ol {
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#assemblyInstructions li {
  line-height: 1.6;
  color: var(--text);
}
#importantNotes {
  background: rgba(233, 185, 68, .2);
}
#finalThoughts {
  background: rgba(95, 122, 68, .12);
}

/* ── Sidebar (abbreviations) — scrollable, sticky on desktop ──────
   No padding on the sidebar itself — the inner #patternAbbrev gets
   padding instead, so the entire sidebar IS the scroll container. */
.pattern-sidebar {
  background: var(--accent);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 0;
  position: sticky;
  top: 96px;
  align-self: flex-start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
/* Inner abbreviations card holds the actual padding so scroll feels
   natural up to the very edge of the sidebar. */
.pattern-sidebar > #patternAbbrev,
.pattern-sidebar > .abbreviations-card {
  padding: 26px 24px 30px;
}
/* Custom scrollbar so it's visibly scrollable (Chromium / Safari) */
.pattern-sidebar::-webkit-scrollbar { width: 10px; }
.pattern-sidebar::-webkit-scrollbar-track {
  background: rgba(47, 35, 24, .08);
  border-left: 2px solid var(--text);
}
.pattern-sidebar::-webkit-scrollbar-thumb {
  background: var(--text);
  border-radius: 6px;
  border: 2px solid var(--accent);
}
.pattern-sidebar h2,
.pattern-sidebar h3 {
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 12px;
  letter-spacing: -.01em;
}
.pattern-sidebar dl,
.pattern-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pattern-sidebar li,
.pattern-sidebar .abbrev-row {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: 8px;
  font-size: .9rem;
}
.pattern-sidebar dt,
.pattern-sidebar .abbrev-key {
  font-weight: 800;
  color: var(--primary-d);
  flex-shrink: 0;
  min-width: 50px;
}
.pattern-sidebar dd,
.pattern-sidebar .abbrev-val {
  color: var(--text);
  flex: 1;
}

.sidebar-close-wrap { display: none; }
.sidebar-close-btn {
  background: var(--text);
  color: var(--accent);
  border: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
}

/* Mobile sidebar */
@media (max-width: 1100px) {
  .pattern-content-wrapper { grid-template-columns: 1fr; }
  .pattern-sidebar {
    position: fixed;
    top: 0; right: -100%;
    height: 100vh;
    width: min(380px, 92vw);
    max-height: 100vh;
    border-radius: 0;
    box-shadow: -8px 0 0 var(--text);
    z-index: 200;
    transition: right .3s ease;
    overflow-y: auto;
  }
  .pattern-sidebar.active { right: 0; }
  .sidebar-close-wrap {
    display: flex;
    justify-content: flex-end;
    position: sticky;
    top: 0;
    margin-bottom: 8px;
  }
}

.mobile-abbrev-toggle {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 150;
  background: var(--primary);
  color: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r-pill);
  padding: 12px 24px;
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .25s, transform .25s;
}
.mobile-abbrev-toggle.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
@media (min-width: 1101px) {
  .mobile-abbrev-toggle { display: none !important; }
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 35, 24, .55);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.mobile-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Source attribution / credits — HIGHLIGHTED, TOP-STACKED ────────
   Yellow Memphis card with a CREDITS pill banner at the TOP (via
   ::before as a normal flow-level element). Body content flows below
   without overlap. The renderer writes <p class="credit-designer">
   <p class="credit-license"> <p class="credit-source"> directly into
   #sourceAttribution — no <h4> wrapper. */
.source-attribution {
  max-width: 880px;
  margin: 0 auto 40px;
  padding: 0 0 24px;
  background: var(--accent);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
/* The "🌼 CREDITS" header pill sits as a real block at the top of
   the card — no absolute positioning, no chance of overlap. */
.source-attribution::before {
  content: '🌼 Credits';
  display: block;
  background: var(--primary);
  color: var(--surface);
  font-weight: 900;
  font-size: .82rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 12px 28px;
  border-bottom: var(--bw) solid var(--text);
}
.source-attribution > * {
  /* Every direct child gets the body padding so content lines up
     regardless of which paragraphs the renderer emits. */
  padding-left: 28px;
  padding-right: 28px;
}
.source-attribution > *:first-child { margin-top: 18px; }
.source-attribution p {
  font-size: .98rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 8px;
}
.source-attribution .credit-designer {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.source-attribution .credit-designer strong { color: var(--text); }
.source-attribution .credit-source {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed rgba(47, 35, 24, .35);
}
.source-attribution a {
  color: var(--primary-d);
  font-weight: 800;
  border-bottom: 2.5px solid var(--text);
  padding-bottom: 1px;
  transition: background .15s, color .15s;
}
.source-attribution a:hover {
  background: var(--text);
  color: var(--accent);
  border-bottom-color: transparent;
  padding: 1px 6px;
  border-radius: 4px;
}
@media (max-width: 600px) {
  .source-attribution > * { padding-left: 18px; padding-right: 18px; }
  .source-attribution::before { padding: 10px 18px; font-size: .76rem; }
  .source-attribution { padding-bottom: 20px; }
}

/* ── Article FAQ (Q&A section) ───────────────────────────────────── */
.qa-section {
  padding: 70px 24px;
  background: var(--bg);
  border-bottom: var(--bw) solid var(--text);
}
.qa-header { text-align: center; margin-bottom: 40px; }
.qa-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -.025em;
}
.qa-list {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qa-item {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.qa-question {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 16px;
  font-weight: 700;
}
.qa-question h3 { font-size: 1rem; font-weight: 700; }
.qa-icon {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: 2.5px solid var(--text);
  border-radius: 50%;
  flex-shrink: 0;
  font-weight: 900;
  font-size: 1.1rem;
  transition: transform .25s;
}
.qa-item.active .qa-icon { transform: rotate(45deg); }
.qa-answer {
  padding: 0 22px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s, padding .25s;
  color: var(--text-soft);
}
.qa-item.active .qa-answer {
  padding: 0 22px 18px;
  max-height: 600px;
}

/* ── Floating progress + completion badge ────────────────────────── */
.global-progress {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 90;
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  min-width: 220px;
  display: none;
}
.global-progress.visible { display: block; }
.global-progress-text {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 8px;
  color: var(--text);
}
.global-progress-bar-track {
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r-pill);
  overflow: hidden;
  height: 14px;
}
.global-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width .3s ease;
  width: 0%;
}

.complete-badge {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 250;
  background: var(--secondary);
  color: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-xl);
  padding: 22px 36px;
  text-align: center;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -.01em;
  opacity: 0;
  transition: opacity .35s, transform .35s;
}
.complete-badge.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Completion modal ─────────────────────────────────────────────── */
.completion-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(47, 35, 24, .68);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  padding: 20px;
}
.completion-modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}
.completion-modal {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-xl);
  padding: 42px 36px 32px;
  max-width: 480px;
  width: 100%;
  position: relative;
  text-align: center;
  transform: scale(.95);
  transition: transform .3s;
}
.completion-modal-backdrop.show .completion-modal { transform: scale(1); }
.completion-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--text);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}
.completion-modal-emoji {
  font-size: 3.4rem;
  margin-bottom: 12px;
  filter: drop-shadow(2px 2px 0 var(--text));
}
.completion-modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}
.completion-modal-sub {
  color: var(--text-soft);
  line-height: 1.55;
  margin-bottom: 24px;
}
.completion-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.completion-modal-form input {
  padding: 12px 14px;
  font-family: var(--font);
  font-size: .95rem;
  background: var(--bg);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  outline: none;
}
.completion-modal-form button {
  padding: 12px 24px;
  font-weight: 800;
  background: var(--primary);
  color: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 4px 4px 0 var(--text);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.completion-modal-form button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--text);
}
.completion-modal-skip {
  margin-top: 16px;
  font-size: .85rem;
}
.completion-modal-skip a {
  color: var(--text-soft);
  text-decoration: underline;
}

/* ── Gallery modal ───────────────────────────────────────────────── */
.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 35, 24, .85);
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  padding: 20px;
}
.gallery-modal.open {
  opacity: 1;
  pointer-events: all;
}
.gallery-modal-content,
.gallery-modal-inner {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow-xl);
  width: min(960px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  padding: 28px;
  /* Sticky header so the close button + title stay visible while scrolling */
  display: flex;
  flex-direction: column;
}
.gallery-modal-content .gallery-grid,
.gallery-modal-inner    .gallery-grid {
  flex: 1;
  /* Inner grid does NOT scroll — the modal-content wrapper is the scroller. */
}
.gallery-modal-content .gallery-title,
.gallery-modal-inner    .gallery-title {
  position: sticky;
  top: -28px;
  background: var(--surface);
  padding: 8px 0 14px;
  margin-top: -8px;
  z-index: 2;
  border-bottom: 2px dashed var(--text);
  margin-bottom: 18px;
}
.gallery-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2;
}
.gallery-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 18px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
}

#galleryLinkBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 18px;
  font-weight: 700;
  font-size: .9rem;
  background: var(--accent);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  cursor: pointer;
}

/* PDF download block */
#pdfDownloadBlock {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--accent);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
#pdfDownloadBlock h3 {
  font-size: 1.1rem;
  font-weight: 900;
  flex: 1;
  min-width: 200px;
}
#pdfDownloadBlock a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--text);
  color: var(--accent);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--primary);
  transition: transform .12s;
}
#pdfDownloadBlock a:hover { transform: translate(-2px, -2px); }

/* ── Loading state ────────────────────────────────────────────────── */
#articleLoading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

/* ── Print ────────────────────────────────────────────────────────── */
@media print {
  .navbar, .footer-section, .pattern-action-bar, .mobile-abbrev-toggle,
  .global-progress, .complete-badge, .completion-modal-backdrop,
  .qa-section, .newsletter-section, .pattern-sidebar,
  #pdfDownloadBlock, #galleryLinkBtn {
    display: none !important;
  }
  body { background: white; }
  .pattern-card { box-shadow: none; }
}

/* ════════════════════════════════════════════════════════════════════
   RENDERER-BOUND CLASSES — every class article.js writes
   These must match the markup the JS emits at runtime.
   ════════════════════════════════════════════════════════════════════ */

/* ── Material section (one per part: Body, Antenna 2x, etc.) ─────── */
.material-section {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 28px 30px;
  margin-bottom: 22px;
}
.material-section + .material-section { margin-top: 0; }
.section-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -.015em;
  margin-bottom: 14px;
  cursor: pointer;
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  padding: 6px 18px;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  transform: rotate(-1deg);
  transition: transform .15s, box-shadow .15s;
}
.section-title:hover {
  transform: rotate(-1deg) translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--text);
}
.section-title.completed {
  background: var(--secondary);
  color: var(--surface);
  text-decoration: line-through;
  text-decoration-thickness: 3px;
}
.section-notes {
  font-style: italic;
  color: var(--text-soft);
  margin: 6px 0 14px;
  line-height: 1.55;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: rgba(233, 185, 68, .14);
  border-radius: 0 8px 8px 0;
}

/* ── Section-level progress bar (per part) ───────────────────────── */
.section-progress {
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  padding: 12px 16px;
  margin: 14px 0 18px;
}
.section-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: .9rem;
}
.section-progress-text {
  color: var(--primary-d);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .8rem;
  font-weight: 800;
}
.section-progress-count { color: var(--text); font-weight: 800; }
.progress-bar-track {
  height: 12px;
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width .3s ease;
}

/* ── Step-by-step list of rows ───────────────────────────────────── */
.step-by-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Row instruction (rounds, instructions, info, notes, assembly) ─ */
.row-instruction {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  cursor: pointer;
  user-select: none;
  transition: background .12s, transform .12s;
  position: relative;
  font-size: .98rem;
  line-height: 1.55;
}
.row-instruction:hover {
  background: rgba(233, 185, 68, .35);
  transform: translateX(2px);
}
.row-instruction.completed {
  background: rgba(95, 122, 68, .25);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--secondary-d);
  opacity: .82;
  padding-right: 44px;
}
.row-instruction.completed::after {
  content: '✓';
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  background: var(--secondary);
  color: var(--surface);
  border: 2px solid var(--text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .82rem;
  text-decoration: none;
}
.row-instruction.kind-info,
.row-instruction.kind-note {
  background: rgba(181, 80, 47, .12);
  cursor: default;
  border-style: dashed;
  font-style: italic;
}
.row-instruction.kind-info:hover,
.row-instruction.kind-note:hover {
  background: rgba(181, 80, 47, .2);
  transform: none;
}
.row-instruction.kind-assembly { background: rgba(233, 185, 68, .2); }
.row-label {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--primary-d);
  min-width: 64px;
  font-size: .95rem;
  letter-spacing: .02em;
}
.row-instruction.kind-info .row-label,
.row-instruction.kind-note .row-label { color: var(--secondary-d); }
.row-text { flex: 1; color: var(--text); margin: 0; line-height: 1.55; }

/* ── Materials block (renderer output) ────────────────────────────── */
.materials-title,
.abbreviations-title,
.assembly-title,
.notes-title {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -.01em;
  margin-bottom: 14px;
  display: inline-block;
  background: var(--primary);
  color: var(--surface);
  padding: 6px 18px;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  transform: rotate(-1.2deg);
}
.material-group-name {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--secondary-d);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px dashed var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.material-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.material-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  font-size: .96rem;
  line-height: 1.5;
  color: var(--text);
}
.material-number {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--accent);
  color: var(--text);
  border: 2px solid var(--text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .82rem;
  line-height: 1;
}
.material-item:nth-child(3n+2) .material-number { background: var(--secondary); color: var(--surface); }
.material-item:nth-child(3n+3) .material-number { background: var(--primary); color: var(--surface); }
.material-text { flex: 1; color: var(--text); }

/* ── Abbreviations (sidebar) ─────────────────────────────────────── */
.abbreviations-title {
  background: var(--text);
  color: var(--accent);
  font-size: 1rem;
  display: block;
  text-align: center;
  transform: none;
  margin: 0 0 14px;
  padding: 8px 14px;
}
.abbrev-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.abbrev-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.4;
}
.abbrev-number {
  flex-shrink: 0;
  font-weight: 900;
  color: var(--primary-d);
  min-width: 56px;
  letter-spacing: .02em;
}
.abbrev-text { flex: 1; color: var(--text); }

/* ── Assembly ─────────────────────────────────────────────────────── */
.assembly-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: assembly;
}
.assembly-list li {
  position: relative;
  padding: 14px 16px 14px 56px;
  background: var(--bg);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  font-size: .98rem;
  line-height: 1.55;
  counter-increment: assembly;
}
.assembly-list li::before {
  content: counter(assembly);
  position: absolute;
  left: 12px; top: 12px;
  width: 30px; height: 30px;
  background: var(--accent);
  color: var(--text);
  border: 2.5px solid var(--text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .9rem;
  box-shadow: 2px 2px 0 var(--text);
}

/* ── Important notes / mistakes / tips ────────────────────────────── */
.notes-list, .mistakes-list, .tips-content-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-list li, .mistake-item, .tips-content-list li {
  position: relative;
  padding: 12px 16px 12px 44px;
  background: var(--surface);
  border: 2.5px solid var(--text);
  border-radius: var(--r);
  font-size: .96rem;
  line-height: 1.55;
}
.notes-list li::before, .mistake-item::before, .tips-content-list li::before {
  content: '';
  position: absolute;
  left: 14px; top: 16px;
  width: 18px; height: 18px;
  background: var(--accent);
  border: 2.5px solid var(--text);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--text);
}
.mistake-item::before { background: var(--primary); }
.note-icon { display: none; }

/* ── Feature cards (intro grid) ──────────────────────────────────── */
.feature-card {
  background: var(--bg);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
  transition: transform .15s, box-shadow .15s;
}
.feature-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
}
.feature-card:nth-child(3n+1) { background: var(--primary); color: var(--surface); }
.feature-card:nth-child(3n+2) { background: var(--accent); }
.feature-card:nth-child(3n+3) { background: var(--secondary); color: var(--surface); }
.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  filter: drop-shadow(2px 2px 0 var(--text));
}
.feature-card h3, .feature-card .feat-title {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 8px;
}
.feature-card p, .feature-card .feat-desc {
  font-size: .97rem;
  line-height: 1.6;
}

/* ── Conclusion ──────────────────────────────────────────────────── */
.conclusion { font-size: 1rem; line-height: 1.7; color: var(--text); }
.conclusion p { margin-bottom: 12px; }

/* ── Skill items ─────────────────────────────────────────────────── */
.skill-item { display: inline-block; font-weight: 700; color: var(--text-soft); font-size: .9rem; }

/* ── Gallery link wrapper ────────────────────────────────────────── */
.gallery-link-wrap { display: flex; justify-content: center; margin: 28px 0; }
.gallery-link-icon { font-size: 1.1rem; }
.gallery-link-arrow { transition: transform .2s; }
.gallery-link-wrap a:hover .gallery-link-arrow { transform: translateX(3px); }
.gallery-figure { display: flex; flex-direction: column; gap: 6px; }
.gallery-figure figcaption { font-size: .82rem; color: var(--text-soft); text-align: center; }

/* ── PDF download block ──────────────────────────────────────────── */
.pdf-download-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--accent);
  color: var(--text);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  text-decoration: none;
  font-weight: 700;
  transition: transform .12s, box-shadow .12s;
  margin: 24px 0;
}
.pdf-download-btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.pdf-download-icon { font-size: 1.6rem; flex-shrink: 0; }
.pdf-download-text { flex: 1; }
.pdf-download-title { font-size: 1.05rem; font-weight: 900; margin-bottom: 2px; }
.pdf-download-meta  { font-size: .85rem; color: var(--text-soft); }

/* ── Part section (alternate naming the renderer uses for cards-schema:
     parts, assembly wrappers, important-notes wrappers, materials wrappers.
     Inherits the same look as .material-section + .section-title.) ──── */
.part-section {
  background: var(--surface);
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 28px 30px;
  margin-bottom: 22px;
}
.part-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -.015em;
  margin-bottom: 14px;
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  padding: 6px 18px;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--text);
  transform: rotate(-1deg);
}
.part-qty {
  display: inline-block;
  margin-left: 10px;
  background: var(--secondary);
  color: var(--surface);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 3px 10px;
  border: 2px solid var(--text);
  border-radius: var(--r-pill);
  vertical-align: middle;
}

/* ── Credits ─────────────────────────────────────────────────────── */
.credit-source, .credit-designer, .credit-license {
  display: block;
  margin-bottom: 6px;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--text-soft);
}
.credit-designer { color: var(--text); font-weight: 700; }
.credit-source a { color: var(--primary-d); font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  /* Hide floating emoji decorations — they overlap the title on mobile */
  .floating-elements { display: none; }

  /* Hero — tighter padding, smaller title */
  .hero-section { padding: 36px 18px 36px; }
  .hero-section::before { width: 180px; height: 180px; top: -40px; right: -60px; }
  .hero-section::after  { width: 160px; height: 160px; bottom: -40px; left: -50px; }
  .hero-section .hero-title { font-size: 1.85rem; line-height: 1.1; }
  .article-desc { font-size: .98rem; }

  /* Tags — drop the rotation on mobile (less chaotic) */
  .decorative-elements { gap: 8px; margin-bottom: 16px; }
  .decorative-elements .tag { transform: none !important; font-size: .7rem; padding: 5px 11px; }

  /* Hide the duplicate category badge — tag-3 already shows the category */
  .article-category-badge { display: none !important; }

  /* Action bar — compact 2-col grid */
  .pattern-action-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pab-btn { padding: 10px 12px; font-size: .82rem; gap: 6px; box-shadow: 2px 2px 0 var(--text); }
  .pab-btn:hover { box-shadow: 3px 3px 0 var(--text); }
  .pab-btn .pab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pab-icon svg { width: 15px; height: 15px; }

  /* Hero stats */
  #articleHeroStats { gap: 8px; }
  #articleHeroStats .article-hero-stat { font-size: .82rem; padding: 8px 12px; }

  /* Pattern card */
  .pattern-card { padding: 22px 18px; }
  .pattern-title { font-size: 1.6rem; }
  .pattern-description { font-size: .98rem; }

  /* Material section + rows */
  .material-section { padding: 20px 16px; margin-bottom: 16px; }
  .section-title { font-size: 1.15rem; padding: 5px 14px; }
  .row-instruction { padding: 11px 14px; font-size: .92rem; gap: 10px; }
  .row-instruction.completed { padding-right: 36px; }
  .row-instruction.completed::after { right: 8px; width: 20px; height: 20px; font-size: .72rem; }
  .row-label { min-width: 56px; font-size: .88rem; }

  /* Materials grid */
  .material-list { grid-template-columns: 1fr; gap: 8px; }
  .material-item { padding: 10px 12px; font-size: .92rem; }

  /* Section progress */
  .section-progress { padding: 10px 12px; margin: 10px 0 14px; }

  /* Content + intro */
  .content-section { padding: 40px 16px; }
  .content-card { padding: 22px 18px; margin-bottom: 16px; }
  .intro-section { padding: 40px 16px; }
  .intro-grid { grid-template-columns: 1fr; gap: 14px; }
  .intro-card, .feature-card { padding: 18px; }

  /* Why-love images */
  .why-love-images-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Q&A */
  .qa-section { padding: 40px 16px; }
  .qa-question { padding: 14px 16px; }
  .qa-question h3 { font-size: .95rem; }

  /* Pattern section */
  .pattern-section { padding: 40px 16px; }

  /* Sidebar drawer width */
  .pattern-sidebar.active { width: min(360px, 90vw); }

  /* Floating progress + abbrev toggle — smaller, leaves more thumb room */
  .global-progress { bottom: 14px; left: 14px; min-width: 180px; padding: 10px 14px; }
  .global-progress-text { font-size: .75rem; }
  .mobile-abbrev-toggle { bottom: 14px; right: 14px; padding: 10px 18px; font-size: .78rem; }
}

@media (max-width: 480px) {
  .pattern-action-bar { grid-template-columns: 1fr; }
  .pab-btn { justify-content: center; padding: 11px 14px; }
  .why-love-images-grid { grid-template-columns: 1fr; }
}

/* ── 2026-05-02 AEO/GEO answer-summary block ─────────────────────────
   Visually distinct lede that AI engines extract verbatim for citations.
   Border-left accent + slightly larger text + tighter spacing makes it
   scan as the "TL;DR" without disrupting the article reading flow. */
.answer-summary {
  margin: 0 0 18px;
  padding: 16px 20px;
  border-left: 6px solid var(--primary, #b5502f);
  background: var(--surface, #fffdf6);
  border-radius: 0 12px 12px 0;
}
.answer-summary p {
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text, #2f2318);
}
.answer-summary p:last-child { margin-bottom: 0; }


/* Back navigation row (article pages) */
.back-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 16px 34px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  min-height: 48px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  border: var(--bw) solid var(--text);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.back-btn:hover {
  transform: translate(-3px,-3px);
  box-shadow: var(--shadow-lg);
  background: var(--accent);
}

/* Headings inside colored cards must keep the light card color —
   the global h1-h6 { color: var(--text) } rule otherwise wins (3.02:1 on terracotta). */
.feature-card:nth-child(3n+1) h3, .feature-card:nth-child(3n+1) .feat-title,
.feature-card:nth-child(3n+1) p,  .feature-card:nth-child(3n+1) .feat-desc,
.feature-card:nth-child(3n+3) h3, .feature-card:nth-child(3n+3) .feat-title,
.feature-card:nth-child(3n+3) p,  .feature-card:nth-child(3n+3) .feat-desc,
.author-card h3, .author-card h4 {
  color: var(--surface);
}
