/* =================================================================
   Shared styles for the website and the admin.
   -----------------------------------------------------------------
   Nothing in this file contains a colour, font or corner radius of
   its own. Those all come from the "theme" in src/site.config.ts,
   which the pages turn into the CSS variables used below.
   To re-brand for another business, change the theme, not this file.
   ================================================================= */

/* The font is served from this website, so visitors' details are not sent to a font provider.
   Figtree, SIL Open Font License: see fonts/Figtree-LICENSE.txt. To use another font, replace the
   file and the name here, and set fontBody in the theme. Delete this block to use the phone's own font. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--colour-text);
  background: var(--colour-page);
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }

h1, h2, h3 { font-family: var(--font-heading); }

a { color: var(--colour-brand); }
a:hover { color: var(--colour-text); }

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

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

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

.container { max-width: 1080px; margin: 0 auto; padding-inline: 20px; }
.container--narrow { max-width: 720px; padding-inline: 16px; }

.plain-list { list-style: none; padding: 0; }

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

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border: 2px solid transparent; border-radius: var(--radius-pill);
  font: inherit; font-size: 18px; font-weight: 800; line-height: 1.2;
  text-align: center; text-decoration: none; cursor: pointer;
}
.button svg { flex: none; }

.button--primary { background: var(--colour-brand); color: var(--colour-on-brand); }
.button--primary:hover { background: var(--colour-brand-hover); color: var(--colour-on-brand); }

.button--dark { background: var(--colour-dark); color: var(--colour-on-dark); }
.button--dark:hover { background: var(--colour-brand-hover); color: var(--colour-on-dark); }

.button--secondary { background: var(--colour-surface); color: var(--colour-brand); border-color: var(--colour-brand); }
.button--secondary:hover { background: var(--colour-brand-soft); color: var(--colour-text); }

.button--danger { background: var(--colour-surface); color: var(--colour-danger); border-color: var(--colour-danger); }
.button--danger:hover { background: var(--colour-danger-bg); color: var(--colour-danger); }

.button--on-dark { background: transparent; color: var(--colour-on-dark); border-color: var(--colour-on-dark-link); }
.button--on-dark:hover { background: var(--colour-on-dark); color: var(--colour-dark); }

.button--large { min-height: 60px; font-size: 19px; }
.button--small { min-height: 44px; padding: 0 16px; font-size: 16px; font-weight: 700; }
.button--full { width: 100%; }

/* Text-only button that still has a 44px tap area (Delete) */
.button--text-danger {
  min-height: 44px; padding: 0 10px; background: transparent; border-color: transparent;
  color: var(--colour-danger); font-size: 16px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
.button--text-danger:hover { background: var(--colour-danger-bg); color: var(--colour-danger); }

.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
  gap: 8px;
}
.button-row form { margin: 0; }
.button-row .button { padding-inline: 8px; font-size: 16px; }

/* ---------- Notices ---------- */

.notice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border: 2px solid; border-radius: var(--radius-card);
  font-size: 17px;
}
.notice svg { flex: none; margin-top: 1px; }
.notice p { margin: 0; }

.notice--good { background: var(--colour-good-bg); border-color: var(--colour-good-border); color: var(--colour-good-text); }
.notice--info { background: var(--colour-brand-soft); border-color: var(--colour-brand); color: var(--colour-text); align-items: center; }
.notice--info a { font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }

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

.form { display: flex; flex-direction: column; gap: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label,
.fieldset legend { font-size: 16px; font-weight: 700; }

.input {
  width: 100%; min-height: 52px; padding: 0 16px;
  font: inherit; color: var(--colour-text);
  background: var(--colour-field-bg);
  border: 2px solid var(--colour-field-border);
  border-radius: var(--radius-field);
}
textarea.input { min-height: 120px; padding: 12px 16px; resize: vertical; }
.input--postcode { text-transform: uppercase; }

.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset legend { padding: 0; margin-bottom: 10px; }

.choices { display: flex; flex-wrap: wrap; gap: 10px; }

.choice {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 18px 0 14px;
  background: var(--colour-field-bg);
  border: 2px solid var(--colour-choice-border);
  border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.choice input { width: 22px; height: 22px; margin: 0; accent-color: var(--colour-brand); }
.choice:has(input:checked) { background: var(--colour-brand-soft); border-color: var(--colour-brand); }

.form-small-print { font-size: 16px; color: var(--colour-text-muted); text-align: center; }

/* =================================================================
   PUBLIC WEBSITE
   ================================================================= */

.site-header { background: var(--colour-surface); border-bottom: 1px solid var(--colour-line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.site-header .button { white-space: nowrap; }

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--colour-text); font-size: 18px; font-weight: 800; line-height: 1.2; text-decoration: none;
}
.brand svg { flex: none; color: var(--colour-brand); }
.brand:hover { color: var(--colour-text); }

/* Hero */
.hero__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 28px; align-items: center;
  padding-block: 36px 40px;
}
.hero__text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero h1 {
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance;
}
.hero__lead { font-size: 18px; color: var(--colour-text-muted); text-wrap: pretty; }
.hero .button { box-shadow: 0 6px 18px var(--colour-brand-shadow); }

/* Before-and-after photo spaces.
   When photos exist, put an <img> inside each .photo-slot; it fills the space. */
.photos {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  padding: 8px; background: var(--colour-surface);
  border-radius: var(--radius-panel); box-shadow: 0 10px 30px var(--colour-shadow);
}
.photo-slot {
  position: relative; overflow: hidden;
  min-height: 220px; padding: 14px;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--colour-photo-bg);
  border: 2px dashed var(--colour-photo-border);
  border-radius: var(--radius-card);
}
.photo-slot--after { background: var(--colour-page); }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot__label {
  position: relative;
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px;
  background: var(--colour-dark); color: var(--colour-on-dark);
  border-radius: var(--radius-pill); font-size: 16px; font-weight: 700;
}
.photo-slot--after .photo-slot__label { background: var(--colour-brand); color: var(--colour-on-brand); }

/* What we clean */
.section__inner { display: flex; flex-direction: column; gap: 18px; padding-block: 20px 44px; }
.section h2,
.panel h2 { font-size: 28px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }

.service-list {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 10px;
}
.service {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 8px 12px 8px 20px;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.service__name { font-size: 18px; font-weight: 700; }
.price-tag {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  background: var(--colour-brand-soft); border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 700; white-space: nowrap;
}
.small-print { max-width: 640px; font-size: 16px; color: var(--colour-text-muted); text-wrap: pretty; }

/* Quote form */
.quote { padding-bottom: 48px; }
.quote .container { max-width: 720px; padding-inline: 12px; }
.panel {
  display: flex; flex-direction: column; gap: 20px;
  padding: 28px 18px 30px;
  background: var(--colour-surface); border-radius: var(--radius-panel);
  box-shadow: 0 10px 30px var(--colour-shadow);
}

/* Footer */
.site-footer { background: var(--colour-dark); color: var(--colour-on-dark); }
.site-footer__inner { display: flex; flex-direction: column; gap: 12px; padding-block: 36px 44px; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--colour-on-dark-link); }
.site-footer a:hover { color: var(--colour-on-dark); }
.footer-name { font-size: 18px; font-weight: 800; }
.footer-contact { display: flex; flex-direction: column; gap: 4px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }

@media (min-width: 600px) {
  .panel { padding: 36px 32px; }
}

@media (min-width: 760px) {
  .site-footer__inner { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; }
  .footer-contact { flex-direction: row; gap: 4px 24px; }
}

/* =================================================================
   ADMIN
   ================================================================= */

.admin-bar { background: var(--colour-dark); color: var(--colour-on-dark); }
.admin-bar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px; }
.admin-bar__title { font-size: 20px; font-weight: 800; }
.admin-bar form { margin: 0; }

.admin-nav { background: var(--colour-surface); border-bottom: 1px solid var(--colour-line); }
.admin-nav ul {
  list-style: none; margin: 0; padding: 10px 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.admin-nav a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 8px;
  background: var(--colour-page); color: var(--colour-text);
  border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.admin-nav a:hover { background: var(--colour-brand-soft); color: var(--colour-text); }
/* The page you are on: filled and underlined, so it does not rely on colour alone */
.admin-nav a[aria-current="page"] {
  background: var(--colour-brand); color: var(--colour-on-brand);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}

@media (min-width: 720px) {
  .admin-nav ul { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.admin-main { display: flex; flex-direction: column; gap: 20px; padding-block: 20px 48px; }
.admin-main h1 { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.admin-main h2 { font-size: 22px; font-weight: 800; line-height: 1.25; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* Status labels: each has its own icon and word, so they never rely on colour alone */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.status svg { flex: none; width: 16px; height: 16px; }
.status--booked { background: var(--colour-status-booked-bg); color: var(--colour-status-booked-text); }
.status--done { background: var(--colour-status-done-bg); color: var(--colour-status-done-text); }
.status--paid { background: var(--colour-status-paid-bg); color: var(--colour-status-paid-text); }
.status--cancelled { background: var(--colour-status-cancelled-bg); color: var(--colour-status-cancelled-text); }

/* Job list (Today, Next 7 days) */
.job-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.job-card {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  grid-template-areas:
    "when name   price"
    "when detail detail"
    "when status status";
  column-gap: 12px; row-gap: 4px;
  padding: 14px 16px;
  background: var(--colour-surface); color: var(--colour-text);
  border: 1px solid var(--colour-line); border-radius: var(--radius-card);
  text-decoration: none;
}
.job-card:hover { border-color: var(--colour-brand); color: var(--colour-text); }
.job-card--cancelled .job-card__name,
.job-card--cancelled .job-card__price { text-decoration: line-through; }
.job-card__when { grid-area: when; display: flex; flex-direction: column; font-weight: 800; font-size: 18px; line-height: 1.25; }
.job-card__day { font-size: 16px; font-weight: 600; color: var(--colour-text-muted); }
.job-card__name { grid-area: name; font-size: 18px; font-weight: 800; line-height: 1.3; }
.job-card__price { grid-area: price; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.job-card__detail { grid-area: detail; font-size: 16px; color: var(--colour-text-muted); }
.job-card__status { grid-area: status; margin-top: 4px; }

/* A job */
.job-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.job-head__when { font-size: 18px; font-weight: 600; color: var(--colour-text-muted); }

.details {
  padding: 4px 16px;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.details__row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--colour-line);
}
.details dt { font-weight: 600; color: var(--colour-text-muted); }
.details dd { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.details dd a { display: inline-flex; align-items: center; min-height: 44px; }
.details__row--to-pay { align-items: baseline; padding: 14px 0 10px; border-bottom: 0; }
.details__row--to-pay dt { font-size: 20px; font-weight: 800; color: var(--colour-text); }
.details__row--to-pay dd { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }

.action-stack { display: flex; flex-direction: column; gap: 12px; }
.action-stack form { margin: 0; }

.box {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.admin-main .box h2 { font-size: 18px; }

.section-break { height: 0; margin: 4px 0; border: 0; border-top: 1px solid var(--colour-line); }

/* Money */
.year-switch { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.year-switch h1 { text-align: center; font-size: 24px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--colour-surface); color: var(--colour-brand);
  border: 2px solid var(--colour-brand); border-radius: var(--radius-pill);
}
.icon-button:hover { background: var(--colour-brand-soft); color: var(--colour-text); }

.takings {
  padding: 16px; text-align: center; font-size: 18px;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.takings strong { font-size: 24px; font-variant-numeric: tabular-nums; }

.table-wrap {
  overflow-x: auto;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.money-table { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.money-table th,
.money-table td { padding: 12px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--colour-line); }
.money-table th:first-child,
.money-table td:first-child { text-align: left; padding-left: 14px; }
.money-table th:last-child,
.money-table td:last-child { padding-right: 14px; }
.money-table thead th { background: var(--colour-brand-soft); font-weight: 800; }
.money-table tbody th { font-weight: 600; }
.money-table tfoot th,
.money-table tfoot td { font-weight: 800; border-top: 2px solid var(--colour-text); border-bottom: 0; }

.entry-list {
  list-style: none; padding: 0;
  background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card);
}
.entry {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px;
  padding: 8px 6px 8px 16px; border-bottom: 1px solid var(--colour-line);
}
.entry:last-child { border-bottom: 0; }
.entry form { margin: 0; }
.entry__date { display: block; font-weight: 700; }
.entry__type { display: block; font-size: 16px; color: var(--colour-text-muted); }
.amount { font-size: 18px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount--in { color: var(--colour-good-text); }
.amount--out { color: var(--colour-danger); }


/* =================================================================
   EXTRAS: pages and parts the original design did not include.
   Same rule: variables only.
   ================================================================= */

/* More notice kinds */
.notice--danger { background: var(--colour-danger-bg); border-color: var(--colour-danger); color: var(--colour-text); }
.notice ul { margin: 0; padding: 0; list-style: none; }

/* More status labels (enquiries) */
.status--new { background: var(--colour-status-done-bg); color: var(--colour-status-done-text); }
.status--closed { background: var(--colour-status-cancelled-bg); color: var(--colour-status-cancelled-text); }

/* Small helper text */
.hint { font-size: 16px; color: var(--colour-text-muted); }
.field .hint { font-size: 15px; }
.empty { color: var(--colour-text-muted); }

/* Spam trap field: never shown */
.trap { position: absolute; left: -9999px; }

/* Select boxes look like inputs */
select.input { appearance: auto; }

/* Back link at the top of an admin page */
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }

/* Simple lists of links (customers, enquiries) */
.link-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.link-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--colour-surface); color: var(--colour-text);
  border: 1px solid var(--colour-line); border-radius: var(--radius-card);
  text-decoration: none;
}
.link-card:hover { border-color: var(--colour-brand); color: var(--colour-text); }
.link-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 18px; font-weight: 800; }
.link-card__detail { font-size: 16px; color: var(--colour-text-muted); }

/* Filter tabs (enquiries) */
.tabs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tabs a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 8px;
  background: var(--colour-surface); color: var(--colour-text);
  border: 1px solid var(--colour-line); border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.tabs a[aria-current="true"] {
  background: var(--colour-brand); color: var(--colour-on-brand); border-color: var(--colour-brand);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}

/* Details list: long values wrap instead of overflowing */
.details dd { min-width: 0; overflow-wrap: anywhere; }
.details__row:last-child { border-bottom: 0; }

/* Day heading with an Add link (diary) */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Entry text on the Money page */
.entry__type a { font-weight: 700; }

/* Card payment page */
.pay { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.pay__amount { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.qr { width: 100%; max-width: 320px; padding: 14px; background: var(--colour-surface); border: 1px solid var(--colour-line); border-radius: var(--radius-card); }
.qr svg { display: block; width: 100%; height: auto; }

/* Settings sections */
.form h2 { margin-top: 10px; }

/* Plain text pages (terms, privacy notice, thank you) */
.prose { display: flex; flex-direction: column; gap: 12px; padding-block: 28px 48px; }
.prose h1 { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.prose h2 { font-size: 21px; font-weight: 800; margin-top: 14px; }
.prose ul { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose .money-table th, .prose .money-table td { text-align: left; white-space: normal; font-weight: 400; }
.prose .money-table thead th { font-weight: 800; }

/* Log-in page */
.login { max-width: 440px; margin-inline: auto; padding-block: 32px; }

/* Headings that link somewhere (a job's customer name) keep the heading colour */
.job-head h1 a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* A form inside a white box or a button row takes the full width it is given */
.button-row form { margin: 0; display: flex; }
.box > .form { gap: 14px; }

/* Services and prices page: one box per service */
.service-row { margin: 0; min-width: 0; }
.service-row .button-row { margin-top: 12px; }

/* Tax export: the list of date ranges, one under another */
.tabs--stack { grid-template-columns: 1fr; margin-bottom: 14px; }
.tabs--stack a { justify-content: flex-start; padding: 0 16px; }

/* A long web address that must wrap instead of pushing the page wide */
.link-text { overflow-wrap: anywhere; }

/* Buttons that cannot be used right now */
.button:disabled { opacity: 0.4; cursor: not-allowed; }
