/* Schibsted Grotesk, SIL Open Font License. Copyright 2021 Schibsted. */
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/schibsted-grotesk-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/schibsted-grotesk-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/schibsted-grotesk-700.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --bg: #12100c;
  --rail: #241c14;
  --surface: #1c1814;
  --surface-2: #2a241c;
  --line: #3a3228;
  --ink: #f6f1e7;
  --muted: #cbbba6;
  --accent: #e2a23a;
  --accent-ink: #1c1406;
  --warn: #ff8a5b;
  --warn-bg: #3a2218;
  --shadow: 0 14px 28px rgb(0 0 0 / 0.32);
  --font: 'Schibsted Grotesk', 'Avenir Next', 'Segoe UI', sans-serif;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 0.18em; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
input[type='checkbox'] { accent-color: var(--accent); width: 18px; height: 18px; }

.mast {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 28px;
  padding: 18px clamp(16px, 3vw, 32px) 14px;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}
.mast-id { min-width: 0; }
h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}
.mast-status { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }
.mast-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.switches { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: var(--muted); cursor: pointer; }
#search {
  width: min(280px, 70vw);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  caret-color: var(--accent);
}
#search::placeholder { color: var(--muted); }
.text-btn {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.text-btn:hover { color: var(--ink); }

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}
.rail {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px 32px 16px;
}
.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); }
.count {
  min-width: 1.6em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.chip[aria-pressed='true'] .count { background: rgb(28 20 6 / 0.16); color: inherit; }

main { padding: 8px clamp(16px, 3vw, 28px) 40px 8px; min-width: 0; }
.group { margin-top: 28px; }
.group h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.claimed { opacity: 0.58; }
.card.is-hidden { box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.stage { position: relative; background: var(--surface-2); }
.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.cover.placeholder {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--muted);
}
.fuse {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--muted);
}
.fuse.hot { background: var(--warn); }
.body { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 14px; flex: 1; }
.body h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.meta, .when { margin: 0; color: var(--muted); font-size: 0.88rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.worth { text-decoration: line-through; }
.badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.btn, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}
.btn { border: 0; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.06); }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.ghost:hover { background: var(--surface-2); }
.claim-flag { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; color: var(--muted); cursor: pointer; font-size: 0.88rem; }

.warning {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 4px;
  background: var(--warn-bg);
  color: var(--warn);
}
.empty { margin: 48px 0; color: var(--muted); }
.foot {
  padding: 8px clamp(16px, 3vw, 32px) 28px;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p { margin: 0; max-width: 65ch; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--rail);
}
.login {
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 24px;
  background: var(--bg);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.login h1 { font-size: 1.8rem; }
.login label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.login input[type='text'],
.login input[type='password'],
.login input:not([type]) {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  caret-color: var(--accent);
  font-weight: 400;
}
.login .btn { border: 0; cursor: pointer; }
.login .muted, .login p:last-child { margin: 0; color: var(--muted); font-size: 0.9rem; }
.login .warning { margin: 0; }

@media (max-width: 800px) {
  .mast { position: static; flex-direction: column; align-items: stretch; }
  .mast-tools { justify-content: flex-start; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px 12px;
    background: var(--rail);
    border-bottom: 1px solid var(--line);
    scrollbar-color: var(--line) transparent;
  }
  .chip { flex: none; }
  main { padding: 4px 12px 32px; }
  .group { scroll-margin-top: 120px; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { flex-direction: row; }
  .stage { width: 118px; flex: none; }
  .cover { height: 100%; aspect-ratio: auto; min-height: 118px; }
  .body { padding: 10px; }
  .body h3 { font-size: 0.98rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { filter: none; }
}
