/* ==========================================================================
   CONSTRUCTIVISM THEME — Soviet Avant-Garde, Revolutionary, Editorial
   MantleKit Theme System
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@700&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --bg: #e8e0d0;
  --fg: #1f1a15;
  --primary: #c62828;
  --card-bg: #f0e8db;
  --muted-fg: #6b5f50;
  --muted-bg: #ddd5c5;
  --secondary: #2a2320;
  --secondary-fg: #e8e0d0;
  --border: #1f1a15;
  --cream: #e8e0d0;
  --light-cream: #f5f0e8;
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Source Serif 4', serif;
  --radius: 0px;
  --max-w: 1200px;
  --nav-h: 5rem;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; border: none; background: none; }

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---------- Page-level Constructivist Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--primary);
  clip-path: polygon(0 0, 38% 0, 22% 100%, 0 100%);
  z-index: 0;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  top: 12%;
  right: 12%;
  width: 180px;
  height: 6px;
  background: var(--fg);
  transform: rotate(-55deg);
  box-shadow: 60px 50px 0 0 var(--fg);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 3rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
p { max-width: 65ch; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}
section {
  position: relative;
  z-index: 1;
  padding: 6rem 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.875rem 2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  font-size: 0.95rem;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--primary);
  color: var(--cream);
  border: 2px solid var(--primary);
}
.btn-primary:hover { background: #a51d1d; border-color: #a51d1d; }
.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 2px solid var(--fg);
}
.btn-outline:hover { background: var(--fg); color: var(--cream); }
.btn-outline-cream {
  background: transparent;
  color: var(--cream);
  border: 2px solid var(--cream);
}
.btn-outline-cream:hover { background: var(--cream); color: var(--primary); }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 4px solid var(--fg);
  display: flex;
  align-items: center;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.navbar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg);
}
.navbar-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.navbar-links a {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  color: var(--fg);
  transition: color 0.15s;
}
.navbar-links a:hover,
.navbar-links a.active { color: var(--primary); }
.navbar-cta .btn { font-size: 0.85rem; padding: 0.625rem 1.5rem; }

/* Mobile nav toggle */
.nav-toggle { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.nav-toggle span { width: 24px; height: 2px; background: var(--fg); }

/* ---------- Hero ---------- */
.hero {
  padding: 8rem 0 6rem;
  min-height: 80vh;
  display: flex;
  align-items: center;
}
.hero-content { max-width: 640px; }
.hero .eyebrow {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  color: var(--muted-fg);
  margin-bottom: 1.5rem;
  display: block;
}
.hero h1 span { color: var(--primary); display: block; }
.hero p {
  font-size: 1.2rem;
  color: var(--muted-fg);
  margin: 1.5rem 0 2.5rem;
  line-height: 1.8;
}
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Logo Bar ---------- */
.logo-bar {
  padding: 3rem 0;
  border-top: 2px solid var(--muted-bg);
  border-bottom: 2px solid var(--muted-bg);
}
.logo-bar p {
  text-align: center;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--muted-fg);
  margin-bottom: 1.5rem;
}
.logo-names {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}
.logo-names span {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
  color: var(--muted-fg);
  opacity: 0.6;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
  padding: 4rem 0;
}
.stats-grid {
  display: flex;
  justify-content: center;
  gap: 0;
}
.stat-item {
  text-align: center;
  padding: 0 3rem;
  border-right: 2px solid var(--fg);
}
.stat-item:last-child { border-right: none; }
.stat-number {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.5rem;
  color: var(--fg);
  display: block;
}
.stat-label {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted-fg);
}

/* ---------- Card Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.card {
  padding: 2rem;
  border: 2px solid var(--fg);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 6px 6px 0 var(--fg); }

/* Card variant cycling */
.card-grid .card:nth-child(3n+1) {
  background: var(--secondary);
  color: var(--cream);
  border-color: var(--secondary);
}
.card-grid .card:nth-child(3n+1) .card-icon { color: var(--primary); }
.card-grid .card:nth-child(3n+1) h3 { color: var(--cream); }
.card-grid .card:nth-child(3n+1) p { color: var(--cream); opacity: 0.85; }
.card-grid .card:nth-child(3n+1) .btn {
  background: var(--primary);
  color: var(--cream);
  border-color: var(--primary);
}
.card-grid .card:nth-child(3n+1) .card-meta { color: var(--cream); opacity: 0.6; }

.card-grid .card:nth-child(3n+2) {
  background: var(--card-bg);
  color: var(--fg);
  border-color: var(--fg);
}
.card-grid .card:nth-child(3n+2) .btn {
  background: var(--primary);
  color: var(--cream);
  border-color: var(--primary);
}

.card-grid .card:nth-child(3n+3) {
  background: var(--primary);
  color: var(--light-cream);
  border-color: var(--primary);
}
.card-grid .card:nth-child(3n+3) .card-icon { color: var(--light-cream); }
.card-grid .card:nth-child(3n+3) h3 { color: var(--light-cream); }
.card-grid .card:nth-child(3n+3) p { color: var(--light-cream); opacity: 0.9; }
.card-grid .card:nth-child(3n+3) .btn {
  background: transparent;
  color: var(--cream);
  border: 2px solid var(--cream);
}
.card-grid .card:nth-child(3n+3) .btn:hover {
  background: var(--cream);
  color: var(--primary);
}
.card-grid .card:nth-child(3n+3) .card-meta { color: var(--light-cream); opacity: 0.7; }

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}
.card h3 { margin-bottom: 0.75rem; }
.card p { font-size: 0.95rem; line-height: 1.6; }

/* ---------- Section Headers ---------- */
.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-header h2 { margin-bottom: 1rem; }
.section-header p {
  color: var(--muted-fg);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Code Preview ---------- */
.code-section {
  padding: 6rem 0;
}
.code-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.code-left h2 { margin-bottom: 1.5rem; }
.code-checklist { margin-top: 1.5rem; }
.code-checklist li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 1.05rem;
}
.code-checklist li::before {
  content: '\2713';
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
}
.code-block {
  background: var(--secondary);
  color: var(--cream);
  padding: 2rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  border: 2px solid var(--fg);
  overflow-x: auto;
}
.code-block .string { color: var(--primary); }
.code-block .keyword { color: var(--cream); }
.code-block .comment { color: var(--muted-fg); }

/* ---------- Manifesto ---------- */
.manifesto {
  background: var(--secondary);
  color: var(--cream);
  padding: 6rem 0;
  text-align: center;
}
.manifesto h2 { color: var(--cream); margin-bottom: 2rem; font-size: clamp(2rem, 5vw, 3.5rem); }
.manifesto blockquote {
  font-family: var(--font-body);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-style: italic;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.8;
  opacity: 0.9;
}
.manifesto .accent-line {
  width: 80px;
  height: 4px;
  background: var(--primary);
  margin: 2rem auto 0;
}

/* ---------- Testimonials ---------- */
.testimonial-card p.quote {
  font-style: italic;
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}
.testimonial-author {
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.testimonial-role {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* ---------- Pricing ---------- */
.pricing-card { text-align: center; }
.pricing-card .plan-name {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.pricing-card .price {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.pricing-card .price-period {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 1.5rem;
}
.pricing-features {
  text-align: left;
  margin-bottom: 2rem;
}
.pricing-features li {
  padding: 0.4rem 0;
  font-size: 0.95rem;
}
.pricing-features li::before {
  content: '\2713';
  margin-right: 0.5rem;
  font-weight: 700;
}
/* Pricing button overrides for readability on all card variants */
.pricing-card .btn { width: 100%; justify-content: center; }

/* ---------- Blog Cards ---------- */
.blog-card .card-meta {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--muted-fg);
  margin-bottom: 0.75rem;
  display: block;
}
.blog-card h3 { margin-bottom: 0.75rem; }
.blog-card p { margin-bottom: 1.5rem; }
.read-more {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}
.card-grid .card:nth-child(3n+1) .read-more { color: var(--primary); }
.card-grid .card:nth-child(3n+3) .read-more { color: var(--cream); }

/* ---------- FAQ / Accordion ---------- */
.faq-item {
  border: 4px solid var(--fg);
  margin-bottom: 1rem;
}
.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}
.faq-question:hover { color: var(--primary); }
.faq-question .icon {
  font-size: 1.5rem;
  transition: transform 0.2s;
  font-weight: 400;
}
.faq-item.open .faq-question .icon { transform: rotate(45deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 1.5rem 1.25rem;
}
.faq-answer p { line-height: 1.7; }

/* ---------- CTA Section ---------- */
.cta-section {
  background: var(--primary);
  color: var(--cream);
  padding: 5rem 0;
  text-align: center;
}
.cta-section h2 { color: var(--cream); margin-bottom: 1rem; }
.cta-section p { margin: 0 auto 2rem; opacity: 0.9; font-size: 1.1rem; }
.cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  background: var(--primary);
  color: var(--cream);
  border-top: 3px solid var(--fg);
  padding: 4rem 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
}
.footer-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}
.footer-tagline { opacity: 0.8; font-size: 0.95rem; }
.footer-col h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}
.footer-col a {
  display: block;
  padding: 0.3rem 0;
  opacity: 0.8;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}
.footer-col a:hover { opacity: 1; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---------- Theme Switcher ---------- */
.theme-switcher {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
}
.theme-switcher-toggle {
  width: 48px;
  height: 48px;
  background: var(--secondary);
  color: var(--cream);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  border: 2px solid var(--fg);
  transition: background 0.15s;
}
.theme-switcher-toggle:hover { background: var(--fg); }
.theme-switcher-menu {
  position: absolute;
  bottom: 56px;
  right: 0;
  background: var(--secondary);
  border: 2px solid var(--fg);
  border-radius: var(--radius);
  min-width: 180px;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  flex-direction: column;
  overflow-x: hidden;
}
.theme-switcher-menu.open { display: flex; }
.theme-switcher-menu a {
  padding: 0.6rem 1rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--cream);
  transition: background 0.15s;
}
.theme-switcher-menu a:hover { background: rgba(255,255,255,0.1); }
.theme-switcher-menu a.current { color: var(--primary); background: rgba(255,255,255,0.05); }

/* ---------- Contact Form ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
}
.form-group { margin-bottom: 1.5rem; }
.form-group label {
  display: block;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--fg);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 140px; }
.contact-sidebar {
  background: var(--secondary);
  color: var(--cream);
  padding: 2rem;
  border: 2px solid var(--fg);
}
.contact-sidebar h3 {
  color: var(--cream);
  margin-bottom: 1.5rem;
}
.contact-sidebar p {
  opacity: 0.85;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.contact-sidebar .info-item {
  margin-bottom: 1.25rem;
}
.contact-sidebar .info-label {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  opacity: 0.6;
  margin-bottom: 0.25rem;
}

/* ---------- KB Page ---------- */
.search-bar {
  max-width: 600px;
  margin: 0 auto 3rem;
  position: relative;
}
.search-bar input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid var(--fg);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
}
.search-bar input:focus { outline: none; border-color: var(--primary); }

/* ---------- About Page ---------- */
.about-story { max-width: 700px; }
.about-story p { margin-bottom: 1.5rem; font-size: 1.05rem; line-height: 1.8; }
.team-card { text-align: center; }
.team-card .avatar {
  width: 80px;
  height: 80px;
  background: var(--muted-bg);
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.card-grid .card:nth-child(3n+1) .avatar { background: rgba(255,255,255,0.15); }
.card-grid .card:nth-child(3n+3) .avatar { background: rgba(255,255,255,0.2); }
.team-card .team-name {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.team-card .team-role {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---------- Page Headers ---------- */
.page-header {
  padding: 6rem 0 3rem;
  text-align: center;
}
.page-header h1 { margin-bottom: 1rem; }
.page-header p { color: var(--muted-fg); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* ---------- Mission Section (red bg) ---------- */
.mission-section {
  background: var(--primary);
  color: var(--cream);
  padding: 5rem 0;
  text-align: center;
}
.mission-section h2 { color: var(--cream); margin-bottom: 1.5rem; }
.mission-section p { margin: 0 auto; opacity: 0.9; font-size: 1.1rem; max-width: 600px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .navbar-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 4px solid var(--fg);
    padding: 1.5rem 2rem;
    gap: 1rem;
  }
  .nav-toggle { display: flex; }
  .navbar-cta { display: none; }

  .hero { min-height: auto; padding: 5rem 0 3rem; }

  .card-grid {
    grid-template-columns: 1fr;
  }
  .code-split {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
  .stat-item { border-right: none; border-bottom: 2px solid var(--fg); padding: 0 0 2rem; }
  .stat-item:last-child { border-bottom: none; padding-bottom: 0; }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .logo-names { gap: 1.5rem; }
}
