.doc {
  width: min(60%, 48rem);
  min-height: 70vh;
  margin-inline: auto;
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.gate {
  max-width: 26rem;
  margin-inline: auto;
}

.gate label {
  display: block;
  margin-bottom: 0.5rem;
}

.gate input,
.gate button {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font: inherit;
}

.gate button {
  margin-top: 1rem;
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
  cursor: pointer;
}

.gate-error {
  color: var(--red);
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
  color: var(--gray);
  font-size: 0.9rem;
}

.crumb > * + *::before {
  content: "/";
  margin-right: 0.5rem;
}

.doc-head {
  margin-bottom: 3rem;
}

.doc-head h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.25rem, 3vw, 2.5rem);
  line-height: 1.15;
}

.doc-section {
  margin-top: 3rem;
}

.doc-section h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  line-height: 1.35;
}

.tip {
  margin-block: 1.5rem;
  padding: 0.4rem 1.25rem;
  border-left: 0.25rem solid var(--red);
  border-radius: 0 0.35rem 0.35rem 0;
  background: color-mix(in srgb, var(--red) 10%, var(--white));
}

.doc-links {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.doc-links a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  text-decoration: none;
}

.doc table {
  margin-block: 1.5rem;
}

.doc thead th {
  background: var(--soft);
}

.doc :is(th, td) {
  overflow-wrap: anywhere;
}

.doc tbody :is(th, td):first-child {
  white-space: nowrap;
}

.doc .parts {
  width: auto;
}

.doc caption {
  margin-bottom: 0.75rem;
  color: var(--gray);
  font-size: 0.9rem;
  text-align: left;
}

.doc-section h4 {
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
  line-height: 1.4;
}

.fold {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}

.fold summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.fold summary::-webkit-details-marker {
  display: none;
}

.fold summary::before {
  content: "›";
  font-size: 1.5rem;
  line-height: 1;
}

.fold[open] summary {
  border-bottom: 1px solid var(--line);
}

.fold[open] summary::before {
  transform: rotate(90deg);
}

.entries {
  display: grid;
  gap: 1.5rem;
  padding: 1.25rem;
}

.entry {
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: clamp(1.25rem, 4vw, 3rem);
}

.entry-media {
  min-height: 10rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--gray);
}

.entry-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.entry h3 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.6;
}

.entry-media.entry-photo {
  min-height: 0;
  display: block;
  border: 0;
  width: 100%;
  height: auto;
  display: block;
}

.meta {
  margin: 1.5rem 0 0;
}

.meta div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--line);
}

.meta dt {
  color: var(--gray);
  font-weight: 700;
}

.meta dd {
  margin: 0;
}

@media (max-width: 900px) {
  .doc {
    width: calc(100% - 2rem);
  }

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

  .entry-media {
    min-height: 12rem;
  }
}

.doc-layout {
  width: min(100% - 2rem, 80rem);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 54rem);
  gap: 2rem;
  justify-content: center;
  align-items: start;
}

.doc-layout .doc {
  grid-column: 2;
  width: 100%;
}

.doc-layout h2,
.doc-layout h3 {
  scroll-margin-top: 9rem;
}

.doc-toc {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 9rem;
  width: 100%;
  max-height: calc(100vh - 10rem);
  margin: 2.5rem auto 0;
  padding: 1.25rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--white);
}

.doc-toc strong {
  display: block;
  margin-bottom: 0.75rem;
}

.doc-toc-links {
  display: grid;
  gap: 0.2rem;
}

.doc-toc-links a {
  padding: 0.45rem 0.6rem;
  border-radius: 0.3rem;
  color: var(--gray);
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: none;
}

.doc-toc-links a:hover,
.doc-toc-links a.is-on {
  background: color-mix(in srgb, var(--red) 10%, var(--white));
  color: var(--red);
}

.doc-toc-links .toc-h3 {
  padding-left: 1.5rem;
  font-size: 0.85rem;
}

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

  .doc-layout .doc {
    width: min(100%, 54rem);
  }

  .doc-toc {
    position: static;
    width: min(100%, 54rem);
    max-height: none;
    margin: 2rem auto 0;
  }
}

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