/*
 * Copyright 2026 NX1X. Licensed under the Apache License, Version 2.0.
 *
 * OpenMila website stylesheet. One file, no framework, no CDN, no web fonts.
 *
 * Brand kit contract: /brand/tokens.css is loaded BEFORE this file and is
 * expected to define --brand-accent, --brand-danger and --brand-success on
 * :root. If the brand kit has not landed yet (or tokens.css 404s), every
 * var() below falls back to the product's own Theme.swift values, so the
 * site renders identically. Do not remove the fallbacks.
 *   accent  rgb(0, 122, 255)  #007aff
 *   danger  rgb(255, 59, 48)  #ff3b30
 *   success rgb(52, 199, 89)  #34c759
 */

:root {
  color-scheme: light dark;

  /* Product brand colours. Used for non-text surfaces (rules, dots, focus). */
  --accent: var(--brand-accent, #007aff);
  --danger: var(--brand-danger, #ff3b30);
  --success: var(--brand-success, #34c759);

  /* Text-safe derivatives. WCAG AA against --bg and --surface. */
  --bg: #ffffff;
  --surface: #f5f6f8;
  --surface-2: #eceef2;
  --border: #d5d9e0;
  --text: #1a1d21;
  --text-muted: #565f6c;
  --link: #0060d6;
  --link-hover: #0057c2;
  --on-accent: #ffffff;
  --accent-solid: #0060d6;
  --ok: #146c2e;
  --warn: #8a5300;
  --no: #b42318;

  --radius: 10px;
  --maxw: 68rem;
  --gutter: 1.25rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Hebrew", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d232c;
    --border: #2b323c;
    --text: #e6e9ef;
    --text-muted: #a8b1bf;
    --link: #5aaeff;
    --link-hover: #8cc6ff;
    --on-accent: #08111c;
    --accent-solid: #5aaeff;
    --ok: #3fb950;
    --warn: #e3b341;
    --no: #ff6b60;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

/* ---------- Skip link and focus ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent-solid);
  color: var(--on-accent);
  z-index: 10;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-block: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  margin-inline-end: auto;
}
.brand img { display: block; height: 28px; width: auto; }
.brand:hover { color: var(--link-hover); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Every item in the main nav, including the GitHub link, is the same kind of
   pill: same height, same padding, same baseline. The GitHub link is not a
   special case here, which is what keeps it from looking bolted on. */
.site-nav a {
  display: inline-flex;
  align-items: center;
  line-height: 1.1;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--link-hover); background: var(--surface); }
.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-2);
}

/* The GitHub mark in the nav, and the star count github.js puts beside it.
   The count starts hidden and is revealed only when the API answers, so a
   reader who is offline or rate-limited gets the plain link with no empty
   badge holding space open, and it is never shown for a repository with zero
   stars. */
.gh-link { gap: 0.45rem; }
.gh-mark { display: block; width: 16px; height: 16px; flex: none; }

.gh-stars {
  display: inline-block;
  line-height: 1.4;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gh-stars[hidden] { display: none; }

main { display: block; }

section { margin-block: 3rem; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding-block: 2.25rem 3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.site-footer p { margin: 0.5rem 0; max-width: 60ch; }

/* Footer links grouped by kind rather than run together in one list: the
   site's own pages, the project's homes on GitHub, and NX1X LAB. */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem 3rem;
  margin: 0 0 2rem;
}
.footer-col { min-width: 9rem; }
.footer-col .footer-heading {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.footer-col ul {
  display: block;
  margin: 0;
  padding: 0;
}
.footer-col li { list-style: none; margin: 0 0 0.4rem; }
.footer-col a { color: var(--text-muted); text-decoration: none; }
.footer-col a:hover { color: var(--link-hover); text-decoration: underline; }

.footer-legal {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.footer-legal p { margin: 0.5rem 0; max-width: 60ch; }

/* ---------- Typography ---------- */

h1, h2, h3, h4 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); margin: 0 0 0.75rem; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.1vw, 1.9rem); margin: 2.5rem 0 0.75rem; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }
h4 { font-size: 1.05rem; margin: 1.25rem 0 0.35rem; }
p, li { max-width: 72ch; }
p { margin: 0 0 1rem; }

a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }

.lead {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  color: var(--text-muted);
  max-width: 62ch;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.small { font-size: 0.925rem; color: var(--text-muted); }

/* ---------- Hero ---------- */

.hero { padding-block: 3.5rem 1rem; }
.hero .lead { margin-bottom: 1.75rem; }

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent-solid);
  background: var(--accent-solid);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--link-hover); border-color: var(--link-hover); color: var(--on-accent); }

.btn-secondary {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface); color: var(--link-hover); border-color: var(--accent); }

/* copy.js creates a <button class="btn">, and a button inherits neither the
   page font nor the anchor's pointer. Contrast is left alone while it is
   disabled: a paler label would be harder to read, not easier. */
button.btn { font: inherit; font-weight: 600; line-height: inherit; cursor: pointer; }
button.btn:disabled { cursor: default; }

/* ---------- Cards and grids ---------- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  padding: 0;
  margin: 1.5rem 0;
  list-style: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}
.card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card p, .card li { max-width: none; }

.note {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.note > :last-child { margin-bottom: 0; }
.note h2, .note h3 { margin-top: 0; }

.note-warn { border-left-color: var(--warn); }

/* ---------- Status pills ---------- */

.pill {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill-done { color: var(--ok); }
.pill-partial { color: var(--warn); }
.pill-written { color: var(--text-muted); }
.pill-planned { color: var(--no); }
.pill-na { color: var(--text-muted); }
/* Not a status: the macOS column of the parity tables, where every row is a
   Mila feature by definition. Deliberately quiet, so it reads as the ruler and
   not as a score. */
.pill-baseline { color: var(--text-muted); border-style: dashed; }

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

.table-scroll { overflow-x: auto; margin: 1.25rem 0; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.975rem;
}
caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 0.5rem;
  color: var(--text-muted);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 700; }
thead th { border-bottom: 2px solid var(--border); }
tbody th { font-weight: 600; }
td p, td li { max-width: none; }

/* ---------- Code ---------- */

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}
pre code { background: none; padding: 0; font-size: 0.9rem; }

.codeblock { position: relative; margin: 0 0 1rem; }
.codeblock pre { margin: 0; }

/* Injected by copy.js only. With JavaScript off the button never exists. */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  inset-inline-end: 0.5rem;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--link);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--link-hover); }

/* ---------- Definition lists ---------- */

dl.spec { margin: 1.25rem 0; }
dl.spec dt { font-weight: 700; margin-top: 1rem; }
dl.spec dd { margin: 0.15rem 0 0; color: var(--text-muted); max-width: 72ch; }

/* ---------- FAQ ---------- */

.faq h2 { margin-top: 2.75rem; }
.faq > div { padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }

/* ---------- Documentation page ---------- */

/* One column on a phone, with the contents list first; two from 60rem up,
   where the list can stick beside the prose. */
.docs-layout {
  display: grid;
  gap: 1.5rem 2.5rem;
  align-items: start;
  padding-block: 1.5rem 0;
}

.docs-toc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
}
.docs-toc h2 { margin: 0 0 0.5rem; }
.docs-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.docs-toc li { max-width: none; counter-increment: toc; }
.docs-toc li::before {
  content: counter(toc) ".";
  color: var(--text-muted);
  padding-inline-end: 0.4rem;
}
.docs-toc a {
  display: inline-block;
  padding-block: 0.2rem;
  text-decoration: none;
}
.docs-toc a:hover { text-decoration: underline; }
.docs-toc p { margin: 0.75rem 0 0; }

.docs-body > h1 { margin-top: 0; }
.docs-body > h2 {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  margin-top: 3rem;
}

.docs-copy { margin: 1.5rem 0 2rem; }
.docs-copy .actions { margin-bottom: 0.5rem; }
.docs-copy .small { margin: 0; min-height: 1.5rem; }

.docs-raw { margin-top: 1rem; }
.docs-raw-text {
  display: block;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  resize: vertical;
}

@media (min-width: 60rem) {
  .docs-layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .docs-toc {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
  }
}

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

/* The four large, obvious buttons at the top of /download. Same visual
   weight for all four: this page does not rank Windows over Linux or an
   installer over a portable build, it just gets a reader to a file fast. */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 1.25rem;
  padding: 0;
  list-style: none;
}
.dl-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.15rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent-solid);
  background: var(--accent-solid);
  color: var(--on-accent);
  text-decoration: none;
}
.dl-card:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: var(--on-accent);
}
.dl-os {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}
.dl-title { font-size: 1.2rem; font-weight: 700; }
.dl-meta {
  display: block;
  min-height: 1.2rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  overflow-wrap: anywhere;
}

/* A short, in-page table of contents for the reference material that follows
   the buttons. Deliberately not the sticky sidebar treatment .docs-toc uses:
   this page is one column, not two. */
.page-toc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 2.5rem;
  font-size: 0.95rem;
}
.page-toc .eyebrow { margin: 0 0 0.6rem; }
.page-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  counter-reset: toc;
}
.page-toc li { max-width: none; counter-increment: toc; }
.page-toc li::before {
  content: counter(toc) ".";
  color: var(--text-muted);
  padding-inline-end: 0.35rem;
}
.page-toc a { text-decoration: none; }
.page-toc a:hover { text-decoration: underline; }

/* ---------- Breadcrumbs ---------- */

.crumbs { font-size: 0.925rem; color: var(--text-muted); padding-block: 1.25rem 0; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.crumbs li::after { content: "/"; padding-inline-start: 0.4rem; color: var(--border); }
.crumbs li:last-child::after { content: ""; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  a, .btn, .copy-btn { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
  html { scroll-behavior: smooth; }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 34rem) {
  body { font-size: 1rem; }
  .site-header .wrap { padding-block: 0.7rem; }
  .brand { font-size: 1.05rem; }
  .site-nav ul { gap: 0.15rem 0.2rem; }
  .site-nav a { padding: 0.4rem 0.55rem; }
  .gh-link { gap: 0.35rem; }
  .btn { display: block; width: 100%; text-align: center; }
  .actions { gap: 0.6rem; }
  .dl-card { padding: 1rem 1.1rem; }
  .footer-nav { gap: 1.25rem 2rem; }
}
