/*
  The product card's panel (js/render-panels.js, P.root) and the product spec read inside it
  (js/spec.js).

  The panel has two views and one switch, set where a title would be: two plain names at
  title size, the one being read in ink and the other in grey. No pill, no box.

  The spec is set for long reading: one comfortable measure, body copy a tone below the ink so
  that what the document sets in bold stands out by tone and not by weight, headings in a
  medium weight, tables on hairlines, code that keeps its shape. Tokens are the board's own
  (css/base.css).
*/

/* ---------- the small line on the product card, on the board ---------- */
.node[data-kind="root"] .node-text::after {
  content: var(--ring-line, "");
  display: block;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.004em;
  color: var(--text);
}

/* ---------- the switch between the two views ---------- */
/* The panel's name for a screen reader. The switch is what is seen. */
.cover-name {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.cover-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 44px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.cover-tab, .cover-tabs.is-one {
  position: relative;
  padding: 0 0 26px;
  border: 0;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: clamp(24px, 3.5vw, 44px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.03em;
  cursor: pointer;
  transition: color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
.cover-tabs.is-one { color: var(--text); cursor: default; }
.cover-tab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--text);
  opacity: 0;
  transition: opacity 180ms ease;
}
.cover-tab[aria-selected="true"] { color: var(--text); }
.cover-tab[aria-selected="true"]::after { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .cover-tab:hover { color: var(--text); } }
.cover-tab:focus-visible { outline: 0; }
.cover-tab:focus-visible::after { opacity: 1; height: 2px; background: var(--edge-hot); }
.cover-body-view { margin-top: 56px; }
.cover-view > .cover-body { margin-top: 0; }

/* ---------- the spec: its sections beside it, and the document ---------- */
.spec {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  min-height: 60vh;
}
.spec.is-plain { grid-template-columns: minmax(0, 1fr); }
.spec-state { grid-column: 1 / -1; margin: 0; font-size: 17px; line-height: 1.5; color: var(--text-2); }

.spec-toc {
  /* The panel's own bar lies over the top of the scrolling area (css/panel.css): the list
     holds just under it. */
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.spec-toc::-webkit-scrollbar { display: none; }
.spec-toggle { display: none; }
.spec-toc ul { margin: 0; padding: 0; list-style: none; }
.spec-toc li { margin: 0; }
.spec-toc li button {
  display: block;
  width: 100%;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.35;
  letter-spacing: -0.003em;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease;
}
.spec-toc li button[aria-current="true"] { color: var(--text); }
@media (hover: hover) and (pointer: fine) { .spec-toc li button:hover { color: var(--text); } }
.spec-toc button:focus-visible { outline: 2px solid var(--edge-hot); outline-offset: 2px; border-radius: 4px; }

.spec-doc {
  max-width: 680px;
  font-size: 16.5px;
  line-height: 1.62;
  letter-spacing: -0.003em;
  color: var(--text-2);
  overflow-wrap: break-word;
}
.spec-doc p { margin: 0 0 1.05em; text-wrap: pretty; }
.spec-doc strong { font-weight: 500; color: var(--text); }
.spec-doc em { font-style: italic; }
.spec-doc a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--line-strong); }

/* The view opens with one lead line (words.cover.specLead), set as a card's lead line is. */
.spec-lead { margin: 0 0 26px; max-width: 46ch; }
/* What the document says before its first section: under that line, small. */
.spec-notes { margin: 0 0 48px; }
.spec-notes blockquote.is-note:last-child { margin-bottom: 0; }
.spec-doc blockquote { margin: 0; }
.spec-doc blockquote.is-note {
  margin: 0 0 14px;
  padding-left: 18px;
  border-left: 1px solid var(--line-strong);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-3);
}
.spec-doc blockquote.is-note p { margin: 0; }
.spec-doc blockquote.is-note strong { color: var(--text-2); }
/* A line the document sets apart to be remembered: the firm's serif, once in a while. */
.spec-doc blockquote:not(.is-note) {
  margin: 30px 0 32px;
  padding-left: 22px;
  border-left: 1px solid var(--line-strong);
  font-family: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-style: italic;
  font-size: 25px;
  line-height: 1.28;
  letter-spacing: -0.008em;
  color: var(--text);
}
.spec-doc blockquote:not(.is-note) p { margin: 0; text-wrap: balance; }

.spec-sec { margin-top: 64px; padding-top: 56px; border-top: 1px solid var(--line); scroll-margin-top: 30px; }
.spec-doc > .spec-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.spec-doc h2 {
  margin: 0 0 22px;
  font-size: clamp(25px, 2.3vw, 31px);
  line-height: 1.14;
  font-weight: 500;
  letter-spacing: -0.024em;
  color: var(--text);
  text-wrap: balance;
}
.spec-doc h2:focus { outline: none; }
.spec-doc h3 {
  margin: 44px 0 12px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.014em;
  color: var(--text);
}
.spec-doc h4 {
  margin: 32px 0 8px;
  font-size: 16.5px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.004em;
  color: var(--text);
}
.spec-doc h2 + h3, .spec-doc h3 + h4 { margin-top: 0; }

.spec-doc ul, .spec-doc ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.spec-doc li { margin: 0.42em 0; padding-left: 0.2em; }
.spec-doc li::marker { color: var(--text-3); }
.spec-doc li > ul, .spec-doc li > ol { margin: 0.3em 0 0; }

.spec-doc code {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.36em;
  border-radius: 5px;
  background: var(--slot);
  color: var(--text);
}
.spec-doc pre {
  margin: 20px 0 26px;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--slot);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.spec-doc pre code { display: block; padding: 0; background: none; font-size: 13.5px; line-height: 1.65; color: var(--text-2); white-space: pre; }
.spec-doc pre:focus-visible, .spec-table:focus-visible { outline: 2px solid var(--edge-hot); outline-offset: 2px; }

/* A table scrolls inside itself when it is wider than the column. It never widens the page. */
.spec-table { margin: 20px 0 28px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.spec-table table {
  width: 100%;
  min-width: calc(var(--cols, 2) * 132px);
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}
.spec-table th {
  padding: 0 18px 10px 0;
  border-bottom: 1px solid var(--line-strong);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-3);
  text-align: left;
  vertical-align: bottom;
}
.spec-table td { padding: 12px 18px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table td:first-child { color: var(--text); }
.spec-table th:last-child, .spec-table td:last-child { padding-right: 0; }
.spec-table tr:last-child td { border-bottom: 0; }

/* ---------- narrow: the sections fold into one line that stays at the top ---------- */
@media (max-width: 900px) {
  .cover-tabs { gap: 6px 28px; }
  .cover-tab, .cover-tabs.is-one { padding-bottom: 20px; }
  .cover-body-view { margin-top: 40px; }
  .spec-lead { margin-bottom: 20px; }
  .spec-notes { margin-bottom: 20px; }
  .spec { display: block; }
  .spec-toc {
    top: 50px;
    z-index: 2;
    max-height: none;
    overflow: visible;
    margin: 0 -20px 30px;
    padding: 0 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .spec-toggle {
    display: flex;
    align-items: baseline;
    gap: 12px;
    width: 100%;
    padding: 14px 0;
    border: 0;
    background: none;
    color: var(--text-3);
    font: inherit;
    font-size: 14.5px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .spec-now { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
  .spec-toc ul { display: none; max-height: 56vh; overflow-y: auto; padding: 2px 0 14px; overscroll-behavior: contain; }
  .spec-toc.is-open ul { display: block; }
  .spec-toc li button { padding: 9px 0; font-size: 16px; }
  .spec-doc { max-width: none; font-size: 16.5px; }
  .spec-doc blockquote:not(.is-note) { font-size: 22px; }
  .spec-sec { margin-top: 48px; padding-top: 44px; scroll-margin-top: 76px; }
}
