/* ==========================================================================
   Castillo Carpet Service – styles

   Order (general → specific; later blocks may override earlier ones):
     1. Tokens        – colors, fonts, spacing (change the look here)
     2. Base          – reset and element defaults
     3. Layout        – container, section spacing, section titles
     4. Components    – reusable pieces (button, carousel, lightbox, …)
     5. Sections      – one block per page section, in page order
     6. Utilities     – motion / accessibility helpers

   Naming: BEM  →  .block, .block__element, .block--modifier
   Breakpoints (kept next to each block, desktop-first):
     1100px  large tablet · 999.98px  tablet · 700px  phone
   ========================================================================== */


/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
  /* Palette (from the original Blocksy theme) */
  --brown: #8B7356;
  --brown-dark: #6f5b43;
  --taupe: #8c7f70;
  --gray: #687279;
  --ink: #1E262E;
  --cream: #FEEEDD;
  --cream-light: #fff7ef;
  --white: #ffffff;
  --star: #f5b301;
  --call: #f97316;

  /* Typography */
  --font: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;

  /* Layout */
  --container: 1290px;
  --content-narrow: 1100px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-space: clamp(64px, 9vw, 110px);
  --header-h: 96px;

  /* Effects */
  --radius: 10px;
  --shadow: 0 10px 30px rgba(30, 38, 46, .10);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (max-width: 999.98px) {
  :root { --header-h: 76px; }
}


/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--gray);
  background: var(--white);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brown); text-decoration: none; transition: color .2s; }
a:hover { color: var(--ink); }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.3; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

ul, ol { margin: 0; padding: 0; list-style: none; }
address { font-style: normal; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--brown); outline-offset: 3px; }


/* ==========================================================================
   3. Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-space); }
.section-title { text-align: center; margin-bottom: 48px; }

/* Media box: image fills its grid cell, cream shows while it loads */
.cover { background: var(--cream); }
.cover img { width: 100%; height: 100%; object-fit: cover; }


/* ==========================================================================
   4. Components
   ========================================================================== */

/* ---------- Skip link ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 1000; padding: 10px 16px; background: var(--ink); color: var(--white); }
.skip-link:focus { left: 10px; top: 10px; }

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .75em 1.6em;
  background: var(--brown); color: var(--white);
  border: 0; border-radius: 6px; font-weight: 500; letter-spacing: .02em;
  transition: background .25s, transform .25s var(--ease);
}
.btn:hover { background: var(--brown-dark); color: var(--white); transform: translateY(-2px); }
.btn--outline { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn--outline:hover { background: var(--ink); color: var(--white); }

/* ---------- Carousel ----------
   Markup: [data-carousel] > .carousel__viewport > .carousel__track > .carousel__slide
   Tune per instance with --per-view and --gap (see .carousel--gallery). */
.carousel { --per-view: 1; --gap: 24px; position: relative; }
.carousel__viewport { overflow: hidden; touch-action: pan-y; }
.carousel__track { display: flex; gap: var(--gap); transition: transform .55s var(--ease); will-change: transform; }
.carousel__slide { flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view)); min-width: 0; }
.carousel__btn {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 48px; height: 48px; padding-bottom: 4px;
  border: 0; border-radius: 50%;
  background: var(--white); color: var(--ink); box-shadow: var(--shadow);
  font-size: 2rem; line-height: 1;
}
.carousel__btn:hover { background: var(--brown); color: var(--white); }
.carousel__btn--prev { left: -24px; }
.carousel__btn--next { right: -24px; }
.carousel__dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 28px; }
.carousel__dot { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; }
.carousel__dot::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: rgba(139, 115, 86, .35); transition: transform .2s, background .2s;
}
.carousel__dot[aria-current="true"]::before { background: var(--brown); transform: scale(1.3); }

@media (max-width: 999.98px) {
  .carousel__btn--prev { left: 6px; }
  .carousel__btn--next { right: 6px; }
}
@media (max-width: 700px) {
  .carousel__btn { display: none; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18, 21, 25, .96); opacity: 0; transition: opacity .25s;
}
.lightbox.is-open { opacity: 1; }
.lightbox__figure { margin: 0; max-width: min(92vw, 1200px); text-align: center; }
.lightbox__img { max-height: 82vh; width: auto; margin-inline: auto; border-radius: 6px; }
.lightbox__counter { margin-top: 12px; color: rgba(255, 255, 255, .7); font-size: .9rem; }
.lightbox__close,
.lightbox__nav {
  position: absolute; display: grid; place-items: center;
  width: 52px; height: 52px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .08); color: var(--white);
  font-size: 2rem; line-height: 1;
}
.lightbox__close:hover,
.lightbox__nav:hover { background: var(--brown); }
.lightbox__close { top: 18px; right: 18px; }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }

@media (max-width: 700px) {
  .lightbox__nav { top: auto; bottom: 18px; }
}

/* ---------- Floating call button (tablet / phone only) ---------- */
.call-fab { display: none; }

@media (max-width: 999.98px) {
  .call-fab {
    position: fixed; right: 16px; bottom: 16px; z-index: 90;
    display: grid; place-items: center;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--brown); box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
  }
  .call-fab svg {
    width: 30px; height: 30px;
    fill: none; stroke: var(--white); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  }
}


/* ==========================================================================
   5. Sections (page order)
   ========================================================================== */

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--white); transition: box-shadow .3s; }
.site-header.is-scrolled { box-shadow: 0 2px 18px rgba(30, 38, 46, .1); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; min-height: var(--header-h); }
.brand img { width: auto; height: 72px; }
.main-nav__list { display: flex; gap: 28px; }
.main-nav__list a { padding: 8px 4px; color: var(--brown); font-size: .9rem; font-weight: 500; }
.main-nav__list a:hover { color: var(--brown-dark); }

@media (max-width: 999.98px) {
  .brand img { height: 56px; }
}

/* ---------- Hero ---------- */
.hero__inner {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto 80px auto;   /* row 3 = where the tagline overlaps the photo */
  grid-template-areas:
    "text text text text text media media media media media media media"
    "call call call call .    media media media media media media media"
    ".    .    .    tag  tag  tag  tag  tag  tag  tag  tag  .   "
    ".    .    .    tag  tag  tag  tag  tag  tag  tag  tag  .   ";
}
.hero__text { grid-area: text; padding: 80px 32px 48px 0; }
.hero__title { margin: 0 0 1.4em; font-size: clamp(2.2rem, 4vw, 3rem); }
.hero__subtitle { margin: 0; font-family: var(--font-serif); font-size: .95rem; font-weight: 600; color: var(--ink); }
.hero__media { grid-area: media; grid-row: 1 / 4; min-height: 440px; }

.hero__call {
  grid-area: call; align-self: end;
  display: grid; grid-template-columns: 40px 1fr; gap: 24px;
  padding: 24px 28px 28px 24px; background: var(--ink); color: var(--white);
}
.hero__call-icon { width: 26px; height: 26px; color: var(--call); }
.hero__call p { margin: 0; font-family: var(--font-serif); font-size: .9rem; font-weight: 600; line-height: 1.75; }
.hero__call a { text-decoration: underline; }

.hero__tagline {
  grid-area: tag; position: relative; z-index: 1;
  display: grid; grid-template-columns: 36px 1fr minmax(120px, 155px); align-items: center; gap: 30px;
  padding: 44px 34px 34px 40px; background: var(--taupe); color: var(--white);
}
.hero__check { display: grid; place-items: center; width: 36px; height: 36px; background: var(--white); color: var(--ink); }
.hero__check svg { width: 18px; height: 18px; }
.hero__tagline p { margin: 0; font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-weight: 600; line-height: 1.5; }
.hero__tagline strong { display: block; margin-top: 2.2em; font-weight: 600; }
.hero__tagline img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: rgba(255, 255, 255, .15); }

@media (max-width: 999.98px) {
  .hero__inner { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "text" "media" "call" "tag"; }
  .hero__text { padding: 48px 0 32px; }
  .hero__title { margin-bottom: .6em; }
  .hero__media { grid-area: media; min-height: 280px; }
  .hero__call { align-self: stretch; }
}
@media (max-width: 700px) {
  .hero__tagline { grid-template-columns: 36px 1fr; gap: 20px; padding: 32px 24px; }
  .hero__tagline img { grid-column: 1 / -1; }
}

/* ---------- Free estimate ---------- */
.estimate { padding-top: 0; }   /* sits flush under the hero tagline */
.estimate__inner { display: grid; grid-template-columns: minmax(260px, 28%) 1fr; }
.estimate__intro { padding: clamp(32px, 5vw, 72px) 40px; background: var(--cream); color: var(--ink); }
.estimate__intro h2 { margin: 0 0 40px; font-size: clamp(1.5rem, 2.4vw, 1.9rem); line-height: 1.35; }
.estimate__intro p { margin: 0; font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; line-height: 1.75; }
.estimate__body { padding: 32px 0 24px clamp(24px, 4vw, 48px); }

.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 56px 40px; }
.step { display: grid; grid-template-columns: 48px 1fr; align-items: start; gap: 20px; }
.step__icon { width: 48px; height: 48px; color: var(--ink); }
.step__icon svg { display: block; width: 100%; height: 100%; }
.step__title { margin: 6px 0 14px; font-size: 1.1rem; }
.step p { margin: 0; font-family: var(--font-serif); font-size: .9rem; font-weight: 600; line-height: 1.85; }
.step a { color: inherit; }

.signature { margin: 44px 0 0; text-align: right; font-size: 1.6rem; font-style: italic; font-weight: 400; color: var(--brown); }

@media (max-width: 999.98px) {
  .estimate__inner { grid-template-columns: 1fr; }
  .estimate__body { padding: 40px 0 0; }
}
@media (max-width: 700px) {
  .steps { grid-template-columns: 1fr; }
  .signature { text-align: center; }
}

/* ---------- Gallery ---------- */
.gallery-section { background: var(--ink); }
.gallery-section .section-title { color: var(--white); letter-spacing: .12em; }

.carousel--gallery { --per-view: 2; }
.carousel--gallery .carousel__btn { width: 30px; height: 30px; font-size: 1.2rem; }
.carousel--gallery .carousel__btn--prev { left: 8px; }
.carousel--gallery .carousel__btn--next { right: 8px; }
.carousel--gallery .carousel__dots { gap: 0; margin-top: 16px; }
.carousel--gallery .carousel__dot { width: 18px; height: 24px; }
.carousel--gallery .carousel__dot::before { width: 6px; height: 6px; background: rgba(255, 255, 255, .4); }
.carousel--gallery .carousel__dot[aria-current="true"]::before { background: var(--white); }

.gallery a { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 5; background: rgba(255, 255, 255, .06); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.gallery a:hover img { transform: scale(1.04); }

@media (max-width: 700px) {
  .carousel--gallery { --gap: 8px; }
}

/* ---------- About + stats ---------- */
.about { padding: clamp(48px, 7vw, 96px) var(--gutter); }
.about__inner {
  display: grid; max-width: var(--content-narrow); margin: 0 auto;
  grid-template-columns: minmax(240px, 28%) 1fr;
  grid-template-areas: "text media" "stats stats";
}
.about__text { grid-area: text; padding: 40px 32px; background: var(--ink); color: rgba(255, 255, 255, .85); }
.about__text h2 { margin: 0 0 24px; color: var(--white); font-size: clamp(1.3rem, 2vw, 1.6rem); line-height: 1.35; }
.about__text p { margin: 0; font-size: .9rem; line-height: 1.7; }
.about__media { grid-area: media; min-height: 420px; }

.stats { grid-area: stats; display: grid; grid-template-columns: minmax(240px, 28%) 1fr 1fr; background: var(--brown); }
.stat { padding: 36px 12px; text-align: center; color: var(--white); }
.stat--dark { background: var(--ink); }
.stat__num { display: block; font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 600; line-height: 1.1; }
.stat__label { display: block; margin-top: 10px; font-size: .85rem; color: rgba(255, 255, 255, .85); }

@media (max-width: 999.98px) {
  .about__inner { grid-template-columns: 1fr; grid-template-areas: "text" "media" "stats"; }
  .about__media { min-height: 280px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .stat { padding: 20px 6px; }
  .stat__label { font-size: .78rem; }
}

/* ---------- Offers ---------- */
.offers { background: var(--cream); }
.offers .carousel { max-width: 980px; margin-inline: auto; }
.offer-card { display: grid; grid-template-columns: 1.15fr 1fr; overflow: hidden; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.offer-card img { width: 100%; height: 100%; min-height: 320px; object-fit: cover; background: var(--cream-light); }
.offer-card__body { display: flex; flex-direction: column; justify-content: center; padding: 40px 36px; }
.offer-card__price { margin: 0; font-size: 2.4rem; font-weight: 600; line-height: 1.2; color: var(--brown); }
.offer-card__size { margin-bottom: 1.2em; font-weight: 500; color: var(--ink); }
.offer-card__includes li { position: relative; padding-left: 28px; margin-bottom: .45em; }
.offer-card__includes li::before { content: "✓"; position: absolute; left: 0; font-weight: 700; color: var(--brown); }

@media (max-width: 700px) {
  .offer-card { grid-template-columns: 1fr; }
  .offer-card img { height: auto; min-height: 0; aspect-ratio: 4 / 3; }
  .offer-card__body { padding: 28px 24px; }
}

/* ---------- Reviews ---------- */
.reviews { background: var(--ink); color: var(--white); }
.reviews .section-title { margin-bottom: 12px; color: var(--white); }
.reviews__subtitle { max-width: 640px; margin: 0 auto 48px; text-align: center; color: rgba(255, 255, 255, .8); }
.reviews__grid { max-width: var(--content-narrow); margin: 0 auto; columns: 3; column-gap: 24px; }   /* masonry */

.review { break-inside: avoid; margin: 0 0 24px; padding: 28px 26px 22px; background: var(--white); color: var(--gray); box-shadow: var(--shadow); }
.review blockquote { margin: 0 0 24px; font-size: .9rem; line-height: 1.6; }
.review blockquote p { margin: 0; }
.review__author { margin: 0 0 8px; text-align: center; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.review__stars { text-align: center; font-size: 1.4rem; line-height: 1; letter-spacing: 4px; color: var(--star); }

@media (max-width: 1100px) {
  .reviews__grid { columns: 2; }
}
@media (max-width: 700px) {
  .reviews__grid { columns: 1; }
}

/* ---------- Contact ---------- */
.contact { padding-block: clamp(48px, 6vw, 80px); background: linear-gradient(to bottom, #ececec 0, var(--white) 72px); }
.contact__inner { display: grid; grid-template-columns: 1fr 1.25fr 1fr; align-items: center; gap: 40px; }
.contact__brand { text-align: center; }
.contact__brand img { width: 140px; margin: 0 auto 32px; }
.contact__brand h2 { max-width: 26ch; margin: 0 auto; font-size: .95rem; font-weight: 400; line-height: 1.6; }
.contact__map { height: 300px; background: var(--cream); }
.contact__map iframe { display: block; width: 100%; height: 100%; border: 0; }
.contact address { padding-left: clamp(0px, 4vw, 56px); font-size: .9rem; line-height: 1.8; color: var(--ink); }
.contact address p { margin: 0 0 1.6em; }
.contact address p:last-child { margin-bottom: 0; }
.contact address a { color: inherit; }
.contact address strong { font-weight: 600; }

@media (max-width: 999.98px) {
  .contact__inner { grid-template-columns: 1fr; gap: 36px; }
  .contact address { padding-left: 0; text-align: center; }
}

/* ---------- Footer ---------- */
.site-footer { padding-block: 40px; background: var(--ink); color: rgba(255, 255, 255, .7); font-size: .9rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.site-footer__logo img { width: auto; height: 60px; padding: 6px 10px; background: var(--white); border-radius: 8px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--cream); }

@media (max-width: 700px) {
  .site-footer__inner { flex-direction: column; text-align: center; }
}

/* ---------- 404 page ---------- */
.not-found { display: flex; align-items: center; min-height: calc(100vh - var(--header-h) - 140px); padding-block: clamp(32px, 6vw, 72px); }
.not-found__inner { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; max-width: var(--content-narrow); }
.not-found__code { display: grid; place-items: center; padding: clamp(40px, 6vw, 80px) 24px; background: var(--cream); }
.not-found__code span { font-family: var(--font-serif); font-size: clamp(5rem, 13vw, 9.5rem); font-weight: 700; line-height: 1; color: var(--taupe); }
.not-found__body { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 5vw, 64px); background: var(--ink); color: rgba(255, 255, 255, .85); }
.not-found__eyebrow { margin: 0 0 12px; font-size: .8rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--cream); }
.not-found__title { margin: 0 0 20px; font-size: clamp(1.5rem, 3vw, 2.2rem); color: var(--white); }
.not-found__body p:not(.not-found__eyebrow) { max-width: 46ch; margin: 0 0 32px; font-family: var(--font-serif); font-weight: 600; font-size: .95rem; line-height: 1.8; }
.not-found__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.not-found .btn--outline { color: var(--white); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.not-found .btn--outline:hover { background: var(--white); color: var(--ink); }

@media (max-width: 700px) {
  .not-found__inner { grid-template-columns: 1fr; }
  .not-found__code { padding-block: 32px; }
  .not-found__actions .btn { flex: 1 1 100%; }
}


/* ==========================================================================
   6. Utilities
   ========================================================================== */

/* Reveal on scroll (class toggled by js/main.js) */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible,
.no-js .reveal { opacity: 1; transform: none; }

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