:root {
  --ink: #2c2119;
  --muted: #745f4d;
  --paper: #fff8ed;
  --cream: #f7ead6;
  --coffee: #6f3f25;
  --clay: #b65f37;
  --olive: #68744a;
  --blue: #315f6b;
  --line: rgba(67, 41, 24, 0.16);
  --shadow: 0 18px 50px rgba(69, 39, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
}

a {
  color: inherit;
}

.site-header {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px clamp(18px, 4vw, 32px);
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: center;
  gap: 16px 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Fraunces, serif;
  font-size: 1.26rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #fffaf1;
  box-shadow: 0 8px 22px rgba(69, 39, 19, 0.12);
}

.nav-menu {
  display: none;
  justify-self: end;
}

.desktop-nav {
  justify-self: end;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav-toggle-button {
  display: none;
  list-style: none;
}

.nav-toggle-button::-webkit-details-marker {
  display: none;
}

.header-search {
  grid-column: 2;
  display: grid;
  gap: 8px;
  justify-self: end;
  width: min(100%, 620px);
}

.header-search input {
  min-width: 0;
  padding: 9px 11px;
}

.header-filter-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr);
  gap: 8px;
  align-items: end;
}

.search-filter-menu {
  position: relative;
}

.search-filter-menu summary {
  width: fit-content;
  list-style: none;
}

.search-filter-menu summary::-webkit-details-marker {
  display: none;
}

.search-filter-menu[open] .header-filter-row {
  display: grid;
}

.search-filter-menu:not([open]) .header-filter-row {
  display: none;
}

.search-filter-menu .header-filter-row {
  position: absolute;
  right: 0;
  z-index: 6;
  width: min(620px, calc(100vw - 36px));
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.header-filter-row label {
  gap: 3px;
  font-size: 0.76rem;
}

.header-filter-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

.category-filter-menu {
  grid-column: 1 / -1;
  position: relative;
}

.category-filter-menu summary {
  cursor: pointer;
  font-weight: 700;
}

.category-checks {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
}

.category-checks label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.category-checks input {
  width: auto;
}

.checkbox-label input {
  width: auto;
}

.clear-filters {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 0;
  color: var(--coffee);
  background: transparent;
  font-weight: 700;
}

.category-line {
  margin: 8px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.read-more {
  margin: 10px 0 0;
  font-weight: 800;
}

.article-category {
  margin-top: 24px;
}

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

.header-search button {
  padding: 9px 12px;
}

.header-search .clear-filters {
  padding: 0;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
}

.main-nav a.active,
.main-nav a:hover {
  color: #fffaf1;
  background: var(--coffee);
}

.language-menu {
  position: relative;
}

.language-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  list-style: none;
}

.language-button::-webkit-details-marker {
  display: none;
}

.language-button::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.language-menu[open] .language-button::after {
  transform: translateY(2px) rotate(225deg);
}

.language-options {
  position: absolute;
  right: 0;
  z-index: 5;
  min-width: 76px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: var(--shadow);
  display: none;
}

.language-menu[open] .language-options {
  display: grid;
  gap: 4px;
}

.language-options a {
  display: block;
  text-align: center;
}

.language-options a.active {
  color: #fffaf1;
  background: var(--coffee);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 32px) 56px;
}

.intro-band {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) 1fr;
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
  padding: clamp(22px, 4vw, 42px) 0 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.intro-copy h1,
.content-page h1,
.admin-shell h1 {
  margin: 0 0 12px;
  font-family: Fraunces, serif;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.intro-art {
  position: relative;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.intro-art img {
  width: min(78%, 360px);
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.44fr);
  gap: 22px;
  margin-top: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2,
.media-card h2 {
  margin: 0;
  font-family: Fraunces, serif;
  font-size: 1.55rem;
}

.media-card h2 a {
  color: var(--coffee);
  text-decoration: none;
}

.media-card h2 a:hover {
  color: var(--clay);
}

.section-title a {
  color: var(--clay);
  font-weight: 800;
  text-decoration: none;
}

.item-list,
.media-list {
  display: grid;
  gap: 14px;
}

.list-card,
.compact-card,
.media-card,
.form-card,
.manage-card,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.78);
  box-shadow: 0 10px 30px rgba(69, 39, 19, 0.08);
}

.list-card {
  padding: 20px;
}

.list-card h2,
.list-card h3 {
  margin: 0 0 6px;
  line-height: 1.15;
}

.list-card h2 a,
.list-card h3 a {
  display: inline-block;
  color: var(--coffee);
  font-family: Fraunces, serif;
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
}

.list-card p,
.compact-card p,
.media-card p,
.manage-card p,
.empty {
  margin: 0;
  color: var(--muted);
}

.side-panel {
  align-self: start;
  padding: 20px;
}

.compact-card {
  padding: 16px;
  margin-top: 12px;
}

.compact-card h3,
.manage-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.content-page,
.admin-shell {
  max-width: 860px;
  margin: 28px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.78;
}

.article-body > *:first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 1.6em 0 0.45em;
  color: var(--coffee);
  line-height: 1.18;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body pre,
.article-body table {
  margin: 0 0 1em;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35em;
}

.article-body blockquote {
  padding: 12px 16px;
  border-left: 4px solid var(--clay);
  background: rgba(255, 250, 241, 0.7);
  color: var(--muted);
}

.article-body code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #fff3df;
  color: var(--coffee);
}

.article-body pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 6px;
  background: #2c2119;
  color: #fffaf1;
}

.article-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

.article-body th,
.article-body td {
  padding: 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.back-link {
  color: var(--clay);
  font-weight: 800;
  text-decoration: none;
}

.content-meta {
  margin: 0 0 10px;
  color: var(--olive);
  font-size: 0.9rem;
  font-weight: 800;
}

.content-meta a {
  color: var(--coffee);
  text-decoration: none;
}

.content-meta a:hover {
  text-decoration: underline;
}

.detail-meta {
  display: grid;
  gap: 3px;
}

.detail-meta p {
  margin: 0;
}

.pagination {
  margin-top: 16px;
}

.pagination h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination a {
  min-width: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--coffee);
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.pagination a.active,
.pagination a:hover {
  color: #fffaf1;
  background: var(--coffee);
}

.media-card {
  padding: 22px;
}

.media-card .content-meta {
  margin-bottom: 6px;
}

.embed-wrap {
  margin: 14px 0;
}

.detail-embed {
  margin-top: 18px;
}

.podcast-description {
  margin-top: 18px;
  color: var(--ink);
  line-height: 1.75;
}

.podcast-description p {
  margin: 0;
}

.embed-wrap iframe {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 8px;
}

.admin-shell {
  max-width: 1120px;
}

.admin-shell.narrow {
  max-width: 640px;
}

.admin-top,
.admin-columns,
.manage-card,
.form-actions {
  display: flex;
  gap: 18px;
}

.admin-top,
.manage-card,
.form-actions {
  align-items: center;
  justify-content: space-between;
}

.admin-columns {
  align-items: flex-start;
}

.admin-columns > section {
  flex: 1;
  min-width: 0;
}

.form-card {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.backup-list {
  display: grid;
  gap: 12px;
}

.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 241, 0.72);
}

.backup-item p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.72);
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--coffee);
  font-size: 0.85rem;
}

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

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

.table-actions form {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--coffee);
  font-weight: 800;
}

label span {
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

textarea {
  resize: vertical;
}

.button,
button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fffaf1;
  background: var(--coffee);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.muted {
  background: var(--olive);
}

.button.secondary {
  background: var(--olive);
}

.button.danger {
  background: #8d2f24;
}

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

.manage-card {
  padding: 16px;
  margin-bottom: 12px;
}

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

.actions a,
.form-actions a {
  color: var(--clay);
  font-weight: 800;
  text-decoration: none;
}

.actions button {
  background: #8d2f24;
}

.error {
  padding: 12px 14px;
  border-radius: 6px;
  color: #fffaf1;
  background: #8d2f24;
}

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 32px) 34px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0 0 6px;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.developer-credit {
  font-size: 0.92rem;
}

.developer-credit a {
  color: var(--coffee);
  font-weight: 800;
  text-decoration: none;
}

.developer-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 820px) {
  .site-header,
  .intro-band,
  .section-grid,
  .admin-columns {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .site-header {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
    justify-self: end;
  }

  .header-search {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

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

  .search-filter-menu summary {
    width: 100%;
  }

  .search-filter-menu .header-filter-row {
    position: static;
    width: 100%;
  }

  .nav-toggle-button {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    display: grid;
    place-content: center;
    gap: 5px;
    background: var(--coffee);
    cursor: pointer;
  }

  .nav-toggle-button:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
  }

  .nav-toggle-button span {
    width: 22px;
    height: 2px;
    border-radius: 99px;
    background: #fffaf1;
    transition: transform 160ms ease, opacity 160ms ease;
  }

  .nav-menu[open] .nav-toggle-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-menu[open] .nav-toggle-button span:nth-child(2) {
    opacity: 0;
  }

  .nav-menu[open] .nav-toggle-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
    padding-top: 10px;
    justify-content: stretch;
  }

  .nav-menu[open] .main-nav {
    display: grid;
  }

  .main-nav a {
    padding: 11px 12px;
  }

  .language-menu {
    display: grid;
  }

  .language-button {
    width: 100%;
  }

  .language-options {
    position: static;
    margin-top: 6px;
    box-shadow: none;
  }

  .section-grid {
    display: grid;
  }

  .intro-art {
    min-height: 190px;
  }

  .admin-top,
  .manage-card,
  .backup-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-page,
  .admin-shell {
    margin-top: 18px;
    padding-top: 20px;
  }

  .content-page h1,
  .admin-shell h1 {
    font-size: clamp(2.1rem, 12vw, 3.4rem);
    line-height: 1;
  }

  .media-card {
    padding: 18px;
  }

  .media-card h2 {
    font-size: 1.35rem;
    line-height: 1.15;
  }
}
