@import "tokens.css";

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

::selection {
  background: var(--mark);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: var(--space-2);
  top: -48px;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-3);
  z-index: 2;
}

.skip:focus { top: var(--space-2); }

header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 3px solid var(--mark);
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 28px 16px;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}

.name {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: normal;
  letter-spacing: -0.05em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.name .tok {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.07em;
}

.name .cut { color: var(--mark); }

.bar .name { font-size: 22px; }

nav { display: flex; gap: 18px; flex-shrink: 0; }

nav a {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { color: var(--mark); }

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: var(--space-5) 28px var(--space-9);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5) var(--space-6);
  align-items: start;
}

.lede,
.stage-wrap,
.desk { min-width: 0; }

h1,
h2 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

h1.name {
  margin: 8px 0 14px;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: normal;
  font-size: clamp(36px, 12vw, 104px);
  line-height: 0.86;
}

.lede p {
  max-width: 38rem;
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.serve-hint {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--mark);
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.serve-hint code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

body.is-live .serve-hint { display: none; }

.stage-wrap { align-self: start; }

.preview { display: none; }

.theater {
  margin: 8px -28px 36px;
  padding: 22px 28px 18px;
  background: #07090f;
}

.film {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #07090f;
  object-fit: contain;
}

.film-note {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #b7c0d6;
}

.stills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.still {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #2a3144;
  background: #07090f;
  cursor: pointer;
}

.still img {
  display: block;
  width: 100%;
  height: auto;
}

.still:hover,
.still.is-on,
.still:focus-visible {
  border-color: #e23b4a;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--film-ink);
  outline: 1px solid var(--ink);
  overflow: hidden;
}

.stage svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rain,
.rain-far {
  position: absolute;
  left: 0;
  right: 0;
  top: 6%;
  bottom: 10%;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    98deg,
    transparent 0 18px,
    color-mix(in srgb, var(--film-line) 55%, transparent) 18px 19px
  );
  background-size: 140px 180px;
  animation: rain 720ms steps(4, end) infinite;
  opacity: 0.55;
}

.rain-far {
  opacity: 0.28;
  background-size: 90px 120px;
  animation-duration: 480ms;
}

@keyframes rain {
  to { background-position: -28px 180px; }
}

.shot-close,
.fig-b,
.fig-reach,
.flare,
.eyes-shut,
.cap { opacity: 0; }

.cap {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 500;
  fill: var(--film-practical);
}

.stage[data-shot="close"] .shot-close,
.stage[data-pose="b"] .fig-b,
.stage[data-flare="on"] .flare,
.stage[data-flare="on"] .fig-reach,
.stage[data-pose="blink"] .eyes-shut,
.stage[data-shot="close"] .cap { opacity: 1; }

.stage[data-pose="b"] .fig-a,
.stage[data-flare="on"] .fig-a,
.stage[data-flare="on"] .fig-b,
.stage[data-pose="blink"] .eyes-open { opacity: 0; }

.slate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

#counter {
  color: var(--mark);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

#hold {
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
}

#hold:hover { background: var(--ink); color: var(--paper); }
#hold:active { transform: translateY(1px); }

.times { position: relative; margin-top: 8px; }

.cells {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  height: 36px;
  border: 1px solid var(--ink);
  background: var(--paper-2);
}

.cells i {
  border-right: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  color: var(--ink-soft);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
}

.cells i:last-child { border-right: 0; }
.cells i.cut { box-shadow: inset 0 4px 0 var(--mark); }
.cells i.on { background: var(--ink); color: var(--paper); }

.times:focus-within .cells {
  outline: 2px solid var(--mark);
  outline-offset: 3px;
}

.times input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 36px;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.desk {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 18px;
}

.desk-fields,
.desk-out {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.desk-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span,
.seg-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

textarea,
input[type="text"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 12px;
}

textarea { min-height: 96px; resize: vertical; }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.seg label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  background: var(--field);
  color: var(--ink);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}

.seg label:has(input:checked) {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.seg label:has(input:focus-visible) {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--film-accent);
}

#out,
#command {
  margin: 0;
  min-width: 0;
  background: var(--ink);
  color: var(--paper-2);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}

#out { max-height: 240px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.actions button {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: var(--mark);
  color: #fff;
  border: 1px solid var(--mark);
  border-radius: 2px;
  padding: 12px 16px;
  cursor: pointer;
}

.actions button:hover { background: var(--mark-deep); }
.actions button:active { transform: translateY(1px); }

.actions button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.actions button.secondary:hover { background: var(--ink); color: var(--paper); }
.actions button:disabled { opacity: 0.4; cursor: not-allowed; }

#status {
  min-height: 1.25em;
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

#status[data-kind="err"] { color: var(--mark); }

#skills,
#agents { margin-top: var(--space-9); }

h2 {
  margin: 0 0 8px;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.section-lead {
  margin: 0 0 20px;
  max-width: 38rem;
  color: var(--ink-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: baseline;
  padding: 16px 12px 16px 0;
  border-top: 1px solid var(--rule);
}

th {
  width: 7.5rem;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  font-style: normal;
}

th a {
  color: inherit;
  text-decoration: none;
}

td { color: var(--ink-soft); }

tr:hover th a { color: var(--mark); }
tr:last-child th,
tr:last-child td { border-bottom: 1px solid var(--rule); }

#agent-note { margin: 0 0 12px; }

footer {
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 20px 0 48px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 14px;
}

footer a { color: var(--ink); }

@media (min-width: 960px) {
  .hero-rest .desk {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    column-gap: 28px;
    align-items: start;
  }
  .desk-title { grid-column: 1 / -1; }
  #out { max-height: 460px; }
}

@media (max-width: 959px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .lede { grid-column: auto; }
  .bar { flex-wrap: wrap; }
  nav { gap: 14px; }
}

@media (max-width: 640px) {
  .bar,
  main { padding-inline: 16px; }
  .bar { flex-direction: column; align-items: flex-start; }
  nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .theater { margin-inline: -16px; padding-inline: 16px; }
  .stills { grid-template-columns: 1fr 1fr; }
  footer { width: min(1180px, calc(100% - 32px)); }
  .bar .name { font-size: 18px; }
  nav { gap: 12px; }
  nav a { font-size: 14px; }
  th { width: 5.5rem; font-size: 18px; }
  .desk { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .rain,
  .rain-far { animation: none; }
  .stage-wrap { position: static; }
  #hold:active,
  .actions button:active { transform: none; }
}
