/* ============================================================
   Purple Magic Whitening Toothpaste — Shared Design System
   Mobile-first • Purple theme • Zero frameworks
   ============================================================ */

/* ------------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ------------------------------------------------------------ */
:root {
  /* Purple palette */
  --primary: #6b21a8;
  --primary-dark: #581c87;
  --primary-darker: #3b0764;
  --primary-light: #a855f7;
  --primary-lighter: #c084fc;
  --primary-ghost: rgba(107, 33, 168, 0.08);

  /* Surfaces */
  --bg: #faf5ff;
  --bg-alt: #f3e8ff;
  --text: #1e1b2e;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
  --card-bg: #ffffff;

  /* Semantic */
  --success: #16a34a;
  --error: #dc2626;
  --info: #6b21a8;

  /* Layout */
  --radius: 16px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --spacing: 16px;
  --spacing-sm: 8px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Typography */
  --font-body: 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --line-height: 1.6;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-purple: 0 4px 16px rgba(107, 33, 168, 0.25);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.3s;
}

/* ------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

fieldset {
  border: none;
}

/* ------------------------------------------------------------
   3. UTILITY CLASSES
   ------------------------------------------------------------ */

/* Screen reader only */
.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;
}

/* Container */
.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* Section spacing */
.section {
  padding: var(--spacing-xl) 0;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: var(--spacing-xl) var(--spacing);
  font-size: var(--font-size-sm);
}

/* ------------------------------------------------------------
   4. BUTTONS
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  min-height: 44px;
  padding: 12px var(--spacing-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--text-inverse);
  cursor: pointer;
  transition:
    background var(--duration) var(--ease),
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

.btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-purple);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary variant (same as default — explicit alias) */
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

/* Outline variant */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-ghost);
}

/* Large variant */
.btn-lg {
  min-height: 56px;
  padding: 16px var(--spacing-lg);
  font-size: var(--font-size-lg);
  border-radius: var(--radius);
}

/* Full-width on mobile */
.btn-block {
  display: flex;
  width: 100%;
}

/* ------------------------------------------------------------
   5. LANGUAGE SWITCH
   ------------------------------------------------------------ */
.lang-switch {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  align-items: center;
}

.lang-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 20px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border: 2px solid var(--primary);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lang-btn:hover {
  background: var(--primary-ghost);
}

.lang-btn.active,
.lang-btn[aria-pressed="true"] {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-purple);
}

/* ------------------------------------------------------------
   6. STAR RATING — Interactive (radio group)
   ------------------------------------------------------------ */
.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
}

.star-rating input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.star-rating .star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 28px;
  line-height: 1;
  color: #d1d5db;
  cursor: pointer;
  transition:
    color var(--duration) var(--ease),
    transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.star-rating .star:hover,
.star-rating .star:hover ~ .star {
  color: var(--primary-light);
  transform: scale(1.15);
}

.star-rating input[type="radio"]:checked ~ .star {
  color: var(--primary);
}

.star-rating .star:active {
  transform: scale(0.9);
}

/* Focus styling for keyboard nav */
.star-rating input[type="radio"]:focus-visible + .star {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   7. STAR RATING — Static display (review cards)
   ------------------------------------------------------------ */
.stars-display {
  display: inline-flex;
  gap: 1px;
  font-size: 18px;
  line-height: 1;
}

.stars-display .star {
  color: #d1d5db;
}

.stars-display .star.filled {
  color: var(--primary);
}

/* ------------------------------------------------------------
   8. REVIEW CARDS
   ------------------------------------------------------------ */
.review-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: var(--spacing);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  transition: box-shadow var(--duration) var(--ease);
}

.review-card:hover {
  box-shadow: var(--shadow-md);
}

.review-name {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--text);
}

.review-stars {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.review-body {
  font-size: var(--font-size-sm);
  line-height: var(--line-height);
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}

.review-body.expanded {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
}

.sample-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 10px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--primary);
  border: 1.5px solid var(--primary-lighter);
  border-radius: var(--radius-pill);
  background: var(--primary-ghost);
  line-height: 1.6;
}

.review-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   9. FORMS
   ------------------------------------------------------------ */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px var(--spacing);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--card-bg);
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.15);
}

.form-field textarea {
  resize: vertical;
  min-height: 100px;
}

.form-status {
  font-size: var(--font-size-sm);
  padding: 10px var(--spacing);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 500;
}

.form-status.success {
  color: var(--success);
  background: rgba(22, 163, 74, 0.08);
}

.form-status.error {
  color: var(--error);
  background: rgba(220, 38, 38, 0.08);
}

.form-status.info {
  color: var(--info);
  background: var(--primary-ghost);
}

/* Hidden honeypot field — must not be visible to users */
.form-field input[name="website"],
.honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------
   10. SHOWCASE PAGE — Full-viewport scroll sections
   ------------------------------------------------------------ */
.showcase-slide {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--spacing);
  padding-bottom: var(--spacing-xl);
  position: relative;
  overflow: hidden;
}

.showcase-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
  transform: scale(0.95);
  opacity: 0;
}

.showcase-img.is-visible {
  transform: scale(1);
  opacity: 1;
}

/* Scroll reveal animation for showcase slides */
.showcase-slide {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.showcase-slide.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------
   11. SLIDESHOW — Display page crossfade
   ------------------------------------------------------------ */
.slideshow {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s var(--ease);
}

.slide.active {
  opacity: 1;
}

/* Ticker overlay */
.ticker {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(30, 27, 46, 0.85);
  color: var(--text-inverse);
  padding: var(--spacing) var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing);
  min-height: 60px;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ticker-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-lighter);
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-text {
  font-size: var(--font-size-sm);
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.ticker-text.visible {
  opacity: 1;
}

/* ------------------------------------------------------------
   12. HOME PAGE
   ------------------------------------------------------------ */
.home-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--spacing-xl) var(--spacing);
  gap: var(--spacing-lg);
  text-align: center;
}

.home-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
}

.home-btn {
  min-height: 56px;
  padding: 16px var(--spacing-xl);
  margin: 12px;
  font-size: var(--font-size-lg);
  font-weight: 700;
  border-radius: var(--radius);
  width: 100%;
  max-width: 320px;
  background: var(--primary);
  color: var(--text-inverse);
  transition:
    background var(--duration) var(--ease),
    transform 0.15s var(--ease),
    box-shadow var(--duration) var(--ease);
}

.home-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-purple);
}

.home-btn:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------
   13. KEYFRAME ANIMATIONS
   ------------------------------------------------------------ */

/* Crossfade for slideshow */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Ticker text slide-in */
@keyframes tickerSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse for sample badge */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Gentle float for hero elements */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Slide-up reveal */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale-in reveal */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger utility — use with animation-delay */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ------------------------------------------------------------
   14. FOCUS-VISIBLE — Accessibility
   ------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure focus visible on interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   15. RESPONSIVE — Mobile-first enhancements
   ------------------------------------------------------------ */

/* Small phones: 320px (base styles above) */

/* Larger phones: 480px+ */
@media (min-width: 480px) {
  :root {
    --spacing: 20px;
    --spacing-lg: 28px;
  }

  .home-title {
    font-size: var(--font-size-2xl);
  }

  .home-btn {
    max-width: 360px;
  }

  .star-rating .star {
    width: 36px;
    height: 36px;
    font-size: 32px;
  }

  .review-card {
    padding: var(--spacing-lg);
  }
}

/* Tablets: 768px+ */
@media (min-width: 768px) {
  :root {
    --spacing: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
  }

  .container {
    max-width: 720px;
  }

  .home-title {
    font-size: 2.5rem;
  }

  .star-rating .star {
    width: 40px;
    height: 40px;
    font-size: 36px;
  }

  .stars-display {
    font-size: 22px;
  }

  .ticker {
    padding: var(--spacing-lg) var(--spacing-xl);
    min-height: 72px;
  }

  .ticker-label {
    font-size: var(--font-size-sm);
  }

  .ticker-text {
    font-size: var(--font-size-base);
  }
}

/* ------------------------------------------------------------
   16. REDUCED MOTION — Accessibility
   ------------------------------------------------------------ */
@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;
  }

  /* Force all animated elements visible */
  .showcase-slide,
  .showcase-img,
  .slide,
  .ticker-text {
    opacity: 1 !important;
    transform: none !important;
  }

  .slide.active {
    opacity: 1 !important;
  }

  .showcase-img.is-visible {
    transform: none !important;
  }

  .showcase-slide.is-visible {
    transform: none !important;
  }

  /* Static slideshow — no crossfade */
  .slide {
    transition: none !important;
  }
}

/* ------------------------------------------------------------
   17. PRINT — Minimal
   ------------------------------------------------------------ */
@media print {
  .btn,
  .lang-switch,
  .ticker,
  .form-field,
  .form-status {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ------------------------------------------------------------
   18. SELECTION STYLING
   ------------------------------------------------------------ */
::selection {
  background: var(--primary-lighter);
  color: var(--text-inverse);
}

::-moz-selection {
  background: var(--primary-lighter);
  color: var(--text-inverse);
}

/* ------------------------------------------------------------
   19. SCROLLBAR — Subtle
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-lighter);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ------------------------------------------------------------
   20. DARK MODE PREFERENCE (subtle)
   ------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  /* Keep light theme as brand direction (purple on light) —
     but provide high-contrast fallback for OLED readability */
}

/* ============================================================
   END — Shared Design System
   All pages add their own scoped classes below (or in separate
   <style> blocks). This file provides: tokens, reset, buttons,
   cards, containers, stars, reviews, forms, slideshow, ticker,
   home layout, keyframes, reduced-motion, focus-visible.
   ============================================================ */
