/* ============================================================
   IndexAll - Static Site Stylesheet
   Clean light theme on white. Warm, airy, refined.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-y: scroll; }

:root {
    --bg: #ffffff;
    --bg-alt: #fafafa;
    --bg-hover: #f5f5f7;
    --bg-card: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #1d1d1f;
    --text-tertiary: #444446;
    --border: #e8e8ed;
    --border-light: #f2f2f5;
    --accent: #0066cc;
    --accent-hover: #0055aa;
    --accent-light: #e8f1fb;
    --link: #0066cc;
    --tag-bg: #ffffff;
    --tag-text: #1d1d1f;
    --tag-border: #1d1d1f;
    --tag-active-bg: #1d1d1f;
    --tag-active-text: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    --max-width: 1200px;
    --header-height: 56px;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.logo-home {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
}

.logo-home:hover { opacity: 0.7; }

.logo-home span {
    font-weight: 300;
    color: var(--text-tertiary);
}

.section-toggle {
    display: flex;
    gap: 2px;
    margin-left: 0.75em;
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 2px;
}

.section-btn {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25em 0.6em;
    min-width: 5.5em;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-tertiary);
    transition: all 0.15s ease;
}

.section-btn:hover {
    background: var(--text);
    color: #fff;
    text-decoration: none;
}

.section-btn.active {
    background: var(--text);
    color: #fff;
    font-weight: 600;
}

.section-btn.active:hover {
    opacity: 0.85;
}

.header-stats {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* --- Layout --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

main {
    flex: 1;
    padding: 2.5rem 0;
}

/* --- Page header --- */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.page-header .subtitle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-header .subtitle-row .subtitle {
    margin: 0;
}

.page-header .search-wrapper--inline {
    flex: 0 1 280px;
    min-width: 180px;
    margin-left: auto;
}

.page-header .icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--text-tertiary);
    transition: color 0.15s;
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.breadcrumbs .sep {
    margin: 0 0.4rem;
    opacity: 0.4;
}

/* --- Search / Filter bar --- */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    position: sticky;
    top: var(--header-height);
    background: var(--bg);
    padding: 0.75rem 0;
    z-index: 50;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 0.85rem;
    padding-left: 2.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

/* --- Search dropdown (item search) --- */
.page-header .search-wrapper--inline {
    overflow: visible;
}

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 200;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
}

.search-dropdown-section {
    padding: 0.4rem 0;
}

.search-dropdown-section + .search-dropdown-section {
    border-top: 1px solid var(--border-light);
}

.search-dropdown-label {
    display: block;
    padding: 0.4rem 1rem 0.25rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    opacity: 0.7;
}

.search-dropdown-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s;
}

.search-dropdown-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
    color: var(--text);
}

.search-dropdown-icon {
    flex: 0 0 auto;
    font-size: 1rem;
    width: 1.4rem;
    text-align: center;
    line-height: 1;
}

.search-dropdown-name {
    flex: 1 1 auto;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.search-dropdown-meta {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: capitalize;
    white-space: nowrap;
}

.search-dropdown-loading {
    display: block;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-align: center;
}

@media (max-width: 768px) {
    .search-dropdown {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}

.filter-select {
    padding: 0.6rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23aeaeb2' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.result-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.clear-filters {
    font-size: 0.8rem;
    color: var(--accent);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font);
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    display: none;
    transition: background 0.15s;
}

.clear-filters:hover {
    background: var(--accent-light);
}

.clear-filters.visible {
    display: inline-block;
}

/* --- Index grid (homepage) --- */
.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
}

.index-card {
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.15s ease;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.index-card:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.index-card .card-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    width: 2.2rem;
    text-align: center;
}

.index-card .card-info {
    flex: 1;
    min-width: 0;
}

.index-card .card-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text);
}

.index-card .card-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.index-card .card-arrow {
    color: var(--text-tertiary);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
}

.index-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.index-card.empty {
    opacity: 0.4;
}

.index-card.empty:hover {
    opacity: 0.65;
}

/* --- Group sections on homepage --- */
.index-group {
    margin-bottom: 1.5rem;
}

.index-group .index-grid {
    display: none;
    margin-top: 0.75rem;
}

.index-group.open .index-grid {
    display: grid;
}

.group-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    cursor: pointer;
    user-select: none;
}

.group-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    position: relative;
    top: 2px;
}

.btn-expand-all {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-expand-all:hover {
    border-color: var(--text-tertiary);
    color: var(--text);
}

.index-group.open .group-chevron {
    transform: rotate(90deg);
}

.group-color-line {
    width: 100%;
    height: 1px;
    opacity: 0.7;
    background: var(--text);
}

.group-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.group-header .group-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* --- Items table --- */
.items-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.items-table th {
    text-align: left;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    transition: color 0.15s;
}

.items-table th:hover {
    color: var(--text);
}

.items-table th .sort-indicator {
    margin-left: 0.3rem;
    opacity: 0.4;
    font-size: 0.7rem;
}

.items-table th.sorted .sort-indicator {
    opacity: 1;
    color: var(--accent);
}

.items-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.items-table tr:last-child td {
    border-bottom: none;
}

.items-table tbody tr {
    transition: background 0.1s;
}

.items-table tbody tr:hover {
    background: var(--bg-hover);
}

.items-table .item-name {
    font-weight: 600;
    white-space: nowrap;
}

.items-table .item-name a {
    color: var(--text);
    transition: color 0.15s;
}

.items-table .item-name a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.items-table .item-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.items-table .item-website a {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    word-break: break-all;
    transition: color 0.15s;
}

.items-table .item-website a:hover {
    color: var(--accent);
}

.items-table .item-country {
    white-space: nowrap;
    font-size: 0.85rem;
}

.flag-icon {
    width: 1em;
    height: 1em;
    max-width: 16px;
    max-height: 16px;
    vertical-align: -0.1em;
    display: inline-block;
}

.items-table .item-year {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* --- Social icons --- */
.social-links {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: color 0.15s, background 0.15s;
}

.social-links a:hover {
    color: var(--accent);
    background: var(--accent-light);
    text-decoration: none;
}

.social-links svg {
    width: 14px;
    height: 14px;
}

/* --- Tags --- */
.tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--tag-bg);
    color: var(--tag-text);
    border: 1px solid var(--tag-border);
    border-radius: 999px;
    font-size: 0.75rem;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s ease;
}

a.tag:hover {
    background: var(--tag-active-bg);
    color: var(--tag-active-text);
    border-color: var(--tag-active-bg);
    text-decoration: none;
}

.tag.active {
    background: var(--tag-active-bg);
    color: var(--tag-active-text);
    border-color: var(--tag-active-bg);
}

/* --- Tag filter bar (category page) --- */
.tag-filters {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    max-height: 4.4rem;
    overflow: hidden;
    position: relative;
    transition: max-height 0.25s ease;
}

.tag-filters.expanded {
    max-height: none;
}

.tag-filters .tag {
    cursor: pointer;
}

.tag-toggle {
    display: none;
    padding: 0.2rem 0.6rem;
    background: var(--bg-alt);
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
    transition: all 0.15s;
}

.tag-toggle:hover {
    color: var(--text);
    border-color: var(--text-tertiary);
}

.tag-toggle.visible {
    display: inline-block;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 0.95rem;
}

/* --- Item Pages --- */

.ip-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.ip-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

.ip-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.ip-status--active {
    background: #f0faf0;
    color: #1a7a1a;
}

.ip-status--discontinued {
    background: #fef0f0;
    color: #7a1a1a;
}

.ip-status--acquired {
    background: #f0f4fe;
    color: #1a3a7a;
}

.ip-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* --- Sidebar card --- */

.ip-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
}

.ip-website {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.ip-website:hover {
    text-decoration: underline;
}

.ip-website svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--accent);
}

.ip-facts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ip-fact {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.ip-fact:last-child {
    border-bottom: none;
}

.ip-fact dt {
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.ip-fact dd {
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

.ip-socials {
    display: flex;
    gap: 0.25rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.ip-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.ip-socials a:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--accent);
    text-decoration: none;
}

.ip-socials svg {
    width: 15px;
    height: 15px;
}

.ip-indexes {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}

.ip-indexes-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.ip-indexes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.ip-indexes-list .tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

/* --- Content area --- */

.ip-content {
    min-width: 0;
}

.ip-section {
    margin-bottom: 2rem;
}

.ip-section:last-child {
    margin-bottom: 0;
}

.ip-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
}

.ip-section p {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text);
    margin: 0.5rem 0;
}

.ip-section p sup {
    font-size: 0.65em;
    color: var(--text-tertiary);
    font-weight: 500;
}

.ip-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ip-section li {
    font-size: 0.9rem;
    line-height: 1.65;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
}

.ip-section li:last-child {
    border-bottom: none;
}

.ip-section li strong {
    font-weight: 600;
}

.ip-section a {
    color: var(--accent);
    text-decoration: none;
}

.ip-section a:hover {
    text-decoration: underline;
}

/* Tables in content (product lines, pricing, etc.) */
.ip-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0.75rem 0;
}

.ip-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ip-table-wrap th {
    text-align: left;
    padding: 0.55rem 0.85rem;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}

.ip-table-wrap td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.ip-table-wrap tr:last-child td {
    border-bottom: none;
}

.ip-table-wrap tbody tr:hover {
    background: var(--bg-hover);
}

/* Sources */
.ip-sources {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.ip-sources summary {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.ip-sources summary::-webkit-details-marker {
    display: none;
}

.ip-sources summary::before {
    content: '+ ';
    font-weight: 400;
}

.ip-sources[open] summary::before {
    content: '- ';
}

.ip-sources ol {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.ip-sources li {
    margin: 0.3rem 0;
    line-height: 1.5;
    word-break: break-all;
}

.ip-sources a {
    color: var(--text-tertiary);
    text-decoration: none;
}

.ip-sources a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .ip-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ip-card {
        position: static;
    }

    .ip-header h1 {
        font-size: 1.4rem;
    }
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
    background: var(--bg-alt);
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.footer-about {
    line-height: 1.6;
    margin: 0;
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.site-footer a {
    color: var(--text-tertiary);
    transition: color 0.15s;
}

.site-footer a:hover {
    color: var(--accent);
}

.footer-meta .footer-submit {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    transition: opacity 0.15s;
}

.footer-meta .footer-submit:hover {
    opacity: 0.8;
    color: var(--bg);
    text-decoration: none;
}

/* --- No-results row in table --- */
.no-results-row td {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    html { font-size: 14px; }

    .container { padding: 0 1rem; }

    main { padding: 1.5rem 0; }

    .site-header {
        height: auto;
        padding: 0.5rem 0;
    }

    .site-header .container {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .header-stats {
        width: 100%;
        font-size: 0.7rem;
    }

    .page-header h1 { font-size: 1.4rem; }

    .page-header .subtitle-row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .search-wrapper--inline {
        position: relative;
        flex: 1;
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }

    .page-header .search-wrapper--inline .search-input {
        width: 100%;
        min-width: 0;
    }

    .site-logo {
        min-width: 0;
        flex: 1;
    }

    .section-toggle {
        margin-left: 0;
        min-width: 0;
        flex: 1;
    }

    .section-btn {
        min-width: 0;
        flex: 1;
        padding: 0.25em 0.4em;
        font-size: 0.75rem;
        white-space: nowrap;
    }

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

    .filter-bar {
        flex-direction: column;
    }

    .search-wrapper {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .items-table .item-desc {
        display: none;
    }

    .items-table th, .items-table td {
        padding: 0.5rem 0.65rem;
    }

    .footer-meta {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .index-card {
        padding: 0.75rem 1rem;
    }

    .social-links a {
        width: 24px;
        height: 24px;
    }

    .social-links svg {
        width: 12px;
        height: 12px;
    }
}

/* --- Utility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* --- Back to top --- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, color 0.15s, box-shadow 0.15s;
    z-index: 90;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    color: var(--accent);
    box-shadow: var(--shadow-lg);
}

/* --- Submit form --- */
.submit-page {
    max-width: 640px;
}

.submit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label .required {
    color: #d00;
}

.form-group label .optional {
    font-weight: 400;
    color: var(--text-tertiary);
}

.form-group input,
.form-group select {
    padding: 0.6rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.6;
}

.type-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
}

.type-option {
    cursor: pointer;
    display: block;
}

.type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.type-option span {
    display: block;
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border);
}

.type-option:last-child span {
    border-right: none;
}

.type-option input:checked + span {
    background: var(--text);
    color: var(--bg);
}

.type-option:hover span {
    background: var(--bg-hover);
}

.type-option input:checked + span:hover {
    background: var(--text);
}

.submit-btn {
    align-self: flex-start;
    padding: 0.65rem 2rem;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    opacity: 0.8;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-message {
    padding: 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.submit-message.success {
    background: #f0faf0;
    border: 1px solid #c3e6c3;
    color: #1a5c1a;
}

.submit-message.error {
    background: #fef0f0;
    border: 1px solid #e6c3c3;
    color: #5c1a1a;
}

.submit-message a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- Print --- */
@media print {
    .site-header, .site-footer, .filter-bar, .tag-filters, .back-to-top { display: none; }
    .items-table { font-size: 0.8rem; }
    .items-table th { background: none; }
}
