/*
 * theme.css — WRITTEN BY THE PLATFORM. Do not edit.
 *
 * Palette: Your colours (custom)
 * Source colours: #04091b #1b2130 #f7f8fb #1f3fc4 #2952e3 #ffffff
 *
 * Every value below is either one of those five or derived from them, and each
 * one is contrast-corrected against this palette's own background. Consume
 * them with var(--token); never write a colour value in app code.
 */

:root {
  --canvas: #f7f8fb;
  --surface: #fbfcfd;
  --surface-2: #ebecf0;
  --border: #d5d7dc;
  --border-strong: #aeb0b8;
  --ink: #1b2130;
  --muted: #6a6d77;
  --accent: #1f3fc4;
  --accent-hover: #1a36a7;
  --accent-ink: #ffffff;
  --accent-text: #2952e3;
  --accent-strong: #1f3fc4;
  --accent-soft: #d9def3;
  --accent-border: #96a5e2;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #dceae4;
  --success-strong: #137638;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #efe4de;
  --warning-strong: #a64c08;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #f0dee0;
  --danger-strong: #b91c1c;}

/* ====================================================================
 * app.css — Kartazo's own styles.
 *
 * Character: clean & premium. Slightly larger radii, more air between
 * sections, and gradient product tiles built only from neutral surface
 * tokens plus a small accent-coloured category chip — so a whole grid of
 * them stays calm instead of turning the accent into wallpaper.
 * ==================================================================== */

:root {
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent);
  --shadow-raised: 0 2px 8px color-mix(in srgb, var(--ink) 6%, transparent), 0 12px 32px color-mix(in srgb, var(--ink) 7%, transparent);
  --content-max: 1240px;
}

/* ---- Hero band -------------------------------------------------- */

.hero-band {
  border-radius: var(--radius-lg);
  padding: var(--s-9) var(--s-8);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--accent-strong)));
  color: var(--accent-ink);
  box-shadow: var(--shadow-raised);
}

/* ---- Category rail ------------------------------------------------ */

.category-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}
@media (max-width: 640px) {
  .category-rail { grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-4) var(--s-2);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.category-chip > * + * { margin-top: var(--s-2); }
.category-chip:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.category-chip-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ---- Product tile (stands in for a photo) -------------------------- */

.product-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-tile.tile-1 { background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.product-tile.tile-2 { background: linear-gradient(200deg, var(--surface-2), var(--surface-3)); }
.product-tile.tile-3 { background: linear-gradient(160deg, var(--surface-3), var(--surface-2)); }
.product-tile.tile-4 { background: linear-gradient(100deg, var(--surface-2), var(--surface-3)); }
.product-tile.tile-5 { background: linear-gradient(250deg, var(--surface-3), var(--surface-2)); }
.product-tile.tile-6 { background: linear-gradient(220deg, var(--surface-2), var(--surface-3)); }

.product-tile-initial {
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 20%, 4rem);
  font-weight: 600;
  color: color-mix(in srgb, var(--border-strong) 70%, var(--muted));
  opacity: 0.7;
  user-select: none;
}
.product-tile-chip {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.product-tile-chip .icon { width: 15px; height: 15px; }

/* ---- Product grid / card ------------------------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
}
@media (max-width: 900px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); } }

.product-card {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.product-card > * + * { margin-top: var(--s-3); }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-card-link { display: flex; flex-direction: column; }
.product-card-link > * + * { margin-top: var(--s-3); }
.product-card-body { display: flex; flex-direction: column; }
.product-card-body > * + * { margin-top: 6px; }
.product-card-actions { align-items: stretch; }
.product-card-actions form,
.product-card-actions > button:first-child { flex: 1 1 auto; }

.star-line { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.star-line .icon { color: var(--accent-text); }

.price-strike { text-decoration: line-through; }

.is-wishlisted { color: var(--accent-text); border-color: var(--accent-border); }

/* ---- Listing layout (filters + grid) -------------------------------- */

.listing-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 800px) { .listing-layout { grid-template-columns: 1fr; } }

.filter-rail { position: sticky; top: var(--s-4); }
.filter-link {
  display: block;
  padding: var(--s-2) var(--s-2);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--t-sm);
}
.filter-link:hover { background: var(--surface-2); }
.filter-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ---- Storefront topbar extras --------------------------------------- */

.store-search {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1 1 380px;
  max-width: 480px;
}
.store-search .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.store-search .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  color: var(--ink);
}
.icon-link:hover { background: var(--surface-2); }
.icon-link-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---- Cart / wishlist rows -------------------------------------------- */

.cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
}
.cart-row:last-child { border-bottom: none; }
.cart-row-art { width: 64px; height: 64px; display: block; }
.cart-row-art .product-tile { border-radius: var(--radius-sm); }
.cart-row-art .product-tile-initial { font-size: 1.5rem; }
.cart-row-info { min-width: 0; }
.cart-row-total { text-align: right; min-width: 70px; }
@media (max-width: 640px) {
  .cart-row { display: flex; flex-wrap: wrap; align-items: center; }
  .cart-row-art { width: 48px; height: 48px; flex: 0 0 auto; }
  .cart-row-info { flex: 1 1 100%; order: 1; }
  .qty-stepper { order: 2; }
  .cart-row-total { order: 3; text-align: left; }
}

.qty-stepper { display: inline-flex; align-items: center; gap: var(--s-2); }

/* ---- Product detail --------------------------------------------------- */

.product-detail {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-8);
}
@media (max-width: 800px) { .product-detail { grid-template-columns: 1fr; } }
.product-detail-art .product-tile { max-width: 360px; }

.crumbs { display: flex; gap: var(--s-2); align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-text); }
.sep { color: var(--border-strong); }

.review-row { padding: var(--s-4) 0; border-top: 1px solid var(--border); }
.review-row:first-child { border-top: none; padding-top: 0; }
.review-form { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4); background: var(--surface-2); }

/* ---- Order tracking steps ---------------------------------------------- */

.steps { display: flex; align-items: center; gap: var(--s-2); }
.step { display: flex; align-items: center; gap: var(--s-2); }
.step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 700;
}
.step.is-active .step-num { background: var(--accent); color: var(--accent-ink); }
.step-line { width: 24px; height: 2px; background: var(--border); }
.step.is-active + .step .step-line,
.step.is-active .step-line { background: var(--accent-border); }

/* ---- Auth pages --------------------------------------------------------- */

.auth-wrap {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6) 0;
}

.divider { height: 1px; background: var(--border); margin: var(--s-4) 0; }

/* ---- Small utilities used across pages ---------------------------------- */

.nums { font-variant-numeric: tabular-nums; }

/* ---- Kartazo brand mark -------------------------------------------------
 * A distinct wordmark badge (gradient + cart glyph) built from the app's own
 * palette — not a borrowed brand's logo. */
.brand-mark-kartazo {
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.brand-mark-kartazo .icon { width: 16px; height: 16px; }

/* ====================================================================
 * MOTION LAYER — a more kinetic, cinematic pass over the whole storefront.
 * Everything here is built from existing tokens: no new colours, only
 * movement, depth and timing. Every animated rule is neutralised under
 * prefers-reduced-motion at the bottom of this file.
 * ==================================================================== */

/* ---- Scroll reveal --------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Hero: slow gradient drift + soft floating glows ------------------ */

.hero-band {
  position: relative;
  overflow: hidden;
  background-size: 220% 220%;
  animation: heroShift 12s ease-in-out infinite;
}
.hero-band::before,
.hero-band::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(36px);
  opacity: .3;
  background: var(--accent-ink);
  animation: fxFloat 9s ease-in-out infinite;
  pointer-events: none;
}
.hero-band::before { width: 220px; height: 220px; top: -70px; right: 12%; }
.hero-band::after { width: 160px; height: 160px; bottom: -60px; left: 8%; animation-delay: 2.4s; }
.hero-band > * { position: relative; }
@keyframes heroShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes fxFloat { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-18px) scale(1.06); } }

/* ---- Category chips: icon comes alive on hover ------------------------ */

.category-chip-icon { transition: transform .35s var(--ease-out), background .3s var(--ease-out); }
.category-chip:hover .category-chip-icon { transform: scale(1.15) rotate(-6deg); }
.category-chip:active { transform: scale(.96); }

/* ---- Product grid: staggered entrance ---------------------------------- */

.product-grid > * { animation: fadeUp .5s var(--ease-out) both; }
.product-grid > *:nth-child(1) { animation-delay: 0ms; }
.product-grid > *:nth-child(2) { animation-delay: 40ms; }
.product-grid > *:nth-child(3) { animation-delay: 80ms; }
.product-grid > *:nth-child(4) { animation-delay: 120ms; }
.product-grid > *:nth-child(5) { animation-delay: 160ms; }
.product-grid > *:nth-child(6) { animation-delay: 200ms; }
.product-grid > *:nth-child(7) { animation-delay: 240ms; }
.product-grid > *:nth-child(8) { animation-delay: 280ms; }
.product-grid > *:nth-child(n+9) { animation-delay: 320ms; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.product-card:active { transform: scale(.98); }

/* ---- Buttons: a light sweep on the primary, a press squeeze on all ----- */

.btn-primary, .btn-danger { position: relative; overflow: hidden; }
.btn-primary::after, .btn-danger::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, color-mix(in srgb, var(--accent-ink) 30%, transparent), transparent);
  transform: translateX(-120%);
  pointer-events: none;
}
.btn-primary:hover::after, .btn-danger:hover::after { transition: transform .7s var(--ease-out); transform: translateX(120%); }
.btn:active { transform: scale(.96); }
.btn { transition: transform .15s var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out); }

/* ---- Cart / wishlist badge: a pop when the count changes -------------- */

@keyframes fxPop { 0% { transform: scale(1); } 45% { transform: scale(1.4); } 100% { transform: scale(1); } }
.icon-link-badge.is-bump { animation: fxPop .45s var(--ease-out); }
.icon-link { transition: transform .2s var(--ease-out); }
.icon-link:active { transform: scale(.92); }

/* ====================================================================
 * DELIVERY FX — the full-screen bike-ride / door-handoff / success
 * animation. Markup lives once in layout.ts (#fx-overlay); public/app.js
 * toggles .is-active and .stage-1 / .stage-2 / .stage-3 on it.
 * ==================================================================== */

.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 45%, var(--ink) 55%), var(--ink) 75%);
}
.fx-overlay.is-active { display: flex; animation: fxFadeIn .25s var(--ease-out); }
@keyframes fxFadeIn { from { opacity: 0; } to { opacity: 1; } }

.fx-overlay-close {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  color: color-mix(in srgb, var(--canvas) 92%, transparent);
  z-index: 1;
}
.fx-overlay-close:hover { background: color-mix(in srgb, var(--canvas) 16%, transparent); }

.fx-beams {
  position: absolute;
  inset: -20%;
  background: repeating-linear-gradient(115deg, color-mix(in srgb, var(--canvas) 7%, transparent) 0 2px, transparent 2px 42px);
  animation: fxBeamMove 7s linear infinite;
}
@keyframes fxBeamMove { from { transform: translateX(0); } to { transform: translateX(-168px); } }

.fx-scene { position: relative; width: min(560px, 88vw); height: 240px; }

.fx-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -52px;
  text-align: center;
  color: var(--canvas);
  font-weight: 600;
  letter-spacing: .01em;
}

.fx-road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--canvas) 22%, transparent);
  overflow: hidden;
}
.fx-overlay.stage-1 .fx-road::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, var(--canvas) 0 22px, transparent 22px 46px);
  opacity: .6;
  animation: fxRoadMove .45s linear infinite;
}
@keyframes fxRoadMove { from { transform: translateX(0); } to { transform: translateX(-46px); } }

.fx-bike-wrap { display: none; position: absolute; bottom: 52px; left: -140px; width: 120px; }
.fx-overlay.stage-1 .fx-bike-wrap { display: block; animation: fxRide 1s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes fxRide {
  0% { left: -140px; transform: translateY(0) rotate(0); }
  45% { transform: translateY(-6px) rotate(-2deg); }
  100% { left: calc(100% - 10px); transform: translateY(0) rotate(0); }
}
.fx-bike { position: relative; width: 110px; height: 60px; }
.fx-wheel { position: absolute; bottom: 0; width: 32px; height: 32px; border-radius: 50%; border: 4px solid var(--canvas); animation: fxSpin .35s linear infinite; }
.fx-wheel.rear { left: 0; }
.fx-wheel.front { right: 0; }
@keyframes fxSpin { to { transform: rotate(360deg); } }
.fx-frame {
  position: absolute;
  bottom: 22px;
  left: 12px;
  width: 78px;
  height: 20px;
  border: 3px solid var(--accent-ink);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--accent-ink) 18%, transparent);
}
.fx-rider { position: absolute; bottom: 32px; left: 32px; width: 30px; }
.fx-rider-head { width: 14px; height: 14px; border-radius: 50%; background: var(--canvas); margin-inline: auto; }
.fx-rider-body { width: 4px; height: 20px; background: var(--accent-ink); margin: 2px auto 0; border-radius: 2px; transform: rotate(10deg); }
.fx-bike .fx-package { position: absolute; bottom: 38px; right: 0; width: 16px; height: 16px; background: var(--canvas); border-radius: 3px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-ink) 55%, transparent); animation: fxBounce .3s ease-in-out infinite alternate; }
@keyframes fxBounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }

/* ---- Stage 2: the door / handoff --------------------------------------- */

.fx-door-scene { position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: center; gap: 28px; padding-bottom: 30px; }
.fx-overlay.stage-2 .fx-door-scene { display: flex; }

.fx-house { width: 92px; height: 92px; color: var(--canvas); opacity: .92; }
.fx-house .icon { width: 100%; height: 100%; }
.fx-overlay.stage-2 .fx-door-knock { animation: fxKnock .35s .7s ease-in-out 3; }
@keyframes fxKnock { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

.fx-courier { width: 34px; position: relative; }
.fx-overlay.stage-2 .fx-courier { animation: fxWalkUp .6s var(--ease-out) both; }
@keyframes fxWalkUp { from { transform: translateX(56px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.fx-courier .fx-rider-body { height: 34px; }
.fx-courier .fx-package {
  position: relative;
  width: 18px;
  height: 18px;
  margin: 6px auto 0;
  background: var(--canvas);
  border-radius: 3px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-ink) 55%, transparent);
}
.fx-overlay.stage-2 .fx-courier .fx-package { animation: fxHandoff .5s .55s var(--ease-out) both; }
@keyframes fxHandoff {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  60% { transform: translateY(-12px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-18px) scale(.2); opacity: 0; }
}

/* ---- Stage 3: success burst --------------------------------------------- */

.fx-success { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.fx-overlay.stage-3 .fx-success { display: flex; }

.fx-success-ring {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--success) 65%, var(--canvas) 35%);
}
.fx-overlay.stage-3 .fx-success-ring { animation: fxRingPop .9s ease-out forwards; }
.fx-overlay.stage-3 .fx-success-ring.d2 { animation-delay: .15s; }
@keyframes fxRingPop { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.fx-success-check {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--success);
  color: var(--success-ink);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
}
.fx-overlay.stage-3 .fx-success-check { animation: fxCheckPop .5s var(--ease-out) both; }
@keyframes fxCheckPop { 0% { transform: scale(0); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.fx-confetti {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.fx-confetti.c2 { background: var(--success); }
.fx-overlay.stage-3 .fx-confetti { animation: fxConfetti .9s ease-out forwards; }
@keyframes fxConfetti {
  to {
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -70px))) rotate(300deg);
    opacity: 0;
  }
}

/* ---- Motion off: prefers-reduced-motion --------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-band, .hero-band::before, .hero-band::after { animation: none; }
  .product-grid > * { animation: none; }
  .btn-primary::after, .btn-danger::after { display: none; }
  .fx-beams,
  .fx-overlay.stage-1 .fx-road::before,
  .fx-wheel,
  .fx-bike .fx-package,
  .fx-bike-wrap,
  .fx-overlay.stage-2 .fx-courier,
  .fx-overlay.stage-2 .fx-courier .fx-package,
  .fx-overlay.stage-2 .fx-door-knock,
  .fx-overlay.stage-3 .fx-success-ring,
  .fx-overlay.stage-3 .fx-success-check,
  .fx-overlay.stage-3 .fx-confetti {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
