:root {
  --bg: #fff8ed;
  --bg-soft: #f9efdb;
  --panel: #fffdf7;
  --maroon: #6b0f1a;
  --maroon-dark: #470810;
  --gold: #c8894a;
  --ink: #3f312b;
  --muted: #8a7566;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
}

a {
  color: var(--maroon);
}

a:hover {
  color: var(--maroon-dark);
}

strong,
b {
  color: var(--maroon-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--maroon-dark);
  font-family: Georgia, "Times New Roman", serif;
}

.quarto-title-block .title {
  color: var(--maroon-dark);
  font-size: 2.4rem;
  font-weight: 700;
}

.quarto-title-block .description {
  color: var(--muted);
  font-style: italic;
}

h1 {
  border-bottom: 2px solid rgba(107, 15, 26, 0.25);
  padding-bottom: 0.3em;
  font-weight: 700;
}

h2 {
  margin-top: 1.5em;
  font-weight: 600;
}

.value-box {
  background-color: var(--panel);
  border: 1px solid #ecd9b8;
  border-top: 4px solid var(--maroon);
  border-radius: 14px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 180px;
  height: 100%;
  width: 180%;
  box-shadow: 0 3px 12px rgba(107, 15, 26, 0.07);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.value-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(107, 15, 26, 0.14);
}

.value-box-number {
  color: var(--maroon);
  font-size: clamp(1.8rem, 3vw, 4.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.value-box-number p {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

.value-box > p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  border-radius: 12px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  overflow: hidden;
}

.card-body {
  padding: 1.25rem;
}

.table thead th {
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  color: var(--maroon-dark);
  background-color: var(--bg-soft);
  border-bottom: 2px solid rgba(107, 15, 26, 0.3);
}

.table thead th .sort-indicator {
  display: inline-block;
  min-width: 0.9rem;
  color: var(--maroon);
}

.table tbody td a {
  text-decoration: none;
}

.table tbody td a:hover {
  text-decoration: underline;
}

.table tbody tr {
  vertical-align: middle;
}

#poet-table th.poet-name,
#poet-table td.poet-name {
  width: 240px;
  min-width: 200px;
  white-space: nowrap;
}

#poet-table td.poet-name,
#poet-table td.poet-name a,
#work-table td.work-name-cell,
#work-table td.work-name-cell a,
#work-table td.work-author-cell,
#work-table td.work-author-cell a {
  font-weight: 700;
  font-size: 1.05rem;
}

#poet-table td.poet-works {
  font-size: 0.9rem;
  line-height: 1.9;
}

#poet-table td.poet-works a {
  margin-right: 0.4rem;
  white-space: nowrap;
}

#poet-table td.poet-works a::after {
  content: "\00b7";
  margin-left: 0.4rem;
  color: #b89a72;
}

#poet-table td.poet-works a:last-child::after {
  content: "";
  margin-left: 0;
}

mark {
  background-color: #ffe3a3;
  padding: 0 0.1rem;
  border-radius: 3px;
}

.badge.bg-primary {
  background-color: var(--maroon) !important;
  color: #fff8ed !important;
}

.badge.bg-primary-subtle {
  background-color: #f1dfc0 !important;
  color: var(--maroon-dark) !important;
}

.badge.text-primary-emphasis {
  color: var(--maroon-dark) !important;
}

.navbar-search input {
  border-radius: 20px;
  border: 2px solid #e3d3b0;
}

.navbar-search input:focus {
  border-color: var(--maroon);
  box-shadow: 0 0 0 0.2rem rgba(107, 15, 26, 0.12);
}

@media (min-width: 992px) {
  .navbar-search {
    flex: 0 1 280px;
  }
}

.nav-tabs .nav-link {
  font-size: 0.9rem;
  border: none;
  padding: 0.75rem 1.25rem;
  color: var(--muted);
}

.nav-tabs .nav-link.active {
  color: var(--maroon-dark);
  border-bottom: 2px solid var(--maroon);
  background: transparent;
}

.accordion-button {
  font-size: 1rem;
  font-weight: 600;
  color: var(--maroon-dark);
}

.accordion-button:not(.collapsed) {
  color: var(--maroon-dark);
  background-color: var(--bg-soft);
  box-shadow: none;
}

.accordion-body {
  font-size: 1.2rem;
}

.accordion-body p,
.accordion-body ul {
  font-size: 1.2rem;
}

.accordion-body ul {
  padding-left: 1.5rem;
}

.accordion-body li {
  margin-bottom: 0.3rem;
}

.badge {
  font-size: 0.95rem;
}

.work-author {
  display: block;
  width: 100%;
  white-space: normal;
}

.work-author-cell,
.work-author-cell a {
  white-space: nowrap;
}

.work-genre-cell,
.work-genre-badge {
  white-space: normal;
  word-break: break-word;
}

.work-genre-badge {
  display: inline-block;
  max-width: 100%;
  text-align: left;
  line-height: 1.35;
}

.pagination .page-link {
  color: var(--maroon);
}

.pagination .page-item.active .page-link {
  background-color: var(--maroon);
  border-color: var(--maroon);
  color: #fff8ed;
}

.pagination .btn {
  font-size: 0.85rem;
}

.tab-content {
  padding-top: 1rem;
}

#poet-search,
#work-search,
#global-search {
  max-width: 500px;
  border-radius: 8px;
  border: 2px solid #e3d3b0;
  padding: 0.75rem 1rem;
}

#poet-search:focus,
#work-search:focus,
#global-search:focus {
  border-color: var(--maroon);
  box-shadow: 0 0 0 0.2rem rgba(107, 15, 26, 0.12);
}

.list-group-item {
  border: none;
  padding: 0.5rem 0;
}

.list-group-item a {
  text-decoration: none;
}

.list-group-item a:hover {
  color: var(--maroon-dark);
}

.lead {
  font-size: 1.1rem;
}

.nav-footer {
  background-color: var(--bg-soft);
  border-top: 2px solid var(--maroon);
  color: var(--muted);
  margin-top: 3rem;
}

.nav-footer a {
  color: var(--maroon);
}

.quotes-marquee {
  overflow: hidden;
  white-space: nowrap;
  background: linear-gradient(
    90deg,
    var(--maroon-dark),
    var(--maroon) 50%,
    var(--maroon-dark)
  );
  color: #fff8ed;
  border-radius: 12px;
  padding: 0.9rem 0;
  margin-top: 2.5rem;
  box-shadow: 0 6px 18px rgba(71, 8, 16, 0.3);
}

.marquee-track {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  animation: marquee-scroll 90s linear infinite;
}

.marquee-item {
  display: inline-block;
  vertical-align: top;
  width: 420px;
  margin-right: 2.5rem;
  white-space: normal;
}

.marquee-item .m-quote {
  display: block;
  font-size: 1.05rem;
  line-height: 1.5;
}

.marquee-item .m-source {
  display: block;
  margin-top: 0.45rem;
  color: #e8b86a;
  font-size: 0.9rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes marquee-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Desktop: move all four navigation boxes to the right,
   beside the search bar */
@media (min-width: 992px) {
  #navbarCollapse {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
  }

  #navbarCollapse .navbar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;

    margin-left: auto !important;
    margin-right: 0 !important;

    width: auto;
    background: transparent;
    border: none;
    padding: 0;
  }

  /* Individual navigation boxes */
  #navbarCollapse .navbar-nav .nav-link {
    background-color: #ead5b7;
    border: 1px solid #d6b991;
    border-radius: 8px;
    padding: 6px 26px !important;
    color: #470810;
    white-space: nowrap;
    transition: background-color 0.2s ease;
  }

  /* Active page */
  #navbarCollapse .navbar-nav .nav-link.active {
    background-color: #684828;
    border-color: #a96f35;
    color: #ffffff;
    font-weight: 600;
  }

  /* Hover effect */
  #navbarCollapse .navbar-nav .nav-link:not(.active):hover {
    background-color: #d9bd96;
    border-color: #c5a575;
    color: #470810;
  }

  /* Search bar spacing */
  #navbar-search-form {
    flex: 0 1 230px;
    margin-left: 15px !important;
    margin-right: 0 !important;
  }
}

/* Mobile navigation: light-brown box behind each link */
@media (max-width: 991.98px) {
  /* Keep the expanded menu neatly arranged */
  #navbarCollapse {
    padding: 12px 10px;
  }

  /* Navigation list */
  #navbarCollapse .navbar-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;

    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 !important;

    width: 100%;
  }

  /* Individual Home, About, Poets and Works boxes */
  #navbarCollapse .navbar-nav .nav-link {
    display: block;
    width: 100%;
    box-sizing: border-box;

    background-color: #ead5b7;
    border: 1px solid #d6b991;
    border-radius: 8px;

    padding: 6px 16px !important;
    color: #470810;
    font-size: 1rem;
    font-weight: 500;

    transition: background-color 0.2s ease;
  }

  /* Active page */
  #navbarCollapse .navbar-nav .nav-link.active {
    background-color: #684828;
    border-color: #a96f35;
    color: #ffffff;
    font-weight: 600;
  }

  /* Touch/hover effect */
  #navbarCollapse .navbar-nav .nav-link:hover {
    background-color: #d9bd96;
    border-color: #c5a575;
    color: #470810;
  }

  /* Search field below the navigation links */
  #navbar-search-form {
    width: 100%;
    margin: 12px 0 4px !important;
  }

  #navbar-search-form input {
    width: 100%;
    box-sizing: border-box;
  }
}

/* Mobile hamburger toggle - light brown background */
.navbar .navbar-toggler {
  background-color: #f1c484;
  border: 2px solid #d6b991;
  border-radius: 8px;
  padding: 6px 10px;
}

/* Dark hamburger icon for visibility */
.navbar .navbar-toggler-icon {
  filter: brightness(0) saturate(100%) invert(14%) sepia(25%) saturate(1600%)
    hue-rotate(345deg) brightness(55%) contrast(105%);
}

.navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(107, 15, 26, 0.15);
}

/* ===== Background image on every page ===== */

html,
body {
  min-height: 100%;
}

body {
  background-image: url("data/bg-for-all.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Let the background image show through the page layout */
#quarto-content,
.quarto-container,
main.content {
  background-color: transparent !important;
}

/* Mobile background behavior */
@media (max-width: 767.98px) {
  body {
    background-attachment: scroll;
    background-position: center top;
  }
}

.navbar {
  background-color: var(--bg-soft) !important;
  background-image: url("../data/header-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
  transition: padding 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.navbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

.navbar-container,
.navbar-brand,
.navbar-collapse,
.navbar-toggler,
.quarto-navbar-tools {
  position: relative;
  z-index: 1;
}

.navbar .navbar-brand {
  color: var(--maroon-dark);
  font-weight: 700;
  font-size: 1.1rem;
  transition: font-size 0.3s ease;
}

.navbar .nav-link {
  color: var(--ink);
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem !important;
  transition:
    font-size 0.3s ease,
    padding 0.3s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--maroon-dark);
  font-weight: 600;
}

/* ===== Larger screens: make the header feel more spacious ===== */
@media (min-width: 992px) {
  .navbar {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  }

  .navbar .navbar-brand {
    font-size: 1.45rem;
  }

  .navbar .nav-link {
    font-size: 1.05rem;
    padding: 0.65rem 1.15rem !important;
  }
}

@media (min-width: 1400px) {
  .navbar {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  }

  .navbar .navbar-brand {
    font-size: 1.6rem;
  }

  .navbar .nav-link {
    font-size: 1.1rem;
    padding: 0.75rem 1.3rem !important;
  }
}

.navbar-brand img {
  display: block !important;
  height: 80px !important;
  max-height: none !important;
  max-width: none !important;
  object-fit: contain !important;
}

@media (min-width: 992px) {
  .navbar-brand-container {
    transform: translateX(80px);
  }
}

/* ====================================================================== */

/* ===== Credit page background only ===== */

body.credit-page {
  background-image: none !important;
  background-color: #fff8ed !important;
}

/* Fixed background image, starting below the header */
body.credit-page::after {
  content: "";
  position: fixed;
  top: 93px; /* Desktop header height */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;

  background-image: url("data/credit.jpg");
  background-size: 100% 100%;
  background-position: center top;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Keep Quarto content transparent */
body.credit-page #quarto-content,
body.credit-page main.content,
body.credit-page .page-columns {
  background: transparent !important;
}

/* Smaller screens: adjust for a shorter header */
@media screen and (max-width: 991.98px) {
  body.credit-page::after {
    top: 72px;
  }
}

/* Portrait mobile: use the normal site background instead */
@media screen and (max-width: 767.98px) and (orientation: portrait) {
  body.credit-page::after {
    background-image: url("data/bg-for-all.jpg");
    background-size: cover;
    background-position: center top;
  }
}

/* Hide the mobile text credits on all screen sizes by default */
.mobile-credits {
  display: none;
}

/* Mobile portrait layout only */
@media screen and (max-width: 767.98px) and (orientation: portrait) {
  /* Hide the background-image credits section */
  body.credit-page::after {
    display: none !important;
  }

  body.credit-page {
    background: #fff3dc !important;
    min-height: 100vh;
  }

  /* Show the mobile credits below the fixed header */
  body.credit-page .mobile-credits {
    display: block;
    position: relative;
    margin-top: 0;
    padding: 22px 20px 35px;
    min-height: calc(100vh - 100px);
    background: url("data/bg-for-all.jpg") center top / cover no-repeat;
    color: #59402b;
    text-align: center;
    box-sizing: border-box;
  }

  /* Credits heading */
  body.credit-page .mobile-credits h1 {
    margin: 0;
    color: #a94c0b;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    line-height: 1.3;
  }

  /* Decorative line below Credits */
  body.credit-page .credits-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 290px;
    margin: 12px auto 24px;
    color: #a76b20;
  }

  body.credit-page .credits-decoration span:first-child,
  body.credit-page .credits-decoration span:last-child {
    font-size: 1.6rem;
    line-height: 1;
  }

  body.credit-page .decoration-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      #b98742,
      #b98742,
      transparent
    );
  }

  /* Each role and its names */
  body.credit-page .credit-entry {
    margin: 0 auto 21px;
    padding: 0 0 15px;
    max-width: 480px;
    border-bottom: 1px solid rgba(166, 112, 43, 0.35);
  }

  body.credit-page .credit-entry h2 {
    margin: 0 0 6px;
    color: #80500d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.4;
  }

  body.credit-page .credit-entry p {
    margin: 3px 0;
    color: #594a3d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-style: italic;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  body.credit-page .credit-entry .credit-description {
    margin-top: 7px;
    font-size: 0.9rem;
    font-style: normal;
    line-height: 1.6;
  }

  /* Contributors */
  body.credit-page .contributors {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  body.credit-page .contributors-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  body.credit-page .contributors-list p {
    margin: 0;
  }
}

.genre-controls {
  margin: 1.25rem 0 1.75rem;
}

.genre-controls #genre-search {
  max-width: 420px;
  border-radius: 8px;
  border: 2px solid #e3d3b0;
  padding: 0.6rem 1rem;
}

.genre-controls #genre-search:focus {
  border-color: var(--maroon);
  box-shadow: 0 0 0 0.2rem rgba(107, 15, 26, 0.12);
}

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.genre-pill {
  background: var(--panel);
  border: 1px solid #ecd9b8;
  color: var(--maroon-dark);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.genre-pill:hover {
  border-color: var(--maroon);
}

.genre-pill.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #fff8ed;
}

.genre-pill .pill-count {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.75;
}

.genre-section {
  border-top: 1px solid #ecd9b8;
  padding: 1.25rem 0 0.5rem;
  margin-top: 1rem;
}

.genre-heading {
  margin-top: 0.25rem;
}

.genre-heading .badge {
  vertical-align: middle;
}

.genre-poets {
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}

.genre-chip {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid #ecd9b8;
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.85rem;
  text-decoration: none;
}

.genre-chip:hover {
  background: #f1dfc0;
}

.genre-works {
  columns: 2;
  column-gap: 2rem;
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .genre-works {
    columns: 1;
  }
}

.genre-work-author {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ===== Fix navbar overlap on iPad mini and tablets ===== */

@media screen and (min-width: 768px) and (max-width: 1100px) {
  /* Keep the logo within its own space */
  .navbar-brand-container {
    transform: translateX(50px) !important;
    flex: 0 0 auto;
    margin-right: 12px;
    max-width: 180px;
  }

  .navbar-brand img {
    height: auto !important;
    max-height: 60px !important;
    max-width: 180px !important;
    width: 100%;
    object-fit: contain !important;
  }

  /* Put navigation below the logo when space is limited */
  #navbarCollapse {
    flex-basis: 100%;
    width: 100%;
  }

  #navbarCollapse .navbar-nav {
    flex-wrap: wrap;
    gap: 6px;
  }

  #navbarCollapse .navbar-nav .nav-link {
    padding: 6px 12px !important;
  }

  #navbar-search-form {
    max-width: 100%;
    margin: 10px 0 !important;
  }
}
