/* AuthBox — stylesheet for every page in authbox/.
   Each app on hio-mitos.github.io has its own design; this one is AuthBox's green look.
   The homepage uses assets/home.css. Only assets/theme.js is shared. */

:root {
  color-scheme: light dark;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --border: #e2e7e6;
  --text: #111a18;
  --muted: #5c6b67;
  --accent: #0f9d77;
  --accent-soft: #e4f5ef;
  --warn: #a8620a;
  --warn-soft: #fdf3e3;
  --warn-border: #f0d5a8;
  --radius: 14px;
  --maxw: 720px;
}

/* Dark palette. Applied when the system asks for it, unless the viewer has
   explicitly chosen light; and always when they have explicitly chosen dark. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1211;
    --surface: #161b1a;
    --surface-2: #1c2322;
    --border: #242d2b;
    --text: #e8edeb;
    --muted: #9baaa6;
    --accent: #2dd4a7;
    --accent-soft: #13302a;
    --warn: #f0b866;
    --warn-soft: #2a2013;
    --warn-border: #4a3a1e;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1211;
  --surface: #161b1a;
  --surface-2: #1c2322;
  --border: #242d2b;
  --text: #e8edeb;
  --muted: #9baaa6;
  --accent: #2dd4a7;
  --accent-soft: #13302a;
  --warn: #f0b866;
  --warn-soft: #2a2013;
  --warn-border: #4a3a1e;
}

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 80px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { max-width: var(--maxw); margin: 0 auto; }
main.wide { max-width: 880px; }

/* ---------- Header ---------- */

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 48px 0 8px;
}

.badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 88%, black));
  display: grid; place-items: center;
  flex: none;
  overflow: hidden;
}
.badge svg { width: 24px; height: 24px; }
.badge img { width: 100%; height: 100%; object-fit: cover; }
.badge.lg { width: 64px; height: 64px; border-radius: 16px; }
.badge.lg svg { width: 34px; height: 34px; }

h1 { font-size: 26px; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }

h2 { font-size: 19px; margin: 40px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 28px 0 8px; letter-spacing: -0.005em; }

p, li { color: var(--text); }
strong { font-weight: 650; }
a { color: var(--accent); }

/* ---------- Callout ---------- */

.lede {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 28px 0 8px;
}
.lede p { margin: 0; }
.lede p + p { margin-top: 10px; }
.lede ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

/* Tables whose header cells are the first column of each row, not a top row. */
table.rows th {
  width: 34%;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--text);
  border-right: 1px solid var(--border);
}
table.rows tr:last-child th { border-bottom: none; }
@media (max-width: 520px) {
  table.rows th, table.rows td { display: block; width: auto; border-right: none; }
  table.rows th { border-bottom: none; padding-bottom: 0; color: var(--muted); }
}

code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  /* Long paths (registry keys, file paths) must wrap rather than widen the page. */
  overflow-wrap: anywhere;
}

/* ---------- Pill links ---------- */

.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.links a {
  display: inline-block;
  font-size: 13px;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.links a:hover { border-color: var(--accent); color: var(--accent); }
.links a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.links a.primary:hover { color: #fff; filter: brightness(1.06); }

/* ---------- Download ---------- */

.download {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0 8px;
}
.download .dl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.download .meta { color: var(--muted); font-size: 14px; }
.btn {
  display: inline-block;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.btn:hover { filter: brightness(1.06); color: #fff; }
.btn.secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); font-weight: 500; }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }

.download .pending { margin: 0; font-size: 15px; }
.download .pending strong { display: block; margin-bottom: 4px; }

.checksum {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.checksum code {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  word-break: break-all;
  line-height: 1.5;
  background: var(--surface-2);
}

/* ---------- Release history ---------- */

.release {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 6px;
  margin: 20px 0 0;
  scroll-margin-top: 20px;
}
.release:target { border-color: var(--accent); }
.release-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.release-head h2 { margin: 0; font-size: 20px; }
.release-head h2 a { color: inherit; text-decoration: none; }
.release-head h2 a:hover { color: var(--accent); }
.release-head time { color: var(--muted); font-size: 14px; }
.release .tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
}
.release h3 {
  margin: 16px 0 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.release ul { margin: 0 0 12px; padding-left: 20px; }
.release li { margin: 3px 0; }
.release p { margin: 8px 0 12px; }

.latest { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Keys and expandable FAQs ---------- */

kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  font-family: inherit;
  font-size: 0.85em;
  line-height: 1.6;
  white-space: nowrap;
}

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 10px 0;
}
details[open] { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
details > summary { cursor: pointer; font-weight: 600; }
details > summary:hover { color: var(--accent); }
details > p { margin: 10px 0 2px; }

/* ---------- Breadcrumb / back link ---------- */

.crumb { padding: 28px 0 0; font-size: 14px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

/* ---------- Footer ---------- */

footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

@media (max-width: 520px) {
  header { padding-top: 32px; }
  h1 { font-size: 22px; }
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

@media (max-width: 520px) {
  .theme-toggle { top: 10px; right: 10px; width: 34px; height: 34px; }
}
