/* ==========================================================================
   MOCKUP: new case study cards (Selected Works). Not published.
   A white card with a thin border: on the left the app icon with the
   project's name and role, a big headline, the description, a row of key
   numbers and a link; on the right the project preview on a soft panel.
   The cards stack as you scroll: each one sticks below the nav, the next
   slides up over it, and the covered one blurs and fades into the page
   (js/case-cards.js). The old cards are kept in a <template> in index.html.
   ========================================================================== */

/* closer to the first card than the old full-screen cards needed (was
   80-120px; about 55px between the words and the card now) */
.selected-works .section-head { margin-bottom: clamp(24px, 2.4vw, 35px); }

/* "Selected Works" lines up with the cards' left edge */
.selected-works > .container {
  max-width: 1520px;
  margin: 0 auto;
  padding-left: clamp(12px, 2.2vw, 32px);
  padding-right: clamp(12px, 2.2vw, 32px);
}

.case-cards {
  --card-top: 96px; /* where a card sticks: just under the glass nav */
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 8px clamp(12px, 2.2vw, 32px) 0;
}

.case-card {
  position: sticky;
  top: var(--card-top);
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  min-height: min(620px, calc(100svh - var(--card-top) - 32px));
  padding: clamp(20px, 2.4vw, 32px);
  border: 1px solid rgba(17, 17, 16, 0.1);
  border-radius: clamp(24px, 2.6vw, 36px);
  background: #fff;
  box-shadow: 0 18px 48px rgba(17, 17, 16, 0.05);
  transform-origin: 50% 0;
  will-change: transform, filter;
}

/* the covered card fades toward the page colour (js/case-cards.js) */
.case-card__veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
}

/* ---------- left: the words ---------- */
.case-card__info {
  display: flex;
  flex-direction: column;
  padding: clamp(8px, 1.6vw, 24px) 0 clamp(8px, 1.2vw, 16px) clamp(4px, 1.2vw, 16px);
}

/* the icon's top lines up with the top of the project name */
.case-card__id {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
/* app icon (placeholders for the projects without a real icon yet) */
.case-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.case-card__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.case-card__icon--img { background: #fff; box-shadow: inset 0 0 0 1px rgba(17, 17, 16, 0.08); }
.case-card__icon--img img { width: 82%; height: 82%; object-fit: contain; }
/* app icons that fill the whole tile (Car Wars, Signal, Meridian), with a
   hairline edge so a white one still reads as a tile on the white card */
.case-card__icon--full { position: relative; }
.case-card__icon--full img { width: 100%; height: 100%; object-fit: cover; }
.case-card__icon--full::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 16, 0.08);
}

.case-card__name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.25;
}
.case-card__conf {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
.case-card__meta {
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--muted);
}
.case-card__lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
}
.case-card__lock svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.case-card__headline {
  margin-top: clamp(24px, 3vw, 40px);
  max-width: 16ch;
  font-family: var(--font-display);
  /* 3px under the "Selected Works" heading (styles.css .section-head h2),
     so the section title stays on top of the hierarchy */
  font-size: calc(clamp(1.8rem, 3.6vw, 2.8rem) - 3px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
}
.case-card__desc {
  margin-top: 18px;
  max-width: 46ch;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--muted);
}

/* key numbers, under a divider */
.case-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px clamp(28px, 4vw, 64px);
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.case-cards .case-card__desc { margin-bottom: clamp(24px, 3vw, 36px); }
.case-card__stat { display: flex; flex-direction: column; }
/* in the project's own accent colour (--project-accent, set on each card in
   index.html from its case study's theme) */
.case-card__stat-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--project-accent, var(--ink));
}
.case-card__stat-label {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* black pill button */
.case-card__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: clamp(22px, 2.6vw, 32px);
  padding: 13px 26px 13px 28px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background-color 0.25s ease;
}
.case-card__arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s ease;
}
.case-card:hover .case-card__link { background: #262624; }
.case-card:hover .case-card__arrow { transform: translateX(3px); }
/* clicking anywhere on the card opens the case study */
.case-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}
.case-card__link:focus-visible { outline: none; }
.case-card:has(.case-card__link:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

/* ---------- right: the project preview on a soft panel ---------- */
.case-card__media {
  position: relative;
  overflow: hidden;
  border-radius: clamp(18px, 2vw, 28px);
  background: #f6f5f1;
}
.case-card__media video {
  position: absolute;
  inset: clamp(16px, 2.4vw, 36px);
  width: calc(100% - 2 * clamp(16px, 2.4vw, 36px));
  height: calc(100% - 2 * clamp(16px, 2.4vw, 36px));
  object-fit: contain;
  /* the card versions of the videos (*-cream.mp4) have their background
     recoloured to this panel's #F6F5F1 with the mockups left white, so they
     sit right on the panel; EOS's dashboard fills its whole video */
}

/* videos whose background is already the panel's cream (*-cream.mp4) run
   edge to edge across the panel, so close-ups don't stop short in a hard
   line; the cream above and below them blends into the panel */
.case-card__media--bleed video {
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- smaller screens: words above the preview ---------- */
@media (max-width: 900px) {
  /* a phone card is taller than the screen, so it only sticks once its
     bottom (the See More button) is in view; the extra space lets it rest
     there a moment before the next card slides over it */
  .case-cards { --card-top: 80px; gap: 30vh; gap: 30svh; }
  /* one column, in this order: the words and numbers, the preview, then
     the See More button under the preview */
  .case-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
  }
  .case-card__info { display: contents; }
  .case-card__info > * { margin-left: 4px; margin-right: 4px; }
  .case-card__id { margin-top: 8px; }
  .case-card__headline { max-width: none; }
  .case-card__stats { margin-top: 0; }
  .case-card__media {
    order: 1;
    aspect-ratio: 16 / 11;
    margin-top: 28px;
  }
  .case-card__link {
    order: 2;
    margin-top: 20px;
    margin-bottom: 4px;
  }
}
