/* Charles Talbot Shop: sale pages, the bag, checkout. Separate from the portfolio's style. */
:root {
  --bg: #faf8f4;
  --card: #ffffff;
  --fg: #161513;
  --muted: #6d6a64;
  --line: #e7e3db;
  --accent: #b4532a;
  --ok: #2f6b3a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #141311; --card: #1c1b18; --fg: #efece6; --muted: #a29d94; --line: #2e2c28; --accent: #e08a5e; --ok: #7fc08a; }
}
:root[data-theme="dark"] { --bg: #141311; --card: #1c1b18; --fg: #efece6; --muted: #a29d94; --line: #2e2c28; --accent: #e08a5e; --ok: #7fc08a; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--sans); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  padding: 16px 32px; border-bottom: 1px solid var(--line);
}
.mark { font: italic 26px/1.1 var(--serif); text-decoration: none; }
.mark span { font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-left: 6px; vertical-align: middle; }
.top nav { display: flex; align-items: center; gap: 6px 20px; flex-wrap: wrap; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--fg); }
.bag-link { color: var(--fg) !important; border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; }
.bag-count { display: inline-block; min-width: 1.4em; margin-left: 4px; text-align: center; font-weight: 600; }
.bag-link.has-items { background: var(--fg); color: var(--bg) !important; border-color: var(--fg); }

main { max-width: 1240px; margin: 0 auto; padding: 32px 32px 80px; }
.foot { max-width: 1240px; margin: 0 auto; padding: 24px 32px 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* Headings and text */
.page-h, .sale-head h1, .item h1 { font: italic 400 44px/1.1 var(--serif); margin: 8px 0 12px; letter-spacing: -.01em; }
.sub-h { font: 600 13px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 48px 0 16px; }
.lede, .intro { font-size: 18px; max-width: 60ch; }
.small { font-size: 14px; color: var(--muted); }
.note { display: inline-block; font-size: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 12px; }
.crumb { margin: 0 0 16px; font-size: 15px; }
.crumb a { color: var(--muted); text-decoration: none; }

/* Sale times */
.sale-when { margin: 0 0 14px; font-size: 15px; }
.sale-state { display: inline-block; padding: 5px 12px; border-radius: 99px; background: var(--line); }
.sale-when[data-state="open"] .sale-state { background: var(--accent); color: #fff; }
.sale-when[data-state="ended"] .sale-state { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.sale-head { margin-bottom: 36px; }

/* Home: sale tiles */
.sales { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.sale-tile { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: center; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sale-tile img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; }
.sale-tile b { display: block; font: italic 400 24px/1.2 var(--serif); margin-bottom: 8px; }
.sale-tile .sale-when { margin: 0 0 6px; font-size: 13px; }
.sale-tile small { color: var(--muted); }
.sale-tile:hover { border-color: var(--fg); }
.sales-past .sale-tile { opacity: .85; }

/* Sale page: cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card-img { position: relative; display: block; aspect-ratio: 1 / 1; background: #fff; }
.card-img img { width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.card-img:hover img { opacity: .88; }
.card-text { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card h2 { font: 600 16px/1.3 var(--sans); margin: 0 0 4px; }
.card h2 a { text-decoration: none; }
.card-meta { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.card-buy { margin: auto 0 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { font: italic 20px/1 var(--serif); }
.price.big { font-size: 32px; margin: 6px 0 16px; }
.badge:empty { display: none; }
.badge { position: absolute; top: 12px; left: 12px; padding: 4px 10px; border-radius: 99px; background: var(--fg); color: var(--bg);
  font: 600 11px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.is-sold .card-img img, .is-sold .photo-main img { opacity: .45; filter: grayscale(.4); }
.is-held .badge { background: var(--accent); }

/* Buttons */
button.add, button.checkout {
  appearance: none; border: 1px solid var(--fg); background: var(--fg); color: var(--bg); cursor: pointer;
  font: 600 14px/1 var(--sans); padding: 11px 16px; border-radius: 99px; white-space: nowrap;
}
button.add:hover:not(:disabled), button.checkout:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
button.add.in-bag { background: transparent; color: var(--ok); border-color: var(--ok); }
button:disabled { opacity: .45; cursor: default; }
.item button.add, button.checkout { width: 100%; padding: 16px; font-size: 16px; }

/* Item page */
.item { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 40px; align-items: start; }
.photo-main { position: relative; background: var(--card); border-radius: 12px; overflow: hidden; display: flex; justify-content: center; }
.photo-main img { max-height: 78vh; width: auto; }
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-thumbs button { padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: none; cursor: pointer; }
.photo-thumbs img { height: 64px; width: auto; }
.details { position: sticky; top: 96px; }
.details .sku { font-size: 12px; letter-spacing: .08em; color: var(--muted); margin: 6px 0 0; }
.details h1 { font-size: 36px; }
.details dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 15px; margin: 20px 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details .small { margin: 12px 0 20px; }

/* Bag */
.bag-list { list-style: none; margin: 0 0 16px; padding: 0; max-width: 760px; }
.bag-row { display: grid; grid-template-columns: 80px 1fr auto auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.bag-row img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.bag-row a { text-decoration: none; font-weight: 600; }
.bag-row small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .05em; }
.bag-row em { display: block; color: var(--accent); font-style: normal; font-size: 14px; }
.bag-row.is-problem img { opacity: .5; }
.remove { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font: 14px var(--sans); }
.bag-total { display: flex; justify-content: space-between; max-width: 760px; font-size: 18px; padding: 8px 0; }
#bag .small, #bag .checkout { max-width: 760px; }

/* Policies */
.prose { max-width: 66ch; font-size: 17px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }

@media (max-width: 760px) {
  .top { padding: 12px 16px; }
  .top nav { gap: 4px 14px; font-size: 14px; }
  main { padding: 20px 16px 60px; }
  .foot { padding: 20px 16px 40px; }
  .page-h, .sale-head h1, .item h1 { font-size: 32px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
  .card-buy { flex-direction: column; align-items: stretch; }
  .card-buy button.add { width: 100%; }
  .item { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .details { position: static; }
  .sale-tile { grid-template-columns: 96px 1fr; }
  .sale-tile img { width: 96px; height: 96px; }
  .bag-row { grid-template-columns: 64px 1fr auto; }
  .bag-row img { width: 64px; height: 64px; }
  .bag-row .remove { grid-column: 2 / 4; justify-self: start; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
