:root {
  --paper: #f6f3ec;
  --ink: #161514;
  --muted: #6d6961;
  --line: rgba(22, 21, 20, 0.16);
  --soft: rgba(255, 255, 255, 0.5);
  --dark: #10100f;
  --accent: #6d1d28;
  --section-bg: #ebe7dd;
  --library-bg: #f8f7f3;
  --panel-bg: rgba(255, 255, 255, 0.5);
  --asset-bg: #ded9d0;
  --hero-overlay: linear-gradient(90deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.18) 58%, rgba(0, 0, 0, 0.14)), linear-gradient(0deg, rgba(0, 0, 0, 0.42), transparent 42%);
  --header-h: 66px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  letter-spacing: 0;
  color: var(--ink);
  transition: background 280ms ease, color 280ms ease;
}

button,
input,
textarea,
select {
  font: inherit;
  max-width: 100%;
}

button,
select,
label.import-label {
  cursor: pointer;
}

.site-header {
  position: fixed;
  z-index: 40;
  inset: 0 0 auto;
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  padding: 0 clamp(16px, 4vw, 44px);
  color: #fff;
  mix-blend-mode: difference;
}

.brand-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: grid;
  gap: 2px;
  justify-items: start;
  text-transform: uppercase;
}

.brand-button span {
  font-size: 13px;
  letter-spacing: 0.16em;
}

.brand-button small {
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.76;
}

.nav {
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav a {
  color: inherit;
  text-decoration: none;
}

.nav a.is-hidden {
  display: none;
}

.header-tools {
  justify-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
}

.version-select {
  max-width: 190px;
  height: 34px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.version-select option {
  color: var(--ink);
}

.text-button,
.outline-button,
.primary-button {
  min-height: 38px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

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

.outline-button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 10px;
}

.hero {
  position: relative;
  min-height: 92svh;
  overflow: hidden;
  color: #fff;
  display: grid;
  align-items: end;
  isolation: isolate;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-overlay);
}

.hero-copy {
  max-width: 820px;
  padding: calc(var(--header-h) + 30px) clamp(18px, 5vw, 64px) clamp(44px, 7vw, 90px);
}

.kicker {
  margin: 0 0 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.hero .kicker,
.film-section .kicker {
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(48px, 9vw, 122px);
  line-height: 0.9;
  max-width: 9ch;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(34px, 5.8vw, 80px);
  line-height: 0.98;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 500;
}

.hero-copy p {
  max-width: 760px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.84);
}

.film-section {
  min-height: 100svh;
  padding: 0;
  position: relative;
  background: #11100f;
  color: var(--paper);
  isolation: isolate;
}

.film-section.is-hidden {
  display: none;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.64fr);
  gap: clamp(22px, 5vw, 70px);
  align-items: end;
  margin-bottom: clamp(22px, 4vw, 40px);
}

.film-section > .section-heading {
  position: absolute;
  z-index: 10;
  top: clamp(78px, 10vw, 118px);
  left: clamp(18px, 5vw, 64px);
  right: clamp(18px, 5vw, 64px);
}

.section-copy {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.film-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #151413;
}

.film-video,
.film-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  filter: contrast(1.03) saturate(0.9);
}

.film-fallback {
  z-index: -1;
}

.film-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.58), transparent 48%, rgba(0, 0, 0, 0.24)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.58), transparent 34%);
}

.film-caption {
  position: absolute;
  z-index: 4;
  left: clamp(18px, 5vw, 64px);
  right: clamp(18px, 5vw, 64px);
  bottom: clamp(26px, 5vw, 60px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
}

.film-caption p {
  max-width: 590px;
  margin-bottom: 0;
  color: rgba(246, 243, 236, 0.82);
  line-height: 1.55;
}

.film-caption span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(246, 243, 236, 0.72);
}

.section {
  padding: clamp(56px, 8vw, 110px) clamp(18px, 5vw, 64px);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  padding: 0 13px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2.5vw, 32px);
}

.asset-card {
  display: grid;
  gap: 12px;
}

.asset-card button {
  padding: 0;
  border: 0;
  background: transparent;
  display: block;
  position: relative;
}

.asset-card.selected button::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}

.asset-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: var(--asset-bg);
}

.asset-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.asset-meta small {
  color: var(--muted);
  font-size: inherit;
}

.asset-tags {
  min-height: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.asset-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.material-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(300px, 1fr);
  gap: clamp(22px, 5vw, 70px);
  background: var(--section-bg);
}

.material-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.material-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.material-specs div {
  min-height: 128px;
  padding: 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  align-content: start;
}

.material-specs b {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

.material-specs span {
  color: var(--muted);
  line-height: 1.5;
}

.library-section {
  background: var(--library-bg);
}

.library-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 4vw, 46px);
}

.library-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.library-grid,
.job-list {
  display: grid;
  gap: 10px;
}

.library-card,
.job-card {
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--ink);
  text-align: left;
}

.library-card {
  min-height: 92px;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
}

.library-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.library-card span {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.library-card small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.editor-section {
  padding: clamp(56px, 8vw, 110px) clamp(18px, 5vw, 64px);
  background: #161514;
  color: var(--paper);
}

.editor-login-section {
  padding: clamp(74px, 10vw, 130px) clamp(18px, 5vw, 64px);
  background: var(--section-bg);
  color: var(--ink);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(320px, 0.64fr);
  gap: clamp(22px, 5vw, 70px);
  align-items: start;
}

.login-panel h2 {
  max-width: 9ch;
}

.login-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  padding: clamp(18px, 3vw, 28px);
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.login-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  padding: 10px 12px;
}

.login-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.36fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: start;
}

.selected-panel,
.editor-main {
  border: 1px solid rgba(246, 243, 236, 0.16);
  background: rgba(255, 255, 255, 0.04);
  padding: clamp(18px, 3vw, 28px);
}

.selected-preview {
  width: 100%;
  aspect-ratio: 4 / 5;
  background-size: cover;
  background-position: center;
  margin-bottom: 16px;
  border: 1px solid rgba(246, 243, 236, 0.18);
}

.selected-panel p,
.editor-section .section-copy,
.job-card p {
  color: rgba(246, 243, 236, 0.68);
  line-height: 1.6;
}

.quick-actions,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: rgba(246, 243, 236, 0.74);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.form-grid label.wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea,
.prompt-preview {
  width: 100%;
  border: 1px solid rgba(246, 243, 236, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  padding: 12px;
  line-height: 1.5;
  resize: vertical;
}

.import-label input {
  display: none;
}

.job-board {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.job-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(246, 243, 236, 0.16);
}

.job-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.job-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(246, 243, 236, 0.18);
  padding: 0 8px;
  color: rgba(246, 243, 236, 0.76);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 9px;
  white-space: nowrap;
}

.job-status.completed {
  border-color: rgba(180, 220, 176, 0.38);
  color: rgba(210, 242, 205, 0.88);
}

.job-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}

.job-progress {
  margin-top: 8px;
  color: rgba(246, 243, 236, 0.54);
  font-size: 12px;
}

.job-result {
  width: 100%;
  margin: 10px 0;
  padding: 0;
  border: 1px solid rgba(246, 243, 236, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper);
  display: grid;
  text-align: left;
}

.job-result img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.job-result span {
  padding: 9px 10px 10px;
  color: rgba(246, 243, 236, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.job-card small {
  color: rgba(246, 243, 236, 0.48);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.72);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.asset-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  border: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

.asset-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.asset-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 0.74fr) minmax(280px, 0.36fr);
}

.asset-dialog img {
  width: 100%;
  height: min(86svh, 860px);
  object-fit: cover;
  display: block;
}

.dialog-copy {
  padding: clamp(22px, 4vw, 42px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dialog-copy h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  font-weight: 400;
}

.dialog-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(246, 243, 236, 0.88);
  color: var(--ink);
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .nav {
    display: none;
  }

  .section-heading,
  .material-section,
  .library-layout,
  .editor-shell,
  .editor-top,
  .job-board,
  .asset-dialog[open] {
    grid-template-columns: 1fr;
  }

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

  h1 {
    max-width: 11ch;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 98px;
  }

  .site-header {
    height: auto;
    min-height: var(--header-h);
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: center;
    padding: 10px 14px 12px;
    color: var(--ink);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    mix-blend-mode: normal;
  }

  .brand-button {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .brand-button span,
  .brand-button small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-tools {
    width: 100%;
    justify-self: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }

  .version-select {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    color: var(--ink);
    background: var(--paper);
    font-size: 10px;
  }

  .hero {
    min-height: 82svh;
    align-items: end;
  }

  .film-section {
    min-height: 84svh;
  }

  .film-caption {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: calc(var(--header-h) + 22px) 16px 34px;
  }

  h1 {
    font-size: clamp(40px, 15vw, 64px);
    line-height: 0.94;
    max-width: 10ch;
  }

  h2 {
    font-size: clamp(30px, 10vw, 46px);
  }

  .hero-copy p {
    max-height: 11.5em;
    overflow: auto;
    font-size: 13px;
  }

  .section {
    padding: 46px 16px;
  }

  .section-heading {
    gap: 14px;
    margin-bottom: 22px;
  }

  .section-copy {
    font-size: 14px;
  }

  .filter-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
  }

  .chip {
    flex: 0 0 auto;
  }

  .asset-grid,
  .login-panel,
  .material-specs,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .asset-meta {
    grid-template-columns: 1fr;
  }

  .library-card {
    grid-template-columns: 58px 1fr;
  }

  .library-card small {
    grid-column: 2;
  }

  .library-head {
    display: grid;
    align-items: start;
  }

  .editor-section {
    padding: 46px 16px;
  }

  .editor-login-section {
    padding: 54px 16px;
  }

  .editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .job-card-top {
    grid-template-columns: 1fr;
  }

  .text-button,
  .outline-button,
  .primary-button {
    min-height: 42px;
    padding: 0 12px;
  }

  .asset-dialog {
    width: min(100vw - 18px, 520px);
    max-height: calc(100svh - 18px);
  }

  .asset-dialog img {
    height: 54svh;
  }

  .dialog-copy {
    padding: 18px;
  }
}
