/*
 * T J Bowes — tjbowes.co.uk
 * Stylesheet
 *
 * Aesthetic: refined editorial, book-design sensibility
 * Palette: warm beige ground, near-black text, antique gold accent
 * Typography: EB Garamond (serif) throughout; size and weight contrast for headings
 */

/* ─── Custom properties ─────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --colour-ground:      #f5f0e8;   /* page background — warm off-white */
  --colour-surface:     #ede8de;   /* slightly deeper surface for cards/aside */
  --colour-text:        #26231e;   /* near-black, warm undertone */
  --colour-text-muted:  #7a7064;   /* secondary text, captions */
  --colour-rule:        #c4b89a;   /* horizontal rules, borders */
  --colour-accent:      #9c6f2e;   /* antique gold — links, highlights */
  --colour-accent-deep: #7a5420;   /* darker gold for hover states */
  --colour-form-bg:     #ede8de;   /* form field background */

  /* Typography */
  --font-serif: 'EB Garamond', 'Garamond', 'Georgia', serif;

  /* Spacing scale */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.75rem;
  --space-lg:  3rem;
  --space-xl:  5rem;

  /* Layout */
  --max-width:       780px;
  --content-padding: clamp(1.25rem, 5vw, 2.5rem);
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */

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

html {
  font-size: 20px;            /* base — em Garamond reads well slightly larger */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--colour-text);
  background-color: var(--colour-ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--colour-text);
  color: var(--colour-ground);
  font-size: 0.8rem;
  text-decoration: none;
  z-index: 100;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 1rem;
}

/* ─── Typography ────────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;           /* Garamond's weight is in its letterform, not boldness */
  line-height: 1.15;
  color: var(--colour-text);
}

/* Page-level display heading */
h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.01em;
}

/* Section heading */
h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.005em;
}

/* Sub-heading */
h3 {
  font-size: 1.15rem;
  font-weight: 500;
}

/* Small-caps label — used for service category names, section markers */
.label {
  font-size: 0.65rem;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
  font-weight: 400;
}

p {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

p:last-child {
  margin-bottom: 0;
}

/* Italic lead — used for taglines and introductory sentences */
.lead {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--colour-text-muted);
  line-height: 1.65;
}

/* Pull quote / highlighted passage */
blockquote {
  border-left: 2px solid var(--colour-accent);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  font-style: italic;
  color: var(--colour-text-muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

/* ─── Links ─────────────────────────────────────────────────────────────────── */

a {
  color: var(--colour-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

a:hover,
a:focus {
  color: var(--colour-accent-deep);
  text-decoration-thickness: 2px;
}

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

/* Navigation links — override base */
nav a {
  color: var(--colour-text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  font-variant: small-caps;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

nav a:hover,
nav a:focus {
  color: var(--colour-text);
}

nav a[aria-current="page"] {
  color: var(--colour-accent);
}

/* ─── Horizontal rule ───────────────────────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--colour-rule);
  margin: var(--space-lg) 0;
}

hr.ornament {
  /* A centred decorative rule with flanking dashes — classical typographic device */
  border: none;
  text-align: center;
  overflow: visible;
  height: 1px;
  background: var(--colour-rule);
  position: relative;
  margin: var(--space-lg) 0;
}

hr.ornament::before {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--colour-ground);
  padding: 0 0.75rem;
  color: var(--colour-accent);
  font-size: 0.7rem;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */

.wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

/* ─── Site header ───────────────────────────────────────────────────────────── */

.site-header {
  padding: var(--space-md) 0 0;
  border-bottom: 1px solid var(--colour-rule);
  margin-bottom: var(--space-lg);
}

.site-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
}

/* Wordmark */
.site-header__wordmark {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--colour-text);
  text-decoration: none;
}

.site-header__wordmark:hover {
  color: var(--colour-text);
  text-decoration: none;
}

/* Primary navigation */
.site-nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

/* Mobile nav toggle — hidden unless small screen */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--colour-text);
  font-size: 1.2rem;
  line-height: 1;
}

/* ─── Site footer ───────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--colour-rule);
  margin-top: var(--space-xl);
  padding: var(--space-md) 0 var(--space-lg);
  font-size: 0.7rem;
  color: var(--colour-text-muted);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--colour-text-muted);
  font-size: 0.7rem;
}

.site-footer a:hover {
  color: var(--colour-accent);
}

/* ─── Main content ──────────────────────────────────────────────────────────── */

main {
  padding-bottom: var(--space-xl);
}

/* ─── Hero section (index page) ─────────────────────────────────────────────── */

.hero {
  padding: var(--space-xl) 0 var(--space-lg);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.hero__heading {
  /* Larger than h1 default — this is the feature statement */
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 14ch;
}

.hero__heading em {
  font-style: italic;
  color: var(--colour-accent);
}

.hero__strapline {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--colour-text-muted);
  max-width: 42ch;
  line-height: 1.65;
  margin-top: var(--space-xs);
}

/* ─── Services grid (home summary) ─────────────────────────────────────────── */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  list-style: none;
  margin: var(--space-lg) 0;
}

.services-grid__item {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--colour-rule);
}

.services-grid__item .label {
  display: block;
  margin-bottom: var(--space-xs);
}

.services-grid__item p {
  font-size: 0.9rem;
  color: var(--colour-text-muted);
  line-height: 1.65;
  margin: 0;
}

.services-grid__item a {
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  display: inline-block;
  margin-top: var(--space-xs);
}

/* ─── Human note (index page differentiator panel) ──────────────────────────── */

.human-note {
  background: var(--colour-surface);
  border-left: 3px solid var(--colour-accent);
  padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
}

.human-note p {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--colour-text);
  line-height: 1.7;
  margin: 0;
}

/* ─── Page header (interior pages) ─────────────────────────────────────────── */

.page-header {
  padding: var(--space-lg) 0 var(--space-md);
  border-bottom: 1px solid var(--colour-rule);
  margin-bottom: var(--space-lg);
}

.page-header .label {
  display: block;
  margin-bottom: var(--space-xs);
}

.page-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

/* ─── Service detail cards (services page) ──────────────────────────────────── */

.service-detail {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--colour-rule);
}

.service-detail:last-child {
  border-bottom: none;
}

.service-detail__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.service-detail h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.service-detail ul {
  list-style: none;
  margin: var(--space-sm) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem var(--space-sm);
}

.service-detail ul li {
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--colour-rule);
}

/* ─── About page ────────────────────────────────────────────────────────────── */

.about-body {
  max-width: 58ch;         /* comfortable reading measure */
}

.about-body p + p {
  margin-top: var(--space-sm);
}

/* ─── Pillar sections (home page manifesto) ─────────────────────────────────── */

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

/* Numeral + heading in a baseline-aligned row — echoes the service-detail pattern */
.pillar__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.pillar h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

/* Reading measure — comfortable line length for extended prose */
.pillar p {
  max-width: 62ch;
}

/* ─── Button ─────────────────────────────────────────────────────────────────── */

/* Button (was Submit button) */
.btn {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--colour-ground);
  background: var(--colour-text);
  border: 1px solid var(--colour-text);
  padding: 0.65rem 1.75rem;
  cursor: pointer;
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover,
.btn:focus {
  background: var(--colour-accent);
  border-color: var(--colour-accent);
  color: var(--colour-ground);
}

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

/* ─── Utility ────────────────────────────────────────────────────────────────── */

/* Visually hidden — for screen reader text */
.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;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {

  html {
    font-size: 18px;
  }

  /* Mobile nav */
  .nav-toggle {
    display: block;
  }

  .site-nav {
    /* Hidden by default on mobile; toggled open by JS */
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--colour-rule);
    margin-top: var(--space-xs);
    width: 100%;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-header__inner {
    flex-wrap: wrap;
  }

  /* Stack services grid on mobile */
  .services-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .hero {
    padding: var(--space-lg) 0 var(--space-md);
  }
}
