/*
 * Site-wide base styles. Global feature CSS (pagy, slimselect, actiontext, chapters_reader)
 * is linked from the layout via Layout::StylesheetsHelper#global_stylesheets — Propshaft does
 * not bundle @import, so separate stylesheet_link_tags are required for reliable loading.
 * Page-specific CSS (sweetal2, flatpickr overrides, adult disclaimer) via #page_stylesheets.
 */

@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

@layer base {
    *,
    ::after,
    ::before,
    ::backdrop,
    ::file-selector-button {
      border-color: var(--color-gray-200, currentColor);
    }
}

/* Expandable Note styles for TinyMCE content */
.note-reference {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-bottom: 1px dotted rgba(8, 145, 178, 0.6);
  color: inherit;
  transition: all 0.2s ease;
}

.dark .note-reference {
  border-bottom-color: rgba(244, 63, 94, 0.6);
}

.note-reference:hover {
  background-color: rgba(8, 145, 178, 0.1);
  border-bottom-color: rgba(8, 145, 178, 1);
}

.dark .note-reference:hover {
  background-color: rgba(244, 63, 94, 0.1);
  border-bottom-color: rgba(244, 63, 94, 1);
}

.note-reference::after {
  content: '📝';
  font-size: 0.7em;
  margin-left: 2px;
  opacity: 0.7;
}

.note-content {
  display: none;
  margin: 8px 0 16px 0;
  padding: 12px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(8, 145, 178, 0.2);
  border-left: 3px solid rgba(8, 145, 178, 0.6);
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.4;
  color: rgba(55, 65, 81, 0.9);
  font-style: italic;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .note-content {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(244, 63, 94, 0.3);
  border-left-color: rgba(244, 63, 94, 0.6);
  color: rgba(209, 213, 219, 0.9);
}

.note-content.show {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Turbo Drive transitions (Phase 2) --- */

/* Premium progress bar — fades in only when visit exceeds Turbo.setProgressBarDelay */
.turbo-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgb(8 145 178) 0%,
    rgb(244 63 94) 50%,
    rgb(8 145 178) 100%
  );
  background-size: 200% 100%;
  animation: turbo-progress-shimmer 0.9s ease-in-out infinite;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.turbo-progress-bar[style*="width"] {
  opacity: 1;
}

@keyframes turbo-progress-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.turbo-progress-bar--hidden {
  display: none !important;
}

/* Cross-fade on full body swap (skipped when morph handles the visit) */
html.turbo-transitioning body {
  opacity: 0.92;
  transition: opacity 0.12s ease-out;
}

html:not(.turbo-transitioning) body {
  opacity: 1;
  transition: opacity 0.18s ease-in;
}

/* Navbar wrapper must stack above page shells (e.g. fictions/show z-10) and not clip dropdowns */
#site-navbar {
  overflow: visible;
}

/* View Transitions API — page content only (avoid view-transition-name on navbar; it breaks Flowbite dropdowns) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.2s;
  animation-timing-function: ease-out;
}