/* Sorcha O'Neill / Naas Data Centres - shared styles
   Brand colour: Social Democrats purple. */

:root {
  --color-bg: #f7f6f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f1ecf7;
  --color-text: #211c29;
  --color-text-muted: #5c5566;
  --color-border: #ddd6e6;
  --color-primary: #5c2d91;
  --color-primary-dark: #3f1f66;
  --color-primary-light: #efe6f7;
  --color-accent: #c8862a;
  --color-accent-dark: #96641f;
  --color-flag: #a23b3b;
  --color-flag-bg: #f6e9e9;
  --radius: 10px;
  --radius-lg: 16px;
  --max-width: 1080px;
  --shadow: 0 1px 2px rgba(30, 20, 40, 0.06), 0 8px 24px rgba(30, 20, 40, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  /* Applies only until a visitor makes an explicit choice via the theme
     toggle - see [data-theme] below, which is more specific and wins once
     JS has stamped a saved preference onto <html>. */
  :root {
    --color-bg: #16121c;
    --color-surface: #201a29;
    --color-surface-alt: #271f33;
    --color-text: #f1ecf7;
    --color-text-muted: #b3a9bf;
    --color-border: #3a2f47;
    --color-primary: #b98fe0;
    --color-primary-dark: #d4b8f0;
    --color-primary-light: #2a2136;
    --color-accent: #e0a24f;
    --color-accent-dark: #f0b869;
    --color-flag: #e08585;
    --color-flag-bg: #2c1c1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

/* Explicit theme toggle overrides - set by js/theme-toggle.js as a
   data-theme attribute on <html>, persisted in localStorage. Takes
   precedence over prefers-color-scheme once a visitor has picked one. */
:root[data-theme="light"] {
  --color-bg: #f7f6f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f1ecf7;
  --color-text: #211c29;
  --color-text-muted: #5c5566;
  --color-border: #ddd6e6;
  --color-primary: #5c2d91;
  --color-primary-dark: #3f1f66;
  --color-primary-light: #efe6f7;
  --color-accent: #c8862a;
  --color-accent-dark: #96641f;
  --color-flag: #a23b3b;
  --color-flag-bg: #f6e9e9;
  --shadow: 0 1px 2px rgba(30, 20, 40, 0.06), 0 8px 24px rgba(30, 20, 40, 0.06);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --color-bg: #16121c;
  --color-surface: #201a29;
  --color-surface-alt: #271f33;
  --color-text: #f1ecf7;
  --color-text-muted: #b3a9bf;
  --color-border: #3a2f47;
  --color-primary: #b98fe0;
  --color-primary-dark: #d4b8f0;
  --color-primary-light: #2a2136;
  --color-accent: #e0a24f;
  --color-accent-dark: #f0b869;
  --color-flag: #e08585;
  --color-flag-bg: #2c1c1c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Keyboard focus - visible everywhere, invisible for mouse/touch clicks */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 100;
  /* fixed dark purple, not the mode-dependent --color-primary var, which
     flips to a *lighter* purple in dark mode and would kill contrast
     against the white text (same reasoning as .campaign-cta in home.css) */
  background: #3f1f66;
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 17px;
}

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

a { color: var(--color-primary); }
a:hover { color: var(--color-accent-dark); }

mark {
  background: var(--color-accent);
  color: #241a0a;
  padding: 0 0.1em;
  border-radius: 3px;
}

a.gloss-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--color-primary);
}
a.gloss-link:hover {
  color: var(--color-primary-dark);
  border-bottom-style: solid;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 0.5rem; }
h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin: 2.2rem 0 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: 7.5rem;
}
h3 { font-size: 1.15rem; margin: 1.4rem 0 0.5rem; }
p { margin: 0 0 1rem; }

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

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1420px;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.brand span.tag {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: none;
}
@media (min-width: 640px) { .brand span.tag { display: inline; } }

nav.primary-nav { display: flex; }
nav.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
nav.primary-nav a {
  display: inline-block;
  padding: 0.5rem 0.6rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.87rem;
  font-weight: 600;
  white-space: nowrap;
}
nav.primary-nav a:hover { background: var(--color-surface-alt); color: var(--color-text); }
.nav-theme-item {
  margin-top: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}
.nav-back-item a { color: var(--color-text-muted); }
nav.primary-nav a[aria-current="page"] {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  background: var(--color-surface);
  color: var(--color-text);
}
@media (max-width: 959px) {
  .nav-toggle-label { display: inline-block; }
  nav.primary-nav {
    display: none;
    width: 100%;
    order: 3;
  }
  nav.primary-nav ul { flex-direction: column; gap: 0.15rem; padding: 0.5rem 0 0.75rem; }
  nav.primary-nav a { display: block; }
  .site-header .wrap { flex-wrap: wrap; }
  nav.primary-nav.nav-open { display: block; }
}

/* Sidebar (desktop only) */
.sidebar { display: none; }

@media (min-width: 960px) {
  .site-header { display: none; }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    padding: 1.5rem 1.25rem;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 50;
  }
  .sidebar .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    margin-bottom: 1.75rem;
    line-height: 1.3;
  }
  .sidebar .brand span.tag { display: block; margin-top: 0.3rem; font-weight: 600; }
  .sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
  .sidebar nav a {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.92rem;
  }
  .sidebar nav a:hover { background: var(--color-surface-alt); color: var(--color-text); }
  .sidebar nav a[aria-current="page"] {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
  }
  .sidebar-footer-note {
    margin-top: auto;
    padding-top: 1.25rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
  }
  .sidebar-back-link {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
  }
  .sidebar-back-link:hover { color: var(--color-primary); }

  .sidebar .theme-toggle { width: 100%; margin-top: 0.75rem; }

  .sidebar ~ .hero, .sidebar ~ main, .sidebar ~ footer.site-footer { margin-left: 250px; }
}

/* Theme toggle button - shared base look, used in the campaign sidebar,
   the campaign mobile nav, and the personal site header. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
}
.theme-toggle:hover { background: var(--color-surface-alt); color: var(--color-text); border-color: var(--color-primary); }
.theme-toggle .theme-toggle-icon { font-size: 1rem; line-height: 1; }

.nav-theme-item { padding: 0; }
.nav-theme-item .theme-toggle { width: 100%; margin: 0.3rem 0; }

.home-header .theme-toggle,
.site-header .theme-toggle {
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
}

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--color-primary-light), var(--color-bg) 80%);
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
}
.hero .eyebrow {
  display: inline-block;
  /* fixed dark purple - see .skip-link comment above */
  background: #3f1f66;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}
.hero p.lede { font-size: 1.15rem; color: var(--color-text-muted); max-width: 60ch; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
/* fixed dark purple, not the mode-dependent --color-primary/-dark vars,
   which flip *lighter* in dark mode and would kill contrast against the
   white text - see .skip-link comment above */
.btn-primary { background: #3f1f66; color: #fff; }
.btn-primary:hover { background: #31184f; color: #fff; }
.btn-accent { background: var(--color-accent); color: #241a0a; }
.btn-accent:hover { background: var(--color-accent-dark); color: #241a0a; }
.btn-ghost { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* Sections / cards */
main { padding: 2rem 0 4rem; }
section + section { margin-top: 1rem; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Glossary */
.glossary-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0.5rem;
}
.glossary-jump a {
  display: inline-block;
  min-width: 1.8rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text);
}
.glossary-jump a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.glossary-letter {
  margin-top: 2rem;
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.3rem;
  scroll-margin-top: 7.5rem;
}
dl.glossary-list { margin: 0; }
dl.glossary-list dt {
  font-weight: 800;
  font-size: 1.02rem;
  margin-top: 1.3rem;
  scroll-margin-top: 7.5rem;
}
dl.glossary-list dd {
  margin: 0.3rem 0 0;
  color: var(--color-text-muted);
}
dl.glossary-list dd a { color: var(--color-primary-dark); }

.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.stat .num {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1.1;
}
.stat .label { color: var(--color-text-muted); font-size: 0.92rem; }
.stat .src { display: block; margin-top: 0.4rem; font-size: 0.78rem; color: var(--color-text-muted); }

.callout {
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.2rem;
}
.callout.flag {
  border-left-color: var(--color-flag);
  background: var(--color-flag-bg);
}

/* Key facts strip - scannable summary right under the hero, for people who
   won't read past the first paragraph */
.key-facts {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.key-facts li { display: block; }
.key-facts a {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--color-text);
  text-decoration: none;
  height: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.key-facts a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-left-color: var(--color-accent);
}
.key-facts .kf-icon { flex-shrink: 0; font-size: 1.1rem; line-height: 1.4; }

/* Collapsible sourced detail - headline claim visible, full reasoning and
   citations expand on click. Used for the denser narrative paragraphs. */
details.sourced {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  background: var(--color-surface);
}
details.sourced summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  list-style: none;
  position: relative;
  padding-right: 7rem;
  color: var(--color-text);
}
details.sourced summary::-webkit-details-marker { display: none; }
details.sourced summary::after {
  content: '+ show sourcing';
  position: absolute;
  top: 0.1rem;
  right: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}
details.sourced[open] summary::after { content: '\2212 hide sourcing'; }
details.sourced .details-body { margin-top: 0.75rem; }
details.sourced .details-body > p:last-child { margin-bottom: 0; }

.pill {
  display: inline-block;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Timeline */
.timeline { list-style: none; margin: 1.5rem 0; padding: 0; border-left: 3px solid var(--color-border); }
.timeline li { position: relative; padding: 0 0 1.6rem 1.4rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0.35rem;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
}
.timeline .date { font-weight: 700; font-size: 0.85rem; color: var(--color-primary-dark); display: block; }
.timeline .desc { color: var(--color-text); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-text-muted); }

/* FAQ */
details.faq {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.2rem 1rem;
  margin-bottom: 0.7rem;
  scroll-margin-top: 7.5rem;
}
details.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.85rem 0;
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+ "; color: var(--color-primary); }
details.faq[open] summary::before { content: "\2212 "; }
details.faq .faq-body { padding-bottom: 0.9rem; color: var(--color-text-muted); }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.3rem; font-size: 0.92rem; }
.field input, .field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
}

.template-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.copy-btn {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

/* Source note */
.source-note { font-size: 0.82rem; color: var(--color-text-muted); }

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
footer.site-footer a { color: var(--color-text-muted); }
footer.site-footer .foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}
footer.site-footer h4 { color: var(--color-text); margin: 0 0 0.5rem; font-size: 0.9rem; }
footer.site-footer ul { list-style: none; padding: 0; margin: 0; }
footer.site-footer li { margin-bottom: 0.35rem; }
footer.site-footer .trademark-note {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.placeholder-note {
  font-size: 0.78rem;
  color: var(--color-accent-dark);
  border: 1px dashed var(--color-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(200, 134, 42, 0.08);
}
