/**
 * Brokie Premium Design System
 * Shared foundation for all HTML marketplace templates.
 * Override per-template via :root in styles.css (--primary, --secondary only).
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&display=swap');

:root {
  /* Surfaces & text */
  --bg-main: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-main: #111827;
  --text-muted: #4b5563;

  /* Legacy aliases (templates may still reference these) */
  --bg-color: var(--bg-main);
  --surface-color: var(--bg-secondary);
  --bg: var(--bg-main);
  --surface: var(--bg-secondary);
  --ink: var(--text-main);
  --muted: var(--text-muted);

  /* Brand (override in template styles.css) */
  --primary: #1e40af;
  --secondary: #d97706;
  --border-color: rgba(128, 128, 128, 0.2);

  /* Text on primary-colored surfaces (footer, CTA strips) */
  --text-on-primary: #ffffff;

  /* Typography — Inter body, Poppins headings */
  --font-display: "Poppins", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, sans-serif;

  /* Layout */
  --container-max: 1200px;
  --section-padding: 5rem 1rem;
  --section-padding-mobile: 4rem 1rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;
  --radius-pill: 99px;

  /* Motion */
  --transition: all 0.3s ease;
}

[data-theme="dark"],
body.dark,
body.dark-mode {
  --bg-main: #0f172a;
  --bg-secondary: #1e293b;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --bg-color: var(--bg-main);
  --surface-color: var(--bg-secondary);
  --bg: var(--bg-main);
  --surface: var(--bg-secondary);
  --ink: var(--text-main);
  --muted: var(--text-muted);
  --border-color: rgba(128, 128, 128, 0.25);
  color-scheme: dark;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-main);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a { color: inherit; text-decoration: none; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p { margin: 0 0 1rem; color: var(--text-muted); }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.section,
section.section {
  padding: var(--section-padding);
}

@media (max-width: 768px) {
  .section,
  section.section { padding: var(--section-padding-mobile); }
}

/* ── Buttons ── */
.btn,
.btn-primary,
.btn.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-on-primary);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover,
.btn.btn-primary:hover,
.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary,
.btn.btn-secondary,
.btn.btn-outline,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  color: var(--primary);
  background: transparent;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover,
.btn.btn-secondary:hover,
.btn.btn-outline:hover,
.btn-outline:hover {
  background: var(--primary);
  color: var(--text-on-primary);
}

/* Primary surfaces — footer, feature strips, CTA banners */
.on-primary,
.features-strip,
.site-footer,
.cta-banner,
.filter-tab.active,
.feature-tab.active,
.toast {
  color: var(--text-on-primary);
}

/* ── Cards ── */
.card,
.product-card,
.team-card,
.cat-card,
.testimonial-card,
.why-card,
.plan,
.pricing-card,
.menu-card,
.service-card,
.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  overflow: hidden;
  box-shadow: none;
}

.card:hover,
.product-card:hover,
.team-card:hover,
.cat-card:hover,
.testimonial-card:hover,
.why-card:hover,
.plan:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border-color));
}

/* ── Hero overlay ── */
.hero {
  position: relative;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.82) 0%,
    rgba(15, 23, 42, 0.55) 50%,
    rgba(15, 23, 42, 0.35) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.hero > .container,
.hero > .hero-content,
.hero .hero-grid {
  position: relative;
  z-index: 2;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Hero text on images stays readable */
.hero.has-image h1,
.hero.has-image h2,
.hero.has-image h3,
.hero.has-image p,
.hero.has-image .badge {
  color: var(--text-on-primary);
}

/* ── Newsletter / subscribe ── */
.newsletter-cta,
.newsletter-section,
.subscribe-section {
  padding: var(--section-padding);
  background: var(--bg-secondary);
  overflow: visible;
  text-align: center;
}

.newsletter-form,
.subscribe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 520px;
  margin: 1rem auto 0;
  align-items: stretch;
  justify-content: center;
}

.newsletter-form input,
.subscribe-form input {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
}

@media (max-width: 640px) {
  .newsletter-form,
  .subscribe-form {
    flex-direction: column;
  }

  .newsletter-form input,
  .subscribe-form input,
  .newsletter-form .btn,
  .subscribe-form .btn {
    width: 100%;
  }
}

/* ── Grids ── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Icon system ── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  flex-shrink: 0;
}

.icon svg,
svg.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm svg,
svg.icon-sm {
  width: 18px;
  height: 18px;
}

.icon-lg svg,
svg.icon-lg {
  width: 28px;
  height: 28px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-mark svg {
  width: 20px;
  height: 20px;
}

.theme-toggle svg,
.nav-toggle svg {
  width: 20px;
  height: 20px;
}

/* Star ratings */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--secondary, #f59e0b);
}

.stars svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

/* Trust badges / inline icons */
.trust-badges span,
.about-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-list li {
  display: flex;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.about-list li svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

/* ── Section headings ── */
.section-head {
  text-align: center;
  margin-bottom: 48px;
}

.section-head h2 {
  margin: 0 0 12px;
}

.section-head p {
  margin: 0 auto;
  max-width: 560px;
  font-size: 1.05rem;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-counter .num {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.stat-counter .lbl {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Images ── */
.hero-img,
.hero-img-main,
.hero-visual img,
.cat-card img,
.product-card img,
.team-card img {
  object-fit: cover;
  width: 100%;
}

/* ── Forms ── */
input, textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  transition: var(--transition);
  background: var(--bg-secondary);
  color: var(--text-main);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.icon-inline {
  display: inline-block;
  vertical-align: -2px;
  color: var(--secondary, #f59e0b);
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  margin-bottom: 16px;
}

/* Footer logo on primary background */
.site-footer .logo,
.footer-logo {
  color: var(--text-on-primary);
  margin-bottom: 12px;
}

/* simpleadmin-lite utility classes */
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  color: var(--text-on-primary);
  font-size: 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.admin-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
