@font-face {
  font-family: "Sprayerz";
  src: url("assets/fonts/Sprayerz.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Captions";
  src: url("assets/fonts/Captions.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-ui: "Space Mono", ui-monospace, monospace;
  --font-display: var(--font-spray);
  --font-graffiti: "Captions", var(--font-ui);
  --font-spray: "Sprayerz", var(--font-ui);
  --font-mono: var(--font-ui);
  --bg: #000;
  --panel: #070707;
  --panel-strong: #0d0d0d;
  --line: #242424;
  --line-strong: #f5f5f5;
  --text: #f5f5f5;
  --muted: #8f8f8f;
  --subtle: #5f5f5f;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.01em;
}

body.lightbox-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

code {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

.app-shell,
.app {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid var(--line);
}

body.entity-mode .app {
  grid-template-columns: minmax(0, 1fr) 360px;
}

body.entity-mode .topbar,
body.entity-mode .chrono-strip {
  grid-column: 1 / -1;
}

body.entity-mode main {
  grid-column: 1;
}

main {
  min-height: 0;
  overflow: hidden;
}

.topbar {
  min-height: calc(34px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 280px) auto;
  align-items: stretch;
  padding-top: env(safe-area-inset-top);
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
}

.title,
#search,
.mode-state,
.topbar-button {
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.title {
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#search {
  width: 100%;
  outline: none;
  text-transform: none;
  letter-spacing: 0.02em;
}

#search::placeholder {
  color: var(--subtle);
  text-transform: uppercase;
}

.data-actions {
  display: flex;
  align-items: stretch;
}

.mode-state {
  color: var(--muted);
}

.topbar-button {
  cursor: pointer;
}

.title:hover,
.title:focus-visible,
.topbar-button:hover,
.topbar-button:focus-visible {
  background: #fff;
  color: #000;
}

#search:focus,
.card:focus-visible,
.year-tick:focus-visible,
.sort-toggle:focus-visible,
.year-separator-label:focus-visible,
.overlay-button:focus-visible,
.secondary-button:focus-visible,
.save-record-button:focus-visible,
.chip-button:focus-visible,
.suggestion:focus-visible,
.tag-status-control select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 1px solid var(--line-strong);
  outline-offset: -1px;
}

.chrono-strip {
  min-width: 0;
  height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  background: #000;
  border-bottom: 1px solid var(--line);
}

.chrono-years {
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) #000;
}

.year-tick,
.sort-toggle {
  position: relative;
  min-width: 58px;
  padding: 6px 8px 5px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #000;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

.year-tick::before,
.year-tick::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  pointer-events: none;
}

.year-tick::before {
  bottom: 7px;
  height: 1px;
  background: var(--line);
}

.year-tick::after {
  bottom: 7px;
  width: var(--density, 12%);
  height: 3px;
  background: var(--muted);
}

.year-label,
.year-count {
  position: relative;
  z-index: 1;
  display: block;
}

.year-count {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 8px;
}

.year-tick:hover,
.year-tick.is-active,
.sort-toggle:hover {
  color: #000;
  background: var(--text);
}

.year-tick:hover .year-count,
.year-tick.is-active .year-count {
  color: #000;
}

.year-tick:hover::before,
.year-tick:hover::after,
.year-tick.is-active::before,
.year-tick.is-active::after {
  background: #000;
}

.sort-toggle {
  min-width: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line-strong);
  border-right: 0;
  text-align: center;
}

.tagging-summary {
  min-width: 0;
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--line);
  background: #000;
}

.tag-status-control,
.tag-progress {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-status-control {
  gap: 6px;
  border-right: 1px solid var(--line);
}

.tag-status-control select {
  width: 132px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000;
  color: var(--text);
  font: inherit;
  text-transform: uppercase;
}

.tag-progress {
  max-width: 42vw;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.panel,
.state-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.state-panel {
  margin: 6px;
  padding: 12px;
  color: var(--muted);
  text-align: left;
}

.index-view {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  gap: 4px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg);
}

.history-view {
  height: 100%;
  min-width: 0;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
}

.videos-view {
  height: 100%;
  min-width: 0;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
}

.videos-heading,
.videos-list {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.videos-heading {
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}

.videos-heading h1,
.video-content h2,
.video-entities h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.videos-heading h1 {
  font-size: 18px;
}

.videos-heading p,
.videos-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.videos-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.video-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--panel);
}

.video-media {
  position: relative;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #000;
}

.video-media iframe,
.video-media img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.video-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.video-content {
  min-width: 0;
  padding: 12px;
}

.video-content h2 {
  font-size: 14px;
  line-height: 1.3;
}

.video-description {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.video-description p {
  margin: 0 0 8px;
}

.video-description p:last-child {
  margin-bottom: 0;
}

.video-metadata {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 10px;
}

.video-metadata dt,
.video-metadata dd {
  min-width: 0;
  margin: 0;
  padding: 5px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.video-metadata dt {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.video-metadata dd {
  overflow-wrap: anywhere;
}

.video-entities {
  margin-top: 10px;
}

.video-entities h3 {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
}

.video-chip-list,
.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.video-chip,
.video-entity-link,
.video-source-link {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--text);
  font-size: 10px;
  line-height: 1.2;
  text-decoration: none;
}

.video-entity-link,
.video-source-link {
  cursor: pointer;
}

.video-entity-link:hover,
.video-entity-link:focus-visible,
.video-source-link:hover,
.video-source-link:focus-visible {
  background: #fff;
  color: #000;
  outline: 0;
}

.video-actions {
  margin-top: 12px;
}

.history-article {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: clamp(12px, 3vw, 28px);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.history-article h1,
.history-article h2,
.history-article h3 {
  margin: 2.25em 0 0.8em;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  scroll-margin-top: 12px;
  text-transform: uppercase;
}

.history-article h1 {
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
  font-size: clamp(18px, 3vw, 28px);
}

.history-article h2 {
  padding-top: 1em;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.history-article h3 {
  color: var(--muted);
  font-size: 12px;
}

.history-article p,
.history-article li {
  max-width: 78ch;
}

.history-article p {
  margin: 0 0 1.1em;
}

.history-article hr {
  height: 1px;
  margin: 2em 0;
  border: 0;
  background: var(--line-strong);
}

.history-article em {
  color: var(--muted);
}

.history-article a {
  color: var(--text);
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.history-article a:hover,
.history-article a:focus-visible {
  background: #fff;
  color: #000;
  outline: 0;
  text-decoration: none;
}

.history-entity-link {
  border-bottom: 1px solid var(--line-strong);
  font-weight: 700;
  text-decoration: none !important;
}

.history-list {
  margin: 0 0 1.2em;
  padding-left: 1.3em;
}

.history-list li + li {
  margin-top: 0.4em;
}

.history-table-wrap {
  max-width: 100%;
  margin: 1.4em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
}

.history-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.45;
}

.history-table th,
.history-table td {
  min-width: 120px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.history-table th {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.history-table tr > :last-child {
  border-right: 0;
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-callout {
  max-width: none !important;
  margin: 1.4em 0 !important;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  background: #000;
}

.history-callout-disputed {
  border-left-style: double;
}

.history-footnotes {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.history-footnotes h2 {
  margin-top: 0;
}

.history-footnotes ol {
  margin: 0;
  padding-left: 2em;
}

.history-footnotes li + li {
  margin-top: 0.8em;
}

.history-footnote-backlink {
  white-space: nowrap;
}

.history-error {
  color: var(--muted);
}

.index-section {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: #000;
}

.index-heading {
  margin: 0;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.index-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0;
  padding: 4px;
}

.index-row {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 20px;
  margin: 0 -1px -1px 0;
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  text-align: left;
}

.index-row:last-child {
  border-bottom: 1px solid var(--line);
}

.index-row:hover,
.index-row:focus-visible {
  background: #fff;
  color: #000;
  outline: 1px solid var(--line-strong);
  outline-offset: -1px;
}

.index-label,
.index-count {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}

.index-meta {
  display: none;
}

.index-count {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.index-row:hover .index-label,
.index-row:hover .index-count,
.index-row:focus-visible .index-label,
.index-row:focus-visible .index-count {
  color: #000;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 4px;
  height: 100%;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg);
}

.year-separator {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 22px;
  color: var(--muted);
}

.year-separator.filtered-out {
  display: none !important;
}

.year-separator-line {
  height: 1px;
  background: var(--line);
}

.year-separator-label {
  min-height: 20px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 18px;
  text-transform: uppercase;
}

span.year-separator-label {
  cursor: default;
}

button.year-separator-label:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.card {
  width: 100%;
  padding: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  color: inherit;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 140px 140px;
}

.card.filtered-out {
  display: none !important;
}

.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: var(--line-strong);
  }

  .card:hover img,
  .card:focus-visible img {
    filter: grayscale(0%);
  }
}

.card img.is-loading {
  opacity: 0;
}

.card img.is-ready {
  opacity: 1;
  transition: opacity 120ms linear;
}

.card img.is-error {
  opacity: 0.24;
  filter: grayscale(1);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  background: transparent;
}

.lightbox-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.lightbox-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  border-right: 0;
  touch-action: pan-y;
  cursor: zoom-in;
}

.lightbox-main img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
  will-change: transform;
}

.lightbox.is-zoomed .lightbox-main {
  cursor: grab;
  touch-action: none;
}

.lightbox.is-zoomed .lightbox-main:active {
  cursor: grabbing;
}

.lightbox-sidebar {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: block;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.sidebar-head {
  position: relative;
  z-index: 2;
  isolation: isolate;
  min-width: 0;
  padding: 10px;
  overflow: visible;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-strong);
}

.record-kicker {
  position: relative;
  z-index: 4;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.record-title-box {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: visible;
}

.record-title-accent {
  position: relative;
  z-index: 1;
  max-width: calc(100% + 48px);
  margin: 0 -48px 0 0;
  pointer-events: none;
  font-family: var(--font-display);
}

.sidebar-head h2,
.record-title-accent {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(18px, 2.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
}

.title-field {
  position: relative;
  z-index: 4;
  margin: 10px -10px -10px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
}

.lightbox-sidebar > .sidebar-section,
.sidebar-head ~ .sidebar-section {
  min-height: 0;
}

.sidebar-section {
  position: relative;
  z-index: 3;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.sidebar-section:last-child {
  border-bottom: 0;
}

.sidebar-title {
  margin: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.lightbox-facts,
.record-primary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.fact {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #000;
}

.fact-title {
  min-height: 104px;
}

.fact-title .fact-value {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 44px);
  line-height: 0.95;
}

.fact-artists,
.fact-crews,
.fact-year,
.fact-type {
  min-height: 68px;
}

.fact-location {
  min-height: 68px;
}

.fact-notes {
  min-height: 96px;
}

.fact-full,
.fact-footer {
  grid-column: 1 / -1;
}

.fact:last-child {
  border-bottom: 0;
}

.fact-label,
.fact-value {
  margin: 0;
  padding: 7px 8px;
}

.fact-label {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
}

.fact-value {
  color: var(--text);
  font-size: clamp(16px, 1.5vw, 24px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.fact-footer {
  min-height: 82px;
  grid-template-columns: minmax(96px, 0.34fr) minmax(0, 1fr);
  grid-template-rows: none;
}

.fact-footer .fact-label,
.fact-footer .fact-value {
  padding: 6px 8px;
}

.fact-footer .fact-label {
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.fact-footer .fact-value {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.2;
}

.fact.is-empty .fact-value,
.profile-fact.is-empty .profile-value {
  color: var(--subtle);
}

.metadata-suggestions {
  border-top: 1px solid var(--line);
  background: #000;
}

.metadata-suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid var(--line);
}

.metadata-suggestion-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
}

.metadata-suggestion-text strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.metadata-suggestion-text span {
  color: var(--subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}

.suggestion-apply {
  min-height: 100%;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
}

.exif-details {
  border-top: 1px solid var(--line);
  background: #000;
}

.exif-details summary {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  list-style: none;
  text-transform: uppercase;
}

.exif-details summary::-webkit-details-marker {
  display: none;
}

.exif-details summary::after {
  content: "Closed";
  margin-left: auto;
  color: var(--subtle);
  font-size: 9px;
}

.exif-details[open] summary::after {
  content: "Open";
}

.exif-details-grid {
  display: grid;
  grid-template-columns: minmax(112px, 0.42fr) minmax(0, 1fr);
  max-height: 45vh;
  overflow-y: auto;
}

.exif-details-grid dt,
.exif-details-grid dd {
  margin: 0;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.exif-details-grid dt {
  border-right: 1px solid var(--line);
  color: var(--subtle);
  font-weight: 700;
}

.exif-details-grid dd {
  color: var(--muted);
}

.entity-value {
  display: inline-flex;
  margin: 0 1px;
  padding: 0 2px;
  border: 0;
  background: #000;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
}

.entity-value:hover,
.entity-value:focus-visible {
  background: #fff;
  color: #000;
  text-decoration: none;
}

.field {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.field span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #000;
  color: var(--text);
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.inline-editor,
.inline-fields {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.field-grow {
  flex: 1;
}

.field-year {
  width: 100%;
}

.secondary-button,
.save-record-button,
.danger-button,
.secondary-button,
.chip-button,
.suggestion {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000;
  color: var(--text);
}

.secondary-button {
  padding: 0 9px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.secondary-button:hover,
.save-record-button:hover,
.danger-button:hover,
.suggestion:hover,
.chip-button:hover {
  border-color: var(--line-strong);
}

.danger-section {
  padding: 10px;
}

.danger-button {
  width: 100%;
  min-height: 34px;
  background: #000;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.record-save-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid var(--line);
  background: #000;
}

.save-record-button {
  min-height: 34px;
  padding: 0 10px;
  background: var(--text);
  color: #000;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.save-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.save-status.is-unsaved {
  color: #000;
  background: var(--text);
}

.save-status.is-saving {
  color: var(--text);
}

.save-status.is-saved,
.save-status.is-json {
  color: var(--text);
}

.save-status.is-local {
  color: var(--muted);
}

.save-status.is-failed {
  color: #000;
  background: var(--text);
}

body:not(.edit-mode) .edit-only {
  display: none !important;
}

body:not(.edit-mode) .chip-button {
  cursor: default;
}

.chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.chip-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: -1px 0 0 -1px;
  padding: 6px 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

.chip-button.empty {
  color: var(--subtle);
  cursor: default;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 0;
  padding: 0 10px 10px;
}

.input-match {
  margin: -2px 10px 8px;
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.35;
  text-transform: uppercase;
}

.input-match.is-ambiguous {
  color: var(--text);
}

.suggestion {
  margin: -1px 0 0 -1px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.overlay-button {
  position: absolute;
  z-index: 80;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #000;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.close-btn {
  top: calc(8px + env(safe-area-inset-top));
  left: calc(8px + env(safe-area-inset-left));
}

.prev-btn {
  left: calc(8px + env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

.next-btn {
  right: calc(360px + 8px + env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
}

.profile-sheet {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 120;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 620px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  background: #000;
}

.profile-card {
  position: relative;
  background: var(--panel);
}

.profile-close {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #000;
  color: var(--text);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-kind,
.profile-title {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
}

.profile-kind {
  padding-right: 72px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.profile-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 0.95;
}

.profile-facts {
  display: grid;
  margin: 0;
}

.profile-fact {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.profile-fact-full {
  min-height: 68px;
}

.profile-fact:last-child {
  border-bottom: 0;
}

.profile-label,
.profile-value {
  margin: 0;
  padding: 7px 8px;
}

.profile-label {
  border-right: 1px solid var(--line);
  color: var(--subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-value {
  color: var(--text);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.profile-value a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.profile-image {
  display: block;
  width: min(100%, 220px);
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #000;
}

.profile-image-credit {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin: 0 4px 4px 0;
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none !important;
  text-transform: uppercase;
}

.profile-details {
  display: grid;
  gap: 6px;
}

.profile-details summary {
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-detail-values {
  color: var(--muted);
}

.entity-panel {
  grid-column: 2;
  grid-row: 3;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: visible;
  border-left: 1px solid var(--line-strong);
  background: var(--panel);
}

.entity-clear {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #000;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.entity-clear:hover,
.entity-clear:focus-visible,
.overlay-button:hover,
.overlay-button:focus-visible,
.profile-close:hover,
.profile-close:focus-visible,
.chip-button:not(.empty):hover,
.chip-button:not(.empty):focus-visible,
.suggestion:hover,
.suggestion:focus-visible,
.metadata-suggestion .suggestion-apply:hover,
.metadata-suggestion .suggestion-apply:focus-visible,
.source-chip:hover,
.source-chip:focus-visible,
.profile-details summary:hover,
.profile-details summary:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.save-record-button:hover,
.save-record-button:focus-visible,
.year-tick:hover,
.year-separator-label:hover,
.sort-toggle:hover,
.sort-toggle:focus-visible {
  background: #fff;
  color: #000;
  transition: none;
}

.entity-header {
  position: relative;
  min-height: 98px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.entity-kind {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.entity-title {
  margin: 0;
  padding: 8px 10px 10px;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-transform: uppercase;
}

.entity-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
}

.entity-facts .profile-fact {
  grid-template-columns: 1fr;
  min-height: 72px;
}

.entity-facts .profile-fact-full {
  grid-column: 1 / -1;
}

.admin-shell {
  height: 100dvh;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg);
}

.admin-header,
.admin-section-head,
.admin-row,
.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-header,
.admin-row,
.admin-section-head {
  justify-content: space-between;
  align-items: flex-start;
}

.admin-header {
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line-strong);
}

.admin-header h1,
.admin-copy h3 {
  margin: 0;
  text-transform: uppercase;
}

.eyebrow,
.subtitle,
.admin-meta {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-section {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.admin-section-head {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-section-head h2 {
  margin: 0;
  text-transform: uppercase;
}

.admin-list {
  display: grid;
}

.admin-row {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-copy p {
  margin: 4px 0 0;
}

.admin-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  body.entity-mode .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) minmax(160px, 32vh);
  }

  body.entity-mode main {
    grid-column: 1;
  }

  .entity-panel {
    grid-column: 1;
    grid-row: 4;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
  }

  .entity-title {
    font-size: clamp(20px, 6vw, 30px);
  }

  .topbar {
    grid-template-columns: minmax(140px, 1fr) minmax(120px, 180px);
  }

  .data-actions {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .mode-state,
  .topbar-button {
    flex: 1;
  }

  .chrono-strip {
    height: 40px;
  }

  .year-tick {
    min-width: 64px;
  }

  .lightbox-inner {
    grid-template-columns: 1fr;
    grid-template-rows: 60dvh minmax(0, 40dvh);
  }

  .lightbox-main {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .lightbox-sidebar {
    height: 40dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .next-btn {
    right: calc(8px + env(safe-area-inset-right));
  }
}

@media (max-width: 680px) {
  body {
    font-size: 11px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .history-view {
    padding: 3px;
  }

  .videos-view {
    padding: 3px;
  }

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

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

  .video-content {
    padding: 10px;
  }

  .history-article {
    padding: 14px 12px 22px;
    font-size: 12px;
    line-height: 1.58;
  }

  .history-article h1 {
    font-size: 18px;
  }

  .history-article h2 {
    font-size: 13px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  #search,
  .title {
    border-bottom: 1px solid var(--line);
  }

  .lightbox-inner {
    grid-template-rows: 58dvh minmax(0, 42dvh);
  }

  .sidebar-head h2 {
    font-size: 18px;
  }

  .record-title-box {
    overflow: hidden;
  }

  .record-title-accent {
    max-width: 100%;
    margin-right: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fact-footer {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .fact-artists .fact-value,
  .fact-crews .fact-value {
    font-size: 17px;
  }

  .inline-editor,
  .inline-fields,
  .admin-header,
  .admin-row,
  .admin-section-head {
    flex-direction: column;
  }

  .overlay-button {
    min-height: 28px;
    padding: 0 8px;
  }

  .profile-sheet {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 52vh;
  }

  .profile-fact {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}
