.flyer-page {
  max-width: 920px;
  margin: 0 auto;
}

.flyer-circular {
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e8 100%);
  border: 3px solid #1a1a1a;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  color: #1a1a1a;
}

.flyer-masthead {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 1.1rem 1rem 0.95rem;
  border-bottom: 5px solid var(--accent);
}

.flyer-store-name {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--flyer-store-name, #fff);
}

.flyer-tagline {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.flyer-dates {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  opacity: 0.95;
}

.flyer-cover {
  border-bottom: 2px dashed #d4c4a8;
  background: #fff;
}

.flyer-cover img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.flyer-body {
  padding: 1rem 1rem 1.25rem;
}

.flyer-section-title {
  margin: 0 0 0.85rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flyer-deals {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.75rem;
}

.flyer-deal {
  grid-column: span 4;
  background: #fff;
  border: 2px solid #222;
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 220px;
}

.flyer-deal--hero {
  grid-column: span 6;
  min-height: 280px;
  background: linear-gradient(135deg, #fff 0%, #fff9e6 100%);
}

/* Feature = slight emphasis, not half-page (hero stays half-width) */
.flyer-deal--wide {
  grid-column: span 4;
  border-color: var(--accent, #c45c26);
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.15);
}

.flyer-preview-banner {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #fff3cd;
  border: 1px solid #e6d89a;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Editor iframe is narrow — keep multi-column so templates look like a circular, not a phone stack */
.flyer-page--preview .flyer-deals {
  grid-template-columns: repeat(12, 1fr) !important;
}
.flyer-page--preview .flyer-deal {
  grid-column: span 4 !important; /* 3 across */
  min-height: 180px;
}
.flyer-page--preview .flyer-deal--hero {
  grid-column: span 6 !important;
  min-height: 220px;
}
.flyer-page--preview .flyer-deal--wide {
  grid-column: span 4 !important;
}
.flyer-page--preview .flyer-canvas-reflow {
  grid-template-columns: repeat(3, 1fr) !important;
}
.flyer-page--preview .flyer-body {
  max-width: none;
}

/* Theme shape differences (desktop + preview) */
.flyer-theme-value_wall .flyer-deal,
.flyer-theme-pantry_stockup .flyer-deal {
  grid-column: span 3;
  min-height: 160px;
  padding: 0.5rem;
}
.flyer-theme-value_wall .flyer-deal-img,
.flyer-theme-pantry_stockup .flyer-deal-img {
  max-height: 64px;
}
.flyer-theme-bold_savings .flyer-deal--hero,
.flyer-theme-weekend_blast .flyer-deal--hero {
  grid-column: span 12;
}
.flyer-theme-manager_specials .flyer-layout-section:first-of-type .flyer-deal--hero,
.flyer-theme-holiday_table .flyer-layout-section:first-of-type .flyer-deal--hero {
  grid-column: span 12;
}
.flyer-page--preview.flyer-theme-value_wall .flyer-deal,
.flyer-page--preview.flyer-theme-pantry_stockup .flyer-deal {
  grid-column: span 3 !important;
}
.flyer-page--preview.flyer-theme-bold_savings .flyer-deal--hero,
.flyer-page--preview.flyer-theme-weekend_blast .flyer-deal--hero {
  grid-column: span 12 !important;
}

.flyer-badge {
  position: absolute;
  top: -0.35rem;
  right: 0.65rem;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  transform: rotate(3deg);
  box-shadow: 0 2px 0 #8e0000;
}

.flyer-deal-img {
  width: 100%;
  height: 88px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  background: #fafafa;
  border-radius: 4px;
}

.flyer-deal--hero .flyer-deal-img {
  height: 120px;
}

.flyer-deal-cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 0.15rem;
}

.flyer-deal-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.flyer-deal--hero .flyer-deal-name {
  font-size: 1.15rem;
}

.flyer-deal-brand,
.flyer-deal-size {
  font-size: 0.78rem;
  color: #555;
  margin-top: 0.15rem;
}

.flyer-price-row {
  margin-top: auto;
  padding-top: 0.65rem;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flyer-price {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.flyer-deal--hero .flyer-price {
  font-size: 2.4rem;
}

.flyer-price-was {
  font-size: 0.85rem;
  color: #666;
  text-decoration: line-through;
}

.flyer-save {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.flyer-deal-actions {
  margin-top: 0.55rem;
  font-size: 0.82rem;
}

.flyer-footer {
  border-top: 3px solid #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  padding: 0.85rem 1rem;
  text-align: center;
  font-size: 0.82rem;
}

.flyer-footer strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.flyer-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
}

.flyer-pdf-link {
  text-align: center;
  margin: 0.75rem 0 0;
}

.flyer-pdf-link a {
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 760px) {
  .flyer-deal,
  .flyer-deal--hero,
  .flyer-deal--wide {
    grid-column: span 6;
  }
}

@media (max-width: 520px) {
  .flyer-deal,
  .flyer-deal--hero,
  .flyer-deal--wide {
    grid-column: span 12;
  }
}

.flyer-layout-section {
  margin-bottom: 1.25rem;
}

.flyer-theme-bold_savings .flyer-price {
  font-size: 1.55rem;
}

.flyer-theme-department_aisles .flyer-section-title {
  text-align: left;
  letter-spacing: 0.04em;
}

.flyer-canvas-page-public {
  margin-bottom: 1.5rem;
}

.flyer-canvas-reflow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.flyer-canvas-reflow .flyer-deal {
  grid-column: auto;
}

.flyer-canvas-text {
  grid-column: 1 / -1;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0.35rem 0;
}

.flyer-canvas-text--masthead {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.flyer-canvas-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
}

.flyer-canvas-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 6px;
}

.flyer-canvas-shape {
  min-height: 48px;
  border-radius: 6px;
}

.flyer-print-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.flyer-page--print .flyer-deal-actions {
  display: none;
}

@media print {
  .store-header,
  .store-banner,
  .store-footer,
  .flyer-deal-actions,
  .flyer-print-bar {
    display: none !important;
  }
  .flyer-circular {
    box-shadow: none;
    border-color: #000;
  }
  .flyer-page {
    max-width: none;
  }
}
