/* ------------------------------------------------------------------
   monitorctl pages, in the Felthos Foundry look: dark warm iron, bone
   text, ember accent, a serif for reading and a mono for commands,
   codes and data. The colours are the front page's (public/style.css).
   The pages are rendered by the Worker (src/monitorctl/pages.js).
   ------------------------------------------------------------------ */
:root {
  --bg: #1a1714;
  --bg-deep: #100e0c;
  --panel: #14110f;
  --fg: #ece6dc;
  --muted: #8d857b;
  --dim: #5a544d;
  --ember: #e0784a;
  --ember-hot: #ffb27a;
  --warn: #ff9c92;
  --rule: #2a2622;
  --glow: rgba(224, 120, 74, 0.14);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}
/* Light theme, chosen with the header switch. Dark is the default. */
:root[data-theme="light"] {
  --bg: #f4efe6;
  --bg-deep: #ebe3d6;
  --panel: #ede5d8;
  --fg: #1f1b17;
  --muted: #645c52;
  --dim: #7f776c;
  --ember: #c4572a;
  --ember-hot: #a3441c;
  --warn: #b3261e;
  --rule: #dcd2c3;
  --glow: rgba(224, 120, 74, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--dim) var(--bg-deep); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 600px at 12% 0%, var(--glow), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--ember); color: var(--bg); }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
main { flex: 1; }
code { font-family: var(--mono); font-size: 0.88em; }

/* Links inside running text, and the monitor names in the table. */
.prose a, .after a, td a, .crumb a {
  border-bottom: 1px solid var(--dim);
  transition: border-color 0.2s, color 0.2s;
}
.prose a:hover, .prose a:focus-visible, .after a:hover, .after a:focus-visible, td a:hover, td a:focus-visible, .crumb a:hover, .crumb a:focus-visible {
  color: var(--ember-hot);
  border-bottom-color: var(--ember);
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 16px; padding-top: 40px; }
.home { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; }
.mark { width: 36px; height: 36px; flex: none; color: var(--fg); }
.mark .chev { stroke: var(--ember); }
.name { font-size: 1.35rem; letter-spacing: 0.01em; }
.top-end { display: inline-flex; align-items: center; gap: 20px; }
.nav-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--ember-hot); border-bottom-color: var(--ember); }
.theme-switch { display: inline-flex; padding: 3px; border: 1px solid var(--rule); border-radius: 999px; }
.theme-switch button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.theme-switch button::after { content: ""; position: absolute; inset: -7px 0; }
.theme-switch svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch button:hover { color: var(--ember-hot); }
.theme-switch button:focus-visible { outline-offset: 2px; }
.theme-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); cursor: default; }

/* ---------- opening ---------- */
h1 {
  margin: 0;
  font-size: clamp(2.3rem, 6.2vw, 4rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2 { margin: 0 0 16px; font-size: 1.5rem; font-weight: 400; line-height: 1.2; letter-spacing: -0.005em; }
section { padding-top: 64px; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0 64px;
  align-items: end;
  padding-top: 72px;
}
.aside { padding-bottom: 0.35em; }
.lede { margin: 0 0 20px; font-size: 1.2rem; line-height: 1.5; color: var(--muted); max-width: 44ch; text-wrap: pretty; }
.fine { margin: 0; font-family: var(--mono); font-size: 0.75rem; line-height: 1.7; letter-spacing: 0.04em; color: var(--muted); }
.pour {
  grid-column: 1 / -1;
  height: 1px;
  margin-top: 48px;
  background: linear-gradient(90deg, var(--ember-hot), var(--ember), var(--dim));
  background-size: 300% 100%;
  background-position: 100% 0;
  animation: pour 8s ease-in-out infinite;
}
@keyframes pour {
  0%, 60%, 100% { background-position: 100% 0; opacity: 0.6; }
  20% { background-position: 0% 0; opacity: 1; }
}

/* ---------- running text ---------- */
.prose { margin: 0 0 20px; max-width: 68ch; color: var(--muted); text-wrap: pretty; }
.prose strong { font-weight: 400; color: var(--fg); }
.prose code, .after code, .summary code { color: var(--fg); }
.after { margin: 14px 0 0; max-width: 56ch; font-size: 0.98rem; color: var(--muted); text-wrap: pretty; }
.empty { margin: 0 0 20px; padding: 20px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--muted); }

/* ---------- terminal blocks ---------- */
.term {
  margin: 0;
  padding: 18px 20px;
  /* Long lines wrap on screen and still copy as one line. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--fg);
  tab-size: 4;
}
.term .p { color: var(--ember); user-select: none; -webkit-user-select: none; }
.term .o { color: var(--muted); }
.term.wrapping { font-size: 0.8rem; color: var(--muted); }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.copy {
  position: relative;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy::after { content: ""; position: absolute; inset: -6px 0; }
.copy:hover, .copy:focus-visible { color: var(--ember-hot); border-color: var(--ember); }
.copy[data-done] { color: var(--fg); border-color: var(--dim); }

/* ---------- install and commands ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px 64px; align-items: start; }
/* A long command scrolls inside its block and never widens the page. */
.split > * { min-width: 0; }
.commands { margin: 32px 0 0; border-top: 1px solid var(--rule); }
.commands > div { padding: 13px 0; border-bottom: 1px solid var(--rule); }
.commands dt code { font-size: 0.86rem; color: var(--fg); }
.commands dd { margin: 2px 0 0; font-size: 0.98rem; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { margin: 0 0 24px; overflow-x: auto; scrollbar-color: var(--dim) transparent; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  padding: 0 20px 10px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
td { padding: 12px 20px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr { transition: background-color 0.15s; }
tbody tr:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.data { font-family: var(--mono); font-size: 0.86rem; color: var(--muted); white-space: nowrap; }
td .unnamed { color: var(--muted); }
td small { margin-left: 10px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* What the reports found. The word carries the meaning, and the mark repeats it. */
.v { white-space: nowrap; }
.v::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; vertical-align: 0.06em; }
.v--works::before { background: var(--ember); }
.v--ignored::before { box-shadow: inset 0 0 0 1.5px var(--warn); }
.v--mixed::before { background: linear-gradient(90deg, var(--ember) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--ember); }
.v--untested, .v--unsupported { color: var(--muted); }
.v--untested::before, .v--unsupported::before { height: 1.5px; border-radius: 0; background: var(--dim); vertical-align: 0.3em; }

/* ---------- one monitor ---------- */
.crumb { margin: 40px 0 0; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.intro--monitor { display: block; padding-top: 28px; }
.facts { margin: 18px 0 0; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); }
.summary { margin-top: 36px; max-width: 60ch; }
.summary p { margin: 0 0 10px; font-size: 1.28rem; line-height: 1.45; text-wrap: pretty; }
.intro--monitor > .prose { margin-top: 24px; }

/* ---------- footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 72px;
  padding-bottom: 28px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.foot a { border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.foot a:hover, .foot a:focus-visible { color: var(--ember-hot); border-bottom-color: var(--ember); }

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .intro { grid-template-columns: minmax(0, 1fr); }
  .intro { gap: 28px 0; align-items: start; padding-top: 56px; }
  .aside { padding-bottom: 0; }
  .pour { margin-top: 40px; }
  section { padding-top: 52px; }
}
@media (max-width: 560px) {
  .top { padding-top: 28px; }
  .mark { width: 30px; height: 30px; }
  .name { font-size: 1.2rem; }
  .top-end { gap: 12px; }
  .nav-link { letter-spacing: 0.12em; max-width: 6em; line-height: 1.4; text-align: right; }
  .theme-switch .ts-label { display: none; }
  .theme-switch button { padding: 9px 11px; }
  .col-max { display: none; }
  th, td { padding-right: 14px; }
  td small { display: block; margin: 2px 0 0 18px; }
  .summary p { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .pour { animation: none; background-position: 50% 0; opacity: 1; }
}
