/* Shared toolkit styles. Tool folders keep an identical copy as styles.css. */

:root {
  color-scheme: light;
  --black: #000000;
  --white: #ffffff;
  --paper: #f4f6f6;
  --ink: #1a1a1a;
  --muted: #333333;
  --teal: #3dd8c8;
  --magenta: #dd378a;
  --line: #b7c2c2;
  --card: #ffffff;
  --header: #111111;
  --header-ink: #ffffff;
  --link: #0b3d38;
  --high: #8c1d4a;
  --med: #6b3a06;
  --ok: #0d5c54;
  --callout-bg: #e7faf7;
  --callout-border: #0d5c54;
  --warn-bg: #fff4f8;
  --warn-border: #dd378a;
  --on-brand: #000000;
  --secondary-bg: #ffffff;
  --secondary-ink: #000000;
  --secondary-border: #000000;
  --input-bg: #ffffff;
  --input-ink: #1a1a1a;
  --input-border: #222222;
  --progress-track: #d9dddd;
  --progress-fill: #0b3d38;
  --focus: #000000;
  --focus-ring: #3dd8c8;
  --empty-border: #222222;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121212;
  --ink: #f4f4f4;
  --muted: #d6d6d6;
  --line: #5c5c5c;
  --card: #1c1c1c;
  --header: #000000;
  --header-ink: #ffffff;
  --link: #9af3ea;
  --high: #ffd0e2;
  --med: #ffd59a;
  --ok: #9af3ea;
  --callout-bg: #102422;
  --callout-border: #3dd8c8;
  --warn-bg: #2a121c;
  --warn-border: #dd378a;
  --secondary-bg: #1c1c1c;
  --secondary-ink: #f4f4f4;
  --secondary-border: #f4f4f4;
  --input-bg: #111111;
  --input-ink: #f4f4f4;
  --input-border: #f2f2f2;
  --progress-track: #333333;
  --progress-fill: #3dd8c8;
  --focus: #ffffff;
  --empty-border: #f4f4f4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #121212;
    --ink: #f4f4f4;
    --muted: #d6d6d6;
    --line: #5c5c5c;
    --card: #1c1c1c;
    --header: #000000;
    --header-ink: #ffffff;
    --link: #9af3ea;
    --high: #ffd0e2;
    --med: #ffd59a;
    --ok: #9af3ea;
    --callout-bg: #102422;
    --callout-border: #3dd8c8;
    --warn-bg: #2a121c;
    --warn-border: #dd378a;
    --secondary-bg: #1c1c1c;
    --secondary-ink: #f4f4f4;
    --secondary-border: #f4f4f4;
    --input-bg: #111111;
    --input-ink: #f4f4f4;
    --input-border: #f2f2f2;
    --progress-track: #333333;
    --progress-fill: #3dd8c8;
    --focus: #ffffff;
    --empty-border: #f4f4f4;
  }
}

* { box-sizing: border-box; }

html { font-size: 112.5%; }

html.large-text { font-size: 137.5%; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

img, svg, video { max-width: 100%; height: auto; }

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--white);
  color: var(--black);
  padding: 0.65rem 0.85rem;
  z-index: 6;
  min-height: 44px;
}

.skip:focus { top: 0.5rem; }

.site-header {
  background: var(--header);
  color: var(--header-ink);
}

.brand-bar {
  height: 0.45rem;
  background: linear-gradient(90deg, var(--teal) 0 50%, var(--magenta) 50% 100%);
}

.header-inner,
.wrap {
  width: min(960px, calc(100% - 1.5rem));
  margin: 0 auto;
}

.header-inner {
  padding: 1rem 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wordmark {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: var(--header-ink);
}

.site-header h1 {
  font-size: 1.7rem;
  line-height: 1.2;
  margin: 0.15rem 0 0;
  color: var(--header-ink);
}

.site-header .lede,
.site-header p {
  margin: 0.35rem 0 0;
  color: #f2f2f2;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.header-actions > button {
  flex: 1 1 9rem;
}

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0; }

h2 { font-size: 1.35rem; line-height: 1.3; }

h3 { font-size: 1.15rem; line-height: 1.35; }

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0 0.2rem;
}

.tool-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 0.8rem;
  color: var(--link);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 8px;
}

main { padding: 1rem 0 2.5rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.panel,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin: 0 0 1rem;
}

.card h2,
.card h3,
.panel h2,
.panel h3 { margin-top: 0.2rem; }

label { display: block; font-weight: 700; margin: 0.75rem 0 0.35rem; }

input, select, textarea, button { font: inherit; }

input[type="text"],
input[type="search"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.75rem;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--input-ink);
}

textarea { min-height: 8rem; resize: vertical; }

::placeholder { color: var(--muted); opacity: 1; }

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 2px solid #000000;
  background: var(--magenta);
  color: #000000;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

button.secondary,
a.secondary {
  background: var(--secondary-bg);
  color: var(--secondary-ink);
  border-color: var(--secondary-border);
}

button.ghost,
a.ghost {
  background: transparent;
  color: #ffffff;
  border-color: #ffffff;
}

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.row > * { flex: 1 1 12rem; }

.check {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-weight: 650;
  margin: 0.35rem 0;
  min-height: 44px;
  padding: 0.35rem 0;
}

.check input {
  width: 1.35rem;
  height: 1.35rem;
  min-width: 1.35rem;
  margin: 0;
  accent-color: #0b3d38;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 1rem;
  min-inline-size: 0;
}

legend { font-weight: 750; padding: 0 0.35rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--teal);
  color: #000000;
  font-weight: 750;
  font-size: 0.95rem;
}

.badge.outline {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
}

.hit {
  border-left: 0.4rem solid var(--magenta);
  padding-left: 0.75rem;
  margin: 0.8rem 0;
}

.risk-high { border-color: var(--high); }
.risk-medium { border-color: var(--med); }
.risk-low { border-color: var(--ok); }

.callout {
  background: var(--callout-bg);
  border: 2px solid var(--callout-border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.warning,
.state-error {
  background: var(--warn-bg);
  border: 2px solid var(--warn-border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
}

.state {
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 1rem;
}

.state-loading {
  background: var(--card);
  border: 2px solid var(--teal);
  color: var(--ink);
}

.state-empty {
  background: var(--card);
  border: 2px dashed var(--empty-border);
  color: var(--ink);
}

.progress {
  height: 0.85rem;
  background: var(--progress-track);
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0 0.75rem;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--progress-fill);
}

.update-banner {
  background: var(--teal);
  color: #000000;
  padding: 0.75rem 1rem;
}

.update-banner .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.update-banner p { margin: 0; color: #000000; font-weight: 650; }

.update-banner button {
  background: #ffffff;
  color: #000000;
  border-color: #000000;
}

.install-panel h2 { margin-top: 0; }

ul, ol { padding-left: 1.2rem; }

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

footer {
  border-top: 0.45rem solid var(--teal);
  background: #111111;
  color: #ffffff;
  padding: 1.2rem 0 2rem;
  font-size: 0.95rem;
}

footer a { color: var(--teal); }

footer p { color: #f2f2f2; }

.built-by {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.2rem 0.55rem;
  background: #3DD8C8;
  color: #111111;
  font-weight: 700;
}

.muted { color: var(--muted); }

.stack > * { margin-top: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--focus-ring);
}

@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }

  button,
  .button,
  .badge,
  .tool-nav a {
    border: 1px solid ButtonText;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 720px) {
  .header-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .header-actions {
    flex: 0 1 18rem;
    justify-content: flex-end;
  }

  .header-actions > button { flex: 0 1 auto; }

  .site-header h1,
  h1 { font-size: 2rem; }
}

[hidden] { display: none !important; }
