/* ============================================================
   CASE FILE — clean template ("cf")

   A quieter take on the case-file page. Loaded after style.css and
   scoped to .cf, so it only affects pages that opt in; every other
   case file keeps the shared template in style.css.

   What stays from the original: the sticky sidebar (diamond marker,
   slide-and-scale motion, scroll-spy in script.js), the section
   reveal, the site header/footer, the paper color and the
   home page's palette and typefaces. What changes: no tilt, offset
   shadows or hand-drawn corners; hairlines, small mono labels and a
   lot more air.

   "Explore more work" keeps the shared playful version by default.
   Add class "is-clean" to .next-projects for the flat variant below.
   ============================================================ */

/* ---------- Tokens ---------- */
html {
  --cf-paper: #f7f5f0;
  --cf-ink: #1e252b;
  --cf-text: #2f3a43;
  --cf-mute: #5f6e7e;
  --cf-accent: #4d6686;          /* the home eyebrow blue, dark enough for text */
  --cf-accent-soft: #eef3f6;
  --cf-mint: #d6e8e3;
  --cf-blue: #899FBB;
  --cf-line: rgba(47, 52, 55, 0.16);
  --cf-card: #ffffff;
  --cf-radius: 6px;
  --cf-heading: "Rethink Sans", system-ui, sans-serif;
  --cf-mono: "Courier New", Courier, monospace;
}

.cf {
  --proj-accent: var(--cf-accent);
  --proj-accent-2: var(--cf-mint);
  --proj-accent-soft: var(--cf-accent-soft);
  --proj-ink: var(--cf-ink);
}

/* Flat paper, no grid — keeps long reading text clean. */
body:has(.cf) {
  background-color: var(--cf-paper);
  background-image: none;
}

/* ---------- Layout ---------- */
.cf {
  padding-top: 96px;
  /* the hero sticker hangs past the cover's edge (and starts oversized while it
     sticks on); clip, not hidden, so the sidebar stays sticky and phones don't
     widen the page to fit it */
  overflow-x: clip;
}

.cf .project-layout {
  grid-template-columns: 188px minmax(0, 1fr);
  gap: clamp(36px, 5vw, 72px);
  width: min(92vw, 1240px);
  margin-top: 24px;
}

.cf .project-main {
  min-width: 0;
}

/* ---------- Sidebar (same marker + motion, quieter type) ---------- */
.cf .project-sidebar {
  top: 120px;
}

.cf-back {
  display: inline-block;
  margin: 0 0 26px 20px;
  font-family: var(--cf-mono);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cf-mute);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.cf-back:hover,
.cf-back:focus-visible {
  color: var(--cf-accent);
  transform: translateX(-3px);
}

.cf .project-sidebar-label {
  color: var(--cf-ink);
}

.cf .project-nav-tab {
  font-family: var(--cf-heading);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.cf .project-nav-tab::before {
  background: var(--cf-accent);
}

.cf .project-nav-tab.active {
  color: var(--cf-accent);
}

/* ---------- Hero ---------- */
.cf-hero {
  scroll-margin-top: 120px;
  padding: 28px 0 0;
  animation: hero-rise 0.8s ease both;
}

/* Floating decorations for the two game case files (Orbit Errands, Chef's
   Plaza): a pair of the game's own sprites bobbing in the empty
   right-hand side of the hero. Hidden below 900px where the text needs the
   room. Each item sets its own width with --w; use two. */
.cf-hero {
  position: relative;
}

.cf-decos {
  position: absolute;
  top: 0;
  right: 0;
  width: 28%;
  height: 100%;
  pointer-events: none;
}

.cf-deco {
  position: absolute;
  width: calc(var(--w, 44) * 1px);
  height: auto;
  filter: drop-shadow(3px 4px 6px rgba(0, 0, 0, 0.14));
  animation: cf-bob 6s ease-in-out infinite;
}

.cf-deco:nth-child(1) { top: 2%;     right: 7%;  animation-delay: 0s; }
.cf-deco:nth-child(2) { bottom: 12%; right: 22%; animation-delay: 1.6s; animation-duration: 5.4s; }

@keyframes cf-bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(4deg); }
}

@media (max-width: 900px) {
  .cf-decos {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-deco {
    animation: none;
  }
}

.cf-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  font-family: var(--cf-mono);
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cf-accent);
}

.cf-diamond {
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--cf-accent);
  transform: rotate(45deg);
}

.cf-title {
  margin: 0;
  font-family: "Rethink Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  color: var(--cf-ink);
}

.cf-title span {
  font-weight: 300;
  color: var(--cf-accent);
}

.cf-lede {
  max-width: 50em;
  margin: 12px 0 0;
  font-family: "Rethink Sans", sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.6;
  color: var(--cf-mute);
}

/* the one-line description leads; the rest reads as supporting detail */
.cf-lede span {
  font-weight: 500;
  color: var(--cf-ink);
}

.cf-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 28px;
}

.cf .cf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 10px 20px;
  font-family: "Rethink Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cf-ink);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--cf-ink);
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cf .cf-btn span {
  display: inline-block;
  transition: transform 0.2s ease;
}

.cf .cf-btn:hover,
.cf .cf-btn:focus-visible {
  color: var(--cf-paper);
  background: var(--cf-ink);
}

.cf .cf-btn:hover span,
.cf .cf-btn:focus-visible span {
  transform: translate(2px, -2px);
}

.cf-links-note {
  max-width: 30em;
  font-family: "Rethink Sans", sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--cf-mute);
}

.cf-links-note strong {
  font-weight: 600;
  color: var(--cf-text);
}

/* ---------- Cover image ---------- */
/* Pages with a hero sticker wrap the cover in .cf-cover-wrap: the sticker is
   positioned against the wrap (the cover itself clips its overflow). */
.cf-cover-wrap {
  position: relative;
  margin-top: 14px;
}

.cf-cover-wrap .cf-cover {
  margin-top: 0;
}

.cf-cover {
  margin: 14px 0 0;
  overflow: hidden;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
  animation: hero-rise 0.9s ease 0.1s both;
}

/* a video as the cover fills the frame like an image does (the browser
   otherwise leaves it at its own pixel width, with blank space beside it) */
.cf-cover video {
  display: block;
  width: 100%;
  height: auto;
}

.cf-cover a {
  display: block;
  position: relative;
}

.cf-cover img {
  display: block;
  width: 100%;
  height: auto;
  /* set --ratio / --pos on the figure to crop a tall or square hero to a banner */
  aspect-ratio: var(--ratio, auto);
  object-fit: cover;
  object-position: var(--pos, center);
}

/* ---------- TL;DR ---------- */
.cf-tldr {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--cf-ink);
  animation: hero-rise 0.9s ease 0.2s both;
}

.cf-tldr dl,
.cf-tldr dd,
.cf-tldr dt {
  margin: 0;
}

.cf-facts {
  display: grid;
  grid-template-columns: 0.95fr 1fr 1fr 1.25fr 1.4fr;
  gap: 20px 28px;
  padding-bottom: 22px;
}

/* four facts instead of five */
.cf-facts:has(> div:nth-child(4):last-child) {
  grid-template-columns: 0.9fr 1fr 1fr 1.3fr;
}

.cf-facts dt {
  margin-bottom: 6px;
  font-family: var(--cf-mono);
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cf-accent);
}

.cf-facts dd {
  font-family: "Rethink Sans", sans-serif;
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--cf-ink);
}

.cf-facts dd span {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--cf-mute);
}

/* ---------- Sections ---------- */
.cf .project-section {
  padding: 34px 0 6px;
  border-bottom: none;
}

.cf .project-section:last-child {
  padding-bottom: 28px;
}

.cf .project-section:first-of-type {
  margin-top: 20px;
}

.cf .section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  font-family: var(--cf-mono);
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cf-accent);
  background: none;
  border: none;
  border-radius: 0;
}

.cf .project-section h2 {
  max-width: 22em;
  margin: 0 0 22px;
  font-family: var(--cf-heading);
  font-weight: 600;
  font-size: clamp(1.7rem, 2.7vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--cf-ink);
}

.cf .project-section p {
  max-width: 68ch;
  margin: 0 0 1.1em;
  font-family: "Rethink Sans", sans-serif;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--cf-text);
}

.cf .project-section p strong {
  font-weight: 600;
  color: var(--cf-ink);
}

.cf .project-section p.scroll-hint {
  max-width: none;
  margin: 28px 0 0;
  font-family: var(--cf-mono);
  font-size: 0.7rem;
  line-height: 1;
  color: var(--cf-mute);
  opacity: 1;
}

.cf .project-main a:not(.cf-btn) {
  color: var(--cf-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.cf .project-main a:not(.cf-btn):hover,
.cf .project-main a:not(.cf-btn):focus-visible {
  color: var(--cf-ink);
  background: var(--cf-mint);
}

/* Lists and pull quote inside a section */
.cf .project-section ul,
.cf .project-section ol {
  max-width: 68ch;
  margin: 0 0 1.1em;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--cf-text);
}

.cf .project-section li {
  margin-bottom: 4px;
}

.cf .project-pullquote {
  max-width: 34em;
  margin: 26px 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--cf-accent);
  font-family: var(--cf-heading);
  font-weight: 500;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--cf-ink);
}

/* Stat chips (a few headline numbers or values pulled out of a paragraph) */
.cf .stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 24px 0 28px;
}

.cf .stat-chip {
  flex: 1 1 170px;
  padding: 18px 20px;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
}

.cf .stat-chip .stat-number {
  display: block;
  font-family: var(--cf-heading);
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--cf-ink);
}

.cf .stat-chip .stat-label {
  display: block;
  margin-top: 8px;
  font-family: var(--cf-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--cf-mute);
}

/* A single standout line inside a section */
.cf .project-section .quote-line {
  max-width: 34em;
  margin: 26px 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--cf-accent);
  font-family: var(--cf-heading);
  font-weight: 500;
  font-size: clamp(1.2rem, 1.9vw, 1.5rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--cf-ink);
}

/* A short personal aside */
.cf .project-section .hand-note {
  max-width: 34em;
  margin: 8px 0 30px;
  padding: 14px 18px;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-left: 2px solid var(--cf-accent);
  border-radius: var(--cf-radius);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--cf-text);
}

/* Floating soundtrack toggle (script.js wires up #music-toggle) */
.music-toggle {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px 10px 15px;
  background: var(--cf-card);
  color: var(--cf-ink);
  border: 1px solid var(--cf-ink);
  border-radius: 999px;
  font-family: "Rethink Sans", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  cursor: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.music-toggle:hover,
.music-toggle.playing {
  background: var(--cf-ink);
  color: var(--cf-paper);
}

.music-toggle .music-icon {
  display: inline-block;
  font-size: 1.1rem;
}

.music-toggle.playing .music-icon {
  animation: music-spin 2.2s linear infinite;
}

@keyframes music-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.music-toggle .music-label::after {
  content: "Play soundtrack";
}

.music-toggle.playing .music-label::after {
  content: "Pause soundtrack";
}

/* Game case files (Orbit Errands, Chef's Plaza): small icon rows, four-up
   rule cards, and the loose sprite "ecosystem" (no box, just the sprites
   scattered at close to their in-game size; they're canvas art, so
   upscaling only blurs them). Per-page sprite sizes live in each page's CSS. */
.cf .icon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  margin: 24px 0 8px;
}

.cf .icon-chip {
  width: 96px;
  text-align: center;
}

.cf .icon-chip .icon-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 84px;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
}

.cf .icon-chip .icon-block img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.cf .icon-chip.bar-chip {
  width: 128px;
}

.cf .icon-chip.bar-chip .icon-block img {
  width: 88px;
  height: 28px;
}

.cf .icon-chip .icon-label {
  display: block;
  margin-top: 10px;
  font-family: var(--cf-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--cf-mute);
}

.cf .hazard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0 28px;
}

.cf .hazard-card {
  padding: 16px 16px 18px;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
}

.cf .project-section .hazard-card h3 {
  margin: 0 0 8px;
  padding-bottom: 8px;
  font-family: var(--cf-heading);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cf-ink);
  border-bottom: 1px solid var(--cf-line);
}

.cf .project-section .hazard-card p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.cf .ecosystem-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 22px 30px;
  margin: 26px 0 10px;
  padding: 10px 4px 4px;
}

.cf .ecosystem-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cf .ecosystem-item:nth-child(3n+1) { transform: rotate(-5deg); }
.cf .ecosystem-item:nth-child(3n+2) { transform: rotate(3deg); }
.cf .ecosystem-item:nth-child(3n) { transform: rotate(-2deg); }

.cf .ecosystem-item img {
  display: block;
  object-fit: contain;
  filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.18));
  transition: transform 0.2s ease;
}

.cf .ecosystem-item:hover img {
  transform: scale(1.14) rotate(-4deg);
}

.cf .ecosystem-item .eco-label {
  font-family: var(--cf-mono);
  font-size: 0.66rem;
  font-weight: bold;
  letter-spacing: 0.02em;
  color: var(--cf-mute);
}

.cf .eco-sm img { width: 48px; height: 48px; }
.cf .eco-md img { width: 64px; height: 64px; }
.cf .eco-lg img { width: 104px; height: 104px; }

@media (max-width: 720px) {
  .cf .hazard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cf .ecosystem-row {
    gap: 18px 22px;
  }
}

/* ---------- Figures ---------- */
.cf .project-figure {
  margin: 28px 0 0;
}

.cf .project-figure img {
  background: #ffffff;
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
}

.cf .project-figure figcaption,
.cf .photo-scroll-item figcaption {
  max-width: none;
  margin: 12px 0 0;
  font-family: var(--cf-mono);
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--cf-mute);
  opacity: 1;
}

.cf .figure-pair {
  gap: 20px;
  margin: 28px 0 0;
}

.cf .figure-pair .project-figure {
  margin: 0;
}

/* Media followed by more text needs air below it too. */
.cf .project-section :is(.project-figure, .figure-pair, .photo-scroll, .project-hero-media):has(+ :is(p, ul, ol, .text-with-figure)) {
  margin-bottom: 26px;
}

/* A figure sitting beside a block of text (a phone recording, a portrait photo) */
.cf .text-with-figure {
  grid-template-columns: minmax(0, 1fr) minmax(200px, 290px);
  gap: clamp(24px, 4vw, 44px);
  margin: 6px 0 1.4em;
}

.cf .text-with-figure .project-figure {
  margin: 8px 0 0;
}

.cf .project-figure video {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
}

/* Looping video in the body (e.g. an animated banner): same flat frame as an image. */
.cf .project-hero-media {
  width: 100%;
  margin: 28px 0 0;
  overflow: hidden;
  background: var(--cf-card);
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
  box-shadow: none;
}

/* Horizontal scroller: same native scroll, flat and untilted.
   Every image carries its real shape as --r (width / height) plus
   width/height attributes, so a box is sized from the row height --h and
   its own ratio: nothing is ever squeezed, the box is right before the image
   loads, and the caption (width tied to the image) lines up with it. On
   narrow screens a wide image is capped at 86vw and its height follows. */
.cf .photo-scroll {
  --h: 320px;
  --fl: 0px;
  --fr: 0px;
  align-items: flex-start;
  gap: 20px;
  margin: 14px 0 0;
  padding: 0 0 14px;
  scrollbar-color: var(--cf-line) transparent;
}

.cf .photo-scroll::-webkit-scrollbar-thumb {
  background: var(--cf-line);
}

/* fade the edge that still has more to scroll to (set by script.js) */
.cf .photo-scroll.is-scrollable {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
}

.cf .photo-scroll.has-more-left {
  --fl: 36px;
}

.cf .photo-scroll.has-more-right {
  --fr: 56px;
}

.cf .photo-scroll:focus-visible {
  outline: 2px solid var(--cf-accent);
  outline-offset: 4px;
}

.cf .scroll-hint[hidden] {
  display: none;
}

.cf .photo-scroll-item {
  flex: none;
}

.cf .photo-scroll-item:nth-child(n) img {
  display: block;
  width: min(calc(var(--h) * var(--r, 1.5)), 86vw);
  height: auto;
  max-width: none;
  aspect-ratio: var(--r, 1.5);
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
  box-shadow: none;
  transform: none;
}

/* the caption is exactly as wide as its image: width:0 + min-width:100% stops
   a long caption from widening the figure past the picture */
.cf .photo-scroll-item figcaption {
  width: 0;
  min-width: 100%;
  max-width: none;
  margin-top: 12px;
}

/* Palette */
.cf .palette-row {
  gap: 16px;
  margin: 30px 0 0;
}

.cf .palette-swatch {
  width: 112px;
  text-align: left;
}

.cf .palette-swatch .swatch-block {
  height: 72px;
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
  box-shadow: none;
}

.cf .palette-swatch .swatch-label {
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: normal;
  line-height: 1.4;
  color: var(--cf-mute);
}

/* ---------- Explore more work — flat variant (opt in with .is-clean) ---------- */
.cf .next-projects.is-clean {
  width: min(92vw, 1240px);
  padding: 20px 0 8px;
  text-align: left;
  border-top: 1px solid var(--cf-ink);
}

.cf .next-projects.is-clean .next-projects-title {
  margin: 14px 0 28px;
  font-family: var(--cf-mono);
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cf-accent);
}

.cf .next-projects.is-clean .next-projects-grid {
  justify-content: flex-start;
  align-items: stretch;
  gap: clamp(20px, 3vw, 40px);
}

.cf .next-projects.is-clean .next-project-card {
  align-items: flex-start;
  width: calc((100% - clamp(20px, 3vw, 40px)) / 2);
  max-width: 460px;
  text-align: left;
}

.cf .next-projects.is-clean .next-project-media,
.cf .next-projects.is-clean .next-project-card:nth-child(n) .next-project-media {
  border: 1px solid var(--cf-line);
  border-radius: var(--cf-radius);
  box-shadow: none;
  transform: none;
  transition: border-color 0.25s ease;
}

.cf .next-projects.is-clean .next-project-media img {
  transition: transform 0.5s ease;
}

.cf .next-projects.is-clean .next-project-card:hover .next-project-media,
.cf .next-projects.is-clean .next-project-card:focus-visible .next-project-media,
.cf .next-projects.is-clean .next-project-card:hover:nth-child(n) .next-project-media {
  transform: none;
  border-color: var(--cf-ink);
}

.cf .next-projects.is-clean .next-project-card:hover .next-project-media img,
.cf .next-projects.is-clean .next-project-card:focus-visible .next-project-media img {
  transform: scale(1.03);
}

.cf .next-projects.is-clean .next-project-label {
  margin-top: 16px;
  color: var(--cf-accent);
}

.cf .next-projects.is-clean .next-project-name {
  margin-top: 6px;
  font-family: var(--cf-heading);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cf .next-projects.is-clean .next-project-desc {
  max-width: 42ch;
  color: var(--cf-mute);
}

.cf .next-projects.is-clean .next-projects-all {
  margin-top: 28px;
  padding: 0;
  font-family: var(--cf-mono);
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cf-ink);
  background: none;
  border: none;
  border-bottom: 1px solid var(--cf-ink);
  border-radius: 0;
  box-shadow: none;
}

.cf .next-projects.is-clean .next-projects-all:hover,
.cf .next-projects.is-clean .next-projects-all:focus-visible {
  transform: none;
  box-shadow: none;
  color: var(--cf-accent);
  border-color: var(--cf-accent);
}

/* =============================================================
   Gallery pages ("wall" of work, no sidebar). Same hero, facts row and
   type as a case file, left-aligned to the wall's own left edge so the
   header and the images read as one sheet; the wall itself is the
   shared masonry in style.css / script.js.
   ============================================================= */
.cf-gallery .cf-hero,
.cf-gallery .cf-tldr,
.cf-gallery .cf-wall-hint {
  width: min(94vw, 1600px);
  margin-left: auto;
  margin-right: auto;
}

.cf-gallery .cf-back-top {
  display: block;
  width: fit-content;
  margin: 20px 0 0 calc((100% - min(94vw, 1600px)) / 2);
  padding-left: 0;
}

.cf-gallery .cf-hero {
  padding-top: 18px;
}

.cf-gallery .cf-wall-hint {
  display: block;
  margin-top: 26px;
  margin-bottom: 0;
  font-family: var(--cf-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cf-mute);
}

.cf-gallery .wall {
  margin-top: 18px;
}

.cf-gallery .wall-section {
  width: min(94vw, 1600px);
  margin: 60px auto 0;
  padding-top: 22px;
  text-align: left;
  border-top: 1px solid var(--cf-line);
}

.cf-gallery .wall-section:first-of-type {
  margin-top: 36px;
}

.cf-gallery .wall-section-title {
  margin: 0;
  font-family: var(--cf-heading);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--cf-ink);
}

.cf-gallery .wall-section-note {
  max-width: 62ch;
  margin: 10px 0 0;
  font-family: "Rethink Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  opacity: 1;
  color: var(--cf-text);
}

.cf-gallery .wall-section + .wall {
  margin-top: 22px;
}

/* The sticker rides at the end of the title, in line with it, so it stays
   close to the words whatever the title's length. */
.cf-gallery .cf-title-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.cf-gallery .cf-title-wrap .hero-sticker {
  top: -16px;
  right: calc(var(--w, 130) * -1px - 25px);
  bottom: auto;
}

@media (max-width: 720px) {
  .cf-gallery .cf-title-wrap .hero-sticker {
    top: -10px;
    right: -81px;
    width: 64px;
  }
}

/* hidden by script.js when it would land on text */
.hero-sticker.sticker-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cf-facts,
  .cf-facts:has(> div:nth-child(4):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .cf .project-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 32px;
  }
}

@media (max-width: 720px) {
  /* text and its side figure stack on phones */
  .cf .text-with-figure {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .cf .text-with-figure .project-figure {
    max-width: 290px;
    margin-top: 18px;
  }

  .music-toggle {
    right: 16px;
    bottom: 16px;
    padding: 9px 14px 9px 12px;
    font-size: 0.82rem;
  }

  .cf {
    padding-top: 84px;
  }

  .cf .project-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .cf-hero {
    padding-top: 14px;
  }

  /* long titles (e.g. mediaWorks_2026) must fit a phone's width */
  .cf-title {
    font-size: clamp(2rem, 9.2vw, 2.8rem);
    overflow-wrap: anywhere;
  }

  .cf-facts,
  .cf-facts:has(> div:nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
  }

  .cf .project-section {
    padding-top: 28px;
  }

  .cf .photo-scroll {
    --h: 240px;
  }

  .cf .next-projects.is-clean .next-project-card {
    width: 100%;
    max-width: none;
  }

  .cf .next-projects.is-clean .next-projects-grid {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-hero,
  .cf-cover,
  .cf-tldr {
    animation: none !important;
  }
}
