/* Woolwich Central Trades: "Above all, refreshed".
   The 2014 Woolwich Central brochure brought up to date: brochure charcoal, sky-garden aqua and deep teal, the heart
   logo of bending walkways, Poppins headings (a free cousin of the brochure's Avant Garde) and Atkinson Hyperlegible
   text for older readers. See DESIGN.md. */

/* Same-site navigations (filters, sort, pagination) cross-fade instead of blanking and repainting the whole page.
   Browsers without support simply navigate as before. Form posts (sign-in, reviews, moderation) skip the fade:
   app.js cancels it, so a submitted form doesn't linger on screen looking as if nothing happened. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Fonts are cached for a year (public/_headers). If a font file changes, raise ?v= here and FONT_VERSION in
   src/views/layout.tsx so browsers fetch it again. */
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-400.woff2?v=1") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-400-italic.woff2?v=1") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-700.woff2?v=1") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-500.woff2?v=1") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-600.woff2?v=1") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  /* Brand */
  --charcoal: #3f3f41;      /* brochure charcoal: header and footer band */
  --charcoal-text: #ffffff;
  --charcoal-muted: #cfd0d1;
  --aqua: #9ad8da;          /* sky-garden aqua: decoration and tints only, never text */
  --lime: #d7e04e;          /* logo lime: decoration only */
  /* Page */
  --bg: #f4f9f9;
  --surface: #ffffff;
  --tint: #e8f5f5;
  --text: #2b2b2d;
  --muted: #55595c;
  --border: #cfe2e2;
  --field-border: #9fc9c9;  /* inputs: a step darker than card hairlines */
  --accent: #236660;        /* deep teal: links, buttons, selected state (6.6:1 on white) */
  --accent-hover: #194d48;
  --accent-text: #ffffff;
  --accent-soft: #e2f1f0;
  /* Verdicts: text and tint pairs, plus solid bar colours */
  --yes: #1d6640;   --yes-bg: #e1f3e8;   --yes-bar: #2f8a5a;
  --maybe: #6b4f00; --maybe-bg: #fbf0d0; --maybe-bar: #d9a92b;
  --no: #9b2a1c;    --no-bg: #fbe2dd;    --no-bar: #c8432f;
  --danger: #9b2a1c;
  --warn-bg: #fdf3d7;
  --ok-bg: #e1f3e8;
  --focus: #236660;
  --header-focus: #d7e04e;
  /* Type */
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", "Atkinson Hyperlegible", system-ui, sans-serif;
  /* Shape */
  --radius: 12px;
  --radius-sm: 8px;
  /* The caret is an image, so it can't read var(--muted): its stroke repeats that colour, here and in the dark
     theme below. Change them together. */
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2355595c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --charcoal: #2b2b2d;
    --charcoal-muted: #b9babb;
    --bg: #1b1c1e;
    --surface: #252628;
    --tint: #203332;
    --text: #eef1f1;
    --muted: #b4b9bb;
    --border: #3a3e41;
    --field-border: #4b5558;
    --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23b4b9bb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --accent: #8fd3cf;
    --accent-hover: #b4e4e1;
    --accent-text: #10302d;
    --accent-soft: #1f3533;
    --yes: #95d9ad;   --yes-bg: #1c3426;   --yes-bar: #4caf78;
    --maybe: #f0c86a; --maybe-bg: #3a3020; --maybe-bar: #d9a92b;
    --no: #ff9f92;    --no-bg: #3e2420;    --no-bar: #e0614d;
    --danger: #ff9f92;
    --warn-bg: #3a3020;
    --ok-bg: #1c3426;
    --focus: #d7e04e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.55 var(--font-body);
}

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 34rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.7rem; margin: 1.4rem 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 0.6rem; }
h3 { font-size: 1.125rem; margin: 0 0 0.25rem; font-weight: 500; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Header: the brochure's charcoal band with the heart logo. */
.site-header { background: var(--charcoal); color: var(--charcoal-text); }
.site-header a:focus-visible { outline-color: var(--header-focus); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 12px; padding-bottom: 10px; }
.brand-block { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-block:hover { color: inherit; }
.logo { width: 44px; height: 40px; flex: none; }
.brand { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; line-height: 1.2; }
.strapline { display: block; font-size: 0.85rem; color: var(--charcoal-muted); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
.site-header nav a {
  color: var(--charcoal-text); text-decoration: none; font-weight: 700; font-size: 1rem;
  padding: 8px 0 6px; border-bottom: 3px solid transparent;
}
.site-header nav a:hover { border-bottom-color: var(--charcoal-muted); color: var(--charcoal-text); }
.site-header nav a[aria-current="page"] { border-bottom-color: var(--aqua); }

/* The walkway: two lines from the logo bending out from under the header. Decorative only. */
.walkway {
  height: 18px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 18' preserveAspectRatio='none'%3E%3Cpath d='M0 3H520C580 3 590 15 650 15H1200' stroke='%239ad8da' stroke-width='3' fill='none'/%3E%3Cpath d='M0 9H470C530 9 545 18 600 18' stroke='%23d7e04e' stroke-width='3' fill='none'/%3E%3C/svg%3E")
    center top / 100% 18px no-repeat,
    var(--charcoal);
}

.site-footer { color: var(--muted); font-size: 0.875rem; padding-top: 28px; padding-bottom: 36px; }

.lead { font-size: 1.125rem; color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: -4px 0 4px; }
.optional { font-weight: 400; color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
}
.panel.highlight { border-color: var(--accent); background: var(--accent-soft); }
.panel > h2:first-child { margin-top: 0; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > select, .row > input { flex: 1 1 10rem; }

label { font-weight: 700; }
label.choice { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; margin-right: 16px; min-height: 44px; }
fieldset { border: 0; padding: 0; margin: 8px 0 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  min-height: 48px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="radio"], input[type="checkbox"] { width: 1.3rem; height: 1.3rem; min-height: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
/* Draw our own caret so it sits inside the padding (the native one hugs the right edge). The caret is 12px wide
   with --select-caret-inset of space on each side; a smaller select only needs to change the inset. */
select {
  --select-caret-inset: 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right var(--select-caret-inset) center;
  background-size: 12px 8px;
  padding-right: calc(var(--select-caret-inset) * 2 + 12px);
}
/* High Contrast mode drops background images, which would leave selects with no arrow: use the native one. */
@media (forced-colors: active) {
  select { appearance: auto; -webkit-appearance: auto; background-image: none; }
}
.code-input { font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; max-width: 12rem; }
.narrow-input { max-width: 5rem; flex: 0 0 5rem !important; }

.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  min-height: 48px;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.button.secondary { background: var(--surface); color: var(--accent); }
.button.secondary:hover { background: var(--accent-soft); color: var(--accent-hover); }
.small-button { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }
.link-button {
  font: inherit; background: none; border: 0; padding: 4px 0; color: var(--accent);
  text-decoration: underline; cursor: pointer; min-height: 0; width: auto;
}
.danger { color: var(--danger); }

.notice { background: var(--ok-bg); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.errors { background: var(--warn-bg); border: 1.5px solid var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; }
.errors p { margin: 0; font-weight: 700; color: var(--danger); }
.errors ul { margin: 4px 0; padding-left: 20px; }

/* Directory */
.hero { padding-top: 2px; }
.hero h1 { margin-top: 1rem; }
.search { display: flex; gap: 8px; }
.search > input { flex: 1 1 auto; min-width: 0; }

.chips { display: flex; gap: 8px; margin: 12px -16px 0; padding: 0 16px 4px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; background: var(--tint); color: var(--accent); border: 1.5px solid transparent; border-radius: 999px;
  padding: 7px 14px; text-decoration: none; font-size: 1rem; font-weight: 700; white-space: nowrap;
}
.chips a:hover { border-color: var(--accent); }
.chips a[aria-current] { background: var(--accent); color: var(--accent-text); }

.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 10px; }
.results-heading { font-family: var(--font-body); font-size: 1rem; color: var(--muted); font-weight: 700; margin: 0; }
.sort-form { display: flex; gap: 6px; align-items: center; }
.sort-form select { --select-caret-inset: 12px; width: auto; min-height: 40px; padding-block: 6px; padding-left: 12px; font-size: 1rem; }

.add-cta { margin-top: 24px; }
.add-cta p { margin: 0 0 12px; }

.cards, .reviews, .plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.card, .review {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.card p, .review p { margin: 4px 0; }
.card h3 a { text-decoration: none; color: var(--text); }
.card-link { position: relative; }
.card-link:hover { border-color: var(--accent); }
.card-link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link h3 a:focus-visible { outline: none; }
.card-link h3 a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.card-link:hover h3 a { color: var(--accent); }
.card-actions { margin-top: 10px !important; }
.card-call { position: relative; z-index: 1; }
.category { color: var(--muted); }
.empty { color: var(--muted); }

/* "Would you use them again?" */
.verdict { display: inline-flex; gap: 4px; align-items: baseline; border-radius: 6px; padding: 2px 9px; font-weight: 700; font-size: 0.875rem; white-space: nowrap; }
.verdict-yes { color: var(--yes); background: var(--yes-bg); }
.verdict-maybe { color: var(--maybe); background: var(--maybe-bg); }
.verdict-no { color: var(--no); background: var(--no-bg); }

.rating-summary { margin: 6px 0; }
.rating-summary p { margin: 0; }
.rating-headline { font-size: 1.125rem; }
.verdict-bar { display: flex; gap: 3px; height: 8px; margin: 6px 0 8px; max-width: 22rem; }
.verdict-bar span { flex: 1 1 0; border-radius: 999px; }
.seg-yes { background: var(--yes-bar); }
.seg-maybe { background: var(--maybe-bar); }
.seg-no { background: var(--no-bar); }
.verdict-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-block; background: var(--accent-soft); border-radius: 6px;
  padding: 3px 9px; font-size: 0.875rem;
}
.badge-warn { background: var(--warn-bg); }

/* Listing */
.listing-head h1 { margin-bottom: 4px; }
.contact h2 { margin-top: 0; }
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; word-break: break-word; }

.review.is-hidden { opacity: 0.7; border-style: dashed; }
.review-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.review-title { font-family: var(--font-body); font-weight: 700; font-size: 1.125rem; margin: 0; text-wrap: pretty; }
.review-text { white-space: pre-line; }
.review-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0; font-size: 0.9rem; }
.review-meta div { display: flex; gap: 4px; }
.review-meta dt { color: var(--muted); }
.review-meta dt::after { content: ":"; }
.review-meta dd { margin: 0; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.actions-inline form { margin: 0; }

details.report summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 6px 0; }
details.report[open] { flex-basis: 100%; }

/* Review form */
.verdict-input { display: flex; flex-direction: column; gap: 8px; }
.verdict-option {
  display: flex; align-items: center; gap: 12px; font-weight: 400;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; background: var(--surface);
}
.verdict-option strong { font-weight: 700; }
.verdict-option-yes:has(input:checked) { border-color: var(--yes-bar); background: var(--yes-bg); }
.verdict-option-maybe:has(input:checked) { border-color: var(--maybe-bar); background: var(--maybe-bg); }
.verdict-option-no:has(input:checked) { border-color: var(--no-bar); background: var(--no-bg); }
.option-hint { display: block; color: var(--muted); font-size: 0.9rem; }

.when-options { display: flex; flex-direction: column; gap: 8px; }
.choice-box {
  display: flex; align-items: center; gap: 12px; font-weight: 400; min-height: 48px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; background: var(--surface);
}
.choice-box:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.when-earlier { margin-top: 8px; }
.choice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.when:not(:has(input[value="earlier"]:checked)) .when-earlier { display: none; }

.welcome { margin-top: 20px; }
.welcome h2 { margin-top: 0; }
.welcome p { margin: 0 0 10px; }

.listing-foot { margin-top: 24px; }

/* Moderation */
.stats { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 12px; }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stats strong { display: block; font-family: var(--font-display); font-size: 1.5rem; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 0.9rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }

.copy-field { font-family: ui-monospace, monospace; font-size: 0.85rem; margin-bottom: 8px; }

@media (min-width: 40rem) {
  h1 { font-size: 2rem; }
  .chips { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding: 0; }
}

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