/* ============================================================
   Ummeo — selected work
   Every preview embeds the real shipped site, rendered at desktop
   width and scaled to fit its frame. Nothing here is a mockup.
   ============================================================ */

.work { background: var(--bg); }

.work__list {
  display: flex;
  flex-direction: column;
  gap: clamp(4rem, 2rem + 8vw, 8rem);
}

.work__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  align-items: center;
}

@media (min-width: 960px) {
  .work__item {
    grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
    gap: clamp(2rem, 1rem + 4vw, 4.5rem);
  }
  /* Alternate sides for rhythm. The column ratio flips with the
     order, so the frame keeps the same width on both sides —
     swapping order alone would make every second preview narrower. */
  .work__item:nth-child(even) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.42fr);
  }
  .work__item:nth-child(even) .work__frame { order: 2; }
  .work__item:nth-child(even) .work__meta { order: 1; }
}

/* ---- Meta column --------------------------------------------- */
.work__meta { display: flex; flex-direction: column; gap: var(--sp-4); }

.work__index {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--fg-subtle);
  letter-spacing: 0.08em;
}

.work__name {
  font-size: var(--step-4);
  line-height: var(--lh-snug);
}

.work__kicker {
  font-size: var(--step-0);
  color: var(--fg-muted);
  max-width: 42ch;
}

.work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

.work__tag {
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  font-size: var(--step--2);
  color: var(--fg-muted);
  background: var(--bg-raised);
}

.work__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
  margin-top: var(--sp-2);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.work__stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
}

.work__stat-label {
  font-size: var(--step--2);
  color: var(--fg-subtle);
}

/* ---- Browser frame -------------------------------------------- */
.work__frame {
  container-type: inline-size;
  border-radius: var(--r-lg);
  border: 1px solid var(--rule);
  background: var(--bg-raised);
  box-shadow: var(--e-3);
  overflow: hidden;
  transition: transform var(--t-slow) var(--ease-out),
              box-shadow var(--t-slow) var(--ease-out);
}

.work__item:hover .work__frame {
  transform: translateY(-4px);
  box-shadow: var(--e-5);
}

.work__chrome {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}

.work__dots { display: flex; gap: 6px; flex: none; }

.work__dots i {
  inline-size: 9px;
  block-size: 9px;
  border-radius: var(--r-pill);
  background: var(--rule-strong);
}

.work__url {
  flex: 1;
  min-width: 0;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Live viewport -------------------------------------------
   The real site, embedded and scrollable. The iframe is rendered
   at a true desktop width, then scaled down to fit the frame, so
   the layout is the genuine desktop layout rather than the site's
   mobile breakpoint. Visitors scroll inside it natively.
   --------------------------------------------------------------- */
.work__viewport {
  position: relative;
  /* Desktop width the site is rendered at before scaling. main.js
     reads this and sets --vw-scale to frameWidth / --vw-width. */
  --vw-width: 1440;
  /* Window height tracks the frame width so the preview keeps its
     proportions from 320px through to the widest desktop. */
  --vw-height: clamp(15rem, 62cqw, 34rem);
  block-size: var(--vw-height);
  overflow: hidden;
  background: var(--bg-sunken);
}

.work__viewport iframe {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: calc(var(--vw-width) * 1px);
  /* Undo the scale so the visible area still fills the frame */
  block-size: calc(var(--vw-height) / var(--vw-scale));
  border: 0;
  transform: scale(var(--vw-scale));
  transform-origin: top left;
  background: var(--bone-100);
  /* Inert until activated. Without this the wheel scrolls the embedded
     site instead of the page, trapping anyone scrolling past. */
  pointer-events: none;
}

.work__viewport.is-live iframe { pointer-events: auto; }

/* Fallback only. main.js overwrites this per frame from the measured
   width; a fixed value cannot match every column and breakpoint. */
.work__frame { --vw-scale: 0.5; }

/* Invitation to activate the preview, dismissed once it is live */
.work__scrollhint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--sp-4);
  background: linear-gradient(to top, color-mix(in srgb, var(--ink-950) 34%, transparent), transparent 38%);
  border: 0;
  inline-size: 100%;
  cursor: pointer;
  opacity: 1;
  transition: opacity var(--t-slow) var(--ease-out);
}

.work__viewport.is-live .work__scrollhint {
  opacity: 0;
  pointer-events: none;
}

.work__scrollhint span {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink-950) 72%, transparent);
  color: var(--bone-100);
  font-size: var(--step--2);
  font-weight: 500;
  backdrop-filter: blur(6px);
}
