/* ============================================
   supersimple.reviews — Design System
   Ultra minimal. Black & white. Binary reviews.
   ============================================ */

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  corner-shape: squircle; /* iOS 26 continuous corners (progressive enhancement) */
}

/* Prevent iOS Safari from overriding form element styling */
input, textarea, button, select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* --- Tokens --- */
:root {
  /* Colors */
  --black: #000000;
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-400: #757575;
  --gray-600: #525252;
  --good-bg: #F0FFF4;
  --bad-bg: #FFF5F5;

  /* Typography */
  --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 20px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --font-size-3xl: 48px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Radius (min 12px, iOS continuous corners) */
  --radius-none: 0px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* --- Base --- */
html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--black);
  background: var(--white);
}

/* --- Typography --- */
.text-3xl { font-size: var(--font-size-3xl); font-weight: var(--font-weight-bold); line-height: var(--line-height-tight); }
.text-2xl { font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); line-height: var(--line-height-tight); }
.text-xl  { font-size: var(--font-size-xl);  font-weight: var(--font-weight-bold); line-height: var(--line-height-tight); }
.text-lg  { font-size: var(--font-size-lg);  font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); }
.text-base { font-size: var(--font-size-base); font-weight: var(--font-weight-regular); }
.text-sm  { font-size: var(--font-size-sm);  font-weight: var(--font-weight-regular); }
.text-xs  { font-size: var(--font-size-xs);  font-weight: var(--font-weight-regular); color: var(--gray-600); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
  border-radius: var(--radius-sm);
}
.btn-primary:hover {
  background: var(--gray-600);
  border-color: var(--gray-600);
}

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border-color: var(--black);
  border-radius: var(--radius-sm);
}
.btn-secondary:hover {
  background: var(--gray-50);
}

.btn-ghost {
  background: transparent;
  color: var(--black);
  border-color: transparent;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover {
  background: var(--gray-100);
}

/* --- Good/Bad Toggle --- */
.toggle-group {
  display: flex;
  gap: var(--space-4);
  width: 100%;
}

.toggle-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 96px;
  padding: var(--space-6);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--gray-400);
}

.toggle-btn .icon {
  font-size: 32px;
  line-height: 1;
}

.toggle-btn:hover {
  border-color: var(--black);
  color: var(--black);
}

.toggle-btn.active-good {
  border-color: var(--black);
  background: var(--good-bg);
  color: var(--black);
}

.toggle-btn.active-bad {
  border-color: var(--black);
  background: var(--bad-bg);
  color: var(--black);
}

/* --- Reason Chips --- */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--white);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip:hover {
  border-color: var(--black);
  color: var(--black);
}

.chip.selected {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
  font-weight: var(--font-weight-medium);
}

/* --- Review Card --- */
.review-card {
  padding: var(--space-4);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
}

.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.review-card-verdict {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.review-card-meta {
  font-size: var(--font-size-xs);
  color: var(--gray-400);
}

.review-card-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.review-card-reasons .chip {
  height: 32px;
  font-size: var(--font-size-xs);
  cursor: default;
  pointer-events: none;
}

/* --- Product Card --- */
.product-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s ease;
}

.product-card:hover {
  border-color: var(--black);
}

.product-card-image {
  width: 56px;
  height: 56px;
  border-radius: 4px; /* iOS nested: outer 16 - padding 16 ≈ small inner */
  background: var(--gray-100);
  flex-shrink: 0;
}

.product-card-info {
  flex: 1;
  min-width: 0;
}

.product-card-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-stats {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--gray-400);
}

.ratio-bar {
  display: flex;
  width: 64px;
  height: 4px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--gray-200);
}

.ratio-bar-fill {
  height: 100%;
  background: var(--black);
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 48px;
  padding: 0 var(--space-4);
  border: none;
  border-bottom: 1.5px solid var(--gray-200);
  background: transparent;
  width: 100%;
}

.search-bar:focus-within {
  border-bottom-color: var(--black);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  background: transparent;
  color: var(--black);
}

.search-bar input::placeholder {
  color: var(--gray-400);
}

.search-bar .search-icon {
  color: var(--gray-400);
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

/* --- Input Field --- */
.input-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.input-field label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
}

.input-field input {
  height: 48px;
  padding: var(--space-3) 0;
  border: none;
  border-bottom: 1.5px solid var(--gray-200);
  outline: none;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--black);
  background: transparent;
  transition: border-color 0.15s ease;
}

.input-field input:focus {
  border-bottom-color: var(--black);
}

.input-field input::placeholder {
  color: var(--gray-400);
}

/* --- Bottom Nav --- */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  width: 100%;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2);
  color: var(--gray-400);
  font-size: 22px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.bottom-nav-item span {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--black);
}

/* --- Mobile Frame --- */
.mobile-frame {
  width: 375px;
  min-height: 812px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--white);
  display: flex;
  flex-direction: column;
  position: relative;
}

.mobile-frame-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

/* --- Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* --- Animations --- */

/* Easing — Apple-inspired asymmetric curves */
:root {
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  /* Entrance: fast deceleration — things snap into place */
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  /* Exit: gentle acceleration — things leave gracefully */
  --ease-exit: cubic-bezier(0.4, 0, 0.7, 0.2);
  /* Spring: slight overshoot — playful bounce past target then settle */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Settle: smooth landing — used after spring or for subtle reveals */
  --ease-settle: cubic-bezier(0.25, 1, 0.5, 1);
}

/* Entrance: fade up */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

[data-animate="fade-up"].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Entrance: fade in */
[data-animate="fade-in"] {
  opacity: 0;
  transition: opacity 0.8s var(--ease-out-expo);
}

[data-animate="fade-in"].is-visible {
  opacity: 1;
}

/* Entrance: scale up from small */
[data-animate="scale-up"] {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

[data-animate="scale-up"].is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Entrance: slide in from left */
[data-animate="slide-left"] {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

[data-animate="slide-left"].is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Entrance: clip reveal (text) */
[data-animate="clip-reveal"] {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s var(--ease-out-quint);
}

[data-animate="clip-reveal"].is-visible {
  clip-path: inset(0 0% 0 0);
}

/* Dot grid canvas container */
.dot-grid-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.dot-grid-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* Micro-interactions: button press */
.btn-press {
  transition: transform 0.15s var(--ease-out-expo), box-shadow 0.15s ease;
}

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

/* Micro-interactions: hover lift */
.hover-lift {
  transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.hover-lift:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* --- i18n: FOUC prevention --- */
html.i18n-loading body {
  opacity: 0 !important;
}

html.i18n-ready body {
  transition: opacity 0.15s ease;
}

/* --- i18n: Language selector --- */
.lang-selector {
  position: relative;
  display: inline-flex;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--white);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--gray-400);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  letter-spacing: 0.5px;
}

.lang-toggle:hover {
  border-color: var(--black);
  color: var(--black);
}

.lang-toggle svg {
  flex-shrink: 0;
  color: var(--gray-400);
}

.lang-toggle:hover svg {
  color: var(--black);
}

.lang-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  padding: var(--space-1) 0;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.lang-option:hover {
  background: var(--gray-100);
  color: var(--black);
}

.lang-option.active {
  color: var(--black);
  font-weight: var(--font-weight-bold);
}

/* i18n: Top-bar dropdown opens downward */
.top-bar .lang-dropdown,
.debate-header .lang-dropdown {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateY(-4px);
}

.top-bar .lang-dropdown.open,
.debate-header .lang-dropdown.open {
  transform: translateY(0);
}

/* --- i18n: RTL overrides --- */
[dir="rtl"] {
  --font-family: 'Noto Sans Arabic', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

[dir="rtl"] .back-btn {
  transform: scaleX(-1);
}

[dir="rtl"] .read-more .arrow {
  transform: scaleX(-1);
}

[dir="rtl"] .read-more:hover .arrow {
  transform: scaleX(-1) translateX(3px);
}

[dir="rtl"] .read-more.expanded .arrow {
  transform: rotate(-90deg);
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-option {
  text-align: right;
}

/* RTL: flip inline arrows */
[dir="rtl"] .alt-arrow,
[dir="rtl"] .search-btn-icon,
[dir="rtl"] .btn-buy-arrow,
[dir="rtl"] .dym-arrow {
  display: inline-block;
  transform: scaleX(-1);
}

/* RTL: top bar layout */
[dir="rtl"] .top-bar {
  flex-direction: row-reverse;
}

/* --- i18n: Chinese font override --- */
html[lang="zh"] {
  --font-family: 'Noto Sans SC', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }

  .btn-press:active,
  .hover-lift:hover,
  .hover-lift:active {
    transform: none !important;
  }
}
