:root {
  --bg: #F5EFE6;
  --clay: #C86D51;
  --clay-deep: #A9533A;
  --ivory: #FFFDF9;
  --ink: #2D2623;
  --ink-soft: #6B5D55;
  --line: rgba(45, 38, 35, 0.12);
  --panel-w: 340px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(90% 70% at 38% 42%, #FFFBF5 0%, #F7F1E8 42%, #EFE5D7 78%, #E8DBCA 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

.viewer { position: fixed; inset: 0; touch-action: none; }
.viewer canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }

/* ---------- brand ---------- */
.brand {
  position: fixed; top: 28px; left: 32px; display: flex; gap: 14px; align-items: flex-start;
  pointer-events: none; z-index: 3;
}
.brand::before {
  content: ""; position: absolute; z-index: -1; left: -60px; top: -50px; right: -70px; bottom: -40px;
  background: radial-gradient(closest-side, rgba(248, 243, 235, 0.92) 40%, rgba(248, 243, 235, 0));
}
.mark { width: 46px; height: 38px; flex: none; margin-top: 22px; }
.eyebrow {
  margin: 0 0 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 8px; pointer-events: auto;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--clay); box-shadow: 0 0 0 3px rgba(200,109,81,.18); }
h1 { font-family: var(--serif); font-weight: 500; font-size: 38px; line-height: 1.02; margin: 0; letter-spacing: -.01em; }
.tagline { margin: 6px 0 0; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--clay-deep); }
.brand-lede { margin: 10px 0 0; max-width: 270px; font-size: 14px; line-height: 1.45; color: var(--ink); }

/* ---------- side panel ---------- */
.panel {
  position: fixed; top: 20px; right: 20px; bottom: 96px; width: var(--panel-w); z-index: 3;
  background: rgba(255, 253, 249, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.7); border-radius: 18px; box-shadow: 0 18px 50px -24px rgba(80, 45, 30, .35);
  padding: 22px 22px 18px; overflow-y: auto; scrollbar-width: thin;
}
.lede { margin: 0 0 16px; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.panel h2 {
  font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600;
  margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline;
}
.panel h2 span { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; opacity: .8; }
.features { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; }
.feature {
  width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px 8px 8px; border-radius: 12px;
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; cursor: pointer; transition: background .2s;
}
.feature:hover { background: rgba(200, 109, 81, 0.07); }
.feature.active { background: rgba(200, 109, 81, 0.12); }
.feature .n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
  background: var(--ivory); color: var(--clay-deep); border: 1.5px solid var(--clay);
}
.feature.active .n { background: var(--clay); color: var(--ivory); }
.feature strong { display: block; font-size: 14.5px; font-weight: 600; margin-top: 3px; }
.feature small { display: block; font-size: 13px; line-height: 1.45; color: var(--ink-soft); margin-top: 3px; }
.feature .more { display: none; font-size: 13.5px; line-height: 1.5; color: var(--ink); margin-top: 8px; }
.feature .more em { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.feature.active .more { display: block; animation: rise .28s ease-out; }
.feature.active small { display: none; }
.renders-h { margin-top: 4px !important; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs button {
  border: 0; padding: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 1 / 1; background: #e8dccd;
  position: relative;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.thumbs button:hover img { transform: scale(1.04); }
.thumbs span {
  position: absolute; left: 6px; bottom: 5px; font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.fine {
  font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); margin: 0 0 16px; padding: 9px 11px; border-radius: 10px;
  background: rgba(200, 109, 81, 0.07);
}

/* ---------- hotspots ---------- */
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hs {
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer; pointer-events: auto; display: grid; place-items: center;
  background: var(--ivory); color: var(--clay-deep); font-weight: 700; font-size: 13px;
  box-shadow: 0 0 0 2px var(--clay), 0 6px 16px -4px rgba(60, 30, 20, .45);
  transition: opacity .3s, transform .25s, background .2s, color .2s;
  will-change: transform;
}
.hs::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid rgba(200,109,81,.55);
  animation: pulse 2.4s ease-out infinite;
}
.hs:hover, .hs.active { background: var(--clay); color: var(--ivory); }
.hs.behind { opacity: .38; }
.hs.hidden { opacity: 0; pointer-events: none; }
.hs .tip {
  position: absolute; left: 38px; top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: rgba(45, 38, 35, .86); color: var(--ivory); font-weight: 500; font-size: 12.5px; padding: 5px 9px;
  border-radius: 8px; opacity: 0; transition: opacity .2s;
}
.hs:hover .tip, .hs.active .tip { opacity: 1; }
.hs.flip .tip { left: auto; right: 38px; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }

/* ---------- info card ---------- */
.card {
  position: fixed; left: 32px; bottom: 104px; width: min(360px, calc(100vw - 64px)); z-index: 4;
  background: var(--ivory); border-radius: 16px; padding: 18px 20px 16px; border: 1px solid var(--line);
  box-shadow: 0 24px 60px -28px rgba(80, 45, 30, .5); animation: rise .28s ease-out;
}
.card[hidden] { display: none; }
.card-num { margin: 0; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--clay-deep); font-weight: 600; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 23px; margin: 4px 0 6px; }
.card p { font-size: 14px; line-height: 1.5; margin: 0; }
.card .card-note { margin-top: 9px; font-size: 12.5px; color: var(--ink-soft); }
.card-close {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(45,38,35,.06); cursor: pointer; font-size: 18px; line-height: 1;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- controls ---------- */
.controls {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(calc(-50% - var(--panel-w) / 2 - 10px)); z-index: 5;
  display: flex; align-items: center; gap: 6px; padding: 7px; border-radius: 999px;
  background: rgba(255, 253, 249, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.8); box-shadow: 0 14px 40px -18px rgba(80, 45, 30, .45);
}
.controls button {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 999px; border: 0;
  background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .2s, color .2s;
}
.controls button svg, .level svg { width: 18px; height: 18px; flex: none; }
.controls button:hover { background: rgba(45, 38, 35, .06); }
.controls .toggle[aria-pressed="true"] { background: rgba(200, 109, 81, 0.15); color: var(--clay-deep); box-shadow: inset 0 0 0 1.5px rgba(200, 109, 81, 0.55); }
.level {
  display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: rgba(122, 106, 85, .1); color: #5A4C3C; font-size: 14px; font-weight: 500;
}
.level input { width: 150px; accent-color: #7A6A55; cursor: pointer; }
.level input:focus { outline: none; }
.level input:focus-visible { outline: 2px solid rgba(122, 106, 85, .45); outline-offset: 4px; border-radius: 6px; }
.level output { min-width: 36px; font-variant-numeric: tabular-nums; text-align: right; }

.hint {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(calc(-50% - var(--panel-w) / 2 - 10px)); margin: 0;
  font-size: 12.5px; color: var(--ink-soft); z-index: 2; pointer-events: none; transition: opacity .6s;
}
.hint.gone { opacity: 0; }

.loader {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; z-index: 6;
  font-size: 14px; color: var(--ink-soft); pointer-events: none; transition: opacity .5s;
}
.loader span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(200,109,81,.2); border-top-color: var(--clay); animation: spin 1s linear infinite; }
.loader.done { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 10; background: rgba(35, 28, 24, .94); display: grid; place-items: center; padding: 28px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: min(1200px, 100%); }
.lightbox img { width: 100%; height: auto; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 10px; display: block; }
.lightbox figcaption { color: #F5EFE6; font-size: 14px; margin-top: 10px; line-height: 1.45; }
.lb-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,253,249,.14); color: #fff; font-size: 22px;
}

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,253,249,.16); color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
}
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-nav:hover, .lb-close:hover { background: rgba(255,253,249,.28); }
.renders-btn {
  display: none; position: fixed; top: 20px; right: 14px; z-index: 4; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.8); background: rgba(255,253,249,.86); cursor: pointer;
  font-size: 13px; font-weight: 500; box-shadow: 0 8px 24px -14px rgba(80,45,30,.5);
}
.renders-btn svg { width: 17px; height: 17px; }

/* ---------- smaller screens ---------- */
@media (max-width: 980px) {
  :root { --panel-w: 0px; }
  .panel { display: none; }
  .renders-btn { display: inline-flex; }
  .brand { top: 16px; left: 18px; gap: 10px; }
  .mark { width: 34px; height: 28px; margin-top: 20px; }
  h1 { font-size: 27px; }
  .tagline { font-size: 14.5px; margin-top: 3px; }
  .brand-lede { font-size: 13px; max-width: 300px; margin-top: 6px; }
  .eyebrow { font-size: 10px; margin-bottom: 5px; }
  .controls { transform: translateX(-50%); }
  .hint { transform: translateX(-50%); }
  .card { left: 12px; right: 12px; width: auto; bottom: 150px; padding: 15px 16px 14px; }
  .card h3 { font-size: 20px; }
  .card p { font-size: 13.5px; }
}
@media (max-width: 620px) {
  .controls {
    left: 10px; right: 10px; bottom: 10px; transform: none; border-radius: 20px; flex-wrap: wrap; justify-content: space-between;
    gap: 4px; padding: 6px;
  }
  .controls button { height: 38px; padding: 0 12px; font-size: 13.5px; flex: 1 1 0; justify-content: center; }
  .level { order: -1; flex: 1 1 100%; justify-content: space-between; height: 40px; }
  .level input { flex: 1; width: auto; min-width: 0; }
  .hint { bottom: 118px; }
  .card { bottom: 116px; }
  .hs .tip { display: none; }
  .renders-btn { top: auto; bottom: 112px; right: 12px; height: 34px; }
  .hint { left: 16px; transform: none; bottom: 121px; }
  .card-open .renders-btn, .card-open .hint { display: none; }
  .brand-lede { max-width: 250px; }
  .lb-nav { top: auto; bottom: 18px; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hs::after, .loader span { animation: none; }
}
