/* ===== Theme Variables ===== */
:root {
  /* Light mode — previously bg/surface were both near-identical whites
     (#fafafa vs #ffffff) with a very faint shadow, so cards barely
     separated from the page and the whole thing read flat next to dark
     mode. Tinting the background toward the accent's cool-blue family
     (instead of neutral grey) gives real separation while staying tied
     to the brand's existing accent color, and a slightly deeper, tinted
     shadow gives cards actual lift instead of a barely-there outline. */
  --color-bg: #eef1f9;
  --color-surface: #ffffff;
  --color-text: #1b2033;
  --color-text-muted: #646b82;
  --color-accent: #4f6df5;
  --color-accent-dark: #3a53c9;
  --color-accent-soft: rgba(79, 109, 245, 0.1);
  --color-cart: #eef0f7;          /* soft tinted placeholder, matches bg family */
  --color-border: #dee2ee;

  /* Warm "thread" accent — used sparingly as the signature of the auth
     flow (stitch lines, step indicators, the sew-on-button motif) as a
     nod to shertty being a home-goods brand. Kept out of the main accent
     family so it reads as a deliberate accent, not a second brand color. */
  --color-thread: #d9822b;
  --color-thread-soft: rgba(217, 130, 43, 0.16);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --shadow-soft: 0 6px 18px rgba(27, 32, 51, 0.09);
  --shadow-hover: 0 16px 34px rgba(27, 32, 51, 0.16);
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --color-bg: #12141a;
  --color-surface: #1b1e26;
  --color-text: #eef0f5;
  --color-text-muted: #9aa1b3;
  --color-accent-soft: rgba(79, 109, 245, 0.16);
  --color-cart: #262b36;
  --color-border: #2d3240;
  --color-thread: #eaa25c;
  --color-thread-soft: rgba(234, 162, 92, 0.16);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.5);
}

html {
  transition: background-color var(--transition);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar { display: none; }
body::-webkit-scrollbar { display: none; }
body { scrollbar-width: none; -ms-overflow-style: none; }

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.container {
  width: min(1200px, 92%);
  margin-inline: auto;
}

/* Registered custom properties so the click-ripple's radius/opacity
   can be *animated* smoothly by the keyframe below (a plain custom
   property jumps straight to its end value mid-animation unless its
   type is declared here first). */
@property --ripple-r {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
@property --ripple-o {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: none;
  padding-top: var(--space-sm);
  padding-bottom: var(--space-xs);
}

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: 0.9rem 1.75rem;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transform: translateY(0);
  animation: navbarFloat 4.5s ease-in-out infinite;
}

[data-theme="dark"] .header-inner {
  background: rgba(27, 30, 38, 0.45);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@keyframes navbarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

html.no-navbar-float .header-inner {
  animation: none;
}

/* Soft patch of light that drifts under the cursor while hovering —
   like a glint of light on water, not the bar itself moving. Replaces
   the old "whole bar tilts toward the cursor" effect: the bar now
   stays level at all times on hover, only this small pool of light
   follows the pointer (--spot-x/--spot-y, set on mousemove in
   script.js) and fades in/out through the ordinary opacity transition
   below (--spot-o). */
.header-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(255, 255, 255, 0.4), transparent 70%);
  opacity: var(--spot-o, 0);
  transition: opacity 0.5s ease;
}

[data-theme="dark"] .header-inner::before {
  background: radial-gradient(240px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(255, 255, 255, 0.14), transparent 70%);
}

/* Calm "press" on click — no shake, no jitter left and right. The bar
   just dips a touch, like a fingertip pressing on something floating,
   then eases back up on the same slow rhythm as navbarFloat above.
   Alongside it, a soft ring of light ripples outward from the exact
   spot that was clicked (--ripple-x/--ripple-y, set in script.js),
   like a drop landing on water. Both play once together, then the
   class is removed again on animationend. */
@keyframes navbarDip {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(4px) scale(0.997); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes navbarRipple {
  0%   { --ripple-r: 0px; --ripple-o: 0.5; }
  100% { --ripple-r: 260px; --ripple-o: 0; }
}

.header-inner.is-pressed {
  animation: navbarDip 0.8s cubic-bezier(.22, .61, .36, 1) 1;
}

html.no-navbar-float .header-inner.is-pressed {
  /* Still allowed to dip even with the idle float turned off. */
  animation: navbarDip 0.8s cubic-bezier(.22, .61, .36, 1) 1;
}

.header-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  --ripple-r: 0px;
  --ripple-o: 0;
  background: radial-gradient(circle var(--ripple-r) at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.5), transparent 70%);
  opacity: var(--ripple-o);
}

[data-theme="dark"] .header-inner::after {
  background: radial-gradient(circle var(--ripple-r) at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.2), transparent 70%);
}

.header-inner.is-pressed::after {
  animation: navbarRipple 0.8s ease-out 1;
}

.brand {
  position: relative;
  z-index: 1;
  grid-column: 1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--color-text);
}

.brand-icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  color: var(--color-text);
}

.main-nav {
  display: contents;
}

.nav-list-primary {
  position: relative;
  z-index: 1;
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-list-secondary {
  position: relative;
  z-index: 1;
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
  border-bottom-color: transparent;
}

.btn-signin {
  color: #fff !important;
  background: var(--color-accent);
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-pill);
  border-bottom: none !important;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-signin:hover {
  background: var(--color-accent-dark);
  transform: translateY(-1px);
}

.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding-inline: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  margin-inline-start: 0.15rem;
}

.nav-bell {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.nav-bell.is-visible { display: inline-flex; }
.nav-bell:hover {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text);
}
.nav-bell svg { width: 18px; height: 18px; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  grid-column: 3;
  justify-self: end;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--color-text);
  transition: transform var(--transition);
}

/* ===== Hero ===== */
.hero {
  padding-block: var(--space-xl);
  text-align: center;
  background:
    radial-gradient(ellipse 900px 420px at 50% 0%, var(--color-accent-soft), transparent 65%),
    linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -1px;
}

.accent { color: var(--color-accent); }

.hero-subtitle {
  max-width: 560px;
  margin: var(--space-sm) auto var(--space-md);
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-small { padding: 0.45rem 1.1rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ===== Simple Page Placeholder ===== */
.page-section {
  padding-block: var(--space-xl);
  text-align: center;
}
.page-section h1 {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-sm);
}
.page-section p {
  color: var(--color-text-muted);
  max-width: 520px;
  margin-inline: auto;
}

/* ===== Settings Page ===== */
.settings-list {
  max-width: 480px;
  margin-inline: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
}
.settings-row + .settings-row {
  border-top: 1px solid var(--color-border);
}

.settings-row-label { text-align: start; }
.settings-row-title { font-weight: 700; font-size: 0.95rem; }
.settings-row-desc { color: var(--color-text-muted); font-size: 0.82rem; margin-top: 0.15rem; }

/* Section labels that split Settings into logical groups (Appearance,
   Motion, Shopping, Notifications) instead of one long undifferentiated
   list. Every group after the first gets a divider above it. */
.settings-group-label {
  padding: 0.9rem var(--space-md) 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.settings-group-label:not(:first-child) {
  border-top: 1px solid var(--color-border);
  margin-top: 0.35rem;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.theme-switch-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition);
}
.theme-switch-thumb {
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
  transition: left 0.35s cubic-bezier(.34,1.56,.64,1),
              transform 0.3s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.25s ease;
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04); }
}
.theme-switch input:checked + .theme-switch-track {
  background: var(--color-accent);
}
.theme-switch input:disabled + .theme-switch-track {
  opacity: 0.45;
  cursor: not-allowed;
}
.theme-switch input:disabled + .theme-switch-track .theme-switch-thumb {
  animation: none;
  cursor: not-allowed;
}
.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  left: 23px;
  /* Only wobble while the switch is actually on — a still, off switch
     that wobbled just as much as an on one made the animation meaningless
     as a signal instead of a hint that this setting is active. */
  animation: bubbleFloat 3.4s ease-in-out infinite;
}
.theme-switch:hover .theme-switch-thumb {
  animation-play-state: paused;
  transform: scale(1.18);
  box-shadow: 0 0 0 6px rgba(79, 109, 245, 0.16), var(--shadow-hover);
}
.theme-switch:active .theme-switch-thumb {
  transform: scale(0.86);
  transition: transform 0.15s ease;
}

.segmented {
  display: inline-flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.segmented-btn {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.segmented-btn:hover { color: var(--color-text); }
.segmented-btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
}

.settings-row-wide {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}
.settings-row-wide .settings-row-label { width: 100%; }

.mini-select {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition);
}
.mini-select:focus { outline: none; border-color: var(--color-accent); }

.budget-control {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}
.budget-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.budget-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.budget-slider-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  width: 40px;
  flex-shrink: 0;
}
.budget-control input[type="number"] {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.budget-control input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
}
.budget-value {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ===== Calm Mode (reduced motion) ===== */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ===== Ambient Floating Bubbles ===== */
.ambient-bubbles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.35;
  background: radial-gradient(circle at 30% 30%, var(--color-accent), transparent 70%);
  pointer-events: auto;
  transition: transform 0.5s cubic-bezier(.34,1.56,.64,1), opacity 0.4s ease;
  animation: bubbleDrift linear infinite;
}

[data-theme="dark"] .ambient-bubble { opacity: 0.22; }

.ambient-bubble:hover {
  transform: scale(1.35);
  opacity: 0.55;
}

@keyframes bubbleDrift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(14px, -18px) scale(1.06); }
  66%  { transform: translate(-10px, 10px) scale(0.96); }
  100% { transform: translate(0, 0) scale(1); }
}

html.reduce-motion .ambient-bubbles { display: none; }

/* Make sure page content always sits above the ambient layer */
main, .site-footer { position: relative; z-index: 1; }

/* ===== Client-side page transitions =====
   The header/navbar is never torn down between "pages" — script.js swaps
   only this element's content, so the float/bump animation keeps running
   uninterrupted instead of restarting on a hard reload. */
main {
  transition: opacity 0.2s ease, transform 0.22s ease;
}
main.is-transitioning {
  opacity: 0;
  transform: translateY(10px);
}
html.reduce-motion main {
  transition: none;
}

/* ===== Community / Dummy Users Strips ===== */
.community-section {
  padding-block: 0 var(--space-xl);
}

.user-row + .user-row {
  margin-top: var(--space-lg);
}

.user-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-sm);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: var(--color-accent);
  flex-shrink: 0;
}

.user-name { font-weight: 700; font-size: 0.95rem; }
.user-meta { color: var(--color-text-muted); font-size: 0.8rem; }

/* ===== Product Grid ===== */
.shop-section { padding-block: var(--space-lg) var(--space-xl); }

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.product-grid {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
  direction: rtl;
  scroll-snap-type: x mandatory;
  padding-block: 0.25rem var(--space-sm);
  scrollbar-width: none;
}
.product-grid::-webkit-scrollbar { display: none; }

.strip-wrap {
  position: relative;
}

.strip-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.85);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  color: var(--color-text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1),
              background 0.2s ease, box-shadow 0.2s ease;
}
.strip-btn svg { width: 18px; height: 18px; display: block; }

[data-theme="dark"] .strip-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(27, 30, 38, 0.65);
}

.strip-wrap:hover .strip-btn:not(.is-hidden),
.strip-wrap:focus-within .strip-btn:not(.is-hidden) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.strip-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(79, 109, 245, 0.35);
  transform: translateY(-50%) scale(1.08);
}

.strip-btn.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-50%) scale(0.85) !important;
}

.strip-btn-right { right: 10px; }
.strip-btn-left { left: 10px; }

@media (max-width: 640px) {
  .strip-btn { display: none; }
}

.cart {
  direction: ltr;
  flex: 0 0 260px;
  scroll-snap-align: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}

.cart:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.cart-media {
  aspect-ratio: 4 / 3;
  background: var(--color-cart);
}

.cart-body { padding: var(--space-sm); }
.cart-title { font-size: 1rem; font-weight: 700; }
.cart-meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--space-xs);
}
.cart-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}
.cart.out-of-budget { opacity: 0.5; }
.cart.out-of-budget:hover { opacity: 0.85; }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-md);
  color: var(--color-text-muted);
  text-align: center;
}

/* ===== Auth pages (Login / Signup) =====
   Split shell: a brand panel (animated cloth-mesh gradient + swaying
   hanger mark + stitched thesis line) beside the actual auth card. Fully
   theme-aware (light/dark), respects .reduce-motion (animations are
   killed globally by the Calm Mode rule above), and collapses to a
   single column on narrow screens. */
.login-page {
  min-height: 100vh;
  background: var(--color-bg);
}

.login-overlay {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  align-items: stretch;
}

/* ---- Brand panel (left / start side) ---- */
.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: var(--space-lg);
  color: #fff;
  background:
    radial-gradient(60% 55% at 20% 18%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(70% 60% at 85% 82%, var(--color-thread-soft), transparent 55%),
    linear-gradient(155deg, var(--color-accent-dark) 0%, var(--color-accent) 55%, #6f4fd8 100%);
}
.auth-panel-blobs {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  opacity: 0.55;
  filter: blur(0px);
}
.auth-panel-blobs .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  mix-blend-mode: soft-light;
  background: radial-gradient(circle, #ffffff, transparent 70%);
  animation: authBlobDrift 22s ease-in-out infinite;
}
.auth-panel-blobs .blob:nth-child(1) { width: 320px; height: 320px; top: -6%; left: -8%; animation-duration: 26s; }
.auth-panel-blobs .blob:nth-child(2) { width: 260px; height: 260px; bottom: -10%; right: -6%; background: radial-gradient(circle, var(--color-thread), transparent 70%); animation-duration: 19s; animation-delay: -6s; }
.auth-panel-blobs .blob:nth-child(3) { width: 200px; height: 200px; bottom: 30%; left: 12%; animation-duration: 24s; animation-delay: -12s; }
@keyframes authBlobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4%, -6%) scale(1.08); }
  66% { transform: translate(-5%, 4%) scale(0.95); }
}

.auth-panel-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.auth-panel-top svg { width: 24px; height: 24px; }

.auth-panel-mid {
  position: relative;
  z-index: 1;
  margin-block: auto;
  padding-block: var(--space-xl);
}
.auth-hanger {
  width: 108px;
  height: 108px;
  margin-bottom: var(--space-md);
  transform-origin: 50% 6%;
  animation: authHangerSway 6.5s ease-in-out infinite;
}
.auth-hanger circle,
.auth-hanger path { stroke: #fff; }
@keyframes authHangerSway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.auth-panel-headline {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.4vw + 1rem, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  max-width: 20ch;
}
.auth-panel-headline em { font-style: italic; color: #ffe3c2; }

.auth-stitch {
  width: 130px;
  height: 14px;
  margin-block: var(--space-sm);
  overflow: visible;
}
.auth-stitch path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 7;
  stroke-dashoffset: 0;
  animation: authStitchPull 5s linear infinite;
}
@keyframes authStitchPull {
  to { stroke-dashoffset: -26; }
}

.auth-panel-copy {
  font-size: 0.98rem;
  line-height: 1.65;
  max-width: 34ch;
  opacity: 0.92;
}

.auth-panel-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  gap: var(--space-md);
  font-size: 0.82rem;
  opacity: 0.85;
}

@media (max-width: 860px) {
  .login-overlay { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
}

/* ---- Auth card (right / end side) ---- */
.auth-card-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-lg) var(--space-md);
  background: var(--color-surface);
}

.auth-card {
  width: min(380px, 100%);
  margin-inline: auto;
  color: var(--color-text);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--color-text-muted);
  transition: color var(--transition);
}
.back-link:hover { color: var(--color-accent); }

.login-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--color-text);
}
.login-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.form-group { margin-bottom: var(--space-sm); }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

.form-group input {
  width: 100%;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-group input::placeholder { color: var(--color-text-muted); }
.form-group input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.form-error,
.form-success {
  display: none;
  font-size: 0.85rem;
  margin-bottom: var(--space-sm);
  margin-top: -0.3rem;
}
.form-error.show { display: block; color: #d64545; }
.form-success.show { display: block; color: #2b9e5c; }

.form-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  text-align: start;
}

.login-links {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-size: 0.88rem;
}
.login-links a { color: var(--color-text-muted); transition: color var(--transition); }
.login-links a:hover { color: var(--color-accent); text-decoration: underline; }

/* ---- Divider + Google sign-in ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: var(--space-md) 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.btn-google:hover { border-color: var(--color-accent); transform: translateY(-1px); }
.btn-google:active { transform: translateY(0); }
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-google:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ---- "I'm not a robot" control (client-side spam gate) ----
   Styled as a sew-on button with two "holes" and a thread that pulls
   through them once the person checks it — a small, on-brand payoff
   in place of a generic checkbox. Paired server-side with the honeypot
   field + time-trap in script.js; see the code comments there for how
   to upgrade this to Cloudflare Turnstile + Supabase's built-in CAPTCHA
   protection for real bot-blocking. */
.notrobot {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition);
}
.notrobot:has(input:checked) { border-color: var(--color-thread); }
.notrobot-btn {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--color-text-muted);
  background: var(--color-surface);
  transition: border-color var(--transition);
}
.notrobot input:checked ~ .notrobot-btn { border-color: var(--color-thread); }
.notrobot-btn::before,
.notrobot-btn::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted);
  top: 50%;
  transform: translateY(-50%);
}
.notrobot-btn::before { left: 7px; }
.notrobot-btn::after { right: 7px; }
.notrobot input:checked ~ .notrobot-btn::before,
.notrobot input:checked ~ .notrobot-btn::after { background: var(--color-thread); }
.notrobot-stitch {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.notrobot input:checked ~ .notrobot-stitch { opacity: 1; }
.notrobot-stitch path {
  fill: none;
  stroke: var(--color-thread);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: notrobotDraw 0.4s ease forwards;
}
@keyframes notrobotDraw { to { stroke-dashoffset: 0; } }
.notrobot input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.notrobot-label { font-size: 0.88rem; color: var(--color-text); }

/* Honeypot field — invisible to people, present in the DOM for bots
   that blindly fill every input. Kept off-screen rather than
   display:none, which some bots specifically check for and skip. */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  left: -9999px;
}

/* ---- Signup step indicator (account → verify), styled as two
   sew-on buttons connected by a thread that "stitches" across once
   step 1 is complete. ---- */
.auth-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-md);
}
.auth-steps .step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-surface);
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.auth-steps .step-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  position: relative;
  overflow: hidden;
}
.auth-steps .step-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-thread);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}
.auth-steps.at-verify .step-dot:first-child {
  border-color: var(--color-thread);
  background: var(--color-thread);
  color: #fff;
}
.auth-steps.at-verify .step-line::after { transform: scaleX(1); }
.auth-steps.at-verify .step-dot:last-child {
  border-color: var(--color-thread);
  color: var(--color-thread);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .cart { flex-basis: 230px; }
}

@media (max-width: 768px) {
  .cart { flex-basis: 210px; }

  .header-inner {
    display: flex;
    justify-content: space-between;
    position: relative;
  }

  .nav-toggle { display: flex; }

  .main-nav {
    display: block;
  }

  #mainNav {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0; right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    display: none;
    padding: var(--space-sm) var(--space-md);
  }
  #mainNav.open { display: block; }

  .nav-list-primary,
  .nav-list-secondary {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .nav-list-secondary {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
  }
}

@media (max-width: 480px) {
  .cart { flex-basis: 78vw; }
}

/* ===== Cart Page Specific Styles ===== */
.cart-items-list {
  max-width: 600px;
  margin: 2rem auto;
  display: grid;
  gap: 1rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.cart-item-info h4 {
  margin: 0;
  font-size: 1.1rem;
}

.cart-item-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.cart-summary {
  max-width: 600px;
  margin: 2rem auto;
}

/* ===== Nav avatar (header, signed-in state) ===== */
.nav-avatar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: var(--color-accent);
}
.nav-avatar-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: #fff;
  background: var(--color-accent);
  flex-shrink: 0;
}

/* ===== Password field + show/hide toggle ===== */
.password-field { position: relative; }
.password-field input { padding-inline-end: 2.8rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.6rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  opacity: 0.85;
  cursor: pointer;
  padding: 0.3rem;
  display: grid;
  place-items: center;
  transition: opacity var(--transition), color var(--transition);
}
.password-toggle:hover { opacity: 1; color: var(--color-accent); }
.password-toggle svg { width: 18px; height: 18px; }

/* ===== Password strength meter (signup) ===== */
.pw-strength { margin: 0.5rem 0 var(--space-sm); }
.pw-strength-bar {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}
.pw-strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width var(--transition), background var(--transition);
  background: #d64545;
}
.pw-strength-bar-fill[data-level="weak"] { width: 25%; background: #d64545; }
.pw-strength-bar-fill[data-level="fair"] { width: 50%; background: #e0a53a; }
.pw-strength-bar-fill[data-level="good"] { width: 75%; background: #c9c23a; }
.pw-strength-bar-fill[data-level="strong"] { width: 100%; background: #2b9e5c; }

.pw-strength-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.3rem;
}

.pw-rules {
  list-style: none;
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.pw-rules li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pw-rules li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
  transition: background var(--transition);
}
.pw-rules li.is-met { color: #2b9e5c; }
.pw-rules li.is-met::before { background: #2b9e5c; }

/* ===== Username availability hint (signup / profile) ===== */
.field-hint {
  font-size: 0.78rem;
  margin-top: 0.35rem;
  min-height: 1.1em;
  color: var(--color-text-muted);
}
.field-hint.is-checking { opacity: 0.7; }
.field-hint.is-ok { color: #2b9e5c; }
.field-hint.is-taken { color: #d64545; }

/* ===== OTP / email-verification step (signup) ===== */
.verify-step { display: none; }
.verify-step.show { display: block; }
.login-form.is-hidden,
.login-links.is-hidden { display: none; }

.otp-inputs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: var(--space-sm) 0;
  direction: ltr;
}
.otp-inputs input {
  width: 2.6rem;
  height: 3rem;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.otp-inputs input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.verify-resend {
  text-align: center;
  font-size: 0.85rem;
  margin-top: var(--space-sm);
  color: var(--color-text-muted);
}
.verify-resend button {
  background: none;
  border: none;
  color: inherit;
  text-decoration: underline;
  opacity: 0.85;
  cursor: pointer;
  font-size: inherit;
}
.verify-resend button:hover { opacity: 1; }
.verify-resend button:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

/* ===== Profile page ===== */
.profile-banner {
  position: relative;
  height: 108px;
  margin: var(--space-md) 0 -52px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    radial-gradient(55% 90% at 12% 20%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(60% 90% at 90% 100%, var(--color-thread-soft), transparent 55%),
    linear-gradient(120deg, var(--color-accent-dark), var(--color-accent) 60%, #6f4fd8);
}

.profile-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  margin: 0 0 var(--space-lg);
  padding-inline: 0.25rem;
  flex-wrap: wrap;
}

.profile-avatar-wrap { position: relative; flex-shrink: 0; }

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--color-accent);
  border: 4px solid var(--color-surface);
  box-shadow: var(--shadow-soft);
}
.profile-avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 2rem;
  color: #fff;
  background: linear-gradient(145deg, var(--color-accent), var(--color-accent-dark));
  border: 4px solid var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.profile-avatar-edit {
  position: absolute;
  bottom: 2px;
  inset-inline-end: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  background: var(--color-thread);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.profile-avatar-edit:hover { background: var(--color-accent-dark); transform: scale(1.06); }
.profile-avatar-edit svg { width: 16px; height: 16px; }
.profile-avatar-edit input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-header-info { min-width: 0; padding-bottom: 0.3rem; }
.profile-username { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; word-break: break-word; }
.profile-email { color: var(--color-text-muted); font-size: 0.88rem; margin-top: 0.15rem; word-break: break-all; }
.profile-avatar-status {
  font-size: 0.78rem;
  margin-top: 0.4rem;
  min-height: 1.1em;
}
.profile-avatar-status.is-error { color: #d64545; }
.profile-avatar-status.is-ok { color: #2b9e5c; }

.profile-field-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.profile-field-row .form-group { flex: 1 1 220px; margin-bottom: 0; }
.profile-field-row input {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.7rem 1rem;
  width: 100%;
  font-size: 0.95rem;
}
.profile-field-row .form-group label {
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: block;
}
.profile-section .field-hint { color: var(--color-text-muted); }
.profile-section .field-hint.is-ok { color: #2b9e5c; }
.profile-section .field-hint.is-taken { color: #d64545; }

