/*
 * Yambo shell: shared tokens, fonts, the Yambo bar and the footer.
 * Framework-free. Drop into any page; everything is scoped to .yb-* classes and --yb-* variables,
 * so it does not restyle the rest of the page.
 *
 * Per-unit accent: put data-yb-unit="consult|kasauti|instrumentry|lab" on <html>.
 * Fonts load from ./fonts/ relative to this file.
 */

@font-face {
  font-family: 'Yambo Serif';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/eb-garamond-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Yambo Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/public-sans-latin-wght-normal.woff2') format('woff2');
}

/* The evidence voice: IBM Plex Mono, one weight. Not preloaded: it sets small labels, and the device's own
   monospace stands in until it arrives. */
@font-face {
  font-family: 'Yambo Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

/* Georgia is wider than EB Garamond; shrink it so the font swap barely moves the layout. */
@font-face {
  font-family: 'Yambo Serif Fallback';
  src: local('Georgia');
  size-adjust: 88%;
}

:root {
  --yb-paper: #f5f5f0;
  --yb-paper-2: #eaebe4;
  --yb-ink: #16212b;
  --yb-soft: #4a5560;
  --yb-rule: #c9ccc2;

  --yb-consult: #1d5bbf;
  --yb-kasauti: #a3361c;
  --yb-instrumentry: #2e6b4f;
  --yb-lab: #6b3e75; /* plum: differs from the other three in lightness as well as hue */
  --yb-grid: #e3e4dc; /* the ledger grid's lines */
  --yb-card: #ffffff; /* the paper a captured record is printed on */

  --yb-accent: var(--yb-ink);
  --yb-on-accent: var(--yb-paper);

  --yb-serif: 'Yambo Serif', 'EB Garamond', 'Yambo Serif Fallback', Georgia, 'Times New Roman', serif;
  --yb-sans: 'Yambo Sans', 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  /* The evidence voice: sources, timestamps and record IDs only, never marketing copy. */
  --yb-mono: 'Yambo Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Consolas, Menlo, monospace;
  --yb-gutter: clamp(1rem, 4vw, 2.5rem);
  --yb-max: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --yb-paper: #10181f;
    --yb-paper-2: #17212a;
    --yb-ink: #ecede6;
    --yb-soft: #aab3bb;
    --yb-rule: #323e48;

    --yb-consult: #8fb5f3;
    --yb-kasauti: #f0957a;
    --yb-instrumentry: #7cc8a0;
    --yb-lab: #c9a3d4;
    --yb-grid: #1c2731;
    --yb-card: #0c1319;
  }
}

:root[data-yb-unit='consult'] { --yb-accent: var(--yb-consult); }
:root[data-yb-unit='kasauti'] { --yb-accent: var(--yb-kasauti); }
:root[data-yb-unit='instrumentry'] { --yb-accent: var(--yb-instrumentry); }
:root[data-yb-unit='lab'] { --yb-accent: var(--yb-lab); }

:root[data-yb-unit='consult'],
:root[data-yb-unit='kasauti'],
:root[data-yb-unit='instrumentry'] {
  --yb-on-accent: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root[data-yb-unit='consult'],
  :root[data-yb-unit='kasauti'],
  :root[data-yb-unit='instrumentry'] {
    --yb-on-accent: #0e161d;
  }
}

/* Shared pieces */

.yb-bar,
.yb-footer {
  font-family: var(--yb-sans);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--yb-ink);
  -webkit-font-smoothing: antialiased;
}

.yb-bar *,
.yb-footer * {
  box-sizing: border-box;
}

.yb-bar p,
.yb-bar ul,
.yb-footer p,
.yb-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.yb-bar a,
.yb-footer a {
  color: var(--yb-ink);
  text-decoration: none;
}

.yb-bar a:hover,
.yb-footer a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.yb-bar a:focus-visible,
.yb-bar summary:focus-visible,
.yb-footer a:focus-visible {
  outline: 2px solid var(--yb-ink);
  outline-offset: 2px;
  border-radius: 2px;
}

.yb-wordmark {
  font-family: var(--yb-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.yb-dot {
  display: inline-block;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--yb-soft);
}

.yb-dot--consult { background: var(--yb-consult); }
.yb-dot--kasauti { background: var(--yb-kasauti); }
.yb-dot--instrumentry { background: var(--yb-instrumentry); }
.yb-dot--lab { background: transparent; box-shadow: inset 0 0 0 1px var(--yb-lab); }

.yb-soon {
  color: var(--yb-soft);
  font-size: 0.8125rem;
}

/* The Yambo bar: 3rem tall on every site */

.yb-bar {
  position: relative;
  z-index: 50;
  background: var(--yb-paper-2);
  border-bottom: 1px solid var(--yb-rule);
}

.yb-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--yb-max);
  height: 3rem;
  margin-inline: auto;
  padding-inline: var(--yb-gutter);
}

.yb-bar__id {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  white-space: nowrap;
}

.yb-bar__id .yb-wordmark {
  font-size: 1.375rem;
  line-height: 1;
}

/* An invisible strut in the unit-name font, so the wordmark sits at the same height
   whether or not a unit name follows it. */
.yb-bar__id::after {
  content: '\200b';
  width: 0;
  margin-left: -0.45rem;
  font-weight: 500;
}

.yb-bar__sep {
  color: var(--yb-soft);
}

.yb-bar__unit {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.yb-bar__end {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: none;
}

.yb-bar__contact {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* tap target */
}

.yb-units {
  position: relative;
  flex: none;
}

.yb-units summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding-inline: 0.25rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.yb-units summary::-webkit-details-marker {
  display: none;
}

.yb-units summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.yb-units details[open] summary::after {
  margin-top: 0.2rem;
  transform: rotate(-135deg);
}

.yb-units__list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  width: min(17rem, calc(100vw - 2rem));
  padding: 0.35rem 0;
  background: var(--yb-paper);
  border: 1px solid var(--yb-rule);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}

.yb-units__list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding-inline: 1rem;
}

.yb-units__list li + li {
  border-top: 1px solid var(--yb-rule);
}

.yb-units__list a {
  flex: 1;
  padding-block: 0.7rem;
}

.yb-units__list a[aria-current] {
  font-weight: 600;
}

.yb-units__list .yb-units__name {
  color: var(--yb-soft);
}

.yb-units__list .yb-soon {
  margin-left: auto;
}

.yb-units__home a {
  color: var(--yb-soft);
}

/* The footer */

.yb-footer {
  background: var(--yb-paper-2);
  border-top: 1px solid var(--yb-rule);
}

.yb-footer__inner {
  display: grid;
  gap: 1.25rem 2.5rem;
  max-width: var(--yb-max);
  margin-inline: auto;
  padding: 2.25rem var(--yb-gutter) 2rem;
}

.yb-footer__part {
  color: var(--yb-soft);
}

.yb-footer__part .yb-wordmark {
  font-size: 1.5rem;
  color: var(--yb-ink);
}

.yb-footer__units,
.yb-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
}

.yb-footer__units li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
}

.yb-footer__units a[aria-current] {
  font-weight: 600;
}

.yb-footer__meta {
  color: var(--yb-soft);
}

.yb-footer__meta li {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

@media (min-width: 52rem) {
  .yb-footer__inner {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .yb-footer__units {
    justify-content: flex-end;
  }

  .yb-footer__meta {
    grid-column: 1 / -1;
    border-top: 1px solid var(--yb-rule);
    padding-top: 0.75rem;
  }
}

/* ------------------------------------------------------------------ */
/* Visual language: evidence is the ornament                           */
/* Every picture is drawn from something real: a record, a source, a   */
/* form, a result. Nothing here moves unless the visitor changes it.   */
/* ------------------------------------------------------------------ */

/* The evidence voice. */
.yb-mono {
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.yb-label {
  margin: 0;
  font-family: var(--yb-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yb-soft);
}

/* The ledger: a faint 24px grid, like a field notebook. Behind evidence only, never behind body text. */
.yb-ledger {
  background-color: var(--yb-paper);
  background-image: linear-gradient(var(--yb-grid) 1px, transparent 1px), linear-gradient(90deg, var(--yb-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Crop marks: corner marks around anything real. They say "this was captured", not "this is a card". */
.yb-frame {
  position: relative;
  padding: clamp(1rem, 3vw, 2rem);
}

.yb-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  --m: linear-gradient(var(--yb-ink) 0 0);
  background:
    var(--m) left top / 18px 1.5px, var(--m) left top / 1.5px 18px,
    var(--m) right top / 18px 1.5px, var(--m) right top / 1.5px 18px,
    var(--m) left bottom / 18px 1.5px, var(--m) left bottom / 1.5px 18px,
    var(--m) right bottom / 18px 1.5px, var(--m) right bottom / 1.5px 18px;
  background-repeat: no-repeat;
}

/* The receipt: a result printed as records. Label, dotted leader, value. */
.yb-receipt {
  display: grid;
  gap: 1rem;
  padding: 1.5rem clamp(1rem, 3vw, 1.75rem);
  border-inline: 1px solid var(--yb-rule);
  border-block: 3px dashed var(--yb-rule);
  background: var(--yb-card);
  color: var(--yb-ink);
  font-family: var(--yb-mono);
  font-size: 0.875rem;
  line-height: 1.5;
}

.yb-receipt > * {
  margin: 0;
  min-width: 0;
}

.yb-receipt__host {
  font-family: var(--yb-serif);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.yb-receipt__part {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--yb-ink);
}

.yb-receipt__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--yb-rule);
  font-size: 0.75rem;
  color: var(--yb-soft);
}

.yb-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
}

.yb-line__k {
  flex: none;
  max-width: 55%;
}

.yb-line__lead {
  flex: 1;
  min-width: 0.75rem;
  border-bottom: 1px dotted var(--yb-soft);
  opacity: 0.6;
}

.yb-line__v {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

/* A value that needs action takes the accent. */
.yb-line__v--act {
  color: var(--yb-accent);
}

/* Redaction: what a public read can't see is shown, not hidden. */
.yb-redact {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
  color: var(--yb-soft);
}

.yb-redact li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.yb-redact li::before {
  content: '';
  flex: none;
  width: 9rem;
  max-width: 45%;
  height: 0.875rem;
  background: var(--yb-ink);
}

.yb-redact li:nth-child(4n + 1)::before { width: 12.5rem; }
.yb-redact li:nth-child(4n + 2)::before { width: 8.25rem; }
.yb-redact li:nth-child(4n + 3)::before { width: 10.5rem; }
.yb-redact li:nth-child(4n + 4)::before { width: 6.875rem; }

/* Status tags. Measured, estimate and sample data match the chip panel's Status line. */
.yb-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--yb-rule);
  border-radius: 999px;
  font-family: var(--yb-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--yb-soft);
}

.yb-tag--dashed { border-style: dashed; }
.yb-tag--accent { border-color: currentColor; color: var(--yb-accent); }

/* The four signature marks, drawn from each unit's own data (shell/marks.mjs). */
.yb-mark {
  display: block;
  max-width: 100%;
  height: auto;
  --m: var(--yb-accent);
}

.yb-mark--consult { --m: var(--yb-consult); }
.yb-mark--kasauti { --m: var(--yb-kasauti); }
.yb-mark--instrumentry { --m: var(--yb-instrumentry); }
.yb-mark--lab { --m: var(--yb-lab); }

.yb-mark .a { fill: var(--m); }
.yb-mark .as { fill: none; stroke: var(--m); }
.yb-mark .i { fill: var(--yb-ink); }
.yb-mark .is { fill: none; stroke: var(--yb-ink); }
.yb-mark .r { fill: var(--yb-rule); }
.yb-mark .rs { fill: none; stroke: var(--yb-rule); }

.yb-footer__checked {
  font-family: var(--yb-mono);
  font-size: 0.75rem;
}
