/* Crux Education shop — layered on top of not-broken.co.uk styles.css v17.
   Only shop-specific layout lives here; colours fall back to the plum/teal palette
   if styles.css doesn't define them. */

:root {
  --shop-plum: #5b2a5e;
  --shop-plum-dark: #431f45;
  --shop-teal: #1f7a78;
  --shop-teal-light: #e3f2f1;
  --shop-ink: #24202a;
  --shop-muted: #5f5866;
  --shop-bg: #faf7fb;
  --shop-card: #ffffff;
  --shop-line: #e6dfe8;
  --shop-radius: 16px;
  --shop-heading: "Nunito", system-ui, sans-serif;
  --shop-body: "Andika", "Open Sans", system-ui, sans-serif;
}

body.shop-page {
  margin: 0;
  font-family: var(--shop-body);
  color: var(--shop-ink);
  background: var(--shop-bg);
  line-height: 1.6;
  font-size: 1.0625rem;
}
.shop-page h1, .shop-page h2, .shop-page h3, .shop-h3 {
  font-family: var(--shop-heading);
  color: var(--shop-plum);
  line-height: 1.25;
}
.shop-page h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: 0 0 .6rem; font-weight: 800; }
.shop-page h2 { font-size: 1.35rem; margin: 1.6rem 0 .5rem; }
.shop-h3 { font-size: 1.15rem; margin: 1.3rem 0 .4rem; }
.shop-page a { color: var(--shop-teal); text-underline-offset: 3px; }
.shop-page a:hover { color: var(--shop-plum); }
.shop-page :focus-visible { outline: 3px solid var(--shop-teal); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: #fff; padding: .6rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shop-wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.shop-main { padding-top: 2rem; padding-bottom: 3rem; min-height: 60vh; }

.shop-testmode { background: #fff3c4; color: #5a4300; text-align: center; padding: .5rem 1rem; font-size: .95rem; }

/* Header */
.shop-header { background: #fff; border-bottom: 1px solid var(--shop-line); }
.shop-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .8rem; padding-bottom: .8rem; }
.shop-brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.shop-brand img { width: 52px; height: 52px; object-fit: contain; }
.shop-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.shop-brand__name { font-family: var(--shop-heading); font-weight: 800; font-size: 1.2rem; color: var(--shop-plum); }
.shop-brand__tag { font-family: var(--shop-heading); font-weight: 700; color: var(--shop-teal); font-size: .95rem; }
.shop-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.shop-nav a { font-family: var(--shop-heading); font-weight: 700; text-decoration: none; color: var(--shop-plum); }
.shop-nav a:hover { text-decoration: underline; }

/* Footer */
.shop-footer { background: var(--shop-plum-dark); color: #f3ecf4; padding: 1.8rem 0; font-size: .95rem; }
.shop-footer a { color: #fff; }
.shop-footer p { margin: .3rem 0; }
.shop-footer__small { opacity: .8; font-size: .88rem; }

/* Cards & grid */
.shop-card { background: var(--shop-card); border: 1px solid var(--shop-line); border-radius: var(--shop-radius); padding: 1.5rem; box-shadow: 0 2px 10px rgba(67, 31, 69, .05); }
.shop-intro { max-width: 720px; margin-bottom: 1.8rem; }
.shop-muted { color: var(--shop-muted); }
.shop-lead { font-size: 1.15rem; }
.shop-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.shop-product { display: flex; flex-direction: column; padding: 1rem; }
.shop-product__link { text-decoration: none; color: inherit; }
.shop-product__img { width: 100%; height: auto; aspect-ratio: 10 / 7; object-fit: cover; border-radius: 12px; background: var(--shop-teal-light); }
.shop-product__name { font-size: 1.2rem !important; margin: .8rem 0 .3rem !important; }
.shop-product__tagline { margin: 0 0 .6rem; flex: 1; }
.shop-product__price { font-family: var(--shop-heading); font-weight: 800; color: var(--shop-teal); margin: 0 0 .8rem; }

/* Product page */
.shop-back { margin: 0 0 1rem; }
.shop-product-page { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .shop-product-page { grid-template-columns: 5fr 6fr; align-items: start; } }
.shop-product-page__media img { width: 100%; height: auto; border-radius: var(--shop-radius); background: var(--shop-teal-light); }
.shop-buybox { margin-top: 1.5rem; }
.shop-price { font-family: var(--shop-heading); font-weight: 800; font-size: 2rem; color: var(--shop-plum); margin: 0 0 1rem; }
.shop-label { display: block; font-family: var(--shop-heading); font-weight: 800; color: var(--shop-plum); margin-bottom: .2rem; }
.shop-hint { font-size: .95rem; color: var(--shop-muted); margin: .2rem 0 .8rem; }
.shop-amount { display: flex; align-items: stretch; max-width: 220px; margin-bottom: 1rem; }
.shop-amount__prefix { display: flex; align-items: center; padding: 0 .8rem; background: var(--shop-teal-light); border: 2px solid var(--shop-line); border-right: 0; border-radius: 10px 0 0 10px; font-weight: 700; font-size: 1.2rem; }
.shop-amount input { flex: 1; min-width: 0; font: inherit; font-size: 1.3rem; padding: .55rem .7rem; border: 2px solid var(--shop-line); border-radius: 0 10px 10px 0; }
.shop-input { display: block; width: 100%; max-width: 420px; box-sizing: border-box; font: inherit; padding: .65rem .8rem; border: 2px solid var(--shop-line); border-radius: 10px; margin-bottom: 1rem; background: #fff; }
.shop-amount input:focus, .shop-input:focus { border-color: var(--shop-teal); outline: none; box-shadow: 0 0 0 3px var(--shop-teal-light); }

.shop-consent { display: flex; gap: .7rem; align-items: flex-start; background: var(--shop-teal-light); border-radius: 12px; padding: .9rem 1rem; margin: .5rem 0; }
.shop-consent input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex: 0 0 auto; accent-color: var(--shop-teal); }
.shop-consent label { font-size: 1rem; }

/* Buttons */
.shop-button { display: inline-block; font-family: var(--shop-heading); font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer;
  padding: .7rem 1.2rem; border-radius: 999px; border: 2px solid var(--shop-plum); background: #fff; color: var(--shop-plum) !important; line-height: 1.2; }
.shop-button:hover { background: var(--shop-plum); color: #fff !important; }
.shop-button--primary { background: var(--shop-plum); color: #fff !important; }
.shop-button--primary:hover { background: var(--shop-plum-dark); border-color: var(--shop-plum-dark); }
.shop-button--small { padding: .35rem .8rem; font-size: .88rem; }
.shop-button--download::before { content: "↓ "; }

/* Messages */
.shop-alert { background: var(--shop-teal-light); border-left: 5px solid var(--shop-teal); padding: .9rem 1.1rem; border-radius: 8px; margin: 0 0 1.2rem; }
.shop-alert p { margin: 0; }
.shop-alert--error { background: #fdecef; border-left-color: #b4234a; }
.shop-message, .shop-thanks, .shop-narrow { max-width: 680px; margin: 0 auto; }
.shop-downloads { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; margin: .5rem 0 1.2rem; }
.shop-hp { position: absolute; left: -9999px; }

/* Prose */
.shop-prose { max-width: 780px; margin: 0 auto; }
.shop-prose li { margin-bottom: .4rem; }

/* Admin */
.shop-filter { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.shop-filter .shop-input { width: auto; margin: 0; }
.shop-table-wrap { overflow-x: auto; }
.shop-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
.shop-table th, .shop-table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--shop-line); vertical-align: top; }
.shop-table th { font-family: var(--shop-heading); color: var(--shop-plum); background: var(--shop-teal-light); }
.shop-table form { margin: 0; }
.shop-tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: #fff3c4; color: #5a4300; }
.shop-tag--warn { background: #fdecef; color: #8a1b39; }
.shop-ok { color: #1c7a3a; font-weight: 800; }
.shop-bad { color: #b4234a; font-weight: 800; }

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

/* ─── Admin: products ─────────────────────────────────────────────────── */
.pa-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pa-head h1 { margin: 0; }
.pa-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.pa-item { display: grid; grid-template-columns: 150px 1fr auto; gap: 1.2rem; align-items: center; padding: 1rem; }
.pa-item img { width: 150px; height: 105px; object-fit: cover; border-radius: 10px; background: var(--shop-teal-light); }
.pa-item h2 { margin: 0 0 .3rem !important; font-size: 1.2rem !important; }
.pa-item p { margin: .2rem 0; }
.pa-item__meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pa-item__link { font-size: .92rem; word-break: break-all; }
.pa-item__actions { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.pa-item__actions form { margin: 0; }
.pa-item__actions .shop-button { width: 100%; text-align: center; }
.pa-item--hidden { opacity: .75; border-style: dashed; }
.pa-tag--live { background: #dff3e5; color: #1c5b30; }
.pa-linkbtn { background: none; border: 0; color: var(--shop-teal); font: inherit; text-decoration: underline; cursor: pointer; padding: 0 .3rem; }
@media (max-width: 640px) {
  .pa-item { grid-template-columns: 1fr; }
  .pa-item img { width: 100%; height: auto; aspect-ratio: 10 / 7; }
  .pa-item__actions { flex-direction: row; }
}

.pa-form { display: flex; flex-direction: column; gap: 1.2rem; }
.pa-section h2 { display: flex; align-items: center; gap: .6rem; margin-top: 0 !important; }
.pa-step { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--shop-plum); color: #fff; font-size: 1rem; flex: 0 0 auto; }
.pa-section .shop-label { margin-top: 1rem; }
.pa-section .shop-input { max-width: 640px; }
.pa-textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
.pa-small { max-width: 8rem !important; }
.pa-url { display: flex; align-items: stretch; max-width: 640px; flex-wrap: wrap; gap: .5rem; }
.pa-url > span { display: flex; align-items: center; color: var(--shop-muted); }
.pa-url input { flex: 1; min-width: 12rem; font: inherit; padding: .6rem .8rem; border: 2px solid var(--shop-line); border-radius: 10px; }
.pa-url--fixed { align-items: center; margin: 0 0 .5rem; }
.pa-choice { border: 0; padding: 0; margin: 0 0 .5rem; display: flex; gap: .8rem; flex-wrap: wrap; }
.pa-option { display: flex; gap: .6rem; align-items: flex-start; border: 2px solid var(--shop-line); border-radius: 12px; padding: .8rem 1rem; cursor: pointer; flex: 1; min-width: 220px; }
.pa-option:has(input:checked) { border-color: var(--shop-teal); background: var(--shop-teal-light); }
.pa-option input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--shop-teal); }
.pa-price--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 1rem; }
.pa-price[hidden] { display: none; }
.pa-span { grid-column: 1 / -1; }
.pa-picture { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.pa-picture img { width: 300px; max-width: 100%; height: auto; aspect-ratio: 10 / 7; object-fit: cover; border-radius: 12px; background: var(--shop-teal-light); border: 1px solid var(--shop-line); }
.pa-picture .shop-label { margin-top: 0; }
.pa-file { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; padding: 1rem; border: 1px solid var(--shop-line); border-radius: 12px; margin-bottom: .8rem; background: #fdfcfe; }
.pa-file .shop-label { margin-top: 0; }
.pa-file .shop-input { margin-bottom: .5rem; }
@media (max-width: 720px) { .pa-file { grid-template-columns: 1fr; } }
.pa-upload { display: block; font-size: .95rem; color: var(--shop-muted); }
.pa-upload input { display: block; margin-top: .3rem; max-width: 100%; }
.pa-check { display: flex; gap: .5rem; align-items: center; font-size: .95rem; margin-top: .5rem; cursor: pointer; }
.pa-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--shop-teal); }
.pa-check--big { font-family: var(--shop-heading); font-weight: 800; font-size: 1.1rem; color: var(--shop-plum); }
.pa-check--big input { width: 1.4rem; height: 1.4rem; }
.pa-error { color: #b4234a; font-weight: 700; margin: .2rem 0 .6rem; }
[aria-invalid="true"] { border-color: #b4234a !important; }
.pa-actions { display: flex; gap: .8rem; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--shop-bg); padding: .8rem 0; border-top: 1px solid var(--shop-line); }
.pa-danger { margin-top: 2rem; border-color: #f0c7d2; }
.pa-danger h2 { color: #8a1b39 !important; font-size: 1.1rem !important; margin-top: 0 !important; }
.pa-delete { border-color: #b4234a !important; color: #b4234a !important; }
.pa-delete:hover { background: #b4234a !important; color: #fff !important; }
.pa-item__actions .shop-button { box-sizing: border-box; }
.pa-actions { box-shadow: 0 -6px 12px rgba(67, 31, 69, .06); z-index: 2; }

/* Keep form fields readable when the device is in dark mode
   (the shop pages are designed light-only). */
html:has(body.shop-page), body.shop-page { color-scheme: light; }
.shop-page input[type="text"], .shop-page input[type="email"], .shop-page input[type="search"],
.shop-page input[type="password"], .shop-page input[type="number"], .shop-page select, .shop-page textarea,
.shop-amount input, .shop-input, .pa-url input {
  background-color: #fff !important;
  color: var(--shop-ink) !important;
  -webkit-text-fill-color: var(--shop-ink);
  caret-color: var(--shop-ink);
}
.shop-page input::placeholder, .shop-page textarea::placeholder { color: #8a8290 !important; -webkit-text-fill-color: #8a8290; }
.shop-page input[type="checkbox"], .shop-page input[type="radio"] { background-color: #fff; color-scheme: light; }
