/*
  Premium layer for the Second Generation Roofing concept — loaded after
  styles.css. Adds: branded loader, floating glass nav, scroll reveals,
  Ken Burns hero, glass stat chips, review carousel, story band.
*/

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(ellipse 900px 600px at 50% 40%, #8f1d1b, #5c0f0d);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; transition: opacity .6s ease, visibility .6s ease;
}
#loader.done { opacity: 0; visibility: hidden; }
#loader .puck {
  background: #faf7f2; border-radius: 50%;
  width: 168px; height: 168px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
  animation: puck-in 0.9s cubic-bezier(.2,.9,.3,1.2) both;
}
#loader .puck img { width: 128px; height: auto; }
#loader svg.ring { position: absolute; width: 208px; height: 208px; transform: rotate(-90deg); }
#loader svg.ring circle {
  fill: none; stroke: #e6bc4a; stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 640; stroke-dashoffset: 640;
  animation: ring-draw 1.5s .2s cubic-bezier(.4,0,.2,1) forwards;
}
#loader .ring-wrap { position: relative; width: 208px; height: 208px; display: flex; align-items: center; justify-content: center; }
#loader .motto {
  color: #f2dfc9; font-size: 13px; letter-spacing: .42em; text-transform: uppercase;
  font-weight: 600; opacity: 0; animation: motto-in 1s .7s ease forwards; text-indent: .42em;
}
@keyframes ring-draw { to { stroke-dashoffset: 0; } }
@keyframes motto-in { to { opacity: 1; } }
@keyframes puck-in { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #loader { display: none; } }

/* ---------- floating glass nav ---------- */
.nav { border-bottom: 0; box-shadow: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 12px 16px 0; }
.nav-inner {
  background: linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.56));
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.55);
  outline: 1px solid rgba(143,29,27,.08);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 12px 40px rgba(43,35,32,.14);
  padding: 8px 20px;
  transition: box-shadow .3s ease;
}
.nav.scrolled .nav-inner { box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 16px 48px rgba(43,35,32,.22); }
.nav-logo img { height: 68px; }
@media (max-width: 1080px) {
  .nav-links { border-radius: 0 0 18px 18px; overflow: hidden;
    background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
}

/* ---------- hero ---------- */
.hero { min-height: 96vh; }
.hero .bg { animation: kenburns 14s ease-out both; transform-origin: 60% 40%; }
@keyframes kenburns { from { transform: scale(1.1); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .hero .bg { animation: none; } }
.hero .shade {
  background:
    radial-gradient(ellipse 900px 480px at 18% 82%, rgba(92,15,13,.55), transparent 65%),
    linear-gradient(100deg, rgba(24,12,8,.84) 0%, rgba(24,12,8,.5) 48%, rgba(24,12,8,.15) 100%);
}
.hero-inner { padding-top: 40px; }
.hero h1 { font-size: clamp(40px, 6vw, 72px); }
.hero h1 em { font-style: italic; color: var(--gold-soft); }

/* glass stat chips over hero photo */
.chip-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 46px; }
.chip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 22px; border-radius: 16px;
  background: linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.07));
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.chip .n { font-family: var(--serif); font-size: 22px; color: var(--gold-soft); }
.chip .l { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #f0e6dc; }

/* ---------- scroll reveals ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: .08s; }
.reveal:nth-child(3) { transition-delay: .16s; }
.reveal:nth-child(4) { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- story band (the name is the story) ---------- */
.story { background: var(--cream2); position: relative; overflow: hidden; }
.story::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 700px 400px at 85% 10%, rgba(212,160,23,.10), transparent 60%);
}
.story .wrap-narrow { position: relative; text-align: center; }
.story .rule { width: 54px; height: 3px; background: var(--gold); margin: 26px auto; border-radius: 2px; }
.story .opener {
  font-family: var(--serif); font-size: clamp(26px, 4vw, 40px); color: var(--brick);
  line-height: 1.25; text-wrap: balance; font-style: italic;
}
.story p.body { color: var(--muted); font-size: 16.5px; max-width: 62ch; margin: 16px auto 0; }
.story .gen-photos { display: flex; gap: 20px; justify-content: center; margin-top: 44px; flex-wrap: wrap; }
.story .gen-photos figure {
  background: #fff; padding: 10px 10px 14px; border-radius: 6px;
  box-shadow: 0 14px 40px rgba(43,35,32,.16); max-width: 240px;
  transform: rotate(-1.6deg);
}
.story .gen-photos figure:nth-child(2) { transform: rotate(1.4deg); }
.story .gen-photos img { border-radius: 3px; aspect-ratio: 4 / 4.6; object-fit: cover; object-position: top; }
.story .gen-photos figcaption { font-size: 12.5px; color: var(--muted); margin-top: 9px; }

/* ---------- big service panels ---------- */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.panel {
  position: relative; border-radius: 20px; overflow: hidden; min-height: 420px;
  display: flex; align-items: flex-end; text-decoration: none; color: #fff;
}
.panel img.ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.panel:hover img.ph { transform: scale(1.045); }
.panel .veil { position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(24,12,8,.82)); }
.panel .glass {
  position: relative; margin: 20px; padding: 22px 26px; border-radius: 16px; width: calc(100% - 40px);
  background: linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.05));
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.panel h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; }
.panel p { color: #efe4d8; font-size: 14.5px; margin-top: 6px; }
.panel .go { margin-top: 12px; color: var(--gold-soft); font-weight: 700; font-size: 14px; }

/* ---------- counter band ---------- */
.counters { background: linear-gradient(135deg, var(--brick), var(--brick-deep)); color: #fff; }
.counters .stats-inner { padding: 52px 24px; }
.counters .n { font-size: clamp(34px, 4vw, 52px); }

/* ---------- horizontal work rail ---------- */
.rail-wrap { overflow-x: auto; padding-bottom: 18px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.rail { display: flex; gap: 18px; width: max-content; padding: 4px; }
.rail figure {
  position: relative; width: 420px; max-width: 78vw; border-radius: 18px; overflow: hidden;
  scroll-snap-align: start; flex: none;
}
.rail img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.rail figcaption {
  position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 9px 14px; border-radius: 10px;
  background: linear-gradient(rgba(24,12,8,.45), rgba(24,12,8,.6));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.16); color: #fff; font-size: 13px; font-weight: 600;
}
.rail-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 8px; letter-spacing: .06em; }

/* ---------- review carousel ---------- */
.carousel { position: relative; max-width: 820px; margin: 0 auto; text-align: center; min-height: 300px; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.slide.on { opacity: 1; pointer-events: auto; position: relative; }
.slide .stars { color: var(--gold); font-size: 18px; letter-spacing: 4px; }
.slide blockquote { font-family: var(--serif); font-size: clamp(19px, 2.4vw, 25px); color: var(--ink); line-height: 1.5; margin-top: 18px; text-wrap: pretty; }
.slide cite { display: block; font-style: normal; margin-top: 20px; font-weight: 700; color: var(--brick); }
.slide cite span { font-weight: 400; color: var(--muted); margin-left: 8px; }
.dots { display: flex; gap: 9px; justify-content: center; margin-top: 26px; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; background: var(--line); cursor: pointer; padding: 0; }
.dots button.on { background: var(--gold); }

/* ---------- CTA over photo ---------- */
.cta-photo { position: relative; overflow: hidden; padding: 110px 24px; }
.cta-photo .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cta-photo .veil { position: absolute; inset: 0; background: rgba(24,12,8,.55); }
.cta-photo .glass-panel {
  position: relative; max-width: 720px; margin: 0 auto; text-align: center;
  padding: 48px 40px; border-radius: 24px; color: #fff;
  background: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.06));
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 30px 80px rgba(0,0,0,.3);
}
.cta-photo h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 4vw, 40px); text-wrap: balance; }
.cta-photo p { color: #f0e6dc; margin-top: 12px; }

@media (max-width: 700px) {
  .panels { grid-template-columns: 1fr; }
  .nav { padding: 8px 8px 0; }
  .nav-logo img { height: 54px; }
  .hero { min-height: 88vh; }
}
