/* ==========================================================================
   Happy Home Care — shared stylesheet
   Hand-written, mobile-first, no build step, no external dependencies.
   Palette is warm + trustworthy; color pairings meet WCAG AA contrast.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Warm, senior-care palette */
  --bg:            #fbf7f0; /* warm cream page background */
  --surface:       #ffffff; /* cards, forms */
  --surface-alt:   #f3ece0; /* alternating section bands */
  --text:          #233230; /* near-black slate green — ~13:1 on --bg */
  --muted:         #4f5d5a; /* secondary text — ~7:1 on --bg */
  --primary:       #1d5c63; /* deep teal — white text = 7.6:1 */
  --primary-dark:  #154951; /* hover */
  --accent:        #b8501f; /* warm terracotta — white text = ~5:1 */
  --accent-dark:   #9a4119;
  --border:        #ddd3c3; /* soft warm border */
  --focus:         #b8501f; /* visible focus ring */
  --danger:        #b3261e; /* error red — white text ~5.9:1 */

  --maxw: 1120px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(35, 50, 48, .06), 0 8px 24px rgba(35, 50, 48, .08);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
          Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;       /* 17px base for readability */
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.2; color: var(--text); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.85rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: .75rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-alt { background: var(--surface-alt); }
.narrow { max-width: 760px; }

.section-head { margin-bottom: 1.75rem; }
.section-sub { color: var(--muted); margin: 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  padding-block: .75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.brand-logo { border-radius: 10px; }
.brand-name { font-size: 1.15rem; letter-spacing: -.01em; }

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
}
.header-phone-icon { font-size: 1.35rem; line-height: 1; }
.header-phone-text { display: flex; flex-direction: column; line-height: 1.1; }
.header-phone-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.header-phone-number { font-size: 1.1rem; }

.site-nav { width: 100%; }
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}
.site-nav a:hover { background: var(--surface-alt); }
.site-nav a[aria-current="page"] {
  color: var(--primary);
  background: var(--surface-alt);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: .85rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover { background: var(--primary); color: #fff; }
.btn-block { width: 100%; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 1.5rem;
}
.cta-row-center { justify-content: center; }

/* ---------- Hero ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 .75rem;
}
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(29, 92, 99, .10), transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero-inner { padding-block: clamp(2.75rem, 8vw, 5rem); max-width: 720px; }
.hero-lede { font-size: 1.2rem; color: var(--muted); }

.trust-points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
}
.trust-points li {
  position: relative;
  padding-left: 1.6rem;
  font-weight: 600;
}
.trust-points li::before {
  content: "\2714";          /* check mark */
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

/* ---------- Page hero (interior pages) ---------- */
.page-hero {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding-block: clamp(2.25rem, 6vw, 3.75rem);
}
.page-hero-lede { font-size: 1.15rem; color: var(--muted); max-width: 680px; }

/* ---------- Cards / grids ---------- */
.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { color: var(--primary); }
.card-link {
  display: inline-block;
  margin-top: .25rem;
  font-weight: 700;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.feature-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
.feature h3 { color: var(--primary); }

/* Team cards */
.team-card { text-align: center; }
.avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.team-card .role {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .5rem;
}

/* ---------- Service detail + lists ---------- */
.service-detail { max-width: 760px; }
.service-detail h2 { color: var(--primary); }

.checklist {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: .6rem;
}
.checklist li {
  position: relative;
  padding-left: 1.9rem;
}
.checklist li::before {
  content: "\2714";
  position: absolute;
  left: 0;
  top: .05em;
  width: 1.3rem;
  height: 1.3rem;
  color: var(--primary);
  font-weight: 700;
}

/* Definition / spec list */
.spec-list {
  margin: 1.25rem 0 0;
  display: grid;
  gap: .75rem;
}
.spec {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.spec dt { font-weight: 700; margin: 0; min-width: 12rem; }
.spec dd { margin: 0; color: var(--muted); }

/* ---------- CTA section + contact form ---------- */
.cta-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
.cta-hours { color: var(--muted); }

.cta-banner { text-align: center; background: var(--surface-alt); }
.cta-banner p { color: var(--muted); max-width: 620px; margin-inline: auto; }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: .7rem .8rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--primary);
}
.field textarea { resize: vertical; }
.field-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }

.form-note { font-size: .85rem; color: var(--muted); margin: .85rem 0 0; }

/* ---------- Validation + submit states ---------- */
.field-error {
  display: block;
  margin-top: .35rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--danger);
}
.field-error:empty { display: none; }

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--danger);
}
.field input[aria-invalid="true"]:focus,
.field textarea[aria-invalid="true"]:focus,
.field select[aria-invalid="true"]:focus {
  outline-color: var(--danger);
  border-color: var(--danger);
}

/* Submission-failure banner (hidden until it has text) */
.form-error {
  margin: 0 0 1rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-sm);
  background: #fdecea;
  color: #7a1c14;            /* dark red — AA contrast on the tint */
  font-weight: 600;
}
.form-error:empty { display: none; }

/* On-page success confirmation */
.form-success {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.form-success h3 { color: var(--primary); margin-top: 0; }
.form-success p:last-child { margin-bottom: 0; }

/* ---------- Contact page layout ---------- */
.contact-layout {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}
.info-block { margin-bottom: 1.5rem; }
.info-block h3 { color: var(--primary); margin-bottom: .25rem; }
.contact-phone,
.footer-phone { font-weight: 700; text-decoration: none; }
.muted { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--primary);
  color: #eef4f3;
  margin-top: auto;
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: #d8e8e6; }
.footer-inner {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  padding-block: 2.75rem;
}
.brand-footer { color: #fff; }
.footer-tagline { color: #cfe1df; margin: .75rem 0 0; max-width: 30ch; }
.footer-heading {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #b9d2cf;
  margin: 0 0 .75rem;
}
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: .5rem; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .18);
  padding-block: 1.1rem;
  font-size: .85rem;
}
.footer-bottom p { margin: 0; color: #cfe1df; }

/* ---------- Responsive (mobile-first → up) ---------- */
@media (min-width: 640px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 880px) {
  .site-nav { width: auto; margin-left: 0; }
  .header-inner { flex-wrap: nowrap; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .cta-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .contact-layout { grid-template-columns: 1fr 1.2fr; }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
