/**
 * drink-detail.css — Kits product-card detail
 *
 * Design system: Kits dark canvas
 *   --kits-bg: 11 11 11         near-black foundation
 *   --kits-surface: 21 19 17    subtle warm-graphite surface
 *   --kits-surface-2: 27 25 22
 *   --kits-surface-3: 33 30 27
 *   --kits-text: 245 243 239    soft white
 *   --kits-text-muted: 168 162 158
 *   --kits-text-quiet: 141 135 128
 *   --kits-coffee: 160 106 69   restrained roasted brown
 *   --kits-border: rgba(255,255,255,0.08)
 *
 * All dd-* class names are renderer-private; only the element IDs
 * (drink-detail-*) are public contract and MUST NOT be renamed.
 */

/* ── Modal shell (shell mechanics preserved) ─────────────────────────────── */

#drink-detail-modal {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease;
    contain: strict;
    isolation: isolate;
}

#drink-detail-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#drink-detail-modal.hidden {
    display: none;
}

#drink-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 11, 11, 0.92);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

#drink-detail-panel {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#drink-detail-mount {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    contain: layout style paint;
}

/* ── Loading / error state ──────────────────────────────────────────────── */

.dd-loading {
    padding: 3rem 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(141, 135, 128);
}

.dd-error {
    padding: 3rem 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(141, 135, 128);
}

/* ── Action bar (protected HTML in _OrderTrayDock) ────────────────────── */

.drink-detail-close,
#drink-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2.75rem;
    padding: 0 0.65rem;
    border: none;
    background: transparent;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: rgb(168, 162, 158);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.drink-detail-close:active,
#drink-detail-back:active {
    opacity: 0.7;
}

/* Top CTA button — updated styling to match Kits surface */
.drink-detail-add-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid rgba(160, 106, 69, 0.45);
    border-radius: 8px;
    background: rgb(160, 106, 69);
    color: rgb(245, 243, 239);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.drink-detail-add-top:active:not(:disabled) {
    opacity: 0.85;
    background: rgb(139, 94, 60);
}

.drink-detail-add-top--disabled,
.drink-detail-add-top:disabled {
    opacity: 0.4;
    pointer-events: none;
    background: rgb(33, 30, 27);
    border-color: rgba(255, 255, 255, 0.08);
}

.drink-detail-add-top__label {
    white-space: nowrap;
}

#drink-detail-modal:not(.is-open) .drink-detail-action-bar {
    display: none;
}

/* Action bar chrome — dark surface matching Kits canvas */
.drink-detail-action-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding:
        max(0.45rem, env(safe-area-inset-top, 0px))
        max(1rem, env(safe-area-inset-right, 0px))
        0.55rem
        max(1rem, env(safe-area-inset-left, 0px));
    background:
        linear-gradient(
            180deg,
            rgba(21, 19, 17, 0.99) 0%,
            rgba(21, 19, 17, 0.95) 100%
        );
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
    z-index: 2;
}

.drink-detail-action-bar__back {
    flex-shrink: 0;
}

.drink-detail-action-bar__glyph {
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.6;
}

.drink-detail-action-bar__add {
    flex: 1 1 auto;
    max-width: 11rem;
    margin-left: auto;
}

.drink-detail-action-bar__add:disabled,
.drink-detail-action-bar__add.drink-detail-add-top--disabled {
    opacity: 0.38;
    box-shadow: none;
}

/* ── Product card article ────────────────────────────────────────────────── */

.dd-product-card {
    position: relative;
    min-height: 100%;
    background: rgb(11, 11, 11);
    color: rgb(245, 243, 239);
}

/* Panel open animation — fade + slide up, product-first feel */
#drink-detail-modal.is-open .dd-product-card {
    animation: kitsDetailOpen 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes kitsDetailOpen {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* ── Product image figure ────────────────────────────────────────────────── */

.dd-card__figure {
    margin: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(21, 19, 17);
    min-height: 13rem;
    overflow: hidden;
}

.dd-card__figure::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 80% 50% at 50% 100%,
        rgba(160, 106, 69, 0.06),
        transparent 70%
    );
    pointer-events: none;
}

.dd-card__img {
    max-width: 100%;
    max-height: min(44vh, 300px);
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    position: relative;
    z-index: 1;
}

/* No-image placeholder */
.dd-card__no-poster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    min-height: 13rem;
}

.dd-card__no-poster-glyph {
    font-size: 3rem;
    font-weight: 600;
    line-height: 1;
    color: rgb(141, 135, 128);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
}

.dd-card__no-poster-cat {
    font-size: 0.6rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgb(111, 106, 100);
}

/* ── Card body ──────────────────────────────────────────────────────────── */

.dd-card__body {
    --dd-tray-clearance: var(--tray-dock-clearance, max(5.75rem, calc(4.85rem + env(safe-area-inset-bottom, 0px))));
    padding: 1.25rem 1.1rem var(--dd-tray-clearance);
    scroll-padding-bottom: var(--dd-tray-clearance);
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Meta: category + name + chips + subtitle ────────────────────────────── */

.dd-card__meta {
    margin-bottom: 1.1rem;
}

.dd-card__category {
    margin: 0 0 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgb(160, 106, 69); /* kits-coffee accent */
}

.dd-card__name {
    margin: 0 0 0.65rem;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(1.7rem, 7vw, 2.2rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: rgb(245, 243, 239);
}

/* Suggestion chips — quiet, restrained */
.dd-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.dd-card__chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: 0.12rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(33, 30, 27, 0.6);
    font-size: 0.7rem;
    color: rgb(141, 135, 128);
    letter-spacing: 0.02em;
}

.dd-card__subtitle {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgb(168, 162, 158);
}

/* ── Description block ──────────────────────────────────────────────────── */

.dd-card__desc-block {
    margin: 0.85rem 0;
    padding: 0.85rem 0.9rem;
    border-left: 2px solid rgba(160, 106, 69, 0.45);
    background: rgba(21, 19, 17, 0.55);
    border-radius: 0 4px 4px 0;
}

.dd-card__desc-label {
    margin: 0 0 0.35rem;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgb(111, 106, 100);
}

.dd-card__desc-body {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgb(168, 162, 158);
}

/* ── Temperature selector ───────────────────────────────────────────────── */

.dd-card__temp-row {
    display: flex;
    gap: 0.5rem;
    margin: 0.85rem 0;
}

.dd-card__temp-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(27, 25, 22, 0.8);
    color: rgb(141, 135, 128);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

.dd-card__temp-btn--active {
    border-color: rgba(160, 106, 69, 0.7);
    background: rgba(160, 106, 69, 0.15);
    color: rgb(245, 243, 239);
}

.dd-card__temp-btn:active:not(.dd-card__temp-btn--active) {
    background: rgba(33, 30, 27, 1);
}

@media (hover: hover) and (pointer: fine) {
    .dd-card__temp-btn:hover:not(.dd-card__temp-btn--active) {
        border-color: rgba(255, 255, 255, 0.2);
        background: rgba(33, 30, 27, 1);
    }
}

/* ── Service note ───────────────────────────────────────────────────────── */

.dd-card__service-note {
    margin: 0.6rem 0 0;
    padding: 0.6rem 0.75rem;
    border-left: 2px solid rgba(160, 106, 69, 0.35);
    font-size: 0.8rem;
    color: rgb(141, 135, 128);
}

/* ── Footer: price + CTA ────────────────────────────────────────────────── */

.dd-card__footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.dd-card__price {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgb(245, 243, 239);
    flex-shrink: 0;
}

/* ── Promotion strike-through ──────────────────────────────────────────────── */

/* Price block: flex column so strike-through sits above the effective price. */
.dd-card__price-block {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
}

/* Original price — struck through and muted when the promotion is ON.
   aria-label keeps the content accessible when CSS text-decoration is
   suppressed (e.g. reader mode, high-contrast). */
.dd-card__price-strike {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: rgba(200, 180, 155, 0.65);
    text-decoration: line-through;
    text-decoration-color: rgba(200, 180, 155, 0.55);
    line-height: 1.2;
    order: -1; /* puts original above effective in flex column */
}

.dd-card__cta {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid rgba(160, 106, 69, 0.55);
    border-radius: 8px;
    background: rgb(160, 106, 69);
    color: rgb(245, 243, 239);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.dd-card__cta:active:not(:disabled) {
    opacity: 0.85;
    background: rgb(139, 94, 60);
}

.dd-card__cta--disabled,
.dd-card__cta:disabled {
    opacity: 0.38;
    pointer-events: none;
    background: rgb(33, 30, 27);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ── Pairing strip ──────────────────────────────────────────────────────── */

.dd-card__pairings {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dd-card__pairings-lead {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    font-style: italic;
    color: rgb(141, 135, 128);
}

.dd-card__pairings-strip {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    scroll-snap-type: x proximity;
}

.dd-card__pairing {
    position: relative;
    flex: 0 0 auto;
    width: 7.25rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(27, 25, 22, 0.8);
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
    -webkit-tap-highlight-color: transparent;
    transition:
        border-color 0.22s ease,
        background-color 0.22s ease,
        transform 0.22s ease;
}

@media (hover: hover) and (pointer: fine) {
    .dd-card__pairing:hover {
        transform: translate3d(0, -2px, 0);
        border-color: rgba(160, 106, 69, 0.45);
        background: rgba(33, 30, 27, 0.9);
    }

    .dd-card__pairing:active {
        transform: none;
    }
}

.dd-card__pairing-img,
.dd-card__pairing-ph {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(33, 30, 27, 0.6);
}

.dd-card__pairing-ph {
    display: block;
}

.dd-card__pairing-name {
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.3;
    color: rgb(245, 243, 239);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dd-card__pairing-hint {
    font-size: 0.5rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgb(111, 106, 100);
}

/* ── Pairing added state ────────────────────────────────────────────────── */

.dd-card__pairing--added {
    border-color: rgba(160, 106, 69, 0.55);
    background: rgba(160, 106, 69, 0.08);
}

.dd-card__pairing--added .dd-card__pairing-hint {
    color: rgb(160, 106, 69);
}

/* ── Order tray visibility dimming during detail ─────────────────────────── */

body.drink-detail-open .order-tray-root--dock:not(.order-tray-root--sheet-open) #order-tray-chip {
    opacity: 0.68 !important;
}

body.drink-detail-open .order-tray-chip__kicker {
    display: none;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */

html.annap-guest-no-motion #drink-detail-modal.is-open .dd-product-card,
html.annap-guest-no-motion .drink-detail-add-top:active:not(:disabled) {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

html.annap-guest-no-motion #drink-detail-modal.is-open .dd-card__temp-btn {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    #drink-detail-modal {
        transition: none;
    }

    .drink-detail-add-top:active:not(:disabled) {
        transform: none;
    }

    .dd-card__temp-btn {
        transition: none;
    }

    .dd-card__pairing {
        transition: none;
    }

    .dd-card__pairing:active {
        transform: none;
    }
}

/* ── Touch device optimisations ─────────────────────────────────────────── */

@media (hover: none) and (pointer: coarse) {
    #drink-detail-modal {
        transition: none;
    }

    #drink-detail-modal,
    #drink-detail-mount,
    .dd-product-card,
    .dd-card__img {
        will-change: auto !important;
    }

    .dd-card__pairing:active {
        transform: none;
    }

    .drink-detail-add-top:active:not(:disabled) {
        transform: none;
    }
}

/* ── Desktop refinement ─────────────────────────────────────────────────── */

@media (min-width: 640px) {
    .drink-detail-action-bar {
        padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
        padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
    }

    .drink-detail-action-bar__add {
        max-width: 13rem;
    }

    .dd-card__body {
        max-width: 36rem;
        margin: 0 auto;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .dd-card__figure {
        min-height: 15rem;
    }

    .dd-card__figure::before {
        background: radial-gradient(
            ellipse 60% 40% at 50% 100%,
            rgba(160, 106, 69, 0.08),
            transparent 70%
        );
    }
}

@media (min-width: 480px) {
    .dd-card__footer {
        gap: 1rem;
    }

    .dd-card__cta {
        max-width: 14rem;
    }
}
