/* ==========================================================
   pages/home.css — Homepage-specific styles
   Hero, Heritage, Featured Cigars, Walk-In, CTA sections
   ========================================================== */

/* ── Hero Section ────────────────────────────────────── */
.hero {
  position: relative;
  height: 100svh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--color-surface);

  /* Rapidly become opaque as soon as the transition curtain lifts.
     This ensures it securely blocks any background elements (like heritage-bg)
     from bleeding through if the page is loaded halfway scrolled down. */
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0s;
}
body.page-loaded .hero-bg {
  opacity: 1;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  object-position: center;
}
.hero-video.active {
  opacity: 1;
}
.hero-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-bg-overlay {
  position: absolute;
  inset: 0;
  /* from-surface/40 via-surface/20 to-surface */
  background: linear-gradient(
    to bottom,
    rgba(24, 18, 16, 0.40),
    rgba(24, 18, 16, 0.20),
    #181210
  );
}

.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2; /* Sits above videos and existing overlay */
  background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(15, 12, 10, 0.35) 80%, rgba(5, 3, 2, 0.98) 115%);
  box-shadow: inset 0 0 clamp(80px, 12vw, 250px) clamp(20px, 4vw, 80px) rgba(5, 3, 2, 0.95);
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  /* Fluid horizontal padding: narrows gracefully from large to small screens */
  padding: 0 clamp(1rem, 4vw, 3rem);
  max-width: 42rem;
}

.hero-title {
  font-family: var(--font-headline);
  /* Fluid type scale: 2.25rem on tiny phones → 3rem base → 4.5rem on tablets */
  font-size: clamp(2.25rem, 5vw + 1rem, 4.5rem);
  font-weight: 700;
  /* Fluid gap below title — proportional to viewport height */
  /* lvh keeps this gap stable when mobile browser chrome appears/disappears */
  margin-bottom: clamp(1.25rem, 3lvh, 2.5rem);
  color: var(--color-on-surface);
  display: flex;
  justify-content: center;
  flex-wrap: nowrap; /* Hard lock — prevents word-spans from reflow-wrapping during font load */
}
.hero-title .word {
  display: inline-block;
  white-space: nowrap;
  margin-right: 1rem;
}
.hero-title .word:last-child {
  margin-right: 0;
}

.hero-scroll-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 65px; /* Default for Desktop (no nav bar) */
  opacity: 0.4;
  color: var(--color-on-surface);
  z-index: 10;
}

/* Adjust clearance when bottom-nav is present (visible up to 1366px) */
@media (max-width: 1366px) {
  .hero-scroll-indicator {
    /* Nav bar height (5rem) + Breathing space (2rem) + iOS safe area */
    bottom: calc(5rem + 2rem + env(safe-area-inset-bottom, 0px));
  }
}


/* ── Heritage Section ────────────────────────────────── */
.heritage {
  position: relative;
  /* Fluid section height: at minimum 60svh on short displays, comfortable on tall */
  min-height: clamp(28rem, 70svh, 52rem);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fluid vertical breathing room — scales gently with viewport height */
  padding: clamp(3rem, 8svh, 7rem) 0;
  overflow: hidden;
}

.heritage-bg,
.cta-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Use physical screen height variable (set via JS) to lock the element 
     to the device geometry instead of variable browser UI bounds.
     Fallback to 100lvh for browsers without JS. */
  height: 100vh;
  height: var(--locked-bg-height, 100lvh);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  /* Default to instant transition since CSS will lock visibility */
  transition: opacity 0.12s ease 0s;

  /* Promote to its own GPU compositor layer.
     This prevents the browser from re-rasterising the element when the
     mobile address bar slides in/out, which is what causes the subtle
     positional shift. Once on its own layer the element is composited
     directly from the GPU tile cache and is geometrically frozen. */
  will-change: transform;
  transform: translateZ(0);
}

/* Hard lock: keeps opacity rigidly at 0 until the hero video's first frame is loaded,
   but crucially omits visibility:hidden so the browser's compositor can pre-upload 
   the heavy background textures to the GPU in the background. */
body:not(.hero-video-ready) .heritage-bg,
body:not(.hero-video-ready) .cta-bg {
  opacity: 0 !important;
  transition: none !important;
}

/* Once fully loaded, use the rapid 0.12s transition for snappy scroll-based background swapping */
body.page-loaded .heritage-bg,
body.page-loaded .cta-bg {
  transition: opacity 0.12s ease 0s;
}

@media (max-width: 767px) {
  .cta-bg {
    background-position: 62.5% center;
  }
}

.cta-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(15, 12, 10, 0.35) 80%, rgba(5, 3, 2, 0.98) 115%);
  box-shadow: inset 0 0 clamp(80px, 12vw, 250px) clamp(20px, 4vw, 80px) rgba(5, 3, 2, 0.95);
}

.heritage-card {
  position: relative;
  z-index: 10;
  margin: 0 clamp(1rem, 4vw, 1.5rem);
  max-width: 32rem;
  background-color: var(--color-surface-container-low);
  /* Fluid card padding — breathes on all sizes */
  padding: clamp(1.75rem, 4vw + 0.5rem, 2.5rem);
  box-shadow: 0 40px 60px -10px rgba(19, 13, 11, 0.5);
  border-left: 2px solid var(--color-primary-container);
}

.heritage-label {
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 1.5rem;
}

.heritage-title {
  font-family: var(--font-headline);
  font-size: 2.25rem;     /* text-4xl */
  margin-bottom: 2rem;
  line-height: 1.2;
}

.heritage-desc {
  color: var(--color-on-surface-variant);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.heritage-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.heritage-link .material-symbols-outlined {
  transition: transform 0.3s ease;
}
.heritage-link:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}
@media (hover: hover) {
  .heritage-link:hover .material-symbols-outlined {
    transform: translateX(0.5rem);
  }
}


/* ── Featured Cigars Section ─────────────────────────── */
.featured {
  position: relative;
  background-color: var(--color-surface);
  /* Fluid vertical padding: top scales with viewport height; bottom gets extra room for visual drama */
  padding: clamp(2.5rem, 5svh, 5rem) 0 clamp(3.5rem, calc(3.2rem + 8svh), 8rem);
  overflow: hidden;
}

.featured-bg {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  pointer-events: none;
}
.featured-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Soft center drop-off that steeply darkens towards the outer 25% */
  /* Centered at calc(50% - 4lvh) vertically to perfectly offset the 8lvh bottom padding */
  background: radial-gradient(ellipse at 50% calc(50% - 4lvh), transparent 35%, rgba(15, 12, 10, 0.4) 75%, rgba(8, 6, 5, 0.95) 110%);
  /* Heavy edge burn that scales fluidly with the viewport */
  box-shadow: inset 0 0 clamp(80px, 12vw, 250px) clamp(20px, 4vw, 80px) rgba(5, 3, 2, 0.95);
}

.featured-header {
  max-width: 80rem;
  margin: 0 auto;
  position: relative;
  z-index: 10;
  padding: 0 clamp(1rem, 3vw, 2rem);
  margin-bottom: clamp(1rem, 2svh, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.featured-heading {
  font-family: var(--font-headline);
  font-size: clamp(1.75rem, 3vw + 0.5rem, 2.5rem);
  margin-bottom: clamp(0.5rem, 1.5svh, 1rem);
}

.featured-subheading {
  color: var(--color-on-surface-variant);
  max-width: 28rem;
}


/* ── Walk-In Section ─────────────────────────────────── */
.walkin {
  position: relative;
  background-color: var(--color-surface-container-lowest);
  /* Fluid padding: tighter on short screens, generous on tall */
  padding: clamp(3rem, 7svh, 6.5rem) clamp(1rem, 3vw, 1.5rem);
  margin-top: -1px;
  /* Fluid section height: always fills a comfortable majority of the viewport */
  min-height: clamp(32rem, 80svh, 60rem);
  display: flex;
  align-items: center;
}

.walkin-inner {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4rem;
  align-items: center;
}

.walkin-image-wrap {
  width: 100%;
  max-width: 36rem;
  order: 2;
}
.walkin-image-group {
  position: relative;
}
.walkin-image-glow {
  position: absolute;
  inset: -1rem;
  background: rgba(255, 183, 125, 0.05);
  filter: blur(48px);
  border-radius: 9999px;
  opacity: 0;
  transition: opacity 1s ease;
}
@media (hover: hover) {
  .walkin-image-group:hover .walkin-image-glow {
    opacity: 1;
  }
}
.walkin-image {
  width: 100%;
  /* Fluid image cap: tighter on compact screens, fuller on tall displays */
  max-height: clamp(20rem, 50svh, 42rem);
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 1s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
@media (hover: hover) {
  .walkin-image-group:hover .walkin-image {
    filter: grayscale(0%);
  }
}

.walkin-text-wrap {
  width: 100%;
  order: 1;
}

.walkin-label {
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.625rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 1.5rem;
}

.walkin-title {
  font-family: var(--font-headline);
  font-size: clamp(2rem, 4vw + 0.5rem, 3.5rem);
  margin-bottom: clamp(1rem, 2.5svh, 2rem);
  line-height: 1.2;
}

.walkin-desc {
  color: var(--color-on-surface-variant);
  font-size: 1.125rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 32rem;
}

.walkin-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  border-top: 1px solid rgba(85, 67, 54, 0.20);
  padding-top: 1.25rem;
}
.walkin-stats > div {
  text-align: center;
}
.walkin-stat-value {
  display: block;
  font-size: 1.875rem;
  font-family: var(--font-headline);
  color: var(--color-on-surface);
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 8px rgba(217, 119, 7, 0.4));
}
.walkin-stat-label {
  font-size: 0.625rem;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-on-surface-variant);
}


/* ── CTA / Subscribe Section ─────────────────────────── */
.cta-section {
  position: relative;
  /* Fluid padding: scales from compact to spacious proportionally */
  padding: clamp(4rem, calc(4rem + 5svh), 9rem) clamp(1rem, 4vw, 2rem);
  background-color: transparent;
  margin-top: -1px;
}

.cta-inner {
  max-width: 42rem;
  margin: 0 auto;
  text-align: center;
}

.cta-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.25rem;
  height: 4.25rem;
  margin-bottom: 2rem;
  background-color: var(--color-surface-container-high);
}
.cta-icon-wrap .material-symbols-outlined {
  font-size: 2.25rem;
  color: var(--color-primary);
  line-height: 1;
}

.cta-title {
  font-family: var(--font-headline);
  font-size: 1.875rem;
  margin-bottom: 2rem;
  text-transform: uppercase;
  line-height: 2.0; /* Increased for premium backplate breathing room */
  position: relative;
  z-index: 1;
}

/* JS-generated per-line glass backplates live in .cta-glass-wrap */
.cta-glass-wrap {
  position: relative;
  display: inline-block;
}

.cta-glass-plate {
  position: absolute;
  background-color: rgba(24, 18, 16, 0.52);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(85, 67, 54, 0.28);
  border-radius: 7px;
  box-shadow: 0 8px 32px -6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: -1;
}

.cta-desc {
  color: var(--color-on-surface-variant);
  margin-bottom: 3rem;
  line-height: 2.2; /* Increased for premium backplate breathing room */
  position: relative;
  z-index: 1;
}

.cta-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


/* ── Responsive ──────────────────────────────────────── */
@media (min-width: 768px) {
  /* hero-title now driven entirely by clamp() — no override needed */

  .heritage-card {
    margin: 0 auto;
    padding: clamp(2.5rem, 4vw, 4.5rem);
  }

  .featured-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  /* featured-heading now driven entirely by clamp() — no override needed */

  .walkin-inner {
    flex-direction: row;
  }
  .walkin-image-wrap {
    width: 50%;
    max-width: none;
    order: 1;
  }
  .walkin-image {
    /* On desktop side-by-side layout, uncap height so it fills the column */
    max-height: clamp(28rem, 60svh, 52rem);
  }
  .walkin-text-wrap {
    width: 50%;
    order: 2;
  }
  .walkin-desc {
    margin-bottom: clamp(1.5rem, 3svh, 2.5rem);
  }
  .walkin-stats {
    padding-top: clamp(1.5rem, 3svh, 2.5rem);
  }
  .walkin-stats > div {
    text-align: left;
  }
}

/* ── Location / Map Section ──────────────────────────── */
.location-section {
  position: relative;
  /* Fluid top padding: tighter on compact viewports, generous on large ones */
  padding: clamp(3.5rem, 7svh, 7rem) 6vw clamp(1.5rem, 2svh, 2rem) 6vw;
  background-color: var(--color-surface-container-lowest);
  border-top: 1px solid rgba(85, 67, 54, 0.10);
  margin-top: -1px;
}

.location-inner {
  max-width: 87.5rem;
  margin: 0 auto;
}

.location-header {
  text-align: center;
  max-width: 42rem;
  /* Fluid bottom gap before the map */
  margin: 0 auto clamp(2rem, 4svh, 4rem) auto;
}

.location-label {
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.625rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 1.5rem;
}

.location-title {
  font-family: var(--font-headline);
  font-size: 2.25rem;
  margin-bottom: 0.66rem; /* 56% reduction from 1.5rem */
  text-transform: uppercase;
}

.location-desc {
  color: var(--color-on-surface-variant);
  font-size: 1.125rem;
  line-height: 1.7;
}

/* Map container — explicit lvh-based height guarantees stable visual scale */
/* lvh (large viewport height) is fixed at the maximum viewport, immune to
   browser chrome resizing on scroll */
.location-map-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 39.33vh;          /* fallback for older browsers */
  height: 39.33lvh;
  min-height: 17.6875rem;       
  background-color: var(--color-surface-container);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(85, 67, 54, 0.25);
  overflow: hidden;
  border-radius: 8px;
  margin: 0 auto;
}

.location-map-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (min-width: 600px) {
  .location-map-wrap {
    height: clamp(20rem, 43svh, 32rem);
  }
}

@media (min-width: 768px) {
  .location-section {
    /* Already handled by fluid base padding — override to add horizontal breathing room */
    padding: clamp(4rem, 8svh, 8.5rem) 6vw clamp(1.75rem, 2.5svh, 2.5rem) 6vw;
  }

  .location-map-wrap {
    height: clamp(24rem, 47svh, 38rem);
  }
}

@media (min-width: 1024px) {
  .location-section {
    padding: clamp(5rem, 10svh, 10.5rem) 8vw clamp(2rem, 3svh, 3rem) 8vw;
  }

  .location-map-wrap {
    width: 69%;
    height: clamp(27rem, 51svh, 44rem);
  }
}

@media (min-width: 1400px) {
  .location-map-wrap {
    height: clamp(30rem, 55svh, 50rem);
  }
}

