/* =========================================================
   Comfort Home Care — style.css
   Brand palette derived from logo. No frameworks used.
   ========================================================= */

:root {
  --primary-blue: #3B86BC;
  --dark-blue: #246896;
  --brand-green: #82BA5B;
  --brand-orange: #F59A23;
  --text-dark: #58585A;
  --text-body: #444444;
  --background-light: #F6F8FA;
  --background-blue: #EEF6FB;
  --background-green: #F2F8EE;
  --white: #FFFFFF;
  --border-light: #DCE7ED;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 4px 16px rgba(36, 104, 150, 0.08);
  --shadow-hover: 0 8px 24px rgba(36, 104, 150, 0.14);
  --transition: 0.25s ease;
}

/* ---------- Reset / Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Lato", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text-body);
  background: var(--white);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  padding-bottom: 0;
}

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

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

ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3 { color: var(--dark-blue); line-height: 1.3; margin: 0 0 16px; }

h1 { font-size: 2.4rem; font-weight: 900; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }

p { margin: 0 0 14px; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  text-align: center;
  margin-bottom: 12px;
}

.section-intro {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 32px;
  color: var(--text-dark);
}

.section-note {
  text-align: center;
  margin-top: 24px;
  color: var(--text-dark);
  font-weight: 700;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--dark-blue);
  color: var(--white);
  padding: 10px 16px;
  z-index: 2000;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Focus visibility for accessibility */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--brand-orange);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn .icon { width: 20px; height: 20px; flex-shrink: 0; }

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

.btn-secondary {
  background: var(--white);
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}
.btn-secondary:hover { background: var(--background-blue); }

.btn-email {
  background: var(--brand-green);
  color: var(--white);
}
.btn-email:hover { background: #6ba347; }

.btn-outline {
  background: transparent;
  color: var(--brand-orange);
  border-color: var(--brand-orange);
}
.btn-outline:hover { background: #FFF6EA; }

.btn-call-header {
  background: var(--primary-blue);
  color: var(--white);
  padding: 8px 16px;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
}
.btn-call-header:hover { background: var(--dark-blue); }
.btn-call-header .icon { width: 16px; height: 16px; color: var(--brand-orange); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--white);
  z-index: 1000;
  transition: box-shadow var(--transition);
}
.site-header.scrolled { box-shadow: var(--shadow-soft); }

/* Header gets its own wider container than the 1200px content sections —
   with logo + 6 nav links (incl. longer Spanish labels) + language switch +
   call button, it needs more horizontal room to avoid crowding/overlap. */
.site-header .container { max-width: 1400px; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 76px;
}

.logo-link { display: flex; align-items: center; flex-shrink: 0; }
.logo-img {
  max-width: 230px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.main-nav { flex: 1; display: flex; justify-content: center; overflow: hidden; }
.nav-list { display: flex; gap: 20px; flex-wrap: nowrap; flex-shrink: 0; }
.nav-link {
  font-weight: 700;
  color: var(--text-dark);
  padding: 8px 2px;
  position: relative;
  white-space: nowrap;
  transition: color var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--primary-blue); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 2px;
  background: var(--brand-orange);
}

.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.lang-switch { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 0.9rem; }
.lang-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dark); padding: 6px 6px; min-height: 32px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.lang-btn[aria-current="true"] {
  color: var(--white);
  background: var(--primary-blue);
}
.lang-btn:hover:not([aria-current="true"]) { color: var(--primary-blue); }
.lang-sep { color: var(--border-light); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--dark-blue);
  transition: transform var(--transition), opacity var(--transition);
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  background: var(--white);
  border-top: 1px solid var(--border-light);
  box-shadow: var(--shadow-soft);
  padding: 16px 24px 24px;
}
.mobile-menu.open { display: block; }
.mobile-nav-list { display: flex; flex-direction: column; gap: 4px; }
.mobile-nav-list .nav-link {
  display: block;
  padding: 12px 4px;
  min-height: 44px;
  border-bottom: 1px solid var(--background-light);
}
.mobile-lang-switch {
  display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.mobile-lang-switch .lang-btn {
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  min-height: 44px;
}
.mobile-contact-info {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-contact-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--primary-blue);
  font-weight: 700;
}
.mobile-contact-link .icon { width: 18px; height: 18px; color: var(--brand-orange); }

/* ---------- Hero ---------- */
.hero {
  padding: 130px 0 70px;
  background: linear-gradient(135deg, #FFFFFF 0%, #EEF6FB 100%);
}
.hero-inner {
  display: flex;
  align-items: center;
  gap: 48px;
}
.hero-text { flex: 1; min-width: 0; }
.hero-image { flex: 1; min-width: 0; }
.hero h1 { font-size: 2.6rem; }
.hero-subtitle { font-size: 1.15rem; color: var(--text-dark); font-weight: 700; }
.hero-desc { color: var(--text-body); }
.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; margin: 24px 0 20px; }
.hero-areas {
  font-weight: 700;
  color: var(--dark-blue);
  background: var(--background-blue);
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius-md);
}
.hero-img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  aspect-ratio: 6 / 4.8;
  object-fit: cover;
  background: var(--background-blue);
}

/* ---------- Highlights ---------- */
.highlights { padding: 60px 0; background: var(--white); }
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.highlight-card {
  background: var(--background-light);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}
.highlight-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.highlight-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.highlight-card p { font-size: 0.95rem; color: var(--text-dark); margin: 0; }

.highlight-icon, .why-icon, .service-icon, .contact-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.highlight-icon svg, .why-icon svg, .service-icon svg, .contact-icon svg { width: 28px; height: 28px; }

.icon-blue { background: var(--background-blue); color: var(--primary-blue); }
.icon-green { background: var(--background-green); color: var(--brand-green); }
.icon-orange { background: #FFF3E1; color: var(--brand-orange); }

/* ---------- About ---------- */
.about { padding: 70px 0; background: var(--background-light); }
.about-inner {
  display: flex;
  align-items: center;
  gap: 48px;
}
.about-image, .about-text { flex: 1; min-width: 0; }
.about-image img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--background-green);
}
.about-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.about-keywords li {
  background: var(--background-green);
  color: var(--dark-blue);
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
}

/* ---------- Services (levels-of-care comparison table) ---------- */
.services { padding: 70px 0; background: var(--white); }

/* Visually hidden but still available to screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Table scrolls horizontally on narrow screens instead of squeezing/wrapping */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  -webkit-overflow-scrolling: touch;
}

.services-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--white);
}
.services-table thead th {
  background: var(--brand-green);
  color: var(--white);
  font-weight: 700;
  text-align: left;
  padding: 16px 20px;
  font-size: 1rem;
  white-space: nowrap;
}
.services-table thead th:not(:first-child),
.services-table tbody td {
  text-align: center;
  width: 160px;
}
.services-table tbody th {
  text-align: left;
  font-weight: 400;
  color: var(--dark-blue);
  padding: 14px 20px;
  font-size: 0.95rem;
}
.services-table tbody td { padding: 14px 12px; }
.services-table tbody tr:nth-child(even) { background: var(--background-light); }
.services-table tbody tr:hover { background: var(--background-green); }

.check-cell { color: var(--brand-green); }
.check-icon { width: 24px; height: 24px; }
.check-cell.empty::before {
  content: "—";
  color: var(--border-light);
  font-weight: 700;
}

.services-legend {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-dark);
}

/* ---------- Service Areas ---------- */
.areas { padding: 70px 0; background: var(--background-blue); }
.areas-list {
  display: flex;
  /* Desktop: keep all area tags on a single row (English/Spanish need ~1030-1090px,
     which fits inside the 1152px content width once the 1200px container is at
     full size). Narrower viewports switch back to wrapping — see breakpoints below. */
  flex-wrap: nowrap;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
  margin: 0 auto;
}
.area-tag {
  background: var(--white);
  border: 2px solid var(--primary-blue);
  color: var(--dark-blue);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

/* ---------- Why Choose Us ---------- */
.why-us { padding: 70px 0; background: var(--white); }
.why-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.why-card {
  text-align: center;
  padding: 28px 18px;
  border-radius: var(--radius-lg);
  background: var(--background-green);
  transition: transform var(--transition), box-shadow var(--transition);
}
.why-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.why-card h3 { font-size: 1.05rem; }
.why-card p { font-size: 0.95rem; color: var(--text-dark); margin: 0; }

/* ---------- Process ---------- */
.process { padding: 70px 0; background: var(--background-light); }
.process-steps {
  display: flex;
  gap: 24px;
}
.process-step {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}
.process-step:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.step-number {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  font-weight: 900;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
}
.process-step h3 { font-size: 1.1rem; }
.process-step p { color: var(--text-body); margin: 0; }

/* ---------- Contact ---------- */
.contact { padding: 70px 0 80px; background: var(--white); }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}
.contact-card {
  background: var(--background-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}
.contact-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.contact-card h3 { font-size: 1.1rem; }
.contact-card p { margin: 0; font-weight: 700; }
.contact-card a { color: var(--primary-blue); }
.contact-card a:hover { text-decoration: underline; }
.contact-card p.contact-address-alt {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.contact-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.map-wrap { text-align: center; }
.map-title { margin-bottom: 16px; }
.map-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.map-frame {
  width: 100%;
  height: 420px;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: block;
}

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

/* ---------- Footer ---------- */
.site-footer { background: var(--dark-blue); color: var(--white); }
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding: 56px 24px 40px;
}
.footer-logo-wrap {
  background: var(--white);
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.footer-logo { max-width: 180px; width: 100%; }
.footer-brand p { color: #DCEBF4; margin: 0; }

.footer-nav h3, .footer-contact h3 { color: var(--white); }
.footer-nav ul { display: flex; flex-direction: column; gap: 10px; }
.footer-nav a { color: #DCEBF4; transition: color var(--transition); }
.footer-nav a:hover { color: var(--white); text-decoration: underline; }

.footer-contact p { margin: 0 0 10px; }
.footer-contact a { color: #DCEBF4; }
.footer-contact a:hover { color: var(--white); text-decoration: underline; }

.footer-bottom {
  text-align: center;
  padding: 18px 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.9rem;
  color: #C9E0EC;
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  transition: background var(--transition), transform var(--transition);
}
.back-to-top:hover { background: var(--dark-blue); }
.back-to-top svg { width: 22px; height: 22px; }

/* ---------- Mobile Fixed Contact Bar ---------- */
.mobile-contact-bar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  z-index: 950;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
}
.mobile-bar-btn {
  width: 50%;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  min-height: 44px;
}
.mobile-bar-btn .icon { width: 20px; height: 20px; }
.mobile-bar-call { background: var(--primary-blue); }
.mobile-bar-email { background: var(--brand-green); }

/* ---------- Fade-in animation ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in { opacity: 1; transform: none; transition: none; }
  .highlight-card, .why-card, .process-step, .contact-card, .btn, .back-to-top, .hamburger span {
    transition: none !important;
  }
  .highlight-card:hover, .why-card:hover, .process-step:hover, .contact-card:hover {
    transform: none;
  }
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

/* Laptop / small desktop */
@media (max-width: 1200px) {
  .container { max-width: 100%; }
  /* Not enough width for the longer English/Spanish area tags on one line below
     the container's full 1200px size — wrap back to multiple rows. */
  .areas-list { flex-wrap: wrap; }
}

/* Tablet (also covers smaller/medium laptop widths where full nav — especially
   the longer Spanish labels — would not fit next to the logo and call button) */
@media (max-width: 1449px) {
  .main-nav { display: none; }
  .btn-call-header { display: none; }
  .hamburger { display: flex; }

  .highlights-grid { grid-template-columns: repeat(2, 1fr); }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
  .process-steps { flex-direction: column; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }

  .hero-inner { flex-direction: column; }
  .hero-text { order: 1; }
  .hero-buttons { order: 2; }
  .hero-image { order: 3; width: 100%; }
  .hero h1 { font-size: 2.2rem; }
}

/* Tablet / mobile — main breakpoint */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .container { padding: 0 20px; }

  .header-inner { height: 66px; }
  .logo-img { max-width: 175px; }

  .hero { padding: 100px 0 50px; }
  .hero h1 { font-size: 1.9rem; }
  .hero-subtitle { font-size: 1.05rem; }
  .hero-buttons { flex-direction: column; align-items: stretch; }
  .hero-buttons .btn { justify-content: center; }

  .about-inner { flex-direction: column; }

  .highlights-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .why-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-buttons { flex-direction: column; align-items: stretch; }
  .contact-buttons .btn { justify-content: center; }

  .footer-inner { grid-template-columns: 1fr; text-align: left; padding: 40px 20px 24px; }

  .map-frame { height: 320px; }

  .mobile-contact-bar { display: flex; }
  body { padding-bottom: 58px; }
  .back-to-top { bottom: 74px; }
}

/* Small phones */
@media (max-width: 480px) {
  .container { padding: 0 20px; }
  .hero h1 { font-size: 1.7rem; }
  .highlights-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .logo-img { max-width: 150px; }
  .section-title { font-size: 1.6rem; }
}
