/* ==========================================================================
   WALLCALCULATOR.APP - DESIGN SYSTEM & STYLESHEET
   Engineered for Core Web Vitals (100/100), Dark/Light Mode & Maximum AEO
   ========================================================================== */

:root {
  /* Color Palette - Construction & Blueprint Precision */
  --brand-primary: #F97316;       /* Safety Orange / High Viz */
  --brand-primary-hover: #EA580C;
  --brand-accent: #0284C7;        /* Blueprint Tech Blue */
  --brand-accent-hover: #0369A1;
  --brand-cyan: #06B6D4;
  --brand-success: #10B981;
  --brand-wood: #D97706;

  /* Theme: Dark (Default) */
  --bg-body: #0B0F19;
  --bg-surface: #111827;
  --bg-card: #182234;
  --bg-card-hover: #1F2C42;
  --bg-input: #0F172A;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #F97316;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --blueprint-grid: rgba(56, 189, 248, 0.08);
  --blueprint-line: #0284C7;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);

  /* Radius & Transitions */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #F1F5F9;
  --border-color: rgba(15, 23, 42, 0.1);
  --border-focus: #F97316;
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #94A3B8;
  --blueprint-grid: rgba(2, 132, 199, 0.06);
  --blueprint-line: #0284C7;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

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

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.header-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.3s ease;
}

[data-theme="light"] .header-nav {
  background: rgba(255, 255, 255, 0.85);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-logo svg {
  width: 32px;
  height: 32px;
}

.brand-logo span.accent {
  color: var(--brand-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
}

/* ==========================================================================
   HERO / CALCULATOR SPLIT SECTION
   ========================================================================== */
.hero-section {
  padding: 2.5rem 0 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(249, 115, 22, 0.12);
  color: var(--brand-primary);
  border: 1px solid rgba(249, 115, 22, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.65rem;
  margin-bottom: 1rem;
}

.hero-title .accent {
  color: var(--brand-primary);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.65;
}

.trust-badges {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.trust-item span.icon {
  font-size: 1.15rem;
}

/* ==========================================================================
   INTERACTIVE CALCULATOR CARD
   ========================================================================== */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: var(--bg-input);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  color: var(--brand-primary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.75rem 2.75rem 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.unit-tag {
  position: absolute;
  right: 0.85rem;
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-dim);
  pointer-events: none;
}

/* Radio Pill Group */
.pill-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.pill-option {
  position: relative;
}

.pill-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.pill-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.pill-option input[type="radio"]:checked + .pill-label {
  border-color: var(--brand-primary);
  background: rgba(249, 115, 22, 0.08);
  color: var(--text-main);
}

.pill-desc {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* Openings Section (Doors/Windows) */
.openings-box {
  background: rgba(0,0,0,0.15);
  border: 1px dashed var(--border-color);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.openings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.openings-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Slider Controls */
.slider-container {
  margin-bottom: 1.25rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.range-slider {
  width: 100%;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* ==========================================================================
   2D BLUEPRINT VISUALIZER (SVG)
   ========================================================================== */
.blueprint-wrapper {
  background: #060913;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  background-image: 
    linear-gradient(var(--blueprint-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}

.blueprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #38BDF8;
  letter-spacing: 0.08em;
}

#blueprint-svg {
  width: 100%;
  height: 180px;
  display: block;
  overflow: visible;
}

.blueprint-legend {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.725rem;
  color: #94A3B8;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ==========================================================================
   RESULTS DASHBOARD (MATERIAL TAKEOFF)
   ========================================================================== */
.results-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.results-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.takeoff-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.takeoff-card.highlight {
  border-color: var(--brand-primary);
  background: rgba(249, 115, 22, 0.06);
}

.takeoff-card.accent {
  border-color: var(--brand-accent);
  background: rgba(2, 132, 199, 0.06);
}

.takeoff-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.takeoff-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.2rem 0;
}

.takeoff-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Estimated Cost Box */
.cost-estimation-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cost-total-display {
  display: flex;
  flex-direction: column;
}

.cost-total-display .label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.cost-total-display .number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--brand-success);
}

.btn-toggle-costs {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-toggle-costs:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}

.cost-breakdown-details {
  display: none;
  padding-top: 0.85rem;
  margin-top: 0.85rem;
  border-top: 1px dashed var(--border-color);
}

.cost-breakdown-details.open {
  display: block;
}

.cost-table {
  width: 100%;
  font-size: 0.825rem;
  border-collapse: collapse;
}

.cost-table td {
  padding: 0.4rem 0.2rem;
  color: var(--text-muted);
}

.cost-table td.cost-num {
  text-align: right;
  font-weight: 600;
  color: var(--text-main);
}

/* Action Buttons (Print / Copy) */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-primary {
  background: var(--brand-primary);
  color: #FFFFFF;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

/* ==========================================================================
   COMPANION TOOLS (SILO CLUSTER SUITE)
   ========================================================================== */
.suite-section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.1);
}

.section-head {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 3rem;
}

.section-eyebrow {
  display: inline-block;
  color: var(--brand-primary);
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.15rem;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.975rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.tool-card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.tool-card-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tool-card-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   SEMANTIC EDUCATIONAL GUIDE & AEO ARTICLE
   ========================================================================== */
.article-section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border-color);
}

.prose-content {
  max-width: 860px;
  margin: 0 auto;
}

/* AEO Direct Answer Box */
.aeo-direct-box {
  background: rgba(249, 115, 22, 0.08);
  border-left: 4px solid var(--brand-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.35rem;
  margin-bottom: 2.5rem;
}

.aeo-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.aeo-text {
  font-size: 0.95rem;
  line-height: 1.7;
}

.prose-content h2 {
  font-size: 1.85rem;
  margin: 2.5rem 0 1rem;
  color: var(--text-main);
}

.prose-content h3 {
  font-size: 1.35rem;
  margin: 1.75rem 0 0.75rem;
  color: var(--text-main);
}

.prose-content p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.prose-content ul, .prose-content ol {
  color: var(--text-muted);
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.75;
}

.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.formula-code {
  background: var(--bg-input);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  color: var(--brand-cyan);
  font-weight: 700;
  display: block;
  margin: 0.5rem 0;
}

/* Comparison Table */
.data-table-wrapper {
  overflow-x: auto;
  margin: 1.75rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
}

.data-table td {
  color: var(--text-muted);
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  padding: 1.15rem 1.25rem;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-icon {
  font-size: 1.25rem;
  color: var(--brand-primary);
  transition: transform 0.2s ease;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  padding: 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding-bottom: 1.25rem;
  transition: max-height 0.3s ease-in-out;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  background: var(--bg-surface);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.footer-links a:hover {
  color: var(--brand-primary);
}

/* ==========================================================================
   PRINT STYLESHEET (FOR CONTRACTOR TAKEOFFS)
   ========================================================================== */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .header-nav, .suite-section, .article-section, .site-footer, .action-buttons, .mode-tabs {
    display: none !important;
  }
  .hero-grid {
    grid-template-columns: 1fr !important;
  }
  .calc-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .blueprint-wrapper {
    background: #FFFFFF !important;
    border: 1px solid #000000 !important;
  }
  .takeoff-card {
    border: 1px solid #CCCCCC !important;
    color: #000000 !important;
  }
}
