/* Sanlom Lamp Studio — "sanag sa dulom": light in the dark. Warm paper by day, deep ink by night. */
:root {
  --ink: #1d1a17;
  --ink-2: #5d554c;
  --paper: #f6f1e8;
  --paper-2: #ece4d6;
  --line: #d9cfbf;
  --amber: #e9a24b;
  --amber-deep: #b86f1c;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
h2 { font: 600 0.78rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin: 0; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 600 1.35rem/1 var(--serif); letter-spacing: 0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--ink-2); margin-top: 3px; }
.tabs { display: flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; color: var(--ink-2); }
.tab.is-on { background: var(--ink); color: var(--paper); }

main { max-width: 1080px; margin: 0 auto; }
.view { display: none; }
.view.is-on { display: block; }

/* Design view: stacked on phones, side by side on wide screens */
@media (min-width: 900px) {
  #view-design.is-on { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; padding: 20px; align-items: start; }
  #view-design > * { min-width: 0; } /* long thumbnail strips scroll instead of widening the column */
  .stage { position: sticky; top: 84px; border-radius: var(--radius); }
  .order-bar { grid-column: 2; position: static !important; border-radius: var(--radius); }
}

.stage {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 5; width: 100%; max-width: calc(72vh * 0.8); margin: 0 auto; /* keep 4:5 so scenes line up */
  background: radial-gradient(120% 80% at 50% 30%, #fbf6ee, #e5dac8 70%, #d6c8b1);
  transition: background 0.4s;
}
.stage.night { background: radial-gradient(120% 80% at 50% 35%, #2b2620, #15120f 70%, #0b0908); }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene.missing { display: none; }

.lamp { position: absolute; inset: 0; pointer-events: none; }
.layer { position: absolute; transform: translateX(-50%); }
.layer img { display: block; width: 100%; height: 100%; object-fit: contain; }
.layer.ph { border-radius: 2px; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; box-shadow: inset 0 -10px 18px rgb(0 0 0 / 0.18); }
.layer.ph img { display: none; }
.stage.night .layer.ph.shade { filter: brightness(1.25) saturate(1.1); box-shadow: inset 0 -30px 40px rgb(255 190 110 / 0.55); }

.glow { position: absolute; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 196 120 / 0.55), rgb(255 170 80 / 0.18) 55%, transparent);
  opacity: 0; transition: opacity 0.4s; pointer-events: none; mix-blend-mode: screen; }
.stage.night .glow { opacity: 1; }

.light-toggle {
  position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 0; border-radius: 999px; font-size: 0.82rem;
  background: rgb(255 255 255 / 0.85); box-shadow: 0 2px 10px rgb(0 0 0 / 0.1);
}
.bulb { width: 12px; height: 12px; border-radius: 50%; background: #c9c0b2; transition: 0.3s; }
.stage.night .light-toggle { background: rgb(40 34 28 / 0.85); color: #f6e6cf; }
.stage.night .bulb { background: var(--amber); box-shadow: 0 0 10px 3px rgb(233 162 75 / 0.7); }

.scene-chips { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; }
.scene-chips button {
  border: 0; padding: 6px 11px; border-radius: 999px; font-size: 0.78rem;
  background: rgb(255 255 255 / 0.78); backdrop-filter: blur(6px);
}
.scene-chips button.is-on { background: var(--ink); color: var(--paper); }
.stage.night .scene-chips button { background: rgb(40 34 28 / 0.75); color: #e9dccb; }
.stage.night .scene-chips button.is-on { background: #f6e6cf; color: var(--ink); }

/* Controls */
.controls { padding: 16px 16px 110px; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 900px) { .controls { padding: 0; } }
.combo-name { font: 500 1.15rem/1.3 var(--serif); }
.combo-name small { display: block; font: 0.8rem var(--sans); color: var(--ink-2); margin-top: 2px; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; }
.picked { font-size: 0.85rem; color: var(--ink-2); }
.picker-row { flex-direction: row; justify-content: space-between; align-items: center; }

.strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; scrollbar-width: thin; }
.thumb {
  flex: 0 0 76px; scroll-snap-align: start; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; padding: 6px 4px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.thumb.is-on { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink); }
.thumb .pic { width: 56px; height: 56px; position: relative; display: grid; place-items: center; }
.thumb .pic img { max-width: 100%; max-height: 100%; }
.thumb .pic .ph { width: 70%; height: 80%; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; background: #cfc6b8; }
.thumb .num { font-size: 0.64rem; color: var(--ink-2); }
.thumb .nm { font-size: 0.74rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 68px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.15); padding: 0;
  outline-offset: 3px; position: relative;
}
.swatch.is-on { outline: 2px solid var(--ink); }
.swatch:focus-visible, .tab:focus-visible, .thumb:focus-visible { outline: 2px solid var(--amber-deep); }

.seg { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.seg button.is-on { background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.12); }
.seg .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.2); }

.ghost { align-self: flex-start; border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 16px; font-size: 0.88rem; }

/* Order bar */
.order-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper);
}
.price { display: flex; flex-direction: column; line-height: 1.1; }
.price strong { font: 600 1.3rem/1 var(--serif); }
.price span { font-size: 0.75rem; opacity: 0.75; margin-top: 3px; }
.order {
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; font-size: 0.95rem;
  background: var(--amber); color: var(--ink); text-decoration: none; text-align: center;
}

/* Catalogue */
.cat-head { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; }
.filters button.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 0 16px 40px; }
.card { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.card .pic { aspect-ratio: 1; display: grid; place-items: center; background: var(--paper); border-radius: 10px; margin-bottom: 6px; overflow: hidden; }
.card .pic img { max-width: 88%; max-height: 88%; }
.card .pic .ph { width: 55%; height: 65%; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; background: #cfc6b8; }
.card .num { font-size: 0.72rem; color: var(--ink-2); }
.card .nm { font: 600 1rem/1.2 var(--serif); }
.card .meta { font-size: 0.75rem; color: var(--ink-2); }

/* Dialog */
dialog { border: 0; border-radius: 18px; padding: 22px; width: min(420px, 92vw); position: relative; }
dialog::backdrop { background: rgb(20 16 12 / 0.55); }
dialog h2 { font: 600 1.2rem var(--serif); text-transform: none; letter-spacing: 0; color: var(--ink); margin-bottom: 6px; }
.hint { font-size: 0.85rem; color: var(--ink-2); margin: 0 0 12px; }
dialog textarea { width: 100%; font: 0.85rem/1.45 var(--sans); border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: none; background: var(--paper); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
