:root {
    color-scheme: light;
    --ink: #171615;
    --muted: #6f706f;
    --paper: #f5f1e8;
    --panel: #fffdf7;
    --line: #ded3c2;
    --brand: #853e22;
    --brand-dark: #512312;
    --green: #365942;
    --blue: #2f5e72;
    --gold: #b77b2c;
    --shadow: 0 18px 55px rgba(54, 41, 30, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(18px, 4vw, 56px);
    background: rgba(245, 241, 232, 0.9);
    border-bottom: 1px solid rgba(222, 211, 194, 0.8);
    backdrop-filter: blur(18px);
}

.brand,
.post-button,
.desktop-nav {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #fff;
    background: var(--brand);
    border-radius: 8px;
    font-size: 0.82rem;
}

.desktop-nav {
    gap: 24px;
    color: var(--muted);
    font-size: 0.95rem;
}

.desktop-nav a:hover,
.nav-dropdown-button:hover {
    color: var(--ink);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    display: grid;
    min-width: 190px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -6px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.nav-dropdown:hover .nav-dropdown-button,
.nav-dropdown:focus-within .nav-dropdown-button {
    color: var(--ink);
}

.nav-dropdown-menu a {
    padding: 9px 10px;
    color: var(--ink);
    border-radius: 6px;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus {
    background: rgba(133, 62, 34, 0.1);
}

.post-button,
.search-row button,
.listing-card button,
.plan-card button,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #fff;
    background: var(--brand);
    border-radius: 8px;
    font-weight: 750;
}

.post-button {
    gap: 8px;
    padding: 10px 14px;
    white-space: nowrap;
}

.post-button span {
    font-size: 1.2rem;
    line-height: 1;
}

.hero {
    position: relative;
    min-height: min(760px, calc(100vh - 68px));
    display: grid;
    align-items: end;
    overflow: hidden;
    background: #161615;
}

.hero-image,
.hero-shade {
    position: absolute;
    inset: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-shade {
    background:
        linear-gradient(90deg, rgba(13, 12, 10, 0.84), rgba(13, 12, 10, 0.48) 42%, rgba(13, 12, 10, 0.1)),
        linear-gradient(0deg, rgba(13, 12, 10, 0.62), rgba(13, 12, 10, 0.04) 44%);
}

.hero-content {
    position: relative;
    width: min(1120px, 100%);
    padding: clamp(26px, 7vw, 72px);
    color: #fff;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 8vw, 6.6rem);
    line-height: 0.94;
    letter-spacing: 0;
}

.hero-copy {
    max-width: 640px;
    margin-bottom: 28px;
    color: rgba(255, 255, 255, 0.84);
    font-size: clamp(1.06rem, 2vw, 1.35rem);
    line-height: 1.45;
}

.search-panel {
    width: min(790px, 100%);
    padding: 14px;
    background: rgba(255, 253, 247, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.search-row input {
    width: 100%;
    min-width: 0;
    padding: 14px 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.search-row button {
    padding: 0 20px;
}

.quick-filters,
.category-submenu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.quick-filters {
    margin-top: 12px;
}

.category-submenu {
    margin-top: 10px;
    padding: 10px;
    background: rgba(81, 35, 18, 0.08);
    border: 1px solid rgba(81, 35, 18, 0.16);
    border-radius: 8px;
}

.category-submenu[hidden] {
    display: none;
}

.filter-button {
    flex: 0 0 auto;
    padding: 8px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 750;
}

.subfilter-button {
    flex: 0 0 auto;
    padding: 8px 11px;
    color: var(--brand-dark);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(81, 35, 18, 0.18);
    border-radius: 8px;
    font-weight: 750;
}

.filter-button.is-active {
    color: #fff;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.subfilter-button.is-active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    width: min(1120px, calc(100% - 36px));
    margin: -42px auto 0;
    position: relative;
    z-index: 2;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
    box-shadow: var(--shadow);
}

.metrics article {
    display: grid;
    gap: 5px;
    padding: 20px;
    background: var(--panel);
}

.metrics strong {
    font-size: clamp(1.4rem, 3vw, 2.3rem);
    line-height: 1;
}

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

.section-shell {
    width: min(1120px, calc(100% - 36px));
    margin: 72px auto;
}

.section-band {
    width: 100%;
    padding: 58px max(18px, calc((100% - 1120px) / 2));
    background: #ebe4d7;
}

.section-heading {
    max-width: 730px;
    margin-bottom: 24px;
}

.inline-heading {
    max-width: none;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.section-heading h2 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1;
    letter-spacing: 0;
}

.section-heading p:not(.eyebrow),
.listing-body p,
.category-card p,
.trust-grid p,
.plan-card p,
.site-footer {
    color: var(--muted);
    line-height: 1.55;
}

.category-grid,
.listing-grid,
.trust-grid,
.plan-grid,
.service-grid {
    display: grid;
    gap: 16px;
}

.category-grid {
    grid-template-columns: repeat(4, 1fr);
}

.listing-grid,
.plan-grid {
    grid-template-columns: repeat(3, 1fr);
}

.trust-grid {
    grid-template-columns: repeat(4, 1fr);
}

.service-grid {
    grid-template-columns: repeat(6, 1fr);
}

.category-card,
.listing-card,
.trust-grid article,
.plan-card,
.service-grid article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.category-card,
.trust-grid article,
.plan-card,
.service-grid article {
    padding: 22px;
}

.service-grid article {
    display: grid;
    place-items: center;
    min-height: 96px;
    color: var(--brand-dark);
    font-weight: 900;
    text-align: center;
}

.icon-box {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 22px;
    color: #fff;
    background: var(--brand);
    border-radius: 8px;
    font-weight: 900;
}

.category-card h3,
.trust-grid h3,
.plan-card h3 {
    margin-bottom: 8px;
    font-size: 1.22rem;
}

.listing-card {
    overflow: hidden;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.listing-card[hidden] {
    display: none;
}

.listing-card:hover,
.listing-card:focus-within {
    box-shadow: 0 14px 38px rgba(54, 41, 30, 0.14);
    transform: translateY(-2px);
}

.listing-media,
.listing-photo-media {
    position: relative;
    display: flex;
    align-items: end;
    min-height: 178px;
    padding: 16px;
    color: #fff;
    background: var(--green);
}

.listing-media span,
.listing-photo-media span {
    position: relative;
    z-index: 2;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.listing-photo-media {
    display: grid;
    grid-template-rows: 1fr 48px;
    gap: 6px;
    min-height: 220px;
    padding: 0;
    overflow: hidden;
    background: #2a241f;
}

.listing-photo-media span {
    position: absolute;
    left: 12px;
    top: 12px;
}

.primary-listing-photo,
.thumbnail-strip img,
.photo-slots img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.primary-listing-photo {
    min-height: 166px;
}

.thumbnail-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 0 6px 6px;
}

.thumbnail-strip img {
    min-width: 0;
    border-radius: 4px;
}

.horse-media {
    background: linear-gradient(135deg, #853e22, #c0843f);
}

.cattle-media {
    background: linear-gradient(135deg, #365942, #8b9f62);
}

.trailer-media {
    background: linear-gradient(135deg, #2f5e72, #8cb6c6);
}

.equipment-media {
    background: linear-gradient(135deg, #7d642e, #d5a342);
}

.irrigation-media {
    background: linear-gradient(135deg, #2f5e72, #4fa5a8);
}

.hay-media {
    background: linear-gradient(135deg, #647a37, #d0a33f);
}

.fence-media {
    background: linear-gradient(135deg, #5c4738, #9a7a5f);
}

.other-media {
    background: linear-gradient(135deg, #5c4738, #8f6e4f);
}

.listing-body {
    padding: 18px;
}

.price-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.price-row h3 {
    margin-bottom: 0;
}

.price-row strong {
    color: var(--brand);
    white-space: nowrap;
}

.listing-body ul {
    padding-left: 18px;
    margin: 14px 0;
    color: var(--muted);
}

.listing-body li + li {
    margin-top: 4px;
}

.badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.verified {
    color: var(--green);
    font-size: 0.86rem;
    font-weight: 850;
}

.listing-card button,
.danger-button {
    padding: 8px 13px;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.card-actions button {
    min-height: 34px;
}

.danger-button {
    color: #fff;
    background: #8d241c;
    border: 0;
    border-radius: 8px;
    font-weight: 850;
}

.empty-state {
    padding: 34px;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.plan-card {
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.plan-card strong {
    margin-bottom: 14px;
    font-size: 2rem;
    color: var(--brand);
}

.plan-card p {
    flex: 1;
}

.payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.payment-methods span {
    padding: 6px 8px;
    color: var(--brand-dark);
    background: rgba(183, 123, 44, 0.14);
    border: 1px solid rgba(183, 123, 44, 0.3);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
}

.plan-card button {
    width: 100%;
    padding: 12px 14px;
}

.featured-plan {
    border-color: rgba(133, 62, 34, 0.55);
    box-shadow: 0 18px 45px rgba(133, 62, 34, 0.15);
}

.payment-status {
    min-height: 24px;
    margin: 18px 0 0;
    color: var(--brand-dark);
    font-weight: 750;
}

.payment-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 26px clamp(18px, 4vw, 56px);
    border-top: 1px solid var(--line);
}

.site-footer span:first-child {
    color: var(--ink);
    font-weight: 850;
}

.site-footer a {
    color: var(--brand-dark);
    font-weight: 750;
}

.terms-page {
    min-height: calc(100vh - 67px);
    padding: clamp(34px, 7vw, 72px) 18px;
}

.terms-shell {
    width: min(920px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 46px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.terms-shell h1 {
    margin: 0;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    line-height: 0.98;
}

.terms-updated {
    margin: 14px 0 34px;
    color: var(--muted);
}

.terms-shell article {
    padding: 24px 0;
    border-top: 1px solid var(--line);
}

.terms-shell h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.terms-shell p {
    max-width: 72ch;
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.7;
}

.auth-page {
    min-height: calc(100vh - 67px);
    padding: clamp(34px, 7vw, 74px) 18px;
    background:
        linear-gradient(135deg, rgba(133, 62, 34, 0.09), rgba(54, 89, 66, 0.12)),
        var(--paper);
}

.auth-shell {
    width: min(980px, 100%);
    margin: 0 auto;
}

.auth-shell h1 {
    color: var(--ink);
    font-size: clamp(3rem, 7vw, 5.4rem);
}

.auth-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 18px;
}

.auth-card {
    display: grid;
    gap: 16px;
    padding: clamp(20px, 4vw, 28px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(54, 41, 30, 0.08);
}

.auth-card h2 {
    margin-bottom: 2px;
}

.auth-card label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 800;
}

.auth-card input,
.auth-card select,
.auth-card textarea {
    width: 100%;
    min-width: 0;
    padding: 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.auth-card textarea {
    resize: vertical;
}

.listing-dialog,
.listing-detail-dialog {
    width: min(760px, calc(100% - 28px));
    max-height: min(840px, calc(100vh - 28px));
    padding: 0;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.listing-dialog::backdrop,
.listing-detail-dialog::backdrop {
    background: rgba(23, 22, 21, 0.58);
}

.listing-form,
.listing-detail {
    display: grid;
    gap: 18px;
    padding: clamp(18px, 4vw, 28px);
}

.listing-detail-dialog {
    width: min(860px, calc(100% - 28px));
}

.dialog-header,
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dialog-header h2 {
    margin-bottom: 0;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1;
}

.icon-button {
    width: 38px;
    height: 38px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

.listing-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.listing-form legend,
.listing-form label {
    color: var(--ink);
    font-weight: 800;
}

.choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.choice-button {
    padding: 9px 12px;
    color: var(--brand-dark);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 800;
}

.choice-button.is-active {
    color: #fff;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.listing-form label {
    display: grid;
    gap: 7px;
}

.listing-form input,
.listing-form select,
.listing-form textarea {
    width: 100%;
    min-width: 0;
    padding: 12px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.listing-form textarea {
    resize: vertical;
}

.photo-slots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.photo-slots span {
    display: grid;
    place-items: center;
    min-height: 82px;
    overflow: hidden;
    color: var(--muted);
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 800;
    text-align: center;
}

.photo-slots .has-photo {
    border-style: solid;
    padding: 0;
}

.form-status {
    min-height: 22px;
    margin: 0;
    color: var(--brand-dark);
    font-weight: 750;
}

.dialog-actions {
    justify-content: flex-end;
}

.secondary-button,
.primary-button {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 850;
}

.secondary-button {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.detail-photo-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-auto-rows: 116px;
    gap: 8px;
}

.detail-photo-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.detail-photo-grid img:first-child {
    grid-row: span 2;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.detail-meta strong,
.detail-meta span {
    padding: 8px 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.detail-meta strong {
    color: var(--brand);
}

.detail-list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.6;
}

.detail-danger-button {
    min-height: 44px;
    padding: 10px 16px;
}

@media (max-width: 940px) {
    .desktop-nav {
        display: none;
    }

    .metrics,
    .category-grid,
    .trust-grid,
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .listing-grid,
    .plan-grid,
    .auth-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .site-header {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .post-button {
        width: 100%;
        justify-content: center;
    }

    .hero {
        min-height: 760px;
    }

    .hero-content {
        padding: 32px 18px;
    }

    h1 {
        font-size: 3.2rem;
    }

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

    .search-row button {
        min-height: 46px;
    }

    .metrics,
    .category-grid,
    .trust-grid,
    .service-grid {
        grid-template-columns: 1fr;
    }

    .inline-heading {
        align-items: start;
        flex-direction: column;
    }

    .site-footer {
        flex-direction: column;
    }

    .form-grid,
    .dialog-actions,
    .photo-slots {
        grid-template-columns: 1fr;
    }

    .dialog-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .badge-row {
        align-items: stretch;
        flex-direction: column;
    }

    .card-actions {
        justify-content: stretch;
    }

    .card-actions button {
        flex: 1;
    }

    .detail-photo-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 160px;
    }

    .detail-photo-grid img:first-child {
        grid-row: span 1;
    }
}
