/* license.broker — Scandinavian functional / Muji clean
   Match Interface (Hero): split-screen, filter panel left + listings right.
   Palette:
     #2a2824 text          #ffffff white right panel
     #8a847a stone         #e8e4de border
     #3d6b50 forest sage   #edf4ef pale sage
     #f0ebe4 warm sand     #f5f3ef warm linen left panel
   Typography: Figtree (display), Karla (body & meta).
   Fallbacks include Inter and system sans where Google Fonts are unavailable.
*/

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    background: #f5f3ef;
    color: #2a2824;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: "Karla", "Inter", system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #2a2824;
    background: #ffffff;
}

a {
    color: #3d6b50;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 180ms ease;
}

a:hover {
    border-bottom-color: #3d6b50;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ---- Matchline ---- */
.matchline {
    position: fixed;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100vh;
    background: #3d6b50;
    opacity: 0.2;
    z-index: 10;
    pointer-events: none;
}

/* ---- App grid ---- */
.app {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.panel {
    padding: 2.5rem 2.25rem;
}

.panel-left {
    background: #f5f3ef;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 0; /* matchline takes that role */
}

.panel-right {
    background: #ffffff;
    overflow-y: auto;
    min-height: 100vh;
}

/* ---- Brand ---- */
.brand {
    margin-bottom: 2rem;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
}

.brand-glyph {
    flex-shrink: 0;
}

.brand-name {
    font-family: "Figtree", "Inter", sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: -0.01em;
    color: #2a2824;
    margin: 0;
}

.brand-tag {
    font-family: "Karla", sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #8a847a;
    margin: 0;
    max-width: 38ch;
}

/* ---- Drawer toggle (mobile only) ---- */
.drawer-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1.5px solid #e8e4de;
    border-radius: 6px;
    font-family: "Figtree", sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: #2a2824;
    margin-bottom: 1rem;
    transition: border-color 180ms ease;
}

.drawer-toggle:hover {
    border-color: #3d6b50;
}

.drawer-toggle svg {
    transition: transform 220ms ease;
}

.drawer-toggle.is-open svg {
    transform: rotate(180deg);
}

/* ---- Drawer contents ---- */
.drawer {
    display: block;
}

.filter-section {
    padding: 1.25rem 0;
    border-bottom: 1px solid #e8e4de;
}

.filter-section:last-child {
    border-bottom: 0;
}

.filter-section:first-of-type {
    padding-top: 0;
}

.filter-title {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a847a;
    margin: 0 0 0.85rem;
}

.field-label {
    display: block;
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a847a;
    margin-bottom: 0.6rem;
}

.field-hint {
    margin: 0.55rem 0 0;
    font-size: 0.8rem;
    color: #8a847a;
}

/* ---- Search ---- */
.search-wrap {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.4rem;
    border: 1.5px solid #e8e4de;
    border-radius: 6px;
    font-family: "Karla", sans-serif;
    font-size: 0.95rem;
    background: #ffffff;
    color: #2a2824;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-input::placeholder {
    color: #8a847a;
}

.search-input:focus {
    border-color: #3d6b50;
    outline: none;
    box-shadow: 0 0 0 3px rgba(61, 107, 80, 0.1);
}

/* ---- Filter checklists ---- */
.filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.check:hover {
    background: #edf4ef;
}

.check input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid #8a847a;
    border-radius: 3px;
    background: #ffffff;
    margin: 0;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.check input:checked {
    background-color: #3d6b50;
    border-color: #3d6b50;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><polyline points='2.5,6.5 5,9 9.5,3.5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

.check-box {
    display: none; /* checkbox visual is the input itself */
}

.check-label {
    flex-grow: 1;
    font-family: "Karla", sans-serif;
    font-size: 0.92rem;
    color: #2a2824;
}

.check-count {
    font-family: "Karla", sans-serif;
    font-size: 0.78rem;
    color: #8a847a;
    font-variant-numeric: tabular-nums;
}

/* ---- Sort chips ---- */
.sort-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sort-chip {
    padding: 0.35rem 0.85rem;
    border: 1px solid #e8e4de;
    background: #ffffff;
    border-radius: 100px;
    font-family: "Karla", sans-serif;
    font-size: 0.82rem;
    color: #2a2824;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.sort-chip:hover {
    border-color: #3d6b50;
    color: #3d6b50;
}

.sort-chip.is-active {
    background: #edf4ef;
    border-color: #3d6b50;
    color: #3d6b50;
}

/* ---- Buttons ---- */
.filter-actions {
    display: flex;
    justify-content: flex-start;
}

.btn-link {
    background: none;
    border: 0;
    font-family: "Karla", sans-serif;
    font-size: 0.85rem;
    color: #3d6b50;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 180ms ease;
}

.btn-link:hover {
    border-bottom-color: #3d6b50;
}

.btn-primary {
    padding: 0.7rem 1.2rem;
    background: #3d6b50;
    color: #ffffff;
    border: 1.5px solid #3d6b50;
    border-radius: 6px;
    font-family: "Figtree", sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: background-color 180ms ease, transform 180ms ease;
}

.btn-primary:hover {
    background: #2f5640;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-ghost {
    padding: 0.7rem 1.2rem;
    background: transparent;
    color: #2a2824;
    border: 1.5px solid #e8e4de;
    border-radius: 6px;
    font-family: "Figtree", sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    transition: border-color 180ms ease, color 180ms ease;
}

.btn-ghost:hover {
    border-color: #3d6b50;
    color: #3d6b50;
}

/* ---- Results header ---- */
.results-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e8e4de;
}

.results-title {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #2a2824;
    margin: 0 0 0.25rem;
}

.results-meta {
    font-family: "Karla", sans-serif;
    font-size: 0.85rem;
    color: #8a847a;
    margin: 0;
}

.legend {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
}

/* ---- License list ---- */
.license-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.license-row {
    padding: 1.1rem 0;
    border-bottom: 1px solid #e8e4de;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 180ms ease, padding 180ms ease;
    animation: rowEnter 360ms ease both;
}

.license-row:hover {
    background: #edf4ef;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.license-row.is-active {
    background: #edf4ef;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.license-main {
    min-width: 0;
    flex-grow: 1;
}

.license-title {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #2a2824;
    margin: 0 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.license-meta {
    font-family: "Karla", sans-serif;
    font-size: 0.8rem;
    color: #8a847a;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    align-items: center;
}

.license-meta .dot {
    color: #c9c4ba;
}

.license-side {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
}

.license-side .price {
    font-family: "Figtree", sans-serif;
    font-weight: 500;
    font-size: 0.92rem;
    color: #2a2824;
    font-variant-numeric: tabular-nums;
}

.license-arrow {
    color: #8a847a;
    transition: transform 200ms ease, color 200ms ease;
}

.license-row:hover .license-arrow {
    transform: translateX(3px);
    color: #3d6b50;
}

@keyframes rowEnter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Status badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2em 0.7em;
    font-family: "Karla", sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 100px;
    white-space: nowrap;
    line-height: 1.4;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.badge-available {
    background: #edf4ef;
    color: #3d6b50;
}

.badge-pending {
    background: #f0ebe4;
    color: #8a847a;
}

.badge-matched {
    background: #e8e4de;
    color: #2a2824;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem 2rem;
    color: #8a847a;
}

.empty-illustration {
    margin-bottom: 1rem;
    opacity: 0.85;
}

.empty-title {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #2a2824;
    margin: 0 0 0.25rem;
}

.empty-sub {
    font-family: "Karla", sans-serif;
    font-size: 0.85rem;
    color: #8a847a;
    margin: 0;
}

/* ---- Footer ---- */
.footer {
    grid-column: 1 / -1;
    background: #ffffff;
    border-top: 1px solid #e8e4de;
    padding: 1.25rem 2rem;
    text-align: center;
}

.footer p {
    font-family: "Karla", sans-serif;
    font-size: 0.82rem;
    color: #8a847a;
    margin: 0;
    letter-spacing: 0.02em;
}

.footer a {
    color: #8a847a;
}

.footer a:hover {
    color: #3d6b50;
    border-bottom-color: #3d6b50;
}

/* ---- Detail slide-over ---- */
.detail {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 92vw);
    height: 100vh;
    background: #ffffff;
    border-left: 1px solid #e8e4de;
    box-shadow: -12px 0 32px rgba(42, 40, 36, 0.06);
    z-index: 30;
    transform: translateX(100%);
    transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
    overflow-y: auto;
}

.detail[hidden] {
    display: block !important; /* keep transition working */
    visibility: hidden;
    pointer-events: none;
}

.detail.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.detail-inner {
    padding: 2.25rem;
}

.detail-close {
    background: none;
    border: 0;
    font-family: "Karla", sans-serif;
    font-size: 0.85rem;
    color: #8a847a;
    padding: 0;
    margin-bottom: 1.5rem;
    transition: color 160ms ease;
}

.detail-close:hover {
    color: #3d6b50;
}

.detail-eyebrow {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8a847a;
    margin: 0 0 0.5rem;
}

.detail-title {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: #2a2824;
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.detail-meta {
    font-family: "Karla", sans-serif;
    font-size: 0.85rem;
    color: #8a847a;
    margin: 0 0 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.55rem 1rem;
    margin: 0 0 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid #e8e4de;
    border-bottom: 1px solid #e8e4de;
}

.detail-grid dt {
    font-family: "Figtree", sans-serif;
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8a847a;
}

.detail-grid dd {
    margin: 0;
    font-family: "Karla", sans-serif;
    font-size: 0.9rem;
    color: #2a2824;
}

.detail-summary {
    font-family: "Karla", sans-serif;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #2a2824;
    margin: 0 0 1.75rem;
}

.detail-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ---- Responsive ---- */
@media (max-width: 880px) {
    .matchline {
        display: none;
    }

    .app {
        grid-template-columns: 1fr;
    }

    .panel-left {
        position: relative;
        height: auto;
        min-height: 0;
        border-bottom: 1px solid #e8e4de;
        padding: 1.75rem 1.25rem;
    }

    .panel-right {
        padding: 1.75rem 1.25rem;
        min-height: auto;
    }

    .drawer-toggle {
        display: flex;
    }

    .drawer {
        display: none;
        margin-top: 0.25rem;
    }

    .drawer.is-open {
        display: block;
    }

    .results-header {
        align-items: flex-start;
    }

    .legend {
        flex-wrap: wrap;
    }

    .detail {
        width: 100vw;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.15rem 0;
    }

    .detail-grid dt {
        margin-top: 0.6rem;
    }
}

@media (max-width: 480px) {
    .panel-left, .panel-right {
        padding: 1.25rem 1rem;
    }

    .license-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .license-side {
        align-self: flex-start;
    }
}

/* ---- Scrollbars (subtle) ---- */
.panel-left::-webkit-scrollbar,
.panel-right::-webkit-scrollbar,
.detail::-webkit-scrollbar {
    width: 6px;
}

.panel-left::-webkit-scrollbar-thumb,
.panel-right::-webkit-scrollbar-thumb,
.detail::-webkit-scrollbar-thumb {
    background: #e8e4de;
    border-radius: 100px;
}

.panel-left::-webkit-scrollbar-thumb:hover,
.panel-right::-webkit-scrollbar-thumb:hover,
.detail::-webkit-scrollbar-thumb:hover {
    background: #8a847a;
}
