/* compare.html (draft): which pocket-ui has what. A quiet ledger, not a wall of boxes: the table sits on the page,
   hairlines between the rows, the group names in the pixel letters, one header that stays put while you scroll.
   On phones you pick one of the four (plain radio buttons, no script) and read a simple checklist for it.
   Built on retro.css's variables, so Cocoa, Pea, Dark, Light and the Pixel letters all carry over. */

/* The top bar is one line (75 px and its lip) once the script has folded the pages into the Menu key. */
.cmp-page { --cmp-top: calc(75.2px + var(--px)); }

/* ---- The marks: a pixel tick for yes, a half-lit square for partly, a short dash for no. --------------------------- */
.k {
  position: relative; display: inline-block; flex: none; vertical-align: top;
  width: 21px; height: 18px; color: var(--amber);
}
/* The tick is drawn pixel by pixel (3 px each), like the device's own icons. */
.c-y .k::after {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 3px; background: transparent;
  box-shadow:
    18px 0 0 0 currentColor,
    15px 3px 0 0 currentColor, 18px 3px 0 0 currentColor,
    0 6px 0 0 currentColor, 12px 6px 0 0 currentColor, 15px 6px 0 0 currentColor,
    0 9px 0 0 currentColor, 3px 9px 0 0 currentColor, 9px 9px 0 0 currentColor, 12px 9px 0 0 currentColor,
    3px 12px 0 0 currentColor, 6px 12px 0 0 currentColor, 9px 12px 0 0 currentColor,
    6px 15px 0 0 currentColor;
}
.c-p .k::after {
  content: ""; position: absolute; left: 3px; top: 2px; width: 14px; height: 14px; box-sizing: border-box;
  border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 0 50%, transparent 50%);
}
.c-n .k::after { content: ""; position: absolute; left: 4px; top: 8px; width: 12px; height: 2px; background: var(--dust); }
.c-f .k::after { content: ""; position: absolute; left: 6px; top: 5px; width: 8px; height: 8px; box-sizing: border-box; border: 2px solid var(--dust); }

.cmp-legend { list-style: none; margin: 1.4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.8rem; font-size: 0.95rem; color: var(--chalk); }
.cmp-legend li { display: flex; align-items: center; gap: 0.6rem; }

/* ---- The table ------------------------------------------------------------------------------------------------- */
.cmp-set { margin: 0 0 0.4rem; }
.cmp-region { overflow-x: auto; }
.cmp-region:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
/* Wide enough for the table: no scroll box, so the header can stay under the top bar. */
@media (min-width: 46rem) { .cmp-region { overflow: visible; } }

.cmp-matrix { table-layout: fixed; width: 100%; min-width: 40rem; border-collapse: collapse; margin: 0; }
.cmp-matrix col { width: 17.5%; }
.cmp-matrix col.c-feat { width: auto; }
.cmp-matrix th, .cmp-matrix td { padding: 0; vertical-align: top; text-align: left; font-weight: 400; }

/* The header: the four names, a strong rule under them. Stays in view while the long table scrolls. */
.cmp-matrix thead th {
  top: var(--cmp-top); z-index: 2; background: var(--void);
  padding: 0.9rem 1rem 0.7rem 0; vertical-align: top; border-bottom: var(--px) solid var(--text);
}
.js .cmp-matrix thead th { position: sticky; }
.cmp-matrix .cn { display: block; font-family: var(--pixel); font-size: var(--d1); line-height: 1.3; color: var(--text); }
.cmp-matrix .cs { display: block; font-family: var(--body); font-size: 0.8rem; line-height: 1.3; color: var(--dust); margin-top: 0.25rem; }

/* The groups: a name in the pixel letters, a little air above it. */
.cmp-matrix tr.grp th {
  font-family: var(--pixel); font-size: var(--d2); line-height: 1.1; color: var(--amber);
  padding: 2.2rem 0 0.7rem; border-bottom: 2px solid var(--rule);
}
.cmp-matrix tbody:first-of-type tr.grp th { padding-top: 1.6rem; }

/* The rows: hairlines only. */
.cmp-matrix tbody tr:not(.grp) > * { border-bottom: 1px solid var(--rule); }
.cmp-matrix th.f { padding: 0.8rem 1.4rem 0.8rem 0; }
.cmp-matrix .fn-name { display: block; font-weight: 600; font-size: 1.02rem; line-height: 1.25; color: var(--text); }
.cmp-matrix .fs { display: block; font-size: 0.85rem; line-height: 1.35; color: var(--dust); margin-top: 0.2rem; }
.cmp-matrix td.c { padding: 0.85rem 1rem 0.8rem 0; }
.cmp-matrix .t { display: block; font-size: 0.85rem; line-height: 1.35; color: var(--chalk); margin-top: 0.35rem; }
.cmp-matrix .t a.fn { color: var(--dust); white-space: nowrap; }
.cmp-matrix .c-n .t, .cmp-matrix .c-f .t { color: var(--dust); }
.cmp-matrix tbody tr:not(.grp):hover > * { background: color-mix(in srgb, var(--spine) 55%, transparent); }

.cmp-get { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 0; margin: 2.4rem 0 0.4rem; }
.cmp-more { margin: 0.6rem 0 0; font-size: 0.95rem; color: var(--chalk); }

/* The picker only exists on phones (below). */
.cmp-pick { display: none; }

/* ---- Phones: pick one, read a checklist ----------------------------------------------------------------------- */
@media (max-width: 39.9375rem) {
  .cmp-region { overflow: visible; }
  .cmp-matrix, .cmp-matrix thead, .cmp-matrix tbody, .cmp-matrix tr, .cmp-matrix th, .cmp-matrix td { display: block; width: auto; min-width: 0; }
  .cmp-matrix colgroup { display: none; }
  .cmp-matrix thead th { position: static; border: 0; padding: 0; background: none; }
  .cmp-matrix thead th.f-h { display: none; }
  .cmp-matrix thead tr { padding: 0 0 0.6rem; border-bottom: var(--px) solid var(--text); }
  .cmp-matrix thead th.ed + th.ed { margin-top: 0.5rem; }
  .cmp-matrix tr.grp th { font-size: var(--d2); padding: 1.8rem 0 0.5rem; }
  .cmp-matrix tbody:first-of-type tr.grp th { padding-top: 1.2rem; }

  /* Without :has(): every edition stays listed under its name, one quiet line each. */
  .cmp-matrix tbody tr:not(.grp) { padding: 0.75rem 0 0.5rem; border-bottom: 1px solid var(--rule); }
  .cmp-matrix tbody tr:not(.grp) > * { border: 0; }
  .cmp-matrix tbody tr:not(.grp):hover > * { background: none; }
  .cmp-matrix th.f { padding: 0 0 0.3rem; }
  .cmp-matrix td.c { display: grid; grid-template-columns: 8rem 21px minmax(0, 1fr); column-gap: 0.6rem; padding: 0.25rem 0; }
  .cmp-matrix td.c::before { content: attr(data-label); font-size: 0.85rem; color: var(--quiet); }
  .cmp-matrix td.c .t { margin: 0; }

  /* With :has(), the picker shows one edition at a time. Without it, every edition stays listed under its name. */
  @supports selector(:has(a)) {
    .cmp-pick {
      display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 1rem 0 1.2rem; padding: 0; border: 0;
      border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule);
    }
    .cmp-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
    .cmp-pick label {
      display: flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0.3rem 0.6rem; cursor: pointer;
      font-family: var(--pixel); font-size: var(--d1); line-height: 1.25; color: var(--quiet);
    }
    .cmp-pick label:nth-of-type(odd) { border-right: 2px solid var(--rule); }
    .cmp-pick label:nth-of-type(-n+2) { border-bottom: 2px solid var(--rule); }
    /* The pixel cursor of the device's own lists marks the one you're reading. */
    .cmp-pick label::before { content: ""; flex: none; width: 6px; height: 12px; background: currentColor; opacity: 0.35;
      clip-path: polygon(0 0, 50% 0, 50% 25%, 100% 25%, 100% 75%, 50% 75%, 50% 100%, 0 100%); }
    .cmp-pick input:checked + label { background: var(--select); color: var(--on-select); }
    .cmp-pick input:checked + label::before { opacity: 1; }
    .cmp-pick input:focus-visible + label { outline: 3px solid var(--text); outline-offset: -3px; }
    .cmp-pick label:hover { color: var(--text); }
    .cmp-pick input:checked + label:hover { color: var(--on-select); }

    /* Each row: the mark on the left, then the name, its line and the note. */
    .cmp-matrix tbody tr:not(.grp) { display: grid; grid-template-columns: 21px minmax(0, 1fr); column-gap: 0.85rem; align-items: start; padding: 0.75rem 0; }
    .cmp-matrix th.f { grid-column: 2; grid-row: 1; padding: 0; }
    .cmp-matrix td.c { display: contents; }
    .cmp-matrix td.c::before { content: none; }
    .cmp-matrix td.c .k { grid-column: 1; grid-row: 1; margin-top: 1px; }
    .cmp-matrix td.c .t { grid-column: 2; grid-row: 2; margin-top: 0.3rem; }
    .cmp-set:has(.cmp-pick input:nth-of-type(1):checked) .cmp-matrix :is(td.c, th.ed):not(:nth-child(2)),
    .cmp-set:has(.cmp-pick input:nth-of-type(2):checked) .cmp-matrix :is(td.c, th.ed):not(:nth-child(3)),
    .cmp-set:has(.cmp-pick input:nth-of-type(3):checked) .cmp-matrix :is(td.c, th.ed):not(:nth-child(4)),
    .cmp-set:has(.cmp-pick input:nth-of-type(4):checked) .cmp-matrix :is(td.c, th.ed):not(:nth-child(5)) { display: none; }
    .cmp-matrix thead th.ed + th.ed { margin-top: 0; }
    .cmp-matrix thead th.ed .cn { display: none; }
    .cmp-matrix thead th.ed .cs { font-size: 0.95rem; margin: 0; color: var(--chalk); }
    /* Not in this one: the name steps back. */
    .cmp-set:has(.cmp-pick input:nth-of-type(1):checked) tr:has(> td:nth-child(2).c-n) th.f,
    .cmp-set:has(.cmp-pick input:nth-of-type(2):checked) tr:has(> td:nth-child(3).c-n) th.f,
    .cmp-set:has(.cmp-pick input:nth-of-type(3):checked) tr:has(> td:nth-child(4).c-n) th.f,
    .cmp-set:has(.cmp-pick input:nth-of-type(4):checked) tr:has(> td:nth-child(5).c-n) th.f { opacity: 0.55; }
  }
}

/* Pixel letters: the running words one grid step up, as on the other pages. */
:root[data-text="pixel"] .cmp-matrix .fn-name { font-size: var(--d1); line-height: 1.5; }
:root[data-text="pixel"] .cmp-matrix .fs, :root[data-text="pixel"] .cmp-matrix .t,
:root[data-text="pixel"] .cmp-matrix .cs, :root[data-text="pixel"] .cmp-legend { font-size: var(--d1); line-height: 1.5; }
