/* =========================================================
   AJR Facilities Management — Shared layout + two brand themes
   Fire Risk Assessment: red / black / white
   Disability Access:   blue / yellow (used as accents only, never
                         as the sole carrier of meaning)
   ========================================================= */

:root {
  --font-body: "Segoe UI", Arial, Helvetica, sans-serif;
  --max-width: 1200px;
  --space-sm: 0.75rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --radius: 6px;
  --focus-ring: 3px solid #ffb400;
}

/* ---- Theme: Fire Risk Assessment (default) ---- */
.theme-fire {
  --color-primary: #a6192e;      /* dark red, AA on white */
  --color-primary-text: #ffffff;
  --color-secondary: #1a1a1a;    /* black */
  --color-text: #1a1a1a;
  --color-bg: #ffffff;
  --color-surface: #f6f6f6;
  --color-border: #d9d9d9;
}

/* ---- Theme: Disability Access ---- */
.theme-access {
  --color-primary: #00437a;      /* dark blue, AA on white */
  --color-primary-text: #ffffff;
  --color-secondary: #c98f00;    /* darkened yellow, AA on white for text use */
  --color-text: #1a1a1a;
  --color-bg: #ffffff;
  --color-surface: #f4f8ff;
  --color-border: #cddcee;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  transition: background-color 0.2s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--color-primary); }
h1, h2, h3 { line-height: 1.2; }

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

.skip-link {
  position: absolute;
  left: 0; top: -3rem;
  background: #000;
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ---- Buttons ---- */
.cta-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
}
.cta-primary,
.header-cta {
  background: var(--color-primary);
  color: var(--color-primary-text);
}
.cta-primary:hover, .header-cta:hover { opacity: 0.9; }
.cta-secondary {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.cta-secondary:hover { background: var(--color-surface); }

/* ---- Header ---- */
.site-header {
  border-bottom: 4px solid var(--color-primary);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.logo { height: 112px; width: auto; }
.main-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
}
.main-nav a:hover { color: var(--color-primary); }
.header-contact {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  margin-left: auto;
}
.contact-link { color: var(--color-text); text-decoration: none; }
.contact-link:hover { color: var(--color-primary); }

/* ---- Site toggle bar ---- */
.site-toggle-bar {
  background: var(--color-secondary, #1a1a1a);
  color: #fff;
}
.theme-access .site-toggle-bar { background: var(--color-primary); }
.site-toggle-inner {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.6rem var(--space-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-md);
}
.site-toggle-label { margin: 0; font-size: 0.95rem; }
.site-toggle-button {
  background: #fff;
  color: #1a1a1a;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.site-toggle-button.js-aligned {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

/* ---- Hero ---- */
.hero {
  background: var(--color-surface);
  padding: 1.75rem var(--space-md);
}
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-lg);
  align-items: center;
}
.hero-text h1 { font-size: 2.25rem; margin: 0 0 var(--space-sm); }
.hero-subheading { font-size: 1.15rem; max-width: 60ch; margin: 0 0 var(--space-md); }
.hero-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.section-back-to-top {
  max-width: var(--max-width);
  margin: var(--space-md) auto 0;
  padding: 0 var(--space-md);
  text-align: right;
  box-sizing: border-box;
}
.hero-inner .section-back-to-top {
  grid-column: 1 / -1;
  max-width: none;
  margin: var(--space-sm) 0 0;
  padding: 0;
}
.section-back-to-top-tight {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.hero-visual.access-only-block {
  padding: 1.5rem 0;
}
.hero-image-access {
  width: calc(44.4% + 2cm);
  height: auto;
  max-width: 100%;
}
@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; }
}

/* ---- Homepage introduction ---- */
.homepage-intro { padding: 0.2rem var(--space-md) 1.5rem; }
.homepage-intro-inner { max-width: var(--max-width); margin: 0 auto; }
.homepage-intro-inner p { margin: 0 0 0.6rem; }
.homepage-intro-lead { font-weight: 700; font-size: 1.15rem; margin: 0 0 0.6rem; }

/* ---- Trust bar ---- */
.trust-bar {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5cm var(--space-md);
  overflow-x: auto;
}
.trust-logos {
  list-style: none;
  display: flex;
  gap: var(--space-lg);
  padding: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}
.trust-logos li { flex-shrink: 0; }
.trust-logos img { height: 48px; width: auto; filter: grayscale(0%); }
.trust-logos li:nth-child(1) img { height: 160px; }
.trust-logos li:nth-child(2) img { height: 96px; }
.trust-logos.access-only-block li img { height: 80px; }

/* ---- Client intro ---- */
.client-intro { padding: 0.4rem var(--space-md) 0.4rem; }
.client-intro-text h2 { margin-top: 0; margin-bottom: 0.5rem; }
.client-intro-text p { margin: 0; }
.client-intro-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-lg);
  align-items: center;
}
.client-photo {
  border-radius: var(--radius);
  border: 3px solid var(--color-primary);
}
.client-intro-inner-solo { grid-template-columns: 1fr; }

/* ---- Access-only sections (hidden unless Disability Access active) ---- */
.access-only-block { display: none; }
.theme-access .access-only-block { display: block; }
.theme-access .hero-visual.access-only-block { display: flex; }
.access-only-inner { max-width: var(--max-width); margin: 0 auto; }
.fire-only-block { display: none; }
.theme-fire .fire-only-block { display: block; }
.theme-fire .hero-visual.fire-only-block { display: flex; }
.theme-fire .trust-logos.fire-only-block { display: flex; }
.theme-access .trust-logos.access-only-block { display: flex; }

/* ---- Football banner ---- */
.football-banner { padding: 0.1406rem 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.football-scroller {
  max-width: 100%;
  overflow: hidden;
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 45s linear infinite;
}
.football-scroller:hover .marquee-track,
.football-scroller:focus-within .marquee-track {
  animation-play-state: paused;
}
.football-logos {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.football-logos li {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  width: 84px;
  margin-right: var(--space-lg);
  flex: 0 0 auto;
}
.football-logos img {
  height: 100%;
  width: 100%;
  object-fit: contain;
}
.football-logos li.logo-lg {
  width: 110px;
  height: 55px;
}
.football-logos li.logo-xl {
  width: 203px;
  height: 102px;
}
.football-logos li.logo-innovex {
  width: 189px;
  height: 95px;
}
.football-logos li.logo-brechin {
  width: 240px;
  height: 120px;
}
.football-logos li.logo-inverness {
  width: 210px;
  height: 105px;
}
.football-logos li.logo-2x {
  width: 168px;
  height: 84px;
}
.football-logos li.logo-1-5x {
  width: 126px;
  height: 63px;
}
.football-logos li.logo-black-sheep {
  width: 220px;
  height: 110px;
}
.football-logos li.logo-aberdeen-performing-arts {
  width: 203px;
  height: 102px;
}
.football-logos li.logo-aberdeen-construction {
  width: 360px;
  height: 180px;
}
.marquee-track.access-only-block { display: none; }
.theme-access .marquee-track.access-only-block { display: flex; }
.theme-access .football-scroller > .marquee-track:not(.access-only-block) { display: none; }
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .football-scroller { overflow-x: auto; }
}

/* ---- Services teaser ---- */
.services-teaser { padding: 0.875rem var(--space-md) 1.75rem; text-align: center; }
.services-teaser-inner { max-width: 70ch; margin: 0 auto; }
.services-list {
  display: none;
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  text-align: left;
}
.theme-fire .services-list-fire { display: grid; }
.theme-access .services-list-access { display: grid; }
.services-intro { display: none; text-align: left; margin-bottom: var(--space-md); }
.services-intro-heading { margin: 0 0 var(--space-sm); font-size: 1.05rem; color: var(--color-primary); }
.theme-fire .services-intro-fire { display: block; }
.theme-access .services-intro-access { display: block; }
.services-cta-line { font-weight: 700; margin: 0 0 var(--space-sm); }
.services-list li {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
}
.services-list li a {
  color: var(--color-primary);
  text-decoration: underline;
}
.services-list li a:hover,
.services-list li a:focus-visible {
  text-decoration-thickness: 2px;
}

/* ---- Mission / About ---- */
.mission {
  background: var(--color-secondary, #1a1a1a);
  color: #fff;
  padding: 1rem 2.5cm;
}
.theme-access .mission { background: var(--color-primary); }
.mission-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: var(--space-lg);
  align-items: center;
}
.mission-media { display: flex; flex-direction: column; gap: var(--space-md); }
.mission-photo {
  width: 100%;
  border-radius: var(--radius);
  border: 3px solid #fff;
}
.mission-text { max-width: none; }
@media (max-width: 800px) {
  .mission-inner { grid-template-columns: 1fr; }
  .mission-media { max-width: 260px; margin: 0 auto; }
}
.mission a.cta-primary { background: #fff; color: var(--color-secondary); }
.theme-access .mission a.cta-primary { color: var(--color-primary); }
.mission .section-back-to-top a { background: #fff; color: var(--color-secondary); border-color: #fff; }
.theme-access .mission .section-back-to-top a { color: var(--color-primary); }

/* ---- Consultation CTA ---- */
.consultation-cta {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 1.125rem var(--space-md);
  text-align: center;
}
.consultation-cta-inner {
  max-width: 60ch;
  margin: 0 auto;
  min-height: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.consultation-cta .hero-actions { justify-content: center; margin-top: var(--space-md); }
.cross-link .hero-actions { justify-content: center; margin-top: var(--space-md); }
.services-teaser .hero-actions { justify-content: center; margin-top: var(--space-md); }

/* ---- FAQ ---- */
.faq-section { padding: 1.75rem var(--space-md); background: var(--color-surface); }
.faq-inner { max-width: 75ch; margin: 0 auto; }
.faq-inner h2 { text-align: center; margin: 0 0 var(--space-md); }
.faq-list { display: none; }
.theme-fire .faq-list.fire-only-block { display: block; }
.theme-access .faq-list.access-only-block { display: block; }
.faq-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  padding: 0.9rem 1.1rem;
}
.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 1.5rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0;
  font-weight: 700;
  color: var(--color-primary);
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.faq-item p { margin: 0.75rem 0 0; }

/* ---- Cross-link ---- */
.cross-link { padding: 1.125rem var(--space-md); text-align: center; }
.cross-link-inner { max-width: 60ch; margin: 0 auto; }

/* ---- Footer ---- */
.site-footer {
  background: var(--color-surface);
  border-top: 4px solid var(--color-primary);
  padding: 0.7031rem var(--space-md) 0.5625rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}
@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
}
.footer-contact h2, .footer-legal h2, .footer-sitemap h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.footer-contact p { margin: 0 0 0.25rem; }
.footer-contact-line { display: flex; align-items: center; gap: 0.4rem; }
.footer-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-primary); }
.footer-sitemap { text-align: center; }
.footer-legal ul, .footer-sitemap ul { list-style: none; padding: 0; margin: 0; }
.footer-legal li, .footer-sitemap li { margin-bottom: 0.2rem; }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-top: 1rem;
  color: #555;
}
.footer-bottom p { margin: 0; }

/* ---- Scroll-down button ---- */
.scroll-down-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 55;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: var(--color-primary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease;
}
.scroll-down-btn svg { width: 22px; height: 22px; }
.scroll-down-btn:hover { opacity: 0.9; }
.scroll-down-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.scroll-down-btn.is-hidden { display: none; }
@media (max-width: 700px) {
  .scroll-down-btn { bottom: calc(3.75rem + 0.75rem); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-down-btn { transition: none; }
}

/* ---- Accessibility toolbar (in header) ---- */
.header-a11y {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.a11y-fab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.a11y-fab svg { width: 16px; height: 16px; flex-shrink: 0; }
.a11y-fab:hover { opacity: 0.92; }
.a11y-fab:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.a11y-read-btn[aria-pressed="true"] { background: var(--color-secondary, #1a1a1a); }
.a11y-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  padding: 1rem;
  width: 220px;
  z-index: 45;
}
.a11y-panel-heading { margin: 0 0 0.75rem; font-size: 1rem; }
.a11y-row { margin-bottom: 0.75rem; }
.a11y-row-label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; }
.a11y-row-buttons { display: flex; gap: 0.4rem; }
.a11y-row-buttons button {
  flex: 1;
  padding: 0.4rem 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}
.a11y-panel-toggle {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}
.a11y-panel-toggle[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-color: var(--color-primary);
}
.a11y-row-buttons button:focus-visible,
.a11y-panel-toggle:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* Text-size scaling, driven by a class on <html> */
html.a11y-font-lg { font-size: 112.5%; }
html.a11y-font-xl { font-size: 125%; }

/* High contrast mode */
html.a11y-high-contrast {
  --color-text: #000000;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-border: #000000;
  --ink-soft: #000000;
}
html.a11y-high-contrast body { color: #000000; }
html.a11y-high-contrast .cta-secondary { border-width: 2px; }

/* Dyslexia-friendly mode: wider spacing, plainer system font */
html.a11y-dyslexia-font body {
  font-family: Verdana, Tahoma, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  line-height: 1.75;
}


/* ---- Sticky mobile call bar ---- */
.sticky-call-bar { display: none; }
@media (max-width: 700px) {
  body { padding-bottom: 3.75rem; }
  .sticky-call-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--color-primary);
    color: var(--color-primary-text);
    text-decoration: none;
    font-weight: 700;
    padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
  }
  .sticky-call-bar svg { width: 18px; height: 18px; flex-shrink: 0; }
  .sticky-call-bar:focus-visible { outline: var(--focus-ring); outline-offset: -3px; }
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .client-intro-inner { grid-template-columns: 1fr; text-align: center; }
  .client-photo { margin: 0 auto; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .header-contact { margin-left: 0; }
  .header-a11y { margin-left: 0; }
  .a11y-fab span { display: none; }
  .a11y-panel { right: auto; left: 0; }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---- Service document page ---- */
.document-page { padding: var(--space-md); }
.document-inner { max-width: 760px; margin: 0 auto; }
.document-back { margin: 0 0 var(--space-sm); }
.document-back a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.document-back a:hover { text-decoration: underline; }
.document-tagline {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--color-text);
  margin: 0 0 var(--space-md);
}
.document-inner h2 { margin: var(--space-lg) 0 var(--space-sm); }
.document-inner p { line-height: 1.6; }
.document-list { padding-left: 1.25rem; margin: 0; }
.document-list li { margin-bottom: 0.6rem; line-height: 1.6; }
.document-cta { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin: var(--space-lg) 0 var(--space-sm); }
.email-fallback { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--color-text); opacity: 0.75; }
.document-download { margin: 0; font-size: 0.9rem; }
.document-download a { color: var(--color-text); }
