/*
 * One stylesheet for every page.
 *
 * The markup lives in .html files and is never generated in JavaScript, so the classes
 * below are the whole contract between the two.
 */

:root {
  color-scheme: light dark;

  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f2f3f7;
  --fg: #14161c;
  --muted: #5b6270;
  --line: #e2e5ec;
  --line-strong: #cdd2dc;

  --accent: #4b45d6;
  --accent-fg: #ffffff;
  --accent-soft: #ecebfb;
  --danger: #b3261e;
  --ok: #126b45;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 18 27 / 6%), 0 8px 24px -16px rgb(16 18 27 / 24%);
  --measure: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101218;
    --surface: #171a22;
    --surface-2: #1e222c;
    --fg: #e8eaf1;
    --muted: #99a1b3;
    --line: #272c37;
    --line-strong: #3a4150;

    --accent: #9d97ff;
    --accent-fg: #14161c;
    --accent-soft: #23233c;
    --danger: #ef9a93;
    --ok: #6fd3a4;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -16px rgb(0 0 0 / 80%);
  }
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 5rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 46rem;
}

.note,
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.sub {
  color: var(--muted);
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

[hidden] {
  display: none !important;
}

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

header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

.brand .tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

nav.main {
  display: flex;
  gap: 0.25rem;
  margin-right: auto;
  flex-wrap: wrap;
}

nav.main a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}

nav.main a:hover {
  color: var(--fg);
  background: var(--surface-2);
}

nav.main a[aria-current="page"] {
  color: var(--fg);
  background: var(--surface-2);
  font-weight: 550;
}

/* --- buttons -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  line-height: 1.2;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, var(--fg));
}

.btn-quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
}

.btn-quiet:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

/* --- account menu in the header (details/summary, no extra script) --------------------- */

.account-menu {
  position: relative;
}

.account-menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu > summary:hover {
  background: var(--surface-2);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 15rem;
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu-panel a,
.menu-panel button {
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  text-decoration: none;
  color: var(--fg);
  background: none;
  border: 0;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--surface-2);
}

.menu-panel .who {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.3rem;
}

.menu-panel .who span {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.menu-panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.3rem 0;
}

/* --- hero and stats -------------------------------------------------------------------- */

.hero {
  padding: 1rem 0 0.5rem;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- search --------------------------------------------------------------------------- */

.searchbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.searchbar input[type="search"] {
  flex: 1 1 18rem;
}

input,
select,
textarea {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

/* --- cards and grids ------------------------------------------------------------------ */

.pack-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}

.pack-card {
  display: block;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.pack-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.pack-preview {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  min-height: 36px;
}

.pack-preview img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 4px;
}

.pack-card p {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.pack-card .meta {
  margin: 0;
  font-size: 0.82rem;
}

.grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  text-align: center;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card img {
  width: 64px;
  height: 64px;
}

.card-name {
  font-size: 0.9rem;
  font-weight: 550;
}

.card-slug {
  font-size: 0.75rem;
  color: var(--muted);
}

.chip {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin: 0 0.25rem 0.25rem 0;
}

/* --- detail pages --------------------------------------------------------------------- */

.fields {
  margin: 1rem 0;
  display: grid;
  gap: 0.5rem;
}

.field {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.field dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.field dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  .field {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.asset-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.asset-preview {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.asset-preview img {
  width: 128px;
  height: 128px;
}

.asset-info {
  flex: 1 1 22rem;
}

/* --- account -------------------------------------------------------------------------- */

.account-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.account-head .avatar {
  width: 3rem;
  height: 3rem;
  font-size: 1.3rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--fg);
}

.tabs a[aria-current="page"] {
  color: var(--fg);
  font-weight: 550;
  border-bottom-color: var(--accent);
}

.tabs form,
.tabs .spacer {
  margin-left: auto;
}

.panel {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.form-card {
  max-width: 26rem;
  margin: 3rem auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 550;
}

/* --- notices and empty states ---------------------------------------------------------- */

.notice {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.notice-ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}

.notice-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty strong {
  display: block;
  color: var(--fg);
  margin-bottom: 0.35rem;
}

ul.tools,
ul.endpoints {
  padding-left: 1.1rem;
}

ul.tools li,
ul.endpoints li {
  margin-bottom: 0.35rem;
}

footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

footer.site .inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem;
}

/*
 * Rows, badges and the icon editor.
 *
 * Added with the upload area. A row is a list entry that carries a link, a status and one
 * line of context - the shape the upload list, the intake report, the review queue and the
 * review history all share.
 */

.rows {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}

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

.row-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 16rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

a.row-main:hover strong {
  text-decoration: underline;
}

.row-main code,
.row-meta {
  font-size: 0.85rem;
  color: var(--muted);
  /* Long slugs and file names must wrap rather than widen the row past the viewport. */
  overflow-wrap: anywhere;
}

/*
 * Status pill.
 *
 * The colour comes from a data attribute rather than a class per state, so the JS sets one
 * value and never has to remember which classes to remove first.
 */
.badge {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge[data-status="published"] {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.badge[data-status="rejected"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.badge[data-status="pending"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}

.icon-item > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  /* The icon list can run to fifty entries, so a collapsed row stays one line tall. */
  flex-wrap: wrap;
}

.icon-item > summary img {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.icon-item > summary code {
  font-size: 0.85rem;
  color: var(--muted);
}

.icon-item form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.icon-item figcaption,
.card figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
