/* ============================================================================
   IKAGLAIE — Skin Advisor  ·  design system
   Aesthetic: refined editorial luxury — warm cream, ink black, a single
   confident red accent, Playfair Display serif paired with Albert Sans.
   ========================================================================== */

:root {
  --black: #0e0e0e;
  --ink: #1d1d1b;
  --ink-soft: #6c6c66;
  --slate: #45535e;
  --white: #ffffff;
  --cream: #fbf7f0;
  --cream-2: #f5efe4;
  --cream-3: #efe7d8;
  --line: #e9e2d5;
  --line-strong: #ddd3c2;
  --accent: #db1215;
  --accent-deep: #a90d10;
  --accent-tint: #fbecec;

  --serif: "Playfair Display", Georgia, serif;
  --sans: "Albert Sans", -apple-system, "Segoe UI", sans-serif;
  --ui: "Poppins", var(--sans);

  --r-lg: 26px;
  --r-md: 16px;
  --r-sm: 12px;

  --shadow-card: 0 1px 2px rgba(30, 25, 18, 0.04), 0 24px 60px -28px rgba(46, 38, 28, 0.28);
  --shadow-soft: 0 14px 36px -22px rgba(46, 38, 28, 0.4);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* --- atmospheric background ------------------------------------------------ */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(58% 42% at 78% 8%, rgba(219, 18, 21, 0.06), transparent 70%),
    radial-gradient(60% 50% at 12% 96%, rgba(69, 83, 94, 0.07), transparent 70%),
    linear-gradient(180deg, #fdfbf6 0%, var(--cream) 42%, var(--cream-2) 100%);
}
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* --- top bar --------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 48px);
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-name {
  font-family: var(--ui);
  font-weight: 600;
  letter-spacing: 0.42em;
  font-size: 16px;
  padding-left: 0.42em;
  color: var(--ink);
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
}
.brand-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--slate);
  white-space: nowrap;
}
.lang-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(6px);
}
.lang-toggle button {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
}
.lang-toggle button.active {
  background: var(--black);
  color: #fff;
}

/* --- stage / panel --------------------------------------------------------- */
.stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px clamp(14px, 4vw, 24px) 20px;
  display: flex;
  flex-direction: column;
}
.progress {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  margin: 4px 4px 18px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width 0.6s var(--ease);
}
.panel {
  position: relative;
  flex: 1;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  padding: clamp(22px, 4.5vw, 38px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: panelIn 0.7s var(--ease) both;
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }
}

/* --- intro screen ---------------------------------------------------------- */
.intro {
  margin: auto 0;
  text-align: left;
  animation: rise 0.7s var(--ease) both;
}
.eyebrow {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}
.intro h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 8vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}
.intro h1 em {
  font-style: italic;
  color: var(--accent);
}
.intro p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--slate);
  max-width: 42ch;
  margin: 0 0 30px;
}
.intro .meta {
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 22px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.intro .meta .dot {
  color: var(--line-strong);
}

/* --- buttons --------------------------------------------------------------- */
.btn {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 15px 30px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s;
}
.btn-primary {
  background: var(--black);
  color: #fff;
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -18px rgba(0, 0, 0, 0.55);
}
.btn-primary .arrow {
  transition: transform 0.3s var(--ease);
}
.btn-primary:hover .arrow {
  transform: translateX(4px);
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-deep);
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover {
  border-color: var(--ink);
}

/* --- chat ------------------------------------------------------------------ */
.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 4px 2px 6px;
  scroll-behavior: smooth;
}
.chat::-webkit-scrollbar {
  width: 6px;
}
.chat::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 6px;
}

.msg {
  display: flex;
  gap: 11px;
  max-width: 90%;
  animation: rise 0.5s var(--ease) both;
}
.msg.bot {
  align-self: flex-start;
}
.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--black);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 13px;
  display: grid;
  place-items: center;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.bubble {
  font-size: 15.5px;
  line-height: 1.55;
  padding: 13px 17px;
  border-radius: 18px;
  border: 1px solid transparent;
}
.msg.bot .bubble {
  background: var(--cream);
  border-color: var(--line);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.msg.user .bubble {
  background: var(--black);
  color: #fff;
  border-bottom-right-radius: 6px;
}

/* typing indicator */
.typing {
  display: inline-flex;
  gap: 5px;
  padding: 16px 18px;
}
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.5;
  animation: blink 1.3s infinite var(--ease);
}
.typing i:nth-child(2) {
  animation-delay: 0.18s;
}
.typing i:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes blink {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* --- option dock ----------------------------------------------------------- */
.dock {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: rise 0.45s var(--ease) both;
}
.composer {
  flex: 0 0 auto;
}
.option {
  font-family: var(--sans);
  font-size: 15px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 14px 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s;
}
.option .tick {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  transition: border-color 0.2s, background 0.2s;
}
.option .tick svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s var(--ease);
}
.option:hover {
  border-color: var(--ink);
  transform: translateX(3px);
}
.option.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
}
.option.selected .tick {
  border-color: var(--accent);
  background: var(--accent);
}
.option.selected .tick svg {
  opacity: 1;
  transform: scale(1);
}
.dock-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.dock-hint {
  font-family: var(--ui);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* text input dock */
.text-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.text-dock textarea {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 14px 16px;
  min-height: 84px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s;
}
.text-dock textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- ask / chat input bar -------------------------------------------------- */
.askbar {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.askbar textarea {
  flex: 1;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 15px;
  max-height: 120px;
  min-height: 46px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s;
}
.askbar textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.send-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--black);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.send-btn:hover {
  transform: translateY(-2px);
  background: var(--accent);
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* --- result ---------------------------------------------------------------- */
.result {
  animation: rise 0.6s var(--ease) both;
}
.result .eyebrow {
  margin-bottom: 14px;
}
.skin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.skin-type {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.05;
  color: var(--ink);
  margin: 0;
}
.confidence {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.skin-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.summary {
  font-size: 16px;
  line-height: 1.66;
  color: var(--slate);
  margin: 0 0 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

/* hero product card */
.hero-card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 18px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 22px;
}
.hero-card .ph {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--cream-2);
  aspect-ratio: 1;
}
.hero-card .ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: photoIn 0.8s var(--ease) both;
}
@keyframes photoIn {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
}
.hero-card .tech {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}
.hero-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.18;
  margin: 0 0 8px;
  color: var(--ink);
}
.hero-card .why {
  font-size: 14px;
  line-height: 1.55;
  color: var(--slate);
  margin: 0 0 14px;
}
.hero-card .buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-card .price {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}
.hero-card .btn {
  padding: 10px 15px;
  font-size: 12.5px;
}
.hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.btn-sm {
  padding: 10px 15px;
  font-size: 12.5px;
}

/* full-routine add-to-basket CTA */
.cart-cta {
  margin: 4px 0 20px;
  text-align: center;
}
.btn-cart {
  width: 100%;
  justify-content: center;
  padding: 15px 24px;
}
.cart-note {
  font-family: var(--ui);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin: 9px 0 0;
}

/* alternatives */
.alts {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.alt {
  flex: 1 1 0;
  min-width: 150px;
  display: flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.alt:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.alt img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--cream-2);
  flex: 0 0 auto;
}
.alt .alt-name {
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  font-weight: 500;
}
.alt .alt-price {
  font-family: var(--ui);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}

/* routine */
.routine {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.routine li {
  display: flex;
  gap: 14px;
  align-items: baseline;
}
.routine .step {
  font-family: var(--ui);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  flex: 0 0 78px;
  padding-top: 1px;
}
.routine .rtext {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--slate);
}

/* routine as specific, clickable product steps */
.routine-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rstep {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.rnum {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--accent);
  flex: 0 0 20px;
  padding-top: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rcard {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.rcard:not(.nolink):hover {
  border-color: var(--ink);
  transform: translateX(3px);
}
.rcard.nolink {
  cursor: default;
  background: var(--cream);
}
.rthumb {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cream-2);
}
.rthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rbody {
  flex: 1;
  min-width: 0;
}
.rtop {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}
.rstep-label {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.rprice {
  font-family: var(--ui);
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.rname {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
}
.rhow {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-top: 3px;
}
.coming {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.coming.sm {
  font-size: 9.5px;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
}
.note-box {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--slate);
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 22px;
}
.price-old {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: line-through;
  margin-left: 8px;
  font-weight: 400;
}
.ph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

.result-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.source-tag {
  font-family: var(--ui);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.source-tag .pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fae6a;
}
.restart {
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.restart:hover {
  color: var(--accent);
}

/* error state */
.notice {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--slate);
  background: var(--accent-tint);
  border: 1px solid #f3cccc;
  border-radius: var(--r-md);
  padding: 14px 16px;
}

/* --- footer ---------------------------------------------------------------- */
.site-foot {
  text-align: center;
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 0 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
}
.site-foot .dot {
  opacity: 0.5;
}
.site-foot a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}
.site-foot a:hover {
  color: var(--accent);
}

/* --- embed mode (when shown inside a Shopify iframe via ?embed=1) ----------- */
.embed .site-foot {
  display: none;
}
.embed .stage {
  padding-top: 4px;
  padding-bottom: 14px;
}
.embed .topbar {
  padding-top: 16px;
  padding-bottom: 8px;
}

/* --- shared animation ------------------------------------------------------ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 480px) {
  .panel {
    padding: 20px 18px 22px;
    border-radius: 20px;
  }
  .hero-card {
    grid-template-columns: 92px 1fr;
    gap: 14px;
  }
  .brand-sub {
    display: none;
  }
}

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