/* ─── Reset & Base ─────────────────────────────── */
/**, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}*/

/*body {
    display: block;
    color: #1f1b16;
    font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: #f5f0e8;
}*/

/* ─── Header Hero ───────────────────────────────── */
.header-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70vh;
}

.header-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-hero .hero-wrapper {
    display: flex;
    gap: 80px;
    flex-direction: column;
    position: absolute;
    margin: 0;
    text-align: center;
    width: 100%;
    max-width: calc(100% - 30vw);
}

/* ─── Page ─────────────────────────────────────── */
.glossary-page {
    min-height: 100vh;
    padding: 0 120px 72px;
}

/* ─── Hero ─────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 40px 36px;
    background: linear-gradient(120deg, #1f1b16 0%, #3b3128 48%, #1d1710 100%);
    color: #f7f2ea;
    display: grid;
    gap: 18px;
}

.hero-text h1 {
    margin: 0;
    line-height: 1.15;
}

.hero-text .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    margin: 0 0 8px;
    color: rgba(247, 242, 234, 0.7);
}

.hero-text .subhead {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(247, 242, 234, 0.85);
}

.hero-accent {
    position: absolute;
    inset: auto -120px -120px auto;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 216, 155, 0.9), transparent 70%);
    filter: blur(0.5px);
    pointer-events: none;
}

.letter-weight-size {
    font-size: 2rem;
    font-weight: 700;
}

.content-grid {
    display: grid;
    gap: 32px;
    margin-top: 32px;
}

@media (min-width: 992px) {
    .content-grid {
        grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
        align-items: start;
    }
}

/* ─── Main Panel ────────────────────────────────── */
.glossary-main {
    background: #fffdf9;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 18px 45px rgba(28, 20, 14, 0.08);
    overflow-x: hidden;
    /* needed so letter-nav negative-margin trick works */
}

/* ─── Search ────────────────────────────────────── */
.search-bar label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.search-input {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f4efe6;
    border-radius: 14px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.search-input input {
    flex: 1;
    min-width: 0;
    /* prevents input from overflowing */
    border: none;
    background: transparent;
    font-size: 1rem;
    font-family: inherit;
    color: inherit;
    outline: none;
}

.search-hint {
    font-size: 0.85rem;
    color: rgba(31, 27, 22, 0.7);
    white-space: nowrap;
    flex-shrink: 0;
}

.search-min-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: rgba(31, 27, 22, 0.6);
}

/* ─── Letter Nav ────────────────────────────────── */
.letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 32px;
}

.letter-nav a {
    padding: 8px 12px;
    border-radius: 999px;
    background: #1f1b16;
    color: #f7f2ea;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.letter-nav a:hover {
    transform: translateY(-2px);
}

.letter-nav a.disabled {
    pointer-events: none;
    opacity: 0.3;
}

/* ─── Status ────────────────────────────────────── */
.status {
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 12px;
    background: #f4efe6;
    margin-bottom: 16px;
}

.status.error {
    background: #f8d7c8;
    color: #7a2b16;
}

.status.hidden {
    display: none;
}

/* ─── Letter Sections ───────────────────────────── */
.letter-section {
    padding: 16px 0;
    border-bottom: 1px solid rgba(31, 27, 22, 0.08);
}

.letter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.letter-header h2 {
    font-size: 1.5rem;
}

.letter-header .count {
    background: #1f1b16;
    color: #f7f2ea;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
}

.letter-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    column-count: 2;
    column-gap: 24px;
}

.letter-section li {
    break-inside: avoid;
    padding: 6px 0;
}

/*.letter-section a {
    color: #2c231b;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}*/

/*.letter-section a:hover {
        color: #c05621;
        border-color: currentColor;
    }*/

/* ─── Back to Top ───────────────────────────────── */
.back-to-top {
    display: inline-flex;
    margin-top: 24px;
    color: #1f1b16;
    font-weight: 600;
    text-decoration: none;
}

.back-to-top:hover {
    text-decoration: underline;
}

/* ─── Sidebar ───────────────────────────────────── */
.glossary-side {
    display: grid;
    gap: 24px;
}

.side-card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 16px 36px rgba(28, 20, 14, 0.08);
}

.side-card-sticky {
    position: sticky;
    top: 24px;
    align-self: start;
    height: fit-content;
    z-index: 1;
}

.side-card h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.side-card ul {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.side-card li {
    padding: 8px 0;
}

.side-card a {
    color: #2c231b;
    text-decoration: none;
}

.side-card a:hover {
    color: #c05621;
}

/* ─── Talk/Query Form ───────────────────────────── */
.talk-panel {
    display: grid;
    gap: 14px;
}

.talk-panel p {
    font-size: 0.9rem;
    color: rgba(31, 27, 22, 0.7);
}

.talk-panel input,
.talk-panel textarea {
    width: 100%;
    border: 1.5px solid rgba(31, 27, 22, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    color: inherit;
    background: #fffdf9;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}

.talk-panel input:focus,
.talk-panel textarea:focus {
    border-color: #c05621;
}

.talk-panel button {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: #1f1b16;
    color: #f7f2ea;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.talk-panel button:hover {
    background: #3b3128;
}

/* ─── Responsive ────────────────────────────────── */

/* Prevent horizontal overflow on all screens */
html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

@media (max-width: 1100px) {
    .glossary-page {
        padding-left: 40px;
        padding-right: 40px;
    }
}

@media (max-width: 767px) {
    .no-mobile {
        display: none;
    }
}

@media (min-width: 768px) {
    .no-desktop {
        display: none;
    }
}

/* ─── Tablet (≤ 900px) ──────────────────────────── */
@media (max-width: 900px) {
    .glossary-page {
        padding-left: 20px;
        padding-right: 20px;
    }

    .header-hero .hero-wrapper {
        max-width: calc(100% - 40px);
    }

    .header-hero .hero-wrapper .page-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }
}

/* ─── Mobile (≤ 767px) ──────────────────────────── */
@media (max-width: 767px) {

    /* Hero banner: comfortable height on mobile */
    .header-hero {
        height: 50vh;
        min-height: 240px;
    }

    /* Title inside banner */
    .header-hero .hero-wrapper {
        max-width: calc(100% - 32px);
        gap: 0;
        padding: 0 16px;
    }

    .header-hero .hero-wrapper .page-title {
        font-size: 1.35rem;
        line-height: 1.3;
        text-align: center;
    }

    /* Page padding - remove the heavy 120px desktop padding */
    .glossary-page {
        padding: 0 16px 48px;
    }

    /* Reduce top margin */
    .content-grid {
        margin-top: 16px;
        gap: 16px;
    }

    /* Main card padding */
    .glossary-main {
        padding: 20px 14px;
        border-radius: 14px;
    }

    /* Search bar */
    .search-bar label {
        font-size: 0.95rem;
    }

    .search-input {
        padding: 10px 12px;
        border-radius: 10px;
        gap: 8px;
    }

    .search-input input {
        font-size: 0.9rem;
        /* ensure input takes remaining space and result count wraps below */
        min-width: 120px;
        flex: 1 1 120px;
    }

    .search-hint {
        font-size: 0.78rem;
        /* let it sit beside or wrap below input naturally */
        flex-shrink: 0;
    }

    /* Letter nav: 2-row wrap on mobile */
    .letter-nav {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 5px;
        margin: 14px 0 20px;
        padding: 0;
        /* force exactly 2 rows by controlling item width */
        max-height: calc((6px + 0.75rem * 1.5 + 6px) * 2 + 5px); /* ~2 rows + gap */
        overflow-y: hidden;
        align-content: flex-start;
    }

    .letter-nav a {
        /* ~14 letters per row → each pill ~calc(100%/14 - gap) */
        flex: 0 0 calc(100% / 14 - 5px);
        text-align: center;
        padding: 6px 0;
        font-size: 0.72rem;
        flex-shrink: 0;
    }

    /* Letter section */
    .letter-header {
        gap: 8px;
    }

    .letter-weight-size {
        font-size: 1.6rem;
    }

    /* Term list: single column on mobile */
    .letter-section ul {
        column-count: 1;
    }

    .letter-section li {
        padding: 5px 0;
    }

    /* Sidebar: hide on mobile to surface main content */
    .glossary-side {
        display: none;
    }

    /* Back to top */
    .back-to-top {
        font-size: 0.9rem;
        margin-top: 20px;
    }
}

/* ─── Small Mobile (≤ 380px) ────────────────────── */
@media (max-width: 380px) {
    .header-hero {
        height: 45vh;
        min-height: 220px;
    }

    .header-hero .hero-wrapper .page-title {
        font-size: 1.15rem;
    }

    .glossary-page {
        padding: 0 12px 40px;
    }

    .glossary-main {
        padding: 16px 12px;
    }

    /* Tighten pill size on very small phones */
    .letter-nav {
        gap: 4px;
        margin: 14px 0 20px;
        padding: 0;
    }

    .letter-nav a {
        flex: 0 0 calc(100% / 13 - 4px);
        padding: 5px 0;
        font-size: 0.68rem;
    }
}