:root {
  --paper: #f6f0e2;
  --paper-soft: #fffaf0;
  --ink: #1c2026;
  --ink-soft: #505862;
  --accent: #9d2d17;
  --accent-deep: #6f1f0f;
  --slate: #1f374c;
  --line: #d7c9b4;
  --radius: 16px;
  --shadow: 0 14px 28px rgba(55, 42, 26, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Public Sans", "Helvetica Neue", Helvetica, sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(157, 45, 23, 0.13), transparent 34%),
    radial-gradient(circle at 82% 10%, rgba(31, 55, 76, 0.12), transparent 34%),
    linear-gradient(165deg, #eee4d1 0%, var(--paper) 47%, var(--paper-soft) 100%);
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0, rgba(0, 0, 0, 0.18) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0, rgba(0, 0, 0, 0.12) 1px, transparent 1px, transparent 4px);
}

a {
  color: inherit;
}

input,
select,
button {
  font: inherit;
}

.wrap {
  width: min(1100px, calc(100% - 40px));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.back-link {
  position: absolute;
  top: 18px;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid #c6b9a5;
  background: rgba(255, 250, 240, 0.85);
  color: #243245;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
}

.masthead {
  position: relative;
  padding: 44px 0 20px;
}

.stamp {
  margin: 18px 0 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: "Libre Baskerville", Georgia, serif;
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.06;
  max-width: 12ch;
}

.lead {
  margin: 0;
  max-width: 70ch;
  color: var(--ink-soft);
  line-height: 1.56;
}

.masthead-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 252, 246, 0.86);
  box-shadow: var(--shadow);
}

.controls {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}

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

.field span {
  font-size: 0.76rem;
  font-weight: 700;
  color: #4c5665;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid #ccbba4;
  border-radius: 11px;
  background: #fffdf7;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 10px 11px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(157, 45, 23, 0.2);
  border-color: var(--accent);
}

.year-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.year-chip {
  border: 1px solid #cbbca7;
  border-radius: 999px;
  background: #fffcf4;
  color: #4f5966;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
  cursor: pointer;
}

.year-chip.active {
  border-color: var(--accent-deep);
  color: #fff;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-deep) 100%);
}

.stat-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  border: 1px dashed #cdbca4;
  border-radius: 13px;
  background: rgba(255, 252, 246, 0.74);
  padding: 11px 12px;
}

.stat-label {
  margin: 0;
  color: #5b6572;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-value {
  margin: 6px 0 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.13rem;
  line-height: 1.2;
}

.featured {
  margin-top: 12px;
  padding: 18px;
  border-left: 4px solid #8e2a15;
}

.featured-kicker {
  margin: 0;
  color: #8e2a15;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.featured h2 {
  margin: 7px 0 10px;
  font-size: clamp(1.26rem, 2.8vw, 1.78rem);
  line-height: 1.14;
  max-width: 22ch;
}

.featured-meta {
  margin: 0 0 8px;
  color: #6a573f;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.featured-summary {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.52;
  max-width: 76ch;
}

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

.release-main {
  padding: 14px 0 120px;
}

.release-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.release-card {
  border: 1px solid #d6c9b5;
  border-radius: 14px;
  background:
    linear-gradient(160deg, #fffdf8 0%, #fff7eb 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 15px, rgba(28, 32, 38, 0.05) 16px);
  padding: 13px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 9px;
  height: 100%;
  box-shadow: 0 9px 18px rgba(56, 43, 24, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.release-card:hover {
  transform: translateY(-2px);
  border-color: #bea88f;
  box-shadow: 0 13px 25px rgba(56, 43, 24, 0.12);
}

.release-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.topic {
  border-radius: 999px;
  border: 1px solid #d4c1aa;
  background: rgba(255, 251, 243, 0.9);
  color: #4f5d6f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 8px;
}

.release-date {
  margin: 0;
  color: #6e5b45;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.release-title {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.25;
  min-height: calc(1em * 1.25 * 2);
  max-height: calc(1em * 1.25 * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.release-summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: calc(1em * 1.5 * 3);
  max-height: calc(1em * 1.5 * 3);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.release-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 9px 11px;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(157, 45, 23, 0.2);
}

.btn-primary {
  border-color: #8c2d18;
  color: #fff;
  background: linear-gradient(120deg, #9d2d17 0%, #6f1f0f 100%);
  box-shadow: 0 7px 14px rgba(125, 34, 18, 0.18);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  filter: brightness(1.03);
}

.btn-secondary {
  border-color: #c6b8a4;
  color: #283241;
  background: #fffcf5;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: #b8a78f;
}

.empty {
  margin: 18px 0 0;
  border: 1px dashed #cdbca4;
  border-radius: 12px;
  background: rgba(255, 251, 243, 0.9);
  color: #5f6977;
  text-align: center;
  padding: 13px;
}

.footer-note {
  margin-top: 6px;
  color: #5d6775;
  font-size: 0.9rem;
  padding-bottom: 28px;
}

.footer-note p {
  margin: 4px 0;
}

.footer-note a {
  color: #1f5e86;
}

.viewer-page {
  background: #f4ecdb;
}

.viewer-shell {
  width: min(1020px, calc(100% - 28px));
  margin: 16px auto;
  border: 1px solid #d8c8b1;
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 12px 25px rgba(57, 43, 22, 0.13);
  padding: 14px;
}

.viewer-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e2d5c2;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.viewer-topbar h1 {
  margin: 0;
  font-size: 1.26rem;
  line-height: 1.2;
  max-width: none;
  flex: 1 1 auto;
}

.viewer-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.viewer-links .btn {
  font-size: 0.84rem;
  padding: 8px 11px;
}

.viewer-frame {
  width: 100%;
  min-height: calc(100vh - 190px);
  border: 1px solid #d8c8b1;
  border-radius: 10px;
  background: #fff;
}

.viewer-empty {
  margin: 0 0 10px;
  border: 1px dashed #ccbca4;
  border-radius: 10px;
  background: rgba(255, 251, 243, 0.9);
  color: #5f6876;
  padding: 10px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .release-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .back-link {
    top: 16px;
    right: 0;
  }

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

  .masthead-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

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

  .stat-row {
    grid-template-columns: 1fr;
  }

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

  .viewer-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .viewer-links {
    width: 100%;
  }

  .viewer-links .btn {
    width: 100%;
  }

  .viewer-frame {
    min-height: 68vh;
  }
}
