/* ==========================================================
   Ranowin Enterprises — design tokens
   ========================================================== */
:root {
  --color-bg: #EAF4FF;          /* light blue — page background */
  --color-surface: #FFFFFF;      /* card / checkout background */
  --color-purple: #6C3CE9;       /* header, footer, primary buttons */
  --color-purple-dark: #5429C4;  /* hover / active state */
  --color-red: #FF6B6B;          /* pastel red — out of stock, errors */
  --color-red-bg: #FFE3E3;       /* pastel red background */
  --color-ink: #232633;
  --color-ink-muted: #6B7280;
  --color-line: #E1E8F2;
  --shadow-rgb: 40, 48, 70;
}

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Poppins', 'Inter', sans-serif;
  margin: 0;
}

p, ul, dl, dd { margin: 0; padding: 0; }
a { color: inherit; }
svg { display: block; }
button { font: inherit; cursor: pointer; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-purple-dark);
  outline-offset: 2px;
}

/* ==========================================================
   Top banner (A5 landscape, ~1.41:1)
   Mobile: full-width, ratio-based height, cropped to fit (cover).
   Desktop: height capped so it can't dominate the screen; the
   image is never cropped (contain), and the light-blue backdrop
   fills any letterboxing on very wide screens.
   ========================================================== */
.top-banner {
  width: 100%;
  line-height: 0;
  background: var(--color-bg);
}

.top-banner img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1.4142 / 1;
  object-fit: cover;
}

@media (min-width: 641px) {
  .top-banner img {
    aspect-ratio: auto;
    height: 250px;
    max-height: 250px;
    object-fit: contain;
    margin: 0 auto;
  }
}

/* ==========================================================
   Header
   ========================================================== */
.site-header {
  background: var(--color-purple);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 16px -8px rgba(var(--shadow-rgb), 0.5);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-title { font-size: 1.2rem; font-weight: 600; color: #fff; }
.brand-subtitle { font-size: 0.78rem; color: rgba(255, 255, 255, 0.8); margin-top: 2px; }

.lang-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 4px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn.active { background: #fff; color: var(--color-purple); }

/* ==========================================================
   Hero
   ========================================================== */
.hero { padding-top: 36px; padding-bottom: 8px; max-width: 720px; }
.hero-headline { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; line-height: 1.25; }
.hero-sub { margin-top: 10px; font-size: 0.98rem; line-height: 1.6; color: var(--color-ink-muted); }

/* ==========================================================
   Product section + grid
   ========================================================== */
.shop { padding-top: 32px; padding-bottom: 56px; }
.section-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 16px; }

.data-notice {
  background: var(--color-red-bg);
  color: #9A3B3B;
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 18px;
  text-align: center;
}

.loading-text {
  text-align: center;
  color: var(--color-ink-muted);
  font-size: 0.92rem;
  padding: 40px 0;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

@media (min-width: 640px)  { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
  background: var(--color-surface);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 30px -18px rgba(var(--shadow-rgb), 0.45);
}

.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  overflow: hidden;
}

.product-image--alt { background: #DCEBFF; }

.product-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-icon {
  width: 34%;
  height: 34%;
  stroke: var(--color-purple);
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: var(--color-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
}

.product-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name { font-size: 1rem; font-weight: 600; color: var(--color-ink); }
.product-price {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-ink);
  margin-bottom: 10px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  background: var(--color-purple);
  color: #fff;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 20px -10px rgba(108, 60, 233, 0.6);
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover { background: var(--color-purple-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-primary.btn-disabled,
.btn-primary.btn-disabled:hover {
  background: var(--color-red-bg);
  color: var(--color-red);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  background: var(--color-purple);
  color: rgba(255, 255, 255, 0.9);
  padding: 28px 20px;
}

.footer-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.footer-business { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1rem; color: #fff; }

.footer-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.85);
}

.footer-icon { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.footer-copy { font-size: 0.78rem; color: rgba(255, 255, 255, 0.65); margin-top: 8px; }

/* ==========================================================
   Full-screen checkout view (SPA-style slide + fade)
   ========================================================== */
body.checkout-locked { overflow: hidden; }

.checkout-view {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 300;
  overflow-y: auto;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s ease, opacity 0.3s ease, visibility 0s linear 0.35s;
}

.checkout-view.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.35s ease, opacity 0.3s ease, visibility 0s linear 0s;
}

.checkout-inner { max-width: 640px; padding-top: 24px; padding-bottom: 56px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--color-purple);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 0;
  margin-bottom: 18px;
}

.back-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.checkout-summary {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--color-surface);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 14px 30px -18px rgba(var(--shadow-rgb), 0.4);
  margin-bottom: 26px;
}

.checkout-image {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.checkout-image svg { width: 44%; height: 44%; stroke: var(--color-purple); fill: none; stroke-width: 1.4; opacity: 0.75; }

.checkout-info { flex: 1; min-width: 0; }
.checkout-info h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; }

.price-breakdown { display: flex; flex-direction: column; gap: 4px; }
.price-row { display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--color-ink-muted); }
.price-row dt, .price-row dd { font-weight: 500; }

.price-row.total-row {
  border-top: 1px dashed var(--color-line);
  margin-top: 6px;
  padding-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-ink);
}

.price-row.total-row dd { color: var(--color-purple); }

.form-section-title { font-size: 1.02rem; font-weight: 600; margin-bottom: 14px; }

/* ==========================================================
   Shared form field styling (checkout form)
   ========================================================== */
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--color-ink); }

.field input,
.field select,
.field textarea {
  border: 1.5px solid var(--color-line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--color-ink);
  background: #fff;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--color-purple); outline: none; }

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

.field.has-error input,
.field.has-error select { border-color: var(--color-red); }

.error-text { font-size: 0.76rem; color: var(--color-red); min-height: 1em; }

.btn-submit { margin-top: 8px; }

/* ==========================================================
   Small screens
   ========================================================== */
@media (max-width: 380px) {
  .header-inner { padding: 14px 16px; }
  .container { padding-left: 16px; padding-right: 16px; }
  .checkout-summary { flex-direction: column; align-items: flex-start; }
  .checkout-image { width: 100%; height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
