/* Project cards and the admin's blueprint editor. Builds on site.css. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ cards */

.project h3 { overflow-wrap: anywhere; }
.project .chips { margin-top: 0; padding-top: 0; }

/* Bleeds to the bevel: card padding minus the 2px inset edge. */
.card-img {
  display: block;
  width: calc(100% + 36px);
  height: auto;
  aspect-ratio: 16 / 9;
  margin: -16px -18px 4px;
  object-fit: cover;
  background: var(--panel-lo);
  box-shadow: 0 2px 0 var(--edge);
}

.card-badges { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.card-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.card .led.down { background: var(--red); box-shadow: 0 0 0 2px var(--edge), 0 0 8px var(--red); }

.card-foot { margin-top: auto; padding-top: 6px; display: grid; gap: 6px; }
.card-links { flex-wrap: wrap; }

.gh { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; color: var(--muted); font-size: 12px; }
.gh-star { color: var(--accent); }
.gh-sep { margin: 0 8px; color: var(--faint); }

/* ------------------------------------------------------------ admin controls */

.btn-mini {
  font: 11px/1 var(--pixel);
  color: var(--ink);
  background: #3a3631;
  border: 0;
  padding: 6px 9px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 #57524b, inset -1px -1px 0 var(--panel-lo), 0 0 0 2px var(--edge);
}
.btn-mini:hover { color: var(--accent); }
.btn-mini:active { box-shadow: inset -1px -1px 0 #57524b, inset 1px 1px 0 var(--panel-lo), 0 0 0 2px var(--edge); }
.btn-mini.danger { color: #ff9c88; }
.btn-mini.danger-solid { background: var(--red); color: #1e0905; box-shadow: inset 1px 1px 0 #ff9c88, inset -1px -1px 0 #8a2a1a, 0 0 0 2px var(--edge); }
.btn-mini.danger-solid:hover { color: #1e0905; background: #f06a52; }
.btn-mini:disabled,
.btn-mini[aria-disabled='true'] { opacity: 0.4; cursor: default; color: var(--ink); }
.btn-mini[hidden] { display: none; }

.card-admin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 2px dashed #3a3631;
}
.card-admin-gap { flex: 1; }
.card-confirm { flex: 1 1 100%; font-size: 13px; color: var(--ink); }
.card-note { margin: 0; color: var(--red); font-size: 12px; }
.card-note:empty { display: none; }

.projects-error { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* The "new project" card is an unbuilt blueprint: grid paper, dashed outline. */
.card-new {
  position: relative;
  min-height: 200px;
  padding: 26px 28px;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  border: 0;
  font: inherit;
  text-align: left;
  color: var(--cyan);
  cursor: pointer;
  background-color: #10283a;
  background-image:
    linear-gradient(rgba(143, 232, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 232, 255, 0.09) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: -1px -1px;
  box-shadow: inset 2px 2px 0 #1d4560, inset -2px -2px 0 #081622, 0 0 0 2px var(--edge);
}
.card-new::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px dashed rgba(143, 232, 255, 0.4);
  pointer-events: none;
}
.card-new:hover::before { border-color: var(--cyan); }
.card-new-plus { font: 32px/1 var(--pixel); }
.card-new-title { font: 17px/1.15 var(--pixel); }
.card-new-hint { font-size: 13px; color: rgba(143, 232, 255, 0.72); }

/* ------------------------------------------------------------ editor dialog */

html:has(.pdlg[open]) { overflow: hidden; }

.pdlg {
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 2px; /* keeps the panel bevel visible around the scrolling body */
  border: 0;
  color: var(--ink);
  overflow: hidden;
}
.pdlg[open] { display: flex; flex-direction: column; }
.pdlg::backdrop { background: rgba(8, 7, 5, 0.78); }

.pdlg-form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }

.pdlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: #23211e;
  border-bottom: 2px solid var(--edge);
}
.pdlg-head h2 { font-size: 20px; margin-top: 6px; overflow-wrap: anywhere; }
.pdlg-x { font-size: 16px; padding: 4px 8px; }

.pdlg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
}

.pdlg-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.pdlg-field.wide, .pdlg-formerr { grid-column: 1 / -1; }
.pdlg fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pdlg legend { padding: 0; float: left; width: 100%; } /* float puts the legend inside the grid */

.pdlg-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pdlg-label,
.pdlg-label label { font: 12px/1.2 var(--pixel); color: var(--muted); }
.pdlg-count { font-size: 11px; color: var(--faint); }
.pdlg-count.over { color: var(--red); }
.pdlg-hint { margin: 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
.pdlg-err { margin: 0; color: var(--red); font-size: 12px; line-height: 1.5; }
.pdlg-err[hidden], .pdlg-formerr[hidden], .pdlg-page[hidden] { display: none; }

.pdlg textarea {
  width: 100%;
  font: 14px/1.5 var(--mono);
  color: var(--ink);
  background: var(--panel-lo);
  border: 0;
  padding: 8px 10px;
  resize: vertical;
  box-shadow: inset 2px 2px 0 var(--edge), inset -1px -1px 0 #3a3631;
}
.pdlg textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.pdlg .pdlg-md { font-size: 13px; min-height: 180px; }
.pdlg input[readonly] { color: var(--muted); background: #1a1815; }
.pdlg input:disabled, .pdlg textarea:disabled { opacity: 0.6; }
.pdlg [aria-invalid='true'] { box-shadow: inset 2px 2px 0 var(--edge), 0 0 0 2px var(--red); }

/* Status as a segmented control; the radios stay real for keyboard and AT. */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--edge); justify-self: start; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg label {
  font: 12px/1 var(--pixel);
  padding: 8px 12px;
  color: var(--ink);
  background: #3a3631;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 #57524b, inset -1px -1px 0 var(--panel-lo);
}
.seg label:hover { color: var(--accent); }
.seg input:checked + label { box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.35), inset 1px 1px 0 rgba(0, 0, 0, 0.35); }
.seg input:checked + .seg-planned { background: var(--muted); color: var(--bg); }
.seg input:checked + .seg-wip { background: var(--accent); color: var(--accent-ink); }
.seg input:checked + .seg-live { background: var(--green); color: #0f2410; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; position: relative; z-index: 1; }
.seg input:disabled + label { opacity: 0.6; cursor: default; }

.pdlg-image { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
.pdlg-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: var(--panel-lo);
  box-shadow: inset 2px 2px 0 var(--edge), inset -1px -1px 0 #3a3631;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  padding: 6px;
  overflow: hidden;
}
.pdlg-preview img { display: block; width: calc(100% + 12px); height: calc(100% + 12px); margin: -6px; object-fit: cover; }
.pdlg-image-tools { display: grid; gap: 10px; align-content: start; }
.pdlg-image-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pdlg-file { display: inline-block; }
.pdlg-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.pdlg-file:has(input:disabled) { opacity: 0.4; cursor: default; }

.pdlg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 18px;
  background: #23211e;
  border-top: 2px solid var(--edge);
}
.pdlg-page { font-size: 13px; margin-right: auto; }
.pdlg-status { margin: 0; color: var(--muted); font-size: 13px; }
.pdlg-status:empty { display: none; }
.pdlg-foot .btn:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 600px) {
  .pdlg-body { grid-template-columns: 1fr; padding: 14px; }
  .pdlg-image { grid-template-columns: 1fr; }
  .pdlg-preview { max-width: 240px; }
  .pdlg-head, .pdlg-foot { padding-left: 14px; padding-right: 14px; }
}
