/* Portfolio index + case detail. */

.filter-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Case cards ---------- */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(18px, 2.2vw, 28px);
}

.case-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.case-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.case-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}
.case-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.5s ease;
}
.case-card:hover .case-card-img img { transform: scale(1.04); }
/* Scrim so the thumbnails (bright site screenshots) settle into the dark
   surface instead of glaring out of it. */
.case-card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--case-scrim);
  pointer-events: none;
}

.case-card-body {
  display: flex;
  flex-direction: column;
  padding: 18px 22px 24px;
  flex: 1;
}
.case-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.case-card-body h3 { font-size: 19px; margin-bottom: 6px; }
.case-card-client { margin: 0 0 16px; font-size: 14px; color: var(--text-faint); }
.case-card-link { margin-top: auto; }

.empty-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.empty-note p { margin: 0; }

/* ---------- Case hero ---------- */
.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  margin-top: 24px;
}
/* Case titles run long; a notch below the site-wide size keeps them to
   three lines beside the cover. */
.case-hero .page-title { margin-top: 14px; font-size: clamp(30px, 4.2vw, 46px); }
.case-hero .chip-row { margin: 22px 0 0; }
.case-hero .hero-actions { margin-top: 26px; }

/* The cover sits in a slim browser frame, so the page reads as "a site"
   before a single word. */
.case-hero-thumb {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: var(--shadow-deep);
}
.case-hero-thumb img { display: block; width: 100%; height: auto; }

@media (max-width: 860px) {
  .case-hero { grid-template-columns: 1fr; }
  .case-hero-thumb { order: -1; }
}

/* ---------- Brief: task + facts ---------- */
.case-brief {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}
.case-task {
  margin: 0;
  font-size: clamp(16px, 1.8vw, 18px);
  line-height: 1.65;
  color: var(--text);
  max-width: 720px;
}

.case-facts dl { margin: 0; display: grid; gap: 18px; }
.case-facts dt {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.case-facts dd { margin: 0; font-size: 16px; color: var(--text); line-height: 1.5; }
.case-facts dd a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.case-facts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.case-facts-list a { text-decoration: none; }
.case-facts-list a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .case-brief { grid-template-columns: 1fr; }
}

/* ---------- Works ---------- */
.case-works {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.case-works li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.case-works li:first-child { border-top: 0; padding-top: 0; }
.case-works li:last-child { padding-bottom: 0; }
.case-works p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-dim); }
.case-works-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-hi);
  padding-top: 4px;
  letter-spacing: 0.04em;
}

/* ---------- Mockups ---------- */
.mockup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
}
.mockup-hint { font-size: 15px; }

.browser-mockup {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-deep);
}
.browser-mockup-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
}
.browser-mockup-bar .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.browser-mockup-url {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  background: var(--surface-faint);
  padding: 4px 12px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browser-mockup-screen { aspect-ratio: 16 / 10; }

.phone-mockup {
  background: var(--phone-shell);
  border: 1px solid var(--line-strong);
  border-radius: 34px;
  padding: 10px;
  box-shadow: var(--shadow-deep);
  /* Explicit width: with size containment on the screen the shell has no
     intrinsic width left, and auto margins would shrink it to the notch. */
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}
.phone-mockup-notch {
  width: 68px;
  height: 15px;
  background: var(--phone-shell);
  border-radius: 0 0 12px 12px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.phone-mockup-screen {
  aspect-ratio: 9 / 19.5;
  border-radius: 24px;
  margin-top: -15px;
}

/* The captures are taller than the frames. The frame clips them, and on
   hover (or tap, via .is-scrolled) the picture glides up to its end — a
   scroll through the site without leaving the page. `cqh` is the frame's
   own height, so the maths needs no script; the min() guard keeps a short
   capture from sliding below its frame. */
.mockup-screen {
  overflow: hidden;
  background: var(--bg-deep);
  container-type: size;
}
.mockup-screen img {
  display: block;
  width: 100%;
  height: auto;
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.mockup { cursor: pointer; outline-offset: 4px; }
.mockup:focus-visible .mockup-screen img,
.mockup.is-scrolled .mockup-screen img {
  transform: translateY(min(0px, calc(100cqh - 100%)));
  transition-duration: 9s;
  transition-timing-function: linear;
}
/* Hover only where a hover exists: on touch screens :hover sticks after a
   tap and would fight the tap toggle. */
@media (hover: hover) {
  .mockup:hover .mockup-screen img {
    transform: translateY(min(0px, calc(100cqh - 100%)));
    transition-duration: 9s;
    transition-timing-function: linear;
  }
}
.phone-mockup.mockup .mockup-screen img { transition-duration: 0.9s; }
.phone-mockup.mockup:focus-visible .mockup-screen img,
.phone-mockup.mockup.is-scrolled .mockup-screen img { transition-duration: 7s; }
@media (hover: hover) {
  .phone-mockup.mockup:hover .mockup-screen img { transition-duration: 7s; }
}

@media (prefers-reduced-motion: reduce) {
  .mockup-screen img { transition: none !important; }
}

@media (max-width: 820px) {
  .mockup-grid { grid-template-columns: 1fr; }
  .phone-mockup { max-width: 220px; }
}

/* ---------- Result ---------- */
.result-panel { position: relative; overflow: hidden; }
.result-text { font-size: clamp(17px, 2vw, 20px); line-height: 1.6; max-width: 820px; margin: 0; }

/* ---------- Prev / next ---------- */
.case-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
}
.case-nav-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.case-nav-link:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}
.case-nav-link--next { text-align: right; align-items: flex-end; }
.case-nav-link--next:only-child { grid-column: 2; }
.case-nav-label { font-size: 13px; font-weight: 600; color: var(--accent-hi); letter-spacing: 0.04em; }
.case-nav-title { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.35; }
.case-nav-client { font-size: 14px; color: var(--text-faint); }

@media (max-width: 600px) {
  .case-nav { grid-template-columns: 1fr; }
  .case-nav-link--next:only-child { grid-column: auto; }
}
