All projectsKeep looking
Component3d
Room
0 views 0 copiesFree
Sign in to take this project
Sign in to copy the source, prompt and SKILL.md.
DetailsPublished
- Version
- v1.0
- Motion
- Micro interaction
- Updated
- Nov 25, 2026
room.html
1<!DOCTYPE html>2<html lang="en">3<head>4<meta charset="UTF-8" />5<meta name="viewport" content="width=device-width, initial-scale=1.0" />6<title>Zestwell — Citrus Season</title>78<!-- Google Fonts: Oswald, Newsreader & DM Mono -->9<link rel="preconnect" href="https://fonts.googleapis.com" />10<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />11<link12href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Newsreader:ital,opsz,wght@0,6..72,400..500;1,6..72,400&family=Oswald:wght@500;600&display=swap"13rel="stylesheet"14/>1516<!-- Import Map for Three.js -->17<script type="importmap">18{19"imports": {20"three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js"21}22}23</script>2425<style>26:root {27--wall: #FFF9EC;28--floor: #F8E7D2;29--ink: #3A3550;30--ink-60: rgba(58, 53, 80, 0.6);31--ink-35: rgba(58, 53, 80, 0.35);32--ink-15: rgba(58, 53, 80, 0.15);33--lemon: #FBE46D;34--blush: #F7D2D1;35--chip-on: #FCEB93;36--drawer: #F9E3DF;37--page: #FFF9EF;3839--font-display: 'Oswald', 'Arial Narrow', sans-serif;40--font-serif: 'Newsreader', Georgia, serif;41--font-mono: 'DM Mono', ui-monospace, monospace;4243--u: min(calc(100vw / 1440), calc(100vh / 900));44--w: calc(100vw / 1440);45}4647*, *::before, *::after {48box-sizing: border-box;49}5051html, body {52height: 100%;53width: 100%;54margin: 0;55padding: 0;56overflow: hidden;57background: var(--wall);58color: var(--ink);59-webkit-font-smoothing: antialiased;60-moz-osx-font-smoothing: grayscale;61}6263button {64background: none;65border: none;66padding: 0;67font: inherit;68color: inherit;69cursor: pointer;70}7172a {73text-decoration: none;74color: inherit;75}7677/* ================= 1. TOP NAVIGATION ================= */78header.nav {79position: fixed;80top: 0;81left: 0;82width: 100%;83height: calc(58 * var(--u));84padding: 0 calc(27 * var(--u));85display: flex;86align-items: center;87z-index: 30;88background: transparent;89border-bottom: 1px solid transparent;90transition: background 0.3s ease, border-color 0.3s ease;91}9293header.nav.is-solid {94background: var(--page);95border-bottom-color: var(--ink-15);96}9798.nav-logo {99font-family: var(--font-serif);100font-weight: 500;101font-size: calc(21 * var(--u));102letter-spacing: -0.01em;103margin-right: calc(36 * var(--u));104min-height: 24px;105display: inline-flex;106align-items: center;107}108109.nav-links {110display: flex;111align-items: center;112gap: calc(22 * var(--u));113}114115.nav-links button,116.nav-links a {117font-family: var(--font-serif);118font-size: max(11px, calc(13.5 * var(--u)));119opacity: 0.85;120min-height: 24px;121display: inline-flex;122align-items: center;123transition: opacity 0.2s ease;124}125126.nav-links button:hover,127.nav-links a:hover {128opacity: 1;129}130131.nav-right {132margin-left: auto;133display: flex;134align-items: center;135gap: calc(14 * var(--u));136}137138.search-pill {139width: calc(159 * var(--u));140height: max(24px, calc(27 * var(--u)));141border: 1px solid var(--ink-35);142border-radius: 99px;143padding: 0 calc(6 * var(--u)) 0 calc(11 * var(--u));144display: flex;145align-items: center;146justify-content: space-between;147transition: border-color 0.2s;148}149150.search-pill:hover {151border-color: var(--ink);152}153154.search-placeholder {155font-family: var(--font-serif);156font-size: max(11px, calc(12 * var(--u)));157color: var(--ink-60);158}159160.search-icons {161display: inline-flex;162align-items: center;163gap: calc(5 * var(--u));164}165166.search-icons svg {167width: calc(12 * var(--u));168height: calc(12 * var(--u));169color: var(--ink-60);170}171172.search-kbd {173font-family: var(--font-mono);174font-size: max(11px, calc(9 * var(--u)));175border: 1px solid var(--ink-15);176border-radius: 4px;177padding: 0 calc(4 * var(--u));178color: var(--ink-35);179line-height: 1.35;180}181182.currency-pill {183height: max(24px, calc(27 * var(--u)));184padding: 0 calc(10 * var(--u));185border: 1px solid var(--ink-35);186border-radius: 99px;187font-family: var(--font-mono);188font-size: max(11px, calc(10.5 * var(--u)));189display: inline-flex;190align-items: center;191gap: 5px;192}193194.nav-icon-btn {195width: max(24px, calc(26 * var(--u)));196height: max(24px, calc(26 * var(--u)));197display: grid;198place-items: center;199position: relative;200border-radius: 99px;201}202203.nav-icon-btn svg {204width: calc(18 * var(--u));205height: calc(18 * var(--u));206stroke: currentColor;207stroke-width: 1.6;208fill: none;209}210211.bag-badge {212position: absolute;213top: -2px;214right: -3px;215min-width: 16px;216height: 16px;217padding: 0 4px;218border-radius: 99px;219background: var(--ink);220color: var(--wall);221font-family: var(--font-mono);222font-size: 11px;223display: none;224place-items: center;225line-height: 1;226}227228.bag-badge.has-items {229display: grid;230}231232/* ================= 2. 3D GALLERY CANVAS ================= */233main#gallery {234position: fixed;235inset: 0;236touch-action: none;237cursor: grab;238z-index: 1;239}240241main#gallery.is-dragging {242cursor: grabbing;243}244245main#gallery.is-hovering {246cursor: pointer;247}248249main#gallery canvas {250width: 100%;251height: 100%;252display: block;253transition: opacity 0.3s ease;254}255256#veil {257position: fixed;258inset: 0;259background: var(--wall);260z-index: 25;261pointer-events: none;262opacity: 1;263}264265/* ================= 3. GALLERY UI OVERLAY ================= */266.gui {267position: fixed;268inset: 0;269z-index: 20;270pointer-events: none;271transition: opacity 0.3s ease, visibility 0.3s ease;272}273274.gui.is-hidden {275opacity: 0;276visibility: hidden;277}278279.gui-arrows,280.gui-hint,281.gui-toggle,282.gui-caption {283pointer-events: auto;284}285286.mask-line {287display: block;288overflow: hidden;289}290291.mask-inner {292display: block;293}294295.gui-arrows {296position: absolute;297left: calc(27 * var(--u));298top: calc(262 * var(--u));299display: flex;300flex-direction: column;301gap: calc(10 * var(--u));302}303304.arrow-btn {305width: calc(50 * var(--u));306height: calc(50 * var(--u));307border-radius: 50%;308border: 1.5px solid var(--ink);309display: grid;310place-items: center;311color: var(--ink);312background: transparent;313transition: background 0.25s ease, color 0.25s ease;314}315316.arrow-btn:hover {317background: var(--ink);318color: var(--wall);319}320321.arrow-btn svg {322width: calc(20 * var(--u));323height: calc(20 * var(--u));324stroke: currentColor;325stroke-width: 1.5;326fill: none;327}328329.gui-hint {330position: absolute;331right: calc(27 * var(--u));332bottom: calc(229 * var(--u));333text-align: right;334font-family: var(--font-mono);335font-size: max(11px, calc(10 * var(--u)));336letter-spacing: 0.12em;337line-height: 1.65;338text-transform: uppercase;339}340341.gui-toggle {342position: absolute;343right: calc(29 * var(--u));344bottom: calc(174 * var(--u));345border: 1px solid var(--ink-35);346border-radius: 99px;347padding: calc(2 * var(--u));348display: flex;349gap: calc(2 * var(--u));350background: rgba(255, 249, 236, 0.72);351backdrop-filter: blur(4px);352}353354.toggle-btn {355height: max(24px, calc(22 * var(--u)));356padding: 0 calc(14 * var(--u));357border-radius: 99px;358font-family: var(--font-mono);359font-size: max(11px, calc(9.5 * var(--u)));360letter-spacing: 0.12em;361text-transform: uppercase;362transition: background 0.2s ease, color 0.2s ease;363}364365.toggle-btn.is-active {366background: var(--ink);367color: var(--wall);368}369370.gui-caption {371position: absolute;372left: calc(25 * var(--u));373bottom: calc(30 * var(--u));374}375376.caption-kicker {377font-family: var(--font-mono);378font-size: max(11px, calc(11.5 * var(--u)));379letter-spacing: 0.14em;380width: max-content;381margin: 0 0 calc(10 * var(--u)) calc(3 * var(--u));382text-transform: uppercase;383}384385.caption-title {386font-family: var(--font-display);387font-weight: 600;388font-size: calc(170 * var(--u));389line-height: 0.82;390letter-spacing: 0.005em;391white-space: nowrap;392transform: scaleX(0.855);393transform-origin: bottom left;394margin: 0;395text-transform: uppercase;396}397398.cta-enter {399position: absolute;400left: calc(946 * var(--u));401bottom: 0;402font-family: var(--font-mono);403font-size: max(11px, calc(11 * var(--u)));404letter-spacing: 0.12em;405border-bottom: 1px solid var(--ink);406padding-bottom: calc(2 * var(--u));407margin-bottom: calc(9 * var(--u));408white-space: nowrap;409min-height: 24px;410display: inline-flex;411align-items: flex-end;412text-transform: uppercase;413}414415/* ================= 4. FLOATING "OPEN THE PRINT" PILL ================= */416#open-pill {417position: fixed;418top: 0;419left: 0;420z-index: 22;421pointer-events: none;422background: #1e1b2b;423color: #ffffff;424font-family: var(--font-mono);425font-size: max(11px, calc(10 * var(--u)));426letter-spacing: 0.14em;427padding: calc(7 * var(--u)) calc(13 * var(--u));428border-radius: 99px;429opacity: 0;430transform: translate(-50%, -50%);431transition: opacity 0.12s ease;432white-space: nowrap;433text-transform: uppercase;434}435436#open-pill.is-visible {437opacity: 1;438}439440/* ================= 5. PRINT PRODUCT PAGE ================= */441section#page {442position: fixed;443inset: 0;444z-index: 15;445background: var(--page);446overflow-y: auto;447overflow-x: hidden;448opacity: 0;449visibility: hidden;450pointer-events: none;451transition: opacity 0.3s ease, visibility 0.3s ease;452}453454section#page.is-open {455opacity: 1;456visibility: visible;457pointer-events: auto;458}459460.page-grid {461padding-top: calc(96 * var(--w));462display: grid;463grid-template-columns: calc(712 * var(--w)) calc(638 * var(--w));464align-items: start;465}466467.page-left {468position: sticky;469top: calc(96 * var(--w));470padding-left: calc(184 * var(--w));471width: calc(544 * var(--w));472}473474#page-art {475width: calc(360 * var(--w));476aspect-ratio: 3 / 4.08;477background-color: #f3ead8;478box-shadow:4790 0 0 calc(10 * var(--w)) #F6EAD8,4800 calc(2 * var(--w)) calc(10 * var(--w)) calc(10 * var(--w)) rgba(58, 53, 80, 0.06);481opacity: 0;482}483484#page-art.is-ready {485opacity: 1;486}487488.page-meta {489width: calc(360 * var(--w));490margin-top: calc(34 * var(--w));491display: flex;492align-items: center;493justify-content: space-between;494font-family: var(--font-mono);495font-size: max(11px, calc(11 * var(--w)));496opacity: 0;497transition: opacity 0.15s ease;498}499500.meta-room {501display: inline-flex;502align-items: center;503gap: calc(7 * var(--w));504}505506.page-meta svg {507width: calc(17 * var(--w));508height: calc(17 * var(--w));509stroke: currentColor;510stroke-width: 1.5;511fill: none;512}513514.page-right {515opacity: 0;516transition: opacity 0.15s ease;517}518519.page-meta.is-revealed,520.page-right.is-revealed,521.collection-band.is-revealed {522opacity: 1;523}524525.p-title {526font-family: var(--font-display);527font-weight: 600;528font-size: calc(46 * var(--w));529text-transform: uppercase;530line-height: 1;531margin: 0;532}533534.p-artist {535font-family: var(--font-serif);536font-style: italic;537font-size: max(11px, calc(19 * var(--w)));538margin: calc(6 * var(--w)) 0 calc(18 * var(--w));539}540541.p-desc {542font-family: var(--font-serif);543font-size: max(11px, calc(14.5 * var(--w)));544line-height: 1.55;545color: var(--ink-60);546max-width: calc(560 * var(--w));547margin: 0 0 calc(20 * var(--w));548}549550.p-price {551font-family: var(--font-mono);552font-size: max(11px, calc(15 * var(--w)));553}554555.p-tax {556font-family: var(--font-mono);557font-size: max(11px, calc(10 * var(--w)));558color: var(--ink-60);559margin: calc(24 * var(--w)) 0 calc(24 * var(--w));560}561562.opt-group {563margin-bottom: calc(21 * var(--w));564}565566.opt-label {567font-family: var(--font-mono);568font-size: max(11px, calc(10 * var(--w)));569text-transform: uppercase;570letter-spacing: 0.1em;571margin-bottom: calc(8 * var(--w));572}573574.opt-val {575color: var(--ink-60);576text-transform: none;577letter-spacing: 0;578}579580.chip-row {581display: flex;582flex-wrap: wrap;583gap: calc(13 * var(--w));584}585586.chip {587height: max(28px, calc(32 * var(--w)));588padding: 0 calc(14 * var(--w));589border: 1px solid var(--ink-35);590font-family: var(--font-mono);591font-size: max(11px, calc(10.5 * var(--w)));592display: inline-flex;593align-items: center;594justify-content: center;595transition: background 0.15s ease, border-color 0.15s ease;596}597598.chip.is-on {599background: var(--chip-on);600border-color: var(--ink);601}602603.frame-chip {604width: calc(121 * var(--w));605height: calc(126 * var(--w));606border: 1px solid var(--ink-15);607background: rgba(255, 255, 255, 0.35);608display: flex;609flex-direction: column;610align-items: center;611justify-content: center;612gap: calc(10 * var(--w));613padding: calc(8 * var(--w));614font-family: var(--font-mono);615font-size: max(11px, calc(10 * var(--w)));616transition: background 0.15s ease, border-color 0.15s ease;617}618619.frame-chip.is-on {620background: var(--chip-on);621border-color: var(--ink);622}623624.frame-thumb {625width: calc(38 * var(--w));626aspect-ratio: 3 / 4.08;627background-color: #eee2ce;628}629630.frame-thumb.is-classic {631box-shadow: 0 0 0 calc(4 * var(--w)) #C99A63;632}633634.frame-thumb.is-canvas {635box-shadow: 0 0 0 calc(5 * var(--w)) #1d1b24;636}637638.buy-row {639margin-top: calc(42 * var(--w));640display: flex;641gap: calc(26 * var(--w));642}643644.qty-stepper {645width: calc(100 * var(--w));646height: calc(50 * var(--w));647border: 1px solid var(--ink-35);648display: flex;649align-items: center;650justify-content: space-between;651padding: 0 calc(10 * var(--w));652font-family: var(--font-mono);653font-size: max(11px, calc(13 * var(--w)));654}655656.qty-stepper button {657min-width: 24px;658min-height: 24px;659display: grid;660place-items: center;661}662663.btn-add-bag {664flex: 1;665height: calc(50 * var(--w));666background: var(--ink);667color: #ffffff;668font-family: var(--font-display);669font-weight: 500;670font-size: max(11px, calc(16 * var(--w)));671letter-spacing: 0.12em;672text-transform: uppercase;673transition: background 0.2s ease;674}675676.btn-add-bag:hover {677background: #2a2640;678}679680.accordions {681margin-top: calc(36 * var(--w));682border-top: 1px solid var(--ink-35);683}684685.acc-item {686border-bottom: 1px solid var(--ink-35);687}688689.acc-trigger {690width: 100%;691height: max(32px, calc(40 * var(--w)));692display: flex;693align-items: center;694justify-content: space-between;695font-family: var(--font-serif);696font-size: max(11px, calc(15 * var(--w)));697text-align: left;698}699700.acc-plus {701font-family: var(--font-mono);702font-size: max(13px, calc(16 * var(--w)));703transition: transform 0.3s ease;704display: inline-block;705}706707.acc-item.is-open .acc-plus {708transform: rotate(45deg);709}710711.acc-panel {712height: 0;713overflow: hidden;714transition: height 0.3s ease;715}716717.acc-body {718padding-bottom: calc(16 * var(--w));719font-family: var(--font-serif);720font-size: max(11px, calc(13.5 * var(--w)));721line-height: 1.55;722color: var(--ink-60);723}724725/* Collection Band */726.collection-band {727margin-top: calc(70 * var(--w));728background: #FBF3E4;729padding: calc(36 * var(--w)) 0 calc(80 * var(--w)) calc(48 * var(--w));730opacity: 0;731transition: opacity 0.15s ease;732}733734.band-title {735font-family: var(--font-display);736font-weight: 600;737font-size: calc(38 * var(--w));738margin: 0 0 calc(28 * var(--w)) calc(-15 * var(--w));739text-transform: uppercase;740line-height: 1;741}742743.band-cards {744display: flex;745gap: calc(87 * var(--w));746}747748.print-card {749width: calc(168 * var(--w));750cursor: pointer;751}752753.card-art {754width: 100%;755aspect-ratio: 3 / 4;756background-color: #f3ead8;757box-shadow: 0 0 0 calc(7 * var(--w)) #F6EAD8;758transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);759}760761.print-card:hover .card-art {762transform: translateY(calc(-4 * var(--w)));763}764765.card-title {766font-family: var(--font-serif);767font-weight: 500;768font-size: max(11px, calc(14 * var(--w)));769margin-top: calc(14 * var(--w));770}771772.card-artist {773font-family: var(--font-serif);774font-style: italic;775font-size: max(11px, calc(13.5 * var(--w)));776color: var(--ink-60);777margin-top: calc(2 * var(--w));778}779780.card-price {781font-family: var(--font-mono);782font-size: max(11px, calc(11 * var(--w)));783margin-top: calc(4 * var(--w));784}785786/* ================= 6. LIST VIEW ================= */787section#list {788position: fixed;789inset: 0;790z-index: 14;791background: var(--page);792overflow-y: auto;793padding: calc(110 * var(--w)) calc(48 * var(--w)) calc(80 * var(--w));794opacity: 0;795visibility: hidden;796pointer-events: none;797transition: opacity 0.3s ease, visibility 0.3s ease;798}799800section#list.is-open {801opacity: 1;802visibility: visible;803pointer-events: auto;804}805806.list-title {807font-family: var(--font-display);808font-weight: 600;809font-size: calc(38 * var(--w));810text-transform: uppercase;811margin: 0 0 calc(36 * var(--w));812line-height: 1;813}814815.list-grid {816display: flex;817flex-wrap: wrap;818gap: calc(46 * var(--w)) calc(56 * var(--w));819}820821/* ================= 7. BAG DRAWER ================= */822#drawer-backdrop {823position: fixed;824inset: 0;825z-index: 39;826background: rgba(58, 53, 80, 0.24);827opacity: 0;828pointer-events: none;829transition: opacity 0.3s ease;830}831832#drawer-backdrop.is-open {833opacity: 1;834pointer-events: auto;835}836837aside.drawer {838position: fixed;839top: 0;840right: 0;841bottom: 0;842width: calc(387 * var(--w));843z-index: 40;844background: var(--drawer);845padding: calc(28 * var(--w)) calc(28 * var(--w)) calc(28 * var(--w)) calc(32 * var(--w));846display: flex;847flex-direction: column;848transform: translateX(101%);849transition: transform 0.45s cubic-bezier(0.1, 0.85, 0.2, 1);850}851852aside.drawer.is-open {853transform: translateX(0);854}855856.drawer-head {857display: flex;858align-items: center;859justify-content: space-between;860margin-bottom: calc(24 * var(--w));861}862863.drawer-title {864font-family: var(--font-display);865font-weight: 600;866font-size: calc(26 * var(--w));867margin: 0;868text-transform: uppercase;869line-height: 1;870}871872.drawer-close {873min-width: 28px;874min-height: 28px;875font-size: 24px;876line-height: 1;877display: grid;878place-items: center;879}880881.drawer-items {882flex: 1;883overflow-y: auto;884display: flex;885flex-direction: column;886gap: calc(20 * var(--w));887padding-right: 4px;888}889890.drawer-empty {891font-family: var(--font-mono);892font-size: max(11px, calc(12 * var(--w)));893text-align: center;894margin-top: calc(120 * var(--w));895color: var(--ink-60);896letter-spacing: 0.08em;897}898899.bag-row {900display: flex;901gap: calc(14 * var(--w));902align-items: flex-start;903transition: opacity 0.35s ease, transform 0.35s ease;904}905906.bag-row.is-entering {907opacity: 0;908transform: translateY(calc(6 * var(--w)));909}910911.bag-thumb {912width: calc(66 * var(--w));913aspect-ratio: 3 / 4;914flex-shrink: 0;915background-color: #f3ead8;916}917918.bag-info {919flex: 1;920min-width: 0;921}922923.bag-title {924font-family: var(--font-serif);925font-weight: 500;926font-size: max(11px, calc(14 * var(--w)));927}928929.bag-artist {930font-family: var(--font-serif);931font-style: italic;932font-size: max(11px, calc(13 * var(--w)));933color: var(--ink-60);934}935936.bag-meta {937font-family: var(--font-mono);938font-size: max(11px, calc(11 * var(--w)));939color: var(--ink-60);940margin-top: calc(4 * var(--w));941}942943.bag-controls {944display: flex;945align-items: center;946justify-content: space-between;947margin-top: calc(10 * var(--w));948}949950.mini-qty {951display: inline-flex;952align-items: center;953border: 1px solid var(--ink-35);954font-family: var(--font-mono);955font-size: max(11px, calc(11 * var(--w)));956}957958.mini-qty button {959min-width: max(24px, calc(24 * var(--w)));960min-height: max(24px, calc(24 * var(--w)));961display: grid;962place-items: center;963}964965.mini-qty span {966padding: 0 6px;967}968969.btn-trash {970min-width: 24px;971min-height: 24px;972display: grid;973place-items: center;974color: var(--ink-60);975}976977.btn-trash:hover {978color: var(--ink);979}980981.drawer-footer {982border-top: 1px solid var(--ink-35);983padding-top: calc(18 * var(--w));984margin-top: calc(14 * var(--w));985}986987.subtotal-row {988display: flex;989justify-content: space-between;990font-family: var(--font-mono);991font-size: max(11px, calc(13 * var(--w)));992margin-bottom: calc(16 * var(--w));993}994995.btn-checkout {996width: 100%;997height: calc(50 * var(--w));998background: var(--ink);999color: #ffffff;1000font-family: var(--font-display);1001font-weight: 500;1002font-size: max(11px, calc(17 * var(--w)));1003letter-spacing: 0.1em;1004text-transform: uppercase;1005}10061007.btn-checkout:hover {1008background: #2a2640;1009}10101011/* Flyer Element */1012.flyer {1013position: fixed;1014top: 0;1015left: 0;1016z-index: 35;1017pointer-events: none;1018transform-origin: top left;1019box-shadow: 0 0 0 8px #F6EAD8;1020}10211022/* Subtle Toast Banner (for non-intrusive feedback without alert()) */1023#toast {1024position: fixed;1025bottom: 24px;1026left: 50%;1027transform: translate(-50%, 16px);1028background: var(--ink);1029color: var(--wall);1030font-family: var(--font-mono);1031font-size: 11px;1032letter-spacing: 0.1em;1033padding: 10px 18px;1034border-radius: 99px;1035z-index: 50;1036opacity: 0;1037pointer-events: none;1038transition: opacity 0.25s ease, transform 0.25s ease;1039}10401041#toast.is-shown {1042opacity: 1;1043transform: translate(-50%, 0);1044}10451046/* ================= DESKTOP-WIDTH PORTRAIT OVERRIDE ================= */1047@media (min-width: 820px) and (max-aspect-ratio: 1/1) {1048.caption-title {1049font-size: calc(150 * var(--u));1050}1051}10521053/* ================= 9. SMALL-SCREEN LAYOUT ================= */1054@media (max-width: 819px),1055(orientation: portrait) and (max-width: 1100px),1056(orientation: landscape) and (max-height: 500px) {1057:root {1058--u: 1px;1059--w: 1px;1060}10611062header.nav {1063height: 52px;1064padding: 0 16px;1065}10661067.nav-logo {1068font-size: 19px;1069margin-right: 0;1070}10711072.nav-links,1073.search-pill,1074.currency-pill,1075.nav-hide-sm {1076display: none !important;1077}10781079#btn-bag {1080width: 32px;1081height: 32px;1082}10831084#btn-bag svg {1085width: 20px;1086height: 20px;1087}10881089.gui-hint {1090top: 62px;1091bottom: auto;1092left: 16px;1093right: 16px;1094text-align: left;1095font-size: 11px;1096}10971098.gui-caption {1099left: 14px;1100bottom: 100px;1101}11021103.caption-kicker {1104font-size: 11px;1105}11061107.caption-title {1108font-size: min(23.5vw, 19vh);1109white-space: normal;1110line-height: 0.84;1111transform: none;1112max-width: 6ch;1113}11141115.cta-enter {1116position: static;1117display: inline-flex;1118margin-top: 12px;1119margin-bottom: 0;1120font-size: 11px;1121}11221123.gui-arrows {1124top: auto;1125left: 16px;1126bottom: 24px;1127flex-direction: row;1128gap: 10px;1129}11301131.arrow-btn {1132width: 44px;1133height: 44px;1134}11351136.arrow-btn svg {1137width: 18px;1138height: 18px;1139}11401141.gui-toggle {1142right: 16px;1143bottom: 30px;1144}11451146.toggle-btn {1147height: 26px;1148}11491150/* Print Page Small Screen */1151section#page {1152padding-top: 64px;1153}11541155.page-grid {1156padding-top: 0;1157grid-template-columns: 1fr;1158max-width: 680px;1159margin: 0 auto;1160padding-left: 20px;1161padding-right: 20px;1162}11631164.page-left {1165position: static;1166padding-left: 0;1167width: 100%;1168margin-bottom: 28px;1169}11701171#page-art {1172width: 100%;1173max-width: 420px;1174margin: 0 auto;1175box-shadow:11760 0 0 8px #F6EAD8,11770 2px 10px 10px rgba(58, 53, 80, 0.06);1178}11791180.page-meta {1181width: 100%;1182max-width: 420px;1183margin: 22px auto 0;1184}11851186.p-title {1187font-size: 36px;1188}11891190.p-artist {1191font-size: 18px;1192}11931194.p-desc {1195font-size: 14.5px;1196}11971198.chip-row {1199gap: 8px;1200}12011202.chip {1203height: 36px;1204font-size: 11px;1205padding: 0 12px;1206}12071208.frame-chip {1209width: min(calc((100vw - 60px) / 3), 190px);1210height: 118px;1211}12121213.buy-row {1214gap: 14px;1215}12161217.qty-stepper {1218width: 100px;1219height: 50px;1220}12211222.btn-add-bag {1223height: 50px;1224}12251226.acc-trigger {1227height: 46px;1228}12291230.collection-band {1231padding: 30px 0 60px max(20px, calc((100vw - 640px) / 2));1232}12331234.band-title {1235margin-left: 0;1236font-size: 32px;1237}12381239.band-cards {1240overflow-x: auto;1241scroll-snap-type: x mandatory;1242gap: 16px;1243padding-right: 20px;1244-webkit-overflow-scrolling: touch;1245}12461247.band-cards .print-card {1248flex: 0 0 150px;1249width: 150px;1250scroll-snap-align: start;1251}12521253/* List Small Screen */1254section#list {1255padding: 80px 20px 60px;1256}12571258.list-title {1259font-size: 32px;1260margin-bottom: 24px;1261}12621263.list-grid {1264display: grid;1265grid-template-columns: repeat(2, 1fr);1266gap: 28px 16px;1267}12681269.list-grid .print-card {1270width: 100%;1271}12721273/* Drawer Small Screen */1274aside.drawer {1275width: min(88vw, 380px);1276padding: 22px 20px;1277}1278}12791280/* Landscape Phone Override */1281@media (orientation: landscape) and (max-height: 500px) {1282.caption-title {1283font-size: min(13vw, 26vh);1284white-space: nowrap;1285max-width: none;1286}12871288.gui-caption {1289bottom: 18px;1290}12911292.cta-enter {1293margin-top: 8px;1294}12951296.gui-hint {1297display: none;1298}12991300.gui-arrows {1301left: auto;1302right: 16px;1303bottom: 18px;1304}13051306.gui-toggle {1307top: 60px;1308bottom: auto;1309right: 16px;1310}1311}13121313/* ================= 10. REDUCED MOTION ================= */1314@media (prefers-reduced-motion: reduce) {1315*, *::before, *::after {1316transition-duration: 0.01ms !important;1317animation-duration: 0.01ms !important;1318}1319}1320</style>1321</head>1322<body>1323<!-- 1. TOP NAVIGATION -->1324<header class="nav" id="main-nav">1325<button class="nav-logo" id="btn-logo" type="button">Zestwell</button>13261327<nav class="nav-links" aria-label="Primary">1328<button type="button" data-action="gallery">Index</button>1329<button type="button" data-action="list">Shop</button>1330<button type="button" data-action="info">Info</button>1331<button type="button" data-action="auctions">Auctions</button>1332<button type="button" data-action="help">Help</button>1333</nav>13341335<div class="nav-right">1336<button class="search-pill" id="btn-search" type="button" aria-label="Search prints">1337<span class="search-placeholder">Search…</span>1338<span class="search-icons">1339<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">1340<circle cx="11" cy="11" r="7"></circle>1341<line x1="16.5" y1="16.5" x2="21" y2="21"></line>1342</svg>1343<kbd class="search-kbd">⌘K</kbd>1344</span>1345</button>13461347<button class="currency-pill" type="button" id="btn-currency">1348<span>USD</span>1349<svg width="8" height="8" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.5">1350<polyline points="2,3.5 5,6.5 8,3.5"></polyline>1351</svg>1352</button>13531354<button class="nav-icon-btn nav-hide-sm" type="button" aria-label="Account" data-toast="Collector account portal coming soon">1355<svg viewBox="0 0 24 24">1356<circle cx="12" cy="8" r="4"></circle>1357<path d="M4.5 20c1.6-3.8 4.4-5.5 7.5-5.5s5.9 1.7 7.5 5.5"></path>1358</svg>1359</button>13601361<button class="nav-icon-btn nav-hide-sm" type="button" aria-label="Saved prints" data-toast="Saved to your studio shortlist">1362<svg viewBox="0 0 24 24">1363<path d="M12 20.5s-7.5-4.7-9.2-9.2C1.5 8 3.6 4.8 7 4.8c2 0 3.7 1.1 5 2.7 1.3-1.6 3-2.7 5-2.7 3.4 0 5.5 3.2 4.2 6.5-1.7 4.5-9.2 9.2-9.2 9.2z"></path>1364</svg>1365</button>13661367<button class="nav-icon-btn" id="btn-bag" type="button" aria-label="Open shopping bag">1368<svg viewBox="0 0 24 24">1369<path d="M6 7h12l1 13H5L6 7z"></path>1370<path d="M9 7V5a3 3 0 0 1 6 0v2"></path>1371</svg>1372<span class="bag-badge" id="bag-badge">0</span>1373</button>1374</div>1375</header>13761377<!-- 2. 3D WEBGL GALLERY -->1378<main id="gallery">1379<div id="veil"></div>1380</main>13811382<!-- 3. GALLERY OVERLAY UI -->1383<div class="gui" id="gui">1384<div class="gui-arrows">1385<button class="arrow-btn" id="btn-prev" type="button" aria-label="Previous print">1386<svg viewBox="0 0 24 24">1387<line x1="19" y1="12" x2="5" y2="12"></line>1388<polyline points="11 6 5 12 11 18"></polyline>1389</svg>1390</button>1391<button class="arrow-btn" id="btn-next" type="button" aria-label="Next print">1392<svg viewBox="0 0 24 24">1393<line x1="5" y1="12" x2="19" y2="12"></line>1394<polyline points="13 6 19 12 13 18"></polyline>1395</svg>1396</button>1397</div>13981399<div class="gui-hint" id="gui-hint">1400<span class="mask-line"><span class="mask-inner" id="hint-1">Scroll or drag to walk round</span></span>1401<span class="mask-line"><span class="mask-inner" id="hint-2">Click a painting to look closer</span></span>1402</div>14031404<div class="gui-toggle" role="tablist" aria-label="View mode">1405<button class="toggle-btn is-active" id="tog-gallery" type="button">GALLERY</button>1406<button class="toggle-btn" id="tog-list" type="button">LIST</button>1407</div>14081409<div class="gui-caption">1410<p class="caption-kicker">1411<span class="mask-line"><span class="mask-inner">YOU ARE WALKING PAST</span></span>1412</p>1413<h1 class="caption-title">1414<span class="mask-line"><span class="mask-inner">CITRUS SEASON</span></span>1415</h1>1416<button class="cta-enter" id="btn-enter" type="button">1417<span class="mask-line"><span class="mask-inner">ENTER THE COLLECTION →</span></span>1418</button>1419</div>1420</div>14211422<!-- 4. HOVER PILL -->1423<div id="open-pill">OPEN THE PRINT</div>14241425<!-- 5. PRINT PRODUCT PAGE -->1426<section id="page" aria-hidden="true">1427<div class="page-grid">1428<div class="page-left">1429<div id="page-art"></div>1430<div class="page-meta" id="page-meta">1431<span>1/1</span>1432<button class="meta-room" type="button" id="btn-view-room">1433<svg viewBox="0 0 24 24">1434<polygon points="12 3 20 7.5 20 16.5 12 21 4 16.5 4 7.5 12 3"></polygon>1435<polyline points="4 7.5 12 12 20 7.5"></polyline>1436<line x1="12" y1="12" x2="12" y2="21"></line>1437</svg>1438<span>View in room</span>1439</button>1440<button type="button" aria-label="Bookmark print" data-toast="Bookmarked print">1441<svg viewBox="0 0 24 24">1442<path d="M6 4h12v17l-6-4-6 4V4z"></path>1443</svg>1444</button>1445</div>1446</div>14471448<div class="page-right" id="page-right">1449<h2 class="p-title" id="p-title">LEMONS ON GINGHAM</h2>1450<p class="p-artist" id="p-artist">Tova Lindqvist</p>1451<p class="p-desc" id="p-desc"></p>1452<div class="p-price" id="p-price">$ 60.00</div>1453<p class="p-tax">Prices include VAT. Shipping calculated at checkout.</p>14541455<!-- Option 1: Paper -->1456<div class="opt-group" data-opt="paper">1457<div class="opt-label">PAPER: <span class="opt-val" id="val-paper">Art Paper</span></div>1458<div class="chip-row">1459<button type="button" class="chip is-on" data-value="Art Paper">Art Paper</button>1460<button type="button" class="chip" data-value="Fine Art Paper">Fine Art Paper</button>1461<button type="button" class="chip" data-value="Recycled Paper">Recycled Paper</button>1462</div>1463</div>14641465<!-- Option 2: Size -->1466<div class="opt-group" data-opt="size">1467<div class="opt-label">SIZE: <span class="opt-val" id="val-size">11.7 × 16.5" (A3)</span></div>1468<div class="chip-row">1469<button type="button" class="chip is-on" data-value='11.7 × 16.5" (A3)'>11.7 × 16.5" (A3)</button>1470<button type="button" class="chip" data-value='16.5 × 23.4" (A2)'>16.5 × 23.4" (A2)</button>1471<button type="button" class="chip" data-value='23.4 × 33.1" (A1)'>23.4 × 33.1" (A1)</button>1472<button type="button" class="chip" data-value='33.1 × 46.8" (A0)'>33.1 × 46.8" (A0)</button>1473</div>1474</div>14751476<!-- Option 3: Signature -->1477<div class="opt-group" data-opt="signature">1478<div class="opt-label">SIGNATURE: <span class="opt-val" id="val-signature">Unsigned</span></div>1479<div class="chip-row">1480<button type="button" class="chip is-on" data-value="Unsigned">Unsigned</button>1481<button type="button" class="chip" data-value="Signed and Numbered">Signed and Numbered</button>1482</div>1483</div>14841485<!-- Option 4: Frame -->1486<div class="opt-group" data-opt="frame">1487<div class="opt-label">FRAME: <span class="opt-val" id="val-frame">Unframed</span></div>1488<div class="chip-row">1489<button type="button" class="frame-chip is-on" data-value="Unframed">1490<span class="frame-thumb" id="fthumb-0"></span>1491<span>Unframed</span>1492</button>1493<button type="button" class="frame-chip" data-value="Classic Frame">1494<span class="frame-thumb is-classic" id="fthumb-1"></span>1495<span>Classic Frame</span>1496</button>1497<button type="button" class="frame-chip" data-value="Framed Canvas">1498<span class="frame-thumb is-canvas" id="fthumb-2"></span>1499<span>Framed Canvas</span>1500</button>1501</div>1502</div>15031504<!-- Quantity + Add to Bag -->1505<div class="buy-row">1506<div class="qty-stepper">1507<button type="button" id="qty-minus" aria-label="Decrease quantity">−</button>1508<span id="qty-val">1</span>1509<button type="button" id="qty-plus" aria-label="Increase quantity">+</button>1510</div>1511<button type="button" class="btn-add-bag" id="btn-add-bag">ADD TO BAG</button>1512</div>15131514<!-- Accordions -->1515<div class="accordions">1516<div class="acc-item">1517<button type="button" class="acc-trigger">1518<span>Paper & Sizes</span>1519<span class="acc-plus">+</span>1520</button>1521<div class="acc-panel">1522<div class="acc-body">1523Art Paper is a smooth 200 gsm matte stock. Fine Art Paper is a 310 gsm cotton rag with a soft texture. Recycled Paper is 100% post-consumer fibre.1524</div>1525</div>1526</div>15271528<div class="acc-item">1529<button type="button" class="acc-trigger">1530<span>Delivery Info</span>1531<span class="acc-plus">+</span>1532</button>1533<div class="acc-panel">1534<div class="acc-body">1535Prints are made to order and ship rolled in a tube within 3–5 working days. Framed pieces ship flat within 7–10 working days.1536</div>1537</div>1538</div>15391540<div class="acc-item">1541<button type="button" class="acc-trigger">1542<span>Returns Policy</span>1543<span class="acc-plus">+</span>1544</button>1545<div class="acc-panel">1546<div class="acc-body">1547Unframed prints can be returned within 30 days in their original tube. Signed editions are final sale.1548</div>1549</div>1550</div>1551</div>1552</div>1553</div>15541555<!-- Get The Collection Cross-Sell Band -->1556<div class="collection-band" id="collection-band">1557<h3 class="band-title">GET THE COLLECTION</h3>1558<div class="band-cards" id="band-cards"></div>1559</div>1560</section>15611562<!-- 6. LIST VIEW -->1563<section id="list" aria-hidden="true">1564<h2 class="list-title">CITRUS SEASON — ALL PRINTS</h2>1565<div class="list-grid" id="list-grid"></div>1566</section>15671568<!-- 7. BAG DRAWER -->1569<div id="drawer-backdrop"></div>1570<aside class="drawer" id="drawer" aria-label="Shopping bag">1571<div class="drawer-head">1572<h2 class="drawer-title">YOUR BAG</h2>1573<button type="button" class="drawer-close" id="btn-drawer-close" aria-label="Close bag">×</button>1574</div>15751576<div class="drawer-items" id="drawer-items"></div>15771578<div class="drawer-footer">1579<div class="subtotal-row">1580<span>Subtotal</span>1581<span id="bag-subtotal">$ 0.00</span>1582</div>1583<button type="button" class="btn-checkout" id="btn-checkout">CHECKOUT →</button>1584</div>1585</aside>15861587<div id="toast"></div>15881589<script type="module">1590import * as THREE from 'three';15911592/* =========================================================================15931. CATALOG & SPRITE SHEET DATA1594========================================================================= */1595const SHEET_URL =1596'https://images.higgs.ai/?default=1&output=webp&url=https%3A%2F%2Fd8j0ntlcm91z4.cloudfront.net%2Fuser_38xzZboKViGWJOttwIXH07lWA1P%2Fhf_20261120_071134_02d2d6ba-ed91-4c3f-87c4-1354b61b5882.png&w=1744&q=85';15971598const SHEET_W = 1744;1599const SHEET_H = 2336;1600const COLS = [1601[0, 575],1602[585, 1158],1603[1168, 1743],1604];1605const ROWS = [1606[0, 769],1607[779, 1545],1608[1555, 2335],1609];16101611const DESC_SUFFIX = ', painted in flat gouache tones. Printed on archival paper with a soft matte finish.';16121613const PRINTS = [1614{ id: 0, title: 'Lemons on Gingham', artist: 'Tova Lindqvist', year: 2024, price: 60, desc: 'A sunny tabletop of lemons, a striped jug and blue gingham' + DESC_SUFFIX },1615{ id: 1, title: 'Oranges & Stripe', artist: 'Elise Marten', year: 2024, price: 60, desc: 'A striped bowl heaped with oranges on a candy-stripe cloth' + DESC_SUFFIX },1616{ id: 2, title: 'Pink Blooms', artist: 'Soren Vale', year: 2023, price: 55, desc: 'Pink garden flowers in a cobalt striped jug against warm yellow' + DESC_SUFFIX },1617{ id: 3, title: 'Citrus Jug', artist: 'Nora Feldt', year: 2024, price: 60, desc: 'Leafy lemon branches in a striped jug on a sunlit table' + DESC_SUFFIX },1618{ id: 4, title: 'Teacup & Lemon', artist: 'Ada Kerrow', year: 2023, price: 50, desc: 'A blue-patterned teacup with a slice of lemon, all morning light' + DESC_SUFFIX },1619{ id: 5, title: 'Blood Orange Bowl', artist: 'Pim Halden', year: 2024, price: 60, desc: 'Halved blood oranges glowing in a white bowl on deep blue' + DESC_SUFFIX },1620{ id: 6, title: 'Lemon Tree, Window', artist: 'Ines Morrow', year: 2022, price: 65, desc: 'A potted lemon tree by an open window on a gingham table' + DESC_SUFFIX },1621{ id: 7, title: 'Grapefruit Halves', artist: 'Juno Basset', year: 2024, price: 55, desc: 'Pink grapefruit halves on a hand-painted checked plate' + DESC_SUFFIX },1622{ id: 8, title: 'Daisies in Stripes', artist: 'Wren Calloway', year: 2023, price: 55, desc: 'White daisies in a tall striped pitcher against blush pink' + DESC_SUFFIX },1623];16241625function getCropBox(i) {1626const col = i % 3;1627const row = Math.floor(i / 3);1628const [c0, c1] = COLS[col];1629const [r0, r1] = ROWS[row];1630return {1631x: c0 + 6,1632y: r0 + 6,1633w: c1 - c0 - 12,1634h: r1 - r0 - 12,1635};1636}16371638const CROPS = PRINTS.map((_, i) => getCropBox(i));16391640function applyDomCrop(el, printIndex) {1641if (!el) return;1642el.dataset.cropIdx = String(printIndex);1643const rect = el.getBoundingClientRect();1644const W = rect.width || el.offsetWidth || 168;1645const H = rect.height || el.offsetHeight || 224;1646const { x, y, w, h } = CROPS[printIndex];1647const sx = W / w;1648const sy = H / h;1649el.style.backgroundImage = `url("${SHEET_URL}")`;1650el.style.backgroundRepeat = 'no-repeat';1651el.style.backgroundSize = `${SHEET_W * sx}px ${SHEET_H * sy}px`;1652el.style.backgroundPosition = `${-x * sx}px ${-y * sy}px`;1653}16541655function refreshAllDomCrops() {1656document.querySelectorAll('[data-crop-idx]').forEach((el) => {1657const idx = Number(el.dataset.cropIdx);1658if (!Number.isNaN(idx)) applyDomCrop(el, idx);1659});1660}16611662/* =========================================================================16632. MEDIA QUERIES & STATE1664========================================================================= */1665const smallMQ = window.matchMedia(1666'(max-width: 819px), (orientation: portrait) and (max-width: 1100px), (orientation: landscape) and (max-height: 500px)'1667);1668const reducedMQ = window.matchMedia('(prefers-reduced-motion: reduce)');16691670const isSmall = () => smallMQ.matches;1671const isPortraitSmall = () => isSmall() && window.innerHeight > window.innerWidth;1672const isReduced = () => reducedMQ.matches;16731674const state = {1675view: 'gallery', // 'gallery' | 'page' | 'list'1676currentPrint: 0,1677lastViewedPrint: 0,1678options: {1679paper: 'Art Paper',1680size: '11.7 × 16.5" (A3)',1681signature: 'Unsigned',1682frame: 'Unframed',1683qty: 1,1684},1685bag: [],1686bagOpen: false,1687focusedMesh: null,1688hoveredMesh: null,1689pointerX: 0,1690pointerY: 0,1691};16921693/* =========================================================================16943. THREE.JS CURVED GALLERY SCENE1695========================================================================= */1696const galleryEl = document.getElementById('gallery');1697const renderer = new THREE.WebGLRenderer({ antialias: true });1698renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));1699renderer.setSize(window.innerWidth, window.innerHeight);1700renderer.outputColorSpace = THREE.SRGBColorSpace;1701renderer.toneMapping = THREE.NoToneMapping;1702galleryEl.appendChild(renderer.domElement);17031704const scene = new THREE.Scene();1705scene.background = new THREE.Color('#FFF9EC');1706scene.fog = new THREE.Fog('#FFF9EC', 10, 46);17071708const camera = new THREE.PerspectiveCamera(1709window.innerWidth >= window.innerHeight ? 56 : 70,1710window.innerWidth / window.innerHeight,17110.05,17121001713);17141715// Reference lights (scene uses MeshBasicMaterial as specified)1716scene.add(new THREE.HemisphereLight(0xfffdf6, 0xe9cfa6, 1.55));1717scene.add(new THREE.AmbientLight(0xfff6e6, 0.55));17181719// Procedural Gradient Textures1720function makeVerticalGradient(stops) {1721const c = document.createElement('canvas');1722c.width = 4;1723c.height = 256;1724const ctx = c.getContext('2d');1725const g = ctx.createLinearGradient(0, 0, 0, 256);1726stops.forEach(([pos, col]) => g.addColorStop(pos, col));1727ctx.fillStyle = g;1728ctx.fillRect(0, 0, 4, 256);1729const tex = new THREE.CanvasTexture(c);1730tex.colorSpace = THREE.SRGBColorSpace;1731return tex;1732}17331734function makeFloorTexture() {1735const c = document.createElement('canvas');1736c.width = 1024;1737c.height = 1024;1738const ctx = c.getContext('2d');1739const rInPx = 512 * (12.2 / 18);1740const g = ctx.createRadialGradient(512, 512, rInPx, 512, 512, 512);1741g.addColorStop(0, '#EDD6B0');1742g.addColorStop(0.55, '#F3E1C3');1743g.addColorStop(1, '#EFDAB8');1744ctx.fillStyle = '#EDD6B0';1745ctx.fillRect(0, 0, 1024, 1024);1746ctx.fillStyle = g;1747ctx.beginPath();1748ctx.arc(512, 512, 512, 0, Math.PI * 2);1749ctx.fill();1750const tex = new THREE.CanvasTexture(c);1751tex.colorSpace = THREE.SRGBColorSpace;1752return tex;1753}17541755function makeRadialGlow(innerColor, outerColor, solidStop) {1756const c = document.createElement('canvas');1757c.width = 256;1758c.height = 256;1759const ctx = c.getContext('2d');1760const g = ctx.createRadialGradient(128, 128, 0, 128, 128, 128);1761g.addColorStop(0, innerColor);1762g.addColorStop(solidStop, innerColor);1763g.addColorStop(1, outerColor);1764ctx.fillStyle = g;1765ctx.fillRect(0, 0, 256, 256);1766const tex = new THREE.CanvasTexture(c);1767tex.colorSpace = THREE.SRGBColorSpace;1768return tex;1769}17701771const R_OUT = 18;1772const R_IN = 12.2;1773const WALL_H = 6.2;17741775// Outer Wall1776const outerWall = new THREE.Mesh(1777new THREE.CylinderGeometry(R_OUT, R_OUT, WALL_H, 160, 1, true),1778new THREE.MeshBasicMaterial({1779map: makeVerticalGradient([1780[0, '#F5EBD8'],1781[0.2, '#FBF3E3'],1782[0.6, '#FBF3E3'],1783[0.86, '#F8EDD9'],1784[1, '#EFDFC4'],1785]),1786side: THREE.BackSide,1787})1788);1789outerWall.position.y = WALL_H / 2;1790scene.add(outerWall);17911792// Inner Pillar1793const innerPillar = new THREE.Mesh(1794new THREE.CylinderGeometry(R_IN, R_IN, WALL_H, 120, 1, true),1795new THREE.MeshBasicMaterial({1796map: makeVerticalGradient([1797[0, '#F7EEDD'],1798[0.3, '#FFFAF0'],1799[0.8, '#FDF5E6'],1800[1, '#F1E1C6'],1801]),1802side: THREE.FrontSide,1803})1804);1805innerPillar.position.y = WALL_H / 2;1806scene.add(innerPillar);18071808// Floor1809const floor = new THREE.Mesh(1810new THREE.CircleGeometry(R_OUT, 160),1811new THREE.MeshBasicMaterial({ map: makeFloorTexture() })1812);1813floor.rotation.x = -Math.PI / 2;1814scene.add(floor);18151816// Ceiling1817const ceiling = new THREE.Mesh(1818new THREE.CircleGeometry(R_OUT, 160),1819new THREE.MeshBasicMaterial({ color: '#FAF1E0', side: THREE.BackSide })1820);1821ceiling.rotation.x = -Math.PI / 2;1822ceiling.position.y = WALL_H;1823scene.add(ceiling);18241825// Shared Halo, Shadow & Frame Geometries1826const PW = 1.36;1827const PH = PW * (763 / 567);1828const PY = 1.95;18291830const haloMat = new THREE.MeshBasicMaterial({1831map: makeRadialGlow('rgba(255,255,255,0.95)', 'rgba(255,255,255,0)', 0.35),1832transparent: true,1833depthWrite: false,1834fog: true,1835});1836const shadowMat = new THREE.MeshBasicMaterial({1837map: makeRadialGlow('rgba(120,90,50,0.28)', 'rgba(120,90,50,0)', 0.25),1838transparent: true,1839depthWrite: false,1840fog: true,1841});1842const frameMat = new THREE.MeshBasicMaterial({ color: '#D3AA72' });18431844const haloGeo = new THREE.PlaneGeometry(2.1 * PW, 1.75 * PH);1845const shadowGeo = new THREE.PlaneGeometry(1.25 * PW, 1.18 * PH);1846const frameGeo = new THREE.BoxGeometry(PW + 0.07, PH + 0.07, 0.06);1847const artGeo = new THREE.PlaneGeometry(PW, PH);1848const labelGeo = new THREE.PlaneGeometry(0.92, 0.92 * (260 / 640));18491850// Create 9 placeholder print materials (populated once sheet loads)1851const printMats = PRINTS.map(() => new THREE.MeshBasicMaterial({ color: '#f4ead8' }));1852const labelCanvases = [];1853const labelTextures = [];18541855function drawLabelCanvas(canvas, print) {1856const ctx = canvas.getContext('2d');1857ctx.clearRect(0, 0, 640, 260);1858ctx.fillStyle = '#3A3550';1859ctx.textBaseline = 'alphabetic';18601861ctx.font = '500 58px "Newsreader", Georgia, serif';1862ctx.fillText(print.artist, 30, 82);18631864ctx.font = 'italic 400 54px "Newsreader", Georgia, serif';1865ctx.fillText(print.title, 30, 150);18661867ctx.fillStyle = 'rgba(58, 53, 80, 0.7)';1868ctx.font = '400 30px "DM Mono", monospace';1869ctx.fillText(`${print.year} · PRINT`, 30, 215);1870}18711872PRINTS.forEach((p) => {1873const c = document.createElement('canvas');1874c.width = 640;1875c.height = 260;1876drawLabelCanvas(c, p);1877const tex = new THREE.CanvasTexture(c);1878tex.colorSpace = THREE.SRGBColorSpace;1879labelCanvases.push(c);1880labelTextures.push(tex);1881});18821883const labelMats = labelTextures.map(1884(tex) =>1885new THREE.MeshBasicMaterial({1886map: tex,1887transparent: true,1888depthWrite: false,1889fog: true,1890})1891);18921893const interactivePrintMeshes = [];1894const outerPrintEntries = [];18951896function createPrintGroup(printIdx, theta, wallType) {1897const group = new THREE.Group();18981899const halo = new THREE.Mesh(haloGeo, haloMat);1900halo.position.set(0, PY + 0.05, 0.005);1901group.add(halo);19021903const shadow = new THREE.Mesh(shadowGeo, shadowMat);1904shadow.position.set(0.05, PY - 0.06, 0.01);1905group.add(shadow);19061907const frame = new THREE.Mesh(frameGeo, frameMat);1908frame.position.set(0, PY, 0.045);1909group.add(frame);19101911const artMesh = new THREE.Mesh(artGeo, printMats[printIdx]);1912artMesh.position.set(0, PY, 0.077);1913artMesh.userData = { printIdx, theta, wall: wallType };1914group.add(artMesh);1915interactivePrintMeshes.push(artMesh);19161917const labelMesh = new THREE.Mesh(labelGeo, labelMats[printIdx]);1918labelMesh.position.set(-PW / 2 + 0.46, PY - PH / 2 - 0.42, 0.02);1919group.add(labelMesh);19201921if (wallType === 'outer') {1922group.position.set(17.98 * Math.cos(theta), 0, 17.98 * Math.sin(theta));1923group.lookAt(0, 0, 0);1924outerPrintEntries.push({ printIdx, theta, mesh: artMesh });1925} else {1926group.position.set(12.22 * Math.cos(theta), 0, 12.22 * Math.sin(theta));1927group.lookAt(24.44 * Math.cos(theta), 0, 24.44 * Math.sin(theta));1928}19291930scene.add(group);1931return artMesh;1932}19331934// 36 Outer Wall Prints1935for (let s = 0; s < 36; s++) {1936const theta = (s * 2 * Math.PI) / 36;1937createPrintGroup(s % 9, theta, 'outer');1938}19391940// 24 Inner Pillar Prints1941for (let k = 0; k < 24; k++) {1942const theta = ((k + 0.5) * 2 * Math.PI) / 24;1943createPrintGroup((k + 4) % 9, theta, 'inner');1944}19451946/* =========================================================================19474. CAMERA POSE & GLIDE SYSTEM1948========================================================================= */1949const getWalkOffsetD = () =>1950isPortraitSmall() ? 0.14 + 0.9 * ((2 * Math.PI) / 36) : 0.14;19511952function getWalkPoseParams() {1953if (isPortraitSmall()) {1954return { r: 15.4, yaw: -0.42, y: 1.9, pitch: -0.1 };1955}1956return { r: 15.6, yaw: -0.3, y: 1.92, pitch: -0.12 };1957}19581959function getFocusPoseParams(wall) {1960if (isPortraitSmall()) {1961return wall === 'outer'1962? { r: 18 - 5.2, yaw: Math.PI / 2, y: PY - 1.05, pitch: 0 }1963: { r: 12.2 + 5.2, yaw: -Math.PI / 2, y: PY - 1.05, pitch: 0 };1964}1965return wall === 'outer'1966? { r: 18 - 4.26, yaw: Math.PI / 2, y: PY - 0.52, pitch: 0 }1967: { r: 12.2 + 4.26, yaw: -Math.PI / 2, y: PY - 0.52, pitch: 0 };1968}19691970const walkInit = getWalkPoseParams();1971const camState = {1972th: getWalkOffsetD(),1973targetTh: getWalkOffsetD(),1974r: walkInit.r,1975yaw: walkInit.yaw,1976y: walkInit.y,1977pitch: walkInit.pitch,1978};19791980let glide = null; // { active, elapsed, duration, from, to, onDone }1981let introCam = null; // { active, elapsed, duration, fromTh, toTh, fromR, toR }19821983function applyCameraPose() {1984const { th, r, yaw, y, pitch } = camState;1985const px = r * Math.cos(th);1986const pz = r * Math.sin(th);1987camera.position.set(px, y, pz);19881989const tx = Math.sin(th);1990const tz = -Math.cos(th);1991const nx = Math.cos(th);1992const nz = Math.sin(th);19931994const dx = Math.cos(yaw) * tx + Math.sin(yaw) * nx;1995const dz = Math.cos(yaw) * tz + Math.sin(yaw) * nz;1996camera.lookAt(px + dx, y + pitch, pz + dz);1997}19981999function shortestAngleNear(targetAngle, referenceAngle) {2000return referenceAngle + Math.atan2(Math.sin(targetAngle - referenceAngle), Math.cos(targetAngle - referenceAngle));2001}20022003const hint1El = document.getElementById('hint-1');2004const hint2El = document.getElementById('hint-2');20052006function setHintMode(focused) {2007if (focused) {2008hint1El.textContent = 'Click the painting to open it';2009hint2El.textContent = 'Esc or click away to step back';2010} else {2011hint1El.textContent = 'Scroll or drag to walk round';2012hint2El.textContent = 'Click a painting to look closer';2013}2014}20152016function startFocusGlide(mesh) {2017const { theta, wall, printIdx } = mesh.userData;2018state.focusedMesh = mesh;2019state.lastViewedPrint = printIdx;2020setHintMode(true);20212022const goalTh = shortestAngleNear(theta, camState.th);2023const targetPose = getFocusPoseParams(wall);2024const dur = isReduced() ? 0 : 0.95;20252026if (dur === 0) {2027camState.th = camState.targetTh = goalTh;2028Object.assign(camState, targetPose);2029glide = null;2030return;2031}20322033glide = {2034elapsed: 0,2035duration: dur,2036from: {2037th: camState.th,2038r: camState.r,2039yaw: camState.yaw,2040y: camState.y,2041pitch: camState.pitch,2042},2043to: {2044th: goalTh,2045...targetPose,2046},2047};2048}20492050function stepBackToWalk() {2051if (!state.focusedMesh) return;2052state.focusedMesh = null;2053setHintMode(false);2054hideOpenPill();20552056const D = getWalkOffsetD();2057const goalTh = camState.th + D;2058const walkPose = getWalkPoseParams();2059const dur = isReduced() ? 0 : 0.95;20602061camState.targetTh = goalTh;2062if (dur === 0) {2063camState.th = goalTh;2064Object.assign(camState, walkPose);2065glide = null;2066return;2067}20682069glide = {2070elapsed: 0,2071duration: dur,2072from: {2073th: camState.th,2074r: camState.r,2075yaw: camState.yaw,2076y: camState.y,2077pitch: camState.pitch,2078},2079to: {2080th: goalTh,2081...walkPose,2082},2083};2084}20852086/* =========================================================================20875. RAYCASTING & PROJECTED SCREEN RECTANGLE2088========================================================================= */2089const raycaster = new THREE.Raycaster();2090const pointerNDC = new THREE.Vector2();2091const openPillEl = document.getElementById('open-pill');20922093function getMeshScreenRect(mesh) {2094mesh.updateWorldMatrix(true, false);2095const hw = PW / 2;2096const hh = PH / 2;2097const localCorners = [2098new THREE.Vector3(-hw, -hh, 0),2099new THREE.Vector3(hw, -hh, 0),2100new THREE.Vector3(hw, hh, 0),2101new THREE.Vector3(-hw, hh, 0),2102];2103let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;2104const vw = window.innerWidth;2105const vh = window.innerHeight;21062107for (const c of localCorners) {2108c.applyMatrix4(mesh.matrixWorld);2109c.project(camera);2110const sx = (c.x * 0.5 + 0.5) * vw;2111const sy = (-c.y * 0.5 + 0.5) * vh;2112if (sx < minX) minX = sx;2113if (sx > maxX) maxX = sx;2114if (sy < minY) minY = sy;2115if (sy > maxY) maxY = sy;2116}2117return {2118left: minX,2119top: minY,2120width: Math.max(10, maxX - minX),2121height: Math.max(10, maxY - minY),2122};2123}21242125function hideOpenPill() {2126openPillEl.classList.remove('is-visible');2127}21282129function updateOpenPill() {2130if (state.view !== 'gallery' || !state.focusedMesh) {2131hideOpenPill();2132return;2133}2134if (isSmall()) {2135const rect = getMeshScreenRect(state.focusedMesh);2136openPillEl.style.left = `${rect.left + rect.width * 0.5}px`;2137openPillEl.style.top = `${rect.top + rect.height * 0.55}px`;2138openPillEl.classList.add('is-visible');2139} else if (state.hoveredMesh === state.focusedMesh) {2140openPillEl.style.left = `${state.pointerX}px`;2141openPillEl.style.top = `${state.pointerY}px`;2142openPillEl.classList.add('is-visible');2143} else {2144hideOpenPill();2145}2146}21472148function pickPrintAt(clientX, clientY) {2149pointerNDC.x = (clientX / window.innerWidth) * 2 - 1;2150pointerNDC.y = -(clientY / window.innerHeight) * 2 + 1;2151raycaster.setFromCamera(pointerNDC, camera);2152const hits = raycaster.intersectObjects(interactivePrintMeshes, false);2153return hits.length > 0 ? hits[0].object : null;2154}21552156/* =========================================================================21576. NAVIGATION & INPUT LISTENERS (WHEEL, DRAG, KEYS, ARROWS)2158========================================================================= */2159galleryEl.addEventListener(2160'wheel',2161(e) => {2162if (state.view !== 'gallery') return;2163e.preventDefault();2164if (state.focusedMesh) {2165stepBackToWalk();2166}2167const dy = e.deltaMode === 1 ? e.deltaY * 33 : e.deltaY;2168camState.targetTh -= dy * 0.0016;2169},2170{ passive: false }2171);21722173let pointerDown = false;2174let dragged = false;2175let downX = 0;2176let downY = 0;2177let downTargetTh = 0;21782179galleryEl.addEventListener('pointerdown', (e) => {2180if (state.view !== 'gallery') return;2181pointerDown = true;2182dragged = false;2183downX = e.clientX;2184downY = e.clientY;2185downTargetTh = camState.targetTh;2186});21872188window.addEventListener('pointermove', (e) => {2189state.pointerX = e.clientX;2190state.pointerY = e.clientY;21912192if (pointerDown && state.view === 'gallery') {2193const dx = e.clientX - downX;2194const dy = e.clientY - downY;2195if (!dragged && Math.hypot(dx, dy) > 6) {2196dragged = true;2197galleryEl.classList.add('is-dragging');2198if (state.focusedMesh) {2199stepBackToWalk();2200downTargetTh = camState.targetTh;2201}2202}2203if (dragged) {2204const delta = Math.abs(dx) > Math.abs(dy) ? dx : dy;2205const sens = isSmall() ? 0.0042 : 0.0022;2206camState.targetTh = downTargetTh + delta * sens;2207}2208} else if (state.view === 'gallery' && !isSmall()) {2209const hit = pickPrintAt(e.clientX, e.clientY);2210state.hoveredMesh = hit;2211galleryEl.classList.toggle('is-hovering', Boolean(hit));2212updateOpenPill();2213}2214});22152216window.addEventListener('pointerup', (e) => {2217if (!pointerDown) return;2218pointerDown = false;2219galleryEl.classList.remove('is-dragging');22202221if (!dragged && state.view === 'gallery') {2222const hit = pickPrintAt(e.clientX, e.clientY);2223if (hit) {2224if (state.focusedMesh === hit) {2225const srcRect = getMeshScreenRect(hit);2226openPrintPage(hit.userData.printIdx, srcRect);2227} else {2228startFocusGlide(hit);2229}2230} else if (state.focusedMesh) {2231stepBackToWalk();2232}2233}2234});22352236function stepSlot(dir) {2237if (state.view !== 'gallery') return;2238if (state.focusedMesh) {2239stepBackToWalk();2240}2241const STEP = (2 * Math.PI) / 36;2242const D = getWalkOffsetD();2243camState.targetTh = (Math.round((camState.targetTh - D) / STEP) - dir) * STEP + D;2244}22452246document.getElementById('btn-prev').addEventListener('click', () => stepSlot(-1));2247document.getElementById('btn-next').addEventListener('click', () => stepSlot(1));22482249window.addEventListener('keydown', (e) => {2250if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {2251e.preventDefault();2252openListView();2253return;2254}22552256if (e.key === 'Escape') {2257if (state.bagOpen) {2258closeBagDrawer();2259return;2260}2261if (state.view === 'page' || state.view === 'list') {2262returnToGallery();2263return;2264}2265if (state.focusedMesh) {2266stepBackToWalk();2267}2268return;2269}22702271if (state.view === 'gallery' && !state.bagOpen) {2272if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {2273e.preventDefault();2274stepSlot(1);2275} else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {2276e.preventDefault();2277stepSlot(-1);2278}2279}2280});22812282/* =========================================================================22837. PRODUCT PAGE, FLIP FLYER, LIST VIEW & BAG DRAWER2284========================================================================= */2285const navEl = document.getElementById('main-nav');2286const guiEl = document.getElementById('gui');2287const pageEl = document.getElementById('page');2288const listEl = document.getElementById('list');2289const pageArtEl = document.getElementById('page-art');2290const pageMetaEl = document.getElementById('page-meta');2291const pageRightEl = document.getElementById('page-right');2292const bandEl = document.getElementById('collection-band');22932294let revealTimer = null;22952296function syncUIStates() {2297const overlayOpen = state.view === 'page' || state.view === 'list';2298navEl.classList.toggle('is-solid', overlayOpen);2299guiEl.classList.toggle('is-hidden', overlayOpen);2300document.getElementById('tog-gallery').classList.toggle('is-active', state.view === 'gallery');2301document.getElementById('tog-list').classList.toggle('is-active', state.view === 'list');2302if (overlayOpen) hideOpenPill();2303}23042305function createCardElement(printIdx) {2306const p = PRINTS[printIdx];2307const card = document.createElement('article');2308card.className = 'print-card';2309card.innerHTML = `2310<div class="card-art"></div>2311<div class="card-title">${p.title}</div>2312<div class="card-artist">${p.artist}</div>2313<div class="card-price">$ ${p.price.toFixed(2)}</div>2314`;2315const art = card.querySelector('.card-art');2316requestAnimationFrame(() => applyDomCrop(art, printIdx));2317card.addEventListener('click', () => {2318const srcRect = art.getBoundingClientRect();2319openPrintPage(printIdx, srcRect);2320});2321return card;2322}23232324function renderListGrid() {2325const grid = document.getElementById('list-grid');2326grid.innerHTML = '';2327PRINTS.forEach((_, idx) => grid.appendChild(createCardElement(idx)));2328}23292330function renderCollectionBand(currentIdx) {2331const container = document.getElementById('band-cards');2332container.innerHTML = '';2333for (let offset = 0; offset < 4; offset++) {2334const idx = (currentIdx + offset) % 9;2335container.appendChild(createCardElement(idx));2336}2337}23382339function resetProductOptions() {2340state.options = {2341paper: 'Art Paper',2342size: '11.7 × 16.5" (A3)',2343signature: 'Unsigned',2344frame: 'Unframed',2345qty: 1,2346};2347document.getElementById('qty-val').textContent = '1';2348document.querySelectorAll('.opt-group').forEach((grp) => {2349const key = grp.dataset.opt;2350const val = state.options[key];2351grp.querySelector('.opt-val').textContent = val;2352grp.querySelectorAll('button').forEach((btn) => {2353btn.classList.toggle('is-on', btn.dataset.value === val);2354});2355});2356}23572358function openPrintPage(printIdx, srcRect) {2359clearTimeout(revealTimer);2360state.currentPrint = printIdx;2361state.lastViewedPrint = printIdx;2362state.view = 'page';23632364const p = PRINTS[printIdx];2365document.getElementById('p-title').textContent = p.title;2366document.getElementById('p-artist').textContent = p.artist;2367document.getElementById('p-desc').textContent = p.desc;2368document.getElementById('p-price').textContent = `$ ${p.price.toFixed(2)}`;2369resetProductOptions();2370renderCollectionBand(printIdx);23712372// Hide elements prior to FLIP & 1000ms staggered reveal2373pageArtEl.classList.remove('is-ready');2374pageMetaEl.classList.remove('is-revealed');2375pageRightEl.classList.remove('is-revealed');2376bandEl.classList.remove('is-revealed');23772378listEl.classList.remove('is-open');2379listEl.setAttribute('aria-hidden', 'true');2380pageEl.classList.add('is-open');2381pageEl.setAttribute('aria-hidden', 'false');2382pageEl.scrollTo({ top: 0, behavior: isReduced() ? 'auto' : 'smooth' });2383syncUIStates();23842385requestAnimationFrame(() => {2386applyDomCrop(pageArtEl, printIdx);2387[0, 1, 2].forEach((n) => applyDomCrop(document.getElementById(`fthumb-${n}`), printIdx));23882389const dstRect = pageArtEl.getBoundingClientRect();2390const flyDur = isReduced() ? 0 : 300;23912392if (srcRect && flyDur > 0 && dstRect.width > 0) {2393const flyer = document.createElement('div');2394flyer.className = 'flyer';2395flyer.style.width = `${dstRect.width}px`;2396flyer.style.height = `${dstRect.height}px`;2397document.body.appendChild(flyer);2398applyDomCrop(flyer, printIdx);23992400const dx = srcRect.left - dstRect.left;2401const dy = srcRect.top - dstRect.top;2402const sx = srcRect.width / dstRect.width;2403const sy = srcRect.height / dstRect.height;24042405const anim = flyer.animate(2406[2407{ transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },2408{ transform: 'translate(0px, 0px) scale(1, 1)' },2409],2410{2411duration: flyDur,2412easing: 'cubic-bezier(0.25, 0.75, 0.25, 1)',2413fill: 'forwards',2414}2415);24162417anim.onfinish = () => {2418pageArtEl.classList.add('is-ready');2419flyer.remove();2420};2421} else {2422pageArtEl.classList.add('is-ready');2423}2424});24252426const detailDelay = isReduced() ? 0 : 1000;2427revealTimer = setTimeout(() => {2428pageMetaEl.classList.add('is-revealed');2429pageRightEl.classList.add('is-revealed');2430bandEl.classList.add('is-revealed');2431}, detailDelay);2432}24332434function openListView() {2435clearTimeout(revealTimer);2436state.view = 'list';2437pageEl.classList.remove('is-open');2438pageEl.setAttribute('aria-hidden', 'true');2439listEl.classList.add('is-open');2440listEl.setAttribute('aria-hidden', 'false');2441listEl.scrollTop = 0;2442syncUIStates();2443requestAnimationFrame(refreshAllDomCrops);2444}24452446function returnToGallery() {2447clearTimeout(revealTimer);2448state.view = 'gallery';2449pageEl.classList.remove('is-open');2450pageEl.setAttribute('aria-hidden', 'true');2451listEl.classList.remove('is-open');2452listEl.setAttribute('aria-hidden', 'true');2453syncUIStates();24542455// Find nearest outer-wall copy of lastViewedPrint and glide to focus on it2456const candidates = outerPrintEntries.filter((e) => e.printIdx === state.lastViewedPrint);2457if (candidates.length > 0) {2458let best = candidates[0];2459let bestDist = Infinity;2460for (const c of candidates) {2461const nearTh = shortestAngleNear(c.theta, camState.th);2462const dist = Math.abs(nearTh - camState.th);2463if (dist < bestDist) {2464bestDist = dist;2465best = c;2466}2467}2468startFocusGlide(best.mesh);2469}2470}24712472// Option Chips2473document.querySelectorAll('.opt-group').forEach((grp) => {2474const key = grp.dataset.opt;2475const valEl = grp.querySelector('.opt-val');2476grp.querySelectorAll('button').forEach((btn) => {2477btn.addEventListener('click', () => {2478const val = btn.dataset.value;2479state.options[key] = val;2480valEl.textContent = val;2481grp.querySelectorAll('button').forEach((b) => b.classList.toggle('is-on', b === btn));2482});2483});2484});24852486// Quantity Stepper (1..9)2487document.getElementById('qty-minus').addEventListener('click', () => {2488if (state.options.qty > 1) {2489state.options.qty -= 1;2490document.getElementById('qty-val').textContent = String(state.options.qty);2491}2492});2493document.getElementById('qty-plus').addEventListener('click', () => {2494if (state.options.qty < 9) {2495state.options.qty += 1;2496document.getElementById('qty-val').textContent = String(state.options.qty);2497}2498});24992500// Accordions2501document.querySelectorAll('.acc-item').forEach((item) => {2502const trigger = item.querySelector('.acc-trigger');2503const panel = item.querySelector('.acc-panel');2504trigger.addEventListener('click', () => {2505const willOpen = !item.classList.contains('is-open');2506item.classList.toggle('is-open', willOpen);2507panel.style.height = willOpen ? `${panel.scrollHeight}px` : '0px';2508});2509});25102511// Shopping Bag Drawer Logic2512const drawerEl = document.getElementById('drawer');2513const backdropEl = document.getElementById('drawer-backdrop');2514const drawerItemsEl = document.getElementById('drawer-items');2515const badgeEl = document.getElementById('bag-badge');2516const subtotalEl = document.getElementById('bag-subtotal');25172518function openBagDrawer() {2519state.bagOpen = true;2520drawerEl.classList.add('is-open');2521backdropEl.classList.add('is-open');2522}25232524function closeBagDrawer() {2525state.bagOpen = false;2526drawerEl.classList.remove('is-open');2527backdropEl.classList.remove('is-open');2528}25292530function renderBag(animateKey = null) {2531const totalQty = state.bag.reduce((sum, item) => sum + item.qty, 0);2532const subtotal = state.bag.reduce((sum, item) => sum + PRINTS[item.printIdx].price * item.qty, 0);25332534badgeEl.textContent = String(totalQty);2535badgeEl.classList.toggle('has-items', totalQty > 0);2536subtotalEl.textContent = `$ ${subtotal.toFixed(2)}`;25372538drawerItemsEl.innerHTML = '';2539if (state.bag.length === 0) {2540drawerItemsEl.innerHTML = '<div class="drawer-empty">YOUR BAG IS EMPTY</div>';2541return;2542}25432544state.bag.forEach((item, idx) => {2545const p = PRINTS[item.printIdx];2546const row = document.createElement('div');2547row.className = 'bag-row';2548if (animateKey && item.key === animateKey && !isReduced()) {2549row.classList.add('is-entering');2550}2551row.innerHTML = `2552<div class="bag-thumb"></div>2553<div class="bag-info">2554<div class="bag-title">${p.title}</div>2555<div class="bag-artist">${p.artist}</div>2556<div class="bag-meta">${item.size} · ${item.frame}</div>2557<div class="bag-meta">$ ${(p.price * item.qty).toFixed(2)}</div>2558<div class="bag-controls">2559<div class="mini-qty">2560<button type="button" data-q="-1" aria-label="Decrease">−</button>2561<span>${item.qty}</span>2562<button type="button" data-q="1" aria-label="Increase">+</button>2563</div>2564<button type="button" class="btn-trash" aria-label="Remove item">2565<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6">2566<polyline points="3 6 5 6 21 6"></polyline>2567<path d="M19 6l-1 14H6L5 6"></path>2568<path d="M10 11v6"></path>2569<path d="M14 11v6"></path>2570</svg>2571</button>2572</div>2573</div>2574`;2575const thumb = row.querySelector('.bag-thumb');2576requestAnimationFrame(() => applyDomCrop(thumb, item.printIdx));25772578row.querySelector('[data-q="-1"]').addEventListener('click', () => {2579if (item.qty > 1) {2580item.qty -= 1;2581} else {2582state.bag.splice(idx, 1);2583}2584renderBag();2585});2586row.querySelector('[data-q="1"]').addEventListener('click', () => {2587if (item.qty < 9) {2588item.qty += 1;2589renderBag();2590}2591});2592row.querySelector('.btn-trash').addEventListener('click', () => {2593state.bag.splice(idx, 1);2594renderBag();2595});25962597drawerItemsEl.appendChild(row);25982599if (row.classList.contains('is-entering')) {2600setTimeout(() => {2601row.classList.remove('is-entering');2602}, 750);2603}2604});2605}26062607document.getElementById('btn-add-bag').addEventListener('click', () => {2608const { paper, size, signature, frame, qty } = state.options;2609const key = `${state.currentPrint}|${paper}|${size}|${signature}|${frame}`;2610const existing = state.bag.find((i) => i.key === key);2611if (existing) {2612existing.qty = Math.min(9, existing.qty + qty);2613} else {2614state.bag.push({2615key,2616printIdx: state.currentPrint,2617paper,2618size,2619signature,2620frame,2621qty,2622});2623}2624openBagDrawer();2625renderBag(key);2626});26272628// Global Button Bindings2629document.getElementById('btn-logo').addEventListener('click', returnToGallery);2630document.getElementById('tog-gallery').addEventListener('click', returnToGallery);2631document.getElementById('tog-list').addEventListener('click', openListView);2632document.getElementById('btn-enter').addEventListener('click', openListView);2633document.getElementById('btn-search').addEventListener('click', openListView);2634document.getElementById('btn-view-room').addEventListener('click', returnToGallery);2635document.getElementById('btn-bag').addEventListener('click', openBagDrawer);2636document.getElementById('btn-drawer-close').addEventListener('click', closeBagDrawer);2637backdropEl.addEventListener('click', closeBagDrawer);26382639document.querySelectorAll('.nav-links button').forEach((btn) => {2640btn.addEventListener('click', () => {2641const act = btn.dataset.action;2642if (act === 'gallery') returnToGallery();2643else openListView();2644});2645});26462647let toastTimer = null;2648function showToast(msg) {2649const t = document.getElementById('toast');2650t.textContent = msg;2651t.classList.add('is-shown');2652clearTimeout(toastTimer);2653toastTimer = setTimeout(() => t.classList.remove('is-shown'), 2400);2654}26552656document.querySelectorAll('[data-toast]').forEach((el) => {2657el.addEventListener('click', () => showToast(el.dataset.toast));2658});26592660document.getElementById('btn-checkout').addEventListener('click', () => {2661if (state.bag.length === 0) {2662showToast('Your bag is currently empty');2663} else {2664showToast('Proceeding to Zestwell Studio checkout…');2665}2666});26672668/* =========================================================================26698. ASSET LOADING, OPENING ENTRANCE & RENDER LOOP2670========================================================================= */2671let introStarted = false;26722673function runOpeningAnimation() {2674if (introStarted) return;2675introStarted = true;26762677// Redraw crisp 3D labels once webfonts are active2678PRINTS.forEach((p, i) => {2679drawLabelCanvas(labelCanvases[i], p);2680labelTextures[i].needsUpdate = true;2681});26822683const veil = document.getElementById('veil');2684if (isReduced()) {2685veil.style.display = 'none';2686return;2687}26882689// 1. Veil fade (0ms delay, 900ms ease-out)2690veil.animate([{ opacity: 1 }, { opacity: 0 }], {2691duration: 900,2692easing: 'ease-out',2693fill: 'forwards',2694}).onfinish = () => {2695veil.style.display = 'none';2696};26972698// 2. Camera step-in (0ms delay, 1400ms expo-out)2699const D = getWalkOffsetD();2700const wp = getWalkPoseParams();2701introCam = {2702elapsed: 0,2703duration: 1.4,2704fromTh: D + 0.16,2705toTh: D,2706fromR: wp.r - 0.35,2707toR: wp.r,2708};2709camState.th = introCam.fromTh;2710camState.targetTh = introCam.toTh;2711camState.r = introCam.fromR;27122713// 3. Staggered text lines + nav children2714const maskItems = Array.from(document.querySelectorAll('.gui .mask-inner'));2715const navItems = Array.from(document.querySelectorAll('header.nav > *'));27162717maskItems.forEach((el, i) => {2718el.animate(2719[{ transform: 'translateY(105%)' }, { transform: 'translateY(0%)' }],2720{2721duration: 1000,2722delay: 250 + i * 60,2723easing: 'cubic-bezier(0.2, 0.7, 0.2, 1)',2724fill: 'backwards',2725}2726);2727});27282729navItems.forEach((el, idx) => {2730const i = maskItems.length + idx;2731el.animate([{ opacity: 0 }, { opacity: 1 }], {2732duration: 1000,2733delay: 250 + i * 60,2734easing: 'cubic-bezier(0.2, 0.7, 0.2, 1)',2735fill: 'backwards',2736});2737});2738}27392740// Load Artwork Sprite Sheet2741const sheetPromise = new Promise((resolve) => {2742const img = new Image();2743img.crossOrigin = 'anonymous';2744img.onload = () => {2745const baseTex = new THREE.Texture(img);2746baseTex.colorSpace = THREE.SRGBColorSpace;2747baseTex.needsUpdate = true;2748const maxAniso = renderer.capabilities.getMaxAnisotropy();27492750CROPS.forEach(({ x, y, w, h }, i) => {2751const tex = baseTex.clone();2752tex.colorSpace = THREE.SRGBColorSpace;2753tex.anisotropy = maxAniso;2754tex.repeat.set(w / SHEET_W, h / SHEET_H);2755tex.offset.set(x / SHEET_W, 1 - (y + h) / SHEET_H);2756tex.needsUpdate = true;27572758printMats[i].color.set('#ffffff');2759printMats[i].map = tex;2760printMats[i].needsUpdate = true;2761});2762resolve();2763};2764img.onerror = () => resolve();2765img.src = SHEET_URL;2766});27672768const failsafeTimer = setTimeout(runOpeningAnimation, 4000);2769Promise.all([sheetPromise, document.fonts.ready]).then(() => {2770clearTimeout(failsafeTimer);2771runOpeningAnimation();2772});27732774// Resize Handler2775function onResize() {2776const w = window.innerWidth;2777const h = window.innerHeight;2778camera.aspect = w / h;2779camera.fov = w >= h ? 56 : 70;2780camera.updateProjectionMatrix();2781renderer.setSize(w, h);2782renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));27832784if (!glide && !introCam) {2785if (state.focusedMesh) {2786Object.assign(camState, getFocusPoseParams(state.focusedMesh.userData.wall));2787} else {2788Object.assign(camState, getWalkPoseParams());2789}2790}2791refreshAllDomCrops();2792updateOpenPill();2793}27942795window.addEventListener('resize', onResize);27962797// Initialize List & Bag UI2798renderListGrid();2799renderBag();28002801// Main Animation Loop2802let lastTime = performance.now();28032804function animate(now) {2805requestAnimationFrame(animate);2806const dt = Math.min(0.05, (now - lastTime) / 1000);2807lastTime = now;28082809if (introCam) {2810introCam.elapsed += dt;2811const t = Math.min(1, introCam.elapsed / introCam.duration);2812const ease = t === 1 ? 1 : 1 - Math.pow(2, -10 * t);2813camState.th = introCam.fromTh + (introCam.toTh - introCam.fromTh) * ease;2814camState.r = introCam.fromR + (introCam.toR - introCam.fromR) * ease;2815if (t >= 1) introCam = null;2816} else if (glide) {2817glide.elapsed += dt;2818const t = Math.min(1, glide.elapsed / glide.duration);2819const eTh = 1 - Math.pow(1 - t, 4);2820const eYaw = 1 - Math.pow(1 - t, 2);2821const eCub = 1 - Math.pow(1 - t, 3);28222823camState.th = glide.from.th + (glide.to.th - glide.from.th) * eTh;2824camState.targetTh = camState.th;2825camState.yaw = glide.from.yaw + (glide.to.yaw - glide.from.yaw) * eYaw;2826camState.r = glide.from.r + (glide.to.r - glide.from.r) * eCub;2827camState.y = glide.from.y + (glide.to.y - glide.from.y) * eCub;2828camState.pitch = glide.from.pitch + (glide.to.pitch - glide.from.pitch) * eCub;28292830if (t >= 1) glide = null;2831} else if (!state.focusedMesh) {2832if (isReduced()) {2833camState.th = camState.targetTh;2834} else {2835camState.th += (camState.targetTh - camState.th) * (1 - Math.exp(-dt / 0.36));2836}2837}28382839applyCameraPose();2840updateOpenPill();2841renderer.render(scene, camera);2842}28432844window.addEventListener('load', () => {2845lastTime = performance.now();2846requestAnimationFrame(animate);2847});2848</script>2849</body>2850</html>


