/* Sapuna Product Finder – mobile-first styles.
 *
 * Palette: the --sapuna-* design tokens defined on sapuna.uk.
 * A complementary scheme – cool teal/mint family (hue ~165–181°) balanced
 * by a warm sand/cream family (~32°) – applied roughly 60/30/10:
 * cream background, white cards with mint borders, teal and sand accents.
 *
 * Brand teal (#57ADAE) is only 2.6:1 against white, so it is used for
 * fills, borders and dark-on-teal elements. Text and white-on-colour
 * elements use --teal-text, a darker step of the site's deep teal (#2F7D6D).
 */

:root {
  /* Brand tokens (sapuna.uk) */
  --teal: #57adae;          /* --sapuna-primary-accent */
  --mint: #a7dccf;          /* --sapuna-soft-accent */
  --mint-bg: #f3fefb;       /* --sapuna-primary-bg / button-bg */
  --mint-line: #dcefeb;     /* --sapuna-border */
  --sand: #d8bfa3;          /* --sapuna-luxury-accent */
  --cream: #f8f3ed;         /* --sapuna-warm-bg */
  --ink: #1f2d2a;           /* --sapuna-main-text */
  --muted: #5f706b;         /* --sapuna-secondary-text */

  /* Derived for accessibility (WCAG AA) */
  --teal-text: #2c7768;     /* 4.8:1 on cream, 5.3:1 white on it */
  --teal-text-hover: #24655a;
  --sand-soft: #f3ebe1;

  --radius: 16px;
  --font-head: "Montserrat", Arial, sans-serif;
  --font-body: "Assistant", Arial, sans-serif;
  --font-arabic: "Tajawal", Tahoma, sans-serif;
  color-scheme: light;
}

/* Arabic: Tajawal for all text, and no letter-spacing (it breaks joined letters). */
html[lang="ar"] {
  --font-head: var(--font-arabic);
  --font-body: var(--font-arabic);
}
html[lang="ar"] .eyebrow,
html[lang="ar"] .product-type { letter-spacing: 0; }
html[lang="ar"] .welcome-tagline { font-style: normal; }
html[lang="ar"] .product-size { direction: ltr; text-align: right; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.2; }
h1:focus { outline: none; }
p { margin: 0; }
a { color: inherit; }

/* Header: brand ink band with a teal progress line */
.header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px 0;
  text-align: center;
}
/* Official logo (sapuna.uk), brand teal #08A6AA: 4.8:1 on the ink header. */
.logo { display: inline-block; padding: 2px 0 12px; line-height: 0; }
.logo img { display: block; width: 150px; height: auto; }
@media (max-width: 359px) { .logo img { width: 120px; } }

.lang {
  position: absolute;
  top: 18px;
  inset-inline-end: 16px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(167, 220, 207, 0.5);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 600 0.875rem/1 var(--font-head);
  cursor: pointer;
  transition: background 0.15s;
}
.lang:hover { background: rgba(167, 220, 207, 0.12); }
.lang:lang(ar) { font-family: var(--font-arabic); font-size: 0.9375rem; }

.progress { height: 4px; margin: 0 -16px; background: rgba(255, 255, 255, 0.12); }
.progress[hidden] { display: none; }
.progress span {
  display: block;
  height: 100%;
  width: calc(var(--progress, 0) * 100%);
  background: var(--teal);
  transition: width 0.3s ease;
}

/* Main screen */
.screen { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 28px 16px 16px; }
.view { animation: enter 0.3s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.eyebrow {
  font: 600 0.75rem/1 var(--font-head);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-text);
  margin-bottom: 10px;
}

/* Welcome: a soft mint glow gives the opening screen a brand moment */
.welcome {
  text-align: center;
  padding: 7vh 8px 0;
  background: radial-gradient(circle at 50% 30%, rgba(167, 220, 207, 0.45), rgba(167, 220, 207, 0) 65%);
}
.welcome-title { font-size: clamp(1.75rem, 7vw, 2.25rem); font-weight: 600; }
.welcome-text { color: var(--muted); margin: 16px auto 32px; max-width: 34ch; }
.welcome-tagline { margin-top: 40px; font-style: italic; color: var(--muted); }
.welcome-tagline::before {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  margin: 0 auto 16px;
  background: var(--sand);
}

/* Buttons */
.btn {
  font: 600 1rem/1 var(--font-head);
  border-radius: 999px;
  min-height: 52px;
  padding: 0 28px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--teal-text);
  color: #fff;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 8px 20px rgba(44, 119, 104, 0.25);
}
.btn-primary:hover { background: var(--teal-text-hover); }
/* Secondary buttons follow the site's own button style: mint fill, teal border. */
.btn-ghost {
  background: var(--mint-bg);
  border-color: var(--teal);
  color: var(--ink);
  flex: 1;
  min-height: 48px;
  font-size: 0.9375rem;
}
.btn-ghost:hover { background: var(--teal); }
.btn:focus-visible, .option:focus-visible { outline: 3px solid var(--teal-text); outline-offset: 3px; }
.logo:focus-visible, .lang:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* Questions */
.question-title { font-size: clamp(1.4rem, 6vw, 1.75rem); font-weight: 600; margin-bottom: 22px; }
.options { display: grid; gap: 12px; }
.option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 18px 20px;
  text-align: start;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--mint-line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(31, 45, 42, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.option:hover { border-color: var(--teal); box-shadow: 0 4px 14px rgba(87, 173, 174, 0.18); }
.option:active { transform: scale(0.985); background: var(--mint-bg); }
.option-label { font: 600 1.0625rem/1.25 var(--font-head); }
.option-sub { color: var(--muted); font-size: 0.9375rem; }
.option-scent { border-inline-start: 8px solid var(--tile); }

/* Results */
.result-title { font-size: clamp(1.4rem, 6vw, 1.75rem); font-weight: 600; }
.result-intro { color: var(--muted); margin-top: 8px; }
.routine-step { margin-top: 28px; }
.routine-step-title { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; font-weight: 600; margin-bottom: 12px; }
.routine-step-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--ink);
  font-size: 0.8125rem;
}
.routine-step-hint { color: var(--muted); font-size: 0.875rem; margin: -6px 0 10px; }

.product {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--mint-line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 45, 42, 0.04);
}
.product + .product { margin-top: 10px; }

.product-image {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tile);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  display: grid;
  place-items: center;
  padding: 6px;
}
.product-image-label {
  font: 600 0.6875rem/1.2 var(--font-head);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.product-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.3s; }
.product-image.has-photo { background: #fff; }
.product-image.has-photo img { opacity: 1; }
.product-image.has-photo .product-image-label { visibility: hidden; }

.product-type { font: 600 0.6875rem/1.3 var(--font-head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-text); }
.product-name { font-size: 1rem; font-weight: 600; margin: 4px 0 6px; }
.product-suited { font-size: 0.875rem; font-weight: 600; }
.product-actives { font-size: 0.875rem; color: var(--muted); margin-top: 4px; }
.product-size { font-size: 0.8125rem; color: var(--muted); margin-top: 6px; }

/* Tips use the warm sand accent, the complement to the teal family. */
.tip {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-inline-start: 4px solid var(--sand);
  background: var(--sand-soft);
  font-size: 0.9375rem;
}

/* Bottom navigation */
.nav {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(248, 243, 237, 0), var(--cream) 30%);
}
.nav[hidden] { display: none; }

.footer { text-align: center; padding: 20px 16px 28px; font-size: 0.8125rem; color: var(--muted); }
.footer p + p { margin-top: 4px; }

@media (min-width: 480px) {
  .product { grid-template-columns: 120px 1fr; }
}

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