/* Brand tokens: see the Red 5 Crafts brand guide. Colours come from the logo. */
:root {
  --brand: #c4332a;        /* red-5: the 5 in the logo */
  --brand-dark: #9a271f;   /* red-5-deep */
  --accent: #458fc1;       /* sky: the logo's sunburst blue */
  --accent-ink: #2d6a96;   /* sky-ink: blue for small text */
  --banner: #cfe4f3;       /* sky-banner */
  --cream: #f6e7cc;
  --ink: #2e1513;
  --muted: #6b5450;
  --bg: #f3f8fc;           /* sky-50: faded blue page background */
  --card: #ffffff;
  --line: #dbe7f0;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Segoe Print", cursive;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--brand); }
header.site { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--banner); position: sticky; top: 0; z-index: 5; }
header.site .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
header.site .brand img { height: 56px; width: 56px; display: block; }
header.site { border-bottom: 3px solid var(--accent); }
.basket-link { background: var(--card); }
.basket-link { text-decoration: none; font-weight: 600; padding: 8px 14px; border: 2px solid var(--brand); border-radius: 999px; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-family: var(--font-display); font-weight: 700; margin: 0 0 8px; text-wrap: balance; }
.lede { color: var(--muted); margin: 0 0 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.product { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.product img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--cream); }
.product .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.filters button { background: transparent; color: var(--ink); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.filters button[aria-pressed="true"] { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.category { margin-bottom: 36px; }
.category h2.cat-title { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 4px; }
.category .cat-desc { color: var(--muted); margin: 0 0 14px; }
.tag { align-self: flex-start; font-family: var(--font-hand); font-size: 1.15rem; line-height: 1; font-weight: 600; color: var(--ink); background: var(--cream); border-radius: 999px; padding: 4px 10px 2px; }
.product h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0; }
.product p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.price { font-weight: 700; }
button, .button { font: inherit; font-weight: 600; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button:hover, .button:hover { background: var(--brand-dark); }
button:disabled { background: #c9b3a8; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qty { width: 60px; padding: 6px; font: inherit; }
.total-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.notice { padding: 12px 14px; border-radius: 8px; background: #fdecea; color: #7a1c15; margin: 12px 0; }
footer.site { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; background: var(--banner); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
@media (max-width: 600px) { .hide-sm { display: none; } }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.5rem; font-weight: 700; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button[aria-pressed="false"] { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.order { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; }
.order ul { margin: 0; padding-left: 18px; }
.order address { font-style: normal; white-space: pre-line; }
@media (max-width: 700px) { .order { grid-template-columns: 1fr; } }

.admin-nav { display: flex; gap: 6px; }
.admin-nav a { text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 999px; color: var(--ink); }
.admin-nav a[aria-current="page"] { background: var(--ink); color: #fff; }

/* Admin: stock */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.stock-row { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.stock-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--cream); }
.stock-row .meta { color: var(--muted); font-size: .9rem; }
.badge { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.on { background: #e3f1fb; color: #1d5f93; }
.badge.sold { background: var(--cream); color: var(--muted); }
.badge.hidden { background: #fdecea; color: #7a1c15; }
.type-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(43, 29, 26, .5); }
dialog form { padding: 20px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-family: var(--font-display); }
label.field { display: grid; gap: 4px; font-weight: 600; }
label.field input, label.field select, label.field textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
label.check { display: flex; gap: 8px; align-items: center; }
.photo-pick { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.photo-pick img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--cream); }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.form-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
button.danger { background: transparent; color: #7a1c15; border: 2px solid #e9b9b4; }
@media (max-width: 600px) { .stock-row { grid-template-columns: 56px 1fr; } .stock-row img { width: 56px; height: 56px; } }

/* Shop: search and photo zoom */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shop-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 24px; }
.shop-tools .filters { margin: 0; }
.search input { font: inherit; width: min(320px, 100%); padding: 9px 14px 9px 38px; border: 2px solid var(--line); border-radius: 999px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b5450' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m12.5 12.5 4 4'/%3E%3C/svg%3E") no-repeat 13px center; color: var(--ink); }
.search input:focus { outline: none; border-color: var(--accent); }
.search { flex: 1 1 240px; max-width: 320px; }
.search input { width: 100%; }
.zoom-btn { all: unset; display: block; cursor: zoom-in; }
.zoom-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.zoom-btn img { display: block; }
dialog.zoom-view { width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 14px; background: var(--card); overflow: hidden; }
dialog.zoom-view::backdrop { background: rgba(46, 21, 19, .75); }
.zoom-frame { overflow: hidden; background: var(--cream); }
.zoom-frame img { display: block; width: 100%; max-height: calc(100vh - 100px); object-fit: contain; cursor: zoom-in; transition: transform .2s ease; }
.zoom-frame img.magnified { transform: scale(2.5); cursor: zoom-out; }
.zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; font-family: var(--font-display); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .zoom-frame img { transition: none; } }
footer.site p { margin: 0; }
footer.site .credit { margin-top: 6px; }
footer.site .credit a { color: var(--accent-ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
footer.site .credit a:hover { text-decoration: underline; }
footer.site .credit img { width: 28px; height: 28px; }
