/* Freight — PS5 tool repository server
 * Written by LJ "HawaiizFynest" Eblacas — Colorado Vista IT Solutions
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-condensed-600.woff2") format("woff2");
}

:root {
  --ink: #0f1a2b;
  --hull: #17253a;
  --deck: #213350;
  --line: #2d4262;
  --text: #e6ecf4;
  --muted: #93a4bd;
  --signal: #f2b134;
  --signal-ink: #1d1404;
  --clear: #4cb782;
  --stop: #e26d5a;
  --band: rgba(242, 177, 52, 0.22);
  --focus: #8ec5ff;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 4px;
  --radius-lg: 10px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --ink: #edf1f6;
    --hull: #ffffff;
    --deck: #e2e8f0;
    --line: #c6d1df;
    --text: #13213a;
    --muted: #55667f;
    --signal: #b57400;
    --signal-ink: #ffffff;
    --clear: #1e8a57;
    --stop: #b8412f;
    --band: rgba(181, 116, 0, 0.18);
    --focus: #1d5fbf;
    color-scheme: light;
  }
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.5 var(--body);
}

a { color: inherit; }

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

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 16px;
}

/* header ------------------------------------------------------------------ */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--hull);
}

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  min-height: 72px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 600 34px/1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark svg { width: 30px; height: 30px; flex: none; }

.masthead .tools {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

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

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

.field > span, .field > label { color: var(--muted); font-size: 14px; }
.field > .input-with-button { color: inherit; font-size: inherit; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--text);
  font: inherit;
}

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

select { padding-right: 32px; }

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.inline-field select { width: auto; min-height: 36px; padding: 4px 28px 4px 10px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--signal); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--deck);
  color: var(--text);
  font: 600 18px/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .button:hover { border-color: var(--muted); }

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

button.quiet { background: transparent; }

button.danger { color: var(--stop); background: transparent; border-color: var(--stop); }

button:disabled { opacity: 0.5; cursor: not-allowed; }

.small { min-height: 34px; padding: 0 12px; font-size: 16px; }

/* manifest list ----------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 28px 0 16px;
}

.toolbar input[type="search"] { flex: 1 1 260px; }

.count { color: var(--muted); font-size: 14px; margin-left: auto; }

.manifest { list-style: none; margin: 0 0 48px; padding: 0; display: grid; gap: 12px; }

.entry {
  position: relative;
  padding: 18px 20px 16px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--hull);
}

.entry::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 5px;
  border-radius: 0 3px 3px 0;
  background: var(--line);
}

.entry[data-fit="yes"]::before { background: var(--clear); }
.entry[data-fit="no"]::before { background: var(--stop); }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}

.entry-title {
  margin: 0;
  font: 600 28px/1.1 var(--display);
  letter-spacing: 0.01em;
}

.entry-version { color: var(--muted); font: 600 20px/1.1 var(--display); }

.entry-head .actions { margin-left: auto; display: flex; gap: 8px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin: 10px 0 0;
}

.facts div { display: flex; gap: 8px; align-items: baseline; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.path { overflow-wrap: anywhere; }

.notes {
  margin: 12px 0 0;
  max-width: 72ch;
  white-space: pre-line;
  color: var(--text);
}

.hash { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; margin-top: 10px; }

/* firmware ruler ---------------------------------------------------------- */

.ruler { margin-top: 14px; }

.ruler-track {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: var(--deck);
}

.ruler-band {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 7px;
  background: var(--band);
  box-shadow: inset 0 0 0 2px var(--signal);
}

.ruler-tick {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--line);
}

.ruler-mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--clear);
}

.ruler-mark.out { background: var(--stop); }

.ruler-labels {
  position: relative;
  height: 22px;
  margin-top: 6px;
  color: var(--muted);
  font: 600 16px/22px var(--display);
  font-variant-numeric: tabular-nums;
}

.ruler-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ruler-labels span.edge-start { transform: none; }
.ruler-labels span.edge-end { transform: translateX(-100%); }

.ruler-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 2px;
  font-size: 14px;
}

.fit-yes { color: var(--clear); }
.fit-no { color: var(--stop); }

/* states ------------------------------------------------------------------ */

.empty, .notice {
  padding: 28px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.notice.error { border-style: solid; border-color: var(--stop); color: var(--text); }

.gate {
  width: min(440px, 100%);
  margin: 72px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--hull);
}

.gate h2 { margin: 0 0 6px; font: 600 30px/1.1 var(--display); }
.gate p { margin: 0 0 18px; color: var(--muted); }
.gate form { display: grid; gap: 14px; }

.form-error { min-height: 1.5em; margin: 0; color: var(--stop); font-size: 14px; }

.site-foot {
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none !important; }

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

.panel {
  margin: 28px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--hull);
}

.panel h2 { margin: 0 0 4px; font: 600 28px/1.1 var(--display); }
.panel > p { margin: 0 0 18px; color: var(--muted); }

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 140px;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.dropzone.over { border-color: var(--signal); color: var(--text); }
.dropzone strong { color: var(--text); font: 600 22px/1.2 var(--display); }

.drop-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}
.drop-more label.button { cursor: pointer; }

#folder-summary { margin-top: 14px; color: var(--text); }
#folder-summary.warn { color: var(--stop); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.progress {
  height: 10px;
  border-radius: 5px;
  background: var(--deck);
  overflow: hidden;
}

.progress > div { height: 100%; width: 0; background: var(--signal); transition: width 0.2s linear; }

.upload-progress { margin-top: 16px; }

.copy-row { display: flex; gap: 10px; }
.copy-row input { flex: 1; min-width: 0; }

.gate em { font-style: normal; color: var(--text); }

.inline-field input.fw-input { width: 5.5em; min-height: 36px; padding: 4px 10px; }

.status-line { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.entry.is-hidden { opacity: 0.6; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
}

dialog {
  width: min(720px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--hull);
  color: var(--text);
}

dialog::backdrop { background: rgba(5, 10, 18, 0.7); }
dialog h2 { margin: 0; font: 600 28px/1.1 var(--display); }

/* accounts ---------------------------------------------------------------- */

.who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.who-name { color: var(--muted); font-size: 14px; }

.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.account-part { padding: 18px 0 4px; border-top: 1px solid var(--line); margin-top: 18px; }
.account-part h3 { margin: 0 0 4px; font: 600 22px/1.2 var(--display); }
.account-part > p { margin: 0 0 12px; color: var(--muted); max-width: 64ch; }

/* A PS5 sign-in code is read off a phone or monitor and typed on a TV, so it
   is the one big, high-contrast thing on screen. */
.code-box {
  display: grid;
  gap: 6px;
  justify-items: start;
  margin: 14px 0 4px;
  padding: 14px 18px;
  border: 2px solid var(--signal);
  border-radius: var(--radius-lg);
  background: var(--ink);
}

.code {
  font: 600 44px/1 var(--display);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  user-select: all;
}

.code.expired { color: var(--muted); text-decoration: line-through; }

.device-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }

.device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
}

.device > div { display: grid; gap: 2px; }

.empty-line { color: var(--muted); font-size: 14px; }

.tag-off { border-color: var(--stop); color: var(--stop); }

.entry.account .facts { margin-top: 8px; }

.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; min-width: 0; }
.input-with-button button { min-height: 42px; }

.account-list { margin: 22px 0 0; }

@media (max-width: 600px) {
  .wordmark { font-size: 30px; }
  .entry { padding: 16px 14px 14px 20px; }
  .entry-title { font-size: 24px; }
  .entry-head .actions { margin-left: 0; width: 100%; }
  .entry-head .actions > * { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .progress > div { transition: none; }
}
