/* css/main.css */
/* ==========================================================================
   1. Setup & Global Styles
   ========================================================================== */
:root {
  --background-color: #000000;
  --text-color: #ffcc00;
  --accent-color: #ffffff;
  --stripe-color: #ffcc00;
  --stripe-text-color: #000000;
  --toggle-bg: #cccccc;
  --toggle-ball: #fff;
  --toggle-ball-active: #10cd00;
  --font-primary: "Bebas Neue", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background-color: var(--background-color);
  overflow: hidden;
}

a,
p {
  text-decoration: none;
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
label {
  margin-bottom: 5px;
  font-weight: 700;
  display: block;
}

#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--background-color);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  will-change: transform;
}

.preloader-counter {
  font-family: "Anton", sans-serif;
  font-size: clamp(6rem, 25vw, 25rem);
  font-weight: 900;
  line-height: 1;
  color: var(--text-color);
  text-align: center;
  will-change: transform, opacity;
}

.preloader-counter::after {
  content: "%";
  font-size: 0.5em;
  vertical-align: top;
  margin-left: 0.05em;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  z-index: 1000;
  box-sizing: border-box;
  color: var(--text-color);
  pointer-events: none;
}

.header-left a {
  font-family: var(--font-primary);
  letter-spacing: 0.05em;
  color: var(--text-color);
  text-decoration: none;
  pointer-events: auto;
  clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
  font-size: 2rem;
  position: relative;
  z-index: 1001;
  mix-blend-mode: difference;
}

.menu-toggle-btn {
  pointer-events: auto;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.3s ease;
  mix-blend-mode: difference;
}
.menu-toggle-btn:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Clean Fullscreen Menu Styles
   ========================================================================== */
.fullscreen-menu {
  position: fixed;
  top: -2%;
  left: -2%;
  width: 104vw;
  height: 104vh;
  z-index: 900;
  background-color: var(--background-color);
  visibility: hidden;
  opacity: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fm-nav {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.fm-link {
  font-family: "Anton", sans-serif;
  font-size: 6rem;
  color: var(--text-color);
  text-decoration: none;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  transition:
    color 0.3s ease,
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform, color;
}

.fm-link:hover {
  color: #ffffff;
  transform: scale(1.05);
}

/* ==========================================================================
   3. Hero Intro & Stripes
   ========================================================================== */
.hero-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}
.stripes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.stripe-wrapper {
  position: absolute;
  width: 100%;
  height: 30.4vh;
  top: 41%;
  transform: translateY(-50%);
}
.stripe {
  position: relative;
  width: 120%;
  height: 100%;
  background-color: var(--stripe-color);
  left: -10%;
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
}

.stripe-text-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 0;
  align-items: center;
  white-space: nowrap;
  font-family: "Anton", sans-serif;
  font-size: 28vh;
  font-weight: 900;
  line-height: 1;
  color: var(--stripe-text-color);
  text-transform: uppercase;
  box-sizing: border-box;
}
.stripe-text-wrapper span {
  padding: 0;
}
[data-stripe-id="1"] .stripe-text-wrapper,
[data-stripe-id="2"] .stripe-text-wrapper,
[data-stripe-id="3"] .stripe-text-wrapper {
  gap: 3.5vh;
  padding: 0 2vh;
}
[data-stripe-id="4"] {
  z-index: 2;
}
[data-stripe-id="4"] .stripe-text-wrapper {
  gap: 0vh;
  padding: 0;
}
[data-stripe-id="5"] .stripe-text-wrapper {
  gap: 0vh;
  padding: 0 2vh;
}

.media-placeholder {
  width: 23vh;
  height: 22vh;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.media-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.styled-media-container {
  border-radius: 1.5rem;
  padding: 1.2vh;
  box-sizing: border-box;
  width: 22vh;
  height: 28vh;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}
.styled-media-container img {
  border-radius: 0.8rem;
  width: 120%;
  height: 120%;
}
.bg-blue {
  background-color: #02b4e8;
}
.bg-green {
  background-color: #2dff54;
}
.bg-pink {
  background-color: #ff13f0;
}

.stripe-with-repositioned-media {
  overflow: visible;
}
.stripe-with-repositioned-media .stripe-text-wrapper {
  overflow: visible;
}
.repositioned-image {
  position: absolute;
  transform: scale(1.38);
  z-index: 5;
}
.stacked-image-container {
  position: relative;
  width: 30vh;
  height: 30vh;
}
.stacked-image-container .stacked-image-top {
  position: absolute;
  top: -1%;
  left: -2.5;
}
.stacked-image-shadow {
  filter: brightness(10%);
}

.hero-running-w {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: scale(1.5);
}
.hero-running-w img,
.hero-running-w video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-running-w .layered {
  position: absolute;
  top: 3.6%;
  left: -21%;
}

/* ==========================================================================
   Gallery
   ========================================================================== */
.container {
  position: relative;
  width: 100vw;
  height: 100svh; /* Desktop remains svh */
  overflow: hidden;
}
.gallery-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  perspective: 2000px;
  will-change: transform;
}
.gallery {
  position: relative;
  width: 37.5rem;
  height: 37.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center;
  will-change: transform;
}

.card {
  position: absolute;
  width: 18.59375rem;
  height: 24.8125rem;
  transform-origin: center;
  will-change: transform;
  transform-style: preserve-3d;
  backface-visibility: visible;
  overflow: hidden;
}

.center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 6.2vw;
  font-weight: 600;
  line-height: 1.1;
  pointer-events: none;
  z-index: 0;
  will-change: opacity;
}
.gallery,
.center-text {
  opacity: 0;
  visibility: hidden;
}

/* ==========================================================================
   Preview Controls
   ========================================================================== */
.preview-controls-wrapper {
  position: fixed;
  bottom: 9%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  z-index: 10;
  pointer-events: none;
}
.subtitle-container {
  width: 100%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  pointer-events: none;
  display: grid;
  place-items: center;
}
.subtitle-container p {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  text-align: center;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: 0.15em;
  opacity: 0.7;
}
.title-container {
  width: 100%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  pointer-events: auto;
  display: grid;
  place-items: center;
}
.title-container a {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  text-align: center;
  font-size: 9rem;
  line-height: 1.1;
  cursor: pointer;
}
.word {
  position: relative;
  display: inline-block;
  will-change: transform;
}

#reset-view-btn {
  background-color: transparent;
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  position: relative;
  z-index: 10;
  font-family: var(--font-primary);
  font-size: 3rem;
  color: var(--text-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
  padding: 0.625rem 1.25rem;
  border: 0.125rem solid var(--accent-color);
}

/* ==========================================================================
   Toggle Switch
   ========================================================================== */
.toggle-container {
  position: fixed;
  z-index: 10;
}
.toggle-rotator {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.toggle-w[data-css="toggle"] {
  width: 18rem;
  height: 10rem;
  margin-bottom: 0;
  position: relative;
}
.toggle-html-input {
  opacity: 0;
}
.toggle-slider {
  cursor: pointer;
  background-color: #ffe9cf;
  border: 0.55rem solid #ffe9cf;
  border-radius: 10rem;
  padding: 0.5rem;
  display: flex;
  position: absolute;
  inset: 0%;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.25);
}
.toggle-ball {
  aspect-ratio: 1;
  pointer-events: none;
  background-color: #3875f9;
  border: 0.4rem solid #3875f9;
  border-radius: 100%;
  width: 8rem;
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    background-color 0.2s,
    border-color 0.2s;
  transform: translateX(0%);
}
.toggle-w[data-css="toggle"]:has(input:checked) .toggle-ball {
  transform: translateX(100%);
  background-color: var(--toggle-ball-active);
  border-color: var(--toggle-ball-active);
}

/* ==========================================================================
   Sprite Animation
   ========================================================================== */
#sprite-runner-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-1.2%, 1%) scaleX(-1) scale(1.3);
  width: 100%;
  height: 100%;
  background-image: url("https://res.cloudinary.com/dlx4muqzx/image/upload/v1782818515/final_sprite_sheet_z4eccn.png");
  background-size: 800% 600%;
  background-position: 0% 0%;
}

/* ==========================================================================
   Utilities & Performance
   ========================================================================== */
.blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(20px);
  z-index: 2;
  pointer-events: none;
}
.img-full {
  height: 100%;
}
.stripe,
.title-container a,
.subtitle-container p {
  will-change: transform;
  transform: translateZ(0);
}
.center-text,
.title-container a {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Fetched Page Content
   ========================================================================== */
.page-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  color: var(--text-color);
  text-align: center;
}
.page-content h1 {
  font-family: var(--font-primary);
  font-size: 9rem;
  line-height: 1.1;
}
.page-content p {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

/* ==========================================================================
   Mobile & Portrait Tablet Overrides
   JS-DRIVEN: body.layout-mobile
   ========================================================================== */
body.layout-mobile {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-nav-height: calc(5.5rem + var(--safe-bottom));
}

body.layout-mobile .hero-container,
body.layout-mobile .page-content {
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--mobile-nav-height);
}

body.layout-mobile .fullscreen-menu {
  height: 104dvh;
  top: -2dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--mobile-nav-height);
}

body.layout-mobile .container {
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--mobile-nav-height);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

body.layout-mobile .gallery-container {
  perspective: 1200px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

body.layout-mobile .gallery {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.layout-mobile .card {
  width: 70.5vw;
  height: 100vw;
  max-width: 308px;
  max-height: 418px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  margin-top: 0;
  top: auto;
  bottom: 0;
  transform: translateY(5%);
}

body.layout-mobile .center-text {
  font-size: 13vw;
  line-height: 1;
  z-index: 100;
  margin-top: 0;
  top: 25%;
}

body.layout-mobile .preview-controls-wrapper {
  position: absolute;
  bottom: calc(var(--mobile-nav-height) + 2rem);
  gap: 1.5rem;
  width: 100%;
}

body.layout-mobile .title-container,
body.layout-mobile .subtitle-container,
body.layout-mobile #reset-view-btn {
  transform: none !important;
}

body.layout-mobile .title-container a {
  font-size: 3.45rem;
}
body.layout-mobile #reset-view-btn {
  font-size: 2.4rem;
}
body.layout-mobile .subtitle-container p {
  font-size: 1.35rem;
}

body.layout-mobile .header {
  top: auto;
  bottom: -1px;
  left: 0;
  width: 100%;
  padding: 1rem 1.5rem calc(1rem + var(--safe-bottom) + 1px) 1.5rem;
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid rgba(255, 204, 0, 0.15);
  pointer-events: auto;
  height: calc(var(--mobile-nav-height) + 1px);
}

body.layout-mobile .header-left a,
body.layout-mobile .menu-toggle-btn {
  mix-blend-mode: normal;
}

@media (max-width: 768px) {
  body.layout-mobile .fm-link {
    font-size: 3.5rem;
  }

  body.layout-mobile .header-left a img {
    height: 3.2rem !important;
  }

  body.layout-mobile .menu-toggle-btn {
    font-size: 1.1rem;
  }

  body.layout-mobile .title-container a {
    font-size: 3.24rem;
  }
  body.layout-mobile .subtitle-container p {
    font-size: 1.035rem;
  }
  body.layout-mobile #reset-view-btn {
    font-size: 2.16rem;
  }

  body.layout-mobile .center-text {
    top: 17%;
  }

  body.layout-mobile .preview-controls-wrapper {
    bottom: calc(var(--mobile-nav-height) + 2rem - 3.5%);
  }
}

/* ==========================================================================
   Ultra-Small Device Overrides (e.g., iPhone SE)
   JS-DRIVEN: Protected by body.layout-mobile
   ========================================================================== */
@media (max-width: 380px) and (max-height: 740px) {
  body.layout-mobile .center-text {
    top: 21%;
  }

  body.layout-mobile .preview-controls-wrapper {
    gap: 1rem;
    bottom: calc(var(--mobile-nav-height) + 1rem);
  }

  body.layout-mobile .subtitle-container p {
    font-size: clamp(0.8rem, 2dvh, 1.15rem);
    letter-spacing: 0.1em;
  }

  body.layout-mobile .title-container a {
    font-size: clamp(2rem, 6dvh, 3.6rem);
  }

  body.layout-mobile #reset-view-btn {
    font-size: clamp(1.5rem, 4dvh, 2.4rem);
    padding: 0.4rem 1rem;
    border-width: 0.1rem;
    transform: none !important;
  }
}

/* ==========================================================================
   Portrait Tablet Overrides (iPad Mini, iPad Air)
   JS-DRIVEN: Extends layout-mobile with size constraints
   ========================================================================== */
@media (min-width: 768px) {
  body.layout-mobile .center-text {
    top: 30%;
    font-size: 11.7vw;
  }

  body.layout-mobile .preview-controls-wrapper {
    gap: 2rem;
    bottom: calc(var(--mobile-nav-height) + 3rem);
  }
}

/* ==========================================================================
   Animation Residue Fix (Mobile & Portrait Tablets)
   JS-DRIVEN: Universal Mobile Shield
   ========================================================================== */
body.layout-mobile .stripe-with-repositioned-media .stripe-text-wrapper {
  overflow: hidden;
}

body.layout-mobile .stripe-with-repositioned-media::after {
  content: "";
  position: absolute;
  top: 0;
  right: -40vw;
  width: 40vw;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}

/* ==========================================================================
   Landscape Tablet & Small Laptop (Desktop Replica)
   JS-DRIVEN: body.layout-landscape-tablet
   ========================================================================== */

html:has(body.layout-landscape-tablet) {
  font-size: 13px;
}

body.layout-landscape-tablet {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

body.layout-landscape-tablet .container {
  padding-top: calc(var(--safe-top) + 1vh);
  padding-bottom: calc(var(--safe-bottom) + 1vh);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  box-sizing: border-box;
}

body.layout-landscape-tablet .stripe-wrapper {
  height: 25vh;
}

body.layout-landscape-tablet .stripe-text-wrapper {
  font-size: 22vh;
}

body.layout-landscape-tablet [data-stripe-id="1"] .stripe-text-wrapper,
body.layout-landscape-tablet [data-stripe-id="2"] .stripe-text-wrapper,
body.layout-landscape-tablet [data-stripe-id="3"] .stripe-text-wrapper {
  gap: 2.8vh;
  padding: 0 1.6vh;
}

body.layout-landscape-tablet [data-stripe-id="5"] .stripe-text-wrapper {
  padding: 0 1.6vh;
}

body.layout-landscape-tablet .media-placeholder {
  width: 19vh;
  height: 18vh;
}

body.layout-landscape-tablet .styled-media-container {
  padding: 1vh;
  width: 18vh;
  height: 23vh;
}

body.layout-landscape-tablet .stacked-image-container {
  width: 24vh;
  height: 24vh;
}

body.layout-landscape-tablet .center-text {
  font-size: 5.5vw;
}

body.layout-landscape-tablet .preview-controls-wrapper {
  bottom: 12%;
}

body.layout-landscape-tablet .fm-nav {
  gap: 1rem;
}

body.layout-landscape-tablet
  .stripe-with-repositioned-media
  .stripe-text-wrapper {
  overflow: hidden;
}

body.layout-landscape-tablet .stripe-with-repositioned-media::after {
  content: "";
  position: absolute;
  top: 0;
  right: -40vw;
  width: 40vw;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}

/* ==========================================================================
   Firefox Desktop Quarantine - The Vanishing Bug Fix
   ========================================================================== */
@supports (-moz-appearance: none) {
  @media (min-width: 1025px) {
    .gallery-container,
    .card {
      transform-style: flat !important;
    }
  }
}
