/* ── Project case-study — sidebar TOC + main column ─────── */

.doc {
  display: grid;
  grid-template-columns: 190px minmax(0, 620px);
  gap: 56px;
  max-width: 866px;
  margin: 0 auto;
  padding: 88px 32px 40vh;
  align-items: start;
}
.doc-side { position: sticky; top: 88px; font-size: 14px; }
.doc-main { min-width: 0; }

.back {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.back:hover { color: var(--fg); }

.doc-toc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}
.doc-toc a {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}
.doc-toc a:hover { color: var(--fg); }
.doc-toc a.active { color: var(--fg); font-weight: 500; }

@media (max-width: 820px) {
  .doc { display: block; padding: 0 22px 80px; }
  /* Sticky horizontal ToC bar pinned to the top */
  .doc-side {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -22px 24px;
    padding: 13px 22px 11px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .doc-toc {
    flex-flow: row nowrap;
    gap: 18px;
    margin-top: 9px;
    padding-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .doc-toc::-webkit-scrollbar { display: none; }
  .doc-toc a { flex: none; }
}

.section-label {
  margin: 46px 0 12px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
}

/* Case-study body: roomier reading rhythm */
.doc-bio p:not(.section-label):not(.pullquote) {
  margin: 0 0 13px;
  line-height: 1.6;
}

/* Inline links inside case-study copy */
.doc-bio p a,
.doc-bio li a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
.doc-bio p a:hover,
.doc-bio li a:hover { text-decoration-color: var(--fg); }

/* Case-study media */
.media { margin: 22px 0; }
.media img,
.media video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
  border: 1px solid var(--line);
}
.media figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.media.narrow { max-width: 380px; margin-left: auto; margin-right: auto; }
.media.narrow figcaption { text-align: center; }

/* Browser-framed website preview that auto-scrolls a tall screenshot */
.site-frame {
  margin: 22px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.site-frame-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  background: #ededea;
  border-bottom: 1px solid var(--line);
}
.site-frame-bar span { width: 9px; height: 9px; border-radius: 50%; background: #cfcfca; }
.site-frame-view {
  --h: 440px;
  position: relative;
  height: var(--h);
  overflow: hidden;
}
.site-frame-scroll {
  display: block;
  width: 100%;
  animation: siteScroll 30s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
@keyframes siteScroll {
  0%, 5% { transform: translateY(0); }
  95%, 100% { transform: translateY(calc(-100% + var(--h))); }
}
@media (max-width: 820px) {
  .site-frame-view { --h: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-frame-view { overflow: auto; -webkit-overflow-scrolling: touch; }
  .site-frame-scroll { animation: none; }
}

/* Row of phone frames that auto-scroll tall mobile screens */
.phones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 22px 0;
}
.phone {
  flex: 1 1 150px;
  max-width: 190px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.phone .pv {
  --h: clamp(300px, 46vh, 440px);
  position: relative;
  height: var(--h);
  overflow: hidden;
}
.phone .pv img {
  display: block;
  width: 100%;
  animation: siteScroll 34s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
.phone:nth-child(2) .pv img { animation-delay: -11s; }
.phone:nth-child(3) .pv img { animation-delay: -22s; }
@media (prefers-reduced-motion: reduce) {
  .phone .pv { overflow: auto; -webkit-overflow-scrolling: touch; }
  .phone .pv img { animation: none; }
}

.bio ul.plain {
  margin: 12px 0;
  padding: 0 0 0 18px;
  line-height: 1.65;
  color: var(--fg);
}
.bio ul.plain li { margin: 4px 0; }

/* Caption under a preview frame (site-frame / phones) that has no <figcaption> */
.cap { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ── Scaffold placeholders — visible reminders of content still to add ─── */
.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--muted);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}
.ph-media { aspect-ratio: 16 / 10; }
.todo {
  color: #7a5b00;
  background: rgba(240, 190, 20, 0.15);
  border-radius: 6px;
  padding: 7px 11px;
}
.doc-bio p.todo { margin: 0 0 13px; }
.role .todo { padding: 1px 6px; }
