/* ==========================================================================
   Wolfville Business Directory — "Golden Harvest" theme
   Look & feel inspired by thelocalbusinessdirectory.ca: warm gold hero with
   a wave divider, white category tiles, gold-accented listing cards and a
   charcoal footer. Pure re-skin: every class used by the app's views is
   kept, so no functionality, markup contracts or htmx behaviour changed.
   ========================================================================== */

:root {
    --bg: #f6f4ee;
    --surface: #ffffff;
    --ink: #221f15;
    --muted: #7a7468;
    --brand: #ffd60a;        /* primary gold */
    --brand-dark: #f0c400;   /* hover gold */
    --brand-ink: #221f14;    /* text on gold */
    --brand-deep: #8a6d00;   /* gold-tinted links / labels */
    --gold-soft: #fff7d6;    /* soft gold fill */
    --gold-line: #f0e2a8;    /* soft gold border */
    --danger: #c2402a;
    --danger-dark: #9c3020;
    --ok: #2e7d4f;
    --border: #eae5d9;
    --footer-bg: #232327;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgb(34 31 21 / 6%);
    --shadow-md: 0 10px 26px rgb(34 31 21 / 12%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    overflow-x: hidden;
}

::selection { background: var(--brand); color: var(--brand-ink); }

:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: 2px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* --------------------------------------------------------------------------
   Header — white bar with gold brand mark (TLBD style)
   -------------------------------------------------------------------------- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: relative;
    z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand {
    display: inline-flex; align-items: center; gap: 0.55rem;
    color: var(--ink); text-decoration: none;
    font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em;
}
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.1rem; height: 2.1rem; font-size: 1.15rem;
    background: var(--brand); border-radius: 10px;
    box-shadow: inset 0 -2px 0 rgb(0 0 0 / 12%);
}
.brand-sub { font-weight: 500; color: var(--muted); margin-left: 0.1rem; }
.site-header nav { display: flex; gap: 1.4rem; }
.site-header nav a {
    color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem;
    padding: 0.2rem 0; border-bottom: 3px solid transparent;
}
.site-header nav a:hover { border-bottom-color: var(--brand); }

main.container { padding: 2rem 1.25rem 3.5rem; min-height: 60vh; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 600; }

/* --------------------------------------------------------------------------
   Hero — full-bleed gold band with wave divider
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    margin: -2rem calc(50% - 50vw) 0;
    padding: 3.4rem 1.25rem 5.8rem;
    text-align: center;
    background: linear-gradient(135deg, #ffe45c 0%, #ffd60a 45%, #f2c400 100%);
    overflow: hidden;
}
.hero h1 {
    margin: 0 0 0.9rem;
    font-size: clamp(2rem, 4.5vw, 2.9rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #211d0e;
}
.hero-stats {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem;
    margin: 0; padding: 0;
}
.hero-stats span {
    background: rgb(255 255 255 / 62%);
    border: 1px solid rgb(0 0 0 / 6%);
    border-radius: 999px;
    padding: 0.32rem 0.95rem;
    font-size: 0.9rem; font-weight: 600; color: #3d3413;
}
.hero-wave {
    position: absolute; bottom: -1px; left: 0;
    width: 100%; height: 52px; display: block;
    pointer-events: none;
}

/* Search card (works on gold hero and on plain admin background) */
.filter-bar {
    display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.65rem;
    margin: 1.7rem auto 0;
    max-width: 780px;
    box-shadow: 0 12px 32px rgb(34 31 21 / 14%);
}
.filter-bar input[type="search"] { flex: 1 1 260px; }
.filter-bar select { flex: 0 1 220px; }
.filter-bar button {
    font: inherit; font-weight: 700; cursor: pointer;
    padding: 0.6rem 1.3rem;
    background: var(--brand); color: var(--brand-ink);
    border: 1px solid #eccf00; border-radius: 9px;
    transition: background 0.15s ease;
}
.filter-bar button:hover { background: var(--brand-dark); }

input, select, textarea {
    font: inherit;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 3px rgb(255 214 10 / 35%);
}

/* --------------------------------------------------------------------------
   Section titles + category tiles (TLBD "Popular Categories" motif)
   -------------------------------------------------------------------------- */
.cat-section { margin-top: 2.6rem; }
.section-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 1.3rem;
}
.section-title::after {
    content: "";
    display: block;
    width: 64px; height: 4px;
    background: var(--brand);
    border-radius: 4px;
    margin: 0.55rem auto 0;
}
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}
.tile {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 0.8rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover {
    transform: translateY(-3px);
    border-color: var(--brand-dark);
    box-shadow: var(--shadow-md);
}
.tile-icon {
    display: flex; align-items: center; justify-content: center;
    width: 3.4rem; height: 3.4rem;
    margin: 0 auto 0.5rem;
    font-size: 1.6rem;
    background: var(--gold-soft);
    border-radius: 50%;
}
.tile-name { font-weight: 700; font-size: 0.88rem; }

/* Collapsible category grid: first two rows visible, rest behind toggle.
   JS measures the two-row height and caps .tiles with an inline
   max-height; this block only handles the clipped look + fade + button. */
.tiles.is-collapsed {
    position: relative;
    overflow: hidden;
}
.tiles.is-collapsed::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 72px;
    background: linear-gradient(to bottom, rgb(246 244 238 / 0%), var(--bg) 80%);
    pointer-events: none;
}
.tiles-toggle-row { margin-top: 1.1rem; text-align: center; }
.tiles-toggle-row[hidden] { display: none; }
.tiles-toggle { display: inline-flex; align-items: center; gap: 0.45rem; }
.tiles-chevron {
    display: inline-block;
    font-size: 0.8rem;
    line-height: 1;
    transition: transform 0.2s ease;
}
.tiles-toggle[aria-expanded="true"] .tiles-chevron { transform: rotate(180deg); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-block;
    background: var(--brand);
    border: 1px solid #eccf00;
    color: var(--brand-ink);
    padding: 0.58rem 1.1rem;
    border-radius: 9px;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgb(34 31 21 / 10%);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgb(34 31 21 / 14%);
}
.btn.small { padding: 0.32rem 0.75rem; font-size: 0.85rem; }
.btn.tiny { padding: 0.22rem 0.6rem; font-size: 0.78rem; }
.btn.full { width: 100%; }
.btn.ghost {
    background: transparent;
    color: var(--brand-deep);
    border: 1px solid var(--gold-line);
    box-shadow: none;
}
.btn.ghost:hover { background: var(--gold-soft); transform: none; box-shadow: none; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-dark); }

/* --------------------------------------------------------------------------
   Listing cards — gold top rail (TLBD signature)
   -------------------------------------------------------------------------- */
.results-head { margin: 0.4rem 0 1.1rem; text-align: center; }
.results-head p { font-weight: 600; margin: 0; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.15rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem 1.2rem;
    display: flex; flex-direction: column; gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--brand-deep); }
.card .cats { margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.card .desc { margin: 0; font-size: 0.9rem; color: #4a4536; }
.card .card-links { margin-top: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.45rem; }

.chip {
    display: inline-block;
    background: var(--brand);
    color: var(--brand-ink);
    border-radius: 6px;
    padding: 0.14rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    margin: 0 0.2rem 0.2rem 0;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pager {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
    justify-content: center;
    margin: 1.7rem 0;
}
.pager a {
    padding: 0.34rem 0.7rem;
    border: 1px solid var(--border); border-radius: 8px;
    text-decoration: none; color: var(--ink);
    background: var(--surface); font-size: 0.9rem; font-weight: 600;
}
.pager a:hover { border-color: var(--brand-dark); background: var(--gold-soft); }
.pager a.current { background: var(--brand); color: var(--brand-ink); border-color: #eccf00; }
/* First/Back/Next/Last step buttons; disabled state renders as inert text. */
.pager .pager-step { white-space: nowrap; }
.pager .pager-step.disabled {
    padding: 0.34rem 0.7rem;
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--muted); background: var(--surface);
    opacity: 0.45; cursor: not-allowed; user-select: none;
    font-size: 0.9rem; font-weight: 600;
}
.pager .pager-gap {
    align-self: center; color: var(--muted);
    padding: 0 0.15rem; user-select: none;
}

/* --------------------------------------------------------------------------
   Business detail page
   -------------------------------------------------------------------------- */
.breadcrumb { margin-bottom: 0.9rem; }
.breadcrumb a { color: var(--brand-deep); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

.detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand);
    border-radius: 14px;
    padding: 1.7rem 1.9rem 2rem;
    box-shadow: var(--shadow-sm);
}
.detail h1 { margin: 0.2rem 0 0.7rem; font-size: 1.9rem; letter-spacing: -0.02em; }
.detail h2 {
    font-size: 0.85rem;
    margin: 1.2rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-deep);
}
.detail-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 1.6rem; margin-top: 1.2rem;
}
.detail-side {
    background: var(--gold-soft);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    align-self: start;
}
.desc-full { white-space: normal; }
.contact-list dt {
    font-weight: 700; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--brand-deep); margin-top: 0.8rem;
}
.contact-list dd { margin: 0.15rem 0 0; }
.contact-list a { color: var(--ink); }

.social-icons {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.social-link:hover {
    border-color: var(--brand-dark);
    box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
    transform: translateY(-1px);
}
.social-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem; }
.admin-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.admin-actions { display: flex; gap: 0.6rem; align-items: center; }
.inline { display: inline; }

.flash { padding: 0.65rem 1rem; border-radius: 9px; margin: 0.8rem 0; font-weight: 500; }
.flash.success { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.flash.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.flash.error ul { margin: 0; padding-left: 1.1rem; }

.admin-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td { padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table thead th {
    background: #fbf3d9; font-size: 0.76rem; text-transform: uppercase;
    letter-spacing: 0.05em; color: #6e5a1e;
}
.admin-table tbody tr:hover { background: #fffcf2; }
.row-actions { display: flex; gap: 0.35rem; }

.admin-form { max-width: 640px; display: flex; flex-direction: column; gap: 0.8rem; }
.admin-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
.admin-form label em { color: var(--danger); font-style: normal; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; }

.confirm-card {
    background: var(--surface); border: 1px solid #fecaca;
    border-top: 4px solid var(--danger);
    border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0;
    box-shadow: var(--shadow-md); max-width: 460px;
}
.confirm-card h3 { margin: 0 0 0.3rem; }
.confirm-actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; }

/* Auth card */
.auth-card {
    max-width: 400px; margin: 3rem auto; background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand);
    border-radius: 14px;
    padding: 2rem; box-shadow: var(--shadow-md);
}
.auth-card h1 { margin-top: 0; font-size: 1.4rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.8rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }

/* Empty state */
.empty {
    text-align: center; padding: 2.6rem 1rem; background: var(--surface);
    border: 1px dashed var(--gold-line); border-radius: var(--radius); color: var(--muted);
}
.empty a { color: var(--brand-deep); font-weight: 600; }

/* HTMX indicator */
.htmx-indicator { opacity: 0; transition: opacity 0.2s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* --------------------------------------------------------------------------
   Footer — charcoal band (TLBD motif)
   -------------------------------------------------------------------------- */
.site-footer {
    background: var(--footer-bg);
    color: #c9c2b4;
    padding: 2.2rem 0;
    font-size: 0.88rem;
    text-align: center;
    margin-top: 2rem;
}
.site-footer p { margin: 0; }
.site-footer strong { color: #fff; }

@media (max-width: 760px) {
    .hero { padding: 2.4rem 1rem 4.8rem; }
    .header-inner { flex-wrap: wrap; row-gap: 0.35rem; }
    .brand { font-size: 1.1rem; }
    .brand-sub { display: none; }
    .site-header nav { gap: 1rem; }
    .filter-bar input[type="search"],
    .filter-bar select { flex: 1 1 100%; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .admin-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}