* {
  box-sizing: border-box;
}

html,
body {
  min-width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  background: var(--page);
}

.index-shell {
  width: min(720px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 20px;
}

.plate {
  border: 3px solid transparent;
  background-clip: padding-box;
  border-image-slice: 3;
  border-image-width: 3px;
  border-image-repeat: stretch;
}

.masthead {
  min-height: 89px;
  padding: 10px 16px;
  background-color: var(--raised);
  border-color: var(--edge-strong);
  border-image-source: url("/assets/chrome/frame-masthead.png");
  text-align: center;
}

.masthead h1 {
  margin: 1px 0 4px;
  color: var(--hot);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.masthead p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 6px;
  row-gap: 7px;
  margin-top: 8px;
}

.portal {
  position: relative;
  display: grid;
  align-items: start;
  min-width: 0;
  min-height: 110px;
  padding: 5px 11px;
  background-color: var(--raised);
  border-color: var(--edge);
  border-image-source: url("/assets/chrome/frame-compact.png");
  color: inherit;
  text-decoration: none;
}

.portal.feature {
  grid-column: 1 / -1;
  min-height: 132px;
  padding: 8px 11px;
  background-color: var(--surface);
  border-image-source: url("/assets/chrome/frame-feature.png");
  text-align: center;
}

.portal.title-only {
  align-items: center;
  min-height: 52px;
  padding-block: 4px;
}

.portal.feature.title-only {
  min-height: 62px;
  padding-block: 5px;
}

.portal.title-only .portal-copy {
  align-self: center;
}

.portal-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding-right: 40px;
}

.feature .portal-copy {
  justify-items: center;
  padding-left: 40px;
}

.portal strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.25;
}

.portal.feature strong {
  font-size: 17.5px;
}

.summary {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.feature .summary {
  font-size: 13px;
}

.portal b {
  margin-top: 1px;
  color: var(--hot);
  font-size: 11px;
  line-height: 1.2;
}

.monoglyph {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  background: url("/assets/chrome/monoglyph-atlas.png") 0 0 / 192px 32px no-repeat;
  image-rendering: auto;
}

.portal:hover .monoglyph,
.portal:focus-visible .monoglyph {
  animation: monoglyph-recoil 240ms steps(1, end) both;
}

.portal:active .monoglyph,
.artifact-card:active .monoglyph {
  animation: none;
  background-position: -32px 0;
}

.portal:hover strong,
.portal:focus-visible strong {
  color: var(--hot);
}

.portal:focus-visible,
.error-shell a:focus-visible {
  outline: 1px solid var(--hot);
  outline-offset: 3px;
}

.index-prose {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.error-shell {
  padding-top: max(14px, 18vh);
}

.error-shell a {
  color: var(--hot);
}

.site-head,
.site-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(860px, calc(100% - 28px));
  margin: 0 auto;
  padding: 12px 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.site-head a,
.site-foot a {
  color: var(--hot);
  text-decoration: none;
}

.document-shell {
  width: min(860px, calc(100% - 28px));
  margin: 0 auto;
}

.projects-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
}

.document-head {
  padding: 18px 22px;
  background: var(--raised);
  border-color: var(--edge-strong);
  border-image-source: url("/assets/chrome/frame-masthead.png");
}

.document-head h1 {
  margin: 5px 0 4px;
  color: var(--hot);
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.05;
}

.document-head p:last-child {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.projects-shell > .document-head {
  padding: 14px 18px;
}

.projects-shell > .document-head h1 {
  margin-top: 2px;
  font-size: 32px;
}

.projects-shell > .document-head p:last-child {
  font-size: 13px;
}

.document {
  width: min(700px, 100%);
  margin: 0 auto;
  padding: 34px 0 56px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

.document h2,
.document h3,
.document h4 {
  color: var(--hot);
  line-height: 1.2;
}

.document h2 {
  margin: 48px 0 14px;
  font-size: 28px;
}

.document h3 {
  margin: 32px 0 10px;
  font-size: 20px;
}

.document h4 {
  text-decoration: underline;
}

.document p,
.document ul,
.document ol,
.document pre,
.document table {
  margin: 0 0 18px;
}

.document a {
  color: var(--hot);
  text-decoration-color: var(--edge-strong);
  text-underline-offset: 3px;
}

.document code,
.document pre {
  font-family: inherit;
}

.document pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--edge);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.5;
}

.document blockquote {
  margin: 24px 0;
  padding: 3px 0 3px 18px;
  border-left: 1px solid var(--edge-strong);
  color: var(--muted);
}

.document img,
.document svg {
  max-width: 100%;
  height: auto;
}

.document hr {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--edge);
}

.document .lede {
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.document aside,
.document .theorem {
  margin: 24px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--edge-strong);
  background: var(--surface);
}

.document .theorem {
  border: 1px solid var(--edge-strong);
}

.document aside > :last-child,
.document .theorem > :last-child,
.document .proof > :last-child {
  margin-bottom: 0;
}

.document .proof {
  margin: 24px 0;
  padding-left: 16px;
  border-left: 1px solid var(--edge);
}

.project-ledger {
  display: grid;
  gap: 12px;
  margin: 12px 0 40px;
}

.project-plate {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  background: var(--raised);
  border-color: var(--edge-strong);
  border-image-source: url("/assets/chrome/frame-feature.png");
}

.project-plate.with-shot {
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.85fr);
}

.project-shot {
  aspect-ratio: 36 / 23;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-right: 1px solid var(--edge);
  background: var(--page);
}

.project-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 18px 0;
}

.project-copy h1,
.project-copy h2 {
  margin: 0 0 10px;
  color: var(--hot);
  font-size: 23px;
  line-height: 1.15;
}

.project-copy h1 {
  font-size: 28px;
}

.project-copy h2 a {
  color: inherit;
  text-decoration: none;
}

.project-copy h2 a:hover,
.project-copy h2 a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-copy p {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.project-actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  margin: auto -18px 0;
  border-top: 1px solid var(--edge);
}

.project-actions a {
  padding: 10px 12px;
  color: var(--hot);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.project-actions a + a {
  border-left: 1px solid var(--edge);
}

.project-actions a:hover,
.project-actions a:focus-visible {
  background: var(--surface);
  color: var(--text);
}

.project-actions a:focus-visible {
  outline: 1px solid var(--hot);
  outline-offset: -3px;
}

.project-profile {
  padding-top: 8px;
}

.project-document {
  padding-bottom: 42px;
}

.document .formula,
.document math[display="block"] {
  display: block;
  overflow-x: auto;
  margin: 22px 0;
  padding: 8px 0;
  text-align: center;
}

.document figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.document table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.document th,
.document td {
  padding: 8px 10px;
  border: 1px solid var(--edge);
  text-align: left;
}

.artifact-card {
  position: relative;
  display: block;
  min-height: 110px;
  margin: 16px 0;
  padding: 11px 14px;
  background: var(--raised);
  border-color: var(--edge);
  border-image-source: url("/assets/chrome/frame-compact.png");
  color: inherit;
  text-decoration: none;
}

.artifact-card strong {
  color: var(--text);
  font-size: 15px;
}

.artifact-card b {
  color: var(--hot);
  font-size: 11px;
}

.artifact-card .monoglyph {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
}

.artifact-card:hover .monoglyph,
.artifact-card:focus-visible .monoglyph {
  animation: monoglyph-recoil 240ms steps(1, end) both;
}

.artifact-card:hover strong,
.artifact-card:focus-visible strong {
  color: var(--hot);
}

.artifact-card:focus-visible {
  outline: 1px solid var(--hot);
  outline-offset: 3px;
}

@keyframes monoglyph-recoil {
  0% { background-position: 0 0; }
  16% { background-position: -64px 0; }
  32% { background-position: -96px 0; }
  48% { background-position: -128px 0; }
  72% { background-position: -160px 0; }
  100% { background-position: 0 0; }
}

@media (max-width: 560px) {
  .index-shell {
    width: calc(100% - 18px);
    padding-top: 9px;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    padding-inline: 12px;
  }

  .site-head,
  .site-foot,
  .document-shell,
  .projects-shell {
    width: calc(100% - 18px);
  }

  .document {
    padding-top: 24px;
  }
}

@media (max-width: 760px) {
  .project-plate.with-shot {
    grid-template-columns: 1fr;
  }

  .project-shot {
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal:hover .monoglyph,
  .portal:focus-visible .monoglyph,
  .artifact-card:hover .monoglyph,
  .artifact-card:focus-visible .monoglyph {
    animation: none;
  }
}
