/* =========================================================
   Broughton Community Energy — shared stylesheet
   Edit the variables in :root to re-theme the whole site.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  /* -- Color: named tokens, edit here to re-theme -- */
  --ink:      #202B1C;   /* near-black hedgerow green — body text */
  --paper:    #EEECDF;   /* warm chalk paper — page background */
  --paper-2:  #E4E1D1;   /* slightly deeper paper — alternating sections */
  --moss:     #3F5B3A;   /* primary brand green — header, links */
  --moss-dark:#2C4128;   /* darker green — header background */
  --amber:    #C1832C;   /* warm ochre — accents, CTAs, active states */
  --slate:    #566058;   /* muted sage-grey — secondary text, borders */
  --line:     #C9C4AF;   /* hairline rule color */
  --white:    #FBFAF5;

  /* -- Type -- */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, Helvetica, Arial, sans-serif;

  /* -- Layout -- */
  --max: 1080px;
  --gap: 2rem;
}

/* -- Reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--moss-dark); text-decoration-color: var(--amber); text-underline-offset: 3px; }
a:hover { color: var(--amber); }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--moss-dark);
}
h1 { font-size: clamp(2.1rem, 4vw, 2.8rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1.1em; max-width: 66ch; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.25em; }
li { margin-bottom: 0.4em; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

/* -- Skip link -- */
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--amber);
  color: var(--ink); padding: 0.6em 1em; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* =========================================================
   Header / navigation
   ========================================================= */
.site-header {
  background: var(--moss-dark);
  color: var(--white);
  border-bottom: 3px solid var(--amber);
}

.site-header .wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0 0.75rem 150px;  /* leftover space for the logo */
  position: relative;
  min-height: 140px;                  /* tall enough to fit the logo */
}

.brand img {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.brand img { width: 130px; height: 130px; border-radius: 50%; }
.brand span {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 500;
  color: var(--white);
}
.brand:hover span { color: var(--amber); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--white);
  color: var(--white);
  padding: 0.4em 0.7em;
  font-size: 1rem;
  cursor: pointer;
}

.main-nav {
  margin-left: 0 px;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.6rem;
  margin: 0;
  padding: 0;
}
.main-nav > ul > li { position: relative; }
.main-nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.98rem;
  padding: 0.4em 0.1em;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover,
.main-nav a:focus,
.main-nav a[aria-current="page"] {
  color: var(--white);
  border-bottom-color: var(--amber);
}
.main-nav .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--moss-dark);
  border: 1px solid var(--moss);
  border-top: 2px solid var(--amber);
  min-width: 180px;
  padding: 0.4em 0;
  z-index: 20;
}
.main-nav li:hover > .submenu,
.main-nav li:focus-within > .submenu {
  display: block;
}
.main-nav .submenu li { width: 100%; }
.main-nav .submenu a {
  display: block;
  padding: 0.5em 1em;
  border-bottom: none;
  white-space: nowrap;
}
.main-nav .submenu a:hover { background: var(--moss); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .main-nav {
    display: none;
    width: 100%;
  }
  .main-nav.open { display: block; }
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--moss);
    margin-top: 0.75rem;
  }
  .main-nav > ul > li { border-bottom: 1px solid var(--moss); }
  .main-nav a { display: block; padding: 0.75em 0.2em; }
  .main-nav .submenu {
    position: static;
    border: none;
    background: var(--moss-dark);
    padding-left: 1em;
  }
  .site-header .wrap { flex-wrap: wrap; 
  padding-left: 90px;
  min-height: 80px;
  }
  
  .brand img {
  width: 70px;
  height: 70px;
}
.brand span {
  font-size: 1.05rem;
}
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding: 3.5rem 0 3rem;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--gap);
  align-items: center;
}
.hero-copy .eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--slate);
  margin-bottom: 0.75em;
  font-size: 1.05rem;
}
.hero-copy h1 { max-width: 16ch; }
.hero-copy h1 {
  margin-bottom: 0.25em;
}
.hero-copy h1 + p {
  margin-bottom: 2em;
}
.hero-image img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  border: 1px solid var(--line);
}
@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-image { order: -1; }
  .hero-image img { height: 220px; }
}

/* =========================================================
   Page header (non-home pages)
   ========================================================= */
.page-header {
  padding: 2.75rem 0 2rem;
  border-bottom: 1px solid var(--line);
}
.page-header p { color: var(--slate); }

/* =========================================================
   Sections
   ========================================================= */
.section { padding: 3rem 0; }
.section.alt { background: var(--paper-2); }
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* -- Triptych (objectives) -- */
.triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.triptych > div {
  padding: 1.75rem 1.5rem;
  border-left: 1px solid var(--line);
}
.triptych > div:first-child { border-left: none; }
.triptych img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1rem;
}
@media (max-width: 700px) {
  .triptych { grid-template-columns: 1fr; }
  .triptych > div { border-left: none; border-top: 1px solid var(--line); }
  .triptych > div:first-child { border-top: none; }
}

/* -- Achievements two-up -- */
.achieve-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem var(--gap);
}
.achieve-grid h3 {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--ink);
}
.achieve-grid img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
@media (max-width: 700px) { .achieve-grid { grid-template-columns: 1fr; } }

/* -- Team grid (About) -- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.team-card img {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  margin-bottom: 1rem; border: 1px solid var(--line);
}
.team-card h3 { margin-bottom: 0.3em; }

/* -- Case studies -- */
.case-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.case-index-card { border-top: 1px solid var(--line); padding-top: 0.9rem; }
.case-index-card img {
  width: 100%; height: 130px; object-fit: cover; margin-bottom: 0.75rem;
}
.case-index-card .num {
  font-family: var(--font-display);
  color: var(--amber);
  font-size: 0.95rem;
}
.case-index-card h3 { font-size: 1.05rem; margin: 0.2em 0 0; }

.case {
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
}
.case:first-of-type { border-top: 2px solid var(--moss); }
.case .case-num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--amber);
  line-height: 1;
}
.case-media img { border: 1px solid var(--line); margin-bottom: 0.75rem; }
.case-body h4 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: none;
  color: var(--slate);
  margin: 1.4em 0 0.3em;
}
@media (max-width: 760px) {
  .case { grid-template-columns: 1fr; }
}

/* -- Table (suppliers) -- */
.table-wrap { overflow-x: auto; margin-bottom: 2rem; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}
th, td {
  text-align: left;
  padding: 0.85em 1em;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.96rem;
}
th {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--moss-dark);
  border-bottom: 2px solid var(--moss);
}
tr:hover td { background: var(--paper-2); }

/* -- Document library -- */
.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }
.doc-card {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 1rem;
}
.doc-card img { margin-bottom: 0.75rem; border: 1px solid var(--line); }
.doc-card a { font-weight: 600; }

/* -- Contact -- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}
.contact-details { border-left: 1px solid var(--line); padding-left: 2rem; }
@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-details { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 2rem; }
}
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35em; font-size: 0.95rem; }
.field input, .field textarea {
  width: 100%;
  padding: 0.65em 0.8em;
  border: 1px solid var(--slate);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
}
.field textarea { min-height: 120px; resize: vertical; }
button.submit, a.btn {
  display: inline-block;
  background: var(--amber);
  color: var(--ink);
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.7em 1.6em;
  cursor: pointer;
  text-decoration: none;
}
button.submit:hover, a.btn:hover { background: var(--moss); color: var(--white); }

/* -- Callout / links list -- */
.callout {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
}
.callout p:last-child { margin-bottom: 0; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--moss-dark);
  color: var(--white);
  padding: 2rem 0;
  margin-top: 3rem;
  font-size: 0.9rem;
}
.site-footer a { color: var(--white); }
.site-footer .wrap {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}

/* -- Story timeline: banded years with items branching above/below -- */

:root {
  --moss-light: #7E9B4F; /* lighter olive-green, used for the 2024 band */
}

.story-timeline {
  display: grid;
  grid-template-columns: repeat(15, minmax(95px, 1fr));
  grid-template-rows: auto 1.5rem 3rem 1.5rem auto 1.75rem;
  column-gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.5rem;
}

.story-item {
  font-size: 0.86rem;
  line-height: 1.35;
}
.story-item.top { grid-row: 1; align-self: end; }
.story-item.bottom { grid-row: 5; align-self: start; }

.story-icon {
  width: 22px;
  height: 22px;
  color: var(--moss-dark);
  margin-bottom: 0.3rem;
  display: block;
}
.story-date {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.82rem;
  margin-bottom: 0.15em;
}
.story-item p {
  margin: 0;
  max-width: 20ch;
}
/* Larger variant for the Energise South Downs icon, which reads small at the default size */
.story-icon--lg {
  width: 40px;
  height: 40px;
}


/* Vertical connector lines from each item down/up to the band */
.story-connector {
  width: 2px;
  background: var(--slate);
  justify-self: center;
}
.story-connector.top { grid-row: 2; align-self: end; height: 100%; }
.story-connector.bottom { grid-row: 4; align-self: start; height: 100%; }

/* Year bands, drawn as arrow/chevron shapes */
.story-band {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  clip-path: polygon(0 0, calc(100% - 1.25rem) 0, 100% 50%, calc(100% - 1.25rem) 100%, 0 100%, 1.25rem 50%);
  margin-left: -1.25rem;
}
.story-band:first-child { clip-path: polygon(0 0, calc(100% - 1.25rem) 0, 100% 50%, calc(100% - 1.25rem) 100%, 0 100%); margin-left: 0; }
.year-2024 { background: var(--moss-light); }
.year-2025 { background: var(--moss); }
.year-2026 { background: var(--moss-dark); z-index: 1; }

/* "12 months wait" dashed annotation */
.story-wait {
  grid-row: 6;
  border-top: 2px dashed var(--slate);
  position: relative;
  text-align: center;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--slate);
  padding-top: 0.4rem;
  margin-top: 0.5rem;
}
.story-wait::after {
  content: "";
  position: absolute;
  top: -6px;
  right: 0;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--slate);
}

.story-note {
  font-size: 0.85rem;
  color: var(--slate);
  font-style: italic;
  margin-top: 1rem;
}

/* Below this width the branching layout stops making visual sense —
   fall back to a plain stacked list in the same document order */
@media (max-width: 900px) {
  .story-timeline {
    display: block;
    overflow-x: visible;
  }
  .story-connector,
  .story-band,
  .story-wait {
    display: none;
  }
  .story-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 0 0.9rem 1.15rem;
    border-bottom: 1px solid var(--line);
    margin-left: 0.3rem;
    position: relative;
  }

  /* The colour strip and its chevron tip are ONE shape, not two —
     this guarantees they always line up exactly, with no separate
     offset numbers that can drift apart. */
  .story-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: var(--line);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), 50% 100%, 0 calc(100% - 8px));
  }
  .story-item.y2024::before { background: var(--moss-light); }
  .story-item.y2025::before { background: var(--moss); }
  .story-item.y2026::before { background: var(--moss-dark); }

  .story-item p {
    max-width: none;
  }
  .story-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }
}
