/* Embroidery Expert - dark by default, light via [data-theme="light"] */
:root {
  --bg: #0e1116;
  --bg-soft: #12161d;
  --surface: #161b23;
  --surface-2: #1d232d;
  --border: #262e3a;
  --border-strong: #354052;
  --text: #e9edf3;
  --muted: #98a2b3;
  --accent: #ff9d57;
  --accent-strong: #ff7a2f;
  --accent-ink: #1a0f06;
  --accent-soft: rgba(255, 157, 87, 0.14);
  --teal: #4fd1c5;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1240px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f4ef;
  --bg-soft: #f1ece4;
  --surface: #ffffff;
  --surface-2: #f6f2ec;
  --border: #e6dfd4;
  --border-strong: #d4cabb;
  --text: #1b1e24;
  --muted: #5f6775;
  --accent: #d9620f;
  --accent-strong: #b94f06;
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 98, 15, 0.1);
  --teal: #0f8f84;
  --shadow: 0 10px 28px rgba(60, 40, 20, 0.1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.logo-mark { color: var(--text); flex: none; }
.topbar-search {
  flex: 1; max-width: 520px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 0 14px; height: 40px; color: var(--muted);
}
.topbar-search:focus-within { border-color: var(--accent); }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.topnav a:hover { color: var(--text); background: var(--surface); }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.theme-toggle:hover { border-color: var(--border-strong); }
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .topnav { margin-left: auto; }
  .topnav a { padding: 6px 9px; }
  .logo span { font-size: 15px; }
}
@media (max-width: 420px) {
  .topnav a[href="/tags"] { display: none; }
}

/* ---------- hero */
.hero { padding: 56px 0 28px; text-align: center; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(36px, 6vw, 64px); font-weight: 600; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: clamp(16px, 2vw, 18px); max-width: 620px; margin: 14px auto 0; }
.hero .chips { justify-content: center; margin-top: 26px; }

/* While searching/filtering, results come first. */
.is-filtering .hero, .is-filtering .hero + .promo { display: none; }
.is-filtering .controls { padding-top: 20px; }

.page-head { padding: 34px 0 18px; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(28px, 4.5vw, 44px); font-weight: 600; letter-spacing: -0.015em; }
.page-head p { margin-top: 6px; }

/* ---------- chips & badges */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip .count { color: var(--muted); font-size: 12px; }
.chip-more { color: var(--accent); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.badge-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ---------- promo banner */
.promo { position: relative; margin: 26px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.promo img { width: 100%; height: auto; aspect-ratio: 600 / 750; object-fit: cover; }
@media (min-width: 700px) { .promo img { aspect-ratio: 1200 / 418; } }
.promo-label { position: absolute; top: 8px; right: 10px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; letter-spacing: .04em; }
@media (max-width: 699px) { .promo { max-width: 480px; margin-left: auto; margin-right: auto; } }

/* ---------- controls */
.controls {
  position: sticky; top: 64px; z-index: 10;
  display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 12px 0; background: var(--bg);
}
.field {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.field:focus-within { border-color: var(--accent); }
.field input, .field select { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.field select { cursor: pointer; width: 100%; text-overflow: ellipsis; }
.field { min-width: 0; }
.field select option { background: var(--surface); color: var(--text); }
@media (max-width: 760px) {
  .controls { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-search { grid-column: 1 / -1; }
}
.result-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 14px; font-size: 14px; }

/* ---------- grid & cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-link { display: flex; flex-direction: column; height: 100%; }
.card-media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-badge { position: absolute; top: 8px; left: 8px; z-index: 1; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.card-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-size: 14.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-formats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.card-formats span { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.empty { grid-column: 1 / -1; text-align: center; padding: 60px 16px; color: var(--muted); }

/* ---------- pagination */
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 32px 0 8px; }
.pg {
  min-width: 40px; height: 40px; padding: 0 12px; display: inline-grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.pg:hover { border-color: var(--accent); }
.pg.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pg.gap { border: 0; background: transparent; cursor: default; }

.button {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; margin-top: 24px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600;
}
.button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 22px 0 6px; font-size: 13.5px; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs [aria-current] { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }

/* ---------- product */
.product { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; padding: 16px 0 10px; align-items: start; }
@media (max-width: 860px) { .product { grid-template-columns: 1fr; gap: 24px; } }
.gallery { position: sticky; top: 84px; }
@media (max-width: 860px) { .gallery { position: static; } }
.gallery-main { border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); aspect-ratio: 1 / 1; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: none; width: 68px; height: 68px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--surface-2); cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active { border-color: var(--accent); }

.product-info h1 { font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 40px); font-weight: 600; letter-spacing: -0.015em; }
.by { margin-top: 8px; color: var(--muted); }
.by strong { color: var(--text); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.formats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; }
.formats .label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.fmt { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 26px; width: 100%; max-width: 380px; height: 54px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: var(--accent-ink);
  font-weight: 800; font-size: 17px; letter-spacing: .01em;
  box-shadow: 0 10px 26px -10px var(--accent-strong); transition: transform .15s, filter .15s;
}
.cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cta-note { font-size: 13px; margin-top: 8px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 26px 0 0; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 600; font-size: 14.5px; }
.meta a:hover { color: var(--accent); }
.text-link { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 600; font-size: 14px; }

.panel { margin-top: 22px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.panel h2 { font-size: 18px; margin-bottom: 14px; }
.prose p + p { margin-top: 10px; }
.prose p { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.table-wrap { overflow-x: auto; }
.sizes { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.sizes th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 0 12px 10px 0; }
.sizes td { padding: 10px 12px 10px 0; border-top: 1px solid var(--border); white-space: nowrap; }
.sizes td .muted { font-size: 13px; margin-left: 6px; }

.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; }

/* ---------- footer */
.footer { margin-top: 72px; border-top: 1px solid var(--border); background: var(--bg-soft); padding: 36px 0 24px; font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-inner p { max-width: 480px; margin-top: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { margin-top: 24px; font-size: 13px; }

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