/* ------------------------------------------------------------------
   Arboristé – the Stromopedie forest theme on top of MudBlazor
   ------------------------------------------------------------------ */
:root {
    --forest: #2f5d3a;
    --forest-deep: #24482d;
    --moss: #6b8f4e;
    --sage: #a9b89a;
    --bark: #5a3e2b;
    --amber: #c98a2b;
    --paper: #f6f1e7;
    --paper-2: #efe7d6;
    --paper-3: #e3d9c6;
    --surface: #fffdf8;
    --ink: #2a2620;
    --ink-soft: #6b6259;
    --serif: "Fraunces", Georgia, serif;
    --sans: "Source Sans 3", "Segoe UI", sans-serif;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(42, 38, 32, .06), 0 4px 14px rgba(42, 38, 32, .06);
    --shadow-md: 0 6px 24px rgba(42, 38, 32, .12);
    --max: 1240px;

    --appbar: #24482d;
    --forest-tint: rgba(47, 93, 58, .12);
    --amber-ink: #8a5c15;
    --bad: #a23b2c;
    --bad-ink: #8a2f22;
    --exam-ink: #4a4a8c;
    /* Text on the app bar and the lightbox, which are dark in both themes. */
    --on-dark: #f6f1e7;
    color-scheme: light;
}

/* --- dark: the forest at night ---------------------------------------
   Not an inversion of the paper: a deep green-black ground, warm off-white
   ink, and the greens and ambers lifted so they still read as the same
   hues on a dark surface. Mirrored in MainLayout.razor (PaletteDark) for
   MudBlazor's own controls. Declared twice: the media query follows the
   operating system, the attribute is a theme pinned in the app bar. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --forest: #8cc59a;
        --forest-deep: #b7dcbf;
        --moss: #9cc07e;
        --sage: #56654d;
        --bark: #d8b193;
        --amber: #e0a345;
        --paper: #111510;
        --paper-2: #182017;
        --paper-3: #2b3529;
        --surface: #172016;
        --ink: #ebe6da;
        --ink-soft: #aaa393;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
        --shadow-md: 0 6px 24px rgba(0, 0, 0, .5);
        --appbar: #0c110b;
        --forest-tint: rgba(140, 197, 154, .14);
        --amber-ink: #eab865;
        --bad: #e0715f;
        --bad-ink: #f2a597;
        --exam-ink: #b3b3ec;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --forest: #8cc59a;
    --forest-deep: #b7dcbf;
    --moss: #9cc07e;
    --sage: #56654d;
    --bark: #d8b193;
    --amber: #e0a345;
    --paper: #111510;
    --paper-2: #182017;
    --paper-3: #2b3529;
    --surface: #172016;
    --ink: #ebe6da;
    --ink-soft: #aaa393;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .5);
    --appbar: #0c110b;
    --forest-tint: rgba(140, 197, 154, .14);
    --amber-ink: #eab865;
    --bad: #e0715f;
    --bad-ink: #f2a597;
    --exam-ink: #b3b3ec;
}

html, body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--forest); }
a:hover { color: var(--forest-deep); }

.main-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content > :not(.site-footer) { flex-shrink: 0; }

.page {
    max-width: var(--max);
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* --- app bar ------------------------------------------------------- */
.app-bar {
    background: var(--appbar) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--on-dark);
    text-decoration: none;
}

.brand-mark { display: inline-flex; color: #cfe0c3; }

.brand-name {
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 500;
    letter-spacing: .01em;
}

/* --- hero ---------------------------------------------------------- */
.hero {
    background:
        radial-gradient(900px 400px at 15% -10%, rgba(107, 143, 78, .28), transparent 60%),
        radial-gradient(700px 360px at 90% 0%, rgba(201, 138, 43, .18), transparent 60%),
        linear-gradient(180deg, var(--paper-2), var(--paper));
    border-bottom: 1px solid var(--paper-3);
}

.hero-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 56px 20px 44px;
}

.hero-kicker {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .78rem;
    font-weight: 600;
    color: var(--moss);
}

.hero-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 1.05;
    margin: 0 0 14px;
    color: var(--forest-deep);
    max-width: 16ch;
}

.hero-lead {
    font-size: 1.15rem;
    max-width: 58ch;
    color: var(--ink-soft);
    margin: 0 0 26px;
}

.hero-search { max-width: 640px; }

.search-box .mud-input-outlined {
    background: var(--surface);
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}

/* --- app bar navigation -------------------------------------------- */
.app-nav { display: flex; gap: 4px; margin-right: 4px; }

.app-nav-link {
    color: var(--on-dark);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
}

.app-nav-link:hover { color: var(--on-dark); background: rgba(255, 255, 255, .08); }

/* --- catalogue ------------------------------------------------------ */
.catalog {
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px 20px 56px;
    width: 100%;
    box-sizing: border-box;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.catalog-filters {
    position: sticky;
    top: 80px;
    background: var(--surface);
    border: 1px solid var(--paper-3);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.filter-label {
    display: block;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.filter-hint { color: var(--ink-soft); font-size: .8rem; margin: 6px 0 0; }

.facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.facet-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--paper-3);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
    text-align: left;
    transition: background-color .12s, border-color .12s;
}

.facet-chip:hover { border-color: var(--moss); }

.facet-chip.active {
    background: var(--forest-tint);
    border-color: var(--forest);
    color: var(--forest-deep);
    font-weight: 600;
}

.facet-chips.static .facet-chip { cursor: default; min-height: 0; }

.facet-count { color: var(--ink-soft); font-size: .8rem; font-weight: 400; }

.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.catalog-count { margin: 0; color: var(--ink-soft); }
.catalog-count strong { color: var(--ink); }

.filters-toggle, .filters-close { display: none !important; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.show-more { display: flex; justify-content: center; margin-top: 24px; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 16px;
    text-align: center;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px dashed var(--paper-3);
    border-radius: var(--radius);
}

/* --- arborist card -------------------------------------------------- */
.arborist-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--paper-3);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.arborist-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.arborist-card-name {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    color: var(--forest-deep);
    overflow-wrap: anywhere;
}

.arborist-card-name:hover { text-decoration: underline; }

.kind-badge {
    flex-shrink: 0;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--paper-2);
    border-radius: 999px;
    padding: 3px 9px;
}

.arborist-card-place, .arborist-card-regions {
    margin: 0;
    color: var(--ink-soft);
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.arborist-card-actions {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: center;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    text-decoration: none;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.card-rating { display: inline-flex; align-items: center; gap: 4px; color: var(--amber-ink); font-size: .9rem; }

/* --- certificate chips ---------------------------------------------- */
.cert-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.cert-chip {
    font-size: .8rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--forest-deep);
    background: var(--forest-tint);
    border: 1px solid transparent;
}

.cert-chip.expired { color: var(--ink-soft); background: transparent; border-color: var(--paper-3); text-decoration: line-through; }
.cert-chip.more { color: var(--ink-soft); background: var(--paper-2); }

/* --- pages ------------------------------------------------------------ */
.page { width: 100%; box-sizing: border-box; }

.page-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.1;
    color: var(--forest-deep);
    margin: 6px 0 8px;
    overflow-wrap: anywhere;
}

.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; text-decoration: none; font-weight: 600; }

.detail-head { margin-bottom: 20px; }
.detail-place { margin: 0; color: var(--ink-soft); font-size: 1.1rem; }

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.detail-main, .detail-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--paper-3);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
}

.card-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.2rem;
    margin: 0 0 12px;
    color: var(--forest-deep);
}

.cert-list, .people-list, .offer-list, .sources ul { list-style: none; margin: 0; padding: 0; }

.cert-list li, .people-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--paper-3);
}

.cert-list li:last-child, .people-list li:last-child { border-bottom: 0; }
.cert-name { font-weight: 600; }
.cert-validity { color: var(--ink-soft); }
.cert-list li.expired .cert-name { color: var(--ink-soft); text-decoration: line-through; }
.person-name { font-weight: 600; }

.offer-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.detail-description { margin: 0; white-space: pre-line; }

.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.facts dt { color: var(--ink-soft); font-size: .9rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.sources li { padding: 4px 0; }
.sources-note { margin: 12px 0 0; font-size: .9rem; color: var(--ink-soft); }

.prose { max-width: 760px; }
.prose h2 { font-family: var(--serif); font-weight: 500; color: var(--forest-deep); margin-top: 28px; }
.prose li { margin-bottom: 6px; }
.muted { color: var(--ink-soft); }

/* --- footer ----------------------------------------------------------- */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--paper-3);
    background: var(--paper-2);
    font-size: .85rem;
    color: var(--ink-soft);
}

.site-footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
}

/* --- blazor error ui ---------------------------------------------------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #2a2620;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 960px) {
    .catalog-layout { grid-template-columns: minmax(0, 1fr); }
    .catalog-filters { position: static; display: none; }
    .catalog-filters.open { display: flex; }
    .filters-toggle, .filters-close { display: inline-flex !important; }
    .detail-layout { grid-template-columns: minmax(0, 1fr); }
    /* On a phone the contacts are what people came for. */
    .detail-side { order: -1; }
}

@media (max-width: 600px) {
    .hero-inner { padding: 32px 16px 24px; }
    .catalog, .page { padding-left: 16px; padding-right: 16px; }
    .card-grid { grid-template-columns: minmax(0, 1fr); }
    .brand-name { font-size: 1.2rem; }
    .app-nav-link { padding: 10px 8px; }
    .app-nav-link:last-child { display: none; }
    .site-footer-inner { padding: 16px; }
}
