/* DarthDesk: a contact sheet of things Carlos has built. Screenshots carry the page; chrome stays quiet. */

:root {
  --bg: rgb(25 25 25);
  --surface: #222222;
  --ink: #e8e8e8;
  --muted: #8f8f8f;
  --line: #333333;
  --plate: #2a2a2a;
  --accent: #7c9bff;
  --accent-ink: #0f1420;
  --danger: #ff7a6e;
  --live: #3ccf8a;
  --building: #e8ad3b;
  --paused: #8f8f8f;
  --archived: #626262;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -14px rgb(0 0 0 / 0.6);
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Buttons and fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, transform 80ms;
}
.btn:hover {
  border-color: var(--muted);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--ink) 86%, var(--bg));
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.btn-quiet:hover {
  color: var(--ink);
  border-color: transparent;
}
.btn-danger {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
  padding-left: 0;
}
.btn-danger:hover {
  border-color: transparent;
  text-decoration: underline;
}

.field {
  display: grid;
  gap: 5px;
}
.field > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 15px;
}
textarea.input {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  resize: vertical;
}
select.input {
  padding-right: 28px;
}
.input:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

/* ---------- Header ---------- */

.top {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 40px 8px;
}
.top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.035em;
  line-height: 1;
}
.count {
  margin: 10px 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.search {
  flex: 1 1 220px;
  max-width: 320px;
  height: 36px;
  background: var(--surface);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.filter {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.filter:hover {
  color: var(--ink);
}
.filter[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.filter .n {
  margin-left: 5px;
  color: var(--muted);
}
.tag-select {
  width: auto;
  height: 32px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.tag-select:hover {
  color: var(--ink);
}
.toolbar .spacer {
  flex: 1;
}

/* ---------- Grid ---------- */

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 40px 80px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 26px 20px;
}

.card {
  position: relative;
  min-width: 0;
}
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 9px;
}
.plate {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 9px;
  background: var(--plate);
  box-shadow: var(--shadow);
}
.plate::after {
  /* Hairline edge so white homepages don't melt into the page. */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(127 140 160 / 0.22);
  pointer-events: none;
}
.plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transition: opacity 300ms ease-out;
}
.plate img.loaded {
  opacity: 1;
}
a.card-link:hover .plate::after {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent);
}

.card[data-status="archived"] .plate img {
  filter: grayscale(1) contrast(0.92);
  opacity: 0.55;
}
.card[data-status="archived"] .card-name {
  color: var(--muted);
}

/* Placeholder when there is no image yet. */
.blank {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  gap: 2px;
  padding: 12px 14px;
}
.blank-host {
  font-size: 18px;
  font-weight: 650;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: color-mix(in srgb, var(--ink) 30%, var(--plate));
  overflow-wrap: anywhere;
}
.blank-note {
  font-size: 12px;
  color: var(--muted);
}
.blank[data-state="pending"] .blank-note::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.card-name {
  margin: 0;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  font-variation-settings: "opsz" 28;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pin {
  width: 11px;
  height: 11px;
  margin-right: 5px;
  vertical-align: 0;
  color: var(--accent);
}
.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--paused);
}
.status[data-s="live"]::before {
  background: var(--live);
}
.status[data-s="building"]::before {
  background: var(--building);
}
.status[data-s="archived"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--archived);
}
.card-host {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-desc {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin-top: 5px;
}
.tag {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.tag:hover {
  color: var(--accent);
}

/* Floating controls over the plate. */
.card-edit,
.plate-action {
  position: absolute;
  top: 7px;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.card-edit {
  right: 7px;
  opacity: 0;
  transition: opacity 120ms;
}
.plate-action {
  left: 7px;
}
.card:hover .card-edit,
.card:focus-within .card-edit {
  opacity: 1;
}
@media (hover: none) {
  .card-edit {
    opacity: 1;
  }
}

/* ---------- Empty and loading ---------- */

.empty {
  max-width: 460px;
  padding: 64px 0;
}
.empty h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.empty p {
  margin: 10px 0 22px;
  color: var(--muted);
  text-wrap: pretty;
}
.notice {
  color: var(--muted);
  padding: 40px 0;
}

/* ---------- Dialog ---------- */

dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px -16px rgb(0 0 0 / 0.4);
}
dialog::backdrop {
  background: rgb(14 18 24 / 0.45);
  backdrop-filter: blur(2px);
}
dialog[open] {
  animation: dialog-in 160ms ease-out;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}
.dialog-form {
  display: grid;
  gap: 0;
}
.dialog-head {
  padding: 22px 24px 0;
}
.dialog-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dialog-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding: 20px 24px;
}
.dialog-body .wide {
  grid-column: 1 / -1;
}
.hint {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.shot-box {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
}
.shot-box .plate {
  box-shadow: none;
  border-radius: 7px;
}
.shot-box .blank {
  padding: 10px;
}
.shot-box .blank-host {
  font-size: 15px;
}
.shot-box .blank-note {
  font-size: 11.5px;
}
.shot-meta {
  display: grid;
  gap: 10px;
}
.shot-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.shot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.form-error {
  margin: 0;
  padding: 0 24px;
  color: var(--danger);
  font-size: 14px;
}
.form-error:empty {
  display: none;
}
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 20px;
}
.dialog-foot .spacer {
  flex: 1;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms, transform 160ms;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Login ---------- */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-form {
  width: min(340px, 100%);
  display: grid;
  gap: 14px;
}
.login-form .wordmark {
  margin-bottom: 18px;
}
.login-form .btn {
  height: 40px;
}
.login-error {
  min-height: 21px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .top {
    padding: 24px 16px 4px;
  }
  main {
    padding: 24px 16px 64px;
  }
  .toolbar {
    margin-top: 20px;
  }
  .search {
    max-width: none;
    flex-basis: 100%;
  }
  .toolbar .spacer {
    display: none;
  }
  .dialog-body {
    grid-template-columns: 1fr;
    padding: 18px 18px;
  }
  .dialog-head {
    padding: 20px 18px 0;
  }
  .dialog-foot {
    padding: 14px 18px 18px;
  }
  .form-error {
    padding: 0 18px;
  }
  .shot-box {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
