@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #0d100e;
  --surface: #151916;
  --surface-raised: #1b201c;
  --line: #2c332e;
  --line-strong: #465047;
  --text: #f2f4ef;
  --muted: #929b94;
  --accent: #d9ff57;
  --accent-ink: #11150b;
  --coral: #ff7657;
  --cyan: #65d9e8;
  --header-height: 68px;
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
p,
figure,
dl,
dd {
  margin: 0;
  letter-spacing: 0;
}

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 16, 14, 0.94);
  backdrop-filter: blur(18px);
}

.brand,
.site-header nav,
.workspace-controls,
.transport-controls,
.transport-options,
.transport-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "DM Mono", monospace;
  font-size: 17px;
  font-weight: 500;
  transform: skew(-5deg);
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 14px;
}

.brand-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.site-header nav {
  gap: 24px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a.is-active {
  color: var(--text);
}

.site-header nav a.is-active {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

main {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

.study-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.selection-title > span,
.study-summary dt,
.study-summary dd,
.video-pane figcaption small,
.page-status,
.timeline-row,
.speed-control span,
.contact-sheet header > span {
  font-family: "DM Mono", monospace;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
}

.study-heading h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 52px;
  line-height: 1;
}

.study-heading > div > p:last-child {
  margin-top: 13px;
  color: var(--muted);
  font-size: 15px;
}

.study-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  min-width: min(100%, 480px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.study-summary > div {
  padding: 13px 15px;
  border-right: 1px solid var(--line);
}

.study-summary > div:last-child {
  border-right: 0;
}

.study-summary dt {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.study-summary dd {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
}

.study-shell {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  min-height: 720px;
  margin-top: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.method-library {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #111411;
}

.library-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.library-heading h2 {
  font-size: 15px;
}

.count-badge {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.method-list {
  display: grid;
}

.method-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  min-height: 72px;
  padding: 13px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.method-button:hover {
  background: var(--surface-raised);
}

.method-button.is-active {
  background: var(--surface-raised);
  box-shadow: inset 3px 0 var(--accent);
}

.method-number {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
}

.method-button strong,
.method-button small {
  display: block;
  min-width: 0;
}

.method-button strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.method-button small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.workspace {
  min-width: 0;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.selection-title > span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.selection-title h2 {
  margin-top: 5px;
  font-size: 18px;
}

.workspace-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.segmented-control {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #101310;
}

.segmented-control button {
  min-height: 31px;
  padding: 0 11px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.segmented-control button:hover {
  color: var(--text);
}

.segmented-control button.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.icon-button,
.round-button,
.loop-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button {
  display: grid;
  width: 39px;
  height: 39px;
  padding: 0;
  place-items: center;
  border-radius: 4px;
  font-size: 18px;
}

.comparison-viewer {
  padding: 18px;
  background: #0a0c0a;
}

.pair-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
  max-width: 820px;
  margin: 0 auto;
}

.video-pane {
  min-width: 0;
}

.video-pane figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 35px;
  padding: 0 2px 9px;
  font-size: 11px;
  font-weight: 600;
}

.video-pane figcaption small {
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.portrait-frame,
.overlay-frame,
.four-up-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #080a08;
}

.portrait-frame {
  height: min(59vh, 600px);
  min-height: 390px;
}

.portrait-frame video,
.overlay-frame video,
.four-up-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
  pointer-events: none;
}

.is-ready > .video-status {
  display: none;
}

.output-pane .portrait-frame {
  border-top: 2px solid var(--accent);
}

.reference-pane .portrait-frame {
  border-top: 2px solid var(--cyan);
}

.comparison-divider {
  display: grid;
  height: 100%;
  place-items: center;
}

.comparison-divider span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #0a0c0a;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 8px;
}

.overlay-view,
.four-up-view {
  display: none;
}

.comparison-viewer[data-mode="overlay"] .pair-view,
.comparison-viewer[data-mode="four-up"] .pair-view {
  display: none;
}

.comparison-viewer[data-mode="overlay"] .overlay-view,
.comparison-viewer[data-mode="four-up"] .four-up-view {
  display: block;
}

.overlay-frame {
  width: min(100%, 500px);
  aspect-ratio: 496 / 864;
  max-height: 66vh;
  margin: 0 auto;
  border-top: 2px solid var(--coral);
  --split: 50%;
}

.overlay-frame video {
  position: absolute;
  inset: 0;
}

.overlay-frame .overlay-output {
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}

.overlay-frame input {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.overlay-divider {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1px;
  background: var(--accent);
  pointer-events: none;
}

.overlay-divider i {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-style: normal;
  transform: translate(-50%, -50%);
}

.overlay-label {
  position: absolute;
  z-index: 3;
  top: 12px;
  padding: 6px 8px;
  border-radius: 2px;
  background: rgba(7, 9, 7, 0.82);
  font-family: "DM Mono", monospace;
  font-size: 8px;
  pointer-events: none;
}

.label-output { left: 12px; color: var(--accent); }
.label-reference { right: 12px; color: var(--cyan); }

.four-up-frame {
  aspect-ratio: 1984 / 864;
  border-top: 2px solid var(--coral);
}

.transport {
  padding: 13px 18px 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #111411;
}

.timeline-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 9px;
}

.timeline-row span:last-child {
  text-align: right;
}

input[type="range"] {
  accent-color: var(--accent);
}

.transport-row {
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
}

.transport-controls,
.transport-options {
  gap: 8px;
}

.round-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
}

.round-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.volume {
  width: 80px;
}

.playback-state {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.speed-control span {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.speed-control select,
.loop-button {
  min-height: 32px;
  border-radius: 4px;
}

.speed-control select {
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 10px;
}

.loop-button {
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.loop-button.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.method-detail {
  display: grid;
  grid-template-columns: 190px minmax(240px, 1fr) auto;
  align-items: center;
  gap: 26px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--line);
}

.method-detail h2,
.contact-sheet h2 {
  font-size: 16px;
}

.method-detail > p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.method-detail dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  border: 1px solid var(--line);
}

.method-detail dl > div {
  padding: 9px 11px;
  border-right: 1px solid var(--line);
}

.method-detail dl > div:last-child {
  border-right: 0;
}

.method-detail dt {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 7px;
  text-transform: uppercase;
}

.method-detail dd {
  margin-top: 5px;
  font-family: "DM Mono", monospace;
  font-size: 9px;
}

.contact-sheet {
  padding: 22px 20px 24px;
}

.contact-sheet header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 13px;
}

.contact-sheet header > span {
  color: var(--muted);
  font-size: 8px;
}

.contact-sheet img {
  display: block;
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  background: #080a08;
  object-fit: contain;
}

.page-status {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #171c18;
  color: var(--muted);
  font-size: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.page-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  main {
    width: min(100% - 36px, 1100px);
  }

  .study-heading {
    align-items: start;
    flex-direction: column;
  }

  .study-summary {
    width: 100%;
  }

  .study-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .workspace-header {
    align-items: start;
    flex-direction: column;
  }

  .workspace-controls {
    justify-content: flex-start;
  }

  .method-detail {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .method-detail dl {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 0 18px;
  }

  .site-header nav {
    gap: 12px;
  }

  .site-header nav a:not(.is-active) {
    display: none;
  }

  main {
    width: calc(100% - 24px);
    padding-top: 24px;
  }

  .study-heading h1 {
    font-size: 36px;
  }

  .study-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-summary > div:nth-child(2) {
    border-right: 0;
  }

  .study-summary > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .study-shell {
    display: block;
  }

  .method-library {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .method-list {
    grid-auto-columns: minmax(190px, 70vw);
    grid-auto-flow: column;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .method-button {
    border-right: 1px solid var(--line);
    scroll-snap-align: start;
  }

  .comparison-viewer {
    padding: 12px;
  }

  .pair-view {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  }

  .portrait-frame {
    height: 54vh;
    min-height: 320px;
  }

  .comparison-divider span {
    width: 22px;
    height: 22px;
    font-size: 7px;
  }

  .video-pane figcaption {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .transport-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .playback-state {
    order: 3;
    width: 100%;
  }

  .method-detail {
    grid-template-columns: 1fr;
  }

  .method-detail dl {
    grid-column: auto;
  }
}

@media (max-width: 460px) {
  .workspace-controls {
    width: 100%;
  }

  .segmented-control {
    max-width: 100%;
    overflow-x: auto;
  }

  .segmented-control button {
    padding-inline: 9px;
  }

  .icon-button {
    margin-left: auto;
  }

  .portrait-frame {
    height: 46vh;
    min-height: 270px;
  }

  .volume {
    width: 56px;
  }

  .speed-control span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .page-status {
    transition: none;
  }
}
