/* ============================================
   WESTWARD CONSTRUCTION — Main Stylesheet
   Mobile-first responsive design
   ============================================ */

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

:root {
  /* =====================================================
     PHYSICAL BRAND TOKENS — absolute colors, never flip
     between themes. Use for brand-absolute elements:
     logo brass period, eyebrow color, specific hero art.
     ===================================================== */
  --charcoal: #2C2C2C;
  --brass: #B8860B;
  --brass-light: #D4A842;
  --offwhite: #FAFAF8;
  --text: #333333;
  --text-light: #6B6B6B;
  --sage: #7A8B6F;
  --navy: #1B3A5C;
  --navy-hover: #244B73;
  --white: #FFFFFF;
  --border: #E5E5E0;
  --shadow: 0 2px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --radius: 4px;
  --max-width: 1200px;
  --header-height: 80px;

  /* =====================================================
     SEMANTIC ROLE TOKENS — layered on top (Stage B,
     2026-04-19). These describe what a color DOES, not
     what it is. They flip between themes; physical tokens
     above stay fixed. In light mode they resolve to the
     same values, so no visual change. Stage C adds
     [data-theme='dark'] overrides of just these tokens.
     ===================================================== */
  --bg: var(--offwhite);             /* page background */
  --surface-1: var(--white);         /* cards, header, elevated panels */
  --surface-2: #F2F1EC;              /* hover / nested surface */
  --surface-3: #E5E5E0;              /* borders, subtle dividers */
  --text-body: var(--text);          /* body copy */
  --text-muted: var(--text-light);   /* meta, captions */
  --heading: var(--charcoal);        /* h1-h4, btn-outline text, logo wordmark */
  --border-subtle: var(--border);    /* card borders, dividers */
  --cta: var(--brass);               /* primary CTA bg */
  --cta-hover: var(--brass-light);   /* primary CTA :hover */
  --cta-on: var(--charcoal);         /* text on CTA button */
  --accent: var(--brass);            /* eyebrows, underlines, brass accents */
  --focus-ring: rgba(184, 134, 11, 0.15); /* input focus outline */
  --on-dark: var(--white);           /* text on intentional dark surfaces
                                        (footer, page-header, cta-section,
                                        contact-info-card, mobile FAB) —
                                        does not flip in dark mode */
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-body);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--heading);
}

h1 { font-size: 2.2rem; margin-bottom: 1rem; }
h2 { font-size: 1.8rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 14px 32px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
}

/* --- Primary CTA: brass (semantic --cta). Stage A decision: brand anchor
     is also the CTA color in both themes. Charcoal text (--cta-on) on
     brass gives ~7.5:1 contrast (WCAG AAA). --- */
.btn-primary {
  background: var(--cta);
  color: var(--cta-on);
}
.btn-primary:hover {
  background: var(--cta-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--heading);
  border: 2px solid var(--heading);
}
.btn-outline:hover {
  background: var(--heading);
  color: var(--surface-1);
}

/* Secondary CTA: navy body, brass ring. Used for form submissions and
   paired CTAs where we want brand contrast against .btn-primary. */
.btn-secondary {
  background: var(--navy);
  color: #FFFFFF;
  border: 2px solid var(--brass);
}
.btn-secondary:hover {
  background: var(--navy-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* btn-brass kept as an alias for backward compat. Prefer btn-primary in new markup. */
.btn-brass { background: var(--cta); color: var(--cta-on); }
.btn-brass:hover { background: var(--cta-hover); transform: translateY(-1px); box-shadow: var(--shadow); }

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 1px;
}

/* Brass period is brand-absolute — stays brass regardless of theme */
.logo span {
  color: var(--brass);
}

.nav-desktop {
  display: none;
  gap: 32px;
  align-items: center;
}

.nav-desktop a {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-body);
  transition: color 0.2s;
  position: relative;
}

.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--accent);
}

.nav-desktop a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.header-phone {
  display: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--heading);
}

.header-cta {
  display: none;
}

/* Mobile menu toggle */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--heading);
  transition: all 0.3s ease;
}

.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile nav */
.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface-1);
  padding: 40px 24px;
  z-index: 999;
  flex-direction: column;
  gap: 0;
}

.nav-mobile.open { display: flex; }

.nav-mobile a {
  display: block;
  padding: 16px 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-mobile a:last-child { border-bottom: none; }

.nav-mobile .mobile-phone {
  margin-top: 24px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.nav-mobile .btn {
  margin-top: 16px;
  text-align: center;
}

/* --- Hero --- */
.hero {
  margin-top: var(--header-height);
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-image {
  position: absolute;
  inset: 0;
  background: var(--charcoal);  /* literal charcoal fallback bg when no image loads */
  z-index: 0;
}

.hero-image .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3a3a3a 0%, #1a1a1a 100%);
  color: rgba(255,255,255,0.3);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px 24px;
  color: #FFFFFF;  /* literal white — hero text is always on dark photo overlay, doesn't flip with theme */
}

.hero h1 {
  color: var(--accent);  /* brass — brand anchor on dark overlay */
  font-size: 2.5rem;
  max-width: 600px;
  margin-bottom: 1.25rem;
}

.hero p {
  font-size: 1.05rem;
  max-width: 500px;
  opacity: 0.9;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Sections --- */
section { padding: 80px 0; }

.section-light { background: var(--surface-1); }
/* NOTE: .section-dark will be retired in Stage C per 2026-04-19 decision.
   Keeping it using physical tokens until then so the inversion pattern works. */
.section-dark { background: var(--charcoal); color: #FFFFFF; }
.section-dark h2, .section-dark h3 { color: #FFFFFF; }

.section-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 48px;
}

/* --- Services Grid --- */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.services-grid.services-grid-2col,
.grid-2col {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (max-width: 520px) {
  .services-grid.services-grid-2col,
  .grid-2col { grid-template-columns: 1fr !important; }
}

.service-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.service-card-image {
  height: 220px;
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.service-card-body {
  padding: 28px;
}

.service-card h3 {
  margin-bottom: 0.5rem;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.service-card .learn-more {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brass);
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.service-card .learn-more:hover { color: var(--brass-light); }

/* --- Portfolio Grid --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.portfolio-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.portfolio-item-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.portfolio-item-image.kitchen { background: linear-gradient(135deg, #5a6555 0%, #3d4a38 100%); }
.portfolio-item-image.bathroom { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); }
.portfolio-item-image.whole-house { background: linear-gradient(135deg, #6b5b4e 0%, #4a3f35 100%); }
.portfolio-item-image.addition { background: linear-gradient(135deg, #546a7b 0%, #3a4f5e 100%); }
.portfolio-item-image.new-build { background: linear-gradient(135deg, #5c5470 0%, #3e3850 100%); }
.portfolio-item-image.exterior { background: linear-gradient(135deg, #4e6a5a 0%, #354a3e 100%); }

.portfolio-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 45%, rgba(0,0,0,0.1) 100%);
  opacity: 1;
  transition: background 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

.portfolio-item:hover .portfolio-item-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.45) 55%, rgba(0,0,0,0.1) 100%);
}

.portfolio-item-info h4 {
  color: var(--on-dark);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.portfolio-item-info p {
  color: rgba(255,255,255,0.92);
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* --- Stats Bar --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  text-align: center;
  padding: 48px 0;
}

.stat-item .stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brass);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-item .stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-dark .stat-label { color: rgba(255,255,255,0.6); }

/* --- Process Steps --- */
.process-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  counter-reset: step;
}

.process-step {
  counter-increment: step;
  position: relative;
  padding-left: 72px;
}

.process-step::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--brass);
  opacity: 0.4;
}

.process-step h3 { margin-bottom: 0.5rem; }

.process-step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Testimonials --- */
.testimonial-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 40px;
  margin-bottom: 24px;
}

.testimonial-card blockquote {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  color: var(--charcoal);
}

.testimonial-card blockquote::before {
  content: '"';
  font-size: 3rem;
  color: var(--brass);
  line-height: 0;
  vertical-align: -0.5em;
  margin-right: 4px;
}

.testimonial-author {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-body);
}

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

/* --- CTA Section --- */
.cta-section {
  text-align: center;
  padding: 80px 0;
  background: var(--charcoal);
  color: var(--on-dark);
}

.cta-section h2 {
  color: var(--on-dark);
  margin-bottom: 1rem;
}

.cta-section p {
  max-width: 500px;
  margin: 0 auto 2rem;
  opacity: 0.8;
}

/* --- Contact Form --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-body);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--text-body);
  background: var(--surface-1);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea { min-height: 120px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.contact-info-card {
  background: var(--charcoal);
  color: var(--on-dark);
  padding: 40px;
  border-radius: var(--radius);
}

.contact-info-card h3 { color: var(--on-dark); margin-bottom: 1.5rem; }

.contact-detail {
  margin-bottom: 24px;
}

.contact-detail .label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 4px;
}

.contact-detail .value {
  font-size: 1.05rem;
}

.contact-detail a {
  color: var(--on-dark);
  transition: color 0.2s;
}

.contact-detail a:hover { color: var(--brass-light); }

/* --- Service Area --- */
.area-list {
  columns: 2;
  column-gap: 24px;
}

.area-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.95rem;
}

/* --- Footer --- */
.site-footer {
  background: #1a1a1a;
  color: rgba(255,255,255,0.7);
  padding: 60px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h4 {
  color: var(--on-dark);
  font-size: 1rem;
  margin-bottom: 16px;
}

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s;
}

.footer-col a:hover { color: var(--brass-light); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.8rem;
}

.footer-license {
  color: rgba(255,255,255,0.4);
}

/* --- Floating Mobile CTA --- */
.mobile-cta {
  display: block;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  width: 56px;
  height: 56px;
  background: var(--navy);
  border: 2px solid var(--brass);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
}

.mobile-cta:hover { transform: scale(1.1); }

.mobile-cta svg {
  width: 24px;
  height: 24px;
  fill: var(--on-dark);
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Page Header (inner pages) --- */
.page-header {
  margin-top: var(--header-height);
  padding: 60px 0;
  background: var(--charcoal);
  color: var(--on-dark);
  text-align: center;
}

.page-header h1 { color: var(--accent); }
.page-header p { color: rgba(255,255,255,0.7); max-width: 600px; margin: 0 auto; }

/* ============================================
   RESPONSIVE — Tablet (768px+)
   ============================================ */
@media (min-width: 768px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.2rem; }

  .hero h1 { font-size: 3.2rem; }
  .hero { min-height: 80vh; }
  .hero-content { padding: 80px 24px; }

  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { grid-template-columns: repeat(4, 1fr); }
  .process-steps { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .area-list { columns: 3; }
}

/* ============================================
   RESPONSIVE — Desktop (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  h1 { font-size: 3.5rem; }

  .hero h1 { font-size: 3.8rem; }

  .nav-desktop { display: flex; }
  .menu-toggle { display: none; }
  .header-phone { display: block; }
  .header-cta { display: inline-block; }
  .mobile-cta { display: none; }

  .services-grid { grid-template-columns: repeat(3, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(3, 1fr); }
  .contact-grid { grid-template-columns: 1.2fr 0.8fr; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}

/* ============================================
   RESPONSIVE — Large Desktop (1280px+)
   ============================================ */
@media (min-width: 1280px) {
  .hero h1 { font-size: 4.2rem; }
  .container { padding: 0 40px; }
}
