/* Shared adaptations for index.html and systems.html: colour scheme, forced colours, touch targets.
   Loaded after tw-site.min.css and the inline page styles. */

:root { color-scheme: light dark; }

/* ---------- Status pills in colours Tailwind 2's default palette lacks ---------- */
.bg-teal-100 { background-color: #ccfbf1; }
.text-teal-800 { color: #115e59; }
.bg-sky-100 { background-color: #e0f2fe; }
.text-sky-800 { color: #075985; }
.bg-orange-100 { background-color: #ffedd5; }
.text-orange-800 { color: #9a3412; }
.bg-amber-100 { background-color: #fef3c7; }
.text-amber-900 { color: #78350f; }

/* ---------- Space reserved for the fixed nav, matched to where its links wrap ---------- */
:root { --nav-offset: 11.75rem; }
@media (min-width: 348px) { :root { --nav-offset: 9.25rem; } }
@media (min-width: 512px) { :root { --nav-offset: 6.75rem; } }
@media (min-width: 768px) { :root { --nav-offset: 5rem; } }

/* ---------- Touch targets: 44px on coarse pointers ---------- */
@media (pointer: coarse) {
  :root { --nav-offset: 13.5rem; }
  nav a,
  article.group a,
  #projects p > a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    min-inline-size: 44px;
  }
  .site-nav-links a { padding: 0; }
  .site-nav-inner,
  .site-nav-links { row-gap: 0; }
}
@media (pointer: coarse) and (min-width: 348px) { :root { --nav-offset: 10.75rem; } }
@media (pointer: coarse) and (min-width: 512px) { :root { --nav-offset: 8rem; } }
@media (pointer: coarse) and (min-width: 768px) { :root { --nav-offset: 5.25rem; } }

/* ---------- Dark colour scheme ---------- */
@media (prefers-color-scheme: dark) {
  body.bg-gray-100 { background-color: #0b1120; color: #f1f5f9; }
  #about.bg-white,
  main > article.bg-white { background-color: #0f172a; }
  #projects.bg-gray-50 { background-color: #0b1120; }

  /* Cards and image wells inside the light regions */
  #projects article.bg-white { background-color: #1e293b; }
  #projects div.bg-gray-200 { background-color: #334155; }

  :is(#about, #projects, main > article) :is(.text-gray-900, .text-gray-800) { color: #f1f5f9; }
  :is(#about, #projects, main > article) :is(div, p).text-gray-600 { color: #cbd5e1; }
  :is(#about, #projects, main > article) :is(.text-blue-600, .text-blue-700) { color: #93c5fd; }
  :is(#about, #projects, main > article) :is(.hover\:text-blue-800, .hover\:text-blue-900):hover { color: #bfdbfe; }

  /* systems.html prose */
  .prose-block h2 { color: #f1f5f9; }
  .prose-block h3 { color: #93c5fd; }
  .prose-block p,
  .prose-block li { color: #cbd5e1; }
  .prose-block .capability-label { color: #93c5fd; }
  .faq-item { border-bottom-color: #334155; }
  main > article section.bg-blue-50 { background-color: #172554; border-color: #1e40af; }
  main > article section.bg-blue-50 p.text-gray-700 { color: #e2e8f0; }
  /* Inverted so the button edge keeps 3:1 against the dark panel behind it */
  main > article a.bg-blue-800 { background-color: #bfdbfe; color: #1e3a8a; }
  main > article a.bg-blue-800:hover { background-color: #dbeafe; }

  /* Every surface is dark now, so the light ring is the one with contrast */
  a:focus-visible,
  button:focus-visible { outline-color: #93c5fd; }
}

/* Dark scheme: tone the saturated blue bands down so they sit with the dark sections */
@media (prefers-color-scheme: dark) {
  .hero.bg-blue-700 { background: linear-gradient(160deg, #172554 0%, #1e3a8a 100%); }
  .page-hero { background: linear-gradient(165deg, #172554 0%, #1e3a8a 100%); }
  body > nav.bg-blue-900 { background-color: #172554; }
  #contact.bg-blue-900 { background-color: #172554; }
  /* Light screenshots glare against dark cards */
  #projects article img,
  #about img { filter: brightness(0.9); }
}

/* ---------- Forced colours (Windows High Contrast) ---------- */
@media (forced-colors: active) {
  /* Backgrounds and shadows are removed: redraw the boundaries they implied */
  body > nav { border-bottom: 1px solid CanvasText; }
  article.group,
  main > article section.bg-blue-50 { border: 1px solid CanvasText; }
  a.rounded-full,
  span.rounded-full { border: 1px solid CanvasText; }
  /* A url() background keeps its own colours and may not contrast */
  .wave { display: none; }
  .site-nav-links a[aria-current="page"] { text-decoration-color: CanvasText; }
}
