/*
 * UI refresh — layered on top of app.css and discovery.css (loaded last, from layouts/main.php).
 *
 * To go back to the previous look, delete the <link> to this file in resources/views/layouts/main.php: nothing else depends on it.
 *
 * What it adds (patterns borrowed from directory/marketplace sites such as Capterra, and from the clean information
 * architecture of the Local Enterprise Authority's site):
 *   1. a row of trust numbers under the hero                         (.trust-strip)
 *   2. "Browse by industry": every industry with its busiest services (.industry-grid)
 *   3. a LIST layout for results — a horizontal row per business that is far quicker to scan than tall cards — in one
 *      List | Grid | Map switch the visitor controls and the browser remembers  (html[data-results-layout="list"], .results-toolbar)
 *   4. a sticky in-page section bar on business profiles              (.profile-subnav)
 *   5. a fuller footer: industries and contact                        (.footer-links.footer-industries, .footer-contact)
 *   6. small progressive CSS touches: balanced headings, page cross-fades
 *   7. touch targets raised to the WCAG 2.2 minimum (24px) where an audit found them smaller
 */

/* ------------------------------------------------------------------ 1. trust strip */
.trust-strip { padding: 0; margin-top: -1px; background: var(--bd-deep-surface); border-top: 1px solid rgba(255, 255, 255, .08); }
.trust-strip ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; }
.trust-strip li { display: flex; align-items: center; gap: .8rem; padding: 1.05rem 1rem; color: #cfdbd9; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.trust-strip li > i { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: .8rem; color: #ffd9cf; background: rgba(227, 108, 79, .22); font-size: 1.15rem; }
.trust-strip strong { display: block; color: #fff; font-size: 1.35rem; font-weight: 750; line-height: 1.1; letter-spacing: -.01em; }
.trust-strip span { display: block; font-size: .78rem; }
@media (min-width: 768px) {
    .trust-strip ul { grid-template-columns: repeat(var(--trust-count, 4), minmax(0, 1fr)); }
    .trust-strip li { justify-content: center; padding: 1.25rem 1rem; border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .08); }
    .trust-strip li:last-child { border-right: 0; }
}

/* ------------------------------------------------------------------ 2. browse by industry */
.industry-section { padding-block: clamp(2.2rem, 5vw, 4rem); }
.industry-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 576px) { .industry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .industry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .industry-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.industry-card { display: flex; flex-direction: column; padding: 1.1rem 1.1rem .9rem; background: var(--bs-body-bg); border: 1px solid var(--bd-line); border-radius: var(--bd-card-radius); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.industry-card:hover, .industry-card:focus-within { border-color: color-mix(in srgb, var(--bd-coral) 55%, var(--bd-line)); box-shadow: var(--app-shadow-card); transform: translateY(-2px); }
.industry-head { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); align-items: center; gap: .75rem; color: var(--bd-ink); text-decoration: none; }
.industry-head .icon-circle { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .85rem; color: var(--bd-coral-dark); background: #fbe4dc; font-size: 1.2rem; }
.industry-head strong { display: block; font-size: .98rem; line-height: 1.25; }
.industry-head small { color: var(--bd-muted); font-size: .76rem; }
.industry-links { margin: .85rem 0 0; padding: .7rem 0 0; list-style: none; border-top: 1px solid var(--bd-line); }
.industry-links li { display: flex; justify-content: space-between; gap: .5rem; padding: .22rem 0; font-size: .84rem; }
.industry-links a { color: var(--bs-body-color); text-decoration: none; }
.industry-links a:hover { color: var(--bd-coral-dark); text-decoration: underline; }
.industry-links span { color: var(--bd-muted); font-variant-numeric: tabular-nums; }
.industry-more { margin-top: auto; padding-top: .6rem; font-size: .8rem; font-weight: 650; }
[data-bs-theme="dark"] .industry-card { background: #1d2a2c; border-color: #405154; }
[data-bs-theme="dark"] .industry-head { color: #eef4f2; }
[data-bs-theme="dark"] .industry-head .icon-circle { color: #ffd9cf; background: rgba(227, 108, 79, .22); }

/* ------------------------------------------------------------------ 3. results: one toolbar — count on the left, List | Grid | Map on the right */
.results-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; }
.results-summary { flex: 1 1 18rem; min-width: 0; }
.results-view-switch { flex: none; margin-left: auto; }
.results-view-switch .btn { font-weight: 650; }
.results-view-switch .btn.active { color: #fff; background: var(--bd-ink); border-color: var(--bd-ink); }
[data-bs-theme="dark"] .results-view-switch .btn { color: #eaf1ef; border-color: #405154; }
[data-bs-theme="dark"] .results-view-switch .btn.active { color: #142c2e; background: #f0a58f; border-color: #f0a58f; }

@media (min-width: 768px) {
    html[data-results-layout="list"] .directory-results { --bs-gutter-y: .9rem; }
    html[data-results-layout="list"] .directory-results > .col { flex: 0 0 100%; max-width: 100%; width: 100%; }
    html[data-results-layout="list"] .directory-results .business-card { flex-direction: row; min-height: 0; }
    html[data-results-layout="list"] .directory-results .business-card:hover { transform: none; }
    html[data-results-layout="list"] .directory-results .biz-media { flex: 0 0 clamp(190px, 26%, 270px); }
    html[data-results-layout="list"] .directory-results .biz-media .biz-cover { height: 100%; min-height: 100%; aspect-ratio: auto; }
    html[data-results-layout="list"] .directory-results .biz-media::after { display: none; }
    html[data-results-layout="list"] .directory-results .biz-quick-actions { top: auto; right: auto; bottom: 10px; left: 10px; }
    html[data-results-layout="list"] .directory-results .business-card > .card-body { display: grid; flex: 1 1 auto; min-width: 0; grid-template-columns: minmax(0, 1fr) 14.5rem; column-gap: 1.4rem; padding: 1rem 1.2rem 1rem; align-content: start; }
    html[data-results-layout="list"] .directory-results .business-card > .card-body > * { grid-column: 1; }
    html[data-results-layout="list"] .directory-results .business-card > .card-body > .business-card-actions { grid-column: 2; grid-row: 1 / span 8; align-self: stretch; margin-top: 0; padding: 0 0 0 1.2rem; border-top: 0; border-left: 1px solid var(--bd-line); align-content: center; }
    html[data-results-layout="list"] .directory-results .biz-identity-row { display: none !important; }
    html[data-results-layout="list"] .directory-results .business-card h3 { font-size: 1.1rem; }
    html[data-results-layout="list"] .directory-results .business-card .card-body > p { margin-bottom: .5rem !important; }
    html[data-results-layout="list"] .directory-results .contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
    html[data-results-layout="list"] .directory-results .card-discovery-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
    html[data-results-layout="list"] .directory-results .card-discovery-actions .profile-action { grid-column: 1 / -1; order: -1; justify-content: center; }
}
/* a narrower list (the filters beside it): the actions drop under the text instead of squeezing it */
@media (min-width: 768px) and (max-width: 1199.98px) {
    html[data-results-layout="list"] .directory-results .business-card > .card-body { grid-template-columns: minmax(0, 1fr); }
    html[data-results-layout="list"] .directory-results .business-card > .card-body > .business-card-actions { grid-column: 1; grid-row: auto; padding: .8rem 0 0; margin-top: .4rem; border-left: 0; border-top: 1px solid var(--bd-line); }
}

/* ------------------------------------------------------------------ 4. profile: sticky section bar */
.profile-subnav { position: sticky; top: var(--dk-nav-h, 78px); z-index: 30; background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent); backdrop-filter: blur(10px) saturate(140%); border-bottom: 1px solid var(--bd-line); }
.profile-subnav[hidden] { display: none; }
.profile-subnav ul { display: flex; gap: .25rem; margin: 0; padding: .45rem 0; overflow-x: auto; list-style: none; scrollbar-width: none; }
.profile-subnav ul::-webkit-scrollbar { display: none; }
.profile-subnav a { display: inline-block; padding: .38rem .8rem; border-radius: 999px; color: var(--bd-muted); font-size: .84rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.profile-subnav a:hover { color: var(--bd-ink); background: var(--bs-tertiary-bg); }
.profile-subnav a.is-current { color: #fff; background: var(--bd-ink); }
/* an anchor jump or a keyboard focus lands below the sticky header (and the section bar), never behind them — WCAG 2.2 "focus not obscured" */
html { scroll-padding-top: calc(var(--dk-nav-h, 78px) + 3.6rem); }

/* ------------------------------------------------------------------ 5. footer */
.footer-contact { margin-top: 1.1rem; display: grid; gap: .45rem; }
.footer-contact a { display: inline-flex; align-items: center; gap: .5rem; color: #cfdbd9; font-size: .84rem; text-decoration: none; }
.footer-contact a:hover { color: #fff; }
.footer-contact i { color: var(--bd-coral); }
@media (min-width: 992px) {
    .footer-grid.footer-grid-wide { grid-template-columns: 1.7fr repeat(4, 1fr); gap: 40px; }
    .footer-grid.footer-grid-wide .footer-links:last-child { grid-column: auto; }
}

/* ------------------------------------------------------------------ 6. small, progressive modern-CSS improvements
 * Each is ignored by a browser that does not know it — the page then simply looks as it did before. */

/* headings break into evenly long lines instead of leaving one orphan word on the last line */
h1, h2, h3, .hero h1 { text-wrap: balance; }

/* moving between pages cross-fades instead of flashing white; the header and the phone tab bar stay put.
 * Needs a browser with cross-document view transitions (Chrome / Edge / Safari); respects "reduce motion". */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .14s; }
    .site-nav { view-transition-name: site-nav; }
    .mobile-tabbar { view-transition-name: site-tabbar; }
}

/* phones: the explanatory "Recommended considers…" line is long and pushes the first result down — the count stays */
@media (max-width: 575.98px) {
    .results-summary .small { display: none; }
}
/* the section bar's tabs: the list is the scroll container, so tabs need a positioned parent to measure against */
.profile-subnav ul { position: relative; }

/* ------------------------------------------------------------------ 7. touch targets (WCAG 2.2 AA 2.5.8: at least 24x24 CSS px)
 * An audit of the home, search, category and profile pages at 1366px and 390px found these 20–23px tall; padding only — nothing moves
 * noticeably, but a thumb can no longer hit the neighbouring link by mistake. */
.footer-links a, .footer-contact a { display: flex; align-items: center; width: fit-content; min-height: 32px; }
.footer-contact a { display: inline-flex; }
.popular-searches a { display: inline-flex; align-items: center; min-height: 32px; }
.section-link, .first-review-link, a.badge, .recently-viewed .btn-link { display: inline-flex; align-items: center; min-height: 28px; }
.recently-viewed .btn-link { min-width: 44px; justify-content: center; }
.industry-links li { align-items: center; padding: 0; }
.industry-links a { display: inline-flex; align-items: center; flex: 1 1 auto; min-height: 30px; }
.filter-card a.small, .offer-card-business { display: inline-flex; align-items: center; min-height: 28px; }

/* ------------------------------------------------------------------ 8. business cards (the cards on the home page, search and category pages)
 * What was wrong, and what changes:
 *   - the logo / initials tile overlaps the photo's bottom edge but was painted UNDER it (the photo is a positioned box), so its
 *     top half was cut off — it is now painted above the photo, as intended
 *   - the action rows were narrower than the card (justify-content: space-between on a one-column grid shrinks the column)
 *   - three buttons in one grey slab on top of the photo were heavy — they are now three separate frosted circles
 *   - Preview / Compare were two more labelled buttons competing with "View profile" — they are quiet icon buttons now
 *   - a crest, square logo or flyer used as the cover was cropped to pieces — it is now shown whole on a blurred copy of itself
 *     (app.js adds .is-letterboxed once it knows the picture's proportions) */
.business-card .biz-logo, .business-card .biz-logo-placeholder { position: relative; z-index: 3; }
.business-card h3 { font-weight: 750; letter-spacing: -.01em; }
.business-card h3 a { color: var(--bd-ink) !important; }
[data-bs-theme="dark"] .business-card h3 a { color: #eef4f2 !important; }

.business-card .biz-media { isolation: isolate; background: color-mix(in srgb, var(--bd-ink) 8%, var(--bs-body-bg)); }
.business-card .biz-media.is-letterboxed::before { content: ''; position: absolute; inset: -28px; z-index: -1; background: var(--cover-bg) center / cover no-repeat; filter: blur(26px) saturate(1.2); opacity: .92; }
.business-card .biz-media.is-letterboxed .biz-cover { object-fit: contain; }

.business-card .biz-quick-actions { gap: 6px; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.business-card .quick-action { min-width: 40px; height: 40px; padding: 0 11px; color: var(--bd-ink); background: rgba(255, 255, 255, .9); border: 0; border-radius: 999px; box-shadow: 0 3px 12px rgba(8, 24, 26, .24); backdrop-filter: blur(8px) saturate(140%); }
.business-card .quick-action:hover, .business-card .quick-action:focus-visible { color: #fff; background: var(--bd-coral-dark); }
.business-card .quick-action.is-active { color: #fff; background: #c9563d; }
.business-card .quick-action[data-helpful-url].is-active { color: #fff; background: #27877d; }
[data-bs-theme="dark"] .business-card .quick-action { color: #fff; background: rgba(14, 30, 32, .72); box-shadow: 0 3px 12px rgba(0, 0, 0, .35); }
[data-bs-theme="dark"] .business-card .quick-action:hover, [data-bs-theme="dark"] .business-card .quick-action:focus-visible { color: #fff; background: #d3664e; }
@media (pointer: coarse) { .business-card .quick-action { min-width: 44px; height: 44px; } }

.business-card .business-card-actions { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
.business-card .contact-actions { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.business-card .card-discovery-actions { grid-template-columns: 44px 44px minmax(0, 1fr); }
.business-card .card-icon-action { padding: 0; }
.business-card .card-icon-action > span { display: none; }
/* in the wider list rows there is room for the words */
@media (min-width: 768px) {
    html[data-results-layout="list"] .directory-results .card-icon-action > span { display: inline; }
}
