/* FabLab Exeter Makerspace — colours taken from the logo */
:root {
  --red: #c8200f;
  --red-dark: #9e1909;
  --green: #4aa052;
  --green-dark: #357a3c;
  --blue: #1a10c8;
  --blue-dark: #120b8f;
  --ink: #16161d;
  --ink-soft: #4a4a57;
  --paper: #ffffff;
  --paper-2: #f5f5f2;
  --line: #e2e2dc;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(22, 22, 29, .10);
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; padding-bottom: 4rem; }
img, video { max-width: 100%; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: .5rem 1rem; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Header / menu ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header::after {          /* tricolour strip */
  content: ""; display: block; height: 4px;
  background: linear-gradient(90deg, var(--red) 0 33.33%, var(--green) 33.33% 66.66%, var(--blue) 66.66%);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand img { width: 48px; height: 48px; }
.brand span { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; line-height: 1.2; white-space: nowrap; }

.menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .25rem; }
.menu > li { position: relative; }
.menu a, .sub-toggle {
  display: block; padding: .55rem .85rem; border-radius: 8px;
  font: 500 .98rem var(--font-body); color: var(--ink); text-decoration: none; white-space: nowrap;
  background: none; border: 0; cursor: pointer;
}
.menu a:hover, .sub-toggle:hover { background: var(--paper-2); color: var(--ink); }
.menu a[aria-current="page"], .has-sub.is-current > .sub-toggle { color: var(--red); font-weight: 600; }
.caret { display: inline-block; width: .5em; height: .5em; margin-left: .3em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.15em) rotate(45deg); transition: transform .2s; }
.sub-toggle[aria-expanded="true"] .caret { transform: translateY(.05em) rotate(-135deg); }

.submenu {
  list-style: none; margin: 0; padding: .4rem;
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .18s ease;
}
.submenu a { border-left: 3px solid transparent; border-radius: 6px; }
.submenu li:nth-child(3n+1) a:hover { border-left-color: var(--red); }
.submenu li:nth-child(3n+2) a:hover { border-left-color: var(--green); }
.submenu li:nth-child(3n+3) a:hover { border-left-color: var(--blue); }
@media (hover: hover) and (min-width: 1101px) {
  .has-sub:hover .submenu { opacity: 1; visibility: visible; transform: none; }
}
.has-sub.open .submenu { opacity: 1; visibility: visible; transform: none; }

.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; }
.bars, .bars::before, .bars::after { display: block; width: 20px; height: 2px; background: var(--ink); margin: 0 auto; position: relative; transition: .2s; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; } .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 1100px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed; inset: calc(var(--header-h) + 4px) 0 auto 0;
    max-height: calc(100vh - var(--header-h) - 4px); overflow-y: auto;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .site-nav.open { display: block; }
  .menu { flex-direction: column; align-items: stretch; padding: .75rem 20px 1.25rem; gap: 0; }
  .menu a, .sub-toggle { width: 100%; text-align: left; padding: .85rem .5rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .submenu { position: static; box-shadow: none; border: 0; padding: 0 0 0 1rem; display: none; opacity: 1; visibility: visible; transform: none; }
  .has-sub.open .submenu { display: block; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: .8rem 1.3rem; border-radius: 999px; font-weight: 600; text-decoration: none; transition: .15s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-ghost { border: 2px solid var(--blue); color: var(--blue); }
.btn-ghost:hover { background: var(--blue); color: #fff; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* ---------- Hero ---------- */
.hero { padding: 3.5rem 0 3rem; background: radial-gradient(1200px 400px at 90% -10%, rgba(26,16,200,.06), transparent), radial-gradient(800px 400px at -10% 110%, rgba(74,160,82,.08), transparent); }
.hero-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 3rem; align-items: center; }
.eyebrow { font: 600 .8rem var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--green-dark); margin: 0 0 .75rem; }
.lead { font-size: 1.2rem; color: var(--ink); }
.hero-text p { color: var(--ink-soft); }
.tagline { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: var(--blue) !important; }
.tagline.big { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin: 2rem 0; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-media { order: -1; }
}

/* Machine pages reuse the home-page hero layout */
.machine-hero .hero-text p { color: var(--ink); }
.machine-hero .prose { max-width: none; }
.machine-hero .ticks { grid-template-columns: 1fr; gap: .35rem; }
.machine-hero.accent-red .eyebrow { color: var(--red); }
.machine-hero.accent-blue .eyebrow { color: var(--blue); }
.machine-hero.accent-green .eyebrow { color: var(--green-dark); }
.machine-hero h1 { display: inline-block; box-shadow: inset 0 -.25em 0 rgba(74,160,82,.25); margin-bottom: 1.25rem; }
.machine-hero.accent-red h1 { box-shadow: inset 0 -.25em 0 rgba(200,32,15,.18); }
.machine-hero.accent-blue h1 { box-shadow: inset 0 -.25em 0 rgba(26,16,200,.16); }

/* ---------- Carousel ---------- */
.carousel {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--ink); aspect-ratio: 16 / 10; box-shadow: var(--shadow);
  margin: 2rem 0;
}
.hero .carousel { margin: 0; }
.track { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
.slide.active { opacity: 1; z-index: 1; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: cover; }
.slide iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.slide:not(.active) { pointer-events: none; }
/* keep our dots and pause button off the embedded player's own controls */
.carousel.on-embed .dots, .carousel.on-embed .car-pause { display: none; }
.carousel.on-embed .car-btn { top: 22px; transform: none; width: 38px; height: 38px; font-size: 1.5rem; }
.slide.missing::after {
  content: attr(data-file) " — add this file to the media folder";
  position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem 4rem; text-align: center;
  color: #fff; font: 500 .95rem var(--font-body);
  background: linear-gradient(135deg, var(--red), var(--green), var(--blue));
}
.car-btn, .car-pause {
  position: absolute; z-index: 3; border: 0; cursor: pointer;
  background: rgba(255,255,255,.88); color: var(--ink);
  display: grid; place-items: center; transition: .15s;
}
.car-btn { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; font-size: 1.8rem; line-height: 1; }
.car-btn:hover, .car-pause:hover { background: #fff; color: var(--red); }
.prev { left: 12px; } .next { right: 12px; }
.car-pause { right: 12px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; font-size: .7rem; letter-spacing: -1px; }
.dots { position: absolute; z-index: 3; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; }
.dots button { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: transparent; padding: 0; cursor: pointer; }
.dots button[aria-selected="true"] { background: #fff; }

/* ---------- Page heads ---------- */
.page-head { padding: 2.5rem 0 1.5rem; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.page-head h1 { margin: 0; }
.page-head .eyebrow { margin-bottom: .4rem; }
.page-head .sub { margin: .4rem 0 0; color: var(--ink-soft); }
.accent-red h1 { box-shadow: inset 0 -.25em 0 rgba(200,32,15,.18); display: inline; }
.accent-green h1 { box-shadow: inset 0 -.25em 0 rgba(74,160,82,.25); display: inline; }
.accent-blue h1 { box-shadow: inset 0 -.25em 0 rgba(26,16,200,.16); display: inline; }
.accent-red .eyebrow { color: var(--red); }
.accent-blue .eyebrow { color: var(--blue); }

.banner { background: var(--paper-2); }
.banner img { width: 100%; height: auto; }

.prose { max-width: 720px; }
.prose.center { margin: 0 auto; text-align: center; }
.about-text { text-align: left; margin-top: 2.5rem; font-size: 1.1rem; }
.about-text p:first-child { font-size: 1.25rem; font-weight: 500; }
.email-img { margin: 1rem auto; max-width: min(480px, 100%); border-radius: 8px; }

.ticks { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1.5rem; }
.ticks li { padding-left: 1.6rem; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .55em; width: .7em; height: .7em; border-radius: 50%; background: var(--green); }
.ticks li:nth-child(3n+2)::before { background: var(--red); }
.ticks li:nth-child(3n)::before { background: var(--blue); }

.notice { margin: 2.5rem 0; padding: 1.75rem; border-radius: var(--radius); background: var(--paper-2); border-left: 6px solid var(--blue); font-size: 1.15rem; }
.notice p { margin: 0 0 .5rem; }
.notice .email-img { margin: 1rem 0 0; }

/* ---------- Machine cards (home) ---------- */
.machine-grid-section { padding-top: 2.5rem; }
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.machine-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.3rem 1.4rem; border-radius: var(--radius); text-decoration: none;
  font: 700 1.15rem var(--font-head); color: #fff; transition: transform .15s, box-shadow .15s;
}
.machine-card.c0 { background: var(--red); }
.machine-card.c1 { background: var(--green); }
.machine-card.c2 { background: var(--blue); }
.machine-card:hover { color: #fff; transform: translateY(-3px); box-shadow: var(--shadow); }
.machine-card .arrow { transition: transform .15s; }
.machine-card:hover .arrow { transform: translateX(4px); }

/* ---------- Opening times table ---------- */
.table-wrap { margin: 2rem 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.times { width: 100%; border-collapse: collapse; }
.times th { text-align: left; background: var(--ink); color: #fff; font: 600 .85rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: .85rem 1rem; }
.times td { padding: .8rem 1rem; border-top: 1px solid var(--line); }
.times td:first-child { font-weight: 600; width: 5rem; }
.times td:nth-child(2) { font-variant-numeric: tabular-nums; width: 10rem; white-space: nowrap; }
.times tr.week-start td { border-top: 2px solid var(--ink-soft); }
.times tr.open td:nth-child(3) { color: var(--green-dark); font-weight: 600; }
.times tr.closed td { color: #8a8a94; }
.times tr.open td.vol { color: var(--blue); font-weight: 600; }
.times tr.today { background: rgba(26,16,200,.06); }
.times tr.today td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
.times .badge { display: inline-block; margin-left: .5rem; padding: .05rem .5rem; border-radius: 999px; background: var(--blue); color: #fff; font-size: .72rem; font-weight: 600; vertical-align: middle; }
.times .week-label td { background: var(--paper-2); font: 600 .8rem var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: .5rem 1rem; }
.times .sess { display: inline-block; font-variant-numeric: tabular-nums; }
.times .and { color: var(--ink-soft); font-weight: 400; margin: 0 .35rem; }
.loading, .error { text-align: center; color: var(--ink-soft); padding: 2rem !important; }
@media (max-width: 560px) {
  .times td, .times th { padding: .65rem .45rem; font-size: .88rem; }
  .times th { font-size: .7rem; letter-spacing: .03em; }
  .times td:first-child { width: 2.6rem; }
  .times td:nth-child(2) { width: auto; }
  .times .badge { display: block; width: max-content; margin: .25rem 0 0; }
  .times .sess { display: block; white-space: nowrap; }
  .times .and { display: none; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #d8d8de; font-size: .95rem; }
.site-footer a { color: #fff; }
.stripe { display: flex; height: 6px; }
.stripe span { flex: 1; } .stripe span:nth-child(1) { background: var(--red); } .stripe span:nth-child(2) { background: var(--green); } .stripe span:nth-child(3) { background: var(--blue); }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 1.5rem 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }
.footer-inner p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Our Volunteers ---------- */
.intro { font-size: 1.2rem; max-width: 720px; margin: 2rem 0 1rem; }
.volunteer { margin: 2rem 0; padding: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius); border-top: 6px solid var(--green); background: #fff; }
.volunteer.accent-red { border-top-color: var(--red); }
.volunteer.accent-blue { border-top-color: var(--blue); }
.volunteer h2 { margin: 0 0 1.25rem; }
.vol-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 2.5rem; align-items: start; }
.vol-pic { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--paper-2); margin-bottom: 1.25rem; }
.vol-details p { margin: 0 0 .75rem; }
.vol-details p:first-child { font-weight: 600; color: var(--green-dark); }
.vol-web a { word-break: break-word; }
.vol-builds h3 { margin: 0 0 .75rem; font-size: 1.25rem; }
.vol-builds .carousel { margin: 0; }
@media (max-width: 800px) {
  .vol-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .volunteer { padding: 1.25rem; }
}
