/* Chip, the HDS board helper: floating button, nudge, chat panel, answer cards, mascot moods. */

.hds-chip { --chip-b: calc(16px + env(safe-area-inset-bottom)); position: fixed; right: 16px; bottom: var(--chip-b); z-index: 65; font-family: var(--f-body); }
.hds-chip [hidden] { display: none !important; }
/* the cutting list's phone bar sits along the bottom: Chip floats above it; the WhatsApp button stacks above Chip */
@media (max-width: 1179px) { .hds-t-cutting-list .hds-chip { --chip-b: calc(76px + env(safe-area-inset-bottom)); } }
@media (max-width: 1099px) { .hds-wa-fab { bottom: calc(132px + env(safe-area-inset-bottom)); } }
html.hds-k3-lock .hds-chip { display: none; }
/* desktop home: while the hero's docked picker is on screen, the button floats just above it */
@media (min-width: 1100px) { html.hds-kh-inview .hds-chip__fab { position: fixed; right: 16px; bottom: max(var(--chip-b), var(--kh-lift, 0px)); } }

/* ---------- the button: Chip himself, floating, with a thought bubble ---------- */
.hds-chip__fab { position: relative; display: block; width: 74px; height: 74px; padding: 0; border: 0; background: none; color: var(--i0); cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* soft shadow on the "floor" under him; it shrinks as he bobs up */
.hds-chip__fab::before { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 9px; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 22, 21, .38), rgba(20, 22, 21, 0)); animation: hds-chip-shadow 3.2s ease-in-out infinite; }
.hds-chip__fabm { position: absolute; left: 2px; top: -2px; width: 70px; height: 70px; filter: drop-shadow(0 6px 8px rgba(20, 22, 21, .28)); animation: hds-chip-bob 3.2s ease-in-out infinite; transition: filter .3s; }
@keyframes hds-chip-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes hds-chip-shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.78); opacity: .65; } }
.hds-chip__fab:focus-visible { outline: none; }
.hds-chip__fab:focus-visible .hds-chip__fabm { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 3px var(--red)) drop-shadow(0 0 2px var(--red)); }
.hds-chip__fab:active .hds-chip__fabm { animation-play-state: paused; }

/* thought bubble: a rounded cloud with two little puffs trailing down to his head */
.hds-chip__fabt { position: absolute; right: 78px; bottom: 88px; padding: .5rem .9rem; background: #fff; border: 1px solid var(--ln); border-radius: 999px; box-shadow: 0 10px 24px -14px rgba(20, 22, 21, .55); font: 650 .92rem/1 var(--f-body); white-space: nowrap; color: var(--i0); transform-origin: 85% 120%; animation: hds-chip-think 3.2s ease-in-out infinite; transition: opacity .25s, transform .25s; }
.hds-chip__fabt::before, .hds-chip__fabt::after { content: ""; position: absolute; background: #fff; border: 1px solid var(--ln); border-radius: 50%; }
.hds-chip__fabt::before { width: 11px; height: 11px; right: 2px; bottom: -13px; }
.hds-chip__fabt::after { width: 6px; height: 6px; right: -8px; bottom: -23px; }
@keyframes hds-chip-think { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@media (hover: hover) {
	.hds-chip__fab:hover .hds-chip__fabt { background: var(--h0); color: var(--g0); border-color: var(--h0); }
	.hds-chip__fab:hover .hds-chip__fabt::before, .hds-chip__fab:hover .hds-chip__fabt::after { background: var(--h0); border-color: var(--h0); }
	.hds-chip__fab:hover .hds-chip-m__eyes { opacity: 0; }
	.hds-chip__fab:hover .hds-chip-m__happy { opacity: 1; }
}
/* while a nudge or the panel is showing, the little bubble steps back */
.hds-chip.is-open .hds-chip__fabt, .hds-chip.is-nudging .hds-chip__fabt { opacity: 0; transform: scale(.8); pointer-events: none; }
@media (max-width: 699px) {
	.hds-chip__fab { width: 64px; height: 64px; }
	.hds-chip__fabm { width: 60px; height: 60px; }
	.hds-chip__fabt { right: 68px; bottom: 78px; padding: .42rem .75rem; font-size: .85rem; }
	.hds-chip.is-open .hds-chip__fab { display: none; }
}

/* ---------- nudge bubble ---------- */
.hds-chip__nudge { position: absolute; right: 30px; bottom: calc(100% + 4px); width: max-content; max-width: min(270px, calc(100vw - 40px)); margin: 0; padding: .7rem 2rem .75rem .85rem; background: #fff; color: var(--i0); border: 1px solid var(--ln); border-radius: var(--r); font-size: .9rem; line-height: 1.35; box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .5); cursor: pointer; animation: hds-chip-pop .45s var(--ease-out); }
.hds-chip__nudge::after { content: ""; position: absolute; right: 26px; bottom: -7px; width: 12px; height: 12px; background: #fff; border-right: 1px solid var(--ln); border-bottom: 1px solid var(--ln); transform: rotate(45deg); }
.hds-chip__nudge-x { position: absolute; top: .2rem; right: .2rem; width: 28px; height: 28px; border: 0; background: none; color: var(--i2); font-size: 1.1rem; cursor: pointer; }
@keyframes hds-chip-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- panel ---------- */
.hds-chip__p { position: fixed; right: 16px; bottom: calc(var(--chip-b) + 86px); z-index: 66; display: flex; flex-direction: column; width: 410px; height: min(680px, calc(100dvh - var(--chip-b) - 100px)); background: var(--g0); border: 1px solid var(--ln); border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 40px 80px -30px rgba(20, 22, 21, .55), 0 2px 0 rgba(0, 0, 0, .03); transform-origin: bottom right; animation: hds-chip-open .3s var(--ease-out); }
@keyframes hds-chip-open { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@media (max-width: 699px) {
	.hds-chip__p { inset: 0; width: auto; height: 100dvh; border: 0; border-radius: 0; animation-name: hds-chip-sheet; }
	@keyframes hds-chip-sheet { from { transform: translateY(24px); opacity: 0; } }
}
html.hds-chip-lock, html.hds-chip-lock body { overflow: hidden; }

.hds-chip__h { position: relative; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .65rem; padding: .7rem .6rem .75rem .85rem; padding-top: calc(.7rem + env(safe-area-inset-top)); background: var(--h0); color: var(--g0); }
.hds-chip__h::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--z-wall) 0 25%, var(--z-base) 25% 50%, var(--z-tall) 50% 75%, var(--red) 75%); }
.hds-chip__hm { width: 46px; height: 46px; }
.hds-chip__t { margin: 0; font: 650 1.2rem/1.05 var(--f-display); letter-spacing: -.01em; }
.hds-chip__s { margin: .15rem 0 0; font-size: .8rem; color: var(--on-h-2); }
.hds-chip__ib { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--g0); cursor: pointer; }
.hds-chip__ib svg, .hds-chip__ib .hds-ic { width: 20px; height: 20px; }
@media (hover: hover) { .hds-chip__ib:hover { background: rgba(255, 255, 255, .1); } }
.hds-chip__ib:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

.hds-chip__log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem .9rem 1.25rem; display: flex; flex-direction: column; gap: .8rem; scroll-padding: 12px; }
.hds-chip__log:focus { outline: none; }
.hds-chip__m { max-width: 100%; animation: hds-chip-in .35s var(--ease-out); }
@keyframes hds-chip-in { from { opacity: 0; transform: translateY(6px); } }
.hds-chip__m--me { align-self: flex-end; max-width: 85%; padding: .6rem .8rem; background: var(--h0); color: var(--g0); border-radius: var(--r) var(--r) 2px var(--r); font-size: .93rem; line-height: 1.4; overflow-wrap: anywhere; }
.hds-chip__m--bot { align-self: stretch; display: grid; gap: .55rem; }
.hds-chip__b { justify-self: start; max-width: 94%; padding: .65rem .85rem; background: #fff; border: 1px solid var(--ln); border-radius: var(--r) var(--r) var(--r) 2px; font-size: .93rem; line-height: 1.5; color: var(--i0); overflow-wrap: anywhere; }
.hds-chip__b a { color: inherit; text-decoration-color: var(--red); }
.hds-chip__b strong { font-weight: 650; }

/* typing */
.hds-chip__typing .hds-chip__b { display: inline-flex; gap: 5px; padding: .8rem .9rem; }
.hds-chip__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--i2); animation: hds-chip-dot 1s infinite ease-in-out; }
.hds-chip__typing i:nth-child(2) { animation-delay: .15s; } .hds-chip__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hds-chip-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* quick replies */
.hds-chip__acts { display: flex; flex-wrap: wrap; gap: .4rem; }
.hds-chip__a { min-height: 36px; padding: .35rem .8rem; border: 1px solid var(--ln-2); border-radius: 999px; background: transparent; color: var(--i0); font: 600 .84rem/1.2 var(--f-body); text-align: left; cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.hds-chip__a--wa::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: .45rem; border-radius: 50%; background: #25a35a; vertical-align: 1px; }
@media (hover: hover) { .hds-chip__a:hover { background: var(--h0); border-color: var(--h0); color: var(--g0); } }
.hds-chip__a:focus-visible, .hds-chip__cb:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- cards ---------- */
.hds-chip__row { display: grid; grid-auto-flow: column; grid-auto-columns: 196px; gap: .55rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; margin: 0 -.9rem; padding: .1rem .9rem .35rem; overscroll-behavior-x: contain; }
.hds-chip__row.is-one { grid-auto-columns: minmax(0, 260px); }
.hds-chip__c { scroll-snap-align: start; display: flex; flex-direction: column; min-width: 0; background: #fff; border: 1px solid var(--ln); border-radius: var(--r); overflow: hidden; }
.hds-chip__sw { display: block; background: var(--g2); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.hds-chip__c--board .hds-chip__sw { height: 76px; border-bottom: 3px solid var(--h0); }
.hds-chip__c--product img, .hds-chip__c--product .hds-chip__sw { display: block; width: 100%; height: 108px; object-fit: contain; background: #fff; padding: .4rem; border-bottom: 1px solid var(--ln); }
.hds-chip__ci { display: grid; gap: .1rem; padding: .55rem .65rem .4rem; }
.hds-chip__ci strong { font: 600 .92rem/1.2 var(--f-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hds-chip__ci span { font-size: .76rem; color: var(--i2); }
.hds-chip__ci em { font-style: normal; color: var(--red-ink); font-weight: 600; }
.hds-chip__ci b { margin-top: .15rem; font: 650 .95rem var(--f-body); font-variant-numeric: tabular-nums; }
.hds-chip__ci b small { font-weight: 500; color: var(--i2); font-size: .75rem; }
.hds-chip__cbs { display: flex; flex-wrap: wrap; gap: .3rem; padding: .25rem .65rem .65rem; margin-top: auto; }
.hds-chip__cb { min-height: 34px; padding: 0 .65rem; border: 1px solid var(--ln-2); border-radius: var(--r); background: #fff; color: var(--i0); font: 600 .8rem/1 var(--f-body); cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.hds-chip__cb.is-main { background: var(--h0); border-color: var(--h0); color: var(--g0); }
.hds-chip__c--product .hds-chip__cb.is-main { background: var(--red-btn); border-color: var(--red-btn); color: #fff; }
.hds-chip__cb:disabled { opacity: .75; cursor: default; }
@media (hover: hover) { .hds-chip__cb:not(.is-main):hover { border-color: var(--i0); } .hds-chip__cb.is-main:hover { filter: brightness(1.15); } }

.hds-chip__c--branch { padding: .7rem .75rem 0; }
.hds-chip__c--branch header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.hds-chip__c--branch header strong { font: 650 1rem/1.2 var(--f-display); }
.hds-chip__c--branch header span { font-size: .8rem; font-weight: 600; color: var(--i1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hds-chip__c--branch p { margin: .2rem 0 .45rem; font-size: .82rem; color: var(--i1); line-height: 1.4; }
.hds-chip__c--branch table { width: 100%; border-collapse: collapse; font-size: .78rem; margin-bottom: .4rem; }
.hds-chip__c--branch th { text-align: left; font-weight: 500; color: var(--i2); padding: .12rem .5rem .12rem 0; white-space: nowrap; vertical-align: top; }
.hds-chip__c--branch td { padding: .12rem 0; font-variant-numeric: tabular-nums; }
.hds-chip__c--branch td small { display: block; color: var(--i2); }
.hds-chip__c--branch .hds-chip__cbs { padding: .3rem 0 .75rem; }

.hds-chip__c--est { padding: .7rem .75rem .75rem; gap: .55rem; }
.hds-chip__c--est table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.hds-chip__c--est td { padding: .15rem .4rem .15rem 0; border-bottom: 1px solid var(--g1); }
.hds-chip__c--est td:first-child { color: var(--i2); white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.hds-chip__c--est td.hds-mm { text-align: right; white-space: nowrap; padding-right: 0; }
.hds-chip__estout { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; font-size: .82rem; color: var(--i1); }
.hds-chip__estout > span { min-width: 0; }
.hds-chip__estbig { grid-column: 1 / -1; font: 600 1.05rem var(--f-display); color: var(--i0); }
.hds-chip__estbig strong { font-size: 1.9rem; line-height: 1; margin-right: .1rem; font-variant-numeric: tabular-nums; }
.hds-chip__estl { grid-column: 1 / -1; color: var(--i2); }
.hds-chip__warn { grid-column: 1 / -1; color: var(--red-ink); font-weight: 600; }
.hds-chip__sheet { grid-column: 1 / -1; width: 100%; height: auto; margin-top: .4rem; border-radius: 2px; }
.hds-chip__estb { display: flex; align-items: center; gap: .45rem; margin: 0; font-size: .8rem; color: var(--i1); }
.hds-chip__sw--sm { width: 20px; height: 20px; border-radius: 2px; flex: none; }

/* ---------- input ---------- */
.hds-chip__f { display: flex; gap: .45rem; padding: .65rem .75rem; background: #fff; border-top: 1px solid var(--ln); }
.hds-chip__in { flex: 1; min-width: 0; height: 46px; padding: 0 .85rem; border: 1px solid var(--ln-2); border-radius: var(--r); background: var(--g0); font: 400 1rem/1 var(--f-body); color: var(--i0); }
.hds-chip__in:focus { outline: none; border-color: var(--i0); background: #fff; box-shadow: 0 0 0 3px rgba(28, 30, 29, .12); }
.hds-chip__go { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: var(--r); background: var(--red-btn); color: #fff; cursor: pointer; }
.hds-chip__go .hds-ic { width: 20px; height: 20px; }
.hds-chip__go:focus-visible { outline: 2px solid var(--i0); outline-offset: 2px; }
.hds-chip__fine { margin: 0; padding: 0 .85rem calc(.6rem + env(safe-area-inset-bottom)); background: #fff; font-size: .72rem; color: var(--i2); }

/* ---------- the mascot ---------- */
.hds-chip-m { display: block; overflow: visible; }
.hds-chip-m__eye { transform-box: fill-box; transform-origin: center; transition: transform .12s ease; }
.hds-chip-m__eyes { transition: transform .3s var(--ease-out); }
.hds-chip-m__happy { opacity: 0; transition: opacity .2s; }
.hds-chip-m__kerf { opacity: 0; }
.hds-chip.is-blink .hds-chip-m__eye { transform: scaleY(.12); }
.hds-chip[data-mood="happy"] .hds-chip-m__eyes { opacity: 0; }
.hds-chip[data-mood="happy"] .hds-chip-m__happy { opacity: 1; }
.hds-chip[data-mood="think"] .hds-chip-m__eyes { animation: hds-chip-look 1.2s ease-in-out infinite; }
.hds-chip[data-mood="think"] .hds-chip-m__kerf { opacity: 1; animation: hds-chip-kerf .9s linear infinite; }
@keyframes hds-chip-look { 0%, 100% { transform: translateX(-2.5px); } 50% { transform: translateX(2.5px); } }
@keyframes hds-chip-kerf { from { transform: translateX(0); } to { transform: translateX(124px); } }

@media (prefers-reduced-motion: reduce) {
	.hds-chip__p, .hds-chip__m, .hds-chip__nudge, .hds-chip__fabm, .hds-chip__fab::before, .hds-chip__fabt { animation: none; }
	.hds-chip[data-mood="think"] .hds-chip-m__eyes, .hds-chip[data-mood="think"] .hds-chip-m__kerf, .hds-chip__typing i { animation: none; }
}
@media print { .hds-chip { display: none; } }
