:root {
  --phlox: #C154C1;
  --palatinate: #662d91;
  --red: #FF0000;
  --rosewood: #65000B;
  --gold: #FFD700;
  --jasmine: #807700;
  --blue: #0000FF;
  --tropical-indigo: #9683EC;
  
  --primary: var(--phlox);
  --secondary: var(--palatinate);
}

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

body {
  font-family: 'Google Sans Code', monospace;
  /* Use small-viewport height with JS fallback to handle mobile chrome/safari UI */
  height: 100svh;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
  position: relative;
}

.refresh-button {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 100;
  cursor: pointer;
  color: var(--secondary);
  transition: transform 0.3s ease;
}

.refresh-button:hover {
  transform: rotate(180deg);
}

.container {
  display: flex;
  /* Match the body technique for reliable viewport sizing */
  height: 100svh;
  height: calc(var(--vh, 1vh) * 100);
  width: 100vw;
}

.product-section {
  flex: 1;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 40px;
}

.nav-arrow {
  color: var(--secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-arrow:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.nav-arrow-left {
  margin-right: 20px;
}

.nav-arrow-right {
  margin-left: 20px;
}

.product-card {
  aspect-ratio: 1;
  width: min(50vh, 50vw);
  background: white;
  border-radius: 10%;
  border: 15px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.product-image {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
}

.dot-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  background-color: var(--primary);
  transform: scale(1.2);
}

.content-section {
  flex: 1;
  background-color: var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.content-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform-origin: top center;
}

.content-section h1 {
  font-family: 'TASA Explorer', serif;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  letter-spacing: -2px;
}

.content-section p {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  color: var(--primary);
  margin-bottom: 40px;
  line-height: 1.6;
  max-width: 400px;
}

.buy-button {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 15px 40px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.buy-button:hover {
  background-color: var(--primary);
  color: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .container {
    /* Put content first and cap it to the top half */
    display: grid;
    grid-template-rows: auto 1fr;
  }
  
  .product-section,
  .content-section { flex: 1; }
  
  .product-section {
    padding: 20px;
  }
  
  .nav-arrow {
    display: none;
  }
  
  .product-card { width: min(50svh, 80vw); }
  
  .content-section {
    grid-row: 1;
    /* Keep some top padding but ensure CTA is above fold with dynamic bottom pad */
    --top-pad: clamp(12px, 4svh, 32px);
    --bottom-pad: max(16px, calc(env(safe-area-inset-bottom, 0px) + 16px));
    padding: var(--top-pad) 20px var(--bottom-pad);
    max-height: 50svh;
    overflow: visible;
    justify-content: flex-start;
  }
  
  .content-section h1 {
    font-size: clamp(1.75rem, 7vw, 3rem);
  }
  
  .content-section p {
    font-size: clamp(0.95rem, 3.5vw, 1.05rem);
    margin-bottom: clamp(16px, 3svh, 30px);
  }
  
  .refresh-button {
    display: none;
  }

  /* Compact mode when text would overflow top half */
  .content-section.compact .content-inner {
    transform: scale(var(--compact-scale, 0.92));
  }

  .content-section.compact h1 { letter-spacing: -1px; }
  .content-section.compact p { line-height: 1.4; }
}
