/* =====================================================================
   Cambie Handyman Service - global stylesheet
   Linked from every page (index.html, about.html). Change a colour,
   font or spacing here and it updates across the whole site.

   Sections:
     1. Design tokens (colours, fonts) for light and dark themes
     2. Base / reset
     3. Page layout helpers
     4. Header (logo, About Us button, contact details)
     5. Cyan divider strip under the header
     6. Services gallery (rotating slideshow)
     7. About page content
     8. Hours of operation
     9. Footer and social icons
    10. Larger screens and reduced motion
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. DESIGN TOKENS
   Every colour used on the site is defined here once and reused below.
   --------------------------------------------------------------------- */

/* Light theme (default) */
:root {
  --paper:      #ffffff;   /* main page background (white areas) */
  --ink:        #1b1d2b;   /* main text colour */
  --navy:       #2e3092;   /* brand navy, matches the logo */
  --cyan:       #22dffc;   /* brand cyan bands */
  --cyan-ink:   #0d1352;   /* text on the cyan bands */
  --rule:       #0d1352;   /* table lines on the cyan band */
  --footer:     #231f20;   /* dark footer background */
  --footer-ink: #ffffff;   /* footer text and icons */
  --card:       #ffffff;   /* card surfaces */
  --good:       #0a7a3d;   /* "Open now" indicator */
  --button-ink: #ffffff;   /* text on the navy About Us button */

  --font-display: "Archivo", "Arial Black", Arial, sans-serif;
  --font-body:    "Source Sans 3", "Segoe UI", Arial, sans-serif;

  --logo-filter: none;     /* logo is navy; lightened in dark theme */

  color-scheme: light;
}

/* Dark theme when the visitor's device is set to dark and no manual choice exists */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #12142a;
    --ink:        #e8eaf8;
    --navy:       #9aa2ff;
    --cyan:       #0b3a47;
    --cyan-ink:   #d9f7ff;
    --rule:       #5fd8ee;
    --footer:     #08080d;
    --card:       #1c1f3d;
    --good:       #4fd98a;
    --button-ink: #0b0d22;
    --logo-filter: invert(1) hue-rotate(180deg);
    color-scheme: dark;
  }
}

/* Dark theme when it is chosen explicitly (same values as above) */
:root[data-theme="dark"] {
  --paper:      #12142a;
  --ink:        #e8eaf8;
  --navy:       #9aa2ff;
  --cyan:       #0b3a47;
  --cyan-ink:   #d9f7ff;
  --rule:       #5fd8ee;
  --footer:     #08080d;
  --card:       #1c1f3d;
  --good:       #4fd98a;
  --button-ink: #0b0d22;
  --logo-filter: invert(1) hue-rotate(180deg);
  color-scheme: dark;
}


/* ---------------------------------------------------------------------
   2. BASE / RESET
   --------------------------------------------------------------------- */

* { box-sizing: border-box; }

/* Keeps content clear of phone notches and system bars */
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
}

img { max-width: 100%; }
a   { color: inherit; }

/* Visible keyboard focus on every link and button */
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Section headings share one style */
h1, h2 {
  font-family: var(--font-display);
  font-stretch: 105%;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 14px;
  text-wrap: balance;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.6rem; }


/* ---------------------------------------------------------------------
   3. PAGE LAYOUT HELPERS
   .band  = a full-width coloured strip. Sets the side gutter (16px or more).
   .wrap  = the centred content column inside a band.
   --------------------------------------------------------------------- */

.band {
  padding-left:  max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
}


/* ---------------------------------------------------------------------
   4. HEADER
   Logo on top; below it the About Us (or Home) button on the left and
   phone / email on the right.
   --------------------------------------------------------------------- */

.top { background: var(--paper); padding-block: 22px 18px; }

/* Logo image, centred */
.logo { display: flex; justify-content: center; text-decoration: none; }
.logo-img {
  display: block;
  width: min(78vw, 330px);
  height: auto;
  filter: var(--logo-filter);
}

/* Row holding the button and the contact details; wraps on narrow phones */
.contact-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
}

/* Navy navigation button (About Us on the home page, Home on the about page) */
.btn-nav {
  display: inline-block;
  background: var(--navy);
  color: var(--button-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  padding: 10px 28px;
  border-radius: 8px;
  text-decoration: none;
}
.btn-nav:hover { filter: brightness(1.12); }

/* Phone / email list */
.contact-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  font-size: 1.05rem;
  min-width: 0;
}
.contact-list dt { font-weight: 700; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }


/* ---------------------------------------------------------------------
   5. CYAN DIVIDER STRIP (between the header and the page content)
   --------------------------------------------------------------------- */

.strip { background: var(--cyan); height: 36px; }


/* ---------------------------------------------------------------------
   6. SERVICES GALLERY
   Fills the white area under the cyan strip, edge to edge. Slides sit on
   top of each other; only the one marked .is-active is visible.
   js/site.js rotates which slide is active.
   --------------------------------------------------------------------- */

.gallery-section { background: var(--paper); }

/* Full-width photo area.
   Height follows the original mobile layout (about 54.5% of the screen
   width) and stops growing at 400px on large screens.
   Change --gallery-height to make it taller or shorter. */
.gallery {
  --gallery-height: min(54.5vw, 400px);
  position: relative;
  width: 100%;
  height: var(--gallery-height);
  overflow: hidden;
  background: var(--cyan-ink);
  touch-action: pan-y;            /* allow vertical scroll, we handle horizontal swipes */
}

/* One service slide: photo plus the service name in front of it */
.slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;              /* fills the area, cropping the photo edges if needed */
}

/* Service name in front of the photo (no background, just a text shadow so it
   stays readable). The bottom padding leaves room for the dots. */
.slide-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 64px max(20px, env(safe-area-inset-right, 0px)) 38px max(20px, env(safe-area-inset-left, 0px));
  color: #ffffff;
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 800;
  font-size: clamp(1.7rem, 8vw, 3rem);
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65), 0 2px 16px rgba(0, 0, 0, 0.6);
}

/* Per-photo framing.
   .pos-top  : show the top part of the photo (wall repair).
   .pos-line : keep the dark/clean dividing line in the exact middle of the
               frame (pressure washing). The line sits 54.07% of the way down
               that photo; if you swap the photo, change the 54.07% below. */
.slide img.pos-top { object-position: 50% 0%; }
.slide img.pos-line {
  position: absolute;
  left: 0;
  top: 50%;
  height: auto;
  translate: 0 -54.07%;
}

/* Previous / next arrows on the left and right edges */
.gallery-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 10, 40, 0.55);
  color: #ffffff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.gallery-arrow:hover { background: rgba(8, 10, 40, 0.8); }
.gallery-arrow svg { width: 22px; height: 22px; }
.gallery-prev { left: max(10px, env(safe-area-inset-left, 0px)); }
.gallery-next { right: max(10px, env(safe-area-inset-right, 0px)); }

/* Dots (one per service), centred along the bottom edge of the photo */
.dots {
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  display: flex;
  justify-content: center;
}
.dot {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  opacity: 0.5;
}
.dot[aria-current="true"]::before { opacity: 1; }

/* Pause / Play button in the top-right corner of the photo */
.gallery-toggle {
  position: absolute;
  top: 10px;
  right: max(10px, env(safe-area-inset-right, 0px));
  border: 0;
  background: rgba(8, 10, 40, 0.55);
  color: #ffffff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.gallery-toggle:hover { background: rgba(8, 10, 40, 0.8); }

/* Text that screen readers read but sighted visitors do not see */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* ---------------------------------------------------------------------
   7. ABOUT PAGE CONTENT
   --------------------------------------------------------------------- */

.page { background: var(--paper); padding-block: 40px 56px; }
.page p { margin: 0 0 14px; max-width: 60ch; }
.page .services-line { font-weight: 600; }


/* ---------------------------------------------------------------------
   8. HOURS OF OPERATION (cyan band with the weekly table)
   --------------------------------------------------------------------- */

.hours { background: var(--cyan); color: var(--cyan-ink); padding-block: 40px; }
.hours h2 { text-align: center; font-size: 1.35rem; }

/* "Open now" / "Closed right now" line, filled in by js/site.js */
.status { text-align: center; margin: 0 0 18px; font-weight: 700; min-height: 1.5em; }
.status .dot-live {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rule);
  margin-right: 8px;
}
.status.open .dot-live { background: var(--good); }

.hours table {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  border-collapse: collapse;
  font-size: 1.05rem;
}
.hours th, .hours td {
  text-align: left;
  padding: 9px 10px;
  border-top: 1px solid var(--rule);
}
.hours tr:last-child th, .hours tr:last-child td { border-bottom: 1px solid var(--rule); }
.hours th { font-weight: 400; width: 52%; border-right: 1px solid var(--rule); }
.hours td { font-variant-numeric: tabular-nums; }

/* Today's row is bold and lightly highlighted */
.hours tr.today th, .hours tr.today td {
  font-weight: 700;
  background: color-mix(in srgb, var(--rule) 14%, transparent);
}


/* ---------------------------------------------------------------------
   9. FOOTER AND SOCIAL ICONS
   --------------------------------------------------------------------- */

.foot { background: var(--footer); color: var(--footer-ink); padding-block: 56px 28px; }

.social { display: flex; gap: 22px; align-items: center; }
.social a {
  display: inline-flex;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.social a:hover { background: rgba(255, 255, 255, 0.12); }
.social svg { width: 34px; height: 34px; display: block; }

.foot small { display: block; margin-top: 26px; opacity: 0.7; font-size: 0.9rem; }


/* ---------------------------------------------------------------------
   10. LARGER SCREENS AND REDUCED MOTION
   --------------------------------------------------------------------- */

@media (min-width: 640px) {
  .top { padding-block: 30px 22px; }
  .hours { padding-block: 56px; }
  .page { padding-block: 56px 72px; }
}

/* Visitors who ask their device for less motion get instant slide changes */
@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn-nav { transition: filter 0.15s ease; }
}
