/* ============================================================
   Projects layer — case-study showcase (projects.html) and the
   "Recent launches" strip on the homepage. Both sit inside .page,
   so they inherit the light-canvas variable flip automatically.
   ============================================================ */

/* ---- shared: framed screenshot with a browser chrome bar ---- */
.shot-frame {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.shot-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
}
.shot-bar i {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ff5f57; flex-shrink: 0;
}
.shot-bar i:nth-child(2) { background: #febc2e; }
.shot-bar i:nth-child(3) { background: #28c840; }
.shot-url {
  margin-inline-start: 10px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 4px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 70%;
  direction: ltr; unicode-bidi: isolate;
}
.shot-frame img,
.shot-frame video {
  /* Every case window is the same size, and the whole screenshot sits
     inside it: one fixed frame ratio + `contain`, so nothing is ever
     cropped and no card is taller than its neighbour. An oddly-shaped
     upload letterboxes on the panel colour instead of being cut. */
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain; object-position: center top;
  background: var(--noir-panel, #151513);
  transition: transform 0.7s var(--ease-fluid);
  /* the hue classes are shared with the playground's masonry cards, and
     `.card--purple img` there carries `margin: 8px 0 26px`. Inside a frame
     that made the purple case window 34px taller than every other one. */
  margin: 0;
}
/* ---- the reel: several screenshots crossfading inside one window, so a
   case shows more than its homepage without becoming a video file. The reel
   owns the frame ratio now; the slides stack inside it absolutely, which is
   what keeps every window the same height whatever the shots measure. ---- */
.shot-reel {
  display: block; position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--noir-panel, #151513);
  line-height: 0;
}
.shot-frame .shot-slide {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  aspect-ratio: auto;                  /* the reel carries the ratio instead */
  object-fit: contain; object-position: center top;
  opacity: 0;
  transition: opacity 0.9s var(--ease-fluid);
}
.shot-frame .shot-slide.is-on { opacity: 1; }

/* the media column: framed shot, with the dots beneath it and OUTSIDE the
   link, since a <button> inside an <a> never receives its own click */
.case-shot { display: block; min-width: 0; }
.shot-dots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.shot-dot {
  /* 30×24 keeps the touch target honest while the mark stays a hairline */
  width: 30px; height: 24px; padding: 0; border: 0;
  background: none; cursor: pointer;
  display: flex; align-items: center;
}
.shot-dot::before {
  content: ''; display: block; width: 100%; height: 3px; border-radius: 2px;
  background: var(--line);
  transition: background var(--dur-ui) var(--ease-fluid);
}
.shot-dot:hover::before { background: var(--muted); }
.shot-dot.is-on::before { background: var(--ember); }
.shot-dot:focus-visible { outline: 3px solid #b34700; outline-offset: 3px; border-radius: 4px; }

/* image-less fallback: a hue-lit monogram panel */
.shot-mono {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 10;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3rem, 6vw, 5rem);
  color: var(--muted); background: var(--glass);
}

/* ============================================================
   projects.html — the case list
   ============================================================ */
.case-list { display: grid; gap: clamp(22px, 3vw, 36px); }

.case-card {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(20px, 3.4vw, 44px);
  align-items: center;
  padding: clamp(18px, 2.6vw, 34px);
}
.case-card--flip .case-media,
.case-card--flip .case-shot { order: 2; }
/* the flipped cards mirror the columns too, so the screenshot always
   lands in the WIDE one — every case window ends up the same size */
.case-card--flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }

.case-media { display: block; text-decoration: none; }
.case-media:hover img, .case-media:focus-visible img { transform: scale(1.035); }
/* on the white project canvas cyan is only ~2:1 — use a tone that clears
   WCAG 1.4.11 (3:1) against both the card and the page */
.case-media:focus-visible { outline: 3px solid #b34700; outline-offset: 4px; border-radius: 16px; }

.case-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.case-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.4rem, 4vw, 3.4rem); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--muted);
  opacity: 0.5; margin-bottom: 14px;
}
.case-copy .card-tag { margin-bottom: 16px; }
.case-copy h3 { font-size: clamp(1.45rem, 2.3vw, 2.05rem); margin-bottom: 12px; }
.case-copy > p { font-weight: 450; font-size: 0.96rem; line-height: 1.7; color: var(--muted); max-width: 52ch; }

.case-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.case-stack span {
  font-size: 0.7rem; font-weight: 650; letter-spacing: 0.02em;
  padding: 6px 12px; border-radius: var(--pill);
  border: 1px solid var(--line); background: var(--glass); color: var(--muted);
}

.case-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-case {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--pill);
  background: var(--ember); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 0.86rem;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(255, 107, 0, 0.35);
  transition: transform var(--dur-tap) var(--ease-fluid), box-shadow var(--dur-ui) var(--ease-fluid);
}
.btn-case:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(255, 107, 0, 0.45); }
.btn-case:active { transform: scale(0.97); }

/* stacked layout under 1000px — media first, copy follows */
@media (max-width: 999px) {
  .case-card { grid-template-columns: 1fr; align-items: start; }
  .case-card--flip .case-media,
  .case-card--flip .case-shot { order: 0; }
  .case-num { display: none; }
}

/* the whole-list count chip in the hero */
.case-count { color: var(--orange); font-weight: 700; }

/* RTL: case copy is English — isolate direction per card */
html[dir="rtl"] .case-card { direction: ltr; }

/* ============================================================
   index.html — "Recent launches" marquee strip
   ============================================================ */
.work-strip {
  overflow: hidden;
  padding-block: 8px;
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.work-track { display: flex; width: max-content; animation: work-scroll 46s linear infinite; }
.work-strip:hover .work-track,
.work-strip:focus-within .work-track { animation-play-state: paused; }
@keyframes work-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.work-seq { display: flex; flex-shrink: 0; direction: ltr; }

.work-cell {
  display: block; width: min(340px, 78vw); flex-shrink: 0;
  margin-inline-end: var(--gap);
  text-decoration: none; color: var(--ink);
}
.work-cell .shot-frame {
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s var(--ease-fluid), box-shadow 0.35s var(--ease-fluid);
}
.work-cell .shot-bar { padding: 7px 12px; }
.work-cell .shot-bar i { width: 7px; height: 7px; }
.work-cell .shot-url { font-size: 0.62rem; padding: 3px 10px; }
.work-cell:hover .shot-frame, .work-cell:focus-visible .shot-frame {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px rgba(255, 107, 0, 0.45), 0 16px 38px rgba(0, 0, 0, 0.5);
}
.work-cell:focus-visible { outline: none; }
.work-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 4px 0; }
.work-cap strong { font-family: var(--font-display); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-cap span { font-size: 0.7rem; font-weight: 600; color: var(--muted); flex-shrink: 0; }

.work-more { margin-top: 26px; }

/* Reduced motion: calm wrapped grid, second sequence hidden.
   flex-shrink must be restored here — .work-seq is flex-shrink:0 for the
   marquee, so without this it stays at its 2520px max-content width inside
   the overflow:hidden strip and only the first project is ever visible. */
html.motion-off .work-track { animation: none; width: auto; flex-wrap: wrap; gap: var(--gap); }
html.motion-off .work-seq { flex-wrap: wrap; flex-shrink: 1; width: 100%; gap: var(--gap); }
html.motion-off .work-seq[aria-hidden="true"] { display: none; }
html.motion-off .work-cell { margin-inline-end: 0; }

/* Touch has neither :hover nor :focus-within, so the 46s loop cannot be
   paused, examined or steered — a WCAG 2.2.2 (Level A) failure. Handing the
   visitor the pace means it is no longer auto-moving content. */
@media (hover: none) {
  .work-strip {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    /* the edge fade is authored for perpetual motion; parked at rest it
       ghosts the leading cell */
    mask-image: none; -webkit-mask-image: none;
  }
  .work-track { animation: none; width: max-content; }
  .work-cell { scroll-snap-align: start; }
  .work-seq[aria-hidden="true"] { display: none; }
}

/* very small phones: trim padding so case cards fit the 320px viewport
   without any clipping (the page already has its own side padding) */
@media (max-width: 380px) {
  .case-card { padding: 14px; gap: 16px; }
  .page:not(.admin-page) { padding-inline: 12px; }
  .shot-bar { padding: 8px 10px; }
  .shot-url { font-size: 0.62rem; max-width: 60%; }
}

/* focus rings on the light canvas need 3:1 contrast — cyan fails on white */
.page:not(.admin-page) .work-cell:focus-visible .shot-frame { box-shadow: 0 0 0 3px var(--orange), 0 16px 38px rgba(0, 0, 0, 0.5); }
