/* Threadify shop — header buttons, cart drawer, add-to-cart panel, checkout.
   Loads on plugin pages and database pages alike (js/shop.js), so every rule
   sets its own font and colours rather than inheriting either page's base. */

.tsc-hdr, .tsc-bar, .tsc-drawer, .tsc-modal, .tsc, .tsc-done, .tbr-add {
  --c-cream: #F5F0E8; --c-parch: #EDE8DC; --c-forest: #2E4A35; --c-brass: #B8922A;
  --c-ink: #1A1A18; --c-stone: #6B6B60; --c-line: rgba(26,26,24,.12);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.tsc-hdr *, .tsc-bar *, .tsc-drawer *, .tsc-modal *, .tsc * { box-sizing: border-box; }

/* ── Header: cart icon + Checkout ─────────────────────────────── */
.tsc-hdr { display: inline-flex; align-items: center; gap: 8px; margin-right: 10px; }
.tsc-hdr[hidden] { display: none !important; }
.tsc-hdr--plugin { order: 2; margin-left: 10px; margin-right: 0; }
.tsc-hdr--float { position: fixed; top: 12px; right: 12px; z-index: 900; }
.tsc-bag {
  position: relative; width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid rgba(26,26,24,.2); border-radius: 6px; cursor: pointer;
}
.tsc-bag:hover { border-color: var(--c-brass); background: var(--c-cream); }
.tsc-bag svg { width: 20px; height: 20px; fill: none; stroke: var(--c-forest); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tsc-badge {
  position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; line-height: 1;
  background: var(--c-brass); color: var(--c-ink);
}
a.tsc-go, #tdfy a.tsc-go {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 6px;
  font-size: .88rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  background: var(--c-brass); color: var(--c-ink); border: 1px solid var(--c-brass);
}
a.tsc-go:hover, #tdfy a.tsc-go:hover { background: var(--c-forest); border-color: var(--c-forest); color: var(--c-cream); text-decoration: none; }
/* With items in the cart, Checkout takes the main call-to-action's place,
   so the menu doesn't grow wider than the screen. */
body.tsc-has-cart .tse-nav__list > li:has(> a.tse-btn) { display: none; }
body.tsc-has-cart #tdfy .nav-cta > a.btn { display: none; }
@media (max-width: 899px) { .tsc-hdr--plugin { margin-left: auto; margin-right: 8px; } }
@media (max-width: 640px) { .tsc-hdr a.tsc-go, #tdfy .tsc-hdr a.tsc-go { display: none; } .tsc-hdr { margin-right: 6px; } }

/* ── Mobile checkout bar ──────────────────────────────────────── */
.tsc-bar { display: none; }
@media (max-width: 640px) {
  .tsc-bar:not([hidden]) {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 850;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; border-radius: 10px; text-decoration: none;
    background: var(--c-forest); color: var(--c-cream); font-weight: 600; font-size: .95rem;
    box-shadow: 0 10px 30px rgba(26,26,24,.28);
  }
  .tsc-bar span:last-child::after { content: " →"; color: var(--c-brass); }
  body.tsc-has-bar { padding-bottom: 76px; }
}

/* ── Drawer ───────────────────────────────────────────────────── */
.tsc-back { position: fixed; inset: 0; z-index: 1000; background: rgba(26,26,24,.45); opacity: 0; transition: opacity .2s ease; }
.tsc-back.is-open { opacity: 1; }
.tsc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; width: 420px; max-width: 100vw;
  display: flex; flex-direction: column; background: var(--c-cream); color: var(--c-ink);
  box-shadow: -10px 0 30px rgba(26,26,24,.18); transform: translateX(100%); transition: transform .22s ease;
}
.tsc-drawer[hidden], .tsc-back[hidden] { display: none; }
.tsc-drawer.is-open { transform: none; }
.tsc-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--c-line); }
.tsc-drawer__head h2, .tsc-modal h2, .tsc h1, .tsc h2, .tsc-done h1 {
  margin: 0; font-family: 'Bebas Neue', 'Inter', sans-serif; font-weight: 400; letter-spacing: .02em; color: var(--c-ink);
}
.tsc-drawer__head h2 { font-size: 1.7rem; color: var(--c-forest); }
.tsc-x { width: 36px; height: 36px; padding: 0; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--c-stone); cursor: pointer; }
.tsc-x:hover { color: var(--c-brass); }
.tsc-drawer__body { flex: 1; overflow-y: auto; padding: 6px 20px; }
.tsc-drawer__foot { padding: 16px 20px 20px; border-top: 1px solid var(--c-line); background: var(--c-parch); }
.tsc-empty { padding: 36px 6px; text-align: center; color: var(--c-stone); font-size: .95rem; line-height: 1.6; }
.tsc-empty a, .tsc-note a, .tsc-hint a { color: var(--c-forest); font-weight: 600; }

/* A cart line (drawer and checkout) */
.tsc-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.tsc-line:last-child { border-bottom: 0; }
.tsc-line__img { width: 64px; height: 76px; border-radius: 6px; overflow: hidden; background: #fff; border: 1px solid var(--c-line); }
.tsc-line__img img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tsc-line__info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tsc-line__brand { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-brass); }
.tsc-line__title { font-size: .92rem; font-weight: 600; color: var(--c-ink); line-height: 1.3; }
.tsc-line__meta { font-size: .8rem; color: var(--c-stone); line-height: 1.4; }
.tsc-line__acts { display: flex; gap: 14px; margin-top: 4px; }
.tsc-line__acts button, .tsc-link {
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: .8rem;
  color: var(--c-stone); text-decoration: underline; text-underline-offset: 2px;
}
.tsc-line__acts button:hover, .tsc-link:hover { color: var(--c-forest); }
.tsc-line__price { text-align: right; font-weight: 700; font-size: .95rem; color: var(--c-forest); }
.tsc-line__price small { display: block; font-weight: 500; font-size: .75rem; color: var(--c-stone); }

.tsc-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: .9rem; color: var(--c-ink); }
.tsc-row--total { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--c-line); font-weight: 700; font-size: 1rem; color: var(--c-forest); }
.tsc-note { margin: 8px 0 0; font-size: .8rem; line-height: 1.5; color: var(--c-stone); }
.tsc-btn {
  display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 14px; padding: 14px 20px;
  font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  background: var(--c-forest); color: var(--c-cream) !important; border: 1px solid var(--c-forest); border-radius: 6px;
}
.tsc-btn:hover { background: var(--c-brass); border-color: var(--c-brass); color: var(--c-ink) !important; text-decoration: none; }
.tsc-btn[hidden], .tsc-link[hidden] { display: none !important; }
.tsc-btn[disabled] { opacity: .5; cursor: not-allowed; background: var(--c-forest); color: var(--c-cream) !important; }
.tsc-drawer__foot .tsc-link { display: block; width: 100%; margin-top: 10px; text-align: center; }

/* ── Add-to-cart panel ────────────────────────────────────────── */
body.tsc-lock { overflow: hidden; }
.tsc-modal {
  position: fixed; inset: 0; z-index: 1002; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(26,26,24,.5);
}
.tsc-sheet {
  position: relative; width: 100%; max-width: 900px; max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--c-cream); border-radius: 12px; box-shadow: 0 30px 60px rgba(26,26,24,.3); color: var(--c-ink);
}
.tsc-sheet > .tsc-x { position: absolute; top: 10px; right: 12px; z-index: 2; }
.tsc-cfg { display: grid; grid-template-columns: 340px 1fr; }
.tsc-cfg__media { background: #fff; border-right: 1px solid var(--c-line); display: flex; align-items: flex-start; justify-content: center; padding: 20px; }
.tsc-cfg__media img { width: 100%; max-width: 300px; aspect-ratio: 2 / 3; object-fit: contain; position: sticky; top: 20px; }
.tsc-cfg__main { padding: 28px 30px 30px; }
.tsc-modal h2 { font-size: 2rem; line-height: 1.05; margin: 4px 0 6px; padding-right: 30px; }
.tsc-from { margin: 0 0 12px; font-size: .88rem; color: var(--c-stone); }
/* Garment price, right under the name: base size price, and where larger sizes cost more. */
.tsc-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; }
.tsc-price strong { font-family: 'Bebas Neue', 'Inter', sans-serif; font-weight: 400; font-size: 2.3rem; line-height: 1; color: var(--c-forest); letter-spacing: .01em; }
.tsc-price__each { font-size: .95rem; font-weight: 600; color: var(--c-ink); }
.tsc-price__note { padding: 3px 9px; border-radius: 999px; background: var(--c-parch); font-size: .8rem; font-weight: 600; color: var(--c-ink); }
.tsc-price__sub { margin: 4px 0 6px; font-size: .8rem; color: var(--c-stone); }
.tsc-loading { color: var(--c-stone); font-size: .95rem; }
.tsc-lbl { display: block; margin: 18px 0 8px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-ink); }
.tsc-lbl small { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--c-stone); }
.tsc-select, .tsc-deco select, .tsc input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .tsc textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .92rem; color: var(--c-ink);
  background: #fff; border: 1px solid rgba(26,26,24,.2); border-radius: 6px;
}
.tsc-select:focus, .tsc-deco select:focus, .tsc input:focus, .tsc textarea:focus, .tsc-size input:focus {
  outline: 2px solid var(--c-forest); outline-offset: 1px; border-color: var(--c-forest);
}
.tsc-sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.tsc-size { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; background: #fff; border: 1px solid var(--c-line); border-radius: 6px; }
.tsc-size__k { font-weight: 700; font-size: .85rem; }
.tsc-size input { width: 100%; padding: 6px 4px; text-align: center; font: inherit; font-size: .95rem; border: 1px solid rgba(26,26,24,.2); border-radius: 4px; background: var(--c-cream); }
.tsc-size__p { font-size: .85rem; font-weight: 700; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.tsc-size--up .tsc-size__p { color: #7D631D; }   /* larger sizes that cost more */
.tsc-size--up { background: #FBF8F1; }
.tsc-decos { display: grid; gap: 8px; }
.tsc-deco { display: grid; grid-template-columns: 1fr 1.2fr 1fr auto; gap: 8px; align-items: center; }
.tsc-deco__x { width: 30px; height: 30px; padding: 0; border: 0; background: none; font-size: 1.3rem; color: var(--c-stone); cursor: pointer; }
.tsc-add-deco { margin-top: 10px; font-weight: 600; color: var(--c-forest); }
.tsc-hint { margin: 10px 0 0; font-size: .78rem; color: var(--c-stone); }
.tsc-sum { margin-top: 18px; padding: 14px 16px; background: #fff; border: 1px solid var(--c-line); border-radius: 8px; }
.tsc-sum .tsc-row { padding: 0; font-size: .95rem; }
.tsc-sum strong { color: var(--c-forest); font-size: 1.1rem; }

@media (max-width: 760px) {
  .tsc-modal { padding: 0; align-items: flex-end; }
  .tsc-sheet { max-height: 94vh; border-radius: 14px 14px 0 0; }
  .tsc-cfg { grid-template-columns: 1fr; }
  .tsc-cfg__media { border-right: 0; border-bottom: 1px solid var(--c-line); padding: 12px; }
  .tsc-cfg__media img { max-width: 150px; position: static; }
  .tsc-cfg__main { padding: 20px 18px 24px; }
  .tsc-deco { grid-template-columns: 1fr 1fr; }
  .tsc-deco select[data-f="p"] { grid-column: 1 / 2; }
}

/* ── Browse cards: add button ─────────────────────────────────── */
.tbr-card--shop { cursor: pointer; }
.tbr-add {
  display: block; width: 100%; margin-top: 10px; padding: 9px 12px; cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif; font-size: .85rem; font-weight: 600;
  background: #2E4A35; color: #F5F0E8; border: 1px solid #2E4A35; border-radius: 6px;
}
.tbr-add:hover { background: #B8922A; border-color: #B8922A; color: #1A1A18; }

/* ── Brand logos now link to their listing ────────────────────── */
.tfb-card--link { padding: 0 !important; }
.tfb-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: inherit; width: 100%; height: 100%; padding: inherit; text-decoration: none !important; color: inherit; }
.tfb-card--link { transition: transform .15s ease, border-color .15s ease; }
.tfb-card--link:hover { transform: translateY(-3px); border-color: #2E4A35 !important; }

/* ── Checkout page ────────────────────────────────────────────── */
.tsc { max-width: 1180px; margin: 0 auto; padding: 36px 24px 80px; color: var(--c-ink); }
.tsc-co__head { margin-bottom: 24px; }
.tsc h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); line-height: 1; margin-top: 6px; }
.tsc-banner { margin: 14px 0 0; padding: 12px 16px; border-radius: 8px; font-size: .9rem; background: #fff; border: 1px solid var(--c-brass); color: var(--c-ink); }
.tsc-banner--test { background: var(--c-parch); border-color: var(--c-forest); }
.tsc-co { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }
.tsc-step { background: #fff; border: 1px solid var(--c-line); border-radius: 10px; padding: 22px 24px; margin-bottom: 16px; }
.tsc-step[hidden] { display: none; }
.tsc-step.is-locked { opacity: .6; }
.tsc h2 { display: flex; align-items: center; gap: 10px; font-size: 1.6rem; margin-bottom: 12px; }
.tsc h2 span {
  width: 30px; height: 30px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; border-radius: 50%; background: var(--c-forest); color: var(--c-cream);
}
.tsc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tsc-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; }
.tsc-grid label b { color: var(--c-brass); }
.tsc [aria-invalid="true"] { border-color: #9E2B25 !important; }
.tsc-files { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.tsc-files li { padding: 8px 10px; font-size: .85rem; background: var(--c-cream); border: 1px solid var(--c-line); border-radius: 6px; }
.tsc-files em { margin-left: 6px; font-style: normal; font-size: .75rem; font-weight: 700; color: var(--c-forest); }
.tsc input[type="file"] { display: block; width: 100%; margin-top: 12px; padding: 12px; border: 1px dashed rgba(26,26,24,.3); border-radius: 6px; background: var(--c-cream); font: inherit; font-size: .9rem; }
.tsc-check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .88rem; }
.tsc-ful { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tsc-opt { display: flex; gap: 10px; padding: 14px 16px; border: 1px solid rgba(26,26,24,.2); border-radius: 8px; cursor: pointer; background: var(--c-cream); }
.tsc-opt:has(input:checked) { border-color: var(--c-forest); box-shadow: 0 0 0 1px var(--c-forest); background: #fff; }
.tsc-opt input { accent-color: #2E4A35; margin-top: 3px; }
.tsc-opt strong { display: block; font-size: .95rem; }
.tsc-opt small { display: block; margin-top: 3px; font-size: .8rem; line-height: 1.45; color: var(--c-stone); }
.tsc-co__side { position: sticky; top: 90px; }
.tsc-sumbox { background: var(--c-parch); border: 1px solid var(--c-line); border-radius: 10px; padding: 22px 22px 18px; }
.tsc-sumbox h2 { font-size: 1.5rem; }
.tsc-sumbox .tsc-link { display: block; margin-top: 10px; text-align: center; }
.tsc-msg { margin: 10px 0 0; padding: 10px 12px; border-radius: 6px; font-size: .85rem; background: #fff; border: 1px solid #9E2B25; color: #9E2B25; }
.tsc-msg[hidden] { display: none; }
#tsc-stripe { min-height: 300px; }
.tsc-empty--big { grid-column: 1 / -1; padding: 60px 20px; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; }
.tsc-empty--big h2 { justify-content: center; }
.tsc-done { max-width: 720px; margin: 0 auto; padding: 70px 24px 90px; text-align: center; color: var(--c-ink); }
.tsc-done h1 { font-size: clamp(2.6rem, 6vw, 3.8rem); margin: 8px 0 14px; }
.tsc-done p { font-size: 1.02rem; line-height: 1.6; color: var(--c-stone); margin: 0 0 12px; }
.tsc-done .tse-btn { margin-top: 12px; }
@media (max-width: 900px) {
  .tsc-co { grid-template-columns: 1fr; }
  .tsc-co__side { position: static; order: -1; }
}
@media (max-width: 560px) {
  .tsc { padding: 24px 16px 60px; }
  .tsc-grid, .tsc-ful { grid-template-columns: 1fr; }
  .tsc-step { padding: 18px 16px; }
}

/* ── Add-to-cart panel: garment, then decoration, then subtotal ── */
.tsc-part { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid var(--c-line); }
.tsc-part__n {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; margin-top: 2px;
  border-radius: 50%; background: var(--c-forest); color: var(--c-cream);
  font-family: 'Bebas Neue', 'Inter', sans-serif; font-size: 1.05rem;
}
.tsc-part__body { min-width: 0; }
.tsc-part h3 { margin: 0; font-family: 'Bebas Neue', 'Inter', sans-serif; font-weight: 400; font-size: 1.45rem; letter-spacing: .02em; color: var(--c-ink); }
.tsc-part .tsc-lbl:first-of-type { margin-top: 10px; }
.tsc-note--tight { margin: 4px 0 10px; }
.tsc-deco { grid-template-columns: 1fr 1.2fr 1fr auto 30px; }
.tsc-deco__price { font-size: .85rem; font-weight: 700; color: var(--c-forest); white-space: nowrap; text-align: right; }
.tsc-sum .tsc-row { padding: 4px 0; }
.tsc-sum .tsc-row small, .tsc-sumbox .tsc-row small { font-weight: 500; color: var(--c-stone); }
.tsc-sum .tsc-row--total { margin-top: 6px; padding-top: 8px; font-size: 1.05rem; }
.tsc-row--sub { font-weight: 700; border-top: 1px dashed var(--c-line); margin-top: 4px; padding-top: 8px; }
.tsc-line__split { font-size: .78rem; color: var(--c-forest); font-weight: 600; }
@media (max-width: 760px) {
  .tsc-deco { grid-template-columns: 1fr 1fr; }
  .tsc-deco__price { text-align: left; }
}

/* ── Checkout: shipping address ───────────────────────────────── */
.tsc-addr { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--c-line); }
.tsc-addr[hidden] { display: none; }
.tsc-span2 { grid-column: 1 / -1; }
.tsc-grid--2 { grid-template-columns: 1.2fr 1fr; gap: 14px; }
.tsc select { width: 100%; padding: 10px 12px; font: inherit; font-size: .92rem; color: var(--c-ink); background: #fff; border: 1px solid rgba(26,26,24,.2); border-radius: 6px; }
@media (max-width: 560px) { .tsc-grid--2 { grid-template-columns: 1fr 1fr; } }

/* Decoration rows: three full-width dropdowns, the per-piece price below. */
.tsc-deco {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 30px; row-gap: 6px;
  padding: 10px 12px; background: #fff; border: 1px solid var(--c-line); border-radius: 8px;
}
.tsc-deco select { min-width: 0; }
.tsc-deco__price { grid-column: 1 / 4; grid-row: 2; text-align: left; font-size: .82rem; }
.tsc-deco > :last-child { grid-column: 4; grid-row: 1; }
@media (max-width: 760px) {
  .tsc-deco { grid-template-columns: 1fr 1fr 30px; }
  .tsc-deco select[data-f="p"] { grid-column: 1 / 3; }
  .tsc-deco__price { grid-column: 1 / 3; grid-row: auto; }
  .tsc-deco > :last-child { grid-column: 3; grid-row: 1; }
}

/* Checkout: terms agreement */
.tsc-agree { align-items: flex-start; margin: 14px 0 0; font-size: .82rem; line-height: 1.45; color: var(--c-ink); }
.tsc-agree input { margin-top: 2px; accent-color: #2E4A35; flex: 0 0 auto; }
.tsc-agree a { color: var(--c-forest); font-weight: 600; }

/* Quantity discount line and the setup-fee waiver bar */
.tsc-row--save span:last-child { color: #2E4A35; font-weight: 700; }
.tsc-row s { color: #5E5E54; margin-right: 4px; }
.tsc-waive { margin: 14px 0 12px; }
.tsc-waive__bar { height: 10px; border-radius: 999px; background: #EDE8DC; border: 1px solid rgba(26,26,24,.12); overflow: hidden; }
.tsc-waive__bar span { display: block; height: 100%; border-radius: 999px; background: #B8922A; transition: width .35s ease; }
.tsc-waive.is-done .tsc-waive__bar span { background: #2E4A35; }
.tsc-waive p { margin: 7px 0 0; font-size: .82rem; line-height: 1.45; color: #1A1A18; }
.tsc-waive strong { color: #2E4A35; }
