/* ============================================================
   Tiljens Collection – Modern Clean Design
   ============================================================
   Palette inspired by vintage railways: deep Brunswick green,
   warm brass/gold highlights, aged-cream panels, charcoal steel.
   ============================================================ */


:root {
    color-scheme: light;

    /* --- core palette --- */
    --green-deep: #1b3a2d;
    --green-mid: #27503e;
    --green-soft: #3a6b54;
    --gold: #b08d47;
    --gold-light: #d4b96a;
    --gold-pale: #f5ecd4;
    --cream: #faf6ed;
    --cream-dark: #efe8d6;
    --charcoal: #2c2c2c;
    --steel: #6b706e;
    --rust: #a04028;
    --rust-soft: #f0ddd6;

    /* --- semantic tokens --- */
    --bg: #f3efe6;
    --panel: var(--cream);
    --panel-border: var(--cream-dark);
    --accent: var(--green-deep);
    --accent-soft: #dce8e0;
    --accent-hover: var(--green-mid);
    --highlight: var(--gold);
    --highlight-soft: #f5ecd4;
    --text: var(--charcoal);
    --text-muted: var(--steel);
    --border: #d6cfc0;
    --shadow-sm: 0 2px 8px rgba(43, 58, 45, .06);
    --shadow-md: 0 8px 24px rgba(43, 58, 45, .08);
    --shadow-lg: 0 16px 40px rgba(43, 58, 45, .10);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;
}

/* ---- reset ------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img {
    display: block;
    max-width: 100%;
}

/* ---- base ------------------------------------------------- */
body {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--green-soft);
    text-decoration: none;
}

a:hover {
    color: var(--gold);
}

/* ---- header ----------------------------------------------- */
header {
    background: linear-gradient(170deg, var(--green-deep) 0%, var(--green-mid) 60%, rgba(58, 107, 84, 0.95) 100%);
    color: var(--cream);
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

header .layout {
    position: relative;
    padding-top: 12px;
    padding-bottom: 12px;
}

header h1 {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: clamp(1.6rem, 4vw, 2.0rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--cream);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}

.brand-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

header p,
header div {
    color: rgba(255, 255, 255, 0.9);
}

header a {
    color: rgba(255, 255, 255, 0.92);
}

header a:hover {
    color: var(--gold-light);
}

.nav {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.nav a {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: none;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
    font-size: 14px;
    font-weight: 500;
    transition: background 140ms ease, color 140ms ease;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream);
}

.nav a.active {
    background: var(--gold);
    color: var(--green-deep);
    font-weight: 700;
}

/* ---- submenu (page-level navigation) ---------------------- */
.submenu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.submenu a {
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--submenu-bg, var(--accent-soft));
    color: var(--submenu-text, var(--green-deep));
    font-weight: 600;
    font-size: 14px;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.submenu a:hover {
    background: var(--highlight-soft);
    color: var(--submenu-text, var(--green-deep));
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.submenu a.active {
    background: var(--submenu-active-bg, var(--gold));
    color: var(--submenu-active-text, var(--green-deep));
    border-color: var(--gold);
    box-shadow: var(--shadow-sm);
}

.submenu-top {
    margin: 6px 0 18px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.page-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    align-items: start;
}

.submenu-side {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 16px;
}

.page-shell-body {
    min-width: 0;
}

@media (max-width: 900px) {
    .page-shell {
        grid-template-columns: 1fr;
    }

    .submenu-side {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
}

.pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--green-deep);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.owner {
    color: var(--text-muted);
    margin: 0 0 10px;
    font-size: 15px;
}

/* ---- meta panel (contact info) ---------------------------- */
.meta-panel {
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-top: 20px;
}

.meta {
    color: var(--text-muted);
    font-size: 14px;
}

/* ---- layout ----------------------------------------------- */
.layout {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2px 24px 56px;
}

.page-header {}

.page-title {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: clamp(1.75rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    color: var(--page-title, var(--green-deep));
}

.page-lead {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}

.page-content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    font-size: 16px;
}

/* Ensure floats inside page-content are contained so the panel grows */
.page-content::after {
    content: "";
    display: table;
    clear: both;
}

.page-content p {
    margin: 0 0 10px;
}

.page-content p:last-child {
    margin-bottom: 0;
}

/* Inline page image: fixed width, text wraps around it */
.page-media {
    float: left;
    width: 220px;
    margin: 0 18px 12px 0;
}

.page-media img {
    width: 220px;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
    .page-media {
        float: none;
        width: 100%;
        margin: 0 0 12px 0;
    }

    .page-media img {
        width: 100%;
    }
}

/* ---- filters ---------------------------------------------- */
.filters {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-label {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="search"],
select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

input[type="search"]:focus,
select:focus {
    outline: none;
    border-color: var(--green-soft);
    box-shadow: 0 0 0 3px rgba(58, 107, 84, .15);
}

/* --- tags -------------------------------------------------- */
.tag-section-label {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin: 20px 0 12px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0px 6px;
    border-radius: var(--radius-sm);
}

/* ---- table styling ---------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    background: var(--panel);
    border: var(--table-border-width, 1px) solid var(--table-border-color, var(--border));
    border-radius: var(--radius-sm);
    overflow: hidden;
}

th,
td {
    padding: 8px 12px;
    border: var(--table-border-width, 1px) solid var(--table-border-color, var(--border));
    text-align: left;
}

th {
    background: var(--accent-soft);
    font-weight: 600;
}

tbody tr:nth-child(even) {
    background: var(--highlight-soft);
}

/* ---- code styling ----------------------------------------- */
.code-frame {
    background: #9d9d8e;
    /* dark background for contrast */
    border: 1px solid rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 6px 18px rgba(16, 20, 24, 0.25);
    margin: 12px 0;
}

.code-frame pre {
    margin: 0;
}

.code-frame code {
    display: block;
    color: #e6eef6;
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre;
}

/* inline code */
code {
    background: #9d9d8e;
    color: #e6eef6;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.92em;
}

.tag-chip input {
    accent-color: var(--green-deep);
    width: 14px;
    height: 14px;
    margin: 0;
    vertical-align: middle;
}

.tag-chip:hover {
    background: var(--highlight-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---- item grid -------------------------------------------- */
.items {
    margin-top: 28px;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ---- item card -------------------------------------------- */
.item-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* thumbnail area */
.thumb {
    position: relative;
    padding-top: 60%;
    background:
        linear-gradient(135deg, #ddd5c5 0%, #e8e2d4 100%);
    overflow: hidden;
}

.thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.item-card:hover .thumb img {
    transform: scale(1.04);
}

.thumb .placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* decorative gold stripe at top of card body */
.card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 3px solid var(--gold);
}

/* status badge */
.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    width: fit-content;
}

/* colour-code common statuses */
.status {
    background: var(--accent-soft);
    color: var(--green-deep);
}

.status[data-val="sold"] {
    background: var(--rust-soft);
    color: var(--rust);
}

.status[data-val="reserved"] {
    background: var(--highlight-soft);
    color: #806020;
}

/* price */
.price {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--green-deep);
    letter-spacing: -0.02em;
}

.item-name {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.desc {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.desc p {
    margin: 0 0 6px;
}

.desc p:last-child {
    margin-bottom: 0;
}

/* per-item tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--highlight-soft);
    color: var(--gold);
    font-weight: 600;
    letter-spacing: .03em;
}

/* gallery thumbnails */
.gallery {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.gallery a {
    display: inline-block;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--cream-dark);
    transition: border-color 120ms ease, transform 120ms ease;
}

.gallery a:hover {
    border-color: var(--gold);
    transform: scale(1.08);
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Detail view gallery: large main image + uniform thumbnails */
.detail-gallery {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 16px;
    align-items: start;
    margin-top: 14px;
}

.detail-gallery .main-image {
    width: 100%;
}

.detail-gallery .main-image img {
    width: 100%;
    height: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.detail-gallery .thumbnails {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thumb-btn {
    appearance: none;
    border: 2px solid var(--border);
    padding: 0;
    width: 100%;
    height: 76px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: transparent;
    cursor: pointer;
}

.thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-btn.selected {
    border-color: var(--gold);
    transform: scale(1.02);
}

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

    .detail-gallery .thumbnails {
        flex-direction: row;
        overflow-x: auto;
    }

    .thumb-btn {
        flex: 0 0 84px;
        height: 64px;
    }
}

/* ---- empty state ------------------------------------------ */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--cream);
    font-size: 16px;
}

/* ---- main (push footer below fold) ----------------------- */
:root {
    --header-height: 0px;
    --footer-height: 0px;
}

main {
    /* make main fill viewport minus header so footer starts just below fold */
    min-height: calc(100vh - var(--header-height, 0px));
}

/* ---- footer ----------------------------------------------- */
footer {
    text-align: center;
    padding: 24px;
    font-size: 14px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

/* ---- responsive ------------------------------------------- */
@media (max-width: 640px) {
    header .layout {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .layout {
        padding: 14px 16px 36px;
    }

    .items {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

    header h1 {
        font-size: 1.6rem;
    }
}