/* Deliberately small and dependency-free: served from this origin so the
   Content-Security-Policy can be default-src 'none'.

   MediTwin brand colours, sampled from logo/logo.png rather than guessed:
     teal  #21b795  (149079 px)
     navy  #201e4f  ( 94264 px)
   Keep these in step with the logo if it is ever replaced. */
:root {
  --brand-teal: #21b795;
  --brand-navy: #201e4f;

  --fg: #1c1e21;
  --muted: #6a7280;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #d9dce1;
  /* Navy for interactive elements: it carries enough contrast on white for
     button text at this weight, where the teal does not. */
  --accent: var(--brand-navy);
  --accent-hover: #2f2b6d;
  --error: #b3261e;
  --warn: #8a5300;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0 1rem 3rem;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
header, main, footer { max-width: 46rem; margin: 0 auto; }
header { padding: 2rem 0 1rem; }

/* --- brand ---------------------------------------------------------------
   The logo is a wide banner (2639x470) on a TRANSPARENT background, and its
   wordmark is half teal, half navy. width/height are declared on the <img> so
   the layout does not jump while it loads; this caps the rendered size. */
.brand { margin-bottom: 1.25rem; }
.brand img {
  display: block;
  width: 100%;
  max-width: 22rem;
  height: auto;
}

h1 { margin: 0; font-size: 1.5rem; }
/* A teal rule under the title, tying the page to the wordmark. */
h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: .5rem;
  background: var(--brand-teal);
  border-radius: 2px;
}
h2 { margin-top: 0; font-size: 1.15rem; }
h3 { font-size: 1rem; margin-bottom: .25rem; }
.sub, .help, .muted { color: var(--muted); }
.sub { margin: .25rem 0 0; }
.help { font-size: .9rem; }
.muted { font-size: .85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Default browser link blue has poor contrast on the dark background, so links
   follow the accent colour, which is checked for both schemes. */
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

label { display: block; margin: .75rem 0 .25rem; font-weight: 600; font-size: .9rem; }
input {
  width: 100%;
  padding: .55rem .65rem;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
button, .button {
  display: inline-block;
  margin-top: 1rem;
  padding: .5rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.button { margin-top: 0; }
button.secondary { background: transparent; color: var(--muted); border: 1px solid var(--line); }

dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
dt { font-weight: 600; color: var(--muted); font-size: .9rem; }
dd { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--bg);
  padding: .1rem .3rem;
  border-radius: 4px;
}
pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .75rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; }

.downloads { list-style: none; padding: 0; margin: 0; }
.downloads li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-top: 1px solid var(--line);
}
.downloads li:first-child { border-top: 0; }
.artefact { flex: 1; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }

.banner {
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid;
}
.banner-error { color: var(--error); border-color: var(--error); background: #fdeceb; }
.banner-closed { color: var(--warn); border-color: var(--warn); background: #fff6e5; }
.banner-info { color: var(--brand-navy); border-color: var(--brand-teal); background: #e9f8f3; }

footer { padding-top: 1.5rem; font-size: .85rem; color: var(--muted); }

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e8eb;
    --muted: #9aa3ad;
    /* Tinted towards the brand navy rather than neutral grey. */
    --bg: #14131f;
    --card: #1e1d2c;
    --line: #343247;
    /* The navy is far too dark to read on a dark background, so interactive
       elements switch to the teal, which has ample contrast on both. */
    --accent: var(--brand-teal);
    --accent-hover: #35c9a7;
    --error: #f2b8b5;
    --warn: #f5c977;
  }

  /* The logo's background is transparent and half its wordmark is #201e4f, so
     on a dark page that half would be almost invisible. Rather than filtering
     the image -- which would distort the teal and misrepresent the brand -- give
     it a light plate to sit on. The brand colours stay exact. */
  .brand img {
    background: #ffffff;
    padding: .6rem .85rem;
    border-radius: 8px;
    max-width: 20rem;
  }

  /* Dark buttons need dark text on the teal. */
  button, .button { color: #10231d; }

  /* Inputs default to a white field, which is jarring against a dark card. */
  input {
    background: #12111b;
    color: var(--fg);
    border-color: var(--line);
  }
  input::placeholder { color: #6d7480; }

  /* code/pre use --bg, which is now darker than the card; give them their own
     slightly lifted tone so they still read as insets. */
  code, pre { background: #12111b; }

  .banner-error { background: #2b1614; }
  .banner-closed { background: #2b2114; }
  .banner-info { color: var(--brand-teal); background: #10251f; }
}

/* Respect a reduced-motion preference: there is no animation here, but the
   focus ring should still be obvious for keyboard users. */
:where(a, button, input, .button):focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}
