/**
 * Melofy Base Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Geist:wght@400;500;600;700&display=swap');

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* Interpolated with silky ease-in & ease-out by ScrollManager */
  scroll-padding-top: calc(var(--bar) + 16px);
  background-color: var(--background);
}

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  background-color: var(--background);
  color: var(--text);
  font-family: var(--f-text);
  font-size: var(--step-0);
  line-height: 1.6;
  padding-top: var(--bar);
  padding-bottom: var(--rail);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle Film Grain and Paper Texture Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
  opacity: 0.045;
  background-image: url('../assets/images/grain-texture.png');
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 20px;
  background: var(--primary);
  color: var(--background);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--f-display);
  font-weight: 700;
  text-decoration: none;
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: 14px;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visibility */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Typography Base */
h1, h2, h3, h4, .disp {
  font-family: var(--f-display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
  color: var(--text);
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p {
  text-wrap: pretty;
  max-width: 58ch;
  color: var(--ink-soft);
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
  transition: color var(--dur-fast), opacity var(--dur-fast);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  touch-action: manipulation;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Kicker Tag */
.kicker {
  font-family: var(--f-text);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary-dark);
  display: inline-block;
  margin-bottom: 0.8rem;
}

/* Custom Desktop Cursor (Magnet / Play State) */
@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor,
  body.has-custom-cursor a,
  body.has-custom-cursor button {
    cursor: none !important;
  }

  .cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--accent);
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.22s var(--ease), height 0.22s var(--ease), background 0.22s, transform 0.08s linear;
    mix-blend-mode: difference;
  }

  .cursor-follower.is-hover {
    width: 48px;
    height: 48px;
    background-color: var(--secondary);
    mix-blend-mode: normal;
    opacity: 0.88;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cursor-follower.is-hover::after {
    content: "PLAY";
    font-family: var(--f-display);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text);
  }

  .cursor-follower.is-audio-on.is-hover::after {
    content: "MUTE";
  }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cursor-follower {
    display: none !important;
  }
}

