/* MUFI-compatible font declarations */
@font-face {
  font-family: 'Junicode';
  src: url('fonts/JunicodeVF-Roman.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Junicode';
  src: url('fonts/JunicodeVF-Italic.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

/* Set Junicode as the default font for the entire book */
body {
  font-family: 'Junicode', serif;
}

/* Let Quarto handle the main sidebar - only add transparency */
.sidebar:not(.margin-sidebar) {
  background-color: transparent !important;
}

/* Ensure margin sidebar (TOC) appears on the right */
.sidebar.margin-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.15);
  border-left: none;
  z-index: 999;
  padding: 1em;
}

/* Make sidebar background transparent in all states */
.sidebar.sidebar-navigation.rollup.quarto-sidebar-toggle-contents,
.sidebar.sidebar-navigation:not(.rollup),
.quarto-sidebar-collapse-item.collapse:not(.show) {
  background-color: transparent !important;
}


/* Remove border when collapsed */
.quarto-sidebar-collapse-item.collapse:not(.show) {
  border-right: none !important;
}

/* Main content adjustment - let Quarto handle left margin, just add right margin for TOC */
.column-body-outset {
  margin-right: 320px; /* TOC width + padding */
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

/* Container for all columns */
.layout-row {
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(minmax(fit-content, 300px), 500px));
  gap: 2em;
  width: 100%;
  justify-content: center;
  padding: 0 1em;
}

/* Base column styles */
.column {
  transition: all 0.3s ease;
  opacity: 0.5;
  flex: 1;
  min-width: minmax(fit-content, 300px); /* Dynamic minimum width based on content */
  max-width: 500px;
  position: relative;
  max-height: none;
  overflow-y: visible;
  background: transparent;
}

/* Scrollbar styling for container */
.layout-row::-webkit-scrollbar {
  width: 8px;
}

.layout-row::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.layout-row::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.column:hover {
  opacity: 1;
}

/* Container positioning */
.column:first-child {
  position: relative;
  margin-left: 0;
}

/* Appendix Line numbers */
.column .line-number {
  position: absolute;
  left: -2.5em;
  margin-top: 0.25em;
  z-index: 1;
  font-family: "Helvetica", sans-serif;
  color: #999;
  font-size: 0.8em;
}

/* Folio numbers */
.column .folio-number {
  position: absolute;
  left: -4em;
  font-family: "Palatino", serif;
  font-style: italic;
  color: #666;
  font-size: 0.9em;
}

/* Content spacing */
.edition-text {
  margin-left: 3em !important;
  position: relative;
  line-height: 1.2;
}

.column-break {
  display: block;
  margin-bottom: 1em !important;
  margin-top: 1em !important;
  margin-left: 3em !important;
  position: relative;
  line-height: 1.2;
  background-color: transparent;
}

/* Decorative initials styling for appendix */
.decorative-initial {
  float: left;
  font-family: "Palatino", "Georgia", serif; /* A font with nice capitals */
  margin-right: 0.1em;
  line-height: 0.8;
  color: #8B0000; /* Dark red - typical for medieval manuscripts */
  position: relative;
}

.decorative-initial[data-size="2"] {
  font-size: 2em;  /* Twice regular text size */
  top: 0.05em;
}

.decorative-initial[data-size="3"] {
  font-size: 3em;  /* Three times regular text size */
  top: 0.1em;
}

.decorative-initial[data-size="4"] {
  font-size: 4em;  /* Four times regular text size */
  top: 0.15em;
}

.decorative-initial[data-size="5"] {
  font-size: 5em;  /* Five times regular text size */
  top: 0.2em;
}

.decorative-initial[data-size="6"] {
  font-size: 6em;  /* Six times regular text size */
  margin-top: 0.25em;
}

/* Floriate style */
.decorative-initial.floriate {
  color: #8B0000; /* Dark red */
}

/* Specific styling for portrait columns */
/* Container for full-width layout */
.column-page-outset {
  max-width: 100vw;
  margin: 0;
  padding: 0 1em;
  overflow-x: auto;
}

.portrait-column {
  padding: 0.5em;
  margin-left: 0;
  min-width: 400px;
  width: auto;
  transition: opacity 0.3s ease;
  opacity: 0.7;
}

/* Ensure text has room to breathe */
.portrait-column p {
  line-height: 1.5;
  white-space: nowrap;
}

.portrait-column:hover {
  opacity: 1;
}

/* Container for portrait layout - let Quarto handle left margin */
.portrait-column-container {
  margin-right: 320px; /* TOC width + padding */
}

.text-container {
  position: relative;
  width: fit-content;
  min-width: 100%;
}

.default-text, .hover-text {
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.hover-text {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.text-container:hover .default-text {
  opacity: 0;
}

.text-container:hover .hover-text {
  opacity: 1;
}

/* Specific styling for portrait columns with visualizations */
.empty-line {
  display: block;
  background-color: rgba(245, 171, 171, 0.5); /* pale red base */
  background-image: linear-gradient(135deg, 
                    rgba(245, 171, 171, 0.7) 25%, 
                    rgba(245, 171, 171, 0.5) 25%, 
                    rgba(245, 171, 171, 0.5) 50%, 
                    rgba(245, 171, 171, 0.7) 50%, 
                    rgba(245, 171, 171, 0.7) 75%, 
                    rgba(245, 171, 171, 0.5) 75%, 
                    rgba(245, 171, 171, 0.5));
  background-size: 15px 15px; /* Smaller pattern */
  height: 1.5em;
  width: 100%;
}

.unique-verse {
  background-color: rgba(173, 216, 173, 0.5); /* pale green */
}

.negation {
  background-color: rgba(135, 206, 250, 0.5); /* sky blue */
  background-image: 
    linear-gradient(45deg, rgba(0, 0, 128, 0.1) 25%, transparent 25%), 
    linear-gradient(-45deg, rgba(0, 0, 128, 0.1) 25%, transparent 25%);
  background-size: 10px 10px;
  padding-bottom: 1px;
}

.color-word {
  background-color: rgba(218, 112, 214, 0.4); /* orchid */
}

.sequence-change {
  display: block;
  background-color: rgba(240, 230, 140, 0.5); /* khaki yellow */
  height: 1.5em;
  width: 100%;
}

.visualization-legend {
  margin: 1em 0;
  padding: 1em;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.legend-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid #ccc;
}


/* Ensure proper spacing between columns when wrapped */
@media (max-width: 1200px) {
  .column {
    flex: 0 0 calc(50% - 2em);
  }
}

@media (max-width: 768px) {
  .column {
    flex: 0 0 100%;
  }
}

/* Line Numbers and Folio Numbers styling for Portraits Pages */
.verse-line {
  display: block;
  position: relative;
  padding-left: 10px;
}

.line-number {
  display: inline-block;
  position: absolute;
  left: -28px;
  width: 25px;
  text-align: right;
  font-size: 0.8em;
  color: #999;
  font-family: "Helvetica", sans-serif;
}

/* Quote table styling - minimal, invisible appearance */
.quote-table {
  border: none !important;
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  border-spacing: 0;
}

.quote-table th,
.quote-table td {
  border: none !important;
  padding: 0.1em 0.3em !important;
  text-align: left;
  vertical-align: top;
  background: transparent !important;
}

.quote-table th {
  font-weight: normal !important;
  background: transparent !important;
  border-bottom: none !important;
  border-top: none !important;
}

/* Remove any default table styling */
.quote-table thead,
.quote-table tbody,
.quote-table tfoot {
  border: none !important;
}

.quote-table tr {
  border: none !important;
  background: transparent !important;
}

/* Remove borders from all table elements */
.quote-table table,
.quote-table caption,
.quote-table colgroup,
.quote-table col {
  border: none !important;
}

/* Ensure no hover effects */
.quote-table tr:hover,
.quote-table td:hover,
.quote-table th:hover {
  background: transparent !important;
}

/* Remove any outline or box-shadow that might create visual borders */
.quote-table,
.quote-table * {
  outline: none !important;
  box-shadow: none !important;
}

.folio-number {
  display: inline-block;
  position: absolute;
  left: -25px;
  width: 25px;
  text-align: right;
  white-space: nowrap;
  font-style: italic;
  color: #666;
  font-size: 0.75em;
  font-family: "Palatino", serif;
}