/* Midiyard — website
 *
 * A flat surface, one accent, and type that does the work. There are no
 * shadows, no gradients and no blur anywhere in this file: depth is the fill
 * ramp (--well → --bg → --panel → --panel-raised) plus 1px hairlines, and
 * nothing else. The CI `frontend` job greps this file for the forbidden
 * properties, so keep them out of the code — and out of the prose on purpose
 * lines, which are the ones a reader copies.
 *
 * The palette is bone paper, graphite ink and one pine green; the amber is a
 * signal, not a decoration (it marks a file that has no bytes on this box).
 * Every pair below is checked to 4.5:1 or better against the surface it is
 * printed on; --ink-faint is the only 3.x pair and is used for text that
 * repeats information already on the page (timestamps, column labels). */

:root {
  color-scheme: light;

  /* surfaces — bone paper, never pure white */
  --bg: #EDEAE1;
  --bg-lift: #F4F2EB;
  --panel: #F6F4EE;
  --panel-raised: #FCFBF7;
  --well: #E1DDD1;
  --well-lift: #E8E5DB;
  --border: #D6D1C3;
  --border-strong: #B9B3A2;

  /* brand — pine green on bone, 6.7:1 against --bg */
  --accent: #14574A;
  --accent-bright: #1C7062;
  --accent-dim: #3B6F63;
  --accent-ghost: rgba(20, 87, 74, 0.10);

  /* type */
  --ink: #1A1C19;
  --ink-dim: #4C524A;
  --ink-faint: #6F766C;

  /* signal — a file a row points at that this box does not have */
  --amber: #7E4E12;
  --amber-ghost: rgba(126, 78, 18, 0.10);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  --wrap: 62rem;
  --gutter: clamp(16px, 5vw, 32px);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  /* The facts column of every list is monospaced: a table of durations,
     tempos and counts reads as a table when its digits line up. */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: the page keeps its full height even with three lines on it. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-bright); }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

/* Keyboard focus is never removed, only drawn — 1px pine, 2px offset. The ring
   is drawn in advance and transparent, so the keyboard arriving is a change like
   every other state rather than a pop. */
a,
.btn,
input,
select,
button,
.shelf,
.ledger-wrap {
  outline: 1px solid transparent;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

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

.wrap.wide { max-width: 74rem; }

.mono { font-family: var(--mono); font-size: 0.9em; }
.quiet { color: var(--ink-dim); font-size: 15px; }
.faint { color: var(--ink-faint); }

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

/* The mark is 24px minimum and strokes with currentColor, so one file follows
   the accent everywhere it appears. */
.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
  color: var(--accent);
}

.brand-word {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-word .yard { font-weight: 400; color: var(--ink-dim); }

.site-nav { display: flex; gap: 4px; }

/* 44px minimum hit area even though the text is small. */
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--accent); background: var(--accent-ghost); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-ghost);
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  justify-items: center;
  gap: clamp(16px, 4vmin, 28px);
  text-align: center;
  padding: clamp(48px, 11vmin, 88px) var(--gutter) clamp(40px, 8vmin, 64px);
}

.hero-mark {
  width: clamp(112px, 26vmin, 190px);
  height: auto;
  display: block;
  color: var(--accent);
}

.wordmark {
  margin: 0;
  font-size: clamp(30px, 7vmin, 52px);
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--ink);
}

.wordmark .yard { font-weight: 300; color: var(--ink-dim); }

.rule {
  width: clamp(28px, 6vmin, 46px);
  height: 1px;
  border: 0;
  margin: 0;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.tagline {
  margin: 0;
  font-size: clamp(11px, 1.6vmin, 13px);
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.hero-copy { display: grid; gap: 10px; max-width: 40rem; }

.lede {
  margin: 0;
  font-size: 18px;
  color: var(--ink-dim);
  text-wrap: balance;
}

.subline { margin: 0; font-size: 15px; color: var(--ink-dim); }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
}

/* A status, not a button: the library's state is a fact about the site, so it
   is drawn as the label it is and cannot be clicked by mistake. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--panel);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status.is-open::before { background: var(--accent); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.btn-primary { background: var(--accent); color: var(--bg-lift); }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: #fff; }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--accent); }
.btn-ghost:hover { background: var(--accent-ghost); border-color: var(--accent); }

/* ---------- bands and section heads ---------- */

.band {
  padding-block: clamp(40px, 8vmin, 72px);
  border-top: 1px solid var(--border);
}

.band-alt { background: var(--panel); }

.band-ink {
  background: var(--accent);
  border-top-color: var(--accent);
  color: var(--bg-lift);
}
.band-ink a { color: var(--bg-lift); }
.band-ink .section-label, .band-ink .lede { color: rgba(244, 242, 235, 0.78); }

.section-head {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-bottom: clamp(20px, 4vmin, 32px);
}

.section-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.section-name {
  margin: 0;
  font-size: clamp(22px, 4vmin, 30px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}

.band-ink .section-name { color: var(--bg-lift); }

/* ---------- three-up facts, steps, shelves ---------- */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cell {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 20px 22px;
  background: var(--panel-raised);
}

.band-alt .cell { background: var(--panel-raised); }

.cell-k {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.cell-name { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.cell p { margin: 0; font-size: 15px; color: var(--ink-dim); }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 24px;
  counter-reset: step;
}

.step {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 2px solid var(--accent);
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

.step-name { margin: 0; font-size: 17px; font-weight: 600; }
.step p { margin: 0; font-size: 15px; color: var(--ink-dim); }

.shelves {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shelf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--panel-raised);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.shelf:hover { background: var(--accent-ghost); border-color: var(--accent); color: var(--accent); }

.shelf .count { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

/* The plan, not the inventory: the landing page's shelf list is followed by the
   one sentence that keeps it honest. */
.shelves-note { margin-top: 20px; }

/* ---------- prose lists ---------- */

.uses,
.notes {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 20px;
  color: var(--ink-dim);
  font-size: 15px;
}

.uses strong, .notes strong { color: var(--ink); }

/* ---------- the browse page ---------- */

.page-head {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding-block: clamp(32px, 7vmin, 56px) 20px;
}

.page-name {
  margin: 0;
  font-size: clamp(26px, 5vmin, 38px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.search {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 16px 0 4px;
}

.search input[type="search"],
.search select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  color: var(--ink);
  font: inherit;
}

.search input[type="search"] { flex: 1 1 16rem; }
.search label { font-size: 13px; color: var(--ink-dim); }

.result-count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  padding-block: 8px;
}

.files {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.file {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 20px;
  align-items: center;
  padding: 14px 18px;
  background: var(--panel-raised);
}

.file-name { margin: 0; font-size: 16px; font-weight: 600; }
.file-credit { margin: 0; font-size: 14px; color: var(--ink-dim); }
.file-facts {
  grid-column: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
}
.file-actions { grid-column: 2; grid-row: 1 / span 3; }

.file.is-off { background: var(--well-lift); }

/* A file whose row is public and whose bytes are not: the page says so instead
   of offering a link that would 404. */
.unavailable {
  display: inline-block;
  padding: 6px 12px;
  border: 1px dashed var(--amber);
  border-radius: var(--radius-md);
  background: var(--amber-ghost);
  color: var(--amber);
  font-size: 13px;
}

/* ---------- the ledger (/admin/) ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  background: var(--panel-raised);
}

.stat b { font-family: var(--mono); font-size: 26px; font-weight: 500; color: var(--ink); }
.stat span { font-size: 13px; color: var(--ink-dim); }

.ledger-wrap { overflow-x: auto; }

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.ledger th,
table.ledger td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.ledger thead th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--border-strong);
}

table.ledger td.num, table.ledger th.num {
  font-family: var(--mono);
  text-align: right;
}

table.ledger tbody tr:last-child th,
table.ledger tbody tr:last-child td { border-bottom: 0; }

table.ledger tbody tr.is-off { background: var(--well-lift); }

.ledger-note { display: block; font-size: 12px; color: var(--amber); }

.recent { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.recent li { display: flex; gap: 16px; padding: 10px 14px; background: var(--panel-raised); font-size: 14px; }
.recent span:last-child { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

/* ---------- breadcrumbs ---------- */

.breadcrumbs { padding-block: 18px 0; }
.breadcrumbs ol { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-faint); }
.breadcrumbs a { color: var(--ink-dim); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs li + li::before { content: "/"; padding-right: 8px; color: var(--border-strong); }

/* ---------- footer ---------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-lift);
  padding-block: 24px;
  font-size: 13px;
  color: var(--ink-dim);
}

.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-dim); }
.site-footer a:hover { color: var(--accent); }

/* ---------- motion ---------- */

/* Reduced motion caps the duration tokens rather than listing selectors: every
   transition in this file is written with those tokens, so a new one cannot
   forget to opt out. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; }
}
