/* Tree First Tree Surgeons — design system
   Spacing, type, and shape are all driven from these variables so the
   look can be tweaked in one place. */

:root {
  --color-bg: #FBF3E7;
  --color-card: #F3DFC4;
  --color-text: #3D2B1F;
  --color-text-muted: #6B5443;
  --color-accent: #B5541F;
  --color-accent-dark: #8A4A15;
  --color-white: #FFFFFF;

  /* Two-family pairing: a characterful serif for headings, a clean
     sans for everything else. Change these two lines to re-theme. */
  --font-heading: 'Newsreader', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Spacing scale — use these everywhere instead of one-off values. */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 56px;

  --min-tap: 44px;
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-sm);
  color: var(--color-text);
  overflow-wrap: break-word;
}

h3, h4, h5, h6 { margin-bottom: var(--space-xs); }

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 var(--space-sm); color: var(--color-text-muted); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Major page sections are always separated by the same rhythm. */
section {
  padding: var(--space-xl) 0;
}

.section-tight {
  padding: var(--space-lg) 0;
}

/* The very first section on interior pages — nav, then this, then
   the page heading. Deliberately asymmetric: more room under the nav
   above the heading, less below the subtext since the next section
   adds its own top padding immediately after. */
.page-intro {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-sm);
}
@media (max-width: 639px) {
  .page-intro { padding-top: var(--space-lg); }
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--min-tap);
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  color: var(--color-white);
}

.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}
.btn-secondary:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn-block { width: 100%; }

/* Badges / tags */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Cards */

.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

/* Icon sizing — every inline SVG gets one of these classes so its size
   is explicit and never left to the browser's replaced-element default
   (which is how icons without a set size can render at 300px+). */

.icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-16 { width: 16px; height: 16px; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }
.icon-28 { width: 28px; height: 28px; }
.icon-32 { width: 32px; height: 32px; }

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid rgba(61, 43, 31, 0.08);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-text);
}
.logo:hover { color: var(--color-text); }
.logo .icon { color: var(--color-accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-tap);
  color: var(--color-text);
  font-weight: 500;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

.nav-cta { margin-left: var(--space-sm); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--min-tap);
  height: var(--min-tap);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-text);
}

@media (max-width: 899px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
    padding: var(--space-md);
    border-bottom: 1px solid rgba(61, 43, 31, 0.08);
    box-shadow: 0 8px 16px rgba(61, 43, 31, 0.08);
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { width: 100%; }
  .nav-cta { margin-left: 0; margin-top: var(--space-xs); }
  .nav-cta .btn { width: 100%; }
}

/* Hero */

.hero-image-wrap {
  padding-top: var(--space-lg);
}
.hero-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  /* Biases any further cropping toward Conrad, who sits slightly
     left-of-center and below the midline in the source photo. */
  object-position: 45% 58%;
  border-radius: var(--radius-lg);
}
@media (min-width: 640px) {
  .hero-image { aspect-ratio: 16 / 9; max-height: 460px; }
}

.hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-md);
  text-align: center;
}
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
  margin: var(--space-md) 0 var(--space-lg);
}
.hero p.lede {
  max-width: 640px;
  margin: 0 auto var(--space-md);
  font-size: 1.125rem;
}

/* Service area list — a grid of postcode + area cards. auto-fill lets
   it reflow from 3 columns down to 1 without a breakpoint per size,
   which matters here since there are 19 entries to lay out cleanly. */
.towns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-sm);
}
.town-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  background: var(--color-card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.town-postcode {
  flex-shrink: 0;
  font-weight: 500;
  color: var(--color-accent);
}
.town-areas {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Grids */

.grid {
  display: grid;
  gap: var(--space-sm);
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 899px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* A vertical list of full-width cards (e.g. the Services page). Cards
   are never allowed to touch — always at least --space-sm apart. */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.service-card, .service-detail, .trust-item {
  text-align: left;
}

.service-card .icon, .service-detail .icon, .trust-item .icon {
  color: var(--color-accent);
  flex-shrink: 0;
}
.trust-item .icon { margin-bottom: 0; }

/* Shared icon + heading row — used on both the homepage service cards
   and the full Services page, so the icon sits inline beside the
   heading rather than stacked above it in either place. */
.icon-heading-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.icon-heading-row h2, .icon-heading-row h3 { margin-bottom: 0; }

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  padding: var(--space-md);
}
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 500;
}

/* Section heading */

.section-heading {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-sm);
}
.section-heading p { margin-bottom: 0; }

/* Narrow centered content column, used for About/legal copy. */
.narrow {
  max-width: 720px;
  margin: 0 auto;
}

/* Gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
@media (max-width: 899px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .gallery-grid { grid-template-columns: 1fr; }
}
.gallery-grid img {
  border-radius: var(--radius-sm);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.before-after-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-card);
  padding: var(--space-xs);
}
@media (max-width: 479px) {
  .before-after-pair { grid-template-columns: 1fr; }
}
.before-after-pair img {
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  object-fit: cover;
}
.before-after-pair .label {
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  padding: 0.25rem 0;
  color: var(--color-text-muted);
}

.gallery-grid img,
.before-after-pair img {
  cursor: zoom-in;
}

/* Lightbox */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 14, 10, 0.9);
  padding: var(--space-lg);
}
.lightbox-overlay[hidden] { display: none; }

.lightbox-image {
  max-width: 100%;
  max-height: 82vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-close {
  top: var(--space-md);
  right: var(--space-md);
  width: var(--min-tap);
  height: var(--min-tap);
  border-radius: 50%;
  font-size: 1.5rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.75rem;
}
.lightbox-prev { left: var(--space-md); }
.lightbox-next { right: var(--space-md); }

.lightbox-caption {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  max-width: 80vw;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}

@media (max-width: 639px) {
  .lightbox-overlay { padding: var(--space-sm); }
  .lightbox-prev, .lightbox-next { width: var(--min-tap); height: var(--min-tap); font-size: 1.4rem; }
  .lightbox-prev { left: var(--space-xs); }
  .lightbox-next { right: var(--space-xs); }
}

.gallery-empty {
  text-align: center;
  padding: var(--space-md);
  color: var(--color-text-muted);
}

/* Highlight strip (home) — a grid at tablet/desktop so every photo is
   visible at once, dropping to the horizontal swipe carousel pattern
   only on narrow phone screens where a grid would be too cramped. */
.highlight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-sm);
}
.highlight-strip img {
  width: 100%;
  border-radius: var(--radius-lg);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  cursor: zoom-in;
}
@media (max-width: 639px) {
  .highlight-strip {
    display: flex;
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    scroll-snap-type: x mandatory;
  }
  .highlight-strip img {
    scroll-snap-align: start;
    flex: 0 0 82%;
    width: auto;
  }
}

.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* Reviews */

.review-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.review-stars { color: var(--color-accent); font-size: 1.1rem; letter-spacing: 2px; }
.review-name { font-weight: 500; color: var(--color-text); margin-top: var(--space-xs); }
.review-date { font-size: 0.85rem; color: var(--color-text-muted); }

/* Written testimonials share the review card look but have no star
   rating, so the quote itself carries more visual weight. */
.testimonial-card p {
  color: var(--color-text);
  font-style: italic;
  margin-bottom: 0;
}

.subsection-heading {
  text-align: center;
  margin: 0 0 var(--space-md);
}
.subsection-heading:not(:first-child) { margin-top: var(--space-lg); }

/* Forms */

.form-field {
  margin-bottom: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.form-field label {
  font-weight: 500;
  font-size: 0.9rem;
}
.form-field input,
.form-field select,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  min-height: var(--min-tap);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(61, 43, 31, 0.15);
  background: var(--color-white);
  color: var(--color-text);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}
.form-field textarea { resize: vertical; min-height: 120px; }

.form-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-status {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  display: none;
}
.form-status.success {
  display: block;
  background: #E4EFD8;
  color: #3B5222;
}
.form-status.error {
  display: block;
  background: #F5DCD3;
  color: #7A2E1B;
}

/* Contact block */

.contact-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.contact-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--min-tap);
}
.contact-row .icon { color: var(--color-accent); }
.contact-row a { color: var(--color-text); font-weight: 500; }
.contact-row a:hover { color: var(--color-accent); }

/* Footer */

.site-footer {
  background: var(--color-card);
  padding: var(--space-lg) 0 var(--space-md);
  margin-top: var(--space-xl);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}
@media (max-width: 899px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
}
@media (max-width: 639px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-md); }
}
.footer-grid h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--min-tap);
  /* Contact details need to be clearly readable against the tan
     footer background, so use the dark brand text color rather than
     the terracotta accent or a muted tone. */
  color: var(--color-text);
  font-weight: 500;
}
.footer-links a:hover { color: var(--color-accent); }
.footer-links .icon { color: var(--color-accent); }
.footer-socials { display: flex; gap: var(--space-sm); }
.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--min-tap);
  height: var(--min-tap);
  color: var(--color-text);
}
.footer-socials a:hover { color: var(--color-accent); }
.footer-bottom {
  border-top: 1px solid rgba(61, 43, 31, 0.15);
  padding-top: var(--space-sm);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Qualifications checklist */

.qualifications-list {
  list-style: none;
  padding: 0;
  /* Centers the list itself (matching .narrow) rather than 0, which
     would otherwise win the cascade over .narrow's margin: 0 auto
     since both are single-class selectors and this rule comes later. */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.qualifications-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  background: var(--color-card);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
}
.qualifications-list .icon { color: var(--color-accent); margin-top: 2px; }

/* Map embed */

.map-embed {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: none;
  width: 100%;
  height: 360px;
}

/* Admin */

.admin-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-md);
}
.admin-upload-section {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}
.admin-upload-btn {
  width: 100%;
  min-height: 64px;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--color-accent);
  background: var(--color-bg);
  color: var(--color-accent);
  cursor: pointer;
  margin-bottom: var(--space-sm);
}
.admin-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
}
@media (max-width: 479px) {
  .admin-thumb-grid { grid-template-columns: repeat(2, 1fr); }
}
.admin-thumb {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
}
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(61, 43, 31, 0.75);
  color: var(--color-white);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

/* Legal pages */

.legal-content h2 { margin-top: var(--space-lg); }
.legal-content ul { color: var(--color-text-muted); }

/* Utility */

.text-center { text-align: center; }
.muted { color: var(--color-text-muted); }
.mt-0 { margin-top: 0; }

/* Mobile heading scale — belt-and-braces on top of the clamp() sizes
   above, so headings never wrap awkwardly on small screens. Serif
   display tracking also eases off at small sizes, where tight
   negative letter-spacing tends to look cramped rather than refined. */
@media (max-width: 639px) {
  h1 { font-size: 1.75rem; letter-spacing: 0; }
  h2 { font-size: 1.375rem; letter-spacing: 0; }
  .hero { padding-top: var(--space-md); }
  .hero p.lede { font-size: 1rem; }
  section { padding: var(--space-lg) 0; }
  .section-tight { padding: var(--space-md) 0; }
  .site-footer { margin-top: var(--space-lg); }
}
