/* palette:start — generated from src/palette.py, do not edit by hand */
:root {
    --very-dark-purple: #2d162c;
    --dark-purple: #412752;
    --purple: #683a68;
    --light-purple: #9775a6;
    --text: #f5eac2;
    --bg: #2c1f33;
}
/* palette:end */

/* semantic: role-based aliases onto the primitives above. Component rules
   below must reference only these, never a primitive var directly, so a
   role's color can be repointed in one place. --color-text is the only text
   color anywhere; accents are fills/borders only (surfaces, buttons, nav).
   --color-accent-soft/--color-border resolve to --light-purple, which only
   reaches ~3.2:1 against --color-text (below 4.5:1 AA) — a known tradeoff on
   resting-state button labels. */
:root {
    --color-bg: var(--bg);
    --color-text: var(--text);
    --color-surface: var(--dark-purple);
    --color-border: var(--light-purple);
    --color-nav-bg: var(--very-dark-purple);
    --color-accent: var(--purple);
    --color-accent-soft: var(--light-purple);
    --color-selected: var(--dark-purple);

    /* cover art (/cover) is duotone-mapped onto the palette above server-side,
       which reads as flat/muted on its own - these punch it up client-side,
       adjustable from the theme settings page rather than fixed per image. */
    --cover-saturate: 80%;
    --cover-brightness: 200%;
    --cover-hue: -20deg;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--color-text); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--color-accent); }

/* app shell: persistent left sidebar + main content pane */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--color-nav-bg);
    border-right: 1px solid var(--color-border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar .brand { font-weight: 600; color: var(--color-text); font-size: 16px; padding: 6px 10px 14px; }
.sidebar a:not(.brand) {
    color: var(--color-text);
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 6px;
}
.sidebar a:not(.brand):hover { background: var(--color-surface); text-decoration: none; }
.sidebar-divider { border: none; border-top: 1px solid var(--color-border); margin: 6px 10px; }
.sidebar-bottom {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.content { flex: 1; min-width: 0; padding: 24px 32px; }
@media (max-width: 700px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .sidebar-bottom { margin-top: 0; padding-top: 0; border-top: none; flex-direction: row; }
}

h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; color: var(--color-text); }
h2 { font-size: 18px; font-weight: 600; margin: 20px 0 10px; color: var(--color-text); }

.subtitle { color: var(--color-text); opacity: 0.7; font-size: 14px; }
.subtitle a { text-decoration: underline; }

.divider { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px;
    margin: 0 -10px;
    border-radius: 4px;
    font-size: 14px;
    min-width: 0;
    min-height: 44px;
}
.row:hover { background: var(--color-selected); }
.row .left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}
.row .row-primary {
    display: inline-block;
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.row .row-secondary {
    display: inline-block;
    flex-shrink: 0;
    max-width: 40%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.row .note {
    color: var(--color-text);
    opacity: 0.7;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.row-bar {
    position: relative;
    width: 100px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 4px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.row-bar-fill {
    position: absolute;
    inset: 0;
    height: 100%;
    background: var(--color-accent);
}
.row-bar-label {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 11px;
    color: var(--color-text);
}
.row .sep { color: var(--color-text); opacity: 0.7; flex-shrink: 0; }

.row-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    filter: saturate(var(--cover-saturate)) brightness(var(--cover-brightness)) hue-rotate(var(--cover-hue));
}

.hero-image {
    width: 160px;
    height: 160px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: block;
    margin-bottom: 12px;
    filter: saturate(var(--cover-saturate)) brightness(var(--cover-brightness)) hue-rotate(var(--cover-hue));
}

.hero-image-raw { filter: none; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
}
.grid-compact .card-title, .grid-compact .card-secondary { font-size: 12px; }

.card { display: flex; flex-direction: column; min-width: 0; position: relative; }

.card[data-tooltip]::after, .card[data-tooltip]::before {
    z-index: 20;
    position: absolute;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.card[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: 100%;
    width: max-content;
    max-width: 220px;
    margin-bottom: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-accent);
    background: var(--color-nav-bg);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, 4px);
}

.card[data-tooltip]::before {
    content: "";
    bottom: 100%;
    width: 10px;
    height: 10px;
    margin-bottom: 8px;
    background: var(--color-nav-bg);
    border-right: 1px solid var(--color-accent);
    border-bottom: 1px solid var(--color-accent);
    transform: translate(-50%, 4px) rotate(45deg);
}

.card[data-tooltip]:hover::after, .card[data-tooltip]:hover::before {
    opacity: 1;
    transform: translate(-50%, 0) rotate(45deg);
}

.card[data-tooltip]:hover::after {
    transform: translate(-50%, 0);
}

.card-cover { display: block; border-radius: 8px; overflow: hidden; }

.card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: transform 0.15s ease;
    filter: saturate(var(--cover-saturate)) brightness(var(--cover-brightness)) hue-rotate(var(--cover-hue));
}

.card-thumb-empty { aspect-ratio: 1 / 1; }

.card-thumb-raw { filter: none; }

.card-cover:hover .card-thumb { transform: scale(1.03); }

.card-title {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-title:hover { text-decoration: underline; }

.card-secondary {
    display: block;
    font-size: 13px;
    color: var(--color-text);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-secondary:hover { text-decoration: underline; }

.card-note {
    display: block;
    font-size: 12px;
    color: var(--color-text);
    opacity: 0.55;
}

.search-form { display: flex; gap: 8px; margin: 20px 0; }
.search-form input {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
.search-form input:focus { border-color: var(--color-accent); }
.search-form button {
    background: var(--color-accent-soft);
    color: var(--color-text);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}
.search-form button:hover { background: var(--color-accent); }

.btn {
    display: inline-block;
    background: var(--color-accent-soft);
    color: var(--color-text);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--color-accent); }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-header h1 { margin-bottom: 0; }

.list-title-row { display: flex; align-items: center; flex-wrap: nowrap; gap: 12px; }
.list-title-row h2 { margin-bottom: 0; white-space: nowrap; }
.list-title-row .btn { flex-shrink: 0; white-space: nowrap; }

.description-form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; max-width: 480px; }
.description-input {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
}
.description-input:focus { outline: none; border-color: var(--color-accent); }
.description-form .btn { align-self: flex-start; }

.year-filter { display: flex; align-items: center; gap: 12px; }
.year-filter-label { font-size: 14px; font-weight: 600; min-width: 9ch; text-align: right; }

.year-range {
    position: relative;
    width: 180px;
    height: 20px;
}
.year-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 2px;
}
.year-range-fill {
    position: absolute;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    background: var(--color-accent);
}
.year-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}
.year-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-text);
    cursor: pointer;
}
.year-thumb::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-text);
    cursor: pointer;
}
.year-thumb::-moz-range-track { background: transparent; border: none; }

/* heatmap: cell colors are an independent 4-color intensity ramp
   (see src/constants.py COLORS); the lightest step only reaches ~3.2:1
   against --color-text, same tradeoff as --color-accent-soft above */
.heatmap-wrap { background: var(--color-bg); border: 1px solid var(--color-border); padding: 8px; border-radius: 6px; display: inline-block; }
.heatmap-wrap table { border-collapse: separate; border-spacing: 2px; }
.heatmap-wrap th { font-size: 11px; color: var(--color-text); opacity: 0.7; text-align: center; width: 44px; }
.heatmap-wrap th.row-label { width: 40px; }
.hm-cell {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    text-align: center;
    line-height: 32px;
    font-size: 11px;
    color: var(--color-text);
    text-decoration: none;
}
.hm-cell:hover { opacity: 0.8; text-decoration: none; }
.hm-day-cell {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    text-align: center;
    line-height: 28px;
    font-size: 10px;
    color: var(--color-text);
    text-decoration: none;
}
.heatmap-cols { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }

/* pagination */
.pagination { display: flex; align-items: center; gap: 2px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 4px;
    color: var(--color-text);
}
.pagination span.current { background: var(--color-selected); }
.pagination .pg-info { color: var(--color-text); opacity: 0.7; margin-left: 10px; }

.info { color: var(--color-text); opacity: 0.7; font-size: 14px; padding: 12px 0; }

/* detail page layout: header+list on the left, heatmap on the right, both
   panels pinned to the same height so a long list scrolls inside its own
   panel instead of growing the page */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 20px;
    margin-top: 16px;
}
.panel {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
}
.detail-layout .panel {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.detail-heatmap { overflow-x: auto; }
.detail-header .hero-image { margin-bottom: 12px; }
.detail-header h1 { margin-top: 4px; }
@media (max-width: 700px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-layout .panel { max-height: none; overflow-y: visible; }
}

/* htmx loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* theme override page */
.theme-grid { margin-top: 16px; }
.theme-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}
.theme-label { flex: 1; font-size: 14px; }
.theme-swatch {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
}
.theme-hex {
    width: 90px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    padding: 6px 8px;
    font-size: 13px;
    font-family: monospace;
}
.theme-hex:focus { outline: none; border-color: var(--color-accent); }
.theme-clear {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}
.theme-clear:hover { background: var(--color-surface); }
.theme-range { flex-shrink: 0; }
.theme-range-value {
    display: inline-block;
    min-width: 64px;
    text-align: right;
    font-family: monospace;
    font-size: 13px;
    flex-shrink: 0;
}

