/* Isobar type tester, dressed in the Masthead Interface kit (site-to-kit-pilot/kit):
   newsprint and ink, three columns (navigate · look · read), a masthead split by a
   rule, uppercase mono labels in brackets, hairlines, square corners, no shadows,
   every state a snap. Departures from the kit: no signal green and no phosphor
   mode (hover and focus invert to ink instead), and the masthead is set in Isobar,
   not the kit's serif, because the page exists to show Isobar. */
:root {
  --newsprint: #fffbee;
  --ink: #0d0c0c;
  --ground: var(--newsprint);
  --on-ground: var(--ink);
  --mark: var(--ink);            /* hover / focus / press ground */
  --on-mark: var(--newsprint);

  --face-label: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --face-type: "Isobar", system-ui, sans-serif;

  --t-label: 0.75rem;            /* 12 / 18 */
  --t-label-lg: 0.875rem;        /* 14 / 21 */
  --t-text: 0.875rem;            /* 14 / 21 */
  --lead: 1.5;

  --hair: 0.25rem;               /*  4 */
  --gap: 0.5rem;                 /*  8 */
  --pad: 1rem;                   /* 16 */
  --gutter: 1.5rem;              /* 24 */
  --break: 3rem;                 /* 48 */
  --btn-h: 2rem;
  --tap: 2.75rem;
  --rule: 1px;
  --dither: 3px;
  color-scheme: light;
}
/* the inverted sheet: same two inks, swapped. Chosen by the reader, never by the OS. */
:root[data-theme="dark"] {
  --ground: var(--ink);
  --on-ground: var(--newsprint);
  --mark: var(--newsprint);
  --on-mark: var(--ink);
  color-scheme: dark;
}

* { box-sizing: border-box; border: 0 solid currentColor; }
html { background: var(--ground); }
body {
  margin: 0; min-height: 100vh;
  background: var(--ground); color: var(--on-ground);
  font: var(--t-label) / var(--lead) var(--face-label);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, figure, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; text-transform: inherit; }
.bracket::before { content: "["; }
.bracket::after { content: "]"; }

/* ---- three columns -------------------------------------------------------- */
.columns { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); min-height: 100vh; }
.column {
  grid-column: span 3; display: flex; flex-direction: column; gap: var(--break);
  padding: var(--gap); min-width: 0; background: var(--ground);
}
.column--nav { justify-content: space-between; font-size: var(--t-label-lg); }
.column--look { grid-column: span 6; padding: 0; gap: 0; border-left-width: var(--rule); border-right-width: var(--rule); }
.column--read { gap: var(--break); }
@media (min-width: 1024px) {
  .columns { height: 100vh; overflow: clip; }
  .column { height: 100vh; }
  .column--read, .scroll { overflow-y: auto; scrollbar-width: none; }
  .column--read::-webkit-scrollbar, .scroll::-webkit-scrollbar { display: none; }
  .scroll { flex: 1 1 0; min-height: 0; }
}

/* ---- masthead: WORD —— rule —— WORD, set in Isobar ------------------------ */
.masthead {
  container-type: inline-size; width: 100%; padding: var(--gap);
  display: flex; align-items: center; column-gap: 0.17em; white-space: nowrap;
  font: 300 3rem / 1 var(--face-type); text-transform: uppercase;
}
.masthead--top { border-bottom-width: var(--rule); }
.masthead--foot { border-top-width: var(--rule); }
@media (min-width: 1024px) { .masthead { font-size: clamp(3rem, 7.4vw, 7rem); } }
.masthead__word { text-box: trim-both cap alphabetic; }
.masthead__rule { flex: 1 1 0; min-width: 0.5em; border-top-width: var(--rule); }

/* ---- links and buttons: every state snaps to ink --------------------------- */
.link {
  color: inherit; text-decoration: none; background: none; padding: 0; cursor: pointer;
  outline: 2px solid transparent; outline-offset: 2px;
}
.link--current { text-decoration-line: underline; text-decoration-thickness: var(--rule); text-underline-offset: 4px; }
@media (hover: hover) { .link:hover { background: var(--mark); color: var(--on-mark); } }
.link:focus-visible, .link:active { background: var(--mark); color: var(--on-mark); }
.invert[aria-pressed="true"] { text-decoration-line: underline; text-decoration-thickness: var(--rule); text-underline-offset: 4px; }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--btn-h);
  padding: 0 var(--gutter); background: var(--on-ground); color: var(--ground); cursor: pointer;
  border-width: var(--rule); border-style: solid; border-color: var(--on-ground);
  outline: 2px solid transparent; outline-offset: 2px;
}
.btn--line { background: transparent; color: inherit; }
@media (hover: hover) {
  .btn:hover { background: var(--ground); color: var(--on-ground); }
  .btn--line:hover { border-style: dashed; }
}
.btn:focus-visible { border-style: dashed; background: var(--ground); color: var(--on-ground); }
.btn:active { background: var(--ground); color: var(--on-ground); border-style: dashed; }
.invert.btn--line[aria-pressed="true"] { text-decoration: none; }

/* segmented choices: pressed is solid ink, the rest are line buttons */
.seg { display: flex; }
.seg button {
  flex: 1 1 0; min-height: var(--btn-h); padding: 0 var(--gap); cursor: pointer; white-space: nowrap;
  background: transparent; border-width: var(--rule); border-style: solid;
  outline: 2px solid transparent; outline-offset: 2px;
}
.seg button + button { border-left-width: 0; }
.seg button[aria-pressed="true"] { background: var(--on-ground); color: var(--ground); border-color: var(--on-ground); }
@media (hover: hover) { .seg button[aria-pressed="false"]:hover { border-style: dashed; } }
.seg button:focus-visible { border-style: dashed; }
.seg--type button { font: 400 1rem / 1 var(--face-type); text-transform: none; }

/* ---- index rows: [LABEL]   value ------------------------------------------ */
.index { display: flex; flex-direction: column; row-gap: var(--hair); }
.index__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gap); }
.index__row--nav { grid-template-columns: 1fr 3fr; }
.index__row--end > :last-child { text-align: right; }
.nav-top { display: flex; justify-content: space-between; gap: var(--gap); }
.column--nav > .index { row-gap: var(--gap); }
.actions { display: flex; flex-direction: column; row-gap: var(--gap); margin-top: auto; }
.actions__years { display: flex; justify-content: space-between; }
.note { color: inherit; }

/* ---- reading text ----------------------------------------------------------- */
.prose { font: 400 var(--t-text) / var(--lead) var(--face-type); text-transform: none; }
.prose p + p { margin-top: var(--gap); }

/* ---- controls --------------------------------------------------------------- */
.controls { display: flex; flex-direction: column; row-gap: var(--pad); }
.field { display: flex; flex-direction: column; row-gap: var(--hair); min-width: 0; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gap); }
.field__input {
  width: 100%; padding: var(--hair) 0; background: transparent; text-transform: none;
  border-bottom-width: var(--rule); border-bottom-style: dashed; border-radius: 0;
  font: 400 1rem / 1.4 var(--face-type);
  outline: 2px solid transparent;
}
.field__input:focus-visible { border-bottom-style: solid; }
input[type=range] { width: 100%; accent-color: var(--on-ground); margin: var(--hair) 0 0; }

/* ---- look column content ------------------------------------------------------ */
section { padding: 0 var(--gap) var(--break); scroll-margin-top: 0; }
.caption {
  display: flex; justify-content: space-between; align-items: center; gap: var(--gap);
  padding: var(--gap) 0; margin-bottom: var(--pad); border-bottom-width: var(--rule);
}
#tester .caption { border-top-width: 0; }
section + section .caption { border-top-width: var(--rule); margin-top: 0; }
.label { font: inherit; }
[contenteditable] { outline: none; }
[contenteditable]:focus-visible { outline: 1px dashed currentColor; outline-offset: 4px; }

.rows { display: grid; }
.row { padding: var(--gap) 0 var(--pad); min-width: 0; }
.row + .row { border-top-width: var(--rule); }
.row-label { display: flex; justify-content: space-between; gap: var(--gap); }
.row-text {
  font-family: var(--face-type); line-height: 1.1; text-transform: none; margin-top: var(--hair);
  overflow-wrap: anywhere; min-height: 1.1em;
}

.blocks { display: grid; gap: var(--break); }
.block .row-label { margin-bottom: var(--gap); }
.block p { font-family: var(--face-type); text-transform: none; text-wrap: pretty; }

.waterfall { display: grid; gap: var(--gap); }
.wf { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: baseline; gap: var(--gap); }
.wf span { font-variant-numeric: tabular-nums; }
.wf div { font-family: var(--face-type); text-transform: none; line-height: 1.15; white-space: nowrap; overflow: hidden; }

.proof { display: grid; gap: var(--gap); }
.proof div { font-family: var(--face-type); text-transform: none; font-size: clamp(1.5rem, 3vw, 2.75rem); line-height: 1.2; overflow-wrap: anywhere; }

/* glyph inspector: a framed card with a caption row */
.card { margin-bottom: var(--pad); }
.card__frame { border-width: var(--rule); display: grid; place-items: center; aspect-ratio: 1.78; overflow: hidden; }
#glyph-big-char { font-family: var(--face-type); text-transform: none; font-size: clamp(8rem, 16vw, 14rem); line-height: 1; }
.card__caption { display: flex; justify-content: space-between; margin-top: var(--gap); }
#glyph-big-name { text-transform: none; }
.glyph-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
  border-top-width: var(--rule); border-left-width: var(--rule);
}
.glyph-grid button {
  width: 100%; aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; position: relative;
  font: 400 1.75rem / 1 var(--face-type); text-transform: none; background: transparent;
  border-right-width: var(--rule); border-bottom-width: var(--rule);
  outline: 2px solid transparent; outline-offset: -4px;
}
.glyph-grid button[aria-pressed="true"] { background: var(--on-ground); color: var(--ground); }
/* hover takes the kit's dither screen instead of a colour */
.glyph-grid button::after {
  content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--on-ground) 35%, transparent) 0 25%, transparent 0 50%) 0 0 / var(--dither) var(--dither);
}
@media (hover: hover) { .glyph-grid button[aria-pressed="false"]:hover::after { opacity: 1; } }
.glyph-grid button:focus-visible { outline-color: currentColor; }

/* ---- phones: read first, then look, sections in a bottom bar ---------------- */
.bar { display: none; }
@media (max-width: 1023.98px) {
  .columns { display: flex; flex-direction: column; }
  .column { height: auto; }
  .column--nav { display: none; }
  .column--look { display: contents; }
  .masthead--top { order: 0; }
  .masthead--foot { display: none; }
  .column--read {
    order: 1; padding: var(--pad) var(--gap) var(--break); gap: var(--break);
    border-left-width: var(--rule); border-right-width: var(--rule); margin: 0 var(--gap);
  }
  .scroll { order: 2; border-left-width: var(--rule); border-right-width: var(--rule); margin: 0 var(--gap); }
  .column--read + .bar, .bar { order: 3; }
  .bar {
    display: flex; gap: var(--pad); position: sticky; bottom: 0; z-index: 10;
    padding: 0 var(--gap) env(safe-area-inset-bottom, 0px); background: var(--ground); border-top-width: var(--rule);
    overflow-x: auto; scrollbar-width: none;
  }
  .bar::-webkit-scrollbar { display: none; }
  .bar .link { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--hair); white-space: nowrap; }
  .bar .invert { margin-left: auto; }
  .actions { margin-top: 0; }
  section { scroll-margin-top: var(--gap); }
}
@media (pointer: coarse) { .btn, .seg button { min-height: var(--tap); } }
