/*
  The home page below the hero (templates/core/home.html): services, about and
  portfolio on cream, then the blog wall and the closing call to action on navy.

  Motion is added only when <head> put `js-motion` on <html> (scripts on, reduced
  motion off). Every hidden "before" state below is scoped to `.js-motion`, so
  without scripts, or with reduced motion, everything is simply there. Only
  transform and opacity ever animate. static/js/home-motion.js does the rest.

  The cream sections use the cream-surface variants of the palette (`.on-cream` in
  site.css re-points --muted, --accent and --line); text on them is navy.
*/

.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; }

.hm { position: relative; background: var(--light); color: var(--ground); overflow-x: clip; }
.hm-sec { position: relative; z-index: 1; padding: clamp(4.5rem, 10vw, 8.5rem) 0; }
.hm-sec + .hm-sec { border-top: 1px solid var(--line); }
.hm .wrap { position: relative; z-index: 1; }
@media (min-width: 768px) { .hm .wrap { padding-left: max(clamp(1rem, 3vw, 2rem), clamp(3rem, 5.6vw, 5rem)); } }   /* clear of the watermark */

/* the brand word running down the left edge: decoration, hidden on phones */
.hm-mark { position: absolute; inset: 0 auto 0 0; width: clamp(2.2rem, 4.6vw, 4.4rem); z-index: 0; pointer-events: none; }
.hm-mark-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; }
.hm-mark span {
  writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
  font-family: var(--font-display); font-weight: 500; text-transform: uppercase;
  font-size: clamp(1.4rem, 2.6vw, 2.4rem); letter-spacing: .6em;
  color: var(--gold-line);                 /* 3.5:1 on cream: a watermark, but still above the 3:1 line */
}
@media (max-width: 767px) { .hm-mark { display: none; } }

/* ── the two-word headings ─────────────────────────────────────────────── */
.split {
  font-family: var(--font-display); font-weight: 300; text-transform: uppercase;
  font-size: clamp(3rem, 10.5vw, 9.6rem); line-height: .92; letter-spacing: .005em;
  text-wrap: nowrap;
}
.split-a, .split-b { display: block; }
.split-b { margin-left: clamp(1.5rem, 12vw, 13rem); }
/* the one-line version (the before/after section): same face, smaller, the second word in gold
   like the AFTER label on the slider */
.split--row { display: flex; align-items: baseline; gap: .26em; font-size: var(--ba-fs, clamp(2.4rem, 6.4vw, 5.6rem)); line-height: .92; }
.split--row .split-a, .split--row .split-b { display: inline-block; margin-left: 0; }
.split--row .split-b { color: var(--accent); }

/* ── before / after: the first section after the hero ──────────────────────────
   ONE large slider (the shared compare component) and a tab per room. Its size is whatever a
   3:2 box allows while everything of the section fits in the window at once: the heading, the
   line and the tabs, the slider, its caption, and the padding. The arithmetic is the custom
   properties below (`--ba-reserve` is all of it except the slider). */
.hm-sec.hm-ba {
  --wrap-pad: clamp(1rem, 3vw, 2rem);                    /* .wrap's side padding */
  --ba-pt: clamp(1.4rem, 3vw, 2.75rem);                  /* above the heading */
  --ba-pb: clamp(1.25rem, 2.2vw, 2rem);                  /* below the caption */
  --ba-fs: clamp(2.4rem, 6.4vw, 5.6rem);                 /* the heading's size */
  --ba-sub: 2.4rem;                                      /* the row of tabs */
  --ba-cap: 2rem;                                        /* the caption row */
  --ba-gap: clamp(.55rem, 1.1vw, .9rem);
  --ba-reserve: calc(var(--ba-pt) + .92 * var(--ba-fs) + var(--ba-sub) + var(--ba-cap) + 3 * var(--ba-gap) + var(--ba-pb) + .5rem);
  --ba-w: min(100%, calc((var(--win-h) - 2 * var(--frame) - var(--ba-reserve)) * 1.5));
  padding: var(--ba-pt) 0 var(--ba-pb);
}
/* the heading, and beside it (under it on a narrow screen) the one plain line: it costs no height */
.hm-ba-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 2rem; }
.hm-ba .split--row { margin: 0; }
.hm-ba-line { flex: 0 1 24rem; margin-bottom: .3rem; font-size: .9375rem; line-height: 1.4; color: var(--muted); }
/* the tabs, the slider and its caption: three rows, one under the other */
.hm-ba-body { display: grid; grid-template-columns: var(--ba-w); grid-template-areas: "tabs" "show" "cap"; margin-top: var(--ba-gap); row-gap: var(--ba-gap); }
.hm-ba-tabs { grid-area: tabs; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.hm-ba-tabs .chip { padding: .55rem 1rem; }
.hm-ba-show { grid-area: show; }
.hm-ba-show .cmp-lg { width: 100%; }
/* one line: a long project title is cut short rather than pushing the slider off the screen */
.hm-ba-cap { grid-area: cap; display: flex; align-items: baseline; justify-content: space-between; gap: .2rem 1.5rem; }
.hm-ba-title { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
               font-family: var(--font-display); font-size: clamp(1.05rem, 1.7vw, 1.4rem); font-weight: 500; line-height: 1.2; }
.hm-ba-cap .hm-more { flex: none; margin-top: 0; white-space: nowrap; }

/* A wide, SHORT window (a 16:9 laptop: 1366x768, 1280x720): what limits the slider is height, and a column of width is
   going spare. So the tabs and the caption move into a column beside the slider, which gets the height they were using:
   about 840x560 at 1366x768 instead of 700x465. A taller window (1440x900) is better off stacked, so it stays so. */
@media (min-width: 1180px) and (max-height: 860px) {
  .hm-sec.hm-ba {
    --ba-rail: 15rem;                                   /* the narrowest the column beside the slider may be */
    --ba-reserve: calc(var(--ba-pt) + .92 * var(--ba-fs) + var(--ba-gap) + var(--ba-pb) + .5rem);
    --ba-w: min(100% - var(--ba-rail) - 2rem, calc((var(--win-h) - 2 * var(--frame) - var(--ba-reserve)) * 1.5));
  }
  .hm-ba-body { grid-template-columns: var(--ba-w) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 2rem;
                grid-template-areas: "show tabs" "show cap"; }
  .hm-ba-tabs { flex-direction: column; flex-wrap: nowrap; align-content: start; }
  .hm-ba-tabs .chip { display: flex; padding: .8rem 1.1rem; font-size: .875rem; }
  .hm-ba-cap { flex-direction: column; align-items: flex-start; align-self: end; gap: .7rem; }
  .hm-ba-title { overflow: visible; white-space: normal; text-overflow: clip; font-size: 1.3rem; }
}
@media (max-width: 767px) {
  /* a phone: the slider runs edge to edge (4:3), the tabs are a row you swipe, the title may wrap */
  .hm-sec.hm-ba { --ba-w: 100%; }
  .hm-ba-head { flex-direction: column; align-items: flex-start; }
  .hm-ba-line { flex: none; margin-bottom: 0; }
  .hm-ba-body { grid-template-columns: minmax(0, 1fr); margin-top: .9rem; row-gap: .75rem; }
  .hm-ba-show { margin-inline: calc(-1 * var(--wrap-pad)); }
  .hm-ba-tabs { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
                margin-inline: calc(-1 * var(--wrap-pad)); padding: .15rem var(--wrap-pad) .35rem; }
  .hm-ba-tabs li { flex: none; scroll-snap-align: start; }
  .hm-ba-tabs::-webkit-scrollbar { display: none; }
  .hm-ba-cap { flex-wrap: wrap; }
  .hm-ba-title { flex: 1 1 100%; white-space: normal; }
}

/* ── numbered items ─────────────────────────────────────────────────────── */
.hm-items { list-style: none; margin: clamp(3rem, 7vw, 6rem) 0 0; padding: 0; display: grid; gap: clamp(4.5rem, 9vw, 8rem); }
.hm-item { position: relative; display: grid; gap: 2.25rem; align-items: center; }
@media (min-width: 900px) {
  .hm-item { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(3rem, 7vw, 7rem); }
  .hm-item:not(.hm-proj).is-flip > :first-child { order: 2; }
}

.hm-photo { position: relative; display: block; margin: 0; }
.hm-photo-link { position: relative; display: block; }
.hm-cap { margin-top: 1.5rem; max-width: 30rem; font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.hm-cap a { border-bottom: 1px solid transparent; transition: color .2s ease, border-color .2s ease; }
.hm-cap a:hover, .hm-cap a:focus-visible { color: var(--accent); border-bottom-color: var(--gold-line); }
.hm-photo img { position: relative; z-index: 1; display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
/* the thin frame sitting behind each photo, shifted off to one corner */
.hm-frame { position: absolute; inset: 0; z-index: 0; border: 1px solid var(--gold-line); transform: translate(14px, 14px); }
.is-flip .hm-frame { transform: translate(-14px, 14px); }

.hm-num {
  display: block; margin-bottom: .6rem; line-height: 1;
  font-family: var(--font-display); font-weight: 300; font-size: clamp(3.2rem, 6.5vw, 5.4rem); font-variant-numeric: lining-nums;
  color: transparent; -webkit-text-stroke: 1px var(--accent);
}
.hm-title { margin-bottom: 1.1rem; font-weight: 600; font-size: clamp(.95rem, 1.35vw, 1.1rem); letter-spacing: .22em; text-transform: uppercase; }
.hm-body { max-width: 34rem; font-size: 1.0625rem; line-height: 1.7; color: color-mix(in srgb, var(--ground) 86%, var(--light)); }
.hm-meta { margin-top: 1rem; color: var(--muted); }
.hm-links { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; }
/* "Before & after": a project that has a real pair says so, and links to it */
.hm-badge {
  display: inline-flex; align-items: center; margin-top: 1.5rem; padding: .55rem .8rem;
  background: var(--gold); color: var(--ground);                  /* text on gold is always navy */
  font: 600 .6875rem/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}
.hm-badge:hover, .hm-badge:focus-visible { background: var(--ground); color: var(--light); }
.hm-more {
  display: inline-flex; align-items: center; gap: .6rem; margin-top: 1.5rem; padding-bottom: .3rem;
  font-size: .8125rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); border-bottom: 1px solid var(--gold-line);
  transition: gap .25s ease;
}
.hm-more:hover { gap: 1rem; }
.hm-more-row { margin-top: clamp(2.5rem, 5vw, 4rem); }
.hm-more-row .hm-more { margin-top: 0; }
.hm-all { text-align: right; }
.hm-empty { margin-top: 3rem; }

/* ── about ──────────────────────────────────────────────────────────────── */
.hm-about { display: grid; gap: 3.5rem; margin-top: clamp(3rem, 7vw, 6rem); align-items: start; }
@media (min-width: 900px) { .hm-about { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(3rem, 7vw, 7rem); } }
.hm-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.4rem; }
.hm-fact {
  display: grid; grid-template-columns: minmax(6.2rem, 11rem) 1fr; grid-template-areas: "big label" "big text";
  column-gap: clamp(1rem, 3vw, 2.2rem); row-gap: .35rem; align-items: start;
  padding-bottom: 2.4rem; border-bottom: 1px solid var(--line);
}
.hm-fact:last-child { border-bottom: 0; }
.hm-big {
  grid-area: big; font-family: var(--font-display); font-weight: 300; line-height: .85;
  font-size: clamp(3.6rem, 7.6vw, 6.4rem); color: var(--accent); font-variant-numeric: lining-nums;
}
.hm-label { grid-area: label; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .18em; padding-top: .5rem; }
.hm-fact .hm-body { grid-area: text; }
.hm-about-photos { position: relative; display: grid; gap: 1.6rem; padding-bottom: 14px; }
.hm-about-photo { width: 84%; }
.hm-about-photo.is-second { width: 54%; justify-self: end; margin-top: -3.5rem; }
.hm-about-photo.is-second img { aspect-ratio: 3 / 4; }
.hm-line {
  margin-top: clamp(4rem, 8vw, 7rem); text-align: center;
  font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(2rem, 5.2vw, 4.2rem); line-height: 1.05;
}

/* ── portfolio: a collage of three photos per project ─────────────────────
   Each item is three blocks in DOM order, which is the phone's order: HEAD (the numeral, the
   title, the description), the COLLAGE, then the FOOT (the kind of work, the link, the
   "Before & after" badge). From 900px the collage takes one column across both rows and the
   head sits at the top of the other column, the foot at its bottom; every second item swaps
   the sides. */
.hm-proj { grid-template-areas: "head" "collage" "foot"; }
.hm-head { grid-area: head; }
.hm-collage { grid-area: collage; position: relative; aspect-ratio: 6 / 5; }
.hm-foot { grid-area: foot; }
.hm-foot .hm-meta { margin-top: 0; }
@media (min-width: 900px) {
  .hm-proj { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto 1fr;
             grid-template-areas: "collage head" "collage foot"; align-items: start; }
  .hm-proj.is-flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
                     grid-template-areas: "head collage" "foot collage"; }
  .hm-head { align-self: start; }
  .hm-foot { align-self: end; }
  .hm-collage { align-self: center; }
}
.hm-c { position: absolute; overflow: hidden; background: var(--raised); }
.hm-c img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hm-c1 { left: 0; top: 0; width: 70%; height: 62%; z-index: 1; }
.hm-c2 { left: 52%; top: 36%; width: 48%; height: 54%; z-index: 2; outline: 6px solid var(--light); }
.hm-c3 { left: 5%; top: 66%; width: 40%; height: 34%; z-index: 2; outline: 6px solid var(--light); }
.hm-item.is-flip .hm-c1 { left: auto; right: 0; }
.hm-item.is-flip .hm-c2 { left: 0; }
.hm-item.is-flip .hm-c3 { left: auto; right: 5%; }

/* ── the blog wall and the closing call to action, on navy ───────────────── */
.hm-dark { background: var(--ground); padding: clamp(4rem, 8vw, 7rem) 0; overflow-x: clip; }
.hm-cta { position: relative; background: var(--ground); border-top: 1px solid var(--line); padding: clamp(5rem, 11vw, 9rem) 0; overflow-x: clip; }
.hm-eyebrow { margin-bottom: 1.5rem; }
.hm-cta-title { font-weight: 300; font-size: clamp(3rem, 9.5vw, 8.5rem); line-height: .94; }
.hm-cta-title span { display: block; }
.hm-cta-title span + span { margin-left: clamp(1.5rem, 11vw, 11rem); color: var(--accent); }
.hm-cta-phone { margin: clamp(1.8rem, 4vw, 3rem) 0 clamp(2rem, 4vw, 3.2rem); font-family: var(--font-display); font-size: clamp(1.5rem, 3.4vw, 2.6rem); line-height: 1.2; }
.hm-cta-phone .muted { font-family: Inter, system-ui, sans-serif; font-size: .9375rem; display: block; margin-top: .6rem; }
.hm-cta-form { padding: clamp(1.5rem, 4vw, 3.5rem); max-width: 62rem; }

/* ── motion: hidden states exist ONLY while js-motion is on <html> ──────── */
.js-motion .hm-item[data-reveal] .hm-photo,
.js-motion .hm-about-photo[data-reveal] {
  --from-x: -4.5rem;                       /* photos on the right come in from the right: see below */
  opacity: 0; transform: translate3d(var(--from-x), 1.5rem, 0);
  transition: opacity .9s ease, transform 1.05s cubic-bezier(.2, .7, .2, 1);
}
.js-motion .hm-item.is-flip[data-reveal] .hm-photo,
.js-motion .hm-about-photo.is-second[data-reveal] { --from-x: 4.5rem; }   /* only the variable: no specificity fight with .is-in */
.js-motion .hm-item[data-reveal] .hm-text {
  opacity: 0; transform: translate3d(0, 2.2rem, 0);
  transition: opacity .9s ease .25s, transform 1.05s cubic-bezier(.2, .7, .2, 1) .25s;
}
.js-motion .hm-fact[data-reveal], .js-motion .hm-line[data-reveal], .js-motion .hm-more-row[data-reveal] {
  opacity: 0; transform: translate3d(0, 2rem, 0);
  transition: opacity .8s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.js-motion .hm-head[data-reveal], .js-motion .hm-foot[data-reveal] {
  opacity: 0; transform: translate3d(0, 2.2rem, 0);
  transition: opacity .9s ease, transform 1.05s cubic-bezier(.2, .7, .2, 1);
}
.js-motion .hm-fact:nth-child(2)[data-reveal] { transition-delay: .12s; }
.js-motion .hm-fact:nth-child(3)[data-reveal] { transition-delay: .24s; }
.js-motion .hm-item.is-in .hm-photo, .js-motion .hm-item.is-in .hm-text,
.js-motion .hm-about-photo.is-in, .js-motion .hm-fact.is-in,
.js-motion .hm-line.is-in, .js-motion .hm-more-row.is-in,
.js-motion .hm-head.is-in, .js-motion .hm-foot.is-in { opacity: 1; transform: none; }
/* the scrubbed pieces start hidden; the script writes their state every frame */
.js-motion .split-a, .js-motion .split-b, .js-motion .hm-c, .js-motion .hm-cta-title { opacity: 0; }
.js-motion [data-split] .split-a, .js-motion [data-split] .split-b, .js-motion .hm-c, .js-motion .hm-cta-title { will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
  .hm *, .hm-cta * { transition: none !important; }
}
