/* Custode Instruments – site styles. Palette taken from lab-bench materials:
   enamel white, slate instrument housings, inspection-tag green. */
:root {
  --paper: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #17252C;
  --steel: #56676F;
  --rule: #CFD8D7;
  --tested: #2C6A4C;
  --tested-tint: #E3EFE8;
  --hold: #9A620E;
  --hold-tint: #F6ECDA;
  --sold: #8A3B2F;
  --wa: #1F7A4D;
  --focus: #1D5FA8;
  --brand: #475152;          /* Custode charcoal */
  --brand-accent: #F4A42B;   /* Custode orange: logo and accents only, never text on white */
  --radius: 3px;
  --font: 'Archivo', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--tested); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-stretch: 82%; font-weight: 700; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.005em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.preview-bar { background: var(--hold-tint); color: #5a3a07; text-align: center; font-size: .85rem; padding: 6px 16px; border-bottom: 1px solid #E5D3AE; }

/* Header */
.site-head { background: var(--brand); border-bottom: 3px solid var(--brand-accent); }
.site-head nav a { color: #fff; }
.site-head nav a[aria-current="page"] { text-decoration-color: var(--brand-accent); }
.brand-logo { display: block; height: 48px; width: auto; }
.site-head nav { margin-left: auto; }
/* Mobile: one slim bar – CI mark left, WhatsApp right, menu links on a compact second line */
@media (max-width: 600px) {
  .site-head .head-row { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "brand . wa" "nav nav nav"; align-items: center; row-gap: 4px; min-height: 0; padding-block: 8px 6px; }
  .site-head .brand { grid-area: brand; }
  .site-head .head-wa { grid-area: wa; }
  .site-head nav { grid-area: nav; margin-left: 0; gap: 22px; font-size: .95rem; }
  .brand-logo { height: 40px; }
}
.brand-mark-img { display: block; height: 36px; width: 36px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-stretch: 85%; font-size: 1.2rem; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 50%; font-size: 1rem; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { text-decoration: none; font-weight: 500; }
nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2b3d46; }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #17603c; border-color: #17603c; color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-lg { width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn-ghost { border-color: var(--rule); }

/* Asset tag – the product reference, styled like an inspection label */
.tag { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--surface); font-variant-numeric: tabular-nums; }
.status { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.status-ok { background: var(--tested-tint); color: var(--tested); }
.status-hold { background: var(--hold-tint); color: var(--hold); }
.status-sold { background: #F3E1DD; color: var(--sold); }

/* Intro */
.intro { background: var(--surface); border-bottom: 1px solid var(--rule); }
.intro-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding-block: 56px; }
.lede { font-size: 1.2rem; color: var(--steel); }
.intro-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.spotlight { position: relative; display: block; text-decoration: none; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: #E4EAE9; }
.spotlight img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.spot-label { position: absolute; left: 16px; bottom: 16px; right: 16px; display: grid; gap: 4px; background: rgba(255,255,255,.96); border: 1.5px solid var(--ink); border-radius: 2px; padding: 12px 14px; max-width: 360px; }
.spot-label .tag { justify-self: start; }
.spot-title { font-weight: 700; font-stretch: 85%; font-size: 1.1rem; }
.spot-test { color: var(--tested); font-size: .9rem; }
.spot-price { font-weight: 600; }

/* Blocks & grid */
.block { padding-block: 40px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); display: flex; flex-direction: column; }
.card-media { position: relative; display: block; background: #E4EAE9; border-bottom: 1px solid var(--rule); }
.card-media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.ph-note { position: absolute; left: 10px; top: 10px; font-size: .75rem; background: rgba(255,255,255,.9); padding: 2px 6px; border-radius: 2px; color: var(--steel); }
.card-body { padding: 14px 16px 18px; display: grid; gap: 6px; align-content: start; }
.card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card h3 { margin: 4px 0 0; }
.card h3 a { text-decoration: none; }
.card-sub { color: var(--steel); font-size: .9rem; margin: 0; }
.card-text { margin: 0; font-size: .95rem; }
.price { font-weight: 700; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.price-lg { font-size: 1.5rem; margin: 6px 0 16px; }
.cat-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cat-list a { display: inline-block; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); text-decoration: none; }
.empty { background: var(--surface); border: 1px dashed var(--rule); padding: 20px; border-radius: var(--radius); }

/* Filters */
.filters { display: grid; grid-template-columns: 1fr 260px auto auto; gap: 12px; align-items: end; margin: 16px 0 8px; }
.filters label span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); padding: 10px 12px; min-height: 44px; border: 1.5px solid #AEBBBC; border-radius: var(--radius); background: var(--surface); }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.clear { align-self: center; }
.count { color: var(--steel); }

/* Product page */
.crumbs { color: var(--steel); font-size: .9rem; }
.product-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.g-main { margin: 0; background: #E4EAE9; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; position: relative; }
.g-main[data-gallery] { touch-action: pan-y; }
.g-main[data-gallery]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.g-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(23, 37, 44, .62); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.g-nav:hover { background: rgba(23, 37, 44, .82); }
.g-nav:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.g-prev { left: 10px; } .g-next { right: 10px; }
.g-count { position: absolute; right: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(23, 37, 44, .72);
  color: #fff; font-size: .85rem; font-variant-numeric: tabular-nums; }
.g-main img[data-full] { cursor: zoom-in; }
.g-zoom { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 10px;
  border: 0; border-radius: 999px; background: rgba(23, 37, 44, .72); color: #fff; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.g-zoom:hover { background: rgba(23, 37, 44, .88); }
.g-zoom:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* v1.6 full-screen photo viewer */
html.lb-open, html.lb-open body { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 1000; color: #fff; }
.lb::before { content: ''; position: absolute; inset: 0; background: #0C1113; opacity: var(--lb-fade, 1); }
.lb[hidden] { display: none; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: zoom-in; }
.lb-zoomed .lb-stage { cursor: grab; }
.lb-zoomed .lb-stage:active { cursor: grabbing; }
.lb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; transform-origin: center center; will-change: transform;
  -webkit-user-drag: none; -webkit-touch-callout: none; background: #fff; }
.lb-anim { transition: transform .22s ease-out; }
.lb-btn { position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(23, 37, 44, .78); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.lb-btn:hover { background: rgba(44, 58, 64, .95); }
.lb-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-zoomed .lb-prev, .lb-zoomed .lb-next { display: none; }
.lb-count { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px;
  background: rgba(23, 37, 44, .78); font-size: .9rem; font-variant-numeric: tabular-nums; }
.lb-tools { position: absolute; right: 12px; bottom: 16px; display: flex; gap: 10px; }
.lb-tools .lb-btn { position: static; }
.lb-hint { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px;
  background: rgba(23, 37, 44, .78); font-size: .9rem; white-space: nowrap; pointer-events: none; transition: opacity .4s; }
.lb-hint-off { opacity: 0; }
@media (max-width: 600px) { .lb-tools { display: none; } .lb-prev, .lb-next { width: 42px; height: 42px; } }
@media (prefers-reduced-motion: reduce) { .lb-anim, .lb-hint { transition: none; } }
.g-thumb[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.g-main img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fff; }
.g-main figcaption { padding: 8px 12px; font-size: .85rem; color: var(--steel); background: var(--surface); }
.g-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.g-thumb { padding: 0; border: 1.5px solid var(--rule); border-radius: 2px; background: none; cursor: pointer; width: 84px; }
.p-mm { color: var(--steel); }
.facts { display: grid; gap: 0; margin: 24px 0 0; border-top: 1px solid var(--rule); }
.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.p-detail { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; margin-top: 40px; }
.specs { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); }
.specs th, .specs td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.specs th { width: 45%; font-weight: 600; }
.fine { font-size: .85rem; color: var(--steel); margin-top: 8px; }
.notice { background: var(--surface); border-left: 4px solid var(--steel); padding: 10px 14px; border-radius: 2px; }
.notice.warn { border-left-color: var(--hold); background: var(--hold-tint); }
.notice.ok { border-left-color: var(--tested); background: var(--tested-tint); }
.notice.alert { border-left-color: var(--sold); background: #F3E1DD; color: #5c241b; margin-bottom: 16px; }
.alert-text { color: var(--sold); font-size: .85rem; font-weight: 600; }
.prose { max-width: 760px; }

.site-foot { border-top: 3px solid var(--brand-accent); background: var(--brand); margin-top: 40px; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 24px; font-size: .9rem; color: #E6EBEB; }
.foot-row a { color: #fff; }
.foot-legal { display: flex; align-items: center; gap: 12px; margin: 0; }
.foot-mark { flex: none; }
.foot-row a { margin-left: 14px; }

/* Admin */
.is-admin { background: #EEF1F1; }
.adm-head { background: var(--brand); color: #fff; border-bottom: 3px solid var(--brand-accent); }
.adm-head .head-row { min-height: 56px; }
.adm-head a { color: #fff; }
.adm-head nav a { opacity: .85; }
.adm-head nav a[aria-current="page"] { opacity: 1; }
.adm-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); }
.adm-table th, .adm-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; font-size: .95rem; }
.adm-table th { background: #F6F8F8; font-weight: 600; font-size: .85rem; }
.adm-table img { width: 64px; height: 48px; object-fit: cover; border-radius: 2px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: .72rem; padding: 2px 6px; border-radius: 2px; border: 1px solid var(--rule); white-space: nowrap; }
.chip.Published { background: var(--tested-tint); border-color: #b9d6c6; color: var(--tested); }
.chip.Draft { background: var(--hold-tint); border-color: #e5d3ae; color: var(--hold); }
.chip.Removed { color: var(--sold); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field small { display: block; color: var(--steel); margin-top: 4px; font-size: .8rem; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 1.15rem; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.photo-list { display: flex; gap: 12px; flex-wrap: wrap; }
.photo-item { width: 150px; border: 1px solid var(--rule); border-radius: 2px; padding: 6px; background: #fff; font-size: .8rem; }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; margin-bottom: 6px; }
.photo-item form { display: inline; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--sold); text-decoration: underline; cursor: pointer; font: inherit; }
.missing { margin: 0; padding-left: 18px; }
.ch-grid { display: grid; gap: 20px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; min-height: 0; }
.login-box { max-width: 420px; margin: 60px auto; }
.stale { color: var(--hold); font-size: .85rem; }

@media (max-width: 860px) {
  .intro-grid, .product-grid, .p-detail { grid-template-columns: 1fr; gap: 28px; }
  .intro-grid { padding-block: 32px; }
  .filters { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .adm-table .hide-sm { display: none; }
  .facts > div { grid-template-columns: 100px 1fr; }
}
/* Phones: the spotlight photo is too small to carry the label on top, so the label sits under it (v1.1.5). */
@media (max-width: 600px) {
  .spotlight { background: #fff; }
  .spot-label { position: static; max-width: none; border: 0; border-top: 3px solid var(--brand-accent); border-radius: 0; background: #fff; padding: 12px 14px 14px; }
  /* the two home-page actions stack full-width, so both are easy to tap (v1.1.6) */
  .intro-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* v1.1 utility classes (no inline styles: CSP blocks them) */
.mt { margin-top: 24px; }
.mt-sm { margin-top: 12px; }
.scroll-x { overflow-x: auto; }
.inline { display: inline; }
.brand-mark-inv { border-color: #fff; }
.linkbtn-ink { color: var(--ink); }
.file-in { max-width: 340px; }
.model-unconfirmed { color: var(--hold); font-weight: 600; }
.ph-admin { top: auto; bottom: 10px; background: var(--hold-tint); color: var(--hold); }

/* v1.2 product types and stock */
[hidden] { display: none !important; }
.inline-pair { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.stock-nums { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; font-size: 1.05rem; margin: 0 0 4px; }
.stock-nums strong { font-size: 1.35rem; }
.stock-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.stock-form { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; align-content: start; background: var(--surface); }
.stock-form h3 { margin: 0; font-size: 1rem; }
.log-table td, .log-table th { font-size: .85rem; }
.type-tag { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); border: 1px solid var(--rule); border-radius: 2px; padding: 1px 6px; vertical-align: middle; }
.rep-note { font-size: .9rem; color: var(--muted, #5b6566); }
.short-expiry { color: var(--hold); font-weight: 600; }

/* v1.2.1: admin price column keeps "R12 500" on one line; "Also available" is a quieter secondary section. */
.nowrap { white-space: nowrap; }
.also-available h2 { font-size: 1.25rem; }
.also-intro { color: var(--muted, #5b6770); margin: -.25rem 0 1rem; max-width: 60ch; }

/* v1.2.2: cards in a row stretch to equal height and the price sits at the bottom, so prices line up. */
.card-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.card-body > .price { margin-top: auto; padding-top: 6px; }

/* v1.3.0: How We Buy & Sell page – existing typography and colours; sections as readable cards */
.how-intro .wrap { padding-block: 40px 32px; }
.how-intro h1 { margin-bottom: .35em; }
.how-sections { display: grid; gap: 20px; padding-top: 28px; }
.how-sections > * { max-width: 860px; }
.how-block { background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 24px 28px 20px; }
.how-eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin: 0 0 .35em; }
.how-eyebrow::before { content: ""; display: inline-block; width: 18px; height: 3px; background: var(--brand-accent); vertical-align: middle; margin-right: 8px; }
.how-block h2 { margin: 0 0 .6em; }
.how-note { font-size: .92rem; color: var(--steel); font-style: italic; }
.how-cta { margin: 18px 0 4px; }
.how-box { background: var(--tint, #F3F5F4); border-left: 4px solid var(--brand-accent); border-radius: 6px; padding: 14px 18px 6px; margin: 14px 0 6px; }
.how-box h3 { margin: 0 0 .5em; font-size: 1.02rem; }
.how-list { margin: 0 0 .6em; padding-left: 1.2em; }
.how-list li { margin: .45em 0; max-width: 68ch; }
.how-small { font-size: .9rem; color: var(--steel); }
.how-closing { text-align: center; color: var(--steel); font-weight: 600; margin: 12px auto 0; }
@media (max-width: 600px) {
  .how-intro .wrap { padding-block: 28px 20px; }
  .how-block { padding: 18px 18px 14px; }
  .how-cta .btn { width: 100%; }
  .site-head nav { gap: 6px 13px; font-size: .88rem; }
}

/* v1.3.1: the spotlight label sits under the photo on every screen size (as on phones since v1.1.5),
   so the whole instrument stays visible whatever the framing of the main photo. */
.spotlight { background: #fff; }
.spot-label { position: static; max-width: none; border: 0; border-top: 3px solid var(--brand-accent); border-radius: 0; background: #fff; padding: 14px 18px 16px; }

/* v1.3.2: How We Buy & Sell – narrower reading column on desktop (about 65–70 characters per line) */
.how-sections > * { max-width: 760px; }
.how-block p { max-width: 68ch; }
