/*
 * Shared mechanics for the three Taisho design previews: reset, icons, product dialog,
 * quote-list drawer, toast. Everything visual is driven by the custom properties each
 * option sets on :root, so the three skins stay independent.
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.has-drawer { overflow: hidden; }
body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .4; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.wrap { width: min(100% - 32px, var(--wrap, 1240px)); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* preview switcher — not part of the design itself */
.preview-bar { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; justify-content: space-between; padding: 6px 16px; background: #0b0d12; color: #c9cfdb; font: 500 12px/1.4 system-ui, sans-serif; }
.preview-bar nav { display: flex; gap: 4px; align-items: center; }
.preview-bar a { padding: 3px 9px; border-radius: 99px; color: #c9cfdb; }
.preview-bar a:hover { background: #222838; color: #fff; }
.preview-bar a[aria-current] { background: #fff; color: #0b0d12; font-weight: 700; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: var(--r-btn, 8px); font-family: var(--font-btn, var(--font-body)); font-weight: 700; font-size: 15px; letter-spacing: var(--btn-track, 0); text-transform: var(--btn-case, none); white-space: nowrap; transition: transform .15s, background .15s, color .15s, border-color .15s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover, var(--accent)); }
.btn--wa { background: var(--wa, #128c4a); color: #fff; }
.btn--wa:hover { background: #0e743d; }
.btn--ghost { border: 1.5px solid var(--line-strong, var(--line)); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.btn--block { width: 100%; }

/* chips + active filter tags */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-chip, 99px); border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap; transition: border-color .15s, background .15s, color .15s; }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip.is-on { background: var(--chip-on, var(--ink)); border-color: var(--chip-on, var(--ink)); color: var(--chip-on-ink, var(--bg)); }
.chip__n { font-size: 12px; font-weight: 600; opacity: .6; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-chip, 99px); background: var(--tag-bg, var(--line)); font-size: 13px; font-weight: 600; }
.tag .i { width: 13px; height: 13px; }
.tag--reset { background: none; text-decoration: underline; text-underline-offset: 3px; }

/* product dialog */
dialog[data-product] { width: min(100% - 24px, 980px); max-height: min(100dvh - 24px, 760px); padding: 0; border: 0; border-radius: var(--r-card, 12px); background: var(--surface); color: var(--ink); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog[data-product]::backdrop { background: rgba(8, 12, 24, .62); backdrop-filter: blur(3px); }
.pv-close { position: sticky; top: 12px; margin: 12px 12px -52px auto; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line); }
.pv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.pv__media { background: #fff; display: grid; place-items: center; padding: 24px; border-right: 1px solid var(--line); }
.pv__media img { width: 100%; max-height: 520px; object-fit: contain; }
.pv__info { padding: 34px 32px 30px; display: grid; gap: 16px; align-content: start; }
.pv__crumb { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pv__title { font-family: var(--font-head); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; font-weight: var(--head-weight, 700); text-wrap: balance; }
.pv__price { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 15px; }
.pv__price strong { font-family: var(--font-head); font-size: 20px; }
.pv__price span { display: inline-flex; align-items: center; gap: 5px; color: var(--ok, #12804a); font-weight: 700; font-size: 14px; }
.pv__desc { color: var(--muted); font-size: 15px; }
.pv__specs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.pv__specs div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pv__specs div:nth-child(odd) { padding-right: 14px; }
.pv__specs div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.pv__specs dt { color: var(--muted); }
.pv__specs dd { font-weight: 700; text-align: right; }
.pv__fit { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-card, 12px); background: var(--fit-bg, var(--bg)); border: 1px solid var(--line); font-size: 14px; }
.pv__fit .i { width: 22px; height: 22px; color: var(--fit-ink, var(--accent)); margin-top: 1px; }
.pv__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pv__actions .btn--primary { flex: 1 1 100%; }
.pv__actions .btn--wa { flex: 1 1 auto; }

/* quote-list drawer */
.drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; transition: visibility .3s; }
.drawer.is-open { visibility: visible; }
.drawer__shade { position: absolute; inset: 0; background: rgba(8, 12, 24, .55); opacity: 0; transition: opacity .3s; }
.drawer.is-open .drawer__shade { opacity: 1; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 440px); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: -20px 0 60px rgba(0, 0, 0, .25); }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-family: var(--font-head); font-size: 20px; font-weight: var(--head-weight, 700); text-transform: var(--head-case, none); letter-spacing: var(--head-track, 0); }
.drawer__head button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); }
.drawer__list { flex: 1; overflow: auto; padding: 4px 20px; }
.drawer__foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.drawer__note { font-size: 13px; color: var(--muted); }
.drawer__links { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.drawer__links a, .drawer__links button { text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.qi { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.qi img { width: 76px; height: 76px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: calc(var(--r-card, 12px) / 2); }
.qi__name { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.qi__ref { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.qi__row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.qi__del { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.qi__del:hover { color: #c62828; }
.qi--empty { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 12px; padding: 60px 10px; border: 0; color: var(--muted); font-size: 14.5px; }
.qi--empty .i { width: 40px; height: 40px; stroke-width: 1.4; }
.qi--empty strong { color: var(--ink); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--r-btn, 8px); }
.qty button { display: grid; place-items: center; width: 32px; height: 32px; }
.qty span { min-width: 28px; text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

/* toast */
.toast { position: fixed; left: 50%; bottom: var(--toast-bottom, 24px); z-index: 70; display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px; border-radius: 99px; background: #10131c; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform .25s, opacity .25s; white-space: nowrap; }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast .i { color: #4ade80; }
.toast button { padding: 5px 12px; border-radius: 99px; background: #fff; color: #10131c; font-weight: 700; font-size: 13px; }

@media (max-width: 760px) {
  .pv { grid-template-columns: 1fr; }
  .pv__media { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .pv__media img { max-height: 260px; }
  .pv__info { padding: 22px 18px 20px; }
  .pv__specs { grid-template-columns: 1fr; }
  .pv__specs div:nth-child(even) { padding-left: 0; border-left: 0; }
  .pv__specs div:nth-child(odd) { padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
