/* ══════════════════════════════════════════════════════════════════════════
   KANGAN JEWELLERS — style.css
   Luxury Jewellery · Heritage Atelier × Modern Editorial
══════════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────────────── */
:root {
  --bg:     #F4EFE6;
  --text:   #0E0E0E;
  --accent: #B89A5E;
  --muted:  #8A857C;
  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Inter', system-ui, sans-serif;
  --ease:   cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ─── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
}

body.loading {
  overflow: hidden;
  height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

address {
  font-style: normal;
}

img, canvas {
  display: block;
  max-width: 100%;
}

/* ─── Loader ─────────────────────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.7s var(--ease);
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

#loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

#loader-track {
  width: 160px;
  height: 1px;
  background: rgba(184, 154, 94, 0.2);
  overflow: hidden;
}

#loader-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.12s linear;
  will-change: transform;
}

#loader-pct {
  font-family: var(--serif);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  color: var(--muted);
}

/* ─── Header ─────────────────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  transition: background 0.5s ease, padding 0.4s ease, box-shadow 0.5s ease;
}

#header.scrolled {
  background: var(--bg);
  padding: 1rem 3rem;
  box-shadow: 0 1px 0 rgba(184, 154, 94, 0.22);
}

/* ── Logo: text shown over video, image shown when scrolled ── */
.header-logo-link {
  display: block;
  position: relative;
  flex-shrink: 0;
  height: 44px;
  display: flex;
  align-items: center;
}

/* Image logo: hidden by default (over video), shown when scrolled */
.header-logo-img {
  height: 44px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  opacity: 0;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.45s ease;
  /* multiply blend makes the white background disappear over ivory */
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Text logo: white, shown over video */
.header-logo-text {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #fff;
  white-space: nowrap;
  transition: opacity 0.45s ease;
}

/* Cross-fade: scrolled state shows image, hides text */
#header.scrolled .header-logo-img {
  opacity: 1;
  pointer-events: auto;
}

#header.scrolled .header-logo-text {
  opacity: 0;
}

/* Nav */
#header-nav {
  display: flex;
  gap: 2.75rem;
}

#header-nav a {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.3s ease;
  position: relative;
}

#header-nav a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}

#header-nav a:hover::after {
  transform: scaleX(1);
}

#header.scrolled #header-nav a {
  color: rgba(14, 14, 14, 0.65);
}

/* CTA button */
.header-cta {
  display: inline-block;
  padding: 0.75rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.45s ease;
  flex-shrink: 0;
}

#header.scrolled .header-cta {
  border-color: var(--accent);
  color: var(--text);
}

.header-cta:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* ─── Hero ───────────────────────────────────────────────────────────── */

/* Wrapper height is set by JS: frameCount × PX_PER_FRAME */
#hero {
  position: relative;
}

/* Sticky viewport-sized stage */
#hero-stage {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  will-change: transform;
}

/* Canvas: object-fit cover handled in JS drawFrame() */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s var(--ease);
  will-change: transform;
}

#hero-canvas.ready {
  opacity: 1;
}

/* Vignette:
   - Linear gradient top-down: darkens behind the header so nav is always readable
   - Radial gradient: subtle edge darkening (0–8%)
   Both in one element, no extra DOM node.                                */
#hero-vignette {
  position: absolute;
  inset: 0;
  background:
    /* Top band — keeps header/nav readable on any bright frame */
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.62) 0%,
      rgba(0, 0, 0, 0.20) 24%,
      rgba(0, 0, 0, 0.00) 42%
    ),
    /* Centre shadow — wide soft oval darkens exactly where hero text sits,
       ensuring legibility on shiny/white video frames */
    radial-gradient(
      ellipse 90% 60% at 50% 52%,
      rgba(0, 0, 0, 0.48) 0%,
      rgba(0, 0, 0, 0.22) 40%,
      transparent 70%
    ),
    /* Edge vignette — barely perceptible 0–8% */
    radial-gradient(
      ellipse at 50% 50%,
      transparent 48%,
      rgba(0, 0, 0, 0.10) 100%
    );
  pointer-events: none;
  z-index: 1;
}

/* Overlay container: centers all states */
#hero-overlays {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

/* Individual text states: all stacked center, JS manages opacity/translateY */
.hero-text {
  position: absolute;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  will-change: transform, opacity;
  padding: 0 2rem;
  width: 100%;
}

/* States 0–2: single-line display serif */
.hero-text:not(.hero-text--final) {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.4rem, 5.5vw, 4.5rem);
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.1;
  /* Hairline stroke: invisible on dark frames, adds contrast on bright/white ones.
     This is not a text-shadow — it's an outline on the glyph contour itself. */
  -webkit-text-stroke: 0.4px rgba(0, 0, 0, 0.28);
  paint-order: stroke fill;
}

/* State 3: brand name + scroll cue */
.hero-text--final {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.hero-brand {
  display: block;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  color: #fff;
  letter-spacing: 0.06em;
  line-height: 1;
  -webkit-text-stroke: 0.4px rgba(0, 0, 0, 0.28);
  paint-order: stroke fill;
}

.hero-scroll-cue {
  display: block;
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.hero-scroll-cue::after {
  content: '';
  display: block;
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, rgba(184, 154, 94, 0.75), transparent);
  margin: 0.75rem auto 0;
  animation: scrollLine 2.2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%   { opacity: 1;   transform: scaleY(1) translateY(0); }
  60%  { opacity: 0.3; transform: scaleY(0.5) translateY(6px); }
  100% { opacity: 1;   transform: scaleY(1) translateY(0); }
}

/* ─── About ──────────────────────────────────────────────────────────── */
#about {
  position: relative;
  padding: 12rem 3rem;
  overflow: hidden;
  background: var(--bg);
}

.about-inner {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9rem;
  align-items: start;
}

.section-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.75rem;
}

.about-left h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 3.2vw, 3rem);
  letter-spacing: -0.01em;
  line-height: 1.18;
  margin-bottom: 2.25rem;
}

.about-body {
  font-size: 1rem;
  line-height: 1.78;
  color: rgba(14, 14, 14, 0.8);
  max-width: 46ch;
}

/* Founder pull-quote: italic serif, gold hairline left border */
.pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  line-height: 1.58;
  color: var(--text);
  border-left: 1px solid var(--accent);
  padding-left: 1.75rem;
  margin: 3.5rem 0;
}

/* ── Contact list ── */
.contact-list {
  margin-top: 1rem;
}

.contact-row {
  padding: 1.35rem 0;
  border-bottom: 1px solid rgba(184, 154, 94, 0.22);
}

.contact-row:first-child {
  border-top: 1px solid rgba(184, 154, 94, 0.22);
}

.contact-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.55rem;
}

.contact-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  line-height: 1.4;
  transition: color 0.2s ease;
}

a.contact-value:hover {
  color: var(--accent);
}

/* ── Right column: map ── */
.about-right {
  position: sticky;
  top: 7rem;
}

.map-wrapper {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 600px;
  overflow: hidden;
}

.map-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(184, 154, 94, 0.38);
  filter: grayscale(0.2) contrast(0.95);
  display: block;
}

/* 3% SVG noise texture overlay */
.noise-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  background-repeat: repeat;
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
#footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.25rem 3rem;
  border-top: 1px solid rgba(184, 154, 94, 0.22);
}

.footer-copy {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Social icon row */
.footer-socials {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  width: 20px;
  height: 20px;
  transition: color 0.25s ease, transform 0.25s ease;
}

.social-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.social-link:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

/* ─── Scroll Reveal ──────────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity  0.8s var(--ease),
    transform 0.8s var(--ease);
  will-change: transform, opacity;
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger via data-delay attribute */
[data-reveal][data-delay="1"] { transition-delay:  80ms; }
[data-reveal][data-delay="2"] { transition-delay: 160ms; }
[data-reveal][data-delay="3"] { transition-delay: 240ms; }
[data-reveal][data-delay="4"] { transition-delay: 320ms; }
[data-reveal][data-delay="5"] { transition-delay: 400ms; }
[data-reveal][data-delay="6"] { transition-delay: 480ms; }
[data-reveal][data-delay="7"] { transition-delay: 560ms; }

/* ─── Floating Social Bar ───────────────────────────────────────────── */
#social-float {
  position: fixed;
  right: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;

  /* Fade in after the page loads — delayed past the canvas reveal */
  opacity: 0;
  animation: sfReveal 0.9s var(--ease) 1.8s forwards;
}

@keyframes sfReveal {
  from { opacity: 0; transform: translateY(-50%) translateX(12px); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0);    }
}

/* White thread — visible against both dark hero and ivory about section */
#social-float::before,
#social-float::after {
  content: '';
  display: block;
  width: 1px;
  height: 3rem;
  flex-shrink: 0;
}
#social-float::before {
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.25));
  order: 0;
}
#social-float::after {
  background: linear-gradient(to top, transparent, rgba(255, 255, 255, 0.25));
  order: 6;
}

.sf-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;

  /* Dark tile — readable on both dark hero canvas and ivory about section */
  background: rgba(14, 14, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  color: #fff;
  margin: 5px 0;

  transition:
    color        0.25s ease,
    border-color 0.25s ease,
    box-shadow   0.25s ease,
    transform    0.25s ease;
}

.sf-link:hover {
  color: var(--accent);
  border-color: rgba(184, 154, 94, 0.5);
  /* Outer glow on the button */
  box-shadow: 0 0 14px rgba(184, 154, 94, 0.28),
              inset 0 0 10px rgba(184, 154, 94, 0.06);
  transform: translateX(-3px);
}

/* Gold glow on the icon itself */
.sf-link:hover svg {
  filter: drop-shadow(0 0 5px rgba(184, 154, 94, 0.75));
}

.sf-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: filter 0.25s ease;
}

/* On mobile: bottom-right corner, horizontal row */
@media (max-width: 768px) {
  #social-float {
    top: auto;
    bottom: 1.25rem;
    right: 1.25rem;
    transform: none;
    flex-direction: row;
    animation-name: sfRevealMobile;
    gap: 6px;
  }

  @keyframes sfRevealMobile {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
  }

  #social-float::before,
  #social-float::after {
    display: none;
  }

  .sf-link {
    width: 36px;
    height: 36px;
    margin: 0;
  }

  .sf-link:hover {
    transform: translateY(-3px);
  }
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .about-inner {
    gap: 5rem;
  }
}

@media (max-width: 768px) {
  #header {
    padding: 1.25rem 1.5rem;
  }

  #header.scrolled {
    padding: 1rem 1.5rem;
  }

  #header-nav {
    display: none;
  }

  .header-cta {
    padding: 0.6rem 1.4rem;
    font-size: 0.65rem;
  }

  #about {
    padding: 6rem 1.5rem;
  }

  .about-inner {
    grid-template-columns: 1fr;
    gap: 4rem;
  }

  .about-right {
    position: static;
  }

  .map-wrapper {
    aspect-ratio: 1 / 1;
    max-height: none;
  }

  #footer {
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 1.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-text:not(.hero-text--final) {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  .hero-brand {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }
}
