/* Shared styles for the documentation pages, layered on the portfolio stylesheet. */
.doc-section a {
  color: #2200ff;
  text-decoration: none;
}

.doc-section a:hover {
  text-decoration: underline;
}

.back-link {
  font-size: 1.15em;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.doc-section h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.doc-section h3 {
  margin: 1.4rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.project-text .doc-section p,
.doc-section li,
.doc-section td,
.doc-section th {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

.project-text .doc-section p {
  margin: 0.6rem 0 0;
  max-width: 75ch;
}

.doc-section ul,
.doc-section ol {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  max-width: 75ch;
}

.doc-section li + li {
  margin-top: 0.3rem;
}

.doc-section strong {
  font-weight: 700;
}

.doc-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  padding: 0.05rem 0.25rem;
  background: rgba(21, 18, 15, 0.06);
}

.project-text .doc-section .doc-formula {
  margin: 0.8rem 0 0;
  padding: 0.5rem 0.8rem;
  border-left: 2px solid var(--line);
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--ink);
}

.doc-table-wrap {
  margin: 0.8rem 0 0;
  overflow-x: auto;
}

.doc-section table {
  border-collapse: collapse;
  min-width: min(100%, 640px);
}

.doc-section th,
.doc-section td {
  padding: 0.35rem 0.8rem 0.35rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc-section th {
  font-weight: 700;
  color: var(--ink);
}

.doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.6rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.doc-tabs a {
  display: block;
  margin-bottom: -1px;
  padding: 0.5rem 0 0.6rem;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  opacity: 0.4;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.doc-tabs a:hover {
  opacity: 0.75;
}

.doc-tabs a[aria-current="page"] {
  opacity: 1;
  border-bottom-color: #2200ff;
}

.doc-section {
  margin: 0;
  padding-top: 0.4rem;
}

.doc-section > h3:first-child {
  margin-top: 0.6rem;
}

.doc-subsection {
  scroll-margin-top: 1.5rem;
}

.doc-subsection + .doc-subsection {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.doc-subsection > h2 + h3,
.doc-subsection > h2 + p,
.doc-subsection > h2 + ul {
  margin-top: 0.6rem;
}

.doc-layout {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  margin-top: 1.2rem;
}

.doc-toc {
  position: sticky;
  top: 1.5rem;
  padding-top: 0.4rem;
}

.doc-toc-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
  border-left: 1px solid var(--line);
}

.doc-toc li {
  counter-increment: toc;
}

.doc-toc a {
  display: block;
  margin-left: -1px;
  padding: 0.35rem 0 0.35rem 0.8rem;
  border-left: 2px solid transparent;
  color: var(--ink);
  opacity: 0.55;
  font-size: 0.95rem;
  text-decoration: none;
}

.doc-toc a::before {
  content: counter(toc) ". ";
}

.doc-toc a:hover {
  opacity: 1;
}

.doc-toc a[aria-current="true"] {
  opacity: 1;
  font-weight: 700;
  border-left-color: #2200ff;
}

.doc-figure {
  margin: 1rem 0 0;
  max-width: 100%;
}

.doc-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #111;
}

.doc-figure a {
  text-decoration: none;
}

.doc-figure figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.doc-figure-small {
  max-width: 22rem;
}

.doc-figure-tall {
  max-width: 16rem;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.figure-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.figure-row > .doc-figure:first-child:not(.doc-figure-tall):not(.doc-figure-small) {
  width: 34rem;
  max-width: 100%;
}

.doc-section ol.figure-key {
  list-style: none;
  padding-left: 0;
  counter-reset: figure-key;
}

.figure-key > li {
  position: relative;
  padding-left: 2rem;
  counter-increment: figure-key;
}

.figure-key > li::before {
  content: counter(figure-key);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #afff2e;
  color: #000;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
}

@media (max-width: 900px) {
  .doc-layout {
    display: block;
  }

  .doc-toc {
    display: none;
  }

  .figure-grid,
  .figure-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
