/* ============================================================
   Cipherverse — preview.css  ·  live iframe thumbnails + browser modal
   The core proof device: click a project to open the real site.
   Restyled to the Console & Keyline DNA (all hexes trace to tokens).
   ============================================================ */

.work-hint { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--muted); margin-bottom: 1.5rem; }

/* ── Live thumbnail (scaled iframe inside a button) ──────── */
.work-card.is-live .work-thumb {
  display: block; width: 100%; padding: 0; border: 0;
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--surface-2); cursor: pointer;
}
.work-frame {
  position: absolute; top: 0; left: 0;
  width: 400%; height: 400%;
  transform: scale(0.25); transform-origin: top left;
  pointer-events: none; /* thumb is a preview, not interactive */
}
.work-iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* Card image (default in grids — the live site loads in the modal).
   Anchored to the TOP: these are screenshots of real sites, so a crop must
   keep the header and hero, never the middle of the page. */
.work-card.is-live .work-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform var(--tr-slow); }
.work-card.is-live:hover .work-thumb img { transform: scale(1.03); }

/* Shot Wall variant (/work) — the tile takes the screenshot's own height
   instead of a fixed 16:10 crop, which is what gives the wall its masonry.
   Very tall full-page shots are capped and cropped from the top. */
.work-card.is-live .shot-thumb { aspect-ratio: auto; border: 1px solid var(--line-2); background: var(--surface); }
.work-card.is-live .shot-thumb img { height: auto; max-height: 72vh; }

/* ── Phone frame — for captures taken on a phone ─────────
   A screenshot is framed as the device it came from: a landscape/desktop
   capture gets the browser chrome above, a portrait capture gets this.
   Rounded on purpose — the DNA's corner language is sharp, but this is
   depicting a physical object, not a UI surface. */
.phone {
  position: relative; display: block; flex: none;
  background: var(--ground);
  border: 1px solid var(--line-2); border-radius: 20px;
  padding: 18px 6px 8px;
  box-shadow: 0 28px 64px rgba(0,0,0,0.6);
  overflow: hidden;
}
.phone-pill {
  position: absolute; top: 7px; left: 50%; translate: -50% 0; z-index: 2;
  width: 34px; height: 4px; border-radius: 9999px; background: var(--line-2);
}
.work-card.is-live .phone img { border-radius: 10px; object-position: top center; }
/* The inset rides along, so it must not scale with the main screenshot. */
.work-card.is-live:hover .phone img { transform: none; }

/* Phone card on the wall */
.work-card.is-live .shot-thumb--phone { background: var(--surface); }
.shot-thumb--phone .phone-stage { display: flex; justify-content: center; padding: clamp(1.5rem, 4vw, 2.75rem) 1rem; }
.shot-thumb--phone .phone { width: min(66%, 260px); }
.work-card.is-live .shot-thumb--phone .phone img { height: auto; max-height: 520px; object-fit: cover; }

/* Phone shot riding along on a desktop card — the responsive proof in one
   tile. Sits above the screenshot but under the hover CTA. */
.phone--inset { position: absolute; right: 5%; bottom: 9%; z-index: 2; width: 23%; max-width: 108px; padding: 11px 4px 5px; border-radius: 13px; }
.phone--inset .phone-pill { top: 4px; width: 20px; height: 3px; }
.work-card.is-live .phone--inset img { height: auto; max-height: 210px; object-fit: cover; border-radius: 7px; }
.work-open { z-index: 3; }

/* Phone card in the home grid — no chrome, and the phone rises into the
   uniform 16:10 tile so the grid keeps its rhythm. */
.work-card.is-live .tile-thumb--phone { background: var(--surface); }
.tile-thumb--phone .phone-stage { display: flex; justify-content: center; align-items: flex-end; height: 100%; padding-top: 13%; }
.tile-thumb--phone .phone { width: min(38%, 132px); border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
.work-card.is-live .tile-thumb--phone .phone img { height: auto; max-height: none; object-fit: cover; }

/* hover affordance */
.work-open {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.8rem; font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 500;
  color: var(--ground); background: var(--lime);
  transform: translateY(100%); transition: transform var(--tr);
}
.work-card.is-live:hover .work-open,
.work-card.is-live:focus-within .work-open { transform: translateY(0); }
.work-card.is-live .work-thumb::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px var(--line-2);
  background: linear-gradient(180deg, transparent 68%, rgba(0,0,0,0.35));
  transition: box-shadow var(--tr); pointer-events: none;
}
.work-card.is-live:hover .work-thumb::after { box-shadow: inset 0 0 0 1px var(--lime); }

/* ── Browser-window modal ───────────────────────────────── */
.vmodal {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: center; justify-content: center;
  padding: clamp(0.75rem, 3vw, 3rem);
}
.vmodal.open { display: flex; }
body.vmodal-lock { overflow: hidden; }

.vmodal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.78); backdrop-filter: blur(6px); }

.vmodal-window {
  position: relative; display: flex; flex-direction: column;
  width: min(1200px, 100%); height: min(82vh, 820px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: 0 40px 120px rgba(0,0,0,0.7);
  animation: vpop 0.32s cubic-bezier(0.2,0.7,0.2,1);
}
.vmodal-bar { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.vmodal-dots { display: flex; gap: 6px; flex: none; }
.vmodal-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.vmodal-dots i:nth-child(3){ background: var(--lime); }
.vmodal-url {
  flex: 1; min-width: 0; text-align: center;
  font-family: var(--font-mono); font-size: var(--t-sm); color: var(--muted);
  background: var(--ground); padding: 0.45rem 1rem; border-radius: var(--radius);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vmodal-tools { display: flex; align-items: center; gap: 0.75rem; flex: none; }
.vmodal-ext { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--lime); }
.vmodal-ext:hover { text-decoration: underline; }
.vmodal-close { width: 32px; height: 32px; border-radius: var(--radius); color: var(--soft); font-size: 1.05rem; transition: background var(--tr); }
.vmodal-close:hover { background: rgba(255,255,255,0.08); }

.vmodal-screen { position: relative; flex: 1; background: #fff; }
.vmodal-frame { width: 100%; height: 100%; border: 0; }
.vmodal-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface); color: var(--muted); font-family: var(--font-mono); font-size: var(--t-sm); }
.vmodal.loaded .vmodal-loading { display: none; }

@keyframes vpop { from { transform: translateY(20px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .vmodal-window { animation: none; }
  .work-open { transition: none; }
}
