/* ===========================
   ILY TUBEMAN — Global Styles
   =========================== */

:root {
  --red: #E63946;
  --red-dark: #C1121F;
  --white: #FFFFFF;
  --black: #1A1A1A;
  --gray: #2B2D42;
  --gray-light: #F7F7F8;
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Inter', sans-serif;
  --hero-canvas-top: 130px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--gray);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===========================
   HERO / 3D Section
   =========================== */

#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  background: linear-gradient(180deg, var(--gray-light) 0%, var(--white) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

#hero-text {
  text-align: center;
  padding-top: clamp(24px, 6vh, 64px);
  z-index: 10;
  pointer-events: none;
}

#hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
}

#hero-text .accent {
  color: var(--red);
}

#hero-text .subtitle {
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--gray);
  margin-top: 8px;
  font-weight: 400;
}

/* Canvas */
#tubeman-canvas-wrap {
  position: absolute;
  top: var(--hero-canvas-top);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
}

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

/* ===========================
   CONTROLS
   =========================== */

#controls {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 16px 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Temporarily hide wind control from UI while keeping logic in place. */
#wind-group {
  display: none;
}

.switch-label,
.slider-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gray);
  user-select: none;
}

/* Power button */
.power-btn {
  position: relative;
  width: 101px;
  height: 50px;
  border-radius: 25px;
  border: 2px solid #ddd;
  background: #eee;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  display: flex;
  align-items: center;
  padding: 0;
}

.power-btn .power-knob {
  position: absolute;
  left: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.power-btn .power-state {
  position: absolute;
  right: 13px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #999;
  transition: opacity 0.2s;
}

.power-btn.on {
  background: var(--red);
  border-color: var(--red-dark);
}

.power-btn.on .power-knob {
  transform: translateX(53px);
}

.power-btn.on .power-state {
  right: auto;
  left: 13px;
  color: var(--white);
}

/* Wind slider */
#wind-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  cursor: pointer;
  transition: opacity 0.3s;
}

#wind-slider:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#wind-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

#wind-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

#wind-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray);
  min-width: 36px;
  text-align: right;
}

/* ===========================
   DEBUG PANEL (dev only)
   =========================== */

#debug-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  width: min(350px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  z-index: 9999;
  background: rgba(26, 26, 26, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #f2f2f2;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

#debug-panel h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.debug-group {
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.debug-group summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  font-weight: 700;
}

.debug-group summary::-webkit-details-marker {
  display: none;
}

.debug-group summary::before {
  content: '▸ ';
  opacity: 0.9;
}

.debug-group[open] summary::before {
  content: '▾ ';
}

.debug-group-body {
  padding: 0 10px 8px;
}

.debug-row {
  display: grid;
  grid-template-columns: 86px 1fr 54px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.debug-row input[type='range'] {
  width: 100%;
}

.debug-row output {
  text-align: right;
  opacity: 0.9;
}

.debug-row-toggle {
  grid-template-columns: 86px 1fr;
}

.debug-row-toggle input[type='checkbox'] {
  justify-self: start;
}

.debug-actions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.debug-actions button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--red);
  color: var(--white);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.debug-readout {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  white-space: pre-wrap;
}

/* ===========================
   RENTAL SECTION
   =========================== */

#rental {
  padding: 80px 0;
  text-align: center;
  background: var(--white);
}

#rental h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 12px;
}

.rental-pitch {
  font-size: 1.1rem;
  color: var(--gray);
  margin-bottom: 40px;
}

.rental-details {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.price-card {
  background: var(--gray-light);
  border-radius: 16px;
  padding: 24px 32px;
  min-width: 180px;
}

.price-card .price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--red);
}

.price-card .per {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gray);
}

.price-card p {
  font-size: 0.9rem;
  color: var(--gray);
  margin-top: 8px;
}

.btn-primary {
  display: inline-block;
  padding: 16px 40px;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(230, 57, 70, 0.3);
}

.btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 57, 70, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-block;
  padding: 13px 30px;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.2s;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

/* ===========================
   STORY SECTION
   =========================== */

#story {
  padding: 80px 0;
  background: var(--gray-light);
}

#story h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 20px;
  text-align: center;
}

#story p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--gray);
  margin-bottom: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#story-photo {
  margin-top: 32px;
  margin-left: auto;
  margin-right: auto;
  max-width: 560px;
  padding: 8px;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

#story-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  display: block;
  border-radius: 12px;
}

.story-gallery-cta {
  margin-top: 20px;
  text-align: center;
}

/* ===========================
   GALLERY PAGE
   =========================== */

.gallery-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(230, 57, 70, 0.06), transparent 40%),
    radial-gradient(circle at 85% 16%, rgba(43, 45, 66, 0.05), transparent 35%),
    var(--gray-light);
}

.gallery-header {
  padding: 56px 0 18px;
  text-align: center;
}

.gallery-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--black);
}

.gallery-subtitle {
  margin-top: 8px;
  color: var(--gray);
  font-size: 1rem;
}

.gallery-actions {
  margin-top: 18px;
}

.gallery-wrap {
  padding: 20px 0 70px;
}

.gallery-book-cta {
  padding: 0 0 56px;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  align-items: start;
}

.gallery-card {
  margin: 0;
  background: var(--white);
  padding: 8px;
  align-self: start;
  height: fit-content;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.11);
  border: 1px solid rgba(0, 0, 0, 0.07);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
}

.gallery-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

.gallery-empty {
  text-align: center;
  color: #60637b;
  padding: 30px 0;
}

/* ===========================
   FOOTER
   =========================== */

footer {
  padding: 40px 0;
  background: var(--black);
  color: var(--white);
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.insta-link {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  transition: opacity 0.2s;
}

.insta-link:hover {
  opacity: 0.8;
}

.footer-tagline {
  font-size: 0.85rem;
  color: #888;
}

.footer-credit {
  font-size: 0.85rem;
  color: #888;
}

.footer-credit a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-credit a:hover {
  color: var(--red);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 600px) {
  :root {
    --hero-canvas-top: 120px;
  }

  #hero {
    height: 100svh;
    min-height: 0;
  }

  #controls {
    flex-direction: column;
    gap: 16px;
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 14px 20px;
    border-radius: 16px;
  }

  #wind-slider {
    width: 100px;
  }

  .power-btn {
    width: 171px;
    height: 85px;
    border-radius: 43px;
  }

  .power-btn .power-knob {
    left: 7px;
    width: 68px;
    height: 68px;
  }

  .power-btn .power-state {
    right: 22px;
    font-size: 1.44rem;
  }

  .power-btn.on .power-knob {
    transform: translateX(90px);
  }

  .power-btn.on .power-state {
    left: 22px;
  }

  .rental-details {
    flex-direction: column;
    align-items: center;
  }

  #debug-panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    max-height: 45vh;
  }

  .gallery-header {
    padding-top: 34px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .gallery-card {
    transform: none !important;
  }
}
