/* ============================================================
   markvd.css  -  MARKVD-NET shared stylesheet
   Version 1.1  |  2026-09-09
   Canonical implementation of the MARKVD-NET style book.

   Load order on a page:
     <link rel="stylesheet" href="/assets/css/markvd.css">
     then, optionally, a small page-local <style> block for
     anything genuinely unique to that page.

   This file is dark-fixed on purpose. markvd.net presents a
   single near black surface, so the tokens do NOT flip with
   prefers-color-scheme. If you ever want a light surface,
   see section 12 and opt in explicitly with class="mv-light".
   ============================================================ */

/* ---------- 1. Tokens ------------------------------------- */

:root {
  /* Surface */
  --mv-bg:          #0b0f0c;   /* page */
  --mv-bg-raise:    #101511;   /* cards, panels, code */
  --mv-bg-sink:     #080b09;   /* nav scrim, wells */
  --mv-line:        #1e2a20;   /* hairlines */

  /* Text */
  --mv-ink:         #d9e4da;   /* body */
  --mv-dim:         #8fa192;   /* secondary */

  /* Accents */
  --mv-green:       #5dd97c;   /* primary accent, links, nodes */
  --mv-green-dim:   #2e6b41;   /* rules, muted accent, underlines */
  --mv-amber:       #f0b45a;   /* field labels, brand text, callouts */
  --mv-red:         #e0685a;   /* server errors, destructive, alarm */
  --mv-blue:        #7fb2d9;   /* rare: external / informational */

  /* Flag set. Toned to sit on the dark surface without shouting. */
  --mv-flag-red:    #b31942;
  --mv-flag-white:  #f0f2ef;
  --mv-flag-blue:   #0a3161;

  /* Type */
  --mv-mono: "IBM Plex Mono", "Cascadia Code", ui-monospace,
             SFMono-Regular, Menlo, Consolas, monospace;

  /* Scale. Body is 15px; everything below is relative to it. */
  --mv-fs-micro:  .72rem;
  --mv-fs-small:  .80rem;
  --mv-fs-mono:   .86rem;
  --mv-fs-body:   1rem;
  --mv-fs-h3:     1rem;
  --mv-fs-h2:     1.35rem;

  /* Rhythm */
  --mv-gap:       1rem;
  --mv-pad-card:  1.1rem 1.2rem;
  --mv-section-y: 3rem;
  --mv-measure:   46rem;   /* max reading width */
  --mv-wrap:      920px;   /* content column */
}

/* Legacy short names. Existing pages use these; keep them
   mapped so one palette change moves the whole site. */
:root {
  --bg: var(--mv-bg);
  --bg-raise: var(--mv-bg-raise);
  --line: var(--mv-line);
  --ink: var(--mv-ink);
  --dim: var(--mv-dim);
  --green: var(--mv-green);
  --green-dim: var(--mv-green-dim);
  --amber: var(--mv-amber);
  --red: var(--mv-red);
  --mono: var(--mv-mono);
}

/* ---------- 2. Reset and base ----------------------------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--mv-bg);
  color: var(--mv-ink);
  font-family: var(--mv-mono);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

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

::selection { background: var(--mv-green-dim); color: var(--mv-ink); }

a {
  color: var(--mv-green);
  text-decoration: none;
  border-bottom: 1px solid var(--mv-green-dim);
}
a:hover {
  color: var(--mv-bg);
  background: var(--mv-green);
  border-bottom-color: var(--mv-green);
}
a:focus-visible {
  outline: 2px solid var(--mv-amber);
  outline-offset: 2px;
}

.wrap { max-width: var(--mv-wrap); margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: 780px; }

/* Skip link. Every page should carry one as its first element. */
.skip {
  position: absolute; left: -9999px;
  background: var(--mv-bg-raise); color: var(--mv-green);
  border: 1px solid var(--mv-green-dim); padding: .5rem .9rem; z-index: 100;
}
.skip:focus { left: 1rem; top: .5rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Navigation --------------------------------- */

.mv-nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 15, 12, .92);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--mv-line);
}
.mv-nav .wrap {
  display: flex; align-items: center; gap: 1.1rem;
  padding: .55rem 1.25rem; flex-wrap: wrap;
}
.mv-nav .brand {
  display: inline-flex; align-items: center;
  border: none; flex: 0 0 auto;
}
.mv-nav .brand img,
.mv-nav .brand svg { height: 26px; width: auto; display: block; }
.mv-nav .brand:hover { background: none; }

/* Text fallback brand, for pages that do not load the lockup. */
.mv-nav .brand-text {
  color: var(--mv-amber); font-weight: 700;
  letter-spacing: .08em; border: none;
}

.mv-nav a:not(.brand):not(.brand-text) {
  color: var(--mv-dim); border: none; font-size: .85rem;
}
.mv-nav a:not(.brand):not(.brand-text):hover {
  color: var(--mv-green); background: none;
}
.mv-nav a:not(.brand):not(.brand-text)::before {
  content: "/"; color: var(--mv-green-dim); margin-right: .15rem;
}
.mv-nav a[aria-current="page"],
.mv-nav a[aria-current="true"] { color: var(--mv-green); }

/* Sub-site header lockup: mark + wordmark + /section in amber. */
.mv-subbrand { display: inline-flex; align-items: center; border: none; }
.mv-subbrand img { height: 30px; width: auto; display: block; }

/* ---------- 4. Hero --------------------------------------- */

.mv-hero {
  padding: 4.5rem 0 3rem;
  border-bottom: 1px solid var(--mv-line);
}
.mv-hero.compact { padding: 2.5rem 0 1.75rem; }

h1 {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  line-height: 1.25; font-weight: 700;
  margin-bottom: 1.2rem; letter-spacing: -.01em;
}
h1 .accent { color: var(--mv-green); }

.lede {
  color: var(--mv-dim); max-width: var(--mv-measure);
  margin-bottom: 2rem;
}
.lede strong { color: var(--mv-ink); font-weight: 700; }

/* ---------- 5. The whois block ---------------------------- */
/* The signature component of this site. A record, not a table
   of data: field name in amber, value in ink, comment in dim
   green. Use it wherever the content is genuinely key/value. */

.whois {
  background: var(--mv-bg-raise);
  border: 1px solid var(--mv-line);
  border-left: 3px solid var(--mv-green);
  padding: 1rem 1.25rem;
  font-size: .83rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.whois .cmt { color: var(--mv-green-dim); }
.whois table { border-collapse: collapse; }
.whois td {
  padding: .05rem .5rem .05rem 0;
  vertical-align: top; white-space: nowrap;
}
.whois td:first-child { color: var(--mv-amber); min-width: 9.5rem; }
.whois td:last-child  { color: var(--mv-ink); white-space: normal; }
.whois a { border-bottom: 1px dotted var(--mv-green-dim); }

/* Accent variants. The left border carries the meaning. */
.whois.is-amber { border-left-color: var(--mv-amber); }
.whois.is-red   { border-left-color: var(--mv-red); }
.whois.is-flag  { border-left-color: var(--mv-flag-red); }

/* ---------- 6. Sections ----------------------------------- */

.mv-section { padding: var(--mv-section-y) 0; border-bottom: 1px solid var(--mv-line); }
.mv-section:last-of-type { border-bottom: none; }

.tag { color: var(--mv-amber); font-size: .8rem; letter-spacing: .15em; }
.tag::after { content: ":"; }

h2 { font-size: var(--mv-fs-h2); margin: .35rem 0 1rem; letter-spacing: .02em; }
h3 { font-size: var(--mv-fs-h3); }

.mv-section > .wrap > p {
  color: var(--mv-dim); max-width: var(--mv-measure); margin-bottom: 1rem;
}
.mv-section p strong { color: var(--mv-ink); }

/* ---------- 7. Cards -------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--mv-gap);
  margin-top: 1.5rem;
}
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
@media (min-width: 720px) { .grid.single { grid-template-columns: 1fr; } }

.card {
  background: var(--mv-bg-raise);
  border: 1px solid var(--mv-line);
  padding: var(--mv-pad-card);
}
.card .k { color: var(--mv-green); font-size: .78rem; letter-spacing: .12em; }
.card h3 { margin: .4rem 0 .5rem; }
.card p { color: var(--mv-dim); font-size: var(--mv-fs-mono); }
.card p + p { margin-top: .6rem; }
.card h3 a { font-size: 1.05rem; }

/* An amber key marks a card whose subject is hosted elsewhere
   or is an outbound destination rather than owned work. */
.card .k.is-amber { color: var(--mv-amber); }

/* ---------- 8. Lists, badges, notes ----------------------- */

ul.plain { list-style: none; max-width: var(--mv-measure); }
ul.plain li {
  color: var(--mv-dim); padding-left: 1.2rem; position: relative;
  margin-bottom: .55rem; font-size: .9rem;
}
ul.plain li::before { content: ">"; color: var(--mv-green); position: absolute; left: 0; }
ul.plain strong { color: var(--mv-ink); }

.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.badges span, .badges a {
  border: 1px solid var(--mv-green-dim); color: var(--mv-green);
  font-size: .78rem; padding: .2rem .6rem;
}
.badges a { border-bottom-width: 1px; }
.badges .is-amber { border-color: var(--mv-amber); color: var(--mv-amber); }

/* A note is a short aside. It never carries the main point. */
.note {
  border-left: 3px solid var(--mv-green-dim);
  background: var(--mv-bg-raise);
  padding: .75rem 1rem; margin: 1.25rem 0;
  color: var(--mv-dim); font-size: var(--mv-fs-mono);
  max-width: var(--mv-measure);
}
.note.is-amber { border-left-color: var(--mv-amber); }
.note.is-red   { border-left-color: var(--mv-red); }

/* ---------- 9. Tables, code, figures ---------------------- */

.mv-table { width: 100%; border-collapse: collapse; font-size: var(--mv-fs-mono); margin: 1.25rem 0; }
.mv-table th, .mv-table td {
  border-bottom: 1px solid var(--mv-line);
  padding: .45rem .75rem .45rem 0; text-align: left; vertical-align: top;
}
.mv-table th { color: var(--mv-amber); font-weight: 700; white-space: nowrap; }
.mv-table td { color: var(--mv-dim); }
.mv-table td strong { color: var(--mv-ink); }
.mv-table tr:last-child td { border-bottom: none; }

code, kbd, samp {
  font-family: var(--mv-mono); font-size: .92em;
  color: var(--mv-amber); background: var(--mv-bg-raise);
  border: 1px solid var(--mv-line); padding: 0 .3em;
}
pre {
  background: var(--mv-bg-raise); border: 1px solid var(--mv-line);
  border-left: 3px solid var(--mv-green-dim);
  padding: .9rem 1.1rem; overflow-x: auto;
  font-size: var(--mv-fs-mono); margin: 1.25rem 0;
}
pre code { background: none; border: none; padding: 0; color: var(--mv-ink); }

figure { margin: 1.5rem 0; }
figure img, .mv-frame {
  border: 1px solid var(--mv-line); background: var(--mv-bg-raise); display: block;
}
figcaption { color: var(--mv-dim); font-size: var(--mv-fs-small); margin-top: .5rem; }

/* ---------- 10. Controls ---------------------------------- */
/* Square, hairline, mono. No radius anywhere on this site. */

.btn {
  display: inline-block; border: 1px solid var(--mv-green-dim);
  background: var(--mv-bg-raise); color: var(--mv-green);
  font: inherit; font-size: var(--mv-fs-mono);
  padding: .4rem .9rem; cursor: pointer;
}
.btn:hover { background: var(--mv-green); color: var(--mv-bg); border-color: var(--mv-green); }
.btn:focus-visible { outline: 2px solid var(--mv-amber); outline-offset: 2px; }
.btn[disabled] { color: var(--mv-dim); border-color: var(--mv-line); cursor: not-allowed; background: var(--mv-bg-sink); }
.btn.is-amber { border-color: var(--mv-amber); color: var(--mv-amber); }
.btn.is-amber:hover { background: var(--mv-amber); color: var(--mv-bg); }

input[type="text"], input[type="search"], input[type="range"], select, textarea {
  font: inherit; font-size: var(--mv-fs-mono);
  background: var(--mv-bg-sink); color: var(--mv-ink);
  border: 1px solid var(--mv-line); padding: .35rem .6rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--mv-amber); outline-offset: 1px;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  padding: 0; height: 26px; background: none; border: none; width: 100%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; background: var(--mv-line); border: 1px solid var(--mv-green-dim);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 22px; margin-top: -10px;
  background: var(--mv-green); border: 1px solid var(--mv-bg);
}
input[type="range"]::-moz-range-track {
  height: 4px; background: var(--mv-line); border: 1px solid var(--mv-green-dim);
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 22px; border-radius: 0;
  background: var(--mv-green); border: 1px solid var(--mv-bg);
}

/* ---------- 11. Flag --------------------------------------- */
/* The asset is a spec-accurate flag (Executive Order 10834
   proportions, 1:1.9). It is never mirrored, rotated, skewed,
   recolored, faded, overlaid with anything, or used as a
   background behind content. Set width and height on the tag so
   the aspect ratio cannot drift. Twice per site at most. */

.flag {
  display: inline-block;
  vertical-align: -.2em;
  height: 1em;
  width: 1.9em;
  border: 1px solid rgba(217, 228, 218, .16);
}
.flag-lg { height: 2.2em; width: 4.18em; vertical-align: baseline; }

/* Flag beside a paragraph. The flag sits clear of the text
   rather than behind or under it. */
.flag-note {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  max-width: var(--mv-measure);
  margin: 1.5rem 0;
}
.flag-note .flag-lg { flex: 0 0 auto; margin-top: .3rem; }
.flag-note p { margin: 0; color: var(--mv-dim); }
@media (max-width: 480px) {
  .flag-note { flex-direction: column; gap: .75rem; }
}

/* Retained for reference only. A gradient rule in flag colors is
   decoration in flag colors, which the Flag Code discourages.
   Not used anywhere on markvd.net. */
.flag-rule {
  height: 3px; border: none; margin: 0;
  background: linear-gradient(
    to right,
    var(--mv-flag-blue) 0 22%,
    var(--mv-flag-red)   22% 48%,
    var(--mv-flag-white) 48% 74%,
    var(--mv-flag-red)   74% 100%
  );
  opacity: .85;
}

/* ---------- 12. Footer ------------------------------------ */

.mv-footer {
  padding: 2.5rem 0; color: var(--mv-dim);
  font-size: .8rem; text-align: center;
}
.mv-footer .sep { color: var(--mv-green-dim); margin: 0 .5rem; }
.mv-footer a { border-bottom-color: var(--mv-line); }

/* ---------- 13. Opt-in light surface ---------------------- */
/* Not used by markvd.net itself. Provided so a hosted project
   that needs a light page can reuse the same components
   without redefining them. Put class="mv-light" on <html>. */

.mv-light {
  --mv-bg: #ffffff;
  --mv-bg-raise: #f1f4f1;
  --mv-bg-sink: #e7ece8;
  --mv-line: #dde5df;
  --mv-ink: #111714;
  --mv-dim: #6d7d71;
  --mv-green: #2e6b41;
  --mv-green-dim: #4f8b62;
  --mv-amber: #a76a12;
  --mv-red: #a8352a;
}
.mv-light .mv-nav { background: rgba(255, 255, 255, .92); }

/* ---------- 14. Motion, print, small screens -------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 480px) {
  :root { --mv-section-y: 2.25rem; }
  .mv-hero { padding: 3rem 0 2rem; }
  .whois td:first-child { min-width: 7.5rem; }
}

@media print {
  body { background: #fff; color: #111714; }
  .mv-nav, .skip, .btn { display: none; }
  .card, .whois, pre { border-color: #ccc; background: #fff; }
  a { color: #111714; border: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
