/* inter under SIL Open Font License on https://github.com/rsms/inter/blob/master/LICENSE.txt */
/* emoji under Unicode Standard License on https://www.unicode.org/copyright.html */
/* GSAP under GSAP Standard License license on https://gsap.com/community/standard-license/ */
/* Lenis under MIT License on https://github.com/darkroomengineering/lenis/blob/main/LICENSE */
/* Three.js under MIT License on https://github.com/mrdoob/three.js/blob/dev/LICENSE */

/* ==========================================
   --- BASE RESET & GLOBAL STYLES ---
   ========================================== */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/Inter-Latin-Variable.woff2") format("woff2");
}

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

html, body {
  width: 100%;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

body {
  background-color: #F5F3EF;
  color: #1A1A1A;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 400; 
}

/* ==========================================
   --- CUSTOM CURSOR (STRUCTURE & LAYER) ---
   ========================================== */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2147483647; /* Maximum z-index value to guarantee front layer placement */
}

.cursor-crosshair {
  position: fixed;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(230, 96, 18, 0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
  pointer-events: none;
  z-index: 2147483647;
  box-sizing: border-box;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.cursor-face {
  position: fixed;
  top: 0;
  left: 0;
  font-family: monospace;
  font-size: 20px; 
  color: #e66012;
  line-height: 1;
  user-select: none;
  transform: translate(-50%, -50%); 
  white-space: nowrap;
  pointer-events: none;
  z-index: 2147483647;
}

.cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  font-family: 'Inter', sans-serif;
  font-size: 8px;
  font-weight: 700;
  color: #e66012;
  margin-left: 25px;
  margin-top: 15px;
  opacity: 0.9;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2147483647;
}

/* ==========================================
   --- DESKTOP ONLY: CUSTOM CURSOR BEHAVIOR ---
   ========================================== */
@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
  /* Hide default OS cursor across the entire page on desktop */
  html, 
  body, 
  a, 
  button, 
  input, 
  textarea, 
  select, 
  summary, 
  canvas, 
  .ui-card, 
  .tilt-card,
  [role="button"] {
    cursor: none !important;
  }

  /* Keep custom elements visible */
  .custom-cursor,
  .cursor-crosshair,
  .cursor-face,
  .cursor-label {
    display: block;
  }
}

/* ==========================================
   --- MOBILE & TOUCH: DISABLE CUSTOM CURSOR ---
   ========================================== */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
  /* Completely hide custom cursor HTML elements on mobile devices */
  .custom-cursor,
  .cursor-crosshair, 
  .cursor-face, 
  .cursor-label {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* Restore standard touch and system pointer behaviors */
  html, 
  body, 
  input, 
  textarea, 
  select, 
  canvas, 
  .ui-card, 
  .tilt-card {
    cursor: auto !important;
  }

  /* Restore pointer hand for clickables */
  a, 
  button, 
  summary, 
  [role="button"],
  .ui-btn,
  .ui-toggle-btn {
    cursor: pointer !important;
  }
}

/* ==========================================
   --- LENIS SMOOTH SCROLL SUPPORT ---
   ========================================== */
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;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

/* ==========================================
   --- SECTION 1: HERO PORTAL ---
   ========================================== */
.hero-container {
  position: relative;
  width: 100vw;
  max-width: 100%;
  height: 100vh;
}

#webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.final-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  z-index: 3;
  width: 90%;
  max-width: 600px;
  pointer-events: none;
}

.final-text h1 {
  font-size: 3.5rem;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
}

.final-text p {
  font-size: 1.1rem;
  color: #666;
}

/* ==========================================
   --- SECTION 2: LIQUID DISTORTION ---
   ========================================== */
.liquid-section {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 2rem;
  background-color: #F5F3EF;
}

.section-tag {
  font-size: 0.9rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #E7573C;
  margin-bottom: 1.5rem;
}

.liquid-canvas-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  height: 450px;
}

#liquid-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.section-description {
  font-size: 1.2rem;
  color: #666;
  max-width: 600px;
  text-align: center;
  line-height: 1.6;
  margin-top: 1.5rem;
}

/* ==========================================
   --- SECTION 2.5: APPLE SHOWCASE ---
   ========================================== */
.apple-section {
  position: relative;
  z-index: 5;
  width: 100vw;
  max-width: 100%;
  height: 100vh;
  background-color: #EBE7DF;
  color: #1A1A1A;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  clip-path: polygon(0 4vw, 100% 0, 100% calc(100% - 4vw), 0 100%);
  margin: -2vw 0;
}

.apple-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 900px;
  padding: 0 2rem;
}

.apple-text {
  font-size: 3.8rem;
  line-height: 1.15;
  letter-spacing: -1.5px;
  color: #C2BBB0;
  transition: color 0.1s ease;
  margin-bottom: 2.5rem;
}

.apple-text span {
  display: inline-block;
  will-change: color;
}

.apple-pill {
  width: 130px;
  height: 44px;
  background: #1A1A1A;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #F5F3EF;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  will-change: transform, width, background-color;
}

/* ==========================================
   --- SECTION 3: INTERACTIVE UI SHOWCASE ---
   ========================================== */
.ui-showcase-section {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6rem 1.5rem 4rem 1.5rem;
  background-color: #F5F3EF;
}

.ui-app-container {
  width: 100%;
  max-width: 900px;
  background: #EBE7DF;
  border: 1px solid #D8D2C4;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}

.ui-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #D8D2C4;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.control-label {
  font-size: 0.85rem;
  color: #666;
  margin-right: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.ui-btn {
  background: #F5F3EF;
  border: 1px solid #D8D2C4;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #1A1A1A;
  transition: all 0.2s ease;
  min-width: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.ui-btn:hover {
  border-color: #1A1A1A;
}

.ui-btn.active {
  background: #1A1A1A;
  color: #F5F3EF;
  border-color: #1A1A1A;
}

.ui-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.ui-card {
  background: #F5F3EF;
  border: 1px solid #D8D2C4;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  word-break: break-word;
}

.ui-card:hover {
  border-color: #E7573C;
  transform: translateY(-2px);
}

.ui-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.ui-card-badge {
  background: #E7573C;
  color: #FFF;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.ui-card-title {
  font-size: 1.1rem;
  color: #1A1A1A;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.ui-card-desc {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

.ui-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 0.85rem;
  color: #444;
  background: #EBE7DF;
  border-radius: 6px;
  padding: 0 0.75rem;
  line-height: 1.5;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.ui-card.expanded .ui-details {
  max-height: 800px;
  opacity: 1;
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.ui-toggle-btn {
  margin-top: auto;
  align-self: flex-start;
  background: none;
  border: none;
  color: #E7573C;
  font-size: 0.8rem;
  padding: 0;
}

.ui-grid.list-view {
  grid-template-columns: 1fr;
}

.ui-grid.list-view .ui-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.ui-grid.list-view .ui-card-header {
  gap: 1rem;
}

.ui-grid.list-view .ui-toggle-btn {
  margin-top: 0;
  align-self: center;
}

/* ==========================================
   --- SECTION 4: PROCESS & METRICS ---
   ========================================== */
.process-section {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5rem 2rem;
  background-color: #F5F3EF;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
  margin-bottom: 3.5rem;
}

.metric-box {
  background: #EBE7DF;
  border: 1px solid #D8D2C4;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.metric-number {
  font-size: 2.8rem;
  color: #E7573C;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.metric-label {
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.process-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
  perspective: 1000px;
}

.tilt-card {
  background: #EBE7DF;
  border: 1px solid #D8D2C4;
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform-style: preserve-3d;
  will-change: transform;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.tilt-card:hover {
  border-color: #E7573C;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.tilt-card-num {
  font-size: 0.8rem;
  color: #E7573C;
  letter-spacing: 2px;
  transform: translateZ(20px);
}

.tilt-card-title {
  font-size: 1.3rem;
  color: #1A1A1A;
  transform: translateZ(30px);
}

.tilt-card-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  transform: translateZ(15px);
}

/* ==========================================
   --- SECTION 5: SHADER DISPLAY & FOOTER ---
   ========================================== */
.footer-section {
  position: relative;
  z-index: 1; /* Context isolated so custom cursor stays above */
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6rem 2rem 3rem 2rem;
  background-color: #EBE7DF;
  overflow: hidden;
  clip-path: polygon(0 4vw, 100% 0, 100% 100%, 0 100%);
  margin-top: -2vw;
}

#shader-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.footer-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(245, 243, 239, 0.85);
  backdrop-filter: blur(12px);
  padding: 3rem 2rem;
  border-radius: 20px;
  border: 1px solid rgba(216, 210, 196, 0.8);
}

.footer-title {
  font-size: 2.5rem;
  letter-spacing: -1px;
  margin-bottom: 1rem;
  color: #1A1A1A;
  transition: transform 0.2s ease-out;
}

.shader-description {
  font-size: 1rem;
  color: #555;
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: 3rem;
}

.footer-bottom {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid #D8D2C4;
  font-size: 0.85rem;
  color: #666;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: #1A1A1A;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #E7573C;
}

/* ==========================================
   --- COOKIES (LIGHT MINIMAL DESIGN) ---
   ========================================== */
#cookie-banner {
  position: fixed !important;
  bottom: 24px;
  right: 24px;
  z-index: 999999 !important;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Lightened background and dark text so dark cursor is clearly visible */
.cookie-full-content {
  background: rgba(245, 243, 239, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #D8D2C4;
  padding: 1.25rem;
  border-radius: 16px;
  max-width: 320px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
  color: #1A1A1A;
}

.cookie-banner-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #555555;
  margin-bottom: 1rem;
}

.cookie-banner-text a.goto-link {
  color: #1A1A1A;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.cookie-banner-text a.goto-link:hover {
  color: #E7573C;
}

.cookie-buttons-container {
  display: flex;
  gap: 0.5rem;
}

.cookie-option-btn {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  outline: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-option-btn.accept-btn {
  background-color: #E7573C;
  color: #FFFFFF;
}

.cookie-option-btn.accept-btn:hover {
  background-color: #d44a30;
  transform: translateY(-1px);
}

.cookie-option-btn.decline-btn {
  background-color: #EBE7DF;
  color: #1A1A1A;
  border: 1px solid #D8D2C4;
}

.cookie-option-btn.decline-btn:hover {
  background-color: #E0DACF;
  border-color: #C2BBB0;
}

.cookie-icon-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 243, 239, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #D8D2C4;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.cookie-icon-btn:hover {
  transform: scale(1.08);
  border-color: #E7573C;
}

#cookie-banner.hidden {
  display: none !important;
}

#cookie-banner.collapsed .cookie-full-content {
  display: none !important;
}

/* ==========================================
   --- MEDIA QUERIES (RESPONSIVE) ---
   ========================================== */
@media (max-width: 768px) {
  #cookie-banner {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .apple-text {
    font-size: 2.2rem;
  }

  .ui-app-container {
    padding: 1.25rem;
  }

  .ui-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    justify-content: flex-start;
  }

  .ui-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .ui-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ui-card {
    padding: 1.25rem;
  }

  .ui-card-title {
    font-size: 1rem;
  }

  .ui-card-desc {
    font-size: 0.8rem;
  }

  .ui-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .ui-grid.list-view .ui-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  .ui-grid.list-view .ui-card-header {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .ui-grid.list-view .ui-toggle-btn {
    margin-top: 0.5rem;
    align-self: flex-start;
  }

  .metrics-grid,
  .process-cards-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .footer-title {
    font-size: 1.8rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}