
:root {
  --cafe-950: #0a2617;
  --cafe-900: #113b24;
  --cafe-850: #174f31;
  --cafe-800: #20653f;
  --cafe-700: #2b7f50;
  --cafe-amber: #c99b2c;
  --cafe-gold: #e5c158;
  --cafe-gold-light: #fef3c7;
  --cafe-ruby: #991b1b;
  --cafe-ruby-bright: #dc2626;
  --cafe-cream: #ffffff;
  --cafe-muted: #a3cfb1;
  --warm-glow: rgba(229, 193, 88, 0.28);
  --glass-panel: rgba(14, 46, 29, 0.86);
  --glass-card: rgba(17, 54, 34, 0.88);
  --glass-border: rgba(229, 193, 88, 0.32);
  --glass-border-hover: rgba(229, 193, 88, 0.72);
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--cafe-gold) var(--cafe-950);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: var(--cafe-950);
}
::-webkit-scrollbar-thumb {
  background: var(--cafe-amber);
  border-radius: 4px;
  border: 2px solid var(--cafe-950);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cafe-gold);
}

body {
  background-color: var(--cafe-950);
  color: var(--cafe-cream);
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.parallax-layer {
  position: fixed;
  top: -30px;
  left: -30px;
  width: calc(100vw + 60px);
  height: calc(100vh + 60px);
  z-index: 0;
  pointer-events: none;
}

.bg-restaurant-art,
.bg-arcadian-art {
  background-image: url('../img/bg.webp');
  background-size: cover;
  background-position: center 38%;
  filter: brightness(0.85) saturate(1.15);
  transform: scale(1.03);
}

.ambient-overlay {
  background: 
    radial-gradient(circle at 80% 12%, rgba(229, 193, 88, 0.28), transparent 48%),
    radial-gradient(circle at 15% 75%, rgba(52, 211, 153, 0.22), transparent 52%),
    radial-gradient(circle at 50% 50%, rgba(201, 155, 44, 0.08), transparent 60%),
    linear-gradient(to bottom, rgba(10, 38, 23, 0.50) 0%, rgba(10, 38, 23, 0.25) 30%, rgba(10, 38, 23, 0.65) 75%, rgba(10, 38, 23, 0.90) 100%);
}

.font-cinzel {
  font-family: 'Cinzel', serif;
}

.font-mono-isbn {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.glass-panel {
  background: var(--glass-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.wiki-page-container {
  background: rgba(10, 32, 20, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 193, 88, 0.28);
  border-radius: 1.25rem;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 20px 48px -12px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (min-width: 640px) {
  .wiki-page-container {
    padding: 1.25rem 1.75rem 1.75rem;
  }
}

@media (min-width: 1024px) {
  .wiki-page-container {
    padding: 1.5rem 2rem 2rem;
  }
}

.glass-card {
  background: var(--glass-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.85), 0 0 24px rgba(229, 193, 88, 0.25);
  transform: translateY(-3px);
}

.local-edit-card {
  background: rgba(12, 58, 96, 0.82);
  border-color: rgba(96, 165, 250, 0.85);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45), 0 12px 28px -8px rgba(14, 116, 184, 0.45);
}

.local-edit-card:hover {
  border-color: rgba(147, 197, 253, 1);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.7), 0 18px 36px -10px rgba(14, 116, 184, 0.6);
}

.local-edit-row {
  background: rgba(12, 58, 96, 0.55);
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.95);
}

.local-edit-row:hover {
  background: rgba(18, 74, 120, 0.7);
}

.local-edit-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.7);
  background: rgba(14, 116, 184, 0.35);
  color: #e0f2fe;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.local-missing-card {
  background: rgba(92, 58, 8, 0.82);
  border-color: rgba(245, 197, 66, 0.9);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.5), 0 12px 28px -8px rgba(180, 120, 20, 0.45);
}

.local-missing-card:hover {
  border-color: rgba(253, 224, 71, 1);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.75), 0 18px 36px -10px rgba(180, 120, 20, 0.6);
}

.local-missing-row {
  background: rgba(92, 58, 8, 0.5);
  box-shadow: inset 3px 0 0 rgba(245, 197, 66, 0.95);
}

.local-missing-row:hover {
  background: rgba(120, 78, 12, 0.65);
}

.local-missing-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.75);
  background: rgba(161, 98, 7, 0.4);
  color: #fef3c7;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-heading {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cafe-gold);
  border-bottom: 1px solid rgba(229, 193, 88, 0.2);
  padding-bottom: 0.375rem;
}

.volume-card {
  background: rgba(13, 29, 19, 0.8);
  border: 1px solid rgba(229, 193, 88, 0.25);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.volume-card-compact {
  background: rgba(13, 29, 19, 0.85);
  border: 1px solid rgba(229, 193, 88, 0.2);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.25);
}
.volume-card-compact .chapter-row,
.chapter-list-scroll .chapter-row {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
}
@media (min-width: 640px) {
  .volume-card-compact .chapter-row,
  .chapter-list-scroll .chapter-row {
    font-size: 0.8125rem;
    line-height: 1.125rem;
    padding: 0.25rem 0.625rem;
  }
}

/* Five compact chapter rows, then scroll. Row height matches the compact metrics above. */
.chapter-list-scroll {
  --chapter-row-block: calc(1.5rem + 2px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: calc(5 * var(--chapter-row-block) + 4 * 0.25rem + 1px);
  overflow-y: auto;
  padding-right: 0.25rem;
}
.chapter-list-scroll .chapter-row {
  box-sizing: border-box;
  height: var(--chapter-row-block);
  min-height: var(--chapter-row-block);
}
@media (min-width: 640px) {
  .chapter-list-scroll {
    --chapter-row-block: calc(1.625rem + 2px);
  }
}

.chapter-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(7, 19, 11, 0.7);
  border: 1px solid rgba(229, 193, 88, 0.1);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: var(--cafe-cream);
  overflow: hidden;
}

.list-row {
  background: rgba(13, 29, 19, 0.7);
  border: 1px solid rgba(229, 193, 88, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem;
  transition: border-color 0.15s ease;
}
.list-row.cursor-pointer:hover {
  border-color: rgba(229, 193, 88, 0.4);
}

.type-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
  background: var(--cafe-950);
  border: 1px solid rgba(229, 193, 88, 0.3);
  color: var(--cafe-gold);
}

.infobox-table {
  width: 100%;
  font-size: 0.75rem;
  line-height: 1rem;
}
.infobox-table tr {
  border-bottom: 1px solid rgba(229, 193, 88, 0.15);
}
.infobox-table th,
.infobox-table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.infobox-table th {
  width: 33.333%;
  color: var(--cafe-amber);
  font-weight: 600;
  background: rgba(13, 29, 19, 0.6);
}

.btn-action,
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.75rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}
.btn-action {
  background: rgba(17, 59, 36, 0.9);
  border: 1px solid rgba(229, 193, 88, 0.4);
  color: #ffffff;
}
.btn-action:hover {
  background: rgba(23, 79, 49, 0.95);
  border-color: var(--cafe-gold);
  color: #ffffff;
}
.btn-action.btn-muted {
  color: rgba(255, 255, 255, 0.75);
}
.btn-action.btn-muted:hover {
  background: rgba(23, 79, 49, 0.95);
  border-color: var(--cafe-gold);
  color: #ffffff;
}
.btn-primary {
  background: rgba(23, 79, 49, 0.95);
  border: 1px solid var(--cafe-gold);
  color: #ffffff;
}
.btn-primary:hover {
  background: rgba(30, 95, 60, 0.95);
  border-color: var(--cafe-gold);
  filter: brightness(1.1);
  color: #ffffff;
}

@media (min-width: 640px) {
  .section-heading { font-size: 0.875rem; line-height: 1.25rem; }
  .chapter-row { font-size: 0.875rem; line-height: 1.25rem; }
  .list-row { padding: 1rem; }
  .btn-action, .btn-primary { font-size: 0.875rem; line-height: 1.25rem; }
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-btn:hover {
  background: rgba(23, 79, 49, 0.6);
  color: #ffffff;
  border-color: rgba(229, 193, 88, 0.4);
}

.filter-btn.active {
  background: rgba(23, 79, 49, 0.95);
  color: #ffffff;
  border-color: var(--cafe-gold);
  box-shadow: 0 0 10px rgba(229, 193, 88, 0.25);
}

img {
  image-rendering: auto;
  image-rendering: smooth;
  image-rendering: -webkit-optimize-contrast;
  -ms-interpolation-mode: bicubic;
}

.cover-aspect {
  aspect-ratio: 1 / 1.44;
  position: relative;
  overflow: hidden;
  background-color: #113b24;
}

.cover-aspect img,
.volume-card img,
.wiki-infobox img,
.wiki-table img,
.cover-preview img,
#coverLightboxImg,
.lightbox-thumb-btn img,
.no-data-cover img {
  image-rendering: auto;
  image-rendering: smooth;
  image-rendering: -webkit-optimize-contrast;
  -ms-interpolation-mode: bicubic;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#coverLightboxImg.is-rotated {
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
  transition: none;
}

.cover-aspect img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover .cover-aspect img {
  transform: scale(1.05) translateZ(0);
}

.wiki-infobox {
  background: rgba(10, 24, 16, 0.94);
  border: 1px solid rgba(229, 193, 88, 0.35);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8);
}

.wiki-infobox-header {
  background: linear-gradient(135deg, rgba(30, 80, 50, 0.75), rgba(13, 29, 19, 0.95));
  border-bottom: 2px solid var(--cafe-gold);
}

.wiki-table th, .wiki-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(229, 193, 88, 0.12);
}

.wiki-table tr:hover {
  background: rgba(229, 193, 88, 0.06);
}

.modal-overlay {
  background: rgba(4, 12, 7, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content-animated {
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#ambientCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0.65;
}

.copy-tooltip {
  position: relative;
}
.copy-tooltip::after {
  content: 'Copied!';
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cafe-gold);
  color: var(--cafe-950);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.copy-tooltip.copied::after {
  opacity: 1;
}

.no-data-badge {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 10px;
  color: rgba(229, 193, 88, 0.75);
  background: rgba(8, 20, 12, 0.85);
  border: 1px dashed rgba(229, 193, 88, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.no-data-cover {
  width: 3.5rem;
  height: 5rem;
  border-radius: 0.5rem;
  border: 1px dashed rgba(229, 193, 88, 0.35);
  background: rgba(7, 19, 11, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
  padding: 0.25rem;
}

.no-data-thumb {
  width: 2.5rem;
  height: 3.5rem;
  border-radius: 0.25rem;
  border: 1px dashed rgba(229, 193, 88, 0.3);
  background: rgba(7, 19, 11, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
}

.no-data-cover-full {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  border: 1px dashed rgba(229, 193, 88, 0.3);
  background: rgba(7, 19, 11, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.category-tab-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.category-tab-btn:hover {
  background: rgba(23, 79, 49, 0.6);
  color: #ffffff;
  border-color: rgba(229, 193, 88, 0.4);
}

.category-tab-btn.active {
  background: rgba(23, 79, 49, 0.95);
  color: #ffffff;
  font-weight: 700;
  border-color: var(--cafe-gold);
  box-shadow: 0 0 10px rgba(229, 193, 88, 0.25);
}

.markdown-content {
  line-height: 1.7;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content p:last-child {
  margin-bottom: 0;
}

.markdown-content a {
  color: var(--cafe-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.markdown-content a:hover {
  color: var(--cafe-gold-light);
}

.markdown-content strong {
  color: var(--cafe-cream);
  font-weight: 700;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content ul {
  list-style-type: disc;
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.markdown-content ol {
  list-style-type: decimal;
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.markdown-content li {
  margin-bottom: 0.25rem;
}

.markdown-content code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.85em;
  background: rgba(13, 29, 19, 0.85);
  border: 1px solid rgba(229, 193, 88, 0.25);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  color: var(--cafe-gold-light);
}

.markdown-content blockquote {
  border-left: 3px solid var(--cafe-gold);
  padding-left: 0.75rem;
  margin: 0.75rem 0;
  color: var(--cafe-muted);
  font-style: italic;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid rgba(229, 193, 88, 0.2);
  margin: 1rem 0;
}

#modalSourcesSection li:target,
#artistSourcesSection li:target {
  background-color: rgba(229, 193, 88, 0.2);
  border-left: 3px solid var(--cafe-gold);
  padding-left: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.4s ease, border-left 0.4s ease;
}

sup.reference:target {
  background-color: rgba(229, 193, 88, 0.3);
  outline: 2px solid var(--cafe-gold);
  border-radius: 2px;
  padding: 0 2px;
}

.artist-suggest-menu {
  position: fixed;
  z-index: 70;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: rgba(10, 38, 23, 0.98);
  border: 1px solid rgba(229, 193, 88, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.artist-suggest-item {
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1.25;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.artist-suggest-item span {
  display: block;
  color: var(--cafe-muted);
  font-size: 0.65rem;
}

.artist-suggest-item.is-active,
.artist-suggest-item:hover {
  background: rgba(229, 193, 88, 0.18);
  color: var(--cafe-gold);
}

body:not(.edit-mode) .requires-edit-mode {
  display: none !important;
}

.edit-mode-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(10, 38, 23, 0.9);
  border: 1px solid rgba(229, 193, 88, 0.35);
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.edit-mode-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #a3cfb1;
  transition: transform 0.15s ease, background 0.15s ease;
}

.edit-mode-switch.is-on {
  background: rgba(229, 193, 88, 0.35);
  border-color: #e5c158;
}

.edit-mode-switch.is-on::after {
  transform: translateX(20px);
  background: #e5c158;
}

.hidden,
[hidden] {
  display: none !important;
}

[class*="space-y-"] > .hidden,
[class*="space-y-"] > [hidden],
.flex > .hidden,
.flex > [hidden] {
  display: none !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
