body[data-theme="one-punch"] {
  --featured-stage: #211b1b;
  --featured-panel: #29211f;
  --featured-art: url("media/selected/one-punch-frame.jpg");
  --featured-glow: #5b2923;
  --notes-art: url("media/selected/one-punch-frame.jpg");
  --featured-motif: radial-gradient(circle, #e6c68494 1px, transparent 1.5px) 0 0 / 6px 6px,
    linear-gradient(120deg, transparent 50%, #c63228 50% 57%, #131010 57% 60%, #eec259 60% 68%, transparent 68%);
}
body[data-theme="ferrari"] {
  --featured-stage: #17191e;
  --featured-panel: #1d2026;
  --featured-art: url("media/selected/ferrari-frame.jpg");
  --featured-glow: #49272d;
  --notes-art: url("media/featured/ferrari-13.jpg");
  --featured-motif: linear-gradient(121deg, transparent 42%, #dc433dcc 43% 47%, transparent 48% 53%, #dd564b94 54% 55%, transparent 56%),
    repeating-conic-gradient(#e1d9d867 0% 25%, transparent 0% 50%) 0 0 / 18px 18px;
}
body[data-theme="vampire-perks"] {
  --accent: #e9ba78;
  --featured-stage: #22141e;
  --featured-panel: #2b1b25;
  --featured-art: url("media/featured/vampire-perks-hero.jpg");
  --featured-glow: #522231;
  --notes-art: url("media/vampire-perks-banner.jpg");
  --featured-motif: radial-gradient(circle at 83% 43%, #b6435569 0 22%, transparent 23%),
    radial-gradient(ellipse at 71% 95%, transparent 36%, #e5b16fae 37% 38%, transparent 39%),
    radial-gradient(ellipse at 93% 95%, transparent 34%, #e5b16fae 35% 36%, transparent 37%);
}
body[data-theme="whitepaper-47"] {
  --accent: #a7ddf6;
  --featured-stage: #101e2b;
  --featured-panel: #172937;
  --featured-art: url("media/whitepaper-serpent-banner.jpg");
  --featured-glow: #224768;
  --notes-art: url("media/selected/whitepaper-serpent.jpg");
  --featured-motif: repeating-linear-gradient(134deg, transparent 0 18px, #b8e7f890 19px, transparent 20px 33px),
    repeating-linear-gradient(61deg, transparent 0 61px, #61ace772 62px, transparent 63px 81px);
}
body[data-theme="halloween-spy"] {
  --accent: #f4a45e;
  --featured-stage: #1a1a23;
  --featured-panel: #24212a;
  --featured-art: url("media/halloween-rooftop-banner.jpg");
  --featured-glow: #433044;
  --notes-art: url("media/featured/halloween-spy-6.jpg");
  --featured-motif: linear-gradient(#f4a45e, #f4a45e) right 11px top 9px / 25px 1px no-repeat,
    linear-gradient(#f4a45e, #f4a45e) right 11px top 9px / 1px 17px no-repeat,
    linear-gradient(#f4a45e, #f4a45e) right 77px bottom 9px / 25px 1px no-repeat,
    linear-gradient(#f4a45e, #f4a45e) right 101px bottom 9px / 1px 17px no-repeat,
    radial-gradient(circle at 68% 50%, transparent 16px, #f4a45e9d 17px, transparent 18px);
}

.route-screen[data-theme="vampire-perks"] { --route-color: #e9ba78; }
.route-screen[data-theme="whitepaper-47"] { --route-color: #a7ddf6; }
.route-screen[data-theme="halloween-spy"] { --route-color: #f4a45e; }

.detail {
  --detail-inset: var(--portfolio-inset);
  padding-block: var(--portfolio-gap);
}
.detail-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: var(--portfolio-padding) var(--detail-inset);
  background: radial-gradient(ellipse at 89% 0%, var(--featured-glow), transparent 56%), var(--featured-stage);
  box-shadow: inset 0 0 0 1px var(--line);
}
.detail-stage::before {
  position: absolute;
  z-index: -2;
  inset: 0 0 auto 36%;
  height: clamp(130px, 21vw, 290px);
  background: var(--featured-art) center 35% / cover no-repeat;
  mask-image: linear-gradient(to left, #000, transparent 96%), linear-gradient(#000, transparent 95%);
  mask-composite: intersect;
  opacity: .35;
  content: "";
  pointer-events: none;
}
body[data-theme="one-punch"] .detail-stage::before { filter: grayscale(.86); }

.detail-title {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 3px clamp(12px, 1.6vw, 23px);
  padding: 0 min(24%, 230px) clamp(14px, 2svh, 22px) 0;
}
.detail-title::after {
  position: absolute;
  z-index: -1;
  inset: 1px 0 12px auto;
  width: min(27%, 290px);
  background: var(--featured-motif);
  mask-image: linear-gradient(90deg, transparent 5%, #000 78%);
  opacity: .7;
  content: "";
  pointer-events: none;
}
.detail-title .eyebrow { grid-column: 1 / -1; color: var(--accent); margin: 0; }
.detail-title h1 {
  font-size: clamp(25px, 3vw, 44px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -.023em;
}
.detail-subtitle {
  color: var(--muted);
  font: 10px/1.3 var(--mono);
  letter-spacing: .065em;
}

.detail-grid {
  --player-limit: max(365px, calc((var(--portfolio-height) - 225px) * 1.38));
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, min(62%, var(--player-limit))) minmax(0, 1fr);
  column-gap: clamp(14px, 2vw, 30px);
}
.detail-sidebar { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.player-column { min-width: 0; }
.frame-slot { position: relative; aspect-ratio: 16 / 9; }
.film-frame {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #080a0d;
}
.frame-slot .film-frame::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 76%, transparent);
  border-block: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
  content: "";
  pointer-events: none;
}
.frame-slot { outline: 1px solid color-mix(in srgb, var(--accent) 54%, transparent); outline-offset: 4px; }
.video-surface { position: relative; width: 100%; height: 100%; overflow: hidden; }
.hero-still, .film-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-still { object-fit: cover; }
.film-video { object-fit: contain; }
.detail[data-film-format="landscape"] .frame-slot .film-video:not(:fullscreen) { object-fit: cover; }

.play-launch {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
}
.play-launch:focus-visible { outline-offset: -5px; }
.play-icon {
  display: grid;
  place-items: center;
  width: clamp(40px, 4.4vw, 65px);
  aspect-ratio: 1;
  border: 1px solid #ffffffe0;
  border-radius: 50%;
  background: #080a0dcc;
  box-shadow: 0 5px 25px #0006;
  transition: color 180ms ease, background 180ms ease;
}
.play-icon::before { width: 29%; aspect-ratio: 1; margin-left: 7%; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); content: ""; }
.play-launch:is(:hover, :focus-visible) .play-icon { color: var(--accent); background: #080a0df2; }
.play-launch > span:last-child { padding: 3px 7px; background: #080a0dda; color: #fff; font-size: 11px; }
.preview-label, .film-error {
  position: absolute;
  left: 9px;
  bottom: 9px;
  padding: 5px 8px;
  background: #0a0b10dc;
  color: #f5efe8;
  font-size: 11px;
  pointer-events: none;
}
.film-error { bottom: 42px; max-width: calc(100% - 18px); }

.project-notes {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: clamp(13px, 1.5vw, 23px);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-top-color: color-mix(in srgb, var(--accent) 77%, transparent);
  background: color-mix(in srgb, var(--featured-panel) 88%, transparent);
}
.project-notes > h2,
.work-contribution h2 {
  color: var(--accent);
  font-size: clamp(15px, 1.38vw, 20px);
  font-weight: 600;
  line-height: 1.25;
}
.project-notes > p {
  margin-top: 7px;
  color: #e2dfdf;
  font-size: clamp(12px, 1.02vw, 14px);
  line-height: 1.55;
}
.project-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; }
.project-meta { margin: 0; font-size: 11px; }
.project-meta > div { display: flex; align-items: baseline; gap: 7px; }
.project-meta dt { color: var(--muted); }
.project-meta dd { margin: 0; color: var(--ink); font: 11px/1.4 var(--mono); white-space: nowrap; }
.notes-play {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 13px;
  min-height: 34px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 37%, var(--line));
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}
.notes-play span, .notes-play:is(:hover, :focus-visible) { color: var(--accent); }

.work-contribution {
  margin-top: clamp(11px, 1.8svh, 20px);
  padding-top: clamp(10px, 1.55svh, 17px);
  border-top: 1px solid var(--line);
}
.work-contribution .eyebrow { margin-bottom: 3px; font-size: 9px; }
.work-contribution .credits-copy { max-width: none; margin-top: 8px; }
.work-contribution .credits-copy p { font-size: clamp(12px, 1.03vw, 14px); line-height: 1.6; }
.work-contribution .credits-copy p + p { margin-top: 6px; }
.work-contribution .credits-tags { margin-top: 8px; font-size: 11px; }

.detail-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-top: 6px; }
.detail-controls:not(:has(> :not([hidden]))) { display: none; }
.player-actions, .film-formats { display: flex; align-items: center; gap: clamp(7px, 1.2vw, 17px); }
.player-actions { margin-left: auto; }
.detail-controls button {
  min-height: 29px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-size: 11px;
}
.detail-controls button:is(:hover, :focus-visible) { color: var(--ink); }
.film-formats button { padding-inline: 7px; border: 1px solid var(--line); }
.film-formats button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.source-frames { margin-top: clamp(12px, 1.8svh, 18px); }
.source-frames h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(14px, 1.35vw, 19px);
  font-weight: 600;
}
.source-frames h2::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.shot-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(7px, .9vw, 13px); }
.shot {
  display: block;
  min-width: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--featured-panel) 65%, #121318);
  text-align: left;
}
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #08090d; }
.shot-caption {
  display: flex;
  align-items: center;
  min-height: clamp(25px, 3.1svh, 32px);
  gap: clamp(5px, .65vw, 9px);
  padding-inline: clamp(7px, .9vw, 12px);
  border-top: 1px solid var(--line);
}
.time { flex: none; color: var(--muted); font: 11px/1 var(--mono); font-variant-numeric: tabular-nums; }
.shot-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: clamp(11px, 1vw, 13px); text-overflow: ellipsis; white-space: nowrap; }
.shot:is(:hover, :focus-visible, [aria-pressed="true"]) { border-color: var(--accent); }
.shot[aria-pressed="true"] .time { color: var(--accent); }
.shot:focus-visible { outline-offset: 2px; }

.detail.is-entering .detail-stage { animation: featured-entry 280ms var(--ease) both; }
@keyframes featured-entry { from { opacity: .35; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }

@media (min-width: 861px) and (min-height: 750px) {
  .project-notes { position: relative; isolation: isolate; }
  .project-notes::after {
    position: absolute;
    z-index: -1;
    inset: auto 0 0 auto;
    width: min(66%, 340px);
    height: min(27%, 122px);
    opacity: .23;
    background: var(--notes-art) center 40% / cover no-repeat;
    mask-image: linear-gradient(110deg, transparent 8%, #000 100%), linear-gradient(transparent, #000 72%);
    mask-composite: intersect;
    pointer-events: none;
    content: "";
  }
  body[data-theme="one-punch"] .project-notes::after { filter: grayscale(1); }
}

@media (max-width: 860px) {
  .detail { --detail-inset: clamp(12px, 3.7vw, 25px); }
  .detail-title { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .detail-title .eyebrow { font-size: 9px; letter-spacing: .1em; }
  .detail-title::after { opacity: .48; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .project-notes { padding: 13px; }
  .project-notes > p, .work-contribution .credits-copy p { font-size: 13px; }
  .work-contribution .credits-tags { font-size: 11px; }
  .detail.is-playing[data-film-format="portrait"] .frame-slot { max-width: min(100%, calc(62svh * 9 / 16)); margin-inline: auto; aspect-ratio: 9 / 16; }
  .detail.is-playing[data-film-format="portrait"] .frame-slot .film-frame { aspect-ratio: 9 / 16; }
  .detail-controls { gap: 5px; margin-top: 5px; }
  .detail-controls button { min-height: 36px; font-size: 10px; }
  .film-formats button { padding-inline: 5px; }
}

@media (max-width: 540px) {
  .shot-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
