/**
 * Front-end styles.
 *
 * Deliberately theme-neutral: colours come from --phx-* custom properties that
 * default to the Fresh Start Crew palette but are overridden by the active
 * theme when it defines --fsc-* tokens.
 *
 * @package PHX_Handy
 */

:root {
    /* Three type roles: condensed caps for display (trade signage), the
       theme's own face for reading, and monospace for money and job numbers
       so figures line up and read like an estimate sheet. */
    --phx-display: 'Arial Narrow', 'Roboto Condensed', 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
    --phx-mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;

    --phx-green: var(--fsc-green, #1C4F46);
    --phx-orange: var(--fsc-orange, #D4581C);
    --phx-orange-dark: var(--fsc-orange-dark, #AE4514);
    --phx-sand: var(--fsc-sand, #C6A277);
    --phx-sand-light: var(--fsc-sand-light, #EBE0CC);
    --phx-cream: var(--fsc-cream, #FBF7EF);
    --phx-ink: var(--fsc-ink, #14312C);
    --phx-muted: #5a6b66;
    --phx-border: #d9d2c4;
    --phx-radius: 0.4rem;
}

/* ── Money and figures ──────────────────────────────────────── */

.phx-money,
.phx-qb__amount,
.phx-trust__value {
    font-family: var(--phx-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

/* ── Chips ──────────────────────────────────────────────────── */

.phx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.phx-chip {
    border: 1.5px solid var(--phx-border);
    background: #fff;
    color: var(--phx-ink);
    border-radius: 999px;
    padding: .5rem .9rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.phx-chip:hover { border-color: var(--phx-sand); }

.phx-chip[aria-pressed="true"] {
    border-color: var(--phx-green);
    background: var(--phx-green);
    color: #fff;
}

.phx-chip .phx-money { opacity: .75; font-size: .82em; margin-left: .25rem; }

/* ── Quote builder ──────────────────────────────────────────── */

.phx-qb {
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: 14px;
    box-shadow: 0 18px 40px -28px rgba(20, 49, 44, .55);
    overflow: hidden;
    max-width: 34rem;
}

.phx-qb__head {
    background: var(--phx-green);
    color: #fff;
    padding: 1rem 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.phx-qb__title {
    font-family: var(--phx-display);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .05em;
    font-size: 1.1rem;
}

.phx-qb__pips { display: flex; gap: .3rem; }

.phx-qb__pip {
    width: 26px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .28);
    transition: background-color .2s ease;
}

.phx-qb__pip[data-on] { background: var(--fsc-gold, #F2B231); }

.phx-qb__body { padding: 1.35rem; }

.phx-qb__step { display: none; }

.phx-qb__step[data-active] {
    display: block;
    animation: phx-rise .22s ease both;
}

@keyframes phx-rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.phx-qb__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

@media (max-width: 420px) { .phx-qb__grid { grid-template-columns: 1fr; } }

.phx-qb__estimate {
    border-top: 1px dashed var(--phx-border);
    margin-top: 1.15rem;
    padding-top: 1.05rem;
}

.phx-qb__line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .9rem;
    color: var(--phx-muted);
    padding-block: .18rem;
}

.phx-qb__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--phx-border);
}

.phx-qb__total b {
    font-family: var(--phx-display);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 1rem;
}

.phx-qb__amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--phx-green);
    line-height: 1;
}

.phx-qb__note {
    font-size: .8rem;
    color: var(--phx-muted);
    margin: .55rem 0 0;
}

.phx-qb__error {
    margin: .9rem 0 0;
    padding: .6rem .8rem;
    border-radius: var(--phx-radius);
    background: #fdecea;
    border-left: 4px solid #b32d2e;
    color: #7a1f20;
    font-size: .9rem;
}

.phx-qb__nav {
    display: flex;
    gap: .6rem;
    margin-top: 1.15rem;
}

.phx-qb__next { flex: 1; }

/* ── Service price menu ─────────────────────────────────────── */

.phx-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

.phx-menu__item {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, transform .15s ease;
}

.phx-menu__item:hover,
.phx-menu__item:focus {
    border-color: var(--phx-orange);
    transform: translateY(-2px);
    color: inherit;
}

.phx-menu__name {
    font-family: var(--phx-display);
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1.12rem;
    letter-spacing: .02em;
    color: var(--phx-green);
}

.phx-menu__desc {
    color: var(--phx-muted);
    font-size: .92rem;
    flex: 1;
}

.phx-menu__price {
    font-family: var(--phx-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--phx-green);
    font-size: 1.05rem;
}

.phx-menu__price span {
    font-family: inherit;
    font-weight: 500;
    color: var(--phx-muted);
    font-size: .8rem;
    display: block;
    letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
    .phx-menu__item:hover { transform: none; }
}

/* ── Trust bar ──────────────────────────────────────────────── */

/* Laid out from the actual cell count rather than auto-fit, which strands the
   last item alone in a half-empty row whenever the count and the available
   columns disagree. */
.phx-trust {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--phx-border);
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    overflow: hidden;
}

.phx-trust[data-cells="1"] { grid-template-columns: 1fr; }
.phx-trust[data-cells="3"] { grid-template-columns: repeat(3, 1fr); }

@media (min-width: 560px) {
    .phx-trust[data-cells="4"] { grid-template-columns: repeat(4, 1fr); }
}

/* An odd cell in a two-column layout takes the full width rather than
   leaving a gap beside it. */
.phx-trust[data-cells="3"] .phx-trust__item:last-child { grid-column: auto; }

@media (max-width: 559.98px) {
    .phx-trust[data-cells="3"] { grid-template-columns: repeat(2, 1fr); }
    .phx-trust[data-cells="3"] .phx-trust__item:last-child { grid-column: 1 / -1; }
}

.phx-trust__item {
    background: #fff;
    padding: .85rem 1rem;
}

.phx-trust__value {
    display: block;
    font-family: var(--phx-display);
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1.15;
    color: var(--phx-green);
}

.phx-trust__label {
    display: block;
    font-size: .74rem;
    color: var(--phx-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
}

.phx-stars {
    color: var(--fsc-gold, #F2B231);
    letter-spacing: -.04em;
    font-size: 1.15rem;
}

/* ── Reviews ────────────────────────────────────────────────── */

.phx-reviews {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1rem;
}

.phx-review {
    background: #fff;
    border: 1px solid var(--phx-border);
    border-left: 4px solid var(--fsc-gold, #F2B231);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
    margin: 0;
}

.phx-review blockquote {
    margin: .5rem 0 .9rem;
    font-size: 1rem;
    quotes: none;
}

.phx-review figcaption {
    font-size: .86rem;
    color: var(--phx-muted);
}

.phx-review figcaption b {
    color: var(--phx-ink);
    display: block;
    font-size: .94rem;
}

/* ── Notices ────────────────────────────────────────────────── */

.phx-notice {
    background: var(--phx-sand-light);
    border-left: 4px solid var(--phx-orange);
    border-radius: var(--phx-radius);
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    color: var(--phx-ink);
}

.phx-notice--success {
    border-left-color: var(--phx-green);
}

.phx-notice--action {
    margin: 0.5rem 0 0;
    padding: 0.6rem 0.8rem;
    font-size: 0.875rem;
}

/* ── Buttons ────────────────────────────────────────────────── */

.phx-button {
    display: inline-block;
    padding: 0.7rem 1.35rem;
    border: 2px solid var(--phx-green);
    border-radius: var(--phx-radius);
    background: var(--phx-green);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.3;
}

.phx-button:hover,
.phx-button:focus {
    filter: brightness(1.1);
    color: #fff;
}

.phx-button--primary {
    background: var(--phx-orange);
    border-color: var(--phx-orange);
}

.phx-button--primary:hover,
.phx-button--primary:focus {
    background: var(--phx-orange-dark);
    border-color: var(--phx-orange-dark);
}

.phx-button--ghost {
    background: transparent;
    color: var(--phx-green);
}

.phx-button--ghost:hover,
.phx-button--ghost:focus {
    background: var(--phx-sand-light);
    color: var(--phx-green);
}

/* ── Badges ─────────────────────────────────────────────────── */

.phx-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 0.2rem;
    background: var(--phx-sand-light);
    color: var(--phx-ink);
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

.phx-badge--direct { background: var(--phx-green); color: #fff; }
.phx-badge--specialist { background: var(--phx-orange); color: #fff; }
.phx-badge--marketplace { background: var(--phx-sand); color: var(--phx-ink); }
.phx-badge--emergency { background: #8c1d18; color: #fff; }

/* ── Form fields ────────────────────────────────────────────── */

.phx-field {
    margin: 0 0 1rem;
}

.phx-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.3rem;
    font-size: 0.9375rem;
}

.phx-field input[type="text"],
.phx-field input[type="tel"],
.phx-field input[type="email"],
.phx-field input[type="date"],
.phx-field input[type="time"],
.phx-field input[type="number"],
.phx-field input[type="search"],
.phx-field select,
.phx-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    background: #fff;
    font: inherit;
    color: inherit;
}

.phx-field input:focus,
.phx-field select:focus,
.phx-field textarea:focus {
    outline: 3px solid var(--fsc-gold, #F2B231);
    outline-offset: 1px;
}

.phx-field__hint {
    display: block;
    color: var(--phx-muted);
    font-size: 0.8125rem;
    margin-top: 0.3rem;
}

.phx-field abbr {
    color: var(--phx-orange);
    text-decoration: none;
}

.phx-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    margin-bottom: 0.4rem;
}

.phx-checkbox input {
    width: auto;
}

.phx-addon__price {
    margin-left: auto;
    font-weight: 700;
    color: var(--phx-green);
}

/* ── Intake ─────────────────────────────────────────────────── */

.phx-intake {
    background: var(--phx-cream);
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
    margin: 0 0 1.5rem;
}

.phx-intake__title {
    margin-top: 0;
    font-size: 1.125rem;
}

.phx-intake__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0 1rem;
}

.phx-intake__scheduling-note {
    margin-bottom: 1rem;
}

.phx-intake__more {
    border-top: 1px solid var(--phx-border);
    padding-top: .9rem;
    margin-top: .5rem;
}

.phx-intake__more > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--phx-green);
    padding-block: .25rem;
    list-style-position: outside;
}

.phx-intake__more > summary::marker {
    color: var(--phx-orange);
}

.phx-intake__more[open] > summary {
    margin-bottom: .9rem;
}

.phx-field--addons {
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 0.9rem 1rem;
    background: #fff;
}

.phx-field--addons legend {
    font-weight: 700;
    padding: 0 0.35rem;
}

.phx-zip-result {
    display: block;
    font-size: 0.8125rem;
    margin-top: 0.3rem;
    font-weight: 700;
}

.phx-zip-result.is-served { color: var(--phx-green); }
.phx-zip-result.is-outside { color: var(--phx-orange-dark); }

/* ── Photos ─────────────────────────────────────────────────── */

.phx-photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
}

.phx-photo {
    position: relative;
    width: 5rem;
}

.phx-photo img {
    width: 100%;
    height: 5rem;
    object-fit: cover;
    border-radius: var(--phx-radius);
    display: block;
}

.phx-photo.is-pending {
    font-size: 0.75rem;
    color: var(--phx-muted);
}

.phx-photo__remove {
    display: block;
    width: 100%;
    margin-top: 0.2rem;
    border: 0;
    background: none;
    color: var(--phx-orange-dark);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
}

/* ── Referral and quote blocks ──────────────────────────────── */

.phx-referral,
.phx-quote-request {
    background: var(--phx-cream);
    border: 1px solid var(--phx-border);
    border-left: 4px solid var(--phx-orange);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
}

.phx-referral__lead,
.phx-quote-request__lead {
    font-weight: 600;
    margin-top: 0;
}

.phx-referral__provider {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.75rem 0;
    border-block: 1px solid var(--phx-border);
    margin-bottom: 1rem;
}

.phx-price-note {
    font-weight: 700;
    color: var(--phx-green);
}

/* ── Lookup ─────────────────────────────────────────────────── */

.phx-lookup {
    background: var(--phx-green);
    color: #fff;
    border-radius: var(--phx-radius);
    padding: 1.75rem;
}

.phx-lookup__title { color: #fff; margin-top: 0; }
.phx-lookup__lead { color: rgba(255, 255, 255, 0.9); }
.phx-lookup__field { max-width: 18rem; margin-bottom: 0.5rem; }
.phx-lookup__note { color: var(--phx-sand); font-size: 0.875rem; margin: 0; }
.phx-lookup .phx-zip-result.is-served { color: var(--fsc-gold, #F2B231); }
.phx-lookup .phx-zip-result.is-outside { color: var(--phx-sand-light); }

/* ── Service grid ───────────────────────────────────────────── */

.phx-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.25rem;
}

.phx-service-card {
    display: block;
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
}

.phx-service-card:hover,
.phx-service-card:focus {
    border-color: var(--phx-orange);
}

.phx-service-card__title {
    margin: 0 0 0.4rem;
    font-size: 1.0625rem;
    color: var(--phx-green);
}

.phx-service-card__desc { color: var(--phx-muted); font-size: 0.9375rem; margin: 0 0 0.5rem; }
.phx-service-card__count { color: var(--phx-sand); font-size: 0.8125rem; font-weight: 700; }

/* ── Directory ──────────────────────────────────────────────── */

.phx-directory__filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.phx-directory__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1.25rem;
}

.phx-provider-card {
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
}

.phx-provider-card h3 { margin: 0.5rem 0 0.4rem; font-size: 1.0625rem; }
.phx-provider-card__summary { font-size: 0.9375rem; margin: 0 0 0.6rem; }
.phx-provider-card__areas,
.phx-provider-card__notes { font-size: 0.8125rem; color: var(--phx-muted); margin: 0 0 0.4rem; }
.phx-provider-card__phone { font-weight: 700; margin: 0; }

/* ── Worker dashboard ───────────────────────────────────────── */

.phx-worker__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.phx-stat {
    background: var(--phx-sand-light);
    border-radius: var(--phx-radius);
    padding: 1rem;
    text-align: center;
}

.phx-stat__value { display: block; font-size: 1.5rem; font-weight: 800; color: var(--phx-green); }
.phx-stat__label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--phx-muted); }

.phx-job-card {
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.phx-job-card__head h3 { margin: 0 0 0.2rem; font-size: 1.0625rem; }
.phx-job-card__ref { color: var(--phx-muted); font-size: 0.8125rem; margin: 0 0 0.75rem; }

.phx-job-card__facts {
    display: grid;
    grid-template-columns: minmax(7rem, auto) 1fr;
    gap: 0.3rem 1rem;
    margin: 0 0 1rem;
    font-size: 0.9375rem;
}

.phx-job-card__facts dt { font-weight: 700; color: var(--phx-muted); }
.phx-job-card__facts dd { margin: 0; }

.phx-job-card__actions textarea { width: 100%; margin-bottom: 0.75rem; }

.phx-job-card__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.phx-job-card__change {
    margin-top: 1rem;
    border-top: 1px solid var(--phx-border);
    padding-top: 0.75rem;
}

.phx-job-card__change summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--phx-orange-dark);
}

.phx-co-row {
    display: grid;
    grid-template-columns: 1fr 5rem 7rem;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.phx-co-row input {
    padding: 0.5rem;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    font: inherit;
}

.phx-job-history { list-style: none; padding: 0; margin: 0; }

.phx-job-history li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--phx-border);
    font-size: 0.9375rem;
}

.phx-job-history__pay { font-weight: 700; }
.phx-job-history__status { color: var(--phx-muted); }

/* ── Plans and change orders ────────────────────────────────── */

.phx-plan-card,
.phx-card {
    background: #fff;
    border: 1px solid var(--phx-border);
    border-radius: var(--phx-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.phx-plan-card header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.phx-plan-card header h3 { margin: 0; font-size: 1.0625rem; }

.phx-plan-card__facts {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: 0.3rem 1rem;
    margin: 1rem 0;
    font-size: 0.9375rem;
}

.phx-plan-card__facts dt { font-weight: 700; color: var(--phx-muted); }
.phx-plan-card__facts dd { margin: 0; }

.phx-plan-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.phx-plan-card__note,
.phx-card__note {
    color: var(--phx-muted);
    font-size: 0.8125rem;
    margin: 0.75rem 0 0;
}

.phx-standalone {
    max-width: 42rem;
    margin: 3rem auto;
    padding: 0 1rem;
}

.phx-card__title { margin-top: 0; }
.phx-card__meta { color: var(--phx-muted); font-size: 0.875rem; }

.phx-lines { width: 100%; border-collapse: collapse; margin: 1.25rem 0; }

.phx-lines th,
.phx-lines td {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--phx-border);
    text-align: left;
}

.phx-lines__amount { text-align: right; white-space: nowrap; }
.phx-lines__qty { display: block; color: var(--phx-muted); font-size: 0.8125rem; }
.phx-lines tfoot th { border-bottom: 0; font-size: 1.0625rem; }

.phx-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* ── Accessibility ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .phx-service-card,
    .phx-button {
        transition: none;
    }
}
