/* ==========================================================================
   site.css — terminal aesthetic for the Team docs. Plain CSS, no front matter.
   Theme custom properties are declared once here and only re-valued (never
   renamed) in the theme blocks below.
   ========================================================================== */
:root {
  --bg: #fff;
  --fg: #111;
  --border: rgba(0, 0, 0, 0.12);
  --accent: #111;
  --code-bg: rgba(0, 0, 0, 0.04);
  --admonition-bg: rgba(0, 0, 0, 0.04);
  --muted: #5a5a5a;
  --muted-2: #8a8a8a;
}

/* System dark mode: applies only when no explicit theme is forced. A user who
   forces light ([data-theme="light"]) keeps the light palette even on a dark OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --fg: #f2f2f2;
    --border: rgba(255, 255, 255, 0.16);
    --accent: #f2f2f2;
    --code-bg: rgba(255, 255, 255, 0.06);
    --admonition-bg: rgba(255, 255, 255, 0.06);
    --muted: #b8b8b8;
    --muted-2: #909090;
  }
}

/* Forced light — same as base :root, wins over system dark. */
[data-theme="light"] {
  --bg: #fff;
  --fg: #111;
  --border: rgba(0, 0, 0, 0.12);
  --accent: #111;
  --code-bg: rgba(0, 0, 0, 0.04);
  --admonition-bg: rgba(0, 0, 0, 0.04);
  --muted: #5a5a5a;
  --muted-2: #8a8a8a;
}

/* Forced dark — same as the system dark palette, regardless of OS. */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --border: rgba(255, 255, 255, 0.16);
  --accent: #f2f2f2;
  --code-bg: rgba(255, 255, 255, 0.06);
  --admonition-bg: rgba(255, 255, 255, 0.06);
  --muted: #b8b8b8;
  --muted-2: #909090;
}

/* --- reset ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0;
}

/* --- base typography ----------------------------------------------------- */
body {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  /* sticky footer */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

strong,
b {
  font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 2em;
  margin-bottom: 0.5em;
  line-height: 1.4;
  text-transform: lowercase;
}

h1 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1.3;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25px;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.25px;
}

p {
  margin: 1em 0;
}

hr {
  border: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.1;
  margin: 3em 0 2.25em;
}

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

/* --- links + inverted hover ---------------------------------------------- */
a {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background 0.15s ease, color 0.15s ease;
  opacity: 0.9;
}

a:hover {
  color: var(--bg);
  background: var(--fg);
  opacity: 1;
}

/* --- layout / sticky footer ---------------------------------------------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  width: 100%;
  flex: 1;
}

/* --- header / nav -------------------------------------------------------- */
header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

header .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

header .site-title {
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--fg);
  text-transform: lowercase;
  background: none;
  opacity: 1;
}

header .site-title:hover {
  color: var(--bg);
  background: var(--fg);
}

header nav a + a {
  margin-left: 1.1rem;
}

header nav a {
  text-transform: lowercase;
  color: var(--muted);
  background: none;
  opacity: 1;
}

header nav a:hover {
  color: var(--bg);
  background: var(--fg);
}

/* contributor docs live in a "contributing" dropdown, kept out of the user-facing bar */
header nav details.nav-dd {
  position: relative;
  display: inline-block;
  margin-left: 1.1rem;
}

header nav details.nav-dd > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  text-transform: lowercase;
}

header nav details.nav-dd > summary::-webkit-details-marker {
  display: none;
}

header nav details.nav-dd > summary::after {
  content: " \25BE";
  color: var(--muted-2);
}

header nav details.nav-dd[open] > summary {
  color: var(--fg);
}

header nav .nav-dd-menu {
  position: absolute;
  right: 0;
  top: 1.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.4rem 0;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

header nav .nav-dd-menu a {
  display: block;
  margin: 0; /* override the `nav a + a` inline spacing */
  padding: 0.25rem 0.9rem;
  white-space: nowrap; /* keep "project-tracking" on one line */
  color: var(--muted);
}

header nav .nav-dd-menu a:hover {
  color: var(--bg);
  background: var(--fg);
}

/* --- footer -------------------------------------------------------------- */
footer {
  margin-top: auto;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9em;
  color: var(--muted);
}

footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

footer a {
  text-transform: lowercase;
  color: var(--muted);
  background: none;
  opacity: 1;
}

footer a:hover {
  color: var(--bg);
  background: var(--fg);
}

footer .copyright {
  color: var(--muted-2);
  font-size: 0.85em;
}

/* --- code / pre ---------------------------------------------------------- */
code,
pre {
  font-family: inherit;
  font-size: 13px;
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
}

/* --- tables (thin borders, header tint, no zebra) ------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13px;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

th {
  background: var(--code-bg);
  font-weight: 600;
}

/* --- blockquote admonitions (left accent border + faint tint) ------------ */
blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--accent);
  background: var(--admonition-bg);
  color: var(--muted);
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* --- home-only blinking block cursor ------------------------------------- */
@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

body.home main>h1::after {
  content: "█";
  margin-left: 2px;
  color: var(--muted);
  animation: blink 1.1s steps(1) 1.6s infinite;
}

/* --- focus-visible (sharp outline) --------------------------------------- */
a:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 2px;
}

/* --- theme toggle button ------------------------------------------------- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1em;
  color: var(--muted);
  padding: 0.25rem;
  margin-left: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--fg);
}

/* --- reduced motion: cursor visible, no blink; no hover transition ------- */
@media (prefers-reduced-motion: reduce) {
  body.home main>h1::after {
    animation: none;
  }

  a {
    transition: none;
  }
}

/* --- responsive header reflow (narrow viewports) ------------------------- */
@media (max-width: 600px) {
  header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  header nav {
    margin-top: 0.5rem;
  }

  header nav a {
    margin-right: 1rem;
  }

  header nav a + a {
    margin-left: 0;
  }

  h1 {
    font-size: 19px;
  }
}
