/* Shared styles for ai-manifest.ahnlak.com. Used by every page. */

:root {
  /* Light: green-bar printer paper */
  --bg: #f4f8ec;
  --band: #eef5e6;
  --fg: #11301b;
  --muted: #2b4f35;
  --accent: #0b4a20;
  --rule: #5b8a68;
  --code-bg: #e8f0df;
  --code-fg: #0e2b17;
  --hole: #dfe8d6;
  --select-bg: #11301b;
  --select-fg: #f4f8ec;
  --glow: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark: phosphor terminal */
    --bg: #060a06;
    --band: #060a06;
    --fg: #8ff0a8;
    --muted: #6fcf88;
    --accent: #4dff7e;
    --rule: #2e6a3d;
    --code-bg: #0c150d;
    --code-fg: #a8ffbf;
    --hole: transparent;
    --select-bg: #8ff0a8;
    --select-fg: #060a06;
    --glow: 0 0 2px rgb(77 255 126 / 0.35);
  }
}

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

html {
  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono",
               Menlo, Consolas, "Liberation Mono", monospace;
  font-size: clamp(15px, 0.9rem + 0.25vw, 17px);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--fg);
  background-color: var(--bg);
  /* Light: wide green bands, like fanfold paper. Dark: faint scanlines. */
  background-image: repeating-linear-gradient(
    to bottom, var(--band) 0 4.8rem, var(--bg) 4.8rem 9.6rem);
  text-shadow: var(--glow);
}

@media (prefers-color-scheme: dark) {
  body {
    background-image: repeating-linear-gradient(
      to bottom, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px);
  }
}

::selection { background: var(--select-bg); color: var(--select-fg); text-shadow: none; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--fg);
  color: var(--bg);
  z-index: 1;
}
.skip:focus { left: 1rem; top: 1rem; }

.page {
  max-width: 76ch;
  margin: 0 auto;
  padding: 2.5rem 16px 3rem;
}

/* Tractor-feed holes down both sides of the "paper", light mode only,
   and only when there is room for them. */
@media (min-width: 52rem) {
  .page {
    padding-inline: 3.5rem;
    background:
      radial-gradient(circle, var(--hole) 0 0.42rem, transparent 0.46rem)
        left 0.9rem top 0 / 1.6rem 1.6rem repeat-y,
      radial-gradient(circle, var(--hole) 0 0.42rem, transparent 0.46rem)
        right 0.9rem top 0 / 1.6rem 1.6rem repeat-y;
    background-origin: border-box;
  }
}

header { margin-bottom: 2.5rem; }

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}
h1::after {
  content: "\2588";
  content: "\2588" / "";
  margin-left: 0.15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  h1::after { animation: none; }
}

.tagline { margin: 0 0 1.5rem; color: var(--muted); }

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
nav a::before { content: "> "; content: "> " / ""; text-decoration: none; }

h2 {
  font-size: 1.15rem;
  color: var(--accent);
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--rule);
}
h2::before { content: "## "; content: "## " / ""; color: var(--muted); }

p, ul, ol, table, pre { margin: 0 0 1.1rem; }
ul, ol { padding-left: 2.2ch; }
li { margin-bottom: 0.35rem; }

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  text-shadow: none;
}
a:focus-visible, pre:focus-visible, .skip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

code {
  font-family: inherit;
  font-size: 0.95em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.05em 0.3em;
  border-radius: 2px;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--rule);
  border-left-width: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.92rem;
}
pre code { background: none; padding: 0; font-size: inherit; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px dashed var(--rule);
}
th { color: var(--accent); font-weight: 700; }
td:first-child { white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

.versions { list-style: none; padding: 0; }
.versions li {
  display: grid;
  grid-template-columns: 11ch 1fr;
  gap: 0 1.5ch;
}
.versions .when { color: var(--muted); }
.badge {
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid currentColor;
  padding: 0 0.4em;
  margin-left: 0.5ch;
  white-space: nowrap;
}

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

footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
footer p { margin: 0 0 0.4rem; }

/* Spec pages */
.crumbs { margin: 0 0 2rem; }
.crumbs ul { list-style: none; margin: 0; padding: 0;
             display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.crumbs a::before { content: "> "; content: "> " / ""; }
.table-wrap { overflow-x: auto; margin: 0 0 1.1rem; }
.table-wrap:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.table-wrap table { margin: 0; min-width: 34rem; }
h2 a.anchor, h3 a.anchor { font-weight: inherit; text-decoration: none; color: inherit; }
h2 a.anchor:hover, h3 a.anchor:hover { background: none; color: inherit; text-decoration: underline; }
