/* Index demo (D2). One face at two sizes, three colors, no radius.
   13px is the apparatus: name, nav, column heads, notes.
   15px is the work: the rows of the table. The list is set larger than the
   name on purpose, so the page opens on what was made. */

:root {
  --paper: #ffffff;
  /* #0a0a0a is the near-black the proposal names, taken from the catalogue
     sites it follows. It stays because the orange row holds 6.3:1 against it. */
  --ink: #0a0a0a;
  /* Orange belongs to the hovered row. Text selection borrows it. */
  --hot: #ff5a1f;
  --gut: 16px;
  --g: 16px;
  color-scheme: light;
}

@media (min-width: 40em) { :root { --gut: 24px; } }
@media (min-width: 64em) { :root { --g: 24px; } }
@media (min-width: 90em) { :root { --gut: 32px; } }

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

body {
  margin: 0;
  padding: 0 var(--gut);
  background: var(--paper);
  color: var(--ink);
  font-family: "Switzer", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  /* Switzer's default figures already share one 576-unit advance. This keeps
     the number columns straight while the fallback face is showing. */
  font-variant-numeric: tabular-nums;
}

h1, h2, p, figure { margin: 0; }

h1, h2 {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { text-decoration-thickness: 2px; }

a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

::selection {
  background: var(--hot);
  color: var(--ink);
}

/* Header. The first column is the width of the N. column below, so the nav
   starts where the titles start. */
.top {
  display: grid;
  grid-template-columns: 12% minmax(0, 1fr) auto;
  align-items: baseline;
  padding: var(--gut) 0 48px;
}

.top .left { display: contents; }

nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
}

nav a, .out { text-decoration: none; }
nav a:hover, .out:hover { text-decoration: underline; }

.out { justify-self: end; }

/* Narrow phones: the name and the nav would run together in one line, so the
   nav drops to a second line, still starting where the titles start. */
@media (max-width: 39.99em) {
  .top h1 { grid-area: 1 / 1; }
  .out { grid-area: 1 / 3; }
  nav { grid-area: 2 / 2 / 3 / 4; margin-top: 4px; }
}

/* The index */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.c-n { width: 12%; }
.c-t { width: 50%; }
.c-k { width: 25%; }
.c-y { width: 13%; }

caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 24px;
}

th {
  text-align: left;
  font-weight: 500;
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--ink);
  vertical-align: bottom;
}

td {
  font-size: 15px;
  line-height: 20px;
  padding: 4px 8px 4px 0;
  vertical-align: top;
  overflow-wrap: break-word;
  transition: background-color 120ms linear, box-shadow 120ms linear;
}

th:last-child, td:last-child { padding-right: 0; }

tbody tr:first-child td { padding-top: 8px; }
tbody tr:last-child td {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}

tbody tr { scroll-margin-top: 16px; }

td a { text-decoration: none; }
td a:hover { text-decoration: underline; }

/* The hovered row. The two outer cells push the orange 6px past the text so
   the figures do not sit on the edge of the bar. */
tbody tr:hover td,
tbody tr:has(:focus-visible) td { background: var(--hot); }

tbody tr:hover td:first-child,
tbody tr:has(:focus-visible) td:first-child { box-shadow: -6px 0 0 var(--hot); }

tbody tr:hover td:last-child,
tbody tr:has(:focus-visible) td:last-child { box-shadow: 6px 0 0 var(--hot); }

/* Row pictures stay out of the way until the wide, pointer layout below. */
.peek { display: none; }

/* About and pictures */
.side { margin-top: 56px; }

#about p { max-width: 34em; }
#about h2, .sheet h2 { margin-bottom: 6px; }

.sheet { margin-top: 40px; }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
}

.sheet img {
  display: block;
  width: 100%;
  height: auto;
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

figcaption { padding-top: 6px; }

@media (min-width: 40em) and (max-width: 63.99em) {
  .sheet-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Footer */
.foot { margin-top: 72px; padding-bottom: var(--gut); }

.foot .left {
  border-top: 1px solid var(--ink);
  padding-top: 8px;
}

.foot h2 { margin-bottom: 6px; }
.note { margin-top: 18px; }

@media (min-width: 40em) {
  .foot .left {
    display: grid;
    grid-template-columns: 12% minmax(0, 1fr);
  }
  .foot h2 { margin-bottom: 0; }
}

/* Wide: a 12-column page. The index takes eight columns, the right four are
   left open for the about note and for the row pictures. */
@media (min-width: 64em) {
  .top, main, .foot {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--g);
    align-items: start;
  }

  .top { align-items: baseline; }

  .top .left {
    display: grid;
    grid-column: 1 / 9;
    grid-template-columns: 12% minmax(0, 1fr);
    align-items: baseline;
  }

  .out {
    grid-column: 9 / 13;
    justify-self: start;
  }

  main > .left, .foot .left { grid-column: 1 / 9; }

  .side {
    grid-column: 9 / 13;
    margin-top: 0;
  }
}

/* Wide with a pointer: hovering a row shows its picture fixed at the right
   edge, sized to the last four columns. No script. */
@media (min-width: 64em) and (hover: hover) {
  .sheet { display: none; }

  .peek {
    display: block;
    position: fixed;
    right: var(--gut);
    bottom: var(--gut);
    z-index: 2;
    width: calc((100% - 2 * var(--gut) - 11 * var(--g)) / 12 * 4 + 3 * var(--g));
    height: auto;
    background: var(--paper);
    outline: 1px solid var(--ink);
    outline-offset: -1px;
    visibility: hidden;
    pointer-events: none;
  }

  tbody tr:hover .peek,
  tbody tr:has(:focus-visible) .peek { visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  td { transition: none; }
}
