/* Claude library: guide, courses, and YouTube cards. */

.lib {
  position: relative;
  z-index: 5;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-block: clamp(56px,9vh,88px);
  padding-inline: var(--gutter);
  scroll-margin-top: 84px;
}

.lib .inner {
  max-width: 1180px;
  margin: 0 auto;
}

.lib h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px,5vw,64px);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin: 0;
}

.lib-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 40px;
  flex-wrap: wrap;
}

.lib-head p {
  color: var(--fg-muted);
  margin: 0;
  max-width: 30em;
}

/* The shelf is a horizontal scroller: cards snap into place, the next card
   peeks in from the right, and arrows / drag / trackpad / keys all move it.
   js/features/library.js adds the arrows' state, dragging, and the edge fades. */
.shelf-wrap {
  position: relative;
  margin-top: 32px;
}

.shelf {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  /* room for the hover lift and focus ring, which overflow would clip */
  padding: 6px 2px 10px;
  margin: -6px -2px -10px;
  --fade-l: 0px;
  --fade-r: 0px;
  mask-image: linear-gradient(90deg,transparent 0,#000 var(--fade-l),#000 calc(100% - var(--fade-r)),transparent 100%);
  transition: --fade-l .3s ease,--fade-r .3s ease;
}

.shelf::-webkit-scrollbar {
  display: none;
}

.shelf.can-left {
  --fade-l: 48px;
}

.shelf.can-right {
  --fade-r: 72px;
}

.shelf:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 22px;
}

.shelf.dragging {
  scroll-snap-type: none;
  scroll-behavior: auto;
  cursor: grabbing;
  user-select: none;
}

.shelf.dragging .res {
  pointer-events: none;
}

.shelf>.res {
  flex: 0 0 min(440px,84%);
  scroll-snap-align: start;
}

@property --fade-l {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

@property --fade-r {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

.shelf-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.shelf-track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.shelf-track i {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 2px;
  background: var(--fg);
  transform-origin: left;
}

.shelf-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease,color .2s ease,border-color .2s ease,opacity .2s ease;
}

.shelf-btn svg {
  width: 18px;
  height: 18px;
}

.shelf-btn:hover:not(:disabled) {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.lib.shelf-fits .shelf-nav {
  display: none;
}

.shelf-btn:disabled {
  opacity: .35;
  cursor: default;
}

.res {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s ease,transform .25s ease;
}

.res:hover {
  border-color: color-mix(in srgb,var(--fg) 20%,var(--line));
  transform: translateY(-3px);
}

.res-visual {
  position: relative;
  display: grid;
  place-items: center;
  height: 230px;
  text-decoration: none;
  overflow: hidden;
}

.book {
  background: radial-gradient(ellipse at 50% 120%,rgba(217,119,87,.22),transparent 60%),#EAE4D7;
  perspective: 900px;
}

.book img {
  position: relative;
  height: 168px;
  width: auto;
  max-width: 78%;
  object-fit: cover;
  border-radius: 3px 8px 8px 3px;
  box-shadow: -6px 0 0 #B85C3D inset,0 18px 28px rgba(20,20,19,.25);
  transform: rotateY(-14deg) rotateX(4deg) rotate(-2deg);
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}

.book .pages {
  position: absolute;
  height: 168px;
  aspect-ratio: 951/735;
  max-width: 78%;
  border-radius: 3px 8px 8px 3px;
  background: repeating-linear-gradient(180deg,#FFFDF7 0 2px,#E8E1D2 2px 3px);
  transform: translate(10px,8px) rotateY(-14deg) rotateX(4deg) rotate(-2deg);
  box-shadow: 0 10px 18px rgba(20,20,19,.15);
}

.res:hover .book img {
  transform: rotateY(-4deg) rotateX(2deg) rotate(0deg) translateY(-4px);
}

.academy {
  background: #141413;
  justify-content: start;
  align-content: center;
  grid-template-columns: auto minmax(0,1fr);
  gap: 18px;
  padding: 0 26px;
}

.academy .grad {
  width: 92px;
  height: auto;
  image-rendering: pixelated;
  cursor: pointer;
}

.ac-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ac-list span {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  background: #262523;
  color: #F3F1EA;
  font: 500 13.5px/1.2 var(--ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #33312E;
  transition: transform .25s ease;
}

.ac-list span:nth-child(1) {
  border-color: #D97757;
}

.res:hover .ac-list span:nth-child(2) {
  transform: translateX(6px);
}

.res:hover .ac-list span:nth-child(3) {
  transform: translateX(12px);
}

.res:hover .ac-list span:nth-child(4) {
  transform: translateX(18px);
}

.res-body {
  padding: 24px 26px 26px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.res-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--fg-muted);
  font-size: 13px;
}

.res-meta .rtag {
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 6px;
  background: color-mix(in srgb,var(--accent) 14%,transparent);
  color: var(--accent-ink);
}

.res h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px,2.4vw,30px);
  line-height: 1.12;
  letter-spacing: -.01em;
  margin: 12px 0 0;
}

.res-body>p {
  color: var(--fg-muted);
  margin: 10px 0 0;
  line-height: 1.6;
}

.res .start {
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-top: 16px;
}

/* "Start here" course path on the courses card. */
.path {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.path a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb,var(--fg) 3%,var(--bg-raised));
  color: var(--fg);
  text-decoration: none;
  transition: border-color .2s ease,background .2s ease;
}

.path a:hover {
  border-color: var(--accent);
  background: color-mix(in srgb,var(--accent) 7%,var(--bg-raised));
}

.path .step {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fg);
  color: var(--bg);
  font: 500 12px/1 var(--mono);
}

.path .pt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.path b {
  font: 500 15px/1.2 var(--ui);
}

.path .pt span {
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.4;
}

.path svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--fg-muted);
  transition: transform .2s ease,color .2s ease;
}

.path a:hover svg {
  color: var(--accent);
  transform: translate(2px,-2px);
}

.toc {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toc li {
  font: 500 12.5px/1 var(--ui);
  padding: 7px 10px;
  border-radius: 8px;
  background: color-mix(in srgb,var(--fg) 6%,var(--bg-raised));
}

.res-ctas {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 22px;
}

.res-note {
  color: var(--fg-muted);
  font-size: 13px;
}

.res-wide .res-visual {
  height: auto;
  min-height: 230px;
}

.theater {
  background: radial-gradient(ellipse at 50% 0%,rgba(217,119,87,.25),transparent 65%),#141413;
  padding: 26px 26px 14px;
  align-content: start;
}

.screen {
  position: relative;
  display: block;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg,#D97757 0%,#B85C3D 55%,#7A3A26 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08),0 18px 40px rgba(217,119,87,.25);
}

.screen .now {
  position: absolute;
  top: 12px;
  left: 14px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.8);
}

.screen .vtitle {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 24px;
  font: 400 clamp(17px,1.8vw,22px)/1.15 var(--display);
  color: #FFF;
  text-wrap: balance;
}

.screen .play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -34px 0 0 -27px;
  border-radius: 50%;
  background: rgba(20,20,19,.82);
  color: #FFF;
  display: grid;
  place-items: center;
  transition: transform .25s ease;
}

.screen .play svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
}

.res-video:hover .screen .play {
  transform: scale(1.12);
}

.screen .bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.3);
}

.screen .bar i {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 2px;
  background: #FFF;
  transition: width 1.2s ease;
}

.res-video:hover .screen .bar i {
  width: 72%;
}

.viewer {
  position: relative;
  display: block;
  width: 80px;
  height: auto;
  image-rendering: pixelated;
  margin: -10px 0 0 22px;
  cursor: pointer;
  z-index: 1;
}

@media (max-width:720px) {
  .lib {
    padding-block: 44px;
  }

  .res-visual {
    height: 190px;
  }

  .book img,
  .book .pages {
    height: 140px;
  }

  .academy {
    padding: 0 18px;
    gap: 12px;
  }

  .academy .grad {
    width: 68px;
  }

  .ac-list span {
    font-size: 12.5px;
    padding: 8px 10px;
  }

  .res-body {
    padding: 20px;
  }

  .path a {
    padding: 10px 12px;
    gap: 10px;
  }

  .path .pt span {
    font-size: 12.5px;
  }

  .theater {
    padding: 18px 18px 12px;
  }

  .viewer {
    width: 64px;
  }
}

@media (max-width:720px) {
  .shelf {
    gap: 14px;
  }

  .shelf.can-right {
    --fade-r: 36px;
  }

  .shelf.can-left {
    --fade-l: 24px;
  }

  .res-wide .res-visual {
    min-height: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shelf {
    scroll-behavior: auto;
    transition: none;
  }

  .res,
  .book img,
  .ac-list span,
  .path a,
  .path svg {
    transition: none;
  }

  .screen .play,
  .screen .bar i {
    transition: none;
  }
}
