/* Theme toggle, case studies and dark mode. Loaded after site.css. */
:root { --card: #fff; --line: #c9dddf; --chip: #edf5f3; --chip-ink: #135d66; }

.theme-toggle[hidden] { display: none; }
.theme-toggle {
  flex: 0 0 auto; display: inline-grid; place-items: center;
  inline-size: 42px; block-size: 42px; padding: 0;
  border: 1px solid #c3d0d7; border-radius: 50%;
  background: transparent; color: var(--ink);
}
.theme-toggle:hover { border-color: var(--teal); color: var(--teal); }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

/* The copy button had a white label on the white form */
.urnavio-site #copy-enquiry-btn { color: var(--teal); border-color: var(--teal); }

/* Case studies */
.home-cases .cases-intro { max-inline-size: 720px; margin-block-end: 30px; }
.home-cases .cases-intro p { color: var(--muted); }
.case-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; align-items: start; }
.case-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.case-figure { position: relative; margin: 0; background: #102536; }
.case-figure img { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 3/2; object-fit: cover; }
.case-figure figcaption { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; padding: 3px 10px; border-radius: 999px; background: #102536e6; color: #fff; font-size: .8125rem; line-height: 1.6; }
.case-body { display: grid; gap: 10px; padding: 18px 20px 20px; }
.case-body > * { margin: 0; }
.case-meta { color: var(--muted); font-size: .875rem; }
.case-body h3 { font-size: 1.2rem; line-height: 1.5; }
.case-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.case-chips li { padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-size: .8125rem; }
.case-challenge { font-size: .9375rem; line-height: 1.75; }
.case-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding-block: 10px; border-block: 1px solid var(--line); }
.case-stats div { display: flex; flex-direction: column-reverse; gap: 2px; }
.case-stats dt { color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.case-stats dd { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.case-body details summary { cursor: pointer; font-weight: 700; font-size: .9375rem; padding-block: 4px; }
.case-body details h4 { margin: 10px 0 2px; font-size: .9375rem; }
.case-body details :is(ol,ul) { margin: 0; padding-inline-start: 1.3em; font-size: .9375rem; line-height: 1.75; }
.case-cta { justify-self: start; }
@media(max-width:1000px) { .case-grid { grid-template-columns: minmax(0,1fr); max-inline-size: 560px; } }

/* Dark mode */
html[data-theme="dark"], html[data-theme="dark"] .urnavio-site {
  color-scheme: dark;
  --ivory: #0d1a22; --surface: #13242f; --card: #15293a; --line: #2c4656;
  --ink: #e4ecee; --muted: #a9bcc4; --teal: #5cc3cd;
  --chip: #1b3a44; --chip-ink: #b6e5e7;
  --panel: #182f3d; --field: #0f202b;
}
html[data-theme="dark"] body { background: var(--ivory); color: var(--ink); }
html[data-theme="dark"] .urnavio-site header { background: #0f1f29; border-color: var(--line); }
html[data-theme="dark"] .urnavio-site .brand .mark path:first-child { fill: #e5f4f4; }
html[data-theme="dark"] .urnavio-site .brand .mark path:last-child { fill: #69c2c7; }
html[data-theme="dark"] .theme-toggle { border-color: var(--line); }

/* solid buttons keep the brand teal so white labels stay readable */
html[data-theme="dark"] .urnavio-site .button:not(.light):not(.solar-primary) { background: #087e8b; border-color: #087e8b; color: #fff; }

/* tinted page bands */
html[data-theme="dark"] .urnavio-site :is(.solar-feature, .home-growth, .brief, #partnerships, .section.dark-band) { background: var(--surface); }

/* cards */
html[data-theme="dark"] .urnavio-site :is(.service-card, .offer-card, .deliverable-sample article, .home-team li, .home-growth-grid article, .contact-route, #brief-form, .resource-card, .audience-grid article, .funding-briefs article, .reference-card, .org-detail-card, .sample-report, .preview, .email-card) {
  background: var(--card); border-color: var(--line); color: var(--ink);
}
/* tinted panels */
html[data-theme="dark"] .urnavio-site :is(.industrial-grid article, #rd-engineer, .career-panel, .org-feature, .faq-list details, .sector-checklist, .intent-grid a, .photo-open, .email-card-icon, .email-card-copy) {
  background: var(--panel); border-color: var(--line); color: var(--ink);
}
html[data-theme="dark"] .urnavio-site .industrial-grid article:is(.service-card, .offer-card) { background: var(--card); }
html[data-theme="dark"] .urnavio-site .faq-list details[open] { background: #1d3a40; border-color: #3a6068; }
html[data-theme="dark"] .urnavio-site .sample-report caption { background: #1b3a44; color: #d5eef0; }
html[data-theme="dark"] .urnavio-site .sample-report :is(th, td) { border-color: var(--line); }

/* navigation */
html[data-theme="dark"] .urnavio-site #navlinks { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .urnavio-site #navlinks > a { color: var(--ink); }
html[data-theme="dark"] .urnavio-site #navlinks > a:is(:hover, [aria-current]) { background: #1d3a44; color: #b6e5e7; }
html[data-theme="dark"] .urnavio-site .language-switch { background: transparent; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .urnavio-site .menu { color: var(--ink); }

/* form fields */
html[data-theme="dark"] .urnavio-site :is(input, select, textarea) { background: var(--field); border-color: #3a5868; color: var(--ink); }
html[data-theme="dark"] .urnavio-site ::placeholder { color: #8fa4ad; }

/* cookie panel */
html[data-theme="dark"] .cookie-panel { background: #15293a; color: #e4ecee; border-color: #2c4656; }
html[data-theme="dark"] .cookie-panel :is(summary, .cookie-actions button, .cookie-close) { background: #1b3340; color: #e4ecee; border-color: #3a5868; }
html[data-theme="dark"] .cookie-panel dl { background: #0f202b; }
html[data-theme="dark"] .cookie-panel a { color: #8fd6dd; }

/* text colours that were fixed values */
html[data-theme="dark"] .urnavio-site :is(.form-note, .email-card-label, .offer-start, .home-team li span, .number) { color: var(--muted); }
html[data-theme="dark"] .urnavio-site :is(.email-card-link, .email-card-link bdi, .service-cta, .offer-type span, .sector-jump a) { color: #8fd6dd; }
html[data-theme="dark"] .urnavio-site :is(.faq-list summary, .service-details summary, .rd-profile :is(h3, p)) { color: var(--ink); }
html[data-theme="dark"] .urnavio-site #rd-engineer { background: var(--panel) !important; border-color: var(--line) !important; border-inline-start-color: #5cc3cd !important; }
html[data-theme="dark"] .urnavio-site .rd-profile p[style*="color"] { color: #8fd6dd !important; }
html[data-theme="dark"] .urnavio-site #brief-form #enquiry-privacy { color: var(--muted); }
html[data-theme="dark"] .urnavio-site .sector-jump a { border-color: var(--line); }

/* make room for the toggle in the header */
@media(min-width:1001px) and (max-width:1420px) {
  .urnavio-site .nav { gap: 12px; }
  .urnavio-site #navlinks { gap: clamp(9px,1.05vw,24px); }
  .urnavio-site #navlinks .nav-icon { display: none; }
  .theme-toggle { inline-size: 38px; block-size: 38px; }
}
@media(max-width:400px) {
  .urnavio-site .nav { gap: 8px; }
  .urnavio-site .brand strong { font-size: 20px; letter-spacing: 1px; }
  .theme-toggle { inline-size: 36px; block-size: 36px; }
}
@media(min-width:1001px) and (max-width:1200px) {
  .urnavio-site .nav > .button { display: none; }
  .urnavio-site #navlinks { gap: 6px; }
}
@media(max-width:374px) {
  .urnavio-site .nav .language-switch { padding-inline: 7px; font-size: 13px; }
  .urnavio-site .brand strong { font-size: 17px; letter-spacing: .5px; }
  .urnavio-site .brand .mark { width: 28px; height: 34px; }
  .urnavio-site .menu { padding-inline: 8px; }
  .urnavio-site .brand small { display: none; }
}

/* icon tiles */
html[data-theme="dark"] .urnavio-site :is(.service-mark, .reference-mark) svg { background: #1b3a44; color: #8fd6dd; stroke: #8fd6dd; }
html[data-theme="dark"] .urnavio-site .service-mark svg { stroke: none; }

/* Foundation page */
.programme-intro, .programme-note { max-inline-size: 760px; color: var(--muted); }
.programme-note { margin-block-start: 22px; font-size: .9375rem; }
.urnavio-site .programme-grid { margin-block-start: 26px; }
.urnavio-site .programme-grid article { display: flex; flex-direction: column; gap: 8px; }
.urnavio-site .programme-grid article > * { margin: 0; }
.programme-status { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-size: .8125rem; }
.programme-status[data-status="o"] { background: #dbef95; color: #2c3a05; }
.programme-fund { margin-block-start: auto !important; padding-block-start: 10px; border-block-start: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }
.urnavio-site .programme-grid .source-link { margin-block-start: auto; }
