
/* ==========================================================================
   Portfolio — public site styles (v4, final). Source of truth: preview_calvinmo_v4.html
   ========================================================================== */
:root {
  --bg: #1c1c1c;
  --bg-raised: #242424;
  --text: #ffffff;
  --text-2: #bdbdbd;
  --accent: #ff6a00;
  --line: #000000;
  --gutter: 2px;
  --overlay: rgba(10, 10, 10, var(--overlay-opacity));
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  /* design defaults (v4). index.php / case-study.php re-emit these from the Design tab on every page */
  --overlay-opacity: 0.7;
  --hero-h: 65vh; --hero-h-phone: 55vh;
  --avatar: 192px; --avatar-phone: 96px;
  --name-size: 100px; --name-size-phone: 40px; --name-weight: 300;
  --sub-size: 28px;
  --hero-scrim-opacity: 0.95; --hero-scrim-height: 60%;
  --hero-pad: 40px; --hero-pad-phone: 24px;
  --cpad-desktop: 40px; --cpad-phone: 20px;
  --row-h: 320px; --row-h-tablet: 260px; --row-h-phone: 180px;
  --grid-top: 64px; --grid-top-phone: 40px;
  --tile-title-size: 16.8px;
  --cpad: var(--cpad-desktop);
}
@media (max-width: 767px) { :root { --cpad: var(--cpad-phone); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--bg); color: var(--accent); padding: 8px 14px; }
.skip-link:focus { top: 8px; }

/* shared container: max 1480, 40px side padding (20px phone) */
.container { width: 100%; max-width: 1480px; margin: 0 auto; padding-left: var(--cpad); padding-right: var(--cpad); }

/* ---------- Hero ------------------------------------------------------- */
.hero {
  position: relative; width: 100%; height: var(--hero-h-phone);
  background: #000; overflow: hidden;
  border-bottom: 1px solid var(--line);
  container-type: size;
}
@media (min-width: 768px) { .hero { height: min(var(--hero-h), 680px); } }
.hero-media { position: absolute; inset: 0; overflow: hidden; }
.hero-media iframe {
  position: absolute; top: 50%; left: 50%;
  /* cover: a 16:9 frame at least as wide and as tall as the hero */
  width: max(100cqw, 177.7778cqh); height: max(100cqh, 56.25cqw);
  max-width: none; transform: translate(-50%, -50%);
  border: 0; pointer-events: none;
}
.hero-media video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; pointer-events: none; }
/* bottom-anchored scrim only: covers the lower --hero-scrim-height of the hero, no top/side tint.
   Stops = 0.95 @0%, 0.6 @25%, 0.2 @45%, 0 @60% of the hero, rescaled to the scrim box; mid stops scale with --hero-scrim-opacity */
.hero-scrim { position: absolute; left: 0; right: 0; bottom: 0; height: var(--hero-scrim-height); pointer-events: none;
  background: linear-gradient(to top,
    rgba(0,0,0,var(--hero-scrim-opacity)) 0%,
    rgba(0,0,0,calc(var(--hero-scrim-opacity) * 0.631579)) 41.6667%,
    rgba(0,0,0,calc(var(--hero-scrim-opacity) * 0.210526)) 75%,
    rgba(0,0,0,0) 100%); }
.hero-inner { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.hero-row { display: flex; align-items: stretch; gap: 40px; padding-bottom: var(--hero-pad); }
.profile { width: var(--avatar); height: var(--avatar); max-width: none; flex: 0 0 auto; object-fit: cover; border: 0; border-radius: 0; background: var(--bg-raised); }
.hero-col { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.hero-name { margin: 0; color: var(--text); font-weight: var(--name-weight); letter-spacing: -0.03em; line-height: 1; font-size: min(var(--name-size), 10.2vw); white-space: nowrap; }
.hero-btns { display: flex; gap: 8px; margin-top: 24px; }
.hero-sub { margin: 8px 0 0; color: var(--text-2); font-family: var(--font); font-weight: 300; font-size: min(var(--sub-size), 3vw); line-height: 1.1; letter-spacing: 0; }
.hero-sub[hidden] { display: none; }
.hero-sub:not([hidden]) + .hero-btns { margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  font: 500 12px/1 var(--font); color: #d1d1d1; background: transparent;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 2px;
  transition: color .2s ease, border-color .2s ease;
}
.btn:hover, .btn:focus-visible { color: var(--accent); border-color: var(--accent); text-decoration: none; }
@media (max-width: 767px) {
  .hero-row { flex-direction: column; align-items: flex-start; gap: 16px; padding-bottom: var(--hero-pad-phone); }
  .profile { width: var(--avatar-phone); height: var(--avatar-phone); }
  .hero-name { font-size: var(--name-size-phone); }
  .hero-btns { margin-top: 16px; }
  .hero-sub { font-size: 16px; }
  .hero-sub:not([hidden]) + .hero-btns { margin-top: 20px; }
}

/* ---------- Mosaic (justified rows, laid out by JS) --------------------- */
.mosaic-wrap { margin-top: var(--grid-top); }
@media (max-width: 767px) { .mosaic-wrap { margin-top: var(--grid-top-phone); } }
.mosaic { position: relative; width: 100%; background: var(--line); min-height: 200px; }
.mosaic-rest { position: absolute; background: var(--bg); pointer-events: none; }
.tile {
  position: absolute; display: block; overflow: hidden;
  background: var(--bg-raised); color: var(--text); text-decoration: none;
}
.tile:hover { text-decoration: none; }
.tile .tile-media { position: absolute; inset: 0; overflow: hidden; transition: transform 0.6s ease; }
/* framed artwork: always covers the tile (zoom >= 1), see frame_style() + assets/frame.js */
.pf-framed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.tile-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: clamp(12px, 1.6vw, 22px);
  background: var(--overlay); opacity: 0; transition: opacity 0.25s ease;
}
.tile-title { color: var(--accent); font-weight: 500; font-size: var(--tile-title-size); line-height: 1.3; }
.tile-desc  { color: var(--text-2); font-size: 0.9rem; line-height: 1.4; }
.tile:hover .tile-overlay, .tile:focus-visible .tile-overlay, .tile.is-touched .tile-overlay { opacity: 1; }
.tile:hover .tile-media, .tile:focus-visible .tile-media { transform: scale(1.025); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 3; }
.tile .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 45%, #2e2e2e, #1f1f1f 70%); }
.tile:hover .ph svg circle, .tile:focus-visible .ph svg circle { stroke: var(--accent); }
.tile:hover .ph svg path, .tile:focus-visible .ph svg path { fill: var(--accent); }

.site-footer { padding: 28px 0; color: var(--text-2); font-size: 0.85rem; }
.site-footer a { color: var(--text-2); }

/* ---------- Lightbox ---------------------------------------------------- */
body.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(8, 8, 8, 0.95); opacity: 0; transition: opacity 0.2s ease; }
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lb-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 0; }
.lb-stage img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain; }
/* player frame: sized from the video PLAYER SHAPE (JS sets aspect-ratio + px size; CSS fallback below) */
.lb-video { position: relative; aspect-ratio: 16 / 9; width: min(92vw, calc(88vh * 16 / 9)); max-width: 92vw; max-height: 88vh; background: #000;
  transition: width 0.3s ease, height 0.3s ease; }
.lb-video iframe { position: absolute; inset: 0; }
.lb-video iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; }
.lb-video .embed-ph { z-index: 0; }
.lb-btn { position: absolute; z-index: 2; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text); font: 300 2.4rem/1 var(--font); cursor: pointer; }
.lb-btn:hover { color: var(--accent); }
.lb-btn[hidden] { display: none; }
.lb-close { top: 10px; right: 12px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); font-size: 3.2rem; }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); font-size: 3.2rem; }
.lb-caption { position: absolute; left: 0; right: 0; bottom: 22px; padding: 0 72px; text-align: center; font-size: 0.95rem; }
.lb-caption .lb-title { color: var(--accent); font-weight: 500; }
.lb-caption .lb-desc { color: var(--text-2); margin-left: 10px; }

/* ---------- Case study / Demo Reel views -------------------------------- */
.topbar { border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.back-link, .topbar-title { color: var(--text); }
.back-link:hover, .topbar-title:hover { color: var(--accent); text-decoration: none; }
.topbar-title { color: var(--text-2); }
.cs { max-width: 1480px; margin: 0 auto; padding: clamp(32px, 6vw, 80px) var(--cpad) 96px; }
.cs-head, .cs-text, .cs-back, .draft-banner { max-width: 70ch; margin-left: auto; margin-right: auto; }
.cs-head h1 { margin: 0 0 16px; font-size: clamp(2rem, 4.4vw, 3.4rem); font-weight: 400; line-height: 1.12; letter-spacing: -0.01em; }
.cs-head h1:focus, .cs-head h1:focus-visible { outline: none; }
.cs-intro { margin: 0 0 40px; color: var(--text-2); font-size: 1.2rem; font-weight: 300; }
.cs-text { font-size: 1.075rem; }
.cs-text h2, .cs-text h3, .cs-text h4 { font-weight: 500; line-height: 1.25; margin: 2em 0 0.6em; }
.cs-text h2 { font-size: 1.6rem; }
.cs-text h3 { font-size: 1.3rem; }
.cs-text h4 { font-size: 1.1rem; color: var(--text-2); }
.cs-text p, .cs-text ul, .cs-text ol { margin: 0 0 1.1em; }
.cs-text a { text-decoration: underline; text-underline-offset: 3px; }
.shot-list { padding-left: 1.2em; color: var(--text-2); }
.shot-list li { margin: 0 0 .25em; }
.cs-media { margin: clamp(32px, 5vw, 64px) 0; }
.cs-media img { width: 100%; height: auto; }
.cs-media figcaption { max-width: 70ch; margin: 10px auto 0; color: var(--text-2); font-size: 0.9rem; }
.view-reel .cs-media { margin-top: 24px; }
.ratio-16x9 { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.ratio-16x9 iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; }
.embed-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: .9rem; }
.ph-text { color: var(--text-2); border-left: 2px solid var(--accent); padding-left: 14px; font-style: italic; }
.cs-back { margin-top: 64px; }
.draft-banner { padding: 10px 14px; border: 1px solid var(--accent); color: var(--accent); margin-bottom: 32px; }

@media (max-width: 767px) {
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .lb-caption { padding: 0 64px; bottom: 26px; }
  .lb-caption .lb-desc { display: block; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .tile:hover .tile-media, .tile:focus-visible .tile-media { transform: none; }
}


/* ---------- additions for the dynamic build ---------------------------- */
.profile--empty { display: block; }
.mosaic-empty { color: var(--text-2); padding: 48px 0; }
.mosaic:has(.mosaic-empty) { background: transparent; }
.lb-stage .lb-img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain; }
.lb-video[hidden], .lb-img[hidden] { display: none; }
.nf { padding: 120px 0; }

/* ---------- Case study layout builder output (update 5). Same file is used by the admin live preview. ---------- */
.pf-layout { width: 100%; }
.pf-row { display: flex; gap: var(--gap, 24px); align-items: flex-start; margin: 0 0 var(--gap, 24px); }
.pf-row:last-child { margin-bottom: 0; }
.pf-v-middle { align-items: center; }
.pf-v-bottom { align-items: flex-end; }
.pf-col { flex: 0 0 calc((100% - var(--gap, 24px) * (var(--n, 1) - 1)) * var(--w, 100) / 100); min-width: 0; }
.pf-text { margin: 0; overflow-wrap: break-word; }
.pf-text p, .pf-text ul, .pf-text ol { margin: 0 0 0.8em; }
.pf-text > :last-child { margin-bottom: 0; }
.pf-text ul, .pf-text ol { padding-left: 1.3em; }
.pf-text a { text-decoration: underline; text-underline-offset: 3px; }
.pf-tag-caption { color: var(--text-2); }
.pf-img, .pf-vid { margin: 0; max-width: 100%; }
.pf-img img { display: block; width: 100%; height: auto; }
.pf-al-center, .pf-vid { margin-left: auto; margin-right: auto; }
.pf-al-right { margin-left: auto; }
.pf-zoom { display: block; cursor: zoom-in; }
.pf-player { position: relative; max-width: 100%; margin: 0 auto; background: #000; }
.pf-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pf-cap { margin: 10px 0 0; color: var(--text-2); font-size: 0.9rem; text-align: center; }
.pf-hr { border: 0; height: 0; max-width: 100%; }
/* update 6: video file block */
.pf-vfile { margin: 0; max-width: 100%; }
.pf-vbox { position: relative; max-width: 100%; margin: 0 auto; background: #000; overflow: hidden; }
.pf-al-left .pf-vbox { margin-left: 0; }
.pf-al-right .pf-vbox { margin-right: 0; }
.pf-vbox video { display: block; width: 100%; height: auto; }
.pf-vbox.pf-fixed video { position: absolute; inset: 0; height: 100%; object-fit: cover; }
/* update 6: up to 8 columns. 768-1100 px: rows with more than 4 columns wrap into lines of 4 equal columns
   (below 768 px this still applies to "keep side by side on phones" rows; other rows stack, see below). */
@media (max-width: 1100px) {
  .pf-row.pf-many { flex-wrap: wrap; }
  .pf-row.pf-many > .pf-col { flex: 0 0 calc((100% - var(--gap, 24px) * 3) / 4); }
}
@media (max-width: 767px) {
  .pf-row:not(.pf-keep) { flex-direction: column; align-items: stretch; }
  .pf-row:not(.pf-keep) > .pf-col { flex: 0 0 auto; width: 100%; }
}
.pf-zoombox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(8, 8, 8, 0.95); cursor: zoom-out; }
.pf-zoombox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; }
.pf-zoombox button { position: absolute; top: 10px; right: 12px; width: 52px; height: 52px; background: transparent; border: 0; color: var(--text); font: 300 2.4rem/1 Roboto, sans-serif; cursor: pointer; }
.pf-zoombox button:hover, .pf-zoombox button:focus-visible { color: var(--accent); }
