/* ============================================================
   whybit. — custom styles
   Everything Tailwind can't do elegantly lives here.
   ============================================================ */

/* Light mode (default) */
:root {
  --bg:        #FAFAFA;
  --bg-soft:   #F1F1F1;
  --bg-card:   #FFFFFF;
  --ink:       #141414;
  --ink-dim:   #5A5A5A;
  --ink-low:   #A0A0A0;
  --line:      #E2E2E2;
  --accent:    #FF5B1F;
  --accent-deep: #E04810;
  --signature: #2B5BFF;

  --dot:         #C8C8C8;
  --scrollbar:   #CFCFCF;
  --glass:       rgba(250, 250, 250, 0.72);
  --card-plate:  #F4F4F4;
  --glow-blend:  multiply;

  --mx: 50%;   /* cursor x */
  --my: 50%;   /* cursor y */
  --scroll-blur: 0px;
}

/* Dark mode */
:root[data-theme="dark"] {
  --bg:        #0A0A0A;
  --bg-soft:   #141414;
  --bg-card:   #1A1A1A;
  --ink:       #EDEDED;
  --ink-dim:   #8A8A8A;
  --ink-low:   #4A4A4A;
  --line:      #222222;

  --dot:         #2a2a2a;
  --scrollbar:   #2a2a2a;
  --glass:       rgba(10, 10, 10, 0.72);
  --card-plate:  #0f0f0f;
  --glow-blend:  screen;
}

/* Smooth the crossfade between themes, but not on every property. */
html { transition: background-color 0.3s ease; }
body, header, nav, footer, .product-card, .bottom-nav {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  /* iOS safe-area awareness */
  padding-top: env(safe-area-inset-top);
}

/* Selection */
::selection { background: var(--accent); color: var(--bg); }

/* Scrollbar — thin, quiet */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   FILM GRAIN — SVG noise, fixed, animated slow jitter
   ============================================================ */
.grain {
  /* Dark grain for light theme */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  animation: grainShift 8s steps(8) infinite;
}
:root[data-theme="dark"] .grain {
  /* Light grain for dark theme */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
@keyframes grainShift {
  0%   { transform: translate(0,0); }
  10%  { transform: translate(-5%,-10%); }
  20%  { transform: translate(-15%,5%); }
  30%  { transform: translate(7%,-25%); }
  40%  { transform: translate(-5%,25%); }
  50%  { transform: translate(-15%,10%); }
  60%  { transform: translate(15%,0%); }
  70%  { transform: translate(0%,15%); }
  80%  { transform: translate(3%,35%); }
  90%  { transform: translate(-10%,10%); }
  100% { transform: translate(0,0); }
}

/* ============================================================
   DOT GRID BACKGROUND — radial mask follows cursor
   Nothing-OS homage. Quiet until you look for it.
   ============================================================ */
.dot-grid {
  background-image: radial-gradient(circle at center, var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: 0 0;
  mask-image: radial-gradient(circle 420px at var(--mx) var(--my),
               rgba(0,0,0,0.85) 0%,
               rgba(0,0,0,0.35) 45%,
               rgba(0,0,0,0.08) 100%);
  -webkit-mask-image: radial-gradient(circle 420px at var(--mx) var(--my),
               rgba(0,0,0,0.85) 0%,
               rgba(0,0,0,0.35) 45%,
               rgba(0,0,0,0.08) 100%);
  transition: background-size 0.4s ease;
}
@media (max-width: 768px) {
  .dot-grid {
    mask-image: radial-gradient(circle at 50% 30%, rgba(0,0,0,0.4), transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 50% 30%, rgba(0,0,0,0.4), transparent 70%);
  }
}

/* ============================================================
   CURSOR GLOW — soft orange bloom that follows cursor
   Tiny blue trail dot = signature easter egg
   ============================================================ */
.cursor-glow {
  width: 340px; height: 340px;
  border-radius: 50%;
  left: var(--mx); top: var(--my);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,91,31,0.22) 0%, rgba(255,91,31,0.08) 35%, transparent 70%);
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
  mix-blend-mode: var(--glow-blend);
}
.cursor-trail {
  width: 8px; height: 8px;
  border-radius: 50%;
  left: var(--mx); top: var(--my);
  transform: translate(-50%, -50%);
  background: var(--signature);
  box-shadow: 0 0 12px rgba(43,91,255,0.8);
  transition: transform 0.12s ease-out, opacity 0.3s ease;
  opacity: 0.9;
}
.cursor-glow.hovering { width: 480px; height: 480px; }

/* Hide default cursor nowhere — we keep native cursor, glow is additive */

/* ============================================================
   MARQUEE — horizontal infinite scroll for manifesto strip
   ============================================================ */
.marquee-mask {
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

/* ============================================================
   MAGNETIC BUTTON — controlled via inline --tx/--ty vars from JS
   ============================================================ */
.magnetic {
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  transform: translate(var(--tx, 0), var(--ty, 0));
}

/* ============================================================
   HERO HEADLINE — serif display, huge, tracked in
   ============================================================ */
.hero-title {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.04em;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
}

/* Word reveal on scroll */
.reveal-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-word.in { opacity: 1; transform: translateY(0); }

/* ============================================================
   LOGO DOT — idle pulse
   ============================================================ */
.logo-dot {
  display: inline-block;
  width: 0.28em; height: 0.28em;
  border-radius: 50%;
  background: var(--signature);
  margin-left: 0.04em;
  vertical-align: baseline;
  transform-origin: center;
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1);   opacity: 1;   box-shadow: 0 0 0px rgba(43,91,255,0); }
  50%      { transform: scale(1.25); opacity: 0.85; box-shadow: 0 0 12px rgba(43,91,255,0.5); }
}

/* ============================================================
   PRODUCT CARD — monochrome with orange reveal on hover
   ============================================================ */
.product-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.3s ease;
}
.product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%),
              rgba(255,91,31,0.18) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.product-card:hover { border-color: var(--accent) !important; transform: translateY(-4px); }
.product-card:hover::before { opacity: 1; }
.product-card:hover .product-img { filter: grayscale(0); transform: scale(1.04); }
.product-img {
  filter: grayscale(1) contrast(1.1);
  transition: filter 0.6s ease, transform 0.6s ease;
}

/* ============================================================
   BOTTOM NAV (mobile) — floating glass pill
   ============================================================ */
.bottom-nav {
  padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--line);
}
.nav-item {
  position: relative;
  transition: color 0.2s ease;
}
.nav-item.active { color: var(--accent); }
.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* ============================================================
   UTILITY — fading underline link
   ============================================================ */
.ul-link {
  position: relative;
  white-space: nowrap;
}
.ul-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.ul-link:hover::after { transform: scaleX(1); transform-origin: left center; }

/* ============================================================
   PAGE TRANSITION
   ============================================================ */
.page-enter-active { transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.page-leave-active { transition: opacity 0.25s ease; }
.page-enter-from   { opacity: 0; transform: translateY(16px); }
.page-leave-to     { opacity: 0; }

/* ============================================================
   SCROLL VELOCITY BLUR — applied via JS
   ============================================================ */
.scroll-blur-target { filter: blur(var(--scroll-blur)); transition: filter 0.2s ease; }

/* ============================================================
   REDUCED MOTION — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .grain { animation: none; }
  .logo-dot { animation: none; }
}

/* ============================================================
   MOBILE — disable cursor-reactive things cleanly
   ============================================================ */
@media (hover: none) {
  .cursor-glow, .cursor-trail { display: none !important; }
}