/* Base page styles */
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #0f172a;
    color: #e5e7eb;
}

/* Site header and navigation */
header {
    background: #020617;
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid #1f2937;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

header p {
    opacity: 0.8;
}

nav {
    margin-top: 24px;
}

nav a {
    color: #e5e7eb;
    text-decoration: none;
    margin: 0 10px;
    font-weight: bold;
}

nav a:hover,
nav a.active {
    color: #22c55e;
}

/* Shared content layout */
section {
    padding: 60px 20px;
    max-width: 900px;
    margin: auto;
}

.wide-section {
    max-width: 1200px;
}

.card {
    background: #020617;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #1f2937;
}

/* Project page */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.project-grid .card {
    margin-bottom: 0;
}

.project-item {
    width: 100%;
}

.project-image {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    margin-top: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #1f2937;
}

.serializer-image {
    object-position: center 80%;
}

/* Parts page */
.parts-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.parts-tabs a {
    color: #cbd5e1;
    text-decoration: none;
    background: #020617;
    border: 1px solid #1f2937;
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: bold;
}

.parts-tabs a:hover,
.parts-tabs a.active {
    color: #020617;
    background: #22c55e;
    border-color: #22c55e;
}

.parts-note {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    background: #082f49;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    color: #dbeafe;
}

.parts-note strong {
    color: #f8fafc;
}

.parts-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.parts-summary > div {
    background: #020617;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 18px;
}

.parts-summary strong {
    display: block;
    color: #22c55e;
    font-size: 1.7rem;
    line-height: 1;
    margin-bottom: 8px;
}

.parts-summary span {
    color: #cbd5e1;
}

.type-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-content: center;
}

.type-breakdown span {
    white-space: nowrap;
}

.parts-search {
    background: #020617;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 20px;
}

.parts-search label {
    display: block;
    color: #cbd5e1;
    font-weight: bold;
    margin-bottom: 10px;
}

.search-row {
    display: flex;
    gap: 10px;
}

.search-row input {
    flex: 1;
    min-width: 0;
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px 14px;
    font: inherit;
}

.search-row input:focus {
    border-color: #22c55e;
    outline: 2px solid rgba(34, 197, 94, 0.25);
}

.parts-search p {
    color: #94a3b8;
    margin: 10px 0 0;
}

.table-wrap {
    overflow-x: auto;
    background: #020617;
    border: 1px solid #1f2937;
    border-radius: 8px;
}

.parts-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.parts-table th,
.parts-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #1f2937;
    text-align: left;
    vertical-align: top;
}

.parts-table th {
    position: sticky;
    top: 0;
    background: #020617;
    color: #22c55e;
    font-size: 0.78rem;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-transform: inherit;
    cursor: pointer;
}

.table-sort-button::after {
    content: "↕";
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1;
}

.table-sort-button[data-sort-direction="ascending"]::after {
    content: "↑";
    color: #f8fafc;
}

.table-sort-button[data-sort-direction="descending"]::after {
    content: "↓";
    color: #f8fafc;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
    color: #f8fafc;
    outline: none;
}

.table-sort-button:focus-visible {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.parts-table tbody tr:nth-child(even) {
    background: #0b1220;
}

.parts-table tbody tr:hover {
    background: #12213a;
}

.parts-table td:nth-child(1),
.parts-table td:nth-child(2),
.parts-table td:nth-child(3),
.parts-table td:nth-child(8),
.parts-table td:nth-child(9),
.parts-table td:nth-child(10) {
    white-space: nowrap;
}

/* Footer and buttons */
footer {
    text-align: center;
    padding: 30px;
    opacity: 0.6;
    border-top: 1px solid #1f2937;
}

button {
    background: #22c55e;
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.9;
}

@media (max-width: 760px) {
    header {
        padding: 32px 16px;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 36px 14px;
    }

    nav a {
        display: inline-block;
        margin: 6px 8px;
    }

    .parts-summary {
        grid-template-columns: 1fr;
    }

    .parts-tabs a {
        flex: 1 1 140px;
        text-align: center;
    }

    .search-row {
        flex-direction: column;
    }
}
