/* Thoughts landing: four identical folds (Writing, Scores, Things I've done, Degrees) */

.page-section > .thought-section:first-of-type {
  margin-top: 0.15rem;
}

.thought-section .thought-list {
  margin-top: 0.25rem;
}

.thought-section .thought-item:last-child {
  border-bottom: 1px solid var(--line);
}

.thought-degrees {
  margin: 3.25rem 0 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.thought-degrees a {
  color: inherit;
  text-decoration: none;
}

.thought-degrees a:hover,
.thought-degrees a:focus-visible {
  color: var(--gold);
}

/* Folded Scores grid */
.score-fold {
  margin: 0;
}

.score-fold > summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
}

.score-fold > summary::-webkit-details-marker,
.score-fold > summary::marker {
  display: none;
  content: "";
}

/* Four main groups: Instrument Serif titles, white, equal, clickable, underlined.
   1.1rem (~17.6px) on phone and desktop (Khalil, 12:34 AM PT, Nov 22 2026). */
.score-fold > summary.group-title {
  margin: 0;
  padding: 0.12rem 0 0.18rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: none;
  color: #ffffff;
  text-wrap: balance;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: currentColor;
}

.score-fold > summary.group-title::after {
  content: "";
  display: inline-block;
  margin-left: 0.45em;
  width: 0.42em;
  height: 0.42em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.22em) rotate(45deg);
  opacity: 0.7;
  vertical-align: middle;
}

.score-fold[open] > summary.group-title::after {
  transform: translateY(0.02em) rotate(225deg);
}

.score-fold > summary:hover,
.score-fold > summary:focus-visible {
  color: #ffffff;
  opacity: 0.88;
}

.score-grid {
  list-style: none;
  margin: 1.35rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem 0.75rem;
}

@media (min-width: 420px) {
  .score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .score-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.score-grid a {
  display: block;
  text-decoration: none;
  color: inherit;
}

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

.score-grid-title {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--ink);
}

.score-grid a:hover .score-grid-title,
.score-grid a:focus-visible .score-grid-title {
  color: var(--gold);
}

@media (max-width: 700px) {
  .thought-section {
    margin-top: 3.25rem;
  }

  .thought-degrees {
    margin-top: 2.75rem;
  }

  .score-grid-title {
    font-size: 0.74rem;
  }
}

/* Writing uses the same fold as Scores */
.score-fold .thought-list {
  margin-top: 0.85rem;
}

/* Never clip the score grid; all 38 thumbs must be able to show */
.score-fold[open] .score-grid,
.score-fold[open] .thought-list {
  height: auto;
  max-height: none;
  overflow: visible;
}

.score-grid-title {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 28%, transparent);
  text-underline-offset: 0.16em;
  cursor: pointer;
}

/* Score lightbox (Thoughts grid) */
.score-viewer.lightbox {
  z-index: 90;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  padding: 0;
  background: rgba(8, 6, 5, 0.96);
}

.score-viewer-frame {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.25rem 0.85rem 0;
}

.score-viewer-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: baseline;
  padding: 0 3.25rem 0.7rem 0.2rem;
}

.score-viewer-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.score-viewer-page-link {
  margin: 0;
  font-size: 0.9rem;
}

.score-viewer-page-link a {
  color: var(--gold);
  text-underline-offset: 0.16em;
}

.score-viewer-page-link a:hover,
.score-viewer-page-link a:focus-visible {
  color: var(--gold-soft);
}

.score-viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 3.4rem 0.5rem;
}

.score-viewer-stage img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: calc(100vh - 11.5rem);
  object-fit: contain;
  background: #fff;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
}

.score-viewer .lightbox-prev,
.score-viewer .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.score-viewer .lightbox-close {
  z-index: 3;
}

.score-viewer-count {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.25rem 0.2rem 0.45rem;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.score-viewer-audio {
  flex: 0 0 auto;
  padding: 0.55rem 0.85rem 0.85rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, #000);
}

.score-viewer-audio[hidden] {
  display: none;
}

.score-viewer-audio audio {
  display: block;
  width: 100%;
  height: 2.4rem;
}

@media (max-width: 700px) {
  .score-viewer-frame {
    padding-top: 3rem;
  }
  .score-viewer-head {
    padding-right: 2.8rem;
  }
  .score-viewer-stage {
    padding-left: 2.6rem;
    padding-right: 2.6rem;
  }
  .score-viewer-stage img {
    max-height: calc(100vh - 13.25rem);
  }
  .score-viewer-audio {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Shared body offset for all four top-level folds */
.score-fold > .fold-panel,
.score-fold > .thought-list,
.score-fold > .score-grid,
.score-fold > .article-body,
.score-fold > .degrees-fold-body {
  margin-top: 0.85rem;
}

.degrees-fold-body .degree-block:first-child {
  padding-top: 0.15rem;
}

/* Equal stack for the four closed section titles */
.page-section > .thought-section {
  margin-top: 1.35rem;
}

.page-section > .thought-section:first-of-type {
  margin-top: 0.1rem;
}

@media (max-width: 700px) {
  .page-section > .thought-section {
    margin-top: 1.15rem;
  }
}
