/* Jim Thompson Studio, in the brand's black-and-white timeline look. */
:root {
  /* Jim Thompson's own look (jimthompson.com): white ground, black ink, hairlines; the bottles and labels carry the colour */
  --ground: #ffffff;
  --ivory: #fafafa;
  --ink: #000000;
  --muted: #6b6b6b;
  --white: #ffffff;
  --line: rgba(0, 0, 0, .1);
  --line-strong: rgba(0, 0, 0, .3);
  --edge: #e4e4e4;
  --navy: #000000;
  --gold: #000000;
  --gold-ink: #000000;
  --focus: #1f5fbf;
  --glass: #ffffff;
  --glass-in: #fafafa;
  --glass-shadow: none;
  --font-display: "Jim Thompson Roman", Georgia, serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gut: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background-color: var(--ground); color: var(--ink);
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  padding: 20px var(--gut) max(20px, env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
body::before { content: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, p { margin: 0; }
fieldset { margin: 0; min-width: 0; }
body.loading { overflow: hidden; }

.glass, .panel, .editor { background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--glass-shadow); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); }

/* ---------- studio layout ---------- */
.app { max-width: 1560px; margin: 0 auto; height: calc(100dvh - 40px); min-height: 700px; display: grid; gap: 14px 24px;
  grid-template-columns: 272px minmax(0, 1fr) 296px; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bottles top designs" "bottles hero designs" "editor editor editor"; }
.top { grid-area: top; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.toplogo { display: block; height: 26px; width: auto; max-width: 70vw; }
.top p { color: var(--muted); font-size: 13px; min-height: 1.5em; }
.galbtn { position: absolute; right: 0; top: 0; }
.galbtn b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; }

.panel { position: relative; border-radius: 22px; padding: 16px; align-self: start; min-width: 0; }
.phead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.panel h2, .editor h2 { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.pcount { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bottles { grid-area: bottles; }
.designs { grid-area: designs; }

.chips { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; margin-bottom: 12px; border-radius: 16px; background: rgba(0, 0, 0, .06); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .07); }
.chip { flex: 1 0 auto; border: 0; background: transparent; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.chip small { font-size: 10px; opacity: .7; margin-left: 3px; }
.chip:hover { color: var(--ink); }
.chip[aria-checked="true"] { background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .16); }

.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: calc(100dvh - 420px); min-height: 180px; overflow-y: auto; padding: 4px; margin: -4px; scrollbar-width: thin; overscroll-behavior: contain; }
.tile { position: relative; height: 96px; border: 1px solid var(--edge); border-radius: 13px; background: var(--glass-in); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8); display: grid; place-items: center; padding: 6px 4px 18px; transition: transform .2s, box-shadow .2s; min-width: 0; }
.tile { overflow: hidden; }
.tile img { position: absolute; left: 6%; right: 6%; top: 6%; bottom: 20px; width: 88%; height: calc(94% - 20px); object-fit: contain; }
.tile span { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.tile .nv { position: absolute; top: 4px; right: 5px; font-size: 9px; font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, .8); border-radius: 999px; padding: 0 5px; line-height: 15px; }
button.tile:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 12px 20px -14px rgba(0, 0, 0, .5); }
.tile[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.noneyet { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding: 6px 2px; }

.variants { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); min-height: 44px; }
.variants .vl { font-size: 12px; color: var(--muted); margin-right: 2px; flex-basis: 100%; }
.variants .sizes { flex-basis: 100%; display: flex; align-items: center; gap: 8px; }
.variants .sizes .lbl { margin: 0; }
.variants .sizes .seg button { padding: 4px 12px; font-size: 12px; }
.vbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--edge); background: rgba(255, 255, 255, .55); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 12px; transition: background .2s; }
.vbtn:hover { background: rgba(255, 255, 255, .9); }
.vbtn i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); background: var(--c, #eee); box-shadow: inset 0 -3px 5px rgba(0, 0, 0, .12), inset 0 2px 3px rgba(255, 255, 255, .6); }
.vbtn i.none { background: conic-gradient(#ddd 0 25%, #fff 0 50%, #ddd 0 75%, #fff 0); }
.vbtn[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 1px; background: #fff; }

.dgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-height: calc(100dvh - 330px); overflow-y: auto; padding: 4px; margin: -4px; scrollbar-width: thin; }
.dsn { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; gap: 5px; text-align: center; font-size: 11px; line-height: 1.25; color: var(--muted); min-width: 0; }
.dsn img { width: 100%; aspect-ratio: 3 / 4; flex: none; object-fit: cover; border-radius: 10px; border: 1px solid var(--edge); display: block; background: var(--glass-in); box-shadow: 0 8px 16px -12px rgba(0, 0, 0, .55); transition: transform .25s; }
.dsn:hover img { transform: translateY(-2px); }
.dsn[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.dsn[aria-checked="true"] img { outline: 2px solid var(--ink); outline-offset: 2px; }
.dsn .orig { margin-top: -3px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 400; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--edge); background: rgba(255, 255, 255, .6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), 0 1px 3px rgba(0, 0, 0, .1); border-radius: 999px; padding: 8px 18px; font-weight: 500; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: background .2s, transform .2s, box-shadow .2s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .9); transform: translateY(-1px); box-shadow: inset 0 1px 0 #fff, 0 10px 18px -12px rgba(0, 0, 0, .55); }
.btn:active { transform: none; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line-strong); }

.hero { grid-area: hero; position: relative; min-height: 0; min-width: 0; }
/* the bottle fills whatever height is left between the header and the editor */
.stagewrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hero canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; filter: drop-shadow(0 18px 18px rgba(40, 30, 15, .16)); }
#mockCanvas { touch-action: pan-y; outline-offset: 6px; border-radius: 12px; }
.ring { position: absolute; left: 50%; top: 55%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border: 1.5px solid rgba(0, 0, 0, .3); border-radius: 50%; opacity: 0; pointer-events: none; }
.hint { position: absolute; right: 2%; bottom: 6%; background: rgba(255, 255, 255, .62); border: 1px solid var(--edge); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 999px; padding: 6px 14px; font-size: 12px; color: var(--muted); pointer-events: none; }

/* ---------- editor ---------- */
.editor { position: relative; grid-area: editor; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 0; border-radius: 24px; padding: 14px 20px; }
.editor > h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.grp { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; padding: 0 20px; border: 0; border-left: 1px solid var(--line); }
.grp:first-of-type { border-left: 0; padding-left: 0; }
.grp legend { float: left; width: 100%; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 2px; padding: 0; }
.fld { display: flex; flex-direction: column; gap: 4px; width: 104px; font-size: 12px; color: var(--muted); }
.fld > span { display: flex; justify-content: space-between; }
.fld output { font-variant-numeric: tabular-nums; color: var(--ink); }
.tfld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); width: 160px; }
.tfld input { width: 100%; border: 1px solid var(--edge); border-radius: 11px; padding: 7px 11px; background: rgba(255, 255, 255, .62); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); color: var(--ink); font-size: 14px; transition: background .2s, border-color .2s; }
.tfld input:focus { background: #fff; border-color: var(--gold); outline: 0; box-shadow: 0 0 0 3px rgba(0, 0, 0, .1); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) var(--p, 50%), rgba(0, 0, 0, .16) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .16); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--gold); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border-radius: 50%; background: var(--white); border: 1.5px solid var(--ink); box-shadow: 0 2px 5px rgba(0, 0, 0, .25); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--white); border: 1.5px solid var(--ink); }
.sw { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-bottom: 2px; position: relative; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw i { width: 36px; height: 21px; border-radius: 999px; background: rgba(0, 0, 0, .2); position: relative; transition: background .2s; flex: none; }
.sw i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--white); transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.sw input:checked + i { background: var(--navy); }
.sw input:checked + i::after { transform: translateX(15px); }
.sw input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.foot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; flex: 1 1 auto; justify-content: flex-end; padding-left: 20px; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, .06); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .16); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.ltype .seg button { padding: 5px 11px; font-size: 12px; }
.fld.off { opacity: .4; }

.genbtn { position: relative; overflow: hidden; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: 13px 46px; font-weight: 600; font-size: 16px; letter-spacing: .03em; color: #fff;
  background: #000; box-shadow: none; transition: transform .2s, background .2s; }
.genbtn::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-18deg); transition: left .7s ease; }
.genbtn:hover:not(:disabled) { transform: translateY(-2px); }
.genbtn:hover:not(:disabled)::after { left: 120%; }
.genbtn:disabled { opacity: .6; cursor: progress; }

/* ---------- generating page ---------- */
#loader { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; overflow: hidden; background: rgba(255, 255, 255, .88); backdrop-filter: blur(30px) saturate(1.3); -webkit-backdrop-filter: blur(30px) saturate(1.3); opacity: 0; transition: opacity .5s ease; }
#loader.in { opacity: 1; }
.lbox { position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px; padding-inline: 16px; }
.lplate { position: relative; padding: 22px 38px; border-radius: 24px; background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--glass-shadow); overflow: hidden; }
.lplate img { display: block; height: min(46dvh, 400px); width: auto; max-width: 70vw; object-fit: contain; filter: blur(var(--bl, 8px)) saturate(.85); opacity: .92; }
.lscan { position: absolute; left: 0; right: 0; top: 0; height: 90px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .1) 80%, rgba(0, 0, 0, .5)); animation: scan2 1.8s cubic-bezier(.5, 0, .5, 1) infinite; }
.lplate i { position: absolute; width: 18px; height: 18px; border: 0 solid var(--gold); }
.lplate i:nth-of-type(1) { left: 12px; top: 12px; border-width: 2px 0 0 2px; }
.lplate i:nth-of-type(2) { right: 12px; top: 12px; border-width: 2px 2px 0 0; }
.lplate i:nth-of-type(3) { left: 12px; bottom: 12px; border-width: 0 0 2px 2px; }
.lplate i:nth-of-type(4) { right: 12px; bottom: 12px; border-width: 0 2px 2px 0; }
.lmeta { display: flex; align-items: baseline; gap: 14px; width: min(300px, 80vw); justify-content: space-between; }
.lstep, .lpct { font-family: var(--font-display); font-size: 26px; }
.lpct { font-variant-numeric: tabular-nums; color: var(--gold-ink); }
.lbar { width: min(300px, 80vw); height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .13); overflow: hidden; margin-top: -10px; }
.lbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--gold)); transform: scaleX(0); transform-origin: left; }

/* ---------- gallery ---------- */
.gal { max-width: 1560px; margin: 0 auto; min-height: calc(100dvh - 40px); display: flex; flex-direction: column; gap: 18px; }
.galtop { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.galtitle { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.galtop p { text-align: center; color: var(--muted); font-size: 13px; }
.galtop .btn { justify-self: start; }
.galbody { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.viewer { position: relative; border-radius: 28px; padding: 22px 22px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.vstage { width: 100%; display: grid; place-items: center; }
.vstage img { display: block; max-width: 100%; max-height: calc(100dvh - 290px); min-height: 260px; width: auto; height: auto; border-radius: 16px; box-shadow: 0 30px 50px -30px rgba(0, 0, 0, .6); }
.vstage img.reveal { animation: reveal 1.1s cubic-bezier(.6, 0, .2, 1) both; }
.vstage img.fade { animation: fadein .45s ease both; }
.vcap { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.vcap strong { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.15; }
.vcap span { color: var(--muted); font-size: 13px; }
.vact { display: flex; gap: 10px; }
.nav { position: absolute; top: 45%; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--edge); background: rgba(255, 255, 255, .65); box-shadow: inset 0 1px 0 #fff, 0 8px 18px -10px rgba(0, 0, 0, .6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: background .2s, transform .2s, opacity .2s; z-index: 2; }
.nav:hover:not(:disabled) { background: rgba(255, 255, 255, .95); transform: scale(1.06); }
.nav:disabled { opacity: .3; cursor: default; }
.nav.prev { left: 14px; } .nav.next { right: 14px; }
.glist { border-radius: 24px; padding: 16px; }
.glist h2 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.gthumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: calc(100dvh - 170px); overflow-y: auto; padding: 3px; margin: -3px; }
.gthumb { border: 1px solid var(--edge); background: var(--glass-in); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 11px; color: var(--muted); transition: transform .2s, box-shadow .2s; min-width: 0; }
.gthumb:hover { transform: translateY(-2px); box-shadow: 0 12px 20px -14px rgba(0, 0, 0, .55); }
.gthumb img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 9px; display: block; }
.gthumb b { color: var(--ink); font-weight: 600; font-size: 12px; }
.gthumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gthumb[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.gal:not([hidden]) .galin { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 80ms); }

#toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 1100; background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .6); max-width: calc(100vw - 32px); text-align: center; }

/* entrance after the intro */
body.pending .rv { opacity: 0; }
body.ready .rv { animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 90ms + 200ms); }
body.ready .rv.fromL { animation-name: riseL; }
body.ready .rv.fromR { animation-name: riseR; }

/* ---------- opening: Jim Thompson's black-and-white timeline look (matches the story film's last frame) ---------- */
@font-face { font-family: "Jim Thompson Roman"; src: url("assets/fonts/JimThompson_Roman.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("assets/fonts/PublicSans-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
#intro { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden; background: #fff; color: #000; clip-path: inset(0);
  padding: max(24px, env(safe-area-inset-top, 0px)) var(--gut) max(24px, env(safe-area-inset-bottom, 0px)); }
#intro.done { clip-path: inset(0 0 0 100%); transition: clip-path .9s cubic-bezier(.77, 0, .18, 1) .1s; }
#intro .frame { position: absolute; inset: max(16px, env(safe-area-inset-top, 0px)) var(--gut) max(16px, env(safe-area-inset-bottom, 0px)); pointer-events: none; }
#intro .frame > i { position: absolute; inset: 0; border: 1.5px solid #000; clip-path: inset(-8px 50% -8px 50%); animation: frameOpen 2s cubic-bezier(.65, 0, .25, 1) .15s forwards; }
#intro .frame > i + i { inset: 10px; border: 1px solid #c9c9c9; animation-delay: .4s; }
#intro .frame b { position: absolute; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: #000; top: -6px; }
#intro .frame b + b { top: auto; bottom: -6px; }
.scene { position: relative; z-index: 1; display: none; flex-direction: column; align-items: center; text-align: center; width: min(760px, 100%); }
.scene.active { display: flex; }
.kicker { font: 400 clamp(11px, 1.15vw, 14px) "Public Sans", sans-serif; letter-spacing: .42em; text-transform: uppercase; margin-bottom: clamp(20px, 3.5vh, 34px); padding-left: .42em; }
.kicker span { display: inline-block; opacity: 0; transform: translateY(8px); animation: up 1s cubic-bezier(.2, .8, .2, 1) .5s forwards; }
.logo-wrap { position: relative; width: min(560px, 74vw); }
.logo { display: block; width: 100%; height: auto; opacity: 0; clip-path: inset(0 50% 0 50%); filter: blur(6px); animation: logoIn 1.8s cubic-bezier(.65, 0, .25, 1) .9s forwards; }
.rule { width: min(220px, 50vw); height: 14px; margin: clamp(18px, 3vh, 28px) 0 clamp(12px, 2vh, 18px); overflow: visible; }
.rule path { fill: none; stroke: #000; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s cubic-bezier(.6, 0, .2, 1) 2.4s forwards; }
.rule .dot { fill: #000; transform-origin: 110px 7px; transform: scale(0); animation: dotIn .6s cubic-bezier(.3, 1.6, .5, 1) 2.9s forwards; }
.partner { font: 300 clamp(13px, 1.3vw, 16px) "Public Sans", sans-serif; letter-spacing: .03em; opacity: 0; animation: up 1s ease 3.2s forwards; }
.partner b { font-weight: 600; }
.swatches { display: flex; justify-content: center; gap: clamp(6px, 1vw, 12px); margin-top: clamp(26px, 5vh, 46px); height: min(clamp(64px, 11vh, 110px), calc((86vw - (var(--n, 9) - 1) * 12px) / var(--n, 9) * 4 / 3)); max-width: 100%; }
/* --n = number of designs, so the row always fits the screen width */
.swatches img { height: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 3px; box-shadow: 0 14px 22px -14px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .08);
  opacity: 0; transform: translateY(26px) rotate(var(--r, 0deg)); animation: swatch .9s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(3.5s + var(--i) * 90ms); }
.count { margin-top: 14px; font: 400 clamp(15px, 1.6vw, 19px) "Jim Thompson Roman", serif; opacity: 0; animation: up 1s ease 4.4s forwards; }
.intro-foot { position: absolute; left: 0; right: 0; bottom: max(44px, calc(env(safe-area-inset-bottom, 0px) + 28px)); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; padding-inline: var(--gut); }
.intro-bar { width: min(220px, 60vw); height: 1px; background: #e2e2e2; overflow: hidden; }
.intro-bar i { display: block; height: 100%; background: #000; transform: scaleX(0); transform-origin: left; }
.intro-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.watch, .enter { display: inline-flex; align-items: center; gap: 10px; border-radius: 999px; padding: 12px 28px; font: 500 13px "Public Sans", sans-serif; letter-spacing: .16em; text-transform: uppercase;
  transition: background .25s, color .25s, border-color .25s, transform .25s; }
.watch { background: #000; color: #fff; border: 1px solid #000; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.watch:hover { background: #2a2a2a; transform: translateY(-1px); }
.enter { background: #fff; color: #000; border: 1px solid #000; }
.enter:disabled { cursor: default; opacity: .55; border-color: transparent; }
.enter:not(:disabled) { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.enter:not(:disabled):hover { background: #000; color: #fff; transform: translateY(-1px); }

/* the story film: full screen, letterboxed on white, the right cut for the screen's shape */
#film { position: absolute; inset: 0; z-index: 5; background: #fff; display: grid; place-items: center; }
#film video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.film-ui { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: var(--gut); display: flex; gap: 8px; }
.film-btn { background: rgba(255, 255, 255, .92); border: 1px solid #000; color: #000; border-radius: 999px; padding: 6px 14px; font: 500 12px "Public Sans", sans-serif; letter-spacing: .06em; }
.film-btn:hover { background: #000; color: #fff; }
.film-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, .08); }
.film-bar i { display: block; height: 100%; background: #000; transform: scaleX(0); transform-origin: left; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes frameOpen { from { clip-path: inset(-6px 50% -6px 50%); } to { clip-path: inset(-6px -6px -6px -6px); } }
@keyframes up { to { opacity: 1; transform: none; } }
@keyframes logoIn { 0% { opacity: 0; clip-path: inset(0 50% 0 50%); filter: blur(6px); } 40% { opacity: 1; } 100% { opacity: 1; clip-path: inset(0 0 0 0); filter: blur(0); } }
@keyframes sheen { 0% { opacity: 1; background-position: 130% 0; } 100% { opacity: 1; background-position: -30% 0; } }
@keyframes dotIn { to { transform: scale(1); } }
@keyframes swatch { to { opacity: 1; transform: translateY(0) rotate(var(--r, 0deg)); } }
@keyframes silk { from { background-position: 0 0, 0 0, 100% 0, 0 100%, 0 0; } to { background-position: 0 0, 0 0, 0 100%, 100% 0, 0 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes riseL { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes riseR { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes swap { 0% { filter: brightness(1.1) blur(1.5px); opacity: .75; } 100% { filter: none; opacity: 1; } }
#mockCanvas.swap { animation: swap .6s ease-out; }
@keyframes reveal { from { clip-path: inset(0 0 100% 0); transform: scale(1.03); } to { clip-path: inset(0); transform: none; } }
@keyframes fadein { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@keyframes scan2 { from { transform: translateY(-100px); } to { transform: translateY(520px); } }

/* ---------- calibration (?calibrate=1) ---------- */
.calsvg { position: absolute; z-index: 4; overflow: visible; touch-action: none; }
.calsvg:focus-visible { outline: 2px solid #e0312b; outline-offset: 3px; }
.calpath { fill: rgba(224, 49, 43, .1); stroke: #e0312b; stroke-width: 1.5; stroke-dasharray: 6 4; cursor: move; }
.calh { fill: #e0312b; stroke: #fff; stroke-width: 2; cursor: grab; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.calh.arc { fill: #fff; stroke: #e0312b; cursor: ns-resize; }
body.calibrating .hint { display: none; }
.calout { position: fixed; right: 12px; top: 12px; z-index: 950; width: min(360px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 6px; background: rgba(17, 17, 17, .92); color: #eee; font-size: 12px; line-height: 1.4; padding: 12px 14px; border-radius: 12px; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .6); }
.calout .ct { font-weight: 600; color: #fff; font-size: 13px; }
.calout .cz { font: 11px/1.4 ui-monospace, Consolas, monospace; color: #9ef0b0; word-break: break-all; }
.calout .cscope { display: flex; align-items: center; gap: 6px; }
.calout .crow { display: flex; flex-wrap: wrap; gap: 6px; }
.calout button { background: #2c2c2c; color: #fff; border: 1px solid #444; border-radius: 7px; padding: 5px 10px; font-size: 12px; }
.calout button:hover { background: #3a3a3a; }
.calout .cs { color: #9ef0b0; }
.calout .cs.bad { color: #ffb4a8; }
.calout .cp { color: #aaa; }
.calout .chelp { color: #bbb; font-size: 11px; }
.calout .crad { display: flex; align-items: center; gap: 8px; }
.calout .crad input { flex: 1; }
.calout .crad output { width: 22px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- laptop ---------- */
@media (max-width: 1280px) {
  .app { grid-template-columns: 220px minmax(0, 1fr) 256px; column-gap: 18px; }
  .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grp { padding: 0 16px; }
  .fld { width: 108px; }
  .galbody { grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
}
/* ---------- tablet and phone: stacked ---------- */
@media (max-width: 960px) {
  body { padding-top: 14px; }
  .app { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto; gap: 14px;
    grid-template-areas: "top top" "hero hero" "bottles designs" "editor editor"; height: auto; min-height: 0; }
  .galbtn { position: static; margin-top: 4px; }
  .hero { height: 56dvh; min-height: 300px; }
  .hint { display: none; }
  .bgrid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); max-height: 330px; }
  .dgrid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 420px; }
  .editor { padding: 16px; }
  .editor > h2 { width: 100%; margin: 0; }
  .grp { border-left: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .grp + .grp { border-top: 1px solid var(--line); padding-top: 12px; }
  .foot { width: 100%; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; justify-content: space-between; }
  .grp legend { grid-column: 1 / -1; }
  .ltype { grid-column: 1 / -1; }
  .ltype .seg button { flex: 1; }
  .fld, .tfld { width: auto; }
  .galtop { grid-template-columns: 1fr; justify-items: center; }
  .galtop .btn { justify-self: start; }
  .galsp { display: none; }
  .galbody { grid-template-columns: minmax(0, 1fr); }
  .gthumbs { max-height: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .vstage img { max-height: 60dvh; min-height: 0; }
}
@media (max-width: 620px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "hero" "bottles" "designs" "editor"; }
  .toplogo { height: 20px; }
  .hero { height: 50dvh; min-height: 280px; }
  .panel { padding: 14px; border-radius: 18px; }
  /* pickers become one swipeable row each */
  .bgrid, .dgrid { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; min-height: 0; scroll-snap-type: x proximity; padding: 4px 4px 8px; gap: 8px; }
  .bgrid .tile { flex: 0 0 82px; height: 104px; scroll-snap-align: start; }
  .dgrid .dsn { flex: 0 0 92px; scroll-snap-align: start; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: 0 0 auto; }
  .grp { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
  .grp.text { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; } .seg button { flex: 1; padding: 7px 6px; }
  #resetBtn { margin-left: 0; }
  .genbtn { position: sticky; bottom: max(10px, env(safe-area-inset-bottom, 0px)); width: 100%; z-index: 20; }
  .viewer { padding: 12px 10px; border-radius: 20px; }
  .nav { width: 38px; height: 38px; margin-top: -19px; }
  .nav.prev { left: 6px; } .nav.next { right: 6px; }
  .vcap strong { font-size: 20px; }
  .kicker { letter-spacing: .3em; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .swatches { display: none; }
  .count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
  body.pending .rv { opacity: 1; }
}

/* desktop: side panels fill their column, lists scroll inside */
@media (min-width: 961px) {
  .bottles, .designs { align-self: stretch; display: flex; flex-direction: column; min-height: 0; }
  .bgrid, .dgrid { flex: 1 1 auto; min-height: 0; max-height: none; align-content: start; }
  .variants { flex: none; }
}

/* stacked layouts: the bottle stays in view while the pickers and sliders scroll underneath */
@media (max-width: 960px) {
  .hero { position: sticky; top: 0; z-index: 10; height: 46dvh; margin: 0 calc(-1 * var(--gut)); padding: 6px var(--gut);
    background: linear-gradient(var(--ground) 82%, rgba(255, 255, 255, 0)); }
  .hero .stagewrap { inset: 6px var(--gut) 14px; }
}
@media (max-width: 620px) {
  .hero { height: 40dvh; min-height: 250px; }
}

/* ---------- black-and-white tone: flat white panels with hairlines, as on jimthompson.com ---------- */
.glass, .panel, .editor { background: #fff; border: 1px solid var(--edge); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.panel { border-radius: 4px; }
.editor { border-radius: 4px; }
.viewer, .glist { border-radius: 4px; }
.tile, .dsn img, .gthumb, .gthumb img { border-radius: 3px; }
.tile { background: #fafafa; border-color: #ececec; box-shadow: none; }
.tile[aria-checked="true"], .dsn[aria-checked="true"] img, .vbtn[aria-checked="true"], .gthumb[aria-pressed="true"] { outline: 1.5px solid #000; }
.chips, .seg { background: #f2f2f2; box-shadow: none; }
.btn, .nav, .hint, .tfld input { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.btn { background: #fff; border-color: #000; }
.btn:hover { background: #000; color: #fff; box-shadow: none; }
.btn.ghost { border-color: var(--line-strong); }
.tfld input { background: #fff; border-color: #d9d9d9; border-radius: 3px; }
.tfld input:focus { border-color: #000; }
.panel h2, .editor h2 { font-family: var(--font-display); font-weight: 400; font-size: 16px; letter-spacing: .01em; }
.grp legend { font-weight: 500; letter-spacing: .14em; }
.genbtn { border-color: #000; letter-spacing: .14em; text-transform: uppercase; font-size: 14px; font-weight: 500; }
.genbtn:hover:not(:disabled) { background: #2a2a2a; }
.vcap strong { font-weight: 400; }
.lplate { border-radius: 4px; box-shadow: none; border-color: var(--edge); }
.lstep, .lpct { font-weight: 400; }
#toast { border-radius: 3px; }
