:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3fb;
  --border: #d9e1ee;
  --text: #1d2736;
  --muted: #5c6b80;
  --accent: #0057ff;
  --accent-hover: #0047d1;
  --success: #136d39;
  --success-hover: #0f5c2f;
  --shadow: 0 10px 30px rgba(18, 38, 63, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.intro {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filters-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  margin-bottom: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-grow {
  grid-column: span 2;
}

label {
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 87, 255, 0.16);
  border-color: var(--accent);
}

input:disabled,
select:disabled {
  background: #f3f6fb;
  color: #7b8798;
  cursor: not-allowed;
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  min-height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

button.secondary {
  background: var(--surface-2);
  color: var(--text);
}

button.secondary:hover:not(:disabled) {
  background: #dde6f5;
}

.info-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.results-panel {
  padding: 0 18px 18px;
}

.result-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

.card-image {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: #dfe7f6;
}

.card-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
}

.card-source-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.source-badge-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.source-nrk {
  background: #f1f5ff;
  border-color: #cddbff;
  color: #214ea3;
}

.source-archive {
  background: #f7f2ea;
  border-color: #e5d6bd;
  color: #6a4b1f;
}
.source-sr {
  background: #fff3f3;
  border-color: #f2c9c9;
  color: #a12a2a;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.subtitle {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 600;
}

.description {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  min-height: calc(1.55em * 4);
  max-height: calc(1.55em * 4);
}

.card-meta-text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.read-more-btn {
  min-height: auto;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.read-more-btn:hover:not(:disabled) {
  background: #dde6f5;
}

.card-link {
  display: inline-block;
  margin-top: auto;
  padding-top: 6px;
  font-weight: 700;
  color: var(--success);
  text-decoration: none;
}

.message {
  grid-column: 1 / -1;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: auto;
  margin: 0;
  cursor: pointer;
}

#pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pager-summary {
  font-weight: 600;
  color: #4b5563;
  margin-right: 10px;
}

.pager-numbers {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pager-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  border: none;
  background: var(--success);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pager-btn:hover:not(:disabled) {
  background: var(--success-hover);
  transform: translateY(-1px);
}

.pager-btn:disabled {
  background: #cfd7df;
  cursor: default;
  opacity: 0.6;
}

.pager-number {
  background: #fff;
  color: var(--success);
  border: 1px solid #b7d8bf;
}

.pager-number:hover:not(:disabled) {
  background: #eef8f1;
}

.pager-number.active {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: #6b7280;
  font-weight: 700;
}

.details-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.details-modal.hidden {
  display: none;
}

.details-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 40, 0.55);
}

.details-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: auto;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.details-modal-body {
  padding: 20px;
}

.details-modal-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 12px 12px 0 0;
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  z-index: 2;
}

.details-modal-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 16px;
  background: #dfe7f6;
}

.details-modal-header-row {
  margin-bottom: 12px;
}

.details-modal-description {
  color: var(--text);
  line-height: 1.65;
  white-space: normal;
}

.details-modal-actions {
  margin-top: 20px;
}

.details-open-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--success);
}

@media (max-width: 900px) {
  .filters-panel {
    grid-template-columns: 1fr;
  }

  .field-grow {
    grid-column: auto;
  }

  .actions {
    align-items: stretch;
  }

  .actions button {
    width: 100%;
  }

  .info-panel {
    flex-direction: column;
  }

  .results-panel {
    padding: 0 14px 14px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 24px 14px 36px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .source-badge {
    max-width: 100%;
  }

  .card-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .pager-summary {
    margin-right: 0;
    width: 100%;
    text-align: center;
  }

  .details-modal-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    margin: 10px auto;
  }

  .details-modal-body {
    padding: 16px;
  }
}
.card[data-card-link] {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card[data-card-link]:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}