/* EarthSort web chat (2.9). Used by the homepage hero and /ask. Phone first. */

.es-chat {
    --chat-radius: 18px;
    --chat-line: #e3dfd6;
    --chat-muted: #5f5f5f;
    --chat-bot: #ffffff;
    --chat-user: var(--color-primary-teal);
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    text-align: left;
    color: var(--color-charcoal);
}

.es-chat[hidden] { display: none; }

.es-chat-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.es-chat-log:empty { display: none; }

.es-msg,
.es-card { scroll-margin-top: 86px; scroll-margin-bottom: 120px; }

.es-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.es-msg--user {
    align-self: flex-end;
    background: var(--chat-user);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.es-msg--user img {
    display: block;
    max-width: 160px;
    max-height: 160px;
    border-radius: 10px;
}

.es-msg--bot {
    align-self: flex-start;
    background: var(--chat-bot);
    border: 1px solid var(--chat-line);
    border-bottom-left-radius: 6px;
}

.es-msg--typing { color: var(--chat-muted); font-style: italic; }

.es-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.es-btn-option {
    border: 1px solid var(--color-primary-teal);
    background: #fff;
    color: var(--color-primary-teal);
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
}

.es-btn-option:hover,
.es-btn-option:focus-visible { background: var(--color-teal-light); }

.es-btn-option:disabled { opacity: 0.5; cursor: default; }

.es-choice {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 12px;
}

.es-choice small {
    display: block;
    color: var(--chat-muted);
    font-weight: 400;
    margin-top: 2px;
}

/* Answer card */
.es-card {
    overflow-wrap: anywhere;
    align-self: stretch;
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--chat-line);
    border-radius: var(--chat-radius);
    overflow: hidden;
}

.es-card-top { padding: 14px 16px 10px; }

.es-city-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: var(--color-charcoal);
}

.es-city-line strong {
    color: var(--color-teal-dark, #234e52);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.es-city-pin { font-size: 1.15rem; }

.es-city-change {
    border: 0;
    background: none;
    padding: 2px 4px;
    font: inherit;
    font-size: 0.85rem;
    color: var(--color-primary-teal);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.es-msg--bot .es-city-line { margin: 0 0 6px; }

.es-card-bin {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-primary-teal);
}

.es-card-bin[data-bin="compost"] { color: #2f855a; }
.es-card-bin[data-bin="trash"],
.es-card-bin[data-bin="landfill"] { color: #4a5568; }
.es-card-bin[data-bin="hazard"],
.es-card-bin[data-bin="hazardous"] { color: #c53030; }
.es-card-bin[data-bin="special"] { color: #b7791f; }

.es-card-item {
    margin: 6px 0 0;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.es-card-desc { margin: 4px 0 0; color: var(--chat-muted); font-size: 0.95rem; }
.es-card-caption { margin: 4px 0 0; color: var(--chat-muted); font-size: 0.95rem; font-style: italic; }

.es-card-section {
    margin: 0 16px;
    padding: 10px 0;
    border-top: 1px solid var(--chat-line);
}

.es-card-section h3 {
    margin: 0 0 4px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #767676;
}

.es-card-notes { white-space: pre-wrap; margin: 0; }
.es-card-notes a,
.es-card-source a { color: var(--color-primary-teal); }

.es-card-note {
    margin: 0 16px 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fdf6e7;
    color: #7a5310;
    font-size: 0.9rem;
}

.es-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px 12px;
    border-top: 1px solid var(--chat-line);
    font-size: 0.9rem;
    color: var(--chat-muted);
}

.es-thumbs { display: flex; gap: 6px; align-items: center; }

.es-thumb {
    border: 1px solid var(--chat-line);
    background: #fff;
    border-radius: 999px;
    width: 40px;
    height: 36px;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
}

.es-thumb[aria-pressed="true"] { border-color: var(--color-primary-teal); background: var(--color-teal-light); }
.es-thumb:disabled { cursor: default; }

.es-get-app {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--color-primary-teal);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.es-get-app:hover { filter: brightness(1.08); }

.es-app-pitch {
    flex: 1 1 180px;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--chat-muted);
}

/* Input */
.es-chat-form {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border-radius: 999px;
    padding: 6px 6px 6px 18px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
    border: 1px solid var(--chat-line);
}

.es-chat-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    font: inherit;
    font-size: 1.05rem;
    padding: 10px 0;
    background: transparent;
    color: var(--color-charcoal);
}

.es-icon-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    background: transparent;
    color: var(--color-primary-teal);
}

.es-icon-btn:hover,
.es-icon-btn:focus-visible { background: var(--color-teal-light); }

.es-icon-btn--send { background: var(--color-primary-teal); color: #fff; }
.es-icon-btn--send:hover,
.es-icon-btn--send:focus-visible { background: var(--color-teal-dark); }
.es-icon-btn:disabled { opacity: 0.5; cursor: default; }

.es-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.es-chat-under {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-top: 10px;
    font-size: 0.92rem;
}

.es-link-btn {
    border: 0;
    background: none;
    padding: 4px 2px;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.es-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.es-tip {
    margin: 10px 0 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--chat-muted);
}

.es-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 18px;
    border: 2px solid var(--color-primary-teal);
    border-radius: 999px;
    background: #fff;
    color: var(--color-primary-teal);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.es-photo-btn:hover { background: var(--color-teal-light, #e6f2f2); }
.es-photo-btn:disabled { opacity: 0.6; cursor: default; }
.es-photo-btn svg { flex: none; }

.es-chat-tip {
    margin: 10px auto 0;
    max-width: 460px;
    font-size: 0.88rem;
    line-height: 1.4;
    text-align: center;
    color: var(--chat-muted);
}

.es-chat-tip[hidden] { display: none; }

.es-msg--alt { font-size: 0.92rem; }
.es-msg--alt .es-btn-option { min-height: 36px; padding: 6px 12px; }

.es-card-report { padding: 0 16px 10px; }
.es-report {
    font-size: 0.85rem;
    color: var(--color-primary-teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Homepage hero (adds to .hero-section in styles.css) */
.chat-hero { padding-left: 16px; padding-right: 16px; }

.chat-hero .chat-hero-live h1 {
    margin: 0 0 4px;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1.1;
}

.chat-hero .chat-hero-live .chat-hero-sub {
    margin: 0 0 22px;
    opacity: 0.95;
}

.chat-hero .es-chat-under,
.chat-hero .es-chat-under .es-link-btn,
.chat-hero .es-chat-tip { color: #fff; }

.chat-hero .es-chat-tip { opacity: 0.92; }

/* On the gradient the photo button is white with teal text, like the input. */
.chat-hero .es-photo-btn { border-color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); }

.chat-hero .es-chat-log { padding: 4px 2px; }

.chat-hero .store-badges-row { margin-top: 22px; }

/* Coverage line under the store badges. */
.hero-section .hero-coverage {
    position: relative;
    z-index: 1;
    margin: 20px auto 0;
    width: fit-content;
    max-width: min(36rem, 100%);
    box-sizing: border-box;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.98rem;
    line-height: 1.4;
    text-wrap: balance;
}

.hero-coverage strong { font-weight: 700; }

.hero-coverage-note { opacity: 0.85; }

.hero-coverage-change {
    border: 0;
    background: none;
    padding: 2px 0;
    font: inherit;
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.hero-coverage-check {
    display: inline-block;
    margin-right: 6px;
    font-weight: 700;
}

.chat-hero-fallback[hidden],
.chat-hero-live[hidden] { display: none; }

/* /ask: the homepage hero, full height. Chat sits on the gradient, badges below. */
.ask-hero {
    min-height: calc(100vh - 140px);
    min-height: calc(100dvh - 140px);
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.ask-hero h1 {
    margin: 24px 0 4px;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1.1;
}

.ask-hero .chat-hero-sub { margin: 0 0 22px; opacity: 0.95; }

.ask-fallback { margin: 8px 0 0; }
.ask-fallback a { color: #fff; font-weight: 600; }
.ask-fallback[hidden] { display: none; }

@media (max-width: 480px) {
    .es-chat-input { font-size: 1rem; }
    .es-chat-form { padding-left: 14px; }
    .es-msg { max-width: 92%; }
    .es-card-bin { font-size: 1.6rem; }
}

/* Coverage cards on either side of the chat (homepage and /ask). coverage.js fills the numbers. */
.hero-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "main main" "us ca";
    gap: 0 12px;
    max-width: 1180px;
    margin: 0 auto;
}

.hero-row-main { grid-area: main; min-width: 0; }
.hero-stat--us { grid-area: us; }
.hero-stat--ca { grid-area: ca; }

.hero-stat {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.22);
    text-align: left;
    color: #fff;
}

.hero-stat-place { font-size: 0.88rem; font-weight: 600; opacity: 0.95; }

.hero-stat-num {
    margin-top: 4px;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.hero-stat-sub { font-size: 0.86rem; line-height: 1.35; opacity: 0.92; }
.hero-stat-extra { margin-top: 6px; font-weight: 600; opacity: 1; }
.hero-stat-sub:empty { display: none; }

/* The visitor's-city pill stays hidden until chat.js has something to say. */
.hero-coverage:has(.hero-coverage-text:empty) { display: none; }

@media (min-width: 1080px) {
    .hero-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 600px) minmax(0, 1fr);
        grid-template-areas: "us main ca";
        gap: 0 40px;
        align-items: center;
    }

    .hero-stat { margin-top: 0; max-width: 230px; padding: 22px 22px 24px; }
    .hero-stat--us { justify-self: end; }
    .hero-stat--ca { justify-self: start; }
    .hero-stat-num { font-size: 3rem; }
    .hero-stat-sub { font-size: 0.92rem; }
}
