/* ==========================================================================
   Crown Home Improvement — cinematic layer (loads after styles.css)
   ========================================================================== */

/* ---------- preloader ---------- */
.preloader { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--navy); background-image: var(--pat-grid); transition: clip-path 1.1s cubic-bezier(.77, 0, .18, 1); clip-path: inset(0 0 0 0); }
.preloader.gone { clip-path: inset(0 0 100% 0); }
.pre-inner { display: grid; justify-items: center; gap: 18px; }
.pre-mark { width: 74px; height: 74px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, var(--gold-2), var(--gold) 55%, #b8862f); color: var(--navy); animation: preFloat 1.6s var(--ease) infinite alternate; }
.pre-mark .ico { width: 42px; height: 42px; }
.pre-word { font-family: var(--font-head); font-weight: 900; font-size: 30px; letter-spacing: .5em; color: #fff; padding-left: .5em; }
.pre-bar { width: 180px; height: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; border-radius: 2px; }
.pre-bar span { display: block; height: 100%; width: 40%; background: var(--gold); animation: preBar 1.1s ease-in-out infinite; }
.pre-num { font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: .2em; color: var(--gold-2); }
.pre-num::after { content: "%"; }
@keyframes preFloat { to { transform: translateY(-8px) rotate(-3deg); } }
@keyframes preBar { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ---------- scroll progress ---------- */
.scroll-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 150; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }

/* ---------- cursor ---------- */
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; z-index: 400; pointer-events: none; border-radius: 50%; transition: opacity .3s; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--gold); }
.cursor-ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1.5px solid rgba(213, 166, 74, .7); transition: width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease), background-color .3s, border-color .3s, opacity .3s; mix-blend-mode: difference; }
.cursor-ring.big { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(213, 166, 74, .12); }
.cursor-ring.view { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: rgba(213, 166, 74, .9); border-color: transparent; mix-blend-mode: normal; }
.cursor-ring.view::after { content: "VIEW"; position: absolute; inset: 0; display: grid; place-items: center; font: 800 12px var(--font-head); letter-spacing: .15em; color: var(--navy); }
@media (hover: hover) and (pointer: fine) { body, a, button, #scene { cursor: none; } input, select, textarea { cursor: text; } select { cursor: pointer; } }

/* ---------- split text ---------- */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split .w > span { display: inline-block; transform: translate3d(0, 110%, 0) rotate(4deg); transform-origin: 0 100%; transition: transform 1s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i) * 45ms); }
.split.in .w > span { transform: none; }
html:not(.loaded) .hero-title .w > span { transform: translate3d(0, 110%, 0) rotate(4deg) !important; }
.loaded .hero-title .w > span { transition-delay: calc(.25s + var(--i) * 70ms); }

/* hero entrance */
.hero-in { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.loaded .hero-in { opacity: 1; transform: none; transition-delay: calc(var(--d, 0s) + .25s); }
.hero .container > * { max-width: 680px; }
.scroll-cue { position: absolute; left: 50%; bottom: 112px; width: 26px; height: 42px; margin-left: -13px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 14px; z-index: 2; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--gold); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }
@media (max-width: 860px) { .scroll-cue { display: none; } }

/* ---------- photos ---------- */
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; transition: transform 1.2s var(--ease), opacity .8s; }
.ph:not(.has-photo) > img { opacity: 0; }
.reveal-clip { clip-path: inset(100% 0 0 0); transition: clip-path 1.3s cubic-bezier(.77, 0, .18, 1); }
.reveal-clip > img { transform: scale(1.25); transition: transform 1.8s cubic-bezier(.2, .8, .2, 1); }
.reveal-clip.in { clip-path: inset(0 0 0 0); }
.reveal-clip.in > img { transform: none; }

/* ---------- marquee ---------- */
.marquee { padding: 46px 0 34px; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
.marquee-row { display: flex; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; align-items: center; gap: 34px; padding-right: 34px; flex: none; white-space: nowrap; animation: marquee 48s linear infinite; }
.marquee-row:first-child .marquee-track span { font-family: var(--font-head); font-weight: 900; font-size: clamp(34px, 5vw, 64px); letter-spacing: -.02em; color: var(--navy); }
.marquee-row:first-child .marquee-track span:nth-of-type(even) { color: transparent; -webkit-text-stroke: 1.5px var(--navy); }
.marquee-row i { font-style: normal; color: var(--gold); font-size: 26px; }
.marquee-rev { margin-top: 10px; }
.marquee-rev .marquee-track { animation-direction: reverse; animation-duration: 36s; }
.marquee-rev span { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.marquee-rev i { font-size: 10px; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- about: layered photos ---------- */
.about-media { padding: 0 0 70px; }
.about-media > .ph-tall { width: 82%; }
.about-inset { position: absolute !important; right: 0; bottom: 0; width: 48%; aspect-ratio: 1 / 1; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 6px solid #fff; z-index: 2; }
.about-badge { right: auto; left: -18px; bottom: 120px; z-index: 3; }
@media (max-width: 920px) { .about-media { margin-left: 0; } }

/* ---------- cinematic pinned view ---------- */
.cine { --p: 0; position: relative; height: 260vh; background: #fff; }
.cine-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: grid; align-items: end; }
.cine-frame { --q: min(1, calc(var(--p) * 2.4)); position: absolute; inset: 0; overflow: hidden; clip-path: inset(calc((1 - var(--q)) * 16%) calc((1 - var(--q)) * 24%) round calc((1 - var(--q)) * 32px)); will-change: clip-path; background: var(--navy); }
.cine-frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(calc(1.35 - var(--p) * .3)) translateY(calc(var(--p) * -3%)); will-change: transform; }
.cine-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16, 29, 50, .1) 30%, rgba(16, 29, 50, .85)); opacity: calc(var(--q) * 1); }
.cine-copy { position: relative; z-index: 2; padding-bottom: 14vh; color: #fff; }
.cine-copy .eyebrow { opacity: clamp(0, calc(var(--p) * 4 - 1.2), 1); }
.cine-line { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: clamp(44px, 8.2vw, 128px); line-height: .95; letter-spacing: -.04em; max-width: 12ch; }
.cine-line span { display: inline-block; opacity: clamp(0, calc(var(--p) * 5 - 1.6), 1); transform: translateY(calc((1 - clamp(0, calc(var(--p) * 5 - 1.6), 1)) * 50px)); }
.cine-line span:nth-child(2) { opacity: clamp(0, calc(var(--p) * 5 - 2.2), 1); transform: translateY(calc((1 - clamp(0, calc(var(--p) * 5 - 2.2), 1)) * 50px)); }
.cine-line span:nth-child(3) { opacity: clamp(0, calc(var(--p) * 5 - 2.8), 1); transform: translateY(calc((1 - clamp(0, calc(var(--p) * 5 - 2.8), 1)) * 50px)); }
.cine-line .gold { color: var(--gold); }
.cine-meta { position: absolute; left: 0; right: 0; bottom: 28px; z-index: 2; display: flex; gap: 28px; justify-content: flex-end; color: rgba(255, 255, 255, .7); font: 700 12px var(--font-head); letter-spacing: .25em; text-transform: uppercase; opacity: clamp(0, calc(var(--p) * 4 - 2), 1); }
@media (max-width: 760px) { .cine { height: 200vh; } .cine-meta { justify-content: flex-start; gap: 14px; letter-spacing: .15em; } }

/* ---------- services: photo cards with tilt + glare ---------- */
.service-card { transform-style: preserve-3d; will-change: transform; transition: transform .5s var(--ease), box-shadow .4s var(--ease), border-color .4s; }
.service-card::after, .why-item::after, .review::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .35), transparent 45%); z-index: 4; }
.service-card:hover::after, .review:hover::after { opacity: 1; }
.why-item { position: relative; }
.why-item::after { background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(213, 166, 74, .16), transparent 50%); }
.why-item:hover::after { opacity: 1; }
.service-card .ph::after { background: linear-gradient(180deg, transparent 40%, rgba(16, 29, 50, .55)); z-index: 2; }
.service-card:hover .ph > img { transform: scale(1.08); }
.service-num { position: absolute; right: 22px; top: 14px; font-family: var(--font-head); font-weight: 900; font-size: 44px; line-height: 1; color: transparent; -webkit-text-stroke: 1.2px #d4dae3; transition: -webkit-text-stroke-color .3s; }
.service-card:hover .service-num { -webkit-text-stroke-color: var(--gold); }
.service-ico { z-index: 3; }

/* ---------- 3D anatomy (pinned) ---------- */
.anatomy { --p: 0; position: relative; height: 560vh; background: radial-gradient(ellipse 70% 60% at 70% 45%, #1d3459, var(--navy) 70%); color: rgba(255, 255, 255, .78); }
.anatomy-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: grid; align-items: center; }
.anatomy-sticky::before { content: ""; position: absolute; inset: 0; background: var(--pat-grid); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%); mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%); }
.anatomy-grid { position: relative; display: grid; grid-template-columns: minmax(300px, .8fr) 1.2fr; gap: 40px; align-items: center; height: 100%; padding-top: var(--header-h); }
.anatomy-copy .section-title { color: #fff; font-size: clamp(30px, 3.4vw, 46px); }
.anatomy-intro { font-size: 17px; margin-bottom: 26px; }
.anatomy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: none; }
.anatomy-list li { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid transparent; transition: background-color .4s, border-color .4s, opacity .4s, transform .4s var(--ease); }
.anatomy.stepping .anatomy-list li { opacity: .38; }
.anatomy-list li.active { opacity: 1 !important; background: rgba(213, 166, 74, .1); border-color: rgba(213, 166, 74, .45); transform: translateX(8px); }
.anatomy-list b { font: 800 13px var(--font-head); color: var(--gold); letter-spacing: .1em; padding-top: 3px; }
.anatomy-list strong { display: block; font-family: var(--font-head); color: #fff; font-size: 17px; }
.anatomy-list li span { font-size: 14.5px; line-height: 1.5; }
.anatomy-stage { position: relative; height: min(78vh, 720px); }
#anatomy-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.anatomy-stage::before { content: ""; position: absolute; inset: 10% 10% 0; border-radius: 50%; background: radial-gradient(circle, rgba(213, 166, 74, .14), transparent 65%); }
.anatomy-progress { position: absolute; left: 10%; right: 10%; bottom: 0; height: 2px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
.anatomy-progress span { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--gold); }
@media (max-width: 960px) {
  .anatomy { height: 620vh; }
  .anatomy-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 0; align-content: start; padding-top: calc(var(--header-h) + 10px); }
  .anatomy-intro, .anatomy-copy .eyebrow { display: none; }
  .anatomy-copy .section-title { font-size: 26px; margin-bottom: 10px; }
  .anatomy-list li { display: none; }
  .anatomy-list li.active { display: grid; transform: none; }
  .anatomy-stage { height: 100%; min-height: 320px; order: 2; }
}

/* ---------- process ---------- */
.process { background: #fff; }
.steps { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.steps::before { content: ""; position: absolute; left: 30px; right: 30px; top: 30px; height: 2px; background: linear-gradient(90deg, var(--gold), var(--royal)); transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.8s cubic-bezier(.77, 0, .18, 1) .2s; }
.steps.in::before { transform: scaleX(1); }
.step { position: relative; }
.step-n { position: relative; z-index: 1; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 22px; background: var(--navy); color: var(--gold); font: 900 22px var(--font-head); box-shadow: 0 0 0 8px #fff, var(--shadow); }
.step h3 { font-size: 20px; }
.step p { color: var(--muted); font-size: 15.5px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr 1fr; } .steps::before { display: none; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* ---------- projects: horizontal pinned gallery ---------- */
.projects-scroll { --p: 0; position: relative; background: var(--navy); color: #fff; }
.hg-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 34px; padding-top: var(--header-h); }
.hg-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; flex-wrap: wrap; }
.hg-head .section-title { color: #fff; margin: 0; }
.hg-note { display: flex; align-items: center; gap: 10px; max-width: 420px; margin: 0; font-size: 14px; color: rgba(255, 255, 255, .6); }
.hg-note .ico { color: var(--gold); }
.hg-track { display: flex; gap: 22px; padding-left: max(20px, calc((100vw - var(--container)) / 2)); padding-right: 40px; will-change: transform; }
.hg-track .g-item { flex: none; position: relative; width: clamp(260px, 30vw, 440px); height: min(56vh, 520px); border-radius: var(--radius-lg); }
.hg-track .g-wide { width: clamp(320px, 46vw, 700px); grid-column: auto; }
.hg-track .g-item .ph { position: absolute; inset: 0; aspect-ratio: auto; }
.g-cap small { display: block; font: 800 12px var(--font-head); letter-spacing: .2em; color: var(--gold); margin-bottom: 4px; }
.hg-bar { height: 2px; background: rgba(255, 255, 255, .1); position: relative; overflow: hidden; border-radius: 2px; }
.hg-bar span { position: absolute; inset: 0; background: var(--gold); transform-origin: 0 50%; transform: scaleX(var(--p)); }
@media (max-width: 760px) {
  .projects-scroll { height: auto !important; padding: 90px 0; }
  .hg-sticky { position: static; height: auto; padding-top: 0; }
  .hg-track { overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; transform: none !important; scrollbar-width: none; }
  .hg-track::-webkit-scrollbar { display: none; }
  .hg-track .g-item, .hg-track .g-wide { width: 80vw; height: 62vh; max-height: 460px; scroll-snap-align: start; }
  .hg-bar { display: none; }
}

/* ---------- reviews ---------- */
.review { position: relative; transform-style: preserve-3d; transition: transform .5s var(--ease), box-shadow .35s var(--ease); }
.score { display: flex; align-items: baseline; }

/* ---------- CTA with cinematic photo ---------- */
.cta-band { padding: clamp(110px, 14vw, 180px) 0; background: var(--navy); }
.cta-band::before { display: none; }
.cta-bg { position: absolute; inset: -18% 0; z-index: 0; }
.cta-bg img { width: 100%; height: 100%; object-fit: cover; }
.cta-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16, 29, 50, .95) 0%, rgba(16, 29, 50, .75) 45%, rgba(16, 29, 50, .35)); }
.cta-inner { z-index: 1; }
.cta-inner h2 { font-size: clamp(38px, 5.4vw, 72px); }

/* ---------- misc ---------- */
.footer-bottom .fine { display: block; font-size: 12.5px; color: rgba(255, 255, 255, .45); margin-top: 4px; }
.btn.magnetic { transition: transform .35s var(--ease), box-shadow .25s var(--ease), background-color .25s, color .25s, border-color .25s; }

@media (prefers-reduced-motion: reduce) {
  .preloader { display: none; }
  .cine { height: auto; } .cine-sticky { position: relative; height: 80vh; } .cine-frame { clip-path: none; } .cine-frame img { transform: none; }
  .cine-line span, .cine-copy .eyebrow, .cine-meta { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none; }
  .reveal-clip { clip-path: none; } .reveal-clip > img { transform: none; }
  .hero-in { opacity: 1; transform: none; }
}
