/* ==========================================================================
   Bailie the Barber – Main Stylesheet (Fixed Deck Layout)
   ========================================================================== */

/* Root tokens
   -------------------------------------------------------------------------- */

:root {
  /* Colors */
  --bb-bg: #0e0e0e;
  --bb-ink: #faf9f6;
  --bb-accent: #c06632;

  --bb-ink-muted: rgba(250, 249, 246, 0.72);
  --bb-border-subtle: rgba(250, 249, 246, 0.14);
  --bb-surface-soft: rgba(18, 18, 18, 0.92);

  /* Layout */
  --bb-max-width: 72rem;
  --bb-gutter: 1.5rem;
  --bb-radius-sm: 0.375rem;
  --bb-radius-md: 0.75rem;
  --bb-radius-lg: 1.25rem;

  /* Typography */
  --bb-font-heading: "Anton", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --bb-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  --bb-font-size-base: 16px;
  --bb-line-height-base: 1.6;

  /* Elevation */
  --bb-shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.65);
  --bb-shadow-subtle: 0 10px 30px rgba(0, 0, 0, 0.45);

  /* Motion */
  --bb-transition-fast: 150ms ease-out;
  --bb-transition-med: 220ms ease-out;
  --bb-transition-slow: 400ms ease-out;
}

/* Global reset
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bb-bg);
}

html.custom-cursor-enabled {
  cursor: none; /* Hide default cursor for custom one when custom cursor is active */
}

body {
  margin: 0;
  font-family: var(--bb-font-body);
  font-size: var(--bb-font-size-base);
  line-height: var(--bb-line-height-base);
  color: var(--bb-ink);
  /* Background gradient: top-down, desaturated indigo to matte gray/black */
  background: linear-gradient(to bottom, #15151a, #0e0e0e 15%);
  background-color: var(--bb-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, video { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

html.custom-cursor-enabled button {
  cursor: none; /* Cursor handled by custom element */
}
input, textarea { font: inherit; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--bb-accent);
  box-shadow: 0 0 12px var(--bb-accent);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
  transition: text-shadow 0.3s ease, color 0.3s ease;
}

a:hover {
  text-shadow: 0 0 8px rgba(250, 249, 246, 0.4);
}

/* Background canvas (Fixed, behind everything)
   -------------------------------------------------------------------------- */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Behind content */
  pointer-events: none;
}

/* Visual Overlays (Noise & Vignette) */
.noise-overlay {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: noise-shift 0.2s steps(3) infinite;
}

@keyframes noise-shift {
  0% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  20% { transform: translate(-10%, 5%); }
  30% { transform: translate(5%, -10%); }
  40% { transform: translate(-5%, 15%); }
  50% { transform: translate(-10%, 5%); }
  60% { transform: translate(15%, 0); }
  70% { transform: translate(0, 10%); }
  80% { transform: translate(-15%, 0); }
  90% { transform: translate(10%, 5%); }
  100% { transform: translate(5%, 0); }
}

.vignette-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  /* Dynamic spotlight tracking via JS variables */
  background: radial-gradient(
    circle 800px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    transparent 0%,
    rgba(0,0,0,0.2) 40%,
    rgba(0,0,0,0.75) 100%
  );
  transition: opacity 0.5s ease;
}

/* Custom Cursor 2.0 (Trailer System) */
.custom-cursor-dot,
.custom-cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: exclusion;
  transform: translate(-50%, -50%);
}

.custom-cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--bb-ink);
  box-shadow: 0 0 4px rgba(255,255,255,0.8);
}

.custom-cursor-ring {
  width: 32px;
  height: 32px;
  border: 1px solid var(--bb-ink);
  opacity: 0.6;
  transition: width 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              height 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              background 0.3s ease,
              border-width 0.3s ease;
}

/* Hover States for Cursor */
.custom-cursor--hover .custom-cursor-ring {
  width: 54px;
  height: 54px;
  background: rgba(250, 249, 246, 0.1);
  border-color: transparent;
  backdrop-filter: blur(2px);
}
/* Hair canvas will be injected here with z-index -2 or similar */

/* Site Main (Fixed Container)
   -------------------------------------------------------------------------- */
.site-main {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Let scroll pass through to body */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* Align content to bottom (neck area) */
  padding-bottom: 5vh;
}

/* Sections (The "Cards")
   -------------------------------------------------------------------------- */
.section {
  position: absolute;
  /* "Neck Box" constraints */
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 28rem; /* Compact width to fit in neck */
  max-height: 55vh; /* Don't go too high into the face */

  /* Scrolling content within the card if needed */
  overflow-y: auto;
  scrollbar-width: none; /* Hide scrollbar for aesthetics */

  opacity: 0;
  pointer-events: none;
  /* Important: transform transition removed here so it doesn't fight velocity skew */
  transition: opacity 0.4s ease-out;
  transform-origin: center bottom;

  /* Visual styling of the text box (transparent/integrated) */
  text-align: center;
}
/* Hair canvas will be injected here with z-index -2 or similar */

/* Hide scrollbar in webkit */
.section::-webkit-scrollbar { display: none; }

.section--active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Kinetic Type: Reveal Animation */
.kinetic-reveal {
  animation: reveal-text 0.8s cubic-bezier(0.2, 1, 0.3, 1) forwards;
  opacity: 0; /* start hidden */
}

@keyframes reveal-text {
  0% { opacity: 0; transform: translateY(25px) rotateX(10deg); filter: blur(10px); }
  100% { opacity: 1; transform: translateY(0) rotateX(0deg); filter: blur(0); }
}

/* Section styling adjustments for small box */
.section__title {
  font-family: var(--bb-font-heading);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.section__inner {
  padding: 0; /* remove container padding */
}

/* Intro Overlay
   -------------------------------------------------------------------------- */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: #000; /* Pure black start */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1.5s ease-in-out;
}

#intro-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro__content {
  text-align: center;
  max-width: 20rem;
  opacity: 0;
  animation: intro-fade-in 1s ease-out forwards 0.5s;
}

@keyframes intro-fade-in {
  to { opacity: 1; }
}

.intro__tagline {
  font-family: var(--bb-font-heading);
  font-size: 1.5rem;
  color: var(--bb-ink);
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
}

.intro__opt-out {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--bb-ink-muted);
  cursor: pointer;
}

/* UI Chrome (Header/Nav) - Fixed on top
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 50;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  pointer-events: auto;
}

.brand__logo { height: 32px; }
.site-nav { display: block; }
.site-nav__list { display: flex; gap: 1rem; }
.site-nav__link { font-size: 0.8rem; text-transform: uppercase; color: var(--bb-ink-muted); }

/* Hide mobile toggle for now, assume desktop-first or simplified nav */
.site-nav__toggle { display: none; }
@media(max-width: 768px) {
  .site-header { justify-content: center; }
  .site-nav { display: none; } /* Hide nav on mobile for purity? Or bottom bar? Keep simple. */
  .brand { margin: 0; }
}

/* Specific Section Tweaks for the "Neck Box" */

/* Hero */
.hero__title { font-size: 3.5rem; line-height: 1; margin-bottom: 0.2rem; }
.hero__tagline { font-size: 0.9rem; margin-bottom: 1.5rem; }
.hero__summary { display: none; } /* Too much text for the clean intro */
.hero__actions { justify-content: center; }

/* About */
.about__layout { display: block; }
.about__media { display: none; } /* No photo, just text */
.about__text p { font-size: 0.95rem; margin-bottom: 0.8rem; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }

/* Services */
.services__grid { display: flex; flex-direction: column; gap: 0.5rem; text-align: left; }
.service-card { background: rgba(18, 18, 18, 0.8); border: 1px solid rgba(255,255,255,0.1); padding: 0.75rem; }
.service-card__title { font-size: 0.9rem; margin-bottom: 0; }
.service-card__meta { font-size: 0.8rem; margin-bottom: 0; }
.service-card__description { display: none; } /* Collapsed view */

/* Gallery (Abstract Barber Art) */
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 2rem;
}

.gallery__item {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  background: #111;
  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.3s ease;
  cursor: crosshair;
}

.gallery__item:hover {
  transform: scale(0.95);
  border-color: var(--bb-accent);
}

.gallery__label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--bb-ink);
  background: rgba(0,0,0,0.6);
  padding: 0.1rem 0.3rem;
  pointer-events: none;
  z-index: 2;
}

/* Generative Art Pattern 1: The Fade (Gradient Steps) */
.gallery__item--fade::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,0.05) 10px,
    rgba(255,255,255,0.05) 20px
  );
  transition: transform 0.5s ease;
}
.gallery__item--fade:hover::before { transform: rotate(15deg) scale(1.2); }

/* Generative Art Pattern 2: The Scissor (Intersecting Lines) */
.gallery__item--scissor::before,
.gallery__item--scissor::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 150%; height: 2px;
  background: rgba(255,255,255,0.1);
  transition: transform 0.4s ease;
}
.gallery__item--scissor::before { transform: translate(-50%, -50%) rotate(45deg); }
.gallery__item--scissor::after { transform: translate(-50%, -50%) rotate(-45deg); }
.gallery__item--scissor:hover::before { transform: translate(-50%, -50%) rotate(0deg); }
.gallery__item--scissor:hover::after { transform: translate(-50%, -50%) rotate(90deg); }

/* Generative Art Pattern 3: The Comb (Vertical Rhythm) */
.gallery__item--comb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.08) 4px,
    rgba(255,255,255,0.08) 6px
  );
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.gallery__item--comb:hover::before { transform: scaleX(2); }

/* Generative Art Pattern 4: The Clipper (Vibrating Grid) */
.gallery__item--clipper {
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: center;
  transition: background-size 0.3s ease;
}
.gallery__item--clipper:hover { background-size: 10px 10px; }

/* Generative Art Pattern 5: The Part (Hard Line) */
.gallery__item--part::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 30%;
  width: 1px;
  background: var(--bb-accent);
  box-shadow: 0 0 10px var(--bb-accent);
  transition: left 0.5s ease;
}
.gallery__item--part:hover::before { left: 70%; }

/* Generative Art Pattern 6: The Texture (Noise Field) */
.gallery__item--texture::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.5;
  transition: opacity 0.3s, background-size 0.3s;
}
.gallery__item--texture:hover::before { opacity: 1; background-size: 12px 12px; }

/* Footer */
.site-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 40;
  padding: 0.5rem 1rem;
  background: transparent;
  pointer-events: auto;
  text-align: center;
  font-size: 0.7rem;
}
.site-footer__inner { justify-content: center; gap: 1rem; padding: 0; }
/* Overlay Navigation (Cinematic)
   -------------------------------------------------------------------------- */

/* Toggle Button (Visible on all screens) */
.site-nav__toggle {
  display: flex; /* Override display:none */
  align-items: center;
  gap: 0.75rem;
  z-index: 100; /* Above overlay */
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.site-nav__toggle:hover {
  opacity: 0.8;
}

.site-nav__toggle-text {
  font-family: var(--bb-font-heading);
  text-transform: uppercase;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--bb-ink);
}

.site-nav__toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 24px;
}

.site-nav__toggle-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--bb-ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animate toggle to X when open */
.nav-open .site-nav__toggle-line:nth-child(1) {
  transform: translateY(3.5px) rotate(45deg);
}

.nav-open .site-nav__toggle-line:nth-child(2) {
  transform: translateY(-3.5px) rotate(-45deg);
}

/* Navigation Overlay */
.site-nav {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 90; /* Below toggle (100) but above everything else */
  background: rgba(14, 14, 14, 0.96); /* High opacity for cinematic feel */
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.nav-open .site-nav {
  opacity: 1;
  pointer-events: auto;
}

/* Navigation List */
.site-nav__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.site-nav__link {
  font-family: var(--bb-font-heading);
  font-size: 3.5rem; /* Large cinematic type */
  text-transform: uppercase;
  color: var(--bb-ink);
  text-decoration: none;
  opacity: 0;
  transform: translateY(30px);
  transition: color 0.3s ease;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.site-nav__link:hover {
  color: var(--bb-accent);
}

/* Staggered Reveal Animation */
.nav-open .site-nav__link {
  animation: nav-reveal 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.nav-open .site-nav__link:nth-child(1) { animation-delay: 0.1s; }
.nav-open .site-nav__link:nth-child(2) { animation-delay: 0.15s; }
.nav-open .site-nav__link:nth-child(3) { animation-delay: 0.2s; }
.nav-open .site-nav__link:nth-child(4) { animation-delay: 0.25s; }
.nav-open .site-nav__link:nth-child(5) { animation-delay: 0.3s; }
.nav-open .site-nav__link:nth-child(6) { animation-delay: 0.35s; }

@keyframes nav-reveal {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Media Query Overrides (Ensure previous mobile styles don't conflict) */
@media(max-width: 768px) {
  .site-nav { display: flex; /* Force flex instead of none */ }
  .site-nav__toggle { display: flex; }

  .site-nav__link {
    font-size: 2.5rem; /* Slightly smaller on mobile */
  }
}

/* Header Layout Fix */
.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
