/* The BMS Merchandise
   School blazer: the crest's navy and antique gold, with the crest set in a piped breast pocket. */

@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --navy: #1c2b42;
  --navy-deep: #132034;
  --navy-2: #2b4a7a;
  --ink: #1e2a3b;
  --gold: #c9a95f;
  --gold-line: #a88a45;
  --gold-ink: #7a5c1e;
  --gold-soft: #f2e9d2;
  --chalk: #edf0f5;
  --line: #d5dbe4;
  --field: #7d899b;
  --page: #ffffff;
  --admin-page: #f3f5f8;
  --muted: #566275;
  --red: #b3261e;
  --red-soft: #f9e0de;
  --low: #8a5300;

  /* Chinese falls through to system fonts, which every phone and computer already has. */
  --display: "Cinzel", "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", "Segoe UI", Arial, sans-serif;

  --step--1: 0.85rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.56rem;
  --step-3: 1.95rem;
  --step-4: 2.44rem;
}

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

html { font-size: 106.25%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Chinese reads better with a little more line height and no tracking. */
html:lang(zh-Hans) body { line-height: 1.7; }
html:lang(zh-Hans) h1, html:lang(zh-Hans) .brand-name { letter-spacing: 0.04em; }

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

a { color: var(--navy-2); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; color: var(--navy); }
h1 { font-family: var(--display); font-weight: 600; font-size: var(--step-4); letter-spacing: 0.02em; }
h2 { font-size: var(--step-1); font-weight: 600; }
p { margin: 0 0 1em; }
small { font-size: var(--step--1); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }

.lead { font-size: var(--step-1); line-height: 1.45; max-width: 36em; }
.fine { font-size: var(--step--1); color: var(--muted); max-width: 46em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pre-line { white-space: pre-line; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--gold); color: var(--navy); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { top: 1rem; }

.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.wrap.narrow { width: min(820px, 100% - 2.5rem); }

/* Header ------------------------------------------------------------------ */

.site-header { background: var(--page); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-block: 0.7rem; flex-wrap: wrap; }

.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--navy); }
.brand-name { font-family: var(--display); font-weight: 600; font-size: var(--step-1); line-height: 1.1; letter-spacing: 0.02em; }
.crest { flex: none; height: auto; }

.site-nav { display: flex; align-items: center; gap: 0.4rem 1.3rem; flex-wrap: wrap; }
.site-nav a { color: var(--navy); text-decoration: none; font-weight: 500; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 0.4em; }
.site-nav .button { color: #fff; }
.site-nav form { margin: 0; }
.count {
  display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 0.4em;
  border-radius: 1em; background: var(--gold); color: var(--navy); font-size: var(--step--1); font-weight: 700; line-height: 1;
}
.language button.link { font-weight: 600; color: var(--gold-ink); text-decoration: none; padding: 0.2rem 0.55rem; border: 1.5px solid var(--gold-line); border-radius: 99px; }
.language button.link:hover { background: var(--gold-soft); }

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font: 600 var(--step-0)/1.2 var(--body);
  padding: 0.7em 1.25em; border-radius: 6px; border: 2px solid var(--navy);
  background: var(--navy); color: #fff; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--navy-2); border-color: var(--navy-2); }
.button.small { font-size: var(--step--1); padding: 0.45em 0.9em; }
.button.wide { width: 100%; }
.button.ghost { background: transparent; color: var(--navy); }
.button.ghost:hover { background: var(--chalk); }
.button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.button.danger:hover { background: #8e1f17; border-color: #8e1f17; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

button.link {
  font: inherit; color: var(--navy-2); background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}
.site-nav button.link { text-decoration: none; font-weight: 500; color: var(--navy); }
.site-nav button.link:hover { text-decoration: underline; }
.danger-text, button.danger-text { color: var(--red); }

/* Messages ---------------------------------------------------------------- */

.flashes { width: min(1160px, 100% - 2.5rem); margin: 1.25rem auto 0; display: grid; gap: 0.5rem; }
.admin-main .flashes { width: auto; margin: 0 0 1.25rem; }
.flash { margin: 0; padding: 0.75rem 1rem; border-radius: 6px; border-left: 5px solid; }
.flash p:last-child { margin-bottom: 0; }
.flash-success { background: #e2f0e6; border-color: #2f7d4b; }
.flash-error { background: var(--red-soft); border-color: var(--red); color: #6e1610; }
.flash-info { background: var(--gold-soft); border-color: var(--gold-line); }
.form-panel .flash { margin-bottom: 1.25rem; }

.callout { background: var(--gold-soft); border-left: 5px solid var(--gold-line); border-radius: 6px; padding: 0.9rem 1.1rem; margin-bottom: 1.5rem; }
.callout ul { margin: 0 0 0.75rem; padding-left: 1.2rem; }
.callout p:last-child { margin-bottom: 0; }
.callout a + a { margin-left: 1rem; }

/* Home: the crest on a blazer pocket -------------------------------------- */

.blazer {
  position: relative;
  color: #d7dde7;
  background-color: var(--navy);
  /* A faint woollen twill. */
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 4px);
  padding: clamp(2.25rem, 6vw, 4.5rem) 0 calc(clamp(2.25rem, 6vw, 4.5rem) + 14px);
  overflow: hidden;
}
/* Gold piping along the bottom edge, like the blazer's trim. */
.blazer::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background: linear-gradient(var(--navy-deep) 0 4px, var(--gold) 4px 7px, var(--navy-deep) 7px);
}
.blazer-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }

.pocket {
  position: relative;
  width: clamp(220px, 30vw, 330px);
  padding: 1.6rem 1.6rem 1.9rem;
  background: var(--navy-deep);
  border-radius: 6px 6px 28px 28px;
  /* Gold piping, then the cloth, then the shadow of the pocket's opening. */
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 7px var(--navy-deep), 0 22px 34px -18px rgba(0, 0, 0, 0.7);
  animation: settle 650ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
/* Stitching inside the piping. */
.pocket::before {
  content: ""; position: absolute; inset: 11px; border-radius: 3px 3px 22px 22px;
  border: 1.5px dashed rgba(201, 169, 95, 0.55); pointer-events: none;
}
/* The pocket's opening along the top. */
.pocket::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 3px; height: 9px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent); border-radius: 4px 4px 0 0;
}
.pocket-crest { width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }

@keyframes settle {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.blazer-copy h1 {
  color: #fff; font-size: clamp(2.1rem, 5.4vw, 3.8rem); line-height: 1.05; margin-bottom: 0.25em;
  text-wrap: balance;
}
.blazer-school { font-family: var(--display); color: var(--gold); font-size: var(--step-1); letter-spacing: 0.03em; margin-bottom: 1.5rem; }
.blazer-copy .lead { color: #fff; max-width: 30em; margin-bottom: 0.6em; }
.hours { color: #a9b4c6; margin: 0; }

/* Catalog ----------------------------------------------------------------- */

.catalog { padding-block: 2.5rem 1rem; }
.catalog-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; margin-bottom: 1.75rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.catalog-bar .tabs { margin-bottom: 0; }
.tabs a {
  padding: 0.4em 0.95em; border-radius: 99px; text-decoration: none; color: var(--navy);
  border: 1.5px solid var(--line); font-weight: 500; white-space: nowrap;
}
.tabs a:hover { border-color: var(--navy); }
.tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.count-muted { opacity: 0.75; font-variant-numeric: tabular-nums; }

.search { display: flex; gap: 0.5rem; }
.search input { width: 15rem; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2rem 1.5rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tile a { display: grid; gap: 0.55rem; text-decoration: none; color: inherit; }
.tile-name { font-weight: 600; font-size: var(--step-1); line-height: 1.25; color: var(--navy); }
.tile a:hover .tile-name { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.tile a:hover .art { background: var(--gold-soft); }
.tile-meta { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.price.big { font-size: var(--step-2); color: var(--navy); margin-bottom: 0.75rem; }

.stock { font-size: var(--step--1); font-weight: 600; }
.stock-low { color: var(--low); }
.stock-out { color: var(--red); }

.art { display: grid; place-items: center; background: var(--chalk); color: var(--navy); border-radius: 12px; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art-md { aspect-ratio: 1; }
.art-md .icon { width: 46%; height: auto; }
.art-lg { aspect-ratio: 1; border-radius: 18px; }
.art-lg .icon { width: 50%; height: auto; stroke-width: 1.4; }
.art-sm { width: 44px; height: 44px; border-radius: 8px; flex: none; }
.art-sm .icon { width: 30px; height: 30px; }
.art.is-out { opacity: 0.5; }

.empty { padding: 3rem 1.5rem; text-align: center; background: var(--chalk); border-radius: 12px; }
.empty p { margin-inline: auto; max-width: 34em; }
.empty-inline { color: var(--muted); }

.how { padding-block: 2.5rem 3.5rem; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.5rem 2.5rem; }
.steps li { counter-increment: step; position: relative; padding-left: 3.1rem; max-width: 26em; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -0.1rem;
  width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%;
  background: var(--navy); color: var(--gold); font-family: var(--display); font-weight: 700; font-size: var(--step-1);
  box-shadow: inset 0 0 0 2px var(--gold);
}
.steps strong { display: block; color: var(--navy); }

/* Product page ------------------------------------------------------------ */

.crumbs { margin: 1.5rem 0 1rem; font-size: var(--step--1); color: var(--muted); }
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; margin-bottom: 3rem; }
.product-info h1 { margin-bottom: 0.3em; font-size: var(--step-3); }
.description { max-width: 34em; }
.notice { background: var(--chalk); padding: 1rem 1.2rem; border-radius: 8px; font-weight: 500; }

.buy { margin: 1.5rem 0 1rem; display: grid; gap: 1.25rem; }
.choices { border: 0; padding: 0; margin: 0; min-width: 0; }
.choices legend { font-weight: 600; margin-bottom: 0.5rem; padding: 0; }
.choice-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: grid; place-items: center; min-width: 3.4rem; min-height: 3rem; padding: 0.3rem 0.9rem;
  border: 2px solid var(--line); border-radius: 6px; font-weight: 600; color: var(--navy);
}
.choice:hover span { border-color: var(--navy); }
.choice input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.choice.is-out span { color: #6b7789; text-decoration: line-through; background: #f4f6f9; }
.choice.is-out input:checked + span { background: #6b7789; border-color: #6b7789; color: #fff; }
.choice input:disabled { cursor: not-allowed; }

.buy-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.buy-row label { font-weight: 600; }
.buy-row input { width: 5rem; }
.stock-line { margin: 0; font-weight: 600; min-height: 1.55em; }

.related { border-top: 1px solid var(--line); padding-block: 2rem 3rem; }

/* Forms ------------------------------------------------------------------- */

/* :where() keeps these at zero specificity so component rules can size inputs. */
:where(input:not([type="radio"], [type="checkbox"], [type="file"]), select, textarea) {
  font: inherit; color: inherit; width: 100%;
  padding: 0.6em 0.75em; border: 1.5px solid var(--field); border-radius: 6px; background: #fff;
}
:where(input:not([type="radio"], [type="checkbox"], [type="file"]), select, textarea):hover { border-color: var(--navy-2); }
:where(input, select, textarea):focus-visible { outline: 3px solid var(--gold); outline-offset: 0; border-color: var(--navy); border-radius: 6px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--navy); width: 1.15rem; height: 1.15rem; margin: 0; flex: none; }
textarea { resize: vertical; }

.form-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.25rem, 3vw, 2rem); }
.form-panel h1 { font-size: var(--step-3); }
.form-panel h2 { margin-bottom: 1rem; }

.field { margin: 0 0 1.15rem; border: 0; padding: 0; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: 0.3rem; padding: 0; }
.optional { font-weight: 400; color: var(--muted); }
.hint { font-size: var(--step--1); color: var(--muted); margin: -0.1rem 0 0.4rem; }
.contact-hint { margin-bottom: 1rem; }
.error-text { color: var(--red); font-size: var(--step--1); font-weight: 600; margin: 0.35rem 0 0; }
.has-error :where(input:not([type="radio"], [type="checkbox"]), textarea, select) { border-color: var(--red); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.option { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; }
.option.block { display: flex; padding: 0.5rem 0; }
.option input[type="checkbox"] { align-self: flex-start; margin-top: 0.2rem; }
.options-inline { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

.actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.actions-inline { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.auth { display: grid; place-items: start center; padding-block: 2.5rem 4rem; }
.auth .form-panel { width: min(520px, 100%); }
.auth .lead { font-size: var(--step-0); color: var(--muted); }
.auth .fine { margin: 0.9rem 0 0; }

.code-input { font-size: var(--step-2); letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; max-width: 14rem; }
.code-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1.25rem 0 0.5rem; }
.code-actions form { margin: 0; }

/* Bag, checkout, orders --------------------------------------------------- */

.wrap.narrow > h1, .wrap > h1 { margin-top: 2rem; }

.lines, .data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lines th, .lines td { padding: 0.85rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.lines thead th { font-size: var(--step--1); color: var(--muted); font-weight: 600; border-bottom-width: 2px; }
.lines tfoot th, .lines tfoot td { border-bottom: 0; font-weight: 600; font-size: var(--step-1); }
.lines tfoot tr.sub th, .lines tfoot tr.sub td, .data tfoot tr.sub th, .data tfoot tr.sub td { font-size: var(--step-0); font-weight: 500; color: var(--muted); }
.lines .num, .data .num { text-align: right; }
.total { color: var(--navy); }
td.line-item > .art { display: inline-grid; margin-right: 0.75rem; vertical-align: middle; }
td.line-item > span { display: inline-block; vertical-align: middle; }
input.qty { width: 5rem; }
.bag .actions { justify-content: flex-end; }

.checkout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; align-items: start; margin-bottom: 3rem; }
.summary { background: var(--chalk); border-radius: 12px; padding: 1.5rem; position: sticky; top: 1rem; }
.summary-lines { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.summary-lines li, .summary-total, .summary-row { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.summary-row { margin: 0 0 0.4rem; }
.summary-row.discount { color: #155f34; font-weight: 600; }
.summary-total { border-top: 2px solid var(--navy); padding-top: 0.75rem; font-weight: 700; font-size: var(--step-1); color: var(--navy); }
.coupon-form { margin: 0 0 1rem; }
.coupon-form label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

.placed { background: var(--navy); color: #d7dde7; border-radius: 16px; padding: 2rem 2rem 2.6rem; margin: 2rem 0 1.5rem; position: relative; overflow: hidden; }
.placed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(var(--navy-deep) 0 3px, var(--gold) 3px 6px, var(--navy-deep) 6px);
}
.placed h1 { color: var(--gold); margin: 0 0 0.4em; }
.placed .lead { color: #fff; }
.placed p:last-child { margin-bottom: 0; }
.ref { font-family: var(--display); font-weight: 700; letter-spacing: 0.05em; background: var(--gold); color: var(--navy); padding: 0.05em 0.45em; border-radius: 4px; white-space: nowrap; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.5rem; margin: 0 0 2rem; }
.facts dt { font-size: var(--step--1); color: var(--muted); }
.facts dd { margin: 0.15rem 0 0; font-weight: 600; }
.facts.stacked { grid-template-columns: 1fr; gap: 0.8rem; margin: 0; }
.facts.stacked dd { font-weight: 500; overflow-wrap: anywhere; }
.contact-states { margin-bottom: 1.25rem; }
.note { background: var(--gold-soft); padding: 0.85rem 1rem; border-radius: 8px; margin: 1.25rem 0; }
.note p:last-child { margin-bottom: 0; }
.after-order { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1.5rem; }

.status, .tag { display: inline-block; padding: 0.1em 0.6em; border-radius: 99px; font-size: var(--step--1); font-weight: 600; white-space: nowrap; line-height: 1.5; }
.status-pending { background: #f6ebcb; color: #6b4a00; }
.status-paid { background: #dce7f4; color: #1f4b73; }
.status-ready { background: #d6ecdc; color: #155f34; }
.status-collected { background: #e5e9ee; color: #44515f; }
.status-cancelled { background: var(--red-soft); color: #8e1f17; }
.tag { background: var(--chalk); color: var(--navy); border-radius: 4px; font-size: 0.78rem; }
.tag-good { background: #ddefe3; color: #155f34; }
.tag-warn { background: #f6ebcb; color: #6b4a00; }
.tag-bad { background: var(--red-soft); color: #8e1f17; }
.tag-presale { background: var(--gold-soft); color: var(--gold-ink); }
.presale-note { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; font-weight: 600; color: var(--gold-ink); }
.owed { color: var(--gold-ink); font-weight: 600; }

.account { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; align-items: start; margin-bottom: 3rem; }
.account-forms { display: grid; gap: 1.5rem; }
.account-forms form { margin: 0; }

.error-page { padding-block: 4rem; }
.prose { padding-bottom: 3rem; }
.prose h2 { margin-top: 1.75rem; }

/* Two-step sign-in -------------------------------------------------------- */

.setup-steps { padding-left: 1.2rem; display: grid; gap: 1.25rem; }
.qr { width: 200px; height: 200px; margin: 0.75rem 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.key { word-break: break-all; background: var(--chalk); padding: 0.1rem 0.35rem; border-radius: 4px; }
.recovery { border-color: var(--gold-line); background: var(--gold-soft); }
.recovery-codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.4rem 1rem; }
.recovery-codes code { font-size: var(--step-0); letter-spacing: 0.05em; }

/* Support chat ------------------------------------------------------------ */

.thread-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.thread-list li + li { border-top: 1px solid var(--line); }
.thread-list a { display: grid; gap: 0.15rem; padding: 0.85rem 1rem; color: inherit; text-decoration: none; }
.thread-list a:hover { background: var(--chalk); }
.thread-list li.is-unread a { box-shadow: inset 4px 0 0 var(--gold); }
.thread-subject { font-weight: 600; color: var(--navy); }
.thread-preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { border: 1px solid var(--line); border-radius: 12px; background: #fff; display: flex; flex-direction: column; margin-bottom: 1rem; }
.chat-log { list-style: none; margin: 0; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain; }
.bubble { max-width: 78%; padding: 0.6rem 0.85rem; border-radius: 12px; }
.bubble.theirs { align-self: flex-start; background: var(--chalk); border-bottom-left-radius: 4px; }
.bubble.mine { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.bubble-who { display: block; font-size: 0.78rem; opacity: 0.8; margin-bottom: 0.15rem; }
.bubble.mine .bubble-who { color: #d7dde7; opacity: 1; }
.bubble-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-note { margin: 0; padding: 0.75rem 1rem; border-top: 1px solid var(--line); color: var(--muted); }
.chat-form { display: flex; gap: 0.6rem; align-items: flex-end; padding: 0.75rem; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; min-height: 2.8rem; max-height: 10rem; }

/* Footer ------------------------------------------------------------------ */

.site-footer { background: var(--navy); color: #d7dde7; margin-top: 2rem; border-top: 3px solid var(--gold); }
.site-footer strong { color: #fff; }
.site-footer a { color: var(--gold); }
.footer-row { display: flex; justify-content: space-between; gap: 1rem 3rem; flex-wrap: wrap; padding-block: 2rem; font-size: var(--step--1); }
.footer-row p { margin: 0; max-width: 32em; }

/* Admin ------------------------------------------------------------------- */

body.admin { background: var(--admin-page); font-size: 0.95rem; }
.admin h1 { font-size: var(--step-3); margin: 0; }

.admin-header { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.admin-header-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 1.5rem; flex-wrap: wrap; }
.admin-header .brand { color: #fff; }
.admin-header .brand-name { font-size: var(--step-0); }
.admin-header-links { display: flex; align-items: center; gap: 1.25rem; font-size: var(--step--1); flex-wrap: wrap; }
.admin-header-links a, .admin-header-links button.link { color: #d7dde7; }
.admin-header-links form { margin: 0; }
.admin-header .language button.link { color: var(--gold); border-color: var(--gold); }
.admin-header .language button.link:hover { background: var(--navy-deep); }
.admin-header-links a.who { color: var(--gold); font-weight: 600; }

.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); flex: 1; }
.admin-nav { background: #fff; border-right: 1px solid var(--line); padding: 0.75rem 0; display: flex; flex-direction: column; }
.admin-nav-group { display: flex; flex-direction: column; padding: 0.4rem 0; }
.admin-nav-group + .admin-nav-group { border-top: 1px solid var(--line); }
.admin-nav a { padding: 0.5rem 1.5rem; color: var(--ink); text-decoration: none; font-weight: 500; border-left: 4px solid transparent; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.admin-nav a:hover { background: var(--chalk); }
.admin-nav a[aria-current="page"] { border-left-color: var(--gold); background: var(--chalk); color: var(--navy); font-weight: 700; }
.admin-main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3rem; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.admin .crumbs { margin: 0 0 0.25rem; }
.admin .lead { font-size: var(--step-0); color: var(--muted); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 1.75rem; }
.figure { background: #fff; padding: 1rem 1.25rem; text-decoration: none; color: inherit; }
a.figure:hover { background: var(--chalk); }
.figure-label { margin: 0 0 0.2rem; color: var(--muted); font-size: var(--step--1); }
.figure-value { font-size: var(--step-3); font-weight: 700; color: var(--navy); margin: 0; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure-sub { margin: 0.25rem 0 0; color: var(--muted); font-size: var(--step--1); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.5rem; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; min-width: 0; }
.panel + .panel, .side > * + * { margin-top: 1.25rem; }
.two-col .panel + .panel { margin-top: 0; }
.panel h2 { font-size: var(--step-0); font-weight: 700; margin-bottom: 0.85rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-head a { font-size: var(--step--1); }
.panel-subhead { font-size: var(--step-0); font-weight: 700; margin: 1.4rem 0 0.4rem; }
.filter-note { color: var(--muted); margin: -0.5rem 0 1rem; }
.data th.pick, .data td.pick { width: 2.5rem; }
.coupon-list .actions { margin-top: 1rem; }
.callout-warning { background: var(--red-soft); border-left-color: var(--red); }
.callout-warning form { margin: 0; }
.bubble-hidden summary { cursor: pointer; font-style: italic; color: var(--muted); }
.bubble-hidden[open] summary { margin-bottom: 0.3rem; }

/* Talking to the store from the front page. */
.talk { background: var(--chalk); padding-block: 2.5rem 3rem; }
.talk-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.5rem 3rem; align-items: start; }
.talk-copy p { max-width: 30em; }
.talk-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.25rem, 3vw, 1.75rem); }
.talk-panel .fine { margin: 0.75rem 0 0; }
.contact-form .field-pair { align-items: end; }
.guest-chats { margin-bottom: 1.5rem; }
.guest-chats h2 { font-size: var(--step-0); }
/* A field for programs only: kept out of sight and out of reach for people. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.panel.danger { border-color: #e7b6b2; }
.panel.danger p { font-size: var(--step--1); color: var(--muted); }
form.panel { margin: 0; }

.table-scroll { overflow-x: auto; border-radius: 10px; }
.data { background: #fff; }
.admin-main > .data, .table-scroll > .data { border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; }
.data th, .data td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid #e3e8ee; vertical-align: middle; }
.data thead th { font-size: var(--step--1); color: var(--muted); font-weight: 600; background: #f8f9fb; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tfoot th, .data tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.panel .data th, .panel .data td { padding-inline: 0.4rem; }
.panel .data thead th { background: transparent; }
.data tr.is-hidden td { color: #6b7789; }
.data tr.is-hidden a { color: #4f6380; }
.data tr.is-warning td { background: #fdf7e8; }
.data .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; letter-spacing: 0.03em; }
.message-body { white-space: pre-wrap; max-width: 28rem; overflow-wrap: anywhere; }

.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar input[type="search"] { width: min(22rem, 100%); }
.toolbar input[type="date"], .toolbar select { width: auto; }
.toolbar label { font-weight: 600; }

.low-list { list-style: none; margin: 0; padding: 0; }
.low-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid #e3e8ee; }
.low-list li:last-child { border-bottom: 0; }

.editor { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
.side { min-width: 0; }
.editor > div > .panel { margin-top: 1.5rem; }

/* Merchandise editor */
.section-fieldset { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0 0; padding: 1.25rem 0 0; min-width: 0; }
.section-fieldset > legend { padding: 0; float: left; width: 100%; margin-bottom: 0.4rem; }
.section-fieldset > legend + * { clear: both; }
.section-fieldset > legend h2 { margin: 0; }
.option-block { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-top: 1rem; background: #fbfcfd; }
.option-head { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 1rem; align-items: end; }
.option-head .field { margin-bottom: 0.75rem; }
.remove-option { margin-bottom: 1.1rem; font-size: var(--step--1); }
.option-block.is-removed { opacity: 0.55; }
.choice-table tr.is-removed input:not([type="checkbox"]) { text-decoration: line-through; color: var(--muted); }
.option-block [data-add-choice] { margin-top: 0.6rem; }
.add-option { margin-top: 1rem; }
.new-option-hint { margin: 1rem 0 0; }
#stock-modes .option.block { align-items: flex-start; }
#stock-modes .option input[type="radio"] { margin-top: 0.25rem; }
.presale-notes { margin-top: 0.75rem; }
.unlimited-note { display: none; }
.stock-section.is-unlimited .unlimited-note { display: block; font-weight: 600; color: var(--gold-ink); }
.stock-section.is-unlimited #stock-tables { opacity: 0.45; }
.choice-table { width: 100%; border-collapse: collapse; }
.choice-table th { font-size: var(--step--1); color: var(--muted); font-weight: 600; text-align: left; padding: 0 0.5rem 0.3rem 0; }
.choice-table td { padding: 0.25rem 0.5rem 0.25rem 0; }
.choice-table td:last-child, .choice-table th:last-child { width: 4.5rem; text-align: center; }
.choice-table input { padding: 0.45em 0.6em; }
.new-row input::placeholder { color: #7d899b; }
.confirm-box { background: var(--red-soft); border-radius: 6px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; }

.stock-grid, .stock-list { border-collapse: collapse; }
.stock-grid th, .stock-grid td, .stock-list th, .stock-list td { padding: 0.3rem 0.6rem 0.3rem 0; text-align: left; }
.stock-grid thead th { font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.stock-grid tbody th, .stock-list th { font-weight: 600; padding-right: 1rem; white-space: nowrap; }
.stock-grid input.qty, .stock-list input.qty { width: 5.5rem; padding: 0.4em 0.5em; }
.stock-grid td { vertical-align: top; }
.stock-grid td small { display: block; margin-top: 0.15rem; white-space: nowrap; }
.stock-grid caption { caption-side: top; text-align: left; font-weight: 600; color: var(--navy); padding: 0.9rem 0 0.3rem; }
.table-scroll + .table-scroll { margin-top: 0.25rem; }

.icon-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.icon-option { position: relative; cursor: pointer; }
.icon-option input { position: absolute; opacity: 0; inset: 0; }
.icon-option > span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 8px; background: var(--chalk); color: var(--navy); border: 2px solid transparent; }
.icon-option:hover > span { border-color: var(--line); }
.icon-option input:checked + span { border-color: var(--navy); background: var(--gold-soft); }
.icon-option input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.current-image { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }

.history { list-style: none; margin: 0; padding: 0; max-height: 28rem; overflow: auto; }
.history li { display: flex; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid #e3e8ee; font-size: var(--step--1); }
.delta { flex: none; width: 3rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: #2f7d4b; }
.delta.down { color: var(--red); }

.inline-form { display: flex; gap: 0.4rem; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input { max-width: 16rem; }
.narrow-panel { max-width: 760px; }
.inline-add { margin-top: 1.5rem; }

.pager { display: flex; gap: 1.5rem; align-items: center; justify-content: center; margin-top: 1.25rem; }

.status-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.status-actions form { margin: 0; }
.stack-actions { display: grid; gap: 0.6rem; justify-items: start; }
.stack-actions form { margin: 0; }

.counter { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1.5rem; align-items: start; }
.counter-items h2 { margin-bottom: 0.75rem; }
.counter-buyer { position: sticky; top: 1rem; }
.qty-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.qty-cell { display: grid; gap: 0.2rem; font-size: var(--step--1); font-weight: 600; }
.qty-cell input.qty { width: 4.4rem; padding: 0.4em 0.5em; }
.qty-cell.is-out { opacity: 0.5; }

.settings { display: grid; gap: 1.25rem; max-width: 900px; }
.settings .form-panel h2 { font-size: var(--step-1); }
.sticky-actions { position: sticky; bottom: 0; background: var(--admin-page); padding: 0.75rem 0; margin: 0; border-top: 1px solid var(--line); }
.test-message { max-width: 900px; margin-top: 1.5rem; }

/* Sales report bars: one hue for one measure, thin, rounded at the data end. */
svg.bar { display: block; margin-top: 0.35rem; }
svg.bar rect { fill: var(--navy-2); }

/* Small screens ----------------------------------------------------------- */

@media (max-width: 900px) {
  .blazer-row { grid-template-columns: 1fr; justify-items: start; }
  .pocket { width: min(240px, 60vw); }
  .product, .checkout, .account, .editor, .counter, .talk-row { grid-template-columns: 1fr; }
  .summary, .counter-buyer { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav-group { flex-direction: row; padding: 0; }
  .admin-nav-group + .admin-nav-group { border-top: 0; border-left: 1px solid var(--line); }
  .admin-nav a { border-left: 0; border-bottom: 4px solid transparent; padding: 0.75rem 1rem; white-space: nowrap; }
  .admin-nav a[aria-current="page"] { border-bottom-color: var(--gold); }
}

@media (max-width: 640px) {
  html { font-size: 100%; }
  h1 { font-size: var(--step-3); }
  .brand-name { font-size: var(--step-0); }
  .site-nav { gap: 0.4rem 1rem; width: 100%; }
  .search, .search input { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; }
  .tile-name { font-size: var(--step-0); }
  .field-pair, .option-head { grid-template-columns: 1fr; }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr { border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
  .lines td { border: 0; padding: 0.2rem 0; text-align: left; }
  .lines .num { text-align: left; }
  .lines tfoot tr { display: flex; justify-content: space-between; border: 0; }
  .lines tfoot th, .lines tfoot td { display: block; width: auto; }
  .bubble { max-width: 90%; }
  .chat-log { height: 55vh; }
  .admin-header-links a.who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pocket { animation: none; }
}

@media (forced-colors: active) {
  .choice input:checked + span, .icon-option input:checked + span { outline: 3px solid CanvasText; }
  svg.bar rect { fill: CanvasText; }
}
