/**
 * Hub Page Styles
 * Page-specific styles (base styles in _base.css)
 *
 * Reusable styles for domain/category hub pages in the Itako dictionary.
 * Hub pages aggregate related terms with thematic organization and navigation.
 */

/* ========================================
   Hub Page Headings
   ======================================== */

body.hub-page {
    background: var(--special-page-outer-bg, #f8f6f1);
}

body.hub-page main.dict-page-grid {
    width: 100%;
    max-width: none;
    margin: 0;
    grid-template-columns: 250px minmax(0, 1fr) 300px;
    gap: 0;
    background: var(--special-page-surface-bg, #fff);
    border: 1px solid var(--line-gray, #e0e0e0);
}

body.hub-page .dict-left,
body.hub-page .dict-main,
body.hub-page .dict-right {
    padding: 1.2rem 1.5rem;
}

body.hub-page .dict-main {
    padding-top: clamp(1.5rem, 3vw, 2.25rem);
}

.hub-page .dict-main h2 {
    color: var(--wood-orange, #e07a00);
    font-size: 1.05rem;
    line-height: 1.35;
    margin: 0 0 1rem;
}

/* ========================================
   Hub Hero Section
   ======================================== */

.hub-hero {
    min-height: clamp(150px, 18vw, 220px);
    margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
    padding: clamp(2rem, 5vw, 3.75rem) clamp(1.25rem, 4vw, 3rem);
    display: grid;
    gap: 0.45rem;
    justify-items: center;
    align-content: center;
}

.hub-hero__title {
    margin: 0;
    color: var(--text-dark, #3b2411);
    position: relative;
}

.hub-eyebrow {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: #6b5b4b;
    font-size: 0.92rem;
    position: relative;
}

.hub-lead {
    margin: 0 auto;
    color: var(--ink-soft, #5a4943);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 720px;
    position: relative;
}

.hub-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

/* ========================================
   Featured Terms Grid
   ======================================== */

.hub-panel--featured {
    border-top: 1px solid var(--line-gray, #e0e0e0);
    padding-top: 1rem;
}

.hub-featured-list {
    display: grid;
    gap: 0.45rem;
}

.hub-featured-list li {
    display: grid;
    gap: 0.15rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line-soft, #e8e2d8);
    border-left: 3px solid #9b8064;
    border-radius: 6px;
    background: #fff;
}

/* Inner wrapper stacks the title + meta. When the term links to a /dictionary/
   entry it expands (negative margin) to fill the card's padding box so the whole
   card is one click target; the card surface itself stays on the <li> above. */
.hub-featured-link {
    display: grid;
    gap: 0.15rem;
    color: inherit;
    text-decoration: none;
}

a.hub-featured-link {
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

a.hub-featured-link:hover,
a.hub-featured-link:focus {
    background: #fffaf5;
    text-decoration: none;
}

a.hub-featured-link:focus-visible {
    outline: 2px solid rgba(141, 123, 104, 0.45);
    outline-offset: 2px;
}

.hub-featured-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-dark, #3b2411);
}

.hub-featured-meta {
    display: block;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--ink-soft, #5a4943);
    font-style: italic;
}

.feature-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.feature-card {
    border: 1px solid var(--line-soft, #e8e2d8);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    background: #fff;
    display: grid;
    gap: 0.25rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.feature-card:hover {
    border-color: rgba(224, 122, 0, 0.35);
    background-color: #fffdf9;
}

.feature-card h4 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--text-dark, #3b2411);
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.feature-meta {
    font-size: 0.78rem;
    color: #777;
    font-style: italic;
}

.feature-desc {
    margin: 0;
    font-size: 0.82rem;
    color: #555;
    line-height: 1.5;
}

/* ========================================
   Subcategory Accordion
   ======================================== */

.hub-category-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.subcategory-accordion {
    border: 1px solid var(--line-gray, #dcd1c3);
    border-left: 3px solid #cdb9a3;
    border-radius: 6px;
    margin-bottom: 0;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(59, 36, 17, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.subcategory-accordion:hover {
    border-color: #b89a7b;
    box-shadow: 0 4px 12px rgba(59, 36, 17, 0.08);
}

.hub-category-link-card {
    display: grid;
    gap: 0.55rem;
    min-height: 8rem;
    padding: 1rem 1.15rem;
    color: inherit;
    text-decoration: none;
}

.hub-category-link-card:hover,
.hub-category-link-card:focus {
    background: #fffaf5;
    text-decoration: none;
}

.hub-category-link-card:focus-visible {
    outline: 2px solid rgba(141, 123, 104, 0.45);
    outline-offset: 2px;
}

.hub-category-link-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--wood-dark, #6b4423);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
}

.hub-category-link-title::after {
    content: '>';
    flex: 0 0 auto;
    color: #8d7b68;
    font-size: 1rem;
    font-weight: 600;
}

.hub-category-link-intro {
    display: block;
    color: var(--ink-soft, #5a4943);
    font-size: 0.88rem;
    line-height: 1.55;
}

.hub-category-link-action {
    align-self: end;
    color: #8d7b68;
    font-size: 0.82rem;
    font-weight: 700;
}

.subcategory-label {
    list-style: none;
    padding: 1rem 1.15rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    background-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--wood-dark, #6b4423);
    transition: background-color 0.2s ease;
}

.subcategory-label:hover {
    background-color: #fffaf5;
}

.subcategory-label::after {
    content: '+';
    font-weight: 300;
    font-size: 1.5rem;
    color: #999;
    transition: transform 0.2s ease, color 0.2s ease;
}

.subcategory-accordion[open] .subcategory-label::after {
    content: '-';
    color: #8d7b68;
}

.subcategory-content {
    padding: 1.25rem;
    background: #fff;
    border-top: 1px solid #eee7df;
}

/* Category Introduction Box */
.category-intro {
    margin: 0 0 1rem 0;
    padding: 0.75rem 1rem;
    background: #fffaf5;
    border-left: 3px solid #b89a7b;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
}

/* ========================================
   Theme List (Term Links)
   ======================================== */

.theme-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: grid;
    gap: 0.4rem;
}

.theme-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed #eee;
}

.theme-list li:last-child {
    border-bottom: none;
}

.theme-list a {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark, #333);
    text-decoration: none;
    transition: color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.theme-list a:hover {
    color: var(--wood-orange, #e07a00);
    text-decoration: underline;
}

.theme-note {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    font-style: italic;
}

/* View All Link */
.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #faf7f1;
    color: var(--text-dark, #3b2411);
    border: 1px solid #d8cfc3;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.view-all-link:hover {
    background: #f3ede5;
}

.hub-browse-all {
    margin-top: 2rem;
    padding: 1.35rem 0 0;
    background: transparent;
    border-top: 1px solid #d8cfc3;
    text-align: left;
}

.hub-browse-all p {
    max-width: 780px;
}

.hub-browse-all .cat-nav-btn {
    background: #fff !important;
    border: 1px solid #d8cfc3 !important;
    color: var(--text-dark, #3b2411) !important;
    border-radius: 999px;
    box-shadow: none;
}

.hub-browse-all .cat-nav-btn:hover {
    background: #faf7f1 !important;
    border-color: #b89a7b !important;
}

/* ========================================
   Sidebar Panels
   ======================================== */

.hub-page .dict-right {
    min-width: 0;
    overflow: visible;
}

.hub-panel {
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.hub-panel h3 {
    font-size: 1rem;
    margin: 0 0 0.65rem 0;
    color: var(--wood-orange, #e07a00);
    border-bottom: 1px solid #d8cfc3;
    padding-bottom: 0.45rem;
}

.hub-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.hub-panel li a {
    display: block;
    padding: 0.2rem 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: var(--text-dark, #333);
    text-decoration: none;
    transition: color 0.2s ease;
}

.hub-panel li a:hover {
    color: var(--wood-orange, #e07a00);
    background-color: transparent;
}

/* Right Sidebar Cards */
.hub-right-card {
    border: 0;
    border-bottom: 1px solid #d8cfc3;
    border-radius: 0;
    padding: 0 0 1rem;
    background: transparent;
    margin-bottom: 1rem;
    overflow: visible;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hub-right-card h3 {
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
    color: var(--wood-orange, #e07a00);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.hub-right-card p,
.hub-right-card .theme-note,
.hub-right-card div {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
    max-width: 100%;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

.hub-right-card * {
    max-width: 100%;
    box-sizing: border-box;
}

.hub-right-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hub-right-card li {
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hub-right-card li:last-child {
    margin-bottom: 0;
}

.hub-right-card a {
    color: var(--wood-orange, #e07a00);
    text-decoration: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    display: inline;
    max-width: 100%;
}

.hub-right-card a:hover {
    text-decoration: underline;
}

.hub-search-card {
    border: 1px solid #d8cfc3;
    border-radius: 8px;
    border-color: #d8cfc3;
    background: #faf7f1;
    padding: 0.9rem;
}

.hub-sidebar-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.hub-sidebar-search input {
    width: 100%;
    min-width: 0;
    border: 1px solid #d4c9bb;
    border-radius: 6px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    background: #fff;
    color: var(--text-dark, #333);
}

.hub-sidebar-search input:focus {
    border-color: #9b8d7c;
    outline: 2px solid rgba(116, 97, 76, 0.18);
    outline-offset: 1px;
}

.hub-sidebar-search button {
    width: auto;
    border: 1px solid #a8957e;
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    background: #8d7b68;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    min-width: 2.5rem;
}

.hub-sidebar-search button:hover {
    background: #7b6956;
    border-color: #7b6956;
}

.hub-search-icon {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

@media (max-width: 980px) {
    body.hub-page main.dict-page-grid {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .hub-hero {
        padding: clamp(2rem, 8vw, 3rem) 1.25rem;
    }

    .feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .hub-category-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .subcategory-label {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .theme-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .theme-note {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    body.hub-page main.dict-page-grid {
        width: 100%;
        margin-top: 0;
    }

    body.hub-page .dict-main {
        padding: 1.1rem;
    }

    .hub-hero {
        min-height: 170px;
        padding: 2.25rem 1rem;
        gap: 0;
    }

    .hub-sidebar-search {
        grid-template-columns: 1fr;
    }

    .hub-sidebar-search button {
        width: 100%;
    }

    .hub-eyebrow {
        display: none;
    }

    .hub-lead {
        display: none;
    }

    .hub-hero__title {
        font-size: clamp(1.45rem, 7vw, 1.9rem);
    }

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

    .hub-category-card-grid {
        grid-template-columns: 1fr;
    }

    .view-all-link {
        font-size: 0.85rem;
        padding: 0.45rem 0.875rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .hub-panel,
    .hub-right-card {
        break-inside: avoid;
    }

    .subcategory-accordion {
        border: 1px solid #ccc;
    }

    .subcategory-label::after {
        display: none;
    }

    .view-all-link {
        display: none;
    }
}
