/* ============================================================
   Coastal Reticulation Perth — base.css
   Structure, layout and mechanics ONLY.
   All colors, fonts, decoration and animation personality live
   in the theme files (themes/*.css), scoped by [data-theme].
   ============================================================ */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* height:auto keeps aspect ratio when width/height attrs are present
   (the attrs are set for CLS; without this the pixel height distorts) */
img { max-width: 100%; display: block; height: auto; }
a { text-decoration: none; color: inherit; }
h1, h2, h3, h4, p, ul, ol, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }

/* Visible keyboard focus everywhere (inputs get their own treatment) */
a:focus-visible, button:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: min(1140px, 100% - 2.5rem);
  margin-inline: auto;
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Anchored sections clear the sticky header when jumped to */
[id] { scroll-margin-top: 84px; }
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 0.75rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.brand-logo { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.05rem; }
.brand-tag { font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; }

.site-nav { display: flex; gap: 1.4rem; margin-inline: auto; font-weight: 600; font-size: 0.95rem; }
.site-nav a { position: relative; padding-block: 0.25rem; white-space: nowrap; }

.header-phone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 44px; /* touch target */
  line-height: 1.2;
  font-weight: 700;
  flex-shrink: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 12px;
}
.header-phone .phone-icon { display: none; }
.header-phone .phone-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; }
.header-phone .phone-number { font-size: 1.05rem; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
}
.nav-toggle span { display: block; height: 3px; border-radius: 3px; background: currentColor; transition: transform 0.3s ease, opacity 0.3s ease; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease;
  text-align: center;
}
.btn-lg { padding: 1rem 1.9rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.65; cursor: not-allowed; transform: none !important; }

/* Honeypot — off-screen, skipped by humans, filled by bots */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(4rem, 9vw, 7.5rem); }
.hero-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-shape, .hero-wave { position: absolute; display: block; }
.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-kicker { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 1rem; }
.hero-title { font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.1; font-weight: 800; margin-bottom: 1.25rem; }
.hero-sub { font-size: clamp(1.02rem, 1.6vw, 1.2rem); max-width: 34rem; margin-bottom: 1.75rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.75rem; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; font-size: 0.92rem; font-weight: 600; }
.hero-media { display: flex; justify-content: center; }
.hero-logo-card { border-radius: 24px; overflow: hidden; max-width: 380px; }
.hero-logo { width: 100%; }

/* ---------- Stats ---------- */
.stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding-block: 2.25rem;
  text-align: center;
}
.stat-num, .stat-suffix { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; line-height: 1; }
.stat-label { display: block; margin-top: 0.4rem; font-size: 0.88rem; font-weight: 600; }

/* ---------- Section heads ---------- */
.section-head { max-width: 44rem; margin-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.section-kicker { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.75rem; }
.section-title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.15; font-weight: 800; margin-bottom: 1rem; }
.section-sub { font-size: 1.05rem; }

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.service-card { padding: 1.9rem 1.6rem; border-radius: 18px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.service-icon { font-size: 2rem; margin-bottom: 1rem; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 16px; }
.service-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.6rem; }
.service-card p { font-size: 0.95rem; }

/* ---------- Offer ---------- */
.offer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
  padding: clamp(1.9rem, 4vw, 3rem);
  border-radius: 24px;
  margin-block: 1rem;
}
.offer-badge { display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.35rem 0.9rem; border-radius: 999px; margin-bottom: 0.9rem; }
.offer-title { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 800; margin-bottom: 0.6rem; }
.offer-sub { max-width: 36rem; }

/* ---------- About ---------- */
.about-inner {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.about-logo-card { border-radius: 24px; overflow: hidden; max-width: 400px; margin-inline: auto; }
.about-copy p { margin-bottom: 1rem; }
.about-points { margin-block: 1.4rem; display: grid; gap: 0.8rem; }
.about-points li { padding-left: 1.9rem; position: relative; }
.about-points li::before { content: "✓"; position: absolute; left: 0; top: 0; font-weight: 800; }
.about-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.5rem; }

/* ---------- How it works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  counter-reset: step;
}
.step { position: relative; padding: 2rem 1.6rem; border-radius: 18px; }
.step-num {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 1.1rem;
}
.step h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.6rem; }
.step p { font-size: 0.95rem; }

/* ---------- Reviews ---------- */
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.review-card { padding: 1.9rem 1.6rem; border-radius: 18px; display: flex; flex-direction: column; gap: 0.9rem; }
.review-stars { letter-spacing: 0.2em; font-size: 1.05rem; }
.review-card p { font-size: 0.97rem; flex: 1; }
.review-card footer { font-size: 0.88rem; font-weight: 600; }
.review-card cite { font-style: normal; font-weight: 800; }

/* ---------- Areas ---------- */
.areas-list { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.areas-list li {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

/* ---------- Contact ---------- */
.contact-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.contact-copy > p { margin-bottom: 1.75rem; max-width: 32rem; }
.contact-methods { display: grid; gap: 1rem; }
.contact-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: 16px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.method-icon { font-size: 1.5rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; flex-shrink: 0; }
.method-body { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.method-body strong { font-size: 1rem; }
.method-body span { font-size: 0.9rem; overflow-wrap: anywhere; }

.contact-form { padding: clamp(1.75rem, 3.5vw, 2.5rem); border-radius: 24px; }
.contact-form h3 { font-size: 1.35rem; font-weight: 800; margin-bottom: 1.4rem; }
.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.4rem; }
.form-field input, .form-field textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}
.form-note { font-size: 0.85rem; margin-top: 0.9rem; text-align: center; }
.form-success { margin-top: 1rem; padding: 0.9rem 1.1rem; border-radius: 12px; font-size: 0.92rem; }
.form-success a { font-weight: 700; text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { padding-top: clamp(3rem, 6vw, 4.5rem); }
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}
.footer-logo { width: 84px; border-radius: 16px; margin-bottom: 1rem; }
.footer-brand p { font-size: 0.92rem; max-width: 22rem; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 1rem; }
.footer-col a, .footer-col p { display: block; font-size: 0.95rem; margin-bottom: 0.6rem; overflow-wrap: anywhere; }
.footer-bottom { padding-block: 1.4rem; font-size: 0.85rem; }

/* ---------- Floating call button ---------- */
.floating-call {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
}

/* ---------- Reveal-on-scroll mechanics ----------
   JS adds .visible when element enters viewport and sets
   --reveal-i (index within its parent) for staggering.
   Themes define the actual transition/animation styles.
   No permanent will-change here: it would pin a GPU layer per
   element for a one-shot entrance. JS toggles it only for the
   brief window each element is actually animating. */

/* ---------- Tablet + mobile: hamburger nav ----------
   Breakpoint is 1060px, not 900px: the full desktop header
   (brand + six nowrap links + phone CTA) needs ~1000px, so it
   would overflow in the 900–1020px band otherwise. */
@media (max-width: 1060px) {
  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(320px, 82vw);
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
    padding: 2rem;
    font-size: 1.15rem;
    transform: translateX(105%);
    visibility: hidden; /* keep hidden links out of the tab order */
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0.35s;
    z-index: 950;
  }
  body.nav-open .site-nav {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0s;
  }
  .site-nav a { padding-block: 0.6rem; } /* ~44px touch target */
  .nav-toggle { display: flex; z-index: 960; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .header-phone .phone-label { display: none; }
  .header-phone { margin-left: auto; }

  .hero-inner, .about-inner, .contact-inner { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-logo-card { max-width: 250px; }
  .about-media { display: none; }
  .services-grid, .reviews-grid, .steps { grid-template-columns: 1fr; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; gap: 1.75rem; }
  /* Clear the fixed call button off the footer copyright */
  .site-footer { padding-bottom: 5.5rem; }
  .floating-call { display: inline-flex; }
  /* Don't let the call button float over the open nav drawer */
  body.nav-open .floating-call { display: none; }
}

/* ---------- Small phones: protect the phone CTA + hamburger ----------
   The brand wordmark, full phone pill and hamburger can't all fit
   below ~560px. Contactability wins: keep the phone + hamburger,
   drop the adjacent wordmark (the circular logo still shows). */
@media (max-width: 560px) {
  .brand-text { display: none; }
  .header-inner { gap: 0.75rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
