/* TRA Car Registry - shared stylesheet */

:root {
    --paper: #f4f6f8;
    --card: #ffffff;
    --ink: #1c2530;
    --muted: #5b6672;
    --blue: #1f3f8a;
    --blue-dark: #162d63;
    --line: #d5dbe2;
    --serif: Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

main.wrap { flex: 1; padding-top: 32px; padding-bottom: 48px; }

/* Header (styled after the main TRA club site) */
.site-header {
    background: #fff6ef;
    border-bottom: 3px solid var(--blue);
}
.header-inner {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "logo brand"
        "logo nav";
    column-gap: 20px;
    align-items: center;
    padding-top: 14px;
    padding-bottom: 12px;
}
.brand-logo { grid-area: logo; display: block; }
.brand-logo img { display: block; height: 96px; width: auto; }
.brand-text {
    grid-area: brand;
    display: flex;
    flex-direction: column;
    align-self: end;
    line-height: 1.25;
}
.brand-name {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 1.35rem;
    text-transform: uppercase;
    color: #f50808;
}
.brand-tagline {
    font-family: Arial, Helvetica, sans-serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #000;
}
.brand-est {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #000;
}
.site-nav {
    grid-area: nav;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 30px;
    margin-top: 10px;
}
.site-nav a {
    color: #000;
    text-decoration: none;
    letter-spacing: 0.05em;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}
.site-nav a.current { color: #014b3f; }
.site-nav a:hover,
.site-nav a:focus-visible { border-bottom-color: #014b3f; }

/* Headings */
h1 {
    font-family: var(--serif);
    font-size: 2.2rem;
    margin: 0 0 12px;
    color: var(--ink);
}
h2 {
    font-family: var(--serif);
    font-size: 1.5rem;
    margin: 0 0 16px;
}

/* Home intro */
.intro { max-width: 680px; margin-bottom: 48px; }
.intro p { font-size: 1.1rem; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.button {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 4px;
    border: 2px solid var(--blue);
    font-weight: 600;
}
.button:hover,
.button:focus-visible { background: var(--blue-dark); border-color: var(--blue-dark); }
.button-alt { background: transparent; color: var(--blue); }
.button-alt:hover,
.button-alt:focus-visible { background: var(--blue); color: #fff; }

a:focus-visible, .button:focus-visible {
    outline: 3px solid #e0a82e;
    outline-offset: 2px;
}

/* Car cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.car-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}
.car-card:hover { border-color: var(--blue); }
.car-card img,
.no-photo {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #e6eaef;
}
.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e6eaef;
    color: var(--muted);
}
.car-card-title { display: block; padding: 12px 14px; font-weight: 600; }

.muted { color: var(--muted); }

/* Registry search page */
.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.field label { font-weight: 600; }
.field select {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
}
button.button { font: inherit; font-weight: 600; cursor: pointer; }

.result-count { color: var(--muted); margin: 0 0 16px; }

.result-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.result-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}
.result-card img,
.result-card .no-photo {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #e6eaef;
}
.result-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
}
.result-body h2 { margin: 0 0 10px; }
.result-body .button { align-self: flex-start; margin-top: auto; }

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 0 0 16px;
}
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Car details page */
.back-link { margin: 0 0 12px; }
.back-link a { color: var(--blue); }

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-bottom: 32px;
}
.main-photo {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: zoom-in;
}
.photos-heading { margin: 24px 0 12px; font-size: 1.2rem; }
.slideshow .slide {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: zoom-in;
}
.slideshow .slide[hidden] { display: none; }
.slide-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.slide-controls[hidden] { display: none; }
.slide-hint { margin: 8px 0 0; font-size: 0.9rem; }

.detail-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 20px;
    margin: 0;
}
.detail-facts dt { color: var(--muted); font-weight: 700; }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; }

.comments h2 { margin-bottom: 10px; }
.comments-box {
    height: 150px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 12px 16px;
}

/* Full-size photo viewer */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 22, 0.92);
    padding: 56px 16px 16px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font: inherit;
    font-weight: 600;
    padding: 8px 16px;
    border: 0;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

@media (max-width: 760px) {
    .detail-layout { grid-template-columns: 1fr; }
}

/* Submission form */
.notice {
    background: var(--card);
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 24px;
}
.notice ul { margin: 8px 0; padding-left: 20px; }
.notice p { margin: 8px 0 0; }
.notice-ok { border-left-color: #1d7a3a; }
.notice-error { border-left-color: #b3261e; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
fieldset.form-col {
    min-width: 0;
    margin: 0;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
}
fieldset.form-col legend {
    font-family: var(--serif);
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0 6px;
}
.form-col .field { min-width: 0; margin-bottom: 16px; }
.field .label-text { font-weight: 600; }

.field input:not([type="file"]):not([type="checkbox"]),
.field textarea {
    font: inherit;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
}
.field textarea { resize: vertical; }
.field input[type="file"] { font: inherit; max-width: 100%; }
.field .caps { text-transform: uppercase; }
.form-col .field select { width: 100%; }

.checks { display: grid; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.hint { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }

/* Spam trap: kept out of sight of people */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--card);
    padding: 18px 0;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

@media (max-width: 640px) {
    .header-inner {
        grid-template-areas:
            "logo brand"
            "nav nav";
    }
    .brand-logo img { height: 72px; }
    .brand-name { font-size: 1.1rem; }
    .brand-tagline { font-size: 0.95rem; }
}
@media (max-width: 520px) {
    h1 { font-size: 1.8rem; }
}
