/* ==========================================================================
   North Texas Smart Living — homepage styles
   Single stylesheet (FR-009 branding, FR-011 responsive).
   Palette source: website/branding/brand-mockup.png + logo variants
   (analyzed 2026-09-22; values recorded as design-token source of truth).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand greens (from logo gradient + mockup) */
  --brand-deep: #1e4b3e; /* logo gradient top / headings */
  --brand-mid: #2e5f50; /* mid green */
  --brand-sage: #7fa795; /* sage (logo gradient bottom) */
  --brand-sage-light: #8ab0a0; /* light sage accents */

  /* Neutrals (mockup warm whites + slate teal) */
  --neutral-bg: #ffffff;
  --neutral-surface: #f5f4f1;
  --neutral-surface-2: #f7f6f3;
  --neutral-ink: #24332e; /* body text (dark green-tinted) */
  --neutral-ink-soft: #52635c; /* muted text */
  --neutral-border: #dce4e0;
  --neutral-slate: #8fa5a8; /* mockup backdrop (accents only) */

  /* Semantic */
  --color-text: var(--neutral-ink);
  --color-text-soft: var(--neutral-ink-soft);
  --color-heading: var(--brand-deep);
  --color-bg: var(--neutral-bg);
  --color-surface: var(--neutral-surface);
  --color-border: var(--neutral-border);
  --color-primary: var(--brand-deep);
  --color-primary-hover: var(--brand-mid);
  --color-accent: var(--brand-sage);
  --color-on-dark: #f5f4f1;
  --color-focus: #c96f2d; /* accessible focus ring (contrast on all surfaces) */

  /* Typography (research R-5: system font stack, zero webfonts) */
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Layout */
  --container-max: 1120px;
  --container-pad: clamp(1.25rem, 4vw, 2rem);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 10px 30px rgba(30, 75, 62, 0.08);
  --header-h: 72px;

  /* Motion (a11y: reduced-motion respected in main.js + media query) */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h); /* sticky header offset for anchors */
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  color: var(--color-heading);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-primary-hover);
}

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

/* Accessible focus (FR-017) */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-on-dark);
  color: var(--brand-deep);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}

.skip-link:focus-visible {
  left: 0;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: clamp(3.5rem, 8vw, 5.5rem);
}

.section-header {
  max-width: 720px;
  margin-bottom: 2.5rem;
}

.section-header p {
  font-size: 1.125rem;
  color: var(--color-text-soft);
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-dark);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-on-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

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

.btn-ghost-dark {
  background: transparent;
  color: var(--color-on-dark);
  border-color: rgba(245, 244, 241, 0.65);
}

.btn-ghost-dark:hover {
  background: rgba(245, 244, 241, 0.12);
  color: var(--color-on-dark);
}

/* --------------------------------------------------------------------------
   4. Header / navigation (FR-002 anchor nav)
   -------------------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--brand-deep);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand-logo {
  width: clamp(34px, 6vw, 44px);
  height: auto;
}

.brand-name {
  display: flex;
  flex-direction: column;
  letter-spacing: 0.02em;
}

.brand-name strong {
  text-transform: uppercase;
}

.brand-name span {
  font-weight: 300;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--brand-mid);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 1rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.3rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-text);
  padding: 0.35rem 0.1rem;
}

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

.nav-cta {
  display: inline-block;
}

/* Mobile nav: links stay visible and wrap to a second row (FR-002 anchor
   navigation must work on phone; no JS/hamburger needed) */
@media (max-width: 860px) {
  .header {
    height: auto;
  }

  .header-inner {
    flex-wrap: wrap;
    padding-block: 0.5rem;
    gap: 0.35rem 1rem;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    justify-content: space-between;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
    font-size: 0.95rem;
  }
}

/* --------------------------------------------------------------------------
   5. Hero (#home)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  color: var(--color-on-dark);
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand-mid) 60%, #3c6f5c 100%);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

.hero h1 {
  color: #fff;
  margin-bottom: 1rem;
}

.hero .lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: rgba(245, 244, 241, 0.92);
  max-width: 54ch;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.75rem;
}

.hero-meta {
  margin-bottom: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--brand-sage-light);
}

.hero-media img {
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-media {
    order: -1;
  }

  .hero-media img {
    max-height: 260px;
    width: 100%;
    object-fit: cover;
  }
}

/* --------------------------------------------------------------------------
   6. Services (#services)
   -------------------------------------------------------------------------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}

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

.service-card p {
  color: var(--color-text-soft);
  margin: 0;
}

/* --------------------------------------------------------------------------
   7. Packages (#packages)
   -------------------------------------------------------------------------- */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.package-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.package-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(30, 75, 62, 0.14);
}

.package-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: var(--neutral-surface);
}

.package-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.4rem 1.6rem;
}

.package-body h3 {
  margin-bottom: 0.4rem;
}

.package-body p {
  color: var(--color-text-soft);
  flex: 1;
}

.package-link {
  align-self: flex-start;
  margin-top: 0.5rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. Process (#process)
   -------------------------------------------------------------------------- */
.process-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  max-width: 780px;
  display: grid;
  gap: 1.5rem;
}

.process-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  align-items: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
}

.process-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-dark);
  font-weight: 700;
  font-size: 1.15rem;
}

.process-steps h3 {
  margin-bottom: 0.25rem;
}

.process-steps p {
  color: var(--color-text-soft);
  margin: 0;
}

/* --------------------------------------------------------------------------
   9. Contact / quote form (#contact) — shell styles (form fields in US2)
   -------------------------------------------------------------------------- */
.contact {
  background: var(--color-surface-2, var(--neutral-bg));
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* FR-011: grid children must be shrinkable so long unbreakable content
   (the business email) can wrap instead of forcing horizontal overflow. */
.contact-grid > * {
  min-width: 0;
}

.contact-info p {
  color: var(--color-text-soft);
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  margin-top: 0.5rem;
  overflow-wrap: anywhere;
}

#form-status,
.noscript-note {
  overflow-wrap: anywhere;
}

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

/* Quote form (US2, T022) */
.quote-form {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field label {
  font-weight: 600;
  color: var(--color-heading);
}

.req {
  color: var(--color-focus);
}

.opt {
  font-weight: 400;
  color: var(--color-text-soft);
  font-size: 0.9rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  width: 100%;
}

.form-field textarea {
  resize: vertical;
}

.field-error {
  color: #b3261e;
  font-size: 0.9rem;
  margin: 0;
}

.consent-field .consent-label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
  color: var(--color-text);
}

.consent-field input[type='checkbox'] {
  width: auto;
  margin-top: 0.2rem;
  accent-color: var(--color-primary);
}

.form-submit {
  justify-self: start;
  min-width: 200px;
}

.form-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

#form-status {
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.noscript-note {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
}

/* Honeypot (FR-015): visually hidden, out of tab order, not labelled */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: linear-gradient(135deg, #16382e 0%, var(--brand-deep) 100%);
  color: rgba(245, 244, 241, 0.9);
  padding-block: 3rem 2.5rem;
}

.footer-inner {
  display: grid;
  gap: 0.75rem;
}

.footer a {
  color: var(--brand-sage-light);
}

.footer .footer-note {
  font-size: 0.9rem;
  color: rgba(245, 244, 241, 0.65);
  margin-top: 0.5rem;
}

.footer-logo {
  width: clamp(120px, 40vw, 200px);
  height: auto;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   11. Reduced motion (a11y)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
