/* ==========================================================================
   PrintPop — Design System
   Custom print-on-demand store (US market)
   ========================================================================== */

:root {
  /* Palette — single warm accent, restrained neutrals */
  --accent: #d95d39;
  --accent-hover: #c04d2c;
  --accent-soft: #fbe9e2;
  --ink: #1c1b1a;
  --ink-soft: #4a4845;
  --muted: #7a7772;
  --line: #e8e6df;
  --bg: #faf9f6;
  --surface: #ffffff;
  --success: #3f7d4e;
  --error: #c0392b;
  --focus-ring: #d95d39;

  --font-display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --shadow-sm: 0 1px 2px rgba(28, 27, 26, 0.06);
  --shadow-md: 0 10px 30px rgba(28, 27, 26, 0.08);
  --shadow-lg: 0 24px 60px rgba(28, 27, 26, 0.12);

  --container: 1240px;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  font-weight: 650;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ----------------------------- Header --------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 246, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand .brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover { color: var(--ink); background: rgba(28, 27, 26, 0.05); }

.nav a.is-active { color: var(--ink); font-weight: 600; }

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.12s ease, background 0.15s ease;
}

.cart-link:hover { background: #2c2b2a; transform: translateY(-1px); }
.cart-link:active { transform: scale(0.97); }

.cart-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ----------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(217, 93, 57, 0.28); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2c2b2a; }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }

.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }

.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ----------------------------- Hero ----------------------------------- */
.hero {
  position: relative;
  padding: 72px 0 56px;
  background:
    radial-gradient(60% 90% at 85% 10%, rgba(217, 93, 57, 0.08), transparent 60%),
    radial-gradient(50% 70% at 10% 90%, rgba(217, 93, 57, 0.06), transparent 55%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero-eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4rem);
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p.lead {
  font-size: 1.15rem;
  max-width: 46ch;
  color: var(--ink-soft);
}

.hero-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-visual svg { width: 100%; height: auto; max-width: 460px; filter: drop-shadow(0 30px 40px rgba(28, 27, 26, 0.12)); }

/* ----------------------------- Sections ------------------------------- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.section-head h2 { margin: 0; }
.section-head .sub { color: var(--muted); margin: 4px 0 0; }

/* ----------------------------- Product grid --------------------------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }

.filter-chip {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
  transition: all 0.15s ease;
}
.filter-chip:hover { border-color: var(--ink); color: var(--ink); }
.filter-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 28px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #ddd9cf;
}

.product-media {
  aspect-ratio: 1 / 1;
  background: #f2f0ea;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  position: relative;
}

.product-media svg { width: 78%; height: 78%; }
.product-media img { width: 100%; height: 100%; object-fit: contain; display: block; }

.product-media .badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 999px;
  text-transform: uppercase;
}

.product-info { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.product-info h3 { margin: 0 0 4px; font-size: 1.08rem; }
.product-info .meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.product-info .price { font-weight: 700; font-size: 1.15rem; }
.product-info .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 16px; }

.color-dots { display: flex; gap: 6px; }
.color-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(28, 27, 26, 0.15);
  display: inline-block;
}

/* ----------------------------- Customizer ------------------------------ */
.customizer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: start;
}

.customizer-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

#customizeCanvas {
  max-width: 100%;
  max-height: 68vh;
  cursor: default;
  touch-action: none;
  border-radius: 4px;
}

.customizer-panel { display: flex; flex-direction: column; gap: 20px; }

.panel-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
}

.panel-block h3 {
  font-size: 0.95rem;
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.tool-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-row .btn { padding: 10px 16px; font-size: 0.88rem; }

.swatch-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(28, 27, 26, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), inset 0 0 0 1px rgba(28,27,26,0.12); }

.size-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.size-chip {
  min-width: 46px;
  padding: 9px 12px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  transition: all 0.12s ease;
}
.size-chip:hover { border-color: var(--ink); }
.size-chip.is-selected { background: var(--ink); color: #fff; border-color: var(--ink); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field input[type="text"],
.field select,
.field textarea,
.field input[type="email"],
.field input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.font-select { width: 100%; }

/* Text style controls inside panel */
.text-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ----------------------------- Upload zone ---------------------------- */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  color: var(--muted);
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone .icon { font-size: 1.6rem; margin-bottom: 8px; }
.upload-zone .hint { font-size: 0.82rem; }

/* ----------------------------- Cart ----------------------------------- */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }

.cart-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  align-items: center;
}

.cart-item .thumb {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: #f2f0ea;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: contain; }

.cart-item .info h4 { margin: 0 0 4px; font-size: 1rem; }
.cart-item .info .variant { color: var(--muted); font-size: 0.86rem; margin-bottom: 10px; }
.qty { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 30px; height: 30px; border: none; background: transparent; font-size: 1.1rem; color: var(--ink-soft); border-radius: 50%; }
.qty button:hover { background: rgba(28,27,26,0.06); }
.qty span { min-width: 24px; text-align: center; font-weight: 600; }
.cart-item .price { font-weight: 700; font-size: 1.05rem; }
.cart-item .remove { color: var(--muted); font-size: 0.82rem; border: none; background: none; text-decoration: underline; }
.cart-item .remove:hover { color: var(--error); }

.summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: calc(var(--header-h) + 24px);
}
.summary .line { display: flex; justify-content: space-between; margin-bottom: 12px; color: var(--ink-soft); }
.summary .line.total { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.summary .note { font-size: 0.8rem; color: var(--muted); margin-top: 14px; }

/* ----------------------------- Checkout ------------------------------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 36px; align-items: start; }
.checkout-form { display: flex; flex-direction: column; gap: 22px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; }
.form-card h3 { margin: 0 0 18px; font-size: 1.05rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row .full { grid-column: 1 / -1; }

.pay-note {
  background: var(--accent-soft);
  border: 1px solid #f4cdbf;
  color: #7a3a22;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.88rem;
  margin-top: 16px;
}

/* ----------------------------- Empty / states ------------------------- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--ink); }

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--error); }

/* ----------------------------- Footer --------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0;
  margin-top: 40px;
  background: var(--surface);
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin-bottom: 14px; }
.site-footer a { display: block; color: var(--muted); margin-bottom: 8px; font-size: 0.92rem; }
.site-footer a:hover { color: var(--ink); }
.site-footer .fine { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }

/* ----------------------------- Reveal animation ----------------------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ----------------------------- Responsive ------------------------------ */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
  .customizer { grid-template-columns: 1fr; }
  .customizer-stage { position: static; }
  .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  /* Keep the cart link reachable on phones (TikTok traffic is mobile-only) */
  .nav a:not(.cart-link) { display: none; }
  .nav .cart-link { display: inline-flex; }
  /* 16px prevents iOS Safari auto-zoom on input focus */
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"],
  .field select,
  .field textarea { font-size: 16px; }
  .cart-item { grid-template-columns: 72px 1fr; }
  .cart-item .thumb { width: 72px; height: 72px; }
  .cart-item .price { grid-column: 1 / -1; justify-self: end; }
  .footer-grid { grid-template-columns: 1fr; }
  /* Header auth buttons stay visible on phones — compact, both kept */
  .auth-actions { gap: 6px; }
  .auth-action { padding: 7px 12px; font-size: 0.82rem; }
}

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

/* ------------------------- Header auth (anonymous + logged-in) --------- */
/* Rendered by js/auth.js into [data-auth-slot]. Lives in styles.css (not
   auth.css) because the header appears on every page; auth.css is only
   loaded by the dedicated auth pages.

   Anonymous state: two parallel pill buttons (Sign in + Create account).
   No dropdown — by design, the two entry points are separate modules.
   Logged-in state: avatar button + dropdown panel (.user-menu). */
.auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.auth-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.auth-action:active { transform: scale(0.97); }
.auth-signin {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.auth-signin:hover {
  border-color: var(--ink);
  background: rgba(28, 27, 26, 0.04);
}
.auth-signup {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.auth-signup:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.user-menu {
  position: relative;
  display: inline-block;
}
.user-menu .user-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.user-menu .user-btn:hover { border-color: var(--accent); color: var(--accent); }
.user-menu .panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 200px;
  z-index: 50;
  display: none;
}
.user-menu.open .panel { display: block; }
.user-menu .panel a, .user-menu .panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.user-menu .panel a:hover, .user-menu .panel button:hover { background: var(--bg); }
.user-menu .panel .sep { height: 1px; background: var(--line); margin: 6px 0; }
.user-menu .badge-verify {
  background: #f7e9c7;
  color: #6b4f10;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 0.04em;
}
/* Anonymous variant: outline button + dropdown only. */
.user-menu.anon .anon-btn { font-weight: 500; }
.user-menu.anon .panel { min-width: 220px; }

@media (max-width: 560px) {
  .user-menu .user-btn { padding: 6px 10px; font-size: 0.82rem; }
  .user-menu .panel { right: -8px; min-width: 180px; }
}
