/* ABOUTME: Tutorial page styles: hero with jump links, sticky contents rail, section headings, book row and pager. */
/* ABOUTME: Content blocks shared with news posts (figures, steps, video, downloads) are in content.css. */
.tutorial-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 1rem + 4vw, 5rem);
  align-items: center;
}

.tutorial-hero__text {
  min-width: 0;
}

.tutorial-hero h1 {
  font-size: clamp(2.6rem, 1.8rem + 4vw, 4.75rem);
  margin-bottom: 0.25em;
  color: var(--plum);
}

.tutorial-hero__tagline {
  font-size: var(--step-1);
  color: var(--ink-soft);
  max-width: 46ch;
  margin-bottom: 1.75rem;
}

.tutorial-hero__example {
  margin: 0;
  padding: 1.25rem 1.25rem 0.9rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  rotate: 2deg;
  transition: rotate 0.5s var(--ease);
}

.tutorial-hero__example:hover {
  rotate: 0deg;
}

.tutorial-hero__example img {
  width: clamp(180px, 22vw, 260px);
}

.tutorial-hero__example figcaption {
  margin-top: 0.6rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* Jump links: one tile per section, with a small icon. */

.jump__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jump__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem 0.5rem 0.7rem;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease), color 0.2s;
}

.jump__link:hover {
  border-color: var(--plum-300);
  color: var(--plum);
  transform: translateY(-1px);
}

.jump__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--plum-100) no-repeat center / 14px;
  flex: none;
}

.jump__icon--rules {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234e194a' stroke-width='1.6' stroke-linecap='round'%3E%3Crect x='2.5' y='2.5' width='11' height='11' rx='1'/%3E%3Cpath d='M6.2 2.5v11M9.8 2.5v11M2.5 6.2h11M2.5 9.8h11'/%3E%3C/svg%3E");
}
.jump__icon--tips {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234e194a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.8a4.4 4.4 0 0 0-2.6 8c.5.4.8 1 .8 1.6v.4h3.6v-.4c0-.6.3-1.2.8-1.6A4.4 4.4 0 0 0 8 1.8ZM6.4 14.2h3.2'/%3E%3C/svg%3E");
}
.jump__icon--steps {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234e194a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 13h4V9h4V5h4'/%3E%3C/svg%3E");
}
.jump__icon--video {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 3.8v8.4L12.3 8Z' fill='%234e194a'/%3E%3C/svg%3E");
}
.jump__icon--download {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234e194a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2.5v8M4.8 7.5 8 10.7l3.2-3.2M3 13.5h10'/%3E%3C/svg%3E");
}
.jump__icon--books {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234e194a' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M3 2.5h7.5a2 2 0 0 1 2 2v9H5a2 2 0 0 1-2-2Z'/%3E%3Cpath d='M3 11.5a2 2 0 0 1 2-2h7.5'/%3E%3C/svg%3E");
}
.jump__icon--section {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='2.5' fill='%234e194a'/%3E%3C/svg%3E");
}

/* Layout: contents rail beside the body on wide screens. */

.tutorial-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 780px);
  justify-content: space-between;
  gap: 4rem;
  padding-block: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) 3rem;
}

.toc__inner {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  padding-left: 1.1rem;
}

.toc__heading {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plum-600);
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc__list a {
  position: relative;
  display: block;
  padding: 0.4rem 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.2s, transform 0.25s var(--ease);
}

.toc__list a:hover {
  color: var(--plum);
}

.toc__list a.is-active {
  color: var(--plum);
  font-weight: 650;
  transform: translateX(3px);
}

.toc__list a::before {
  content: "";
  position: absolute;
  left: calc(-1.1rem - 3px);
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  transition: border-color 0.25s, background-color 0.25s;
  z-index: 1;
}

.toc__list a.is-active::before,
.toc__list a.is-passed::before {
  border-color: var(--plum);
  background: var(--plum);
}

.toc__track {
  position: absolute;
  left: 0;
  top: 2.2rem;
  bottom: 0.6rem;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.toc__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--plum);
  border-radius: 2px;
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
}

.mobile-toc {
  display: none;
}

@media (max-width: 1023px) {
  .tutorial-layout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: center;
    max-width: 780px;
    gap: 0;
  }

  .toc {
    display: none;
  }

  .js .mobile-toc {
    display: block;
    position: sticky;
    top: var(--header-height);
    z-index: 40;
    background: rgb(252 250 248 / 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }

  .mobile-toc summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem var(--gutter);
    font-size: 0.95rem;
    cursor: pointer;
    list-style: none;
  }

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

  .mobile-toc__label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--plum-600);
    white-space: nowrap;
  }

  .mobile-toc__current {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
  }

  .mobile-toc__details[open] .icon--chevron {
    transform: rotate(180deg);
  }

  .mobile-toc ol {
    margin: 0;
    padding: 0.25rem var(--gutter) 1rem;
    list-style: none;
  }

  .mobile-toc ol a {
    display: block;
    padding: 0.55rem 0;
    color: var(--ink);
    text-decoration: none;
    border-top: 1px solid var(--line);
  }

  .mobile-toc ol a.is-active {
    color: var(--plum);
    font-weight: 650;
  }

  .mobile-toc__progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 2px;
    width: 100%;
    background: var(--plum);
    transform-origin: left;
    transform: scaleX(var(--progress, 0));
  }

  html {
    scroll-padding-top: calc(var(--header-height) + 4rem);
  }
}

@media (max-width: 760px) {
  .tutorial-hero__inner {
    grid-template-columns: 1fr;
  }

  .tutorial-hero__example {
    justify-self: center;
    rotate: 0deg;
  }

  .jump {
    margin-inline: calc(-1 * var(--gutter));
  }

  .jump__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.25rem var(--gutter) 0.5rem;
    scrollbar-width: none;
  }

  .jump__link {
    white-space: nowrap;
  }
}

/* Body: section headings get a small grid motif. */

.tutorial-body > h2 {
  position: relative;
  padding-top: 1.75rem;
  margin-top: 3.5rem;
  color: var(--plum);
}

.tutorial-body > h2:first-child {
  margin-top: 0;
}

.tutorial-body > h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--plum) 0 33%, var(--rose) 33% 66%, var(--blue) 66%);
}

.tutorial-body > p:first-child {
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--ink);
}

.tutorial-body ul > li {
  list-style: none;
  position: relative;
}

.tutorial-body ul > li::before {
  content: "";
  position: absolute;
  left: -1.15em;
  top: 0.62em;
  width: 0.5em;
  height: 0.5em;
  border: 2px solid var(--rose);
  border-radius: 2px;
  rotate: 45deg;
}

/* Book row inside the body */

.tutorial-body .book-row {
  margin-top: 1.5rem;
}

.tutorial-body .book-row > li::before {
  display: none;
}

.tutorial-body .book-row > li {
  padding: 0;
  margin: 0;
}

/* Pager */

.tutorial-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding-block: 2.5rem 4rem;
  border-top: 1px solid var(--line);
}

.tutorial-pager__link {
  display: grid;
  gap: 0.15rem;
  text-decoration: none;
  color: var(--ink);
}

.tutorial-pager__link span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tutorial-pager__link strong {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--plum);
}

.tutorial-pager__link--next {
  text-align: right;
}

.tutorial-pager__all {
  font-weight: 600;
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .tutorial-pager {
    grid-template-columns: 1fr 1fr;
  }

  .tutorial-pager__all {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
}

