/* ==========================================================================
   licensor.directory  -- vintage newspaper layout meets typographic focus
   --------------------------------------------------------------------------
   Palette
     --paper        #faf6ef   aged paper background
     --olive        #2a2e1e   dark olive masthead
     --ink          #1a1a14   ink black body text
     --sienna       #6b4423   burnt sienna accent / drop caps / links
     --rule         #d4cfc4   warm horizontal/column rules
     --tag          #e8e2d4   sandstone tag background
     --muted        #7a7568   warm gray jurisdiction
   ========================================================================== */

:root {
    --paper: #faf6ef;
    --olive: #2a2e1e;
    --ink: #1a1a14;
    --sienna: #6b4423;
    --rule: #d4cfc4;
    --tag: #e8e2d4;
    --muted: #7a7568;
    --paper-faint: #f3eee2;

    --serif-display: "Libre Baskerville", "Times New Roman", Times, serif;
    --serif-body: "Crimson Text", "Georgia", "Times New Roman", serif;
    --sans-label: "Work Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
}

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

html {
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif-body);
    font-size: 0.95rem;
    line-height: 1.5;
    /* subtle paper grain */
    background-image:
        radial-gradient(circle at 18% 22%, rgba(122, 117, 104, 0.05) 0, transparent 35%),
        radial-gradient(circle at 78% 64%, rgba(107, 68, 35, 0.04) 0, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(42, 46, 30, 0.03) 0, transparent 45%);
}

a {
    color: var(--sienna);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 120ms ease, color 120ms ease;
}

a:hover {
    border-bottom-color: var(--sienna);
}

/* ==========================================================================
   Masthead
   ========================================================================== */

.masthead {
    background: var(--olive);
    color: var(--paper);
    padding: 2rem 3rem 1.75rem;
    position: relative;
}

.masthead::before,
.masthead::after {
    content: "";
    position: absolute;
    left: 3rem;
    right: 3rem;
    height: 1px;
    background: rgba(212, 207, 196, 0.35);
}

.masthead::before { top: 0; }
.masthead::after { display: none; }

.masthead-inner {
    max-width: 1440px;
    margin: 0 auto;
}

.masthead-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--sans-label);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: #d4cfc4;
    margin-bottom: 1rem;
}

.masthead-meta-left,
.masthead-meta-right {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
}

.folio-sep {
    opacity: 0.5;
}

.masthead-title {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4.25rem);
    line-height: 1;
    letter-spacing: 0.02em;
    margin: 0;
    color: var(--paper);
    /* subtle inked-letterpress feel */
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.masthead-rule {
    border: 0;
    border-top: 1px solid rgba(212, 207, 196, 0.55);
    border-bottom: 1px solid rgba(212, 207, 196, 0.25);
    height: 4px;
    margin: 0.85rem 0 0.85rem;
}

.masthead-sub {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: 1rem;
    color: #d4cfc4;
    margin: 0 0 1.2rem;
    max-width: 64ch;
}

.masthead-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: baseline;
    font-family: var(--sans-label);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #c8c2b3;
}

.masthead-stats .stat strong {
    color: var(--paper);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    margin-right: 0.3rem;
}

.masthead-stats .stat-sep {
    color: rgba(212, 207, 196, 0.4);
}

/* ==========================================================================
   Alphabet jump bar
   ========================================================================== */

.alphabet-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    border-bottom: 2px solid var(--olive);
    padding: 0.4rem 3rem;
    backdrop-filter: blur(2px);
}

.alpha-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    flex: 1 1 auto;
}

.alpha-letter {
    font-family: var(--sans-label);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sienna);
    padding: 0.35rem 0.65rem;
    border-bottom: 0;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    user-select: none;
}

.alpha-letter:hover,
.alpha-letter.is-active {
    background: var(--tag);
    color: var(--olive);
    border-bottom: 0;
}

.alpha-letter.is-current {
    background: var(--olive);
    color: var(--paper);
}

.alpha-letter.is-empty {
    opacity: 0.3;
    pointer-events: none;
}

.search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 1px solid var(--rule);
    padding-left: 1rem;
    flex: 0 0 auto;
}

.filter-input {
    font-family: var(--serif-body);
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    width: 280px;
    background: var(--paper-faint);
    border: 1px solid var(--rule);
    border-radius: 0;
    color: var(--ink);
    outline: none;
    transition: border-color 120ms ease, background 120ms ease;
}

.filter-input::placeholder {
    color: var(--muted);
    font-style: italic;
}

.filter-input:focus {
    border-color: var(--sienna);
    background: var(--paper);
}

.filter-count {
    font-family: var(--sans-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    white-space: nowrap;
}

/* ==========================================================================
   Main page grid: directory + right rail
   ========================================================================== */

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 0;
    max-width: 1600px;
    margin: 0 auto;
}

.directory {
    padding: 2rem 3rem 3rem;
    border-right: 1px solid var(--rule);
}

.category-rail {
    padding: 2rem 1.5rem 3rem 1.5rem;
    background: var(--paper-faint);
    position: relative;
}

.rail-inner {
    position: sticky;
    top: 4rem;
}

/* ==========================================================================
   Alpha sections
   ========================================================================== */

.alpha-section {
    margin-bottom: 2.25rem;
    scroll-margin-top: 4.5rem;
}

.alpha-heading {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    border-bottom: 2px solid var(--olive);
    padding-bottom: 0.35rem;
    margin-bottom: 1rem;
    position: relative;
}

.drop-cap {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 4rem;
    line-height: 0.9;
    color: var(--sienna);
    margin-right: 0.3rem;
    letter-spacing: -0.02em;
    /* slight letterpress feel */
    text-shadow: 0 1px 0 rgba(107, 68, 35, 0.08);
}

.alpha-meta {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.45rem;
}

.alpha-title {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--olive);
    margin: 0;
}

.alpha-count {
    font-family: var(--sans-label);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ==========================================================================
   Three-column directory listings
   ========================================================================== */

.columns {
    column-count: 3;
    column-gap: 2rem;
    column-rule: 1px solid var(--rule);
}

.entry {
    display: block;
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 0.32rem 0;
    border-bottom: 1px solid var(--rule);
    line-height: 1.35;
}

.entry .name {
    font-family: var(--serif-body);
    font-weight: 600;
    color: var(--ink);
    font-size: 0.92rem;
    margin-right: 0.35rem;
}

.entry .tag {
    display: inline-block;
    background: var(--tag);
    color: var(--sienna);
    font-family: var(--sans-label);
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.15em 0.45em;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: 1px;
    white-space: nowrap;
}

.entry .jurisdiction {
    font-family: var(--serif-body);
    font-style: italic;
    font-weight: 400;
    color: var(--muted);
    font-size: 0.84rem;
    white-space: nowrap;
}

.entry.is-hidden {
    display: none;
}

.entry:hover {
    background: rgba(232, 226, 212, 0.45);
}

.entry:hover .name {
    color: var(--sienna);
}

.section-divider {
    display: block;
    margin: 2.4rem auto;
    width: 70%;
}

.section-divider span {
    display: block;
    height: 1px;
    background: var(--rule);
}

.section-divider span + span {
    margin-top: 2px;
}

.alpha-section.is-empty {
    display: none;
}

/* ==========================================================================
   Category rail
   ========================================================================== */

.rail-title {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--olive);
    margin: 0 0 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--olive);
}

.rail-sub {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--muted);
    margin: 0 0 1.1rem;
}

.cat-tree {
    list-style: none;
    margin: 0 0 1.4rem;
    padding: 0;
    border-top: 1px solid var(--rule);
}

.cat-node {
    border-bottom: 1px solid var(--rule);
}

.cat-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    padding: 0.4rem 0.1rem;
    font-family: var(--sans-label);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    font-weight: 500;
}

.cat-toggle:hover {
    color: var(--sienna);
}

.cat-marker {
    font-family: var(--sans-label);
    font-weight: 600;
    color: var(--sienna);
    width: 0.9rem;
    display: inline-block;
    text-align: center;
    transition: transform 200ms ease;
}

.cat-node.is-open .cat-marker {
    color: var(--olive);
}

.cat-label {
    flex: 1;
}

.cat-count {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.cat-children {
    list-style: none;
    margin: 0 0 0.4rem 1.4rem;
    padding: 0 0 0.2rem 0;
    border-left: 1px solid var(--rule);
    max-height: 0;
    overflow: hidden;
    transition: max-height 260ms ease;
}

.cat-node.is-open .cat-children {
    max-height: 320px;
}

.cat-children li {
    padding: 0;
}

.cat-children a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.2rem 0.6rem;
    font-family: var(--serif-body);
    font-size: 0.83rem;
    color: var(--ink);
    border-bottom: 0;
}

.cat-children a:hover {
    color: var(--sienna);
    background: rgba(232, 226, 212, 0.4);
}

.cat-children a span {
    font-style: italic;
    color: var(--muted);
    font-size: 0.78rem;
}

.rail-meta {
    margin-top: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--rule);
}

.rail-meta-title {
    font-family: var(--sans-label);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--olive);
    margin: 0 0 0.45rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0.18rem 0;
    border-bottom: 1px dotted var(--rule);
    font-size: 0.82rem;
}

.meta-row .meta-key {
    font-family: var(--serif-body);
    color: var(--ink);
}

.meta-row .meta-val {
    font-family: var(--sans-label);
    font-weight: 500;
    color: var(--sienna);
    letter-spacing: 0.04em;
}

.rail-note {
    margin-top: 1.2rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--rule);
    font-family: var(--serif-body);
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted);
}

/* ==========================================================================
   Colophon (footer)
   ========================================================================== */

.colophon {
    background: var(--olive);
    color: #d4cfc4;
    padding: 2.5rem 3rem 1.5rem;
    margin-top: 2rem;
    border-top: 4px double rgba(212, 207, 196, 0.4);
}

.colophon-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1440px;
    margin: 0 auto;
}

.colophon-col h4 {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--paper);
    margin: 0 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(212, 207, 196, 0.4);
}

.colophon-col p {
    font-family: var(--serif-body);
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0;
    color: #c8c2b3;
}

.colophon-col em {
    font-style: italic;
    color: var(--paper);
}

.colophon-rule {
    height: 1px;
    background: rgba(212, 207, 196, 0.35);
    margin: 1.5rem auto 0.85rem;
    max-width: 1440px;
}

.colophon-bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: 1440px;
    margin: 0 auto;
    font-family: var(--sans-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #a8a394;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
    .page-grid {
        grid-template-columns: minmax(0, 1fr) 230px;
    }

    .columns {
        column-count: 2;
    }

    .masthead,
    .alphabet-bar,
    .directory,
    .colophon {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 880px) {
    .page-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .directory {
        border-right: 0;
    }

    .category-rail {
        border-top: 2px solid var(--olive);
        background: var(--paper);
    }

    .rail-inner {
        position: static;
    }

    .colophon-inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .columns {
        column-count: 2;
    }

    .alphabet-bar {
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.5rem 1.25rem;
        align-items: stretch;
    }

    .alpha-inner {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--rule) transparent;
        padding-bottom: 0.25rem;
    }

    .alpha-letter {
        flex: 0 0 auto;
        padding: 0.35rem 0.55rem;
    }

    .search-wrap {
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid var(--rule);
        padding-top: 0.4rem;
    }

    .filter-input {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .columns {
        column-count: 1;
    }

    .masthead {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .masthead-top {
        flex-direction: column;
        gap: 0.25rem;
    }

    .masthead-stats {
        gap: 0.4rem;
        font-size: 0.65rem;
    }

    .directory,
    .colophon {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .drop-cap {
        font-size: 3rem;
    }

    .colophon-bottom {
        flex-direction: column;
        gap: 0.4rem;
    }
}

/* ==========================================================================
   Print -- because this is, after all, a directory
   ========================================================================== */

@media print {
    body { background: #fff; color: #000; }
    .masthead, .colophon { background: #fff; color: #000; border-color: #000; }
    .alphabet-bar, .category-rail { display: none; }
    .page-grid { grid-template-columns: 1fr; }
    .directory { border-right: 0; }
    .columns { column-count: 3; column-rule: 1px solid #000; }
    .entry { border-bottom: 1px solid #999; }
    .alpha-heading { border-bottom: 2px solid #000; }
    .drop-cap { color: #000; }
}
