/* Project list: mobile-first accordion ------------ */
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.project { scroll-margin-top: .75rem; }

.proj-btn {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  color: var(--btn-ink); background: var(--btn);
  border: 0; border-radius: 10px;
  padding: .85rem 2.75rem .85rem 1rem; position: relative;
  box-shadow: 0 0 4px rgba(0, 0, 0, .15);
  transition: background-color .15s;
}
.proj-btn:hover { background: #3d3d44; }
.proj-btn strong { display: block; font-size: .9rem; line-height: 1.3; }
.proj-btn span { display: block; margin-top: .2rem; font-size: .8rem; line-height: 1.4; color: var(--btn-sub); }
.proj-btn::after {
  content: ""; position: absolute; right: 1.1rem; top: 1.25rem;
  width: .6rem; height: .6rem; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .2s; opacity: .7;
}
.proj-btn[aria-expanded="true"] { background: var(--btn-active); box-shadow: inset 4px 0 0 var(--accent); }
.proj-btn[aria-expanded="true"]::after { transform: rotate(-135deg); top: 1.5rem; }

.panel {
  display: flex; flex-direction: column;
  margin-top: .5rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: clamp(14px, 3vw, 22px);
}
.js .project .panel { display: none; }
.js .project.is-active .panel { display: flex; }
.no-js .project + .project { margin-top: .75rem; }

/* Detail panel contents ------------------------- */
.top, .summary { display: contents; }
.p-head { order: -2; }
.shot { order: -1; }
.panel h2 { margin: 0; line-height: 1.2; }
.yr { margin: .1rem 0 1rem; font-size: 1rem; color: var(--muted); font-weight: 700; }
.p-head:not(:has(.yr)) h2 { margin-bottom: 1rem; }

.shot { margin: 0 auto 1rem; }
.shot img {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--card);
  box-shadow: 0 0 5px rgba(0, 0, 0, .18);
}

.meta { margin: 0; display: grid; gap: 1rem; }
.meta dt { font-size: .8rem; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.meta dd { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.chips li { padding: .15rem .7rem; border-radius: 1rem; background: var(--chip); font-size: .85rem; line-height: 1.5; }

.gallery {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .85rem;
}
.gallery a { display: block; color: inherit; text-align: center; font-size: .8rem; font-weight: 700; }
.gallery a:hover { text-decoration: none; }
.gallery a:hover .thumb { border-color: var(--accent); transform: translateY(-2px); }
.thumb {
  display: block; aspect-ratio: 4 / 3; overflow: hidden; position: relative;
  background: var(--chip); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 0 5px rgba(0, 0, 0, .15);
  transition: transform .15s, border-color .15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.play { background: #26262a; }
.thumb.play::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%);
  border-style: solid; border-width: 14px 0 14px 24px; border-color: transparent transparent transparent #fff;
}
.cap { display: block; margin-top: .35rem; }

.links, .detail { margin-top: 1.5rem; }
.detail p { margin: 0 0 .85rem; }
.detail p:last-child { margin-bottom: 0; }
.links h3, .detail h3 { margin: 0 0 .25rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.links ul { margin: 0; padding-left: 1.1rem; }

/* Desktop: master/detail layout ------------------ */
@media (min-width: 1000px) {
  .js .projects {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    grid-template-rows: repeat(10, auto) 1fr;
    gap: 0 0;
    align-items: start;
  }
  .js .project { display: contents; }

  .js .proj-btn {
    grid-column: 1; border-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, .15);
    box-shadow: none; padding: .85rem 1rem; min-height: 5.5rem;
  }
  .js .proj-btn::after { display: none; }
  .js .project:first-child .proj-btn { border-top-left-radius: 12px; border-top-color: transparent; }
  .js .project:last-child .proj-btn { border-bottom-left-radius: 12px; }

  .js .proj-btn[aria-expanded="true"] { box-shadow: inset 4px 0 0 var(--accent); }

  .js .panel {
    grid-column: 2; grid-row: 1 / -1;
    margin: 0; align-self: stretch; min-height: 100%;
    border-radius: 0 12px 12px 12px; border-left: 0;
    padding: 1.5rem 1.75rem 1.75rem;
  }

  .js .project.is-active .panel { display: block; }

  .top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 290px); column-gap: 1.75rem; align-items: start; }
  .panel.no-shot .top { grid-template-columns: minmax(0, 1fr); }
  .summary { display: block; }
  .p-head, .shot { order: 0; }
  .shot { margin: 0; justify-self: end; }
}


/* Lightbox (replaces Fancybox) ------------------ */
#lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  padding: 0; border: 0; background: transparent; color: #fff;
}
#lightbox::backdrop { background: rgba(0, 0, 0, .85); }
.lb { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; padding: 3.5rem 3.5rem 2rem; }
.lb figure { margin: 0; text-align: center; max-width: 100%; }
.lb-stage img, .lb-stage video {
  display: block; margin: 0 auto; max-width: min(92vw, 1100px); max-height: 78vh;
  border-radius: 6px; background: #000; box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
}
.lb-cap { margin-top: .75rem; font-size: .95rem; }
.lb-btn {
  position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .14);
  width: 2.75rem; height: 2.75rem; border-radius: 50%; font-size: 1.8rem; line-height: 1;
  display: grid; place-items: center; padding: 0 0 .2rem;
}
.lb-btn:hover { background: rgba(255, 255, 255, .28); }
.lb-close { top: .9rem; right: .9rem; }
.lb-prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .75rem; top: 50%; transform: translateY(-50%); }
.lb-solo .lb-prev, .lb-solo .lb-next { display: none; }
@media (max-width: 1000px) { .lb { padding: 3.5rem .5rem 1.5rem; } .lb-prev, .lb-next { top: auto; bottom: .75rem; transform: none; } }

/* Avoid a flash of the open panel on phones before projects.js decides what to show. */
@media (max-width: 819px) {
  .js:not(.ready) .project .panel { display: none; }
}