/* Project detail pages */

/* Hero */
.case-hero { padding-top: clamp(40px, 7vw, 96px); }
.back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--grey); font-size: 15px; transition: color .2s var(--ease);
}
.back:hover { color: var(--ink); }
.case-title {
  margin-top: clamp(16px, 2.5vw, 28px);
  max-width: 17ch;
  font-size: var(--fs-display);
  line-height: 1;
  letter-spacing: -.015em;
  font-weight: 500;
  color: var(--grey);
}
.case-title strong { color: var(--ink); font-weight: 500; }
.case-sub {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px;
  margin-top: clamp(28px, 4vw, 56px);
}
.case-sub p { grid-column: 2; max-width: 44ch; font-size: var(--fs-h4); line-height: 1.45; color: var(--body); }
@media (max-width: 800px) { .case-sub { display: block; } }
@media (prefers-reduced-motion: no-preference) {
  .case-title, .note-heading, .case-sub, .note-sub, .notes-head p { animation: lift 1s var(--ease) backwards; }
  .case-sub, .note-sub, .notes-head p { animation-delay: .12s; }
  @keyframes lift { from { opacity: 0; transform: translateY(40px); } }
}

.stage {
  margin-top: clamp(36px, 5vw, 64px);
  padding: clamp(14px, 2.6vw, 40px);
  border-radius: var(--radius);
  background: var(--stage);
}
.stage > * { border-radius: var(--radius-sm); overflow: hidden; }
.stage video, .stage img { width: 100%; background: var(--card); }
.caption { margin-top: 14px; font-size: 14px; color: var(--grey); }
.stage .caption { padding-inline: 4px; }

/* Key facts: a three-column row between hairlines, like Augmented Design on the home hero */
.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px clamp(24px, 3vw, 48px);
  margin-top: clamp(40px, 5vw, 72px); padding-block: clamp(28px, 3vw, 40px) clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.facts dt { font-size: 15px; font-weight: 500; color: var(--grey); }
.facts dd { margin: 14px 0 0; font-size: var(--fs-h4); line-height: 1.45; letter-spacing: -.005em; color: var(--ink); }
.tags { list-style: none; margin: 0; padding: 0; }
.tags li { line-height: 1.6; }
@media (max-width: 900px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .facts { grid-template-columns: minmax(0, 1fr); } }

/* Section nav (sommaire), inside the sticky left column */

.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: flex; align-items: center; gap: 10px; min-height: 36px;
  color: var(--grey); font-size: 15px; transition: color .2s var(--ease);
}
.toc a::before {
  content: ""; width: 14px; height: 1px; background: currentColor;
  transform-origin: left; transform: scaleX(.4); transition: transform .3s var(--ease);
}
.toc a:hover, .toc a.is-active { color: var(--ink); }
.toc a.is-active::before { transform: scaleX(1); }
@media (max-width: 960px) { .toc { display: none; } }

.chapter + .chapter { margin-top: clamp(96px, 12vw, 168px); }
.label { font-size: 15px; font-weight: 500; color: var(--grey); }
.chapter > h2 {
  margin-top: 14px; max-width: 20ch;
  font-size: var(--fs-h2); line-height: 1.05; letter-spacing: -.01em; font-weight: 500;
}
.lede { margin-top: 24px; max-width: 60ch; font-size: var(--fs-body); line-height: 1.5; }
.chapter .stage { margin-top: 40px; }

/* Challenge and lesson cards: columns under hairlines, like the home Notes */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px clamp(24px, 3vw, 48px); margin-top: 40px; }
.card { padding-top: 24px; border-top: 1px solid var(--rule); }
.card h3 { font-size: var(--fs-section); line-height: 1.15; letter-spacing: -.008em; font-weight: 500; text-wrap: balance; }
.card p { margin-top: 14px; max-width: 44ch; text-wrap: pretty; }
@media (max-width: 700px) { .cards { grid-template-columns: minmax(0, 1fr); } }

/* Five surfaces diagram */
.surfaces { margin-top: 48px; overflow-x: auto; scrollbar-width: none; }
.surfaces svg { min-width: 880px; width: 100%; }
.surfaces .dev { color: var(--grey); transition: color .25s var(--ease); }
.surfaces a:hover .dev, .surfaces a:focus-visible .dev { color: var(--ink); }
.surfaces .shape { fill: none; stroke: currentColor; stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.surfaces .shape.faint { stroke-opacity: .45; }
.surfaces .floor { stroke: var(--rule); stroke-width: 1; }
.surfaces text { fill: currentColor; font-family: inherit; }
.surfaces .t1 { font-size: 15px; font-weight: 700; fill: var(--ink); }
.surfaces .t2 { font-size: 13px; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .surfaces .shape {
      stroke-dasharray: 1; stroke-dashoffset: 1;
      animation: draw linear both; animation-timeline: view(); animation-range: entry 10% cover 45%;
    }
    @keyframes draw { to { stroke-dashoffset: 0; } }
  }
}

/* Surface blocks */
/* Split head: label across, title left, text right, then the media full width */
.surface {
  margin-top: clamp(72px, 9vw, 120px); scroll-margin-top: 24px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.surface > * { grid-column: 1 / -1; }
.surface .label { display: flex; gap: 10px; }
.surface h3 {
  grid-column: 1; margin-top: 14px; max-width: 18ch;
  font-size: var(--fs-section); line-height: 1.2; letter-spacing: -.01em; font-weight: 500;
}
.surface > p:not(.label) { grid-column: 2; margin-top: 18px; max-width: 52ch; }
@media (max-width: 1100px) {
  .surface { display: block; }
  .surface h3 { margin-top: 10px; max-width: 24ch; }
  .surface > p:not(.label) { margin-top: 16px; max-width: 58ch; }
}
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); }
.pair > * { border-radius: var(--radius-sm); overflow: hidden; }
.stack { display: grid; gap: clamp(12px, 2vw, 24px); }
.stack > * { border-radius: var(--radius-sm); overflow: hidden; }
@media (max-width: 640px) { .pair.wide { grid-template-columns: minmax(0, 1fr); } }

/* Impact */
.outcomes { margin: 40px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.outcomes li {
  display: grid; grid-template-columns: minmax(0, 1fr); padding-block: 22px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-h4); line-height: 1.4; color: var(--ink); letter-spacing: -.01em;
}

/* Phone screens (mobile app projects) */
.phones {
  display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 300px));
  justify-content: center; gap: clamp(10px, 2.4vw, 32px);
}
.phones img {
  width: 100%; border-radius: clamp(14px, 2.2vw, 30px);
  background: var(--card);
  outline: 1px solid rgb(31 30 28 / .06); outline-offset: -1px;
}
.stage .phones { padding-block: clamp(8px, 2vw, 32px); }
.stage > .phones { border-radius: 0; overflow: visible; }
.phones.raise > :nth-child(2) { transform: translateY(-5%); }
.case-hero .phones.raise { padding-top: clamp(20px, 4vw, 56px); }
@media (max-width: 560px) {
  .phones[style*="--n:3"], .phones[style*="--n: 3"] { gap: 8px; }
}

/* Page layout (project and note pages). CSS only: a left column from the top of the page,
   the back link heading the sticky sommaire, so it follows the reader down the whole page. */
.case-layout {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(32px, 6vw, 96px);
  padding-bottom: clamp(80px, 10vw, 140px);
}
.case-side { padding-top: clamp(40px, 7vw, 96px); }
.side-sticky { position: sticky; top: 32px; display: grid; gap: 20px; }
.case-layout .case-hero, .case-layout .note-hero { padding-top: clamp(40px, 7vw, 96px); }
.case-layout .case-title, .case-layout .note-heading { margin-top: 0; }
.case-layout .chapters, .case-layout .prose { padding-top: clamp(72px, 10vw, 140px); }
/* Arrival: back link then the sections slide up in turn (strong ease-out, 40ms apart) */
@media (prefers-reduced-motion: no-preference) {
  .side-sticky > .back, .side-sticky .toc li { animation: side-in .5s cubic-bezier(.23, 1, .32, 1) backwards; }
  .side-sticky .toc li:nth-child(1) { animation-delay: .04s; }
  .side-sticky .toc li:nth-child(2) { animation-delay: .08s; }
  .side-sticky .toc li:nth-child(3) { animation-delay: .12s; }
  .side-sticky .toc li:nth-child(4) { animation-delay: .16s; }
  .side-sticky .toc li:nth-child(5) { animation-delay: .2s; }
  .side-sticky .toc li:nth-child(n+6) { animation-delay: .24s; }
  @keyframes side-in { from { opacity: 0; transform: translateY(12px); } }
}
@media (prefers-reduced-motion: reduce) {
  .side-sticky > .back, .side-sticky .toc li { animation: fade-in .3s ease backwards; }
}
/* The back arrow leans back on hover */
.back span { display: inline-block; transition: transform .2s cubic-bezier(.23, 1, .32, 1); }
@media (hover: hover) and (pointer: fine) { .back:hover span { transform: translateX(-3px); } }
/* Under 960px the sommaire is hidden: one column, the back link stays at the top, nothing fixed */
@media (max-width: 960px) {
  .case-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side-sticky { position: static; }
  .case-layout .case-hero, .case-layout .note-hero { padding-top: clamp(16px, 2.5vw, 28px); }
}
