/* General site-wide styles for a warm, minimalist feel */
body {
    margin: 0;
    padding: 0;
    color: #3b3a30; /* A rich, deep brown-gray */
    background-color: #fcfbf8; /* A warm, creamy off-white */
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    overflow-x: hidden; /* Prevents horizontal scroll on mobile */
}

/* Headings with a touch of elegance */
h1, h2, h3 {
    font-family: 'Georgia', serif; /* A classic serif font for sophistication */
    color: #1a1a1a;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 2rem;
    position: relative;
    display: inline-block;
}

h1 { font-size: 3em; text-align: center; }
h2 { font-size: 2.2em; }
h3 { font-size: 1.6em; }


/* Main content area */
main {
    max-width: 900px;
    margin: auto;
    padding: 2rem;
}

/* Header and navigation (unchanged from previous) */
header {
    text-align: center;
    padding: 2rem 0;
    background-color: #fcfbf8;
}

header h1 {
    font-size: 2.5rem;
    color: #1a1a1a;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: inline-block;
}

.header-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: transparent;
    color: #3b3a30;
    padding: 14px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
}

.dropbtn:hover {
    color: #1a1a1a;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 250px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 1;
    border: 1px solid #ddd;
    border-top: none;
    text-align: left;
}

.dropdown-content a {
    color: #3b3a30;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.nav-link {
    text-decoration: none;
    background-color: transparent;
    color: #3b3a30;
    padding: 14px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #1a1a1a;
}

/* Dictionary page and filter styles */
.filter-controls {
    text-align: center;
    margin: 0 0 0; /* Reduced margins to minimize space */
    display: flex;
    justify-content: center;
    gap: 1px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: transparent;
    color: #888;
    padding: 10px 18px;
    font-size: 1em;
    font-weight: bold;
    border: none; /* No border for a clean look */
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.filter-btn.active {
    color: #a35d4f; /* A warm, beautiful accent color */
    border-bottom: 2px solid #a35d4f; /* A clean, modern indicator line */
}

.filter-btn:hover:not(.active) {
    color: #1a1a1a;
}

#dictionary-entries {
    display: grid;
    gap: 20px;
}

.entry {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05); /* Softer, more elegant shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* New CSS for the entry header and tag */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d1c9bd;
    padding-bottom: 8px;
    margin-bottom: 1rem;
}

.entry-header h3 {
    margin: 0;
    padding: 0;
    border-bottom: none;
    font-size: 1.5em;
    font-weight: 500;
}

.entry-header h3.entry-title {
    color: #2b2b2b;
}

.category-tag {
    font-size: 0.8em;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
}

/* Unique colors for each category tag */
.category-tag-ring-bank {
    background-color: #a35d4f; /* Warm accent color */
}

.category-tag-mainstream {
    background-color: #007bff; /* Blue */
}

.category-tag-michael-levin {
    background-color: #dc3545; /* Red */
}

.category-tag-predictive-processing {
    background-color: #28a745; /* Green */
}

.category-tag-neuroscience {
    background-color: #6c757d; /* Gray */
}

.category-tag-immanuel-kant {
    background-color: #556b2f; /* Dark olive green */
}

.category-tag-person {
    background-color: #8b4513; /* A warm saddle brown */
}

.category-tag-math {
    background-color: #4CAF50; /* A vibrant green */
}

.category-tag-dynamics {
    background-color: #2196F3; /* A bright blue */
}

.category-tag-book {
    background-color: #9c27b0; /* A deep purple */
}

.category-tag-paper {
    background-color: #FF9800; /* A bold orange */
}

/* Ensure existing entry p tags are correctly styled */
.entry p {
    color: #4b4b4b;
    margin-top: 0;
    margin-bottom: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    h1 { font-size: 2em; }
    h2 { font-size: 1.5em; }
    .dropbtn, .nav-link { font-size: 1em; padding: 10px; }
    .filter-controls {
        flex-direction: column;
        align-items: center;
    }
    .filter-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Collapse whitespace in entry text and hide truly empty paragraphs */
.entry p { white-space: normal; }
.entry p:empty { display: none; }

.footer-container {
    text-align: center;
    max-width: 900px;
    margin: 2rem auto 2rem;
    padding: 2rem 0;
    border-top: 1px solid #d1c9bd; /* A subtle, elegant top border */
    font-size: 0.9em;
    color: #5d5d5d;
}

.footer-container p {
    margin: 0.5em 0;
}

.card-link { display:block; text-decoration:none; color:inherit; }

.card-link { display:block; text-decoration:none; color:inherit; }
.entry p { white-space: normal; }
.entry p:empty { display: none; }

/* clicks inside controls OR plot elements should never trigger the card link */
.card-link .controls,
.card-link .controls *,
.card-link #morlet-graph,
.card-link input[type="range"],
.card-link .plotly-graph-div {
  pointer-events: auto;
}

/* Prevent card link behavior on ALL interactive plot elements */
.card-link #morlet-graph,
.card-link input[type="range"],
.card-link .plotly-graph-div,
.card-link .js-plotly-plot,
.card-link .modebar,
.card-link .modebar-group,
.card-link .plot-container,
.card-link .svg-container {
  pointer-events: auto !important;
}

/* Optional: Make it clear these elements are interactive */
.card-link input[type="range"] {
  cursor: grab;
}

.card-link input[type="range"]:active {
  cursor: grabbing;
}

/* COMPLETELY isolate the Morlet plot from any link behavior */
#complex-morlet-wavelet-math,
#complex-morlet-wavelet-math *:not(.entry-title) {
  pointer-events: auto !important;
}

.entry-link-symbol {
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    font-size: 1.2em;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: auto;
    z-index: 10;
}

.entry-link-symbol:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Ensure Plotly gets full control */
#morlet-graph, 
.plotly-graph-div, 
.js-plotly-plot,
input[type="range"] {
    pointer-events: auto !important;
}

/* Remove any lingering hover effects */
.card-link { 
    display: block; 
    text-decoration: none; 
    color: inherit; 
}

/* REMOVE ALL CARD HOVER EFFECTS */
.entry {
    transform: none !important;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05) !important;
}

.card-link:hover .entry {
    transform: none !important;
}

/* Make entire cards non-clickable */
.card-link {
    pointer-events: none;
    cursor: default;
}
