/* ===========================================================
   h2osave — main stylesheet
   Palette: deep teal / aqua / white, matching original site's
   water-conservation branding.
   =========================================================== */

:root {
  --color-primary: #0e6e6e;
  --color-primary-dark: #084c4c;
  --color-accent: #1fb6a8;
  --color-accent-light: #e6f7f5;
  --color-text: #1c2b2b;
  --color-text-muted: #5a6b6b;
  --color-bg: #ffffff;
  --color-bg-alt: #f4faf9;
  --color-border: #dfeeec;
  --font-base: 'Segoe UI', Helvetica, Arial, sans-serif;
  --max-width: 1160px;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(8, 76, 76, 0.08);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

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

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

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

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(6px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo img { height: 42px; width: auto; }

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

.nav-links a {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-primary-dark);
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
}
.nav-toggle span {
  width: 26px;
  height: 3px;
  background: var(--color-primary-dark);
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: #fff; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  color: #fff;
  background-size: cover;
  background-position: center;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 44, 44, 0.55), rgba(6, 44, 44, 0.75));
  z-index: -1;
}
.hero-content { max-width: 640px; padding: 0 24px; margin: 0 auto; width: 100%; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0 0 16px;
  font-weight: 800;
}
.hero p { font-size: 1.15rem; margin: 0 0 28px; opacity: 0.95; }

.page-hero {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background-size: cover;
  background-position: center;
  position: relative;
  isolation: isolate;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(6, 44, 44, 0.6);
  z-index: -1;
}
.page-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0; }

/* ---------- Sections ---------- */
section { padding: 72px 0; }
.section-alt { background: var(--color-bg-alt); }

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--color-primary-dark);
  margin: 0 0 18px;
}
.section-lead {
  color: var(--color-text-muted);
  max-width: 640px;
  font-size: 1.05rem;
  margin-bottom: 32px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.two-col.reverse .col-img { order: 2; }

.col-img img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; height: 380px; object-fit: cover; }

/* ---------- Cards / Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }
.card img { width: 100%; height: 200px; object-fit: cover; }
.card-body { padding: 22px; }
.card-body h3 { margin: 0 0 10px; color: var(--color-primary-dark); font-size: 1.15rem; }
.card-body p { margin: 0 0 14px; color: var(--color-text-muted); font-size: 0.95rem; }
.card-tag {
  display: inline-block;
  background: var(--color-accent-light);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.card-tag--accent {
  background: var(--color-accent);
  color: #fff;
  letter-spacing: 0.03em;
}

/* ---------- Carousel ---------- */
.carousel {
  display: flex;
  align-items: center;
  gap: 12px;
}
.carousel-viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.carousel-viewport::-webkit-scrollbar { display: none; }
.carousel-viewport:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
.carousel-track {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 4px 4px 12px;
}
.carousel-slide {
  flex: 0 0 260px;
  scroll-snap-align: start;
}
@media (min-width: 600px) {
  .carousel-slide { flex-basis: 300px; }
}
@media (max-width: 560px) {
  /* Arrow buttons would otherwise claim ~100px of a ~280px viewport,
     leaving barely a sliver of card visible; touch swipe already
     covers navigation at this width via the scrollable viewport. */
  .carousel-arrow { display: none; }
}
.carousel-slide .card { height: 100%; }
.carousel-arrow {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: #fff;
  color: var(--color-primary);
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.carousel-arrow:hover { background: var(--color-primary); color: #fff; }
.carousel-arrow:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* ---------- Modals ---------- */
body.modal-open { overflow: hidden; }
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 44, 44, 0.65);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}
/* Explicit override so the modal only shows once JS clears the `hidden`
   attribute — an unconditional `display: flex` here would beat the
   browser's own [hidden] handling and the modal would never actually hide. */
.modal-overlay:not([hidden]) {
  display: flex;
}
.modal {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
}
.modal-small { max-width: 420px; text-align: center; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--color-accent-light); }
.modal-gallery-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.modal h2 { color: var(--color-primary-dark); margin: 0 0 12px; font-size: 1.5rem; padding-right: 32px; }
.modal h3 { color: var(--color-primary-dark); margin: 24px 0 10px; font-size: 1rem; }
.modal ul { margin: 0; padding-left: 20px; color: var(--color-text-muted); }
.modal ul li { margin-bottom: 8px; }
.modal-actions { margin-top: 28px; }
.donate-modal-welcome { font-weight: 700; color: var(--color-primary-dark); margin: 0 0 16px; }

.qr-placeholder {
  width: 160px;
  height: 160px;
  margin: 0 auto 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.qr-placeholder svg { display: block; width: 100%; height: 100%; }

/* ---------- Contact / Forms ---------- */
.contact-form {
  display: grid;
  gap: 16px;
  max-width: 520px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
}
.contact-form textarea { min-height: 130px; resize: vertical; }
.contact-form label { font-weight: 600; font-size: 0.9rem; color: var(--color-primary-dark); }
.contact-form select {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--color-text);
}
.contact-form .form-note.error { color: #b3261e; }

.wl-unit-row { display: flex; gap: 10px; align-items: stretch; }
.wl-unit-row input[type="number"] { flex: 1; min-width: 0; }
.wl-unit-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.wl-unit-toggle label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 0 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.wl-unit-toggle label:first-child { border-right: 1px solid var(--color-border); }
.wl-unit-toggle label.active { background: var(--color-primary); color: #fff; }
.wl-unit-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}
.stat-number {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--color-accent);
  margin: 0 0 6px;
}
.stat-label {
  font-weight: 700;
  color: var(--color-primary-dark);
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.stat-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0;
}
.stat-demo-tag {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  vertical-align: middle;
}

/* ---------- Plain explainer lists ---------- */
.plain-steps {
  max-width: 720px;
  padding-left: 22px;
  color: var(--color-text);
}
.plain-steps li { margin-bottom: 14px; }

/* ---------- Numbered process flow ---------- */
.process-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  position: relative;
  margin-top: 8px;
}
.process-flow::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.process-step {
  position: relative;
  z-index: 1;
  text-align: center;
}
.process-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: var(--shadow);
}
.process-step-icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  color: var(--color-primary);
}
.process-step-icon svg { width: 100%; height: 100%; }
.process-step h3 { margin: 0 0 8px; color: var(--color-primary-dark); font-size: 1.05rem; }
.process-step p { margin: 0; color: var(--color-text-muted); font-size: 0.92rem; }

@media (max-width: 720px) {
  .process-flow { grid-template-columns: 1fr; gap: 36px; }
  .process-flow::before { display: none; }
}

.notice-box {
  background: var(--color-accent-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 720px;
}

.info-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.info-list h4 { margin: 0 0 4px; color: var(--color-primary-dark); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; }
.info-list p, .info-list a { margin: 0; color: var(--color-text-muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: #d8ece9;
  padding: 56px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}
.footer-grid h4 { color: #fff; margin: 0 0 14px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-grid p, .footer-grid a { color: #b8d6d2; font-size: 0.92rem; line-height: 1.9; }
.social-links {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}
.social-links a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #d8ece9;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.social-links a:hover { background: var(--color-accent); color: #fff; }
.social-links svg { width: 18px; height: 18px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 20px;
  font-size: 0.85rem;
  color: #9dc0bc;
  text-align: center;
}

/* ---------- Water level report ---------- */
.gsi-wrap { display: flex; justify-content: center; padding: 8px 0 4px; }
.wl-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-accent-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 0.92rem;
  color: var(--color-primary-dark);
}
.wl-status-bar strong { color: var(--color-primary); }
.wl-signout {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  font-size: 0.92rem;
}
.wl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.wl-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}
.wl-list .wl-level { font-weight: 700; color: var(--color-primary-dark); }

/* ---------- Blog ---------- */
.post-meta { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.post-body { max-width: 720px; margin: 0 auto; font-size: 1.05rem; }
.post-body h2 { color: var(--color-primary-dark); margin-top: 40px; }
.post-body img { border-radius: var(--radius); margin: 24px 0; }
.post-body p a { color: var(--color-primary); text-decoration: underline; }
.post-body p a:hover { color: var(--color-accent); }
.post-header { max-width: 720px; margin: 0 auto 32px; }
.post-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--color-primary-dark); margin: 0 0 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col.reverse .col-img { order: 0; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--color-border);
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 480px; overflow-y: auto; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 14px 24px; border-bottom: 1px solid var(--color-border); }
  .nav-toggle { display: flex; }
}

/* Short/landscape phone viewports: a vh-based hero can otherwise
   fill the entire screen and hide all page content below the fold. */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { min-height: auto; padding: 48px 0; }
  .page-hero { min-height: auto; padding: 40px 0; }
}

@media (max-width: 480px) {
  section { padding: 48px 0; }
  .container { padding: 0 18px; }
  .nav-wrap { padding: 12px 18px; }
  .col-img img { height: 220px; }
  .modal { padding: 22px; }
  .modal h2 { font-size: 1.3rem; }
  .modal-gallery-img { height: 180px; }
  .button-row { flex-direction: column; align-items: stretch; }
  .button-row .btn { text-align: center; }
}
