@import "tokens.css";

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #efe9de; color: var(--ink); font-family: var(--sans); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
button { font: inherit; cursor: pointer; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid currentColor; border-radius: 3px;
  font: 600 11px/1.5 var(--sans); letter-spacing: .04em; text-align: center; opacity: .9;
}
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.eyebrow.gold { color: #a9852f; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 30px; background: var(--ink); color: var(--white); border: 0; text-decoration: none;
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase; transition: transform .2s var(--ease), background .2s;
}
.btn:hover { transform: translateY(-1px); background: #2b2926; }
.btn-full { width: 100%; }
.btn-gold { background: linear-gradient(135deg, #b8913a, #e0c26e 50%, #a57d2b); color: #1b1408; }

/* Loading + error */
.loading, .error { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--paper); transition: opacity .6s var(--ease); }
.loading.hidden { opacity: 0; pointer-events: none; }
.loading-mark { font: italic 34px var(--serif); letter-spacing: .01em; }
.loading-bar { width: min(320px, 70vw); height: 1px; background: var(--border-strong); overflow: hidden; }
.loading-bar span { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(.04); transition: transform .4s var(--ease); }
#loading-text { font-size: 13px; color: var(--ink-soft); letter-spacing: .04em; }
.error[hidden] { display: none; }
.error-card { max-width: 440px; padding: 40px; text-align: center; }
.error-card h2 { font: 400 32px/1.15 var(--serif); margin-bottom: 14px; }
.error-card p { color: var(--ink-soft); line-height: 1.55; margin-bottom: 24px; }

/* Top bar */
.g-top { position: fixed; top: 0; left: 0; right: 0; z-index: 35; display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; pointer-events: none; }
.g-brand { pointer-events: auto; color: var(--ink); text-decoration: none; font: 700 13px var(--serif); letter-spacing: .22em; text-transform: uppercase; display: flex; flex-direction: column; gap: 3px; text-shadow: 0 1px 12px rgba(255,255,255,.6); }
.g-brand span { font: italic 400 13px var(--serif); letter-spacing: .02em; text-transform: none; color: var(--ink-soft); }
.g-actions { display: flex; gap: 8px; pointer-events: auto; }
.g-pill { padding: 8px 14px; border: 1px solid var(--border-strong); background: rgba(253,252,250,.82); backdrop-filter: blur(8px); color: var(--ink); font-size: 12px; letter-spacing: .06em; text-decoration: none; }
.g-pill[aria-pressed="false"] { color: var(--ink-muted); }
.in-gallery .g-top { opacity: .78; }

/* Intro / pause */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(239,233,222,.55); backdrop-filter: blur(6px); transition: opacity .4s var(--ease); }
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-card { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--white); padding: 44px 44px 36px; box-shadow: 0 30px 80px rgba(20,20,20,.18); }
.overlay-card h1 { font: 400 52px/1 var(--serif); margin-bottom: 16px; }
.overlay-lead { color: var(--ink-soft); line-height: 1.6; margin-bottom: 22px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 28px; font-size: 13px; }
.keys div { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 8px; }
.keys dt { font-weight: 700; letter-spacing: .08em; font-size: 11px; text-transform: uppercase; }
.keys dd { color: var(--ink-soft); }
.overlay-fine { margin-top: 18px; font-size: 12px; color: var(--ink-muted); line-height: 1.5; }
.touch-only { display: none; }
.touch .touch-only { display: block; }
.touch .desktop-only { display: none; }

/* HUD */
.crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(20,20,20,.45); z-index: 10; pointer-events: none; opacity: 0; transition: transform .15s, opacity .2s; }
.in-gallery .crosshair { opacity: 1; }
.crosshair[data-mode="target"] { transform: scale(1.8); background: #fff; }
.crosshair[data-mode="paint"] { transform: scale(.7); }
.prompt { position: fixed; left: 50%; bottom: 17vh; transform: translate(-50%, 8px); z-index: 12; padding: 10px 16px; background: rgba(20,20,20,.72); color: #fff; font-size: 14px; letter-spacing: .02em; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); white-space: nowrap; backdrop-filter: blur(6px); }
.prompt.show { opacity: 1; transform: translate(-50%, 0); }
.prompt kbd { margin-right: 6px; }
.toast { position: fixed; left: 50%; top: 84px; transform: translate(-50%, -8px); z-index: 25; padding: 10px 18px; background: rgba(253,252,250,.92); font-size: 13px; letter-spacing: .03em; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); box-shadow: 0 8px 30px rgba(20,20,20,.12); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.clock { position: fixed; left: 24px; bottom: 20px; z-index: 10; font: italic 13px var(--serif); color: var(--ink-soft); text-shadow: 0 1px 10px rgba(255,255,255,.7); pointer-events: none; }

/* Palette swatches */
.palette-ui { position: fixed; right: 20px; bottom: 20px; z-index: 11; display: flex; gap: 6px; padding: 8px; background: rgba(253,252,250,.78); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.in-gallery .palette-ui { opacity: 1; pointer-events: auto; }
.touch .palette-ui { display: none; }
.brush-off .palette-ui { display: none; }   /* B takes out the brush and palette (app.js) */
.swatch { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(20,20,20,.14); background: var(--c); transition: transform .15s; }
.swatch span { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--ink-muted); }
.swatch.active { transform: scale(1.22); border-color: var(--ink); }
.swatch-mix { background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935); }
.swatch-mix.mixed { background: radial-gradient(var(--c) 55%, transparent 56%), conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935); }
.palette-ui { padding-bottom: 20px; }

.wheel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.94); z-index: 40; padding: 22px; background: var(--white); box-shadow: 0 30px 80px rgba(20,20,20,.25); text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.wheel.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.wheel canvas { display: block; width: 240px; height: 240px; cursor: crosshair; border-radius: 50%; }
.wheel p { margin-top: 12px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }

/* Panels */
.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(440px, 100%); overflow-y: auto; padding: 56px 36px 36px; background: var(--white); box-shadow: -30px 0 80px rgba(20,20,20,.18); transform: translateX(105%); transition: transform .45s var(--ease); }
.panel.open { transform: translateX(0); }
.panel h2 { font: 400 40px/1.05 var(--serif); margin-bottom: 10px; }
.panel-close { position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ink-soft); }
.d-details { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.d-blurb { font: italic 17px/1.55 var(--serif); margin-bottom: 14px; }
.d-meta { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 22px; }
.opt-group { border: 0; margin-bottom: 16px; }
.opt-group legend { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.opt-group[disabled] { opacity: .35; }
.opt { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px; border: 1px solid var(--border); background: none; text-align: left; font-size: 14px; color: var(--ink); transition: border-color .15s, background .15s; }
.opt::before { content: ''; flex: 0 0 14px; height: 14px; border-radius: 50%; background: var(--sw, transparent); border: 1px solid var(--border-strong); }
.opt[data-kind="canvas"]::before { border-radius: 2px; background: repeating-linear-gradient(45deg, #efe7d6, #efe7d6 2px, #ddd2bd 2px, #ddd2bd 4px); }
.opt span { flex: 1; }
.opt em { font-style: normal; font-size: 12px; color: var(--ink-muted); }
.opt.on { border-color: var(--ink); background: var(--paper); }
.d-summary { font-size: 13px; color: var(--ink-soft); margin: 4px 0 6px; }
.d-price { font: 17px/1.5 var(--serif); margin-bottom: 20px; }
.d-ar { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; padding: 16px; margin-bottom: 20px; background: var(--paper); border: 1px solid var(--border); }
.d-ar canvas { width: 110px; height: 110px; image-rendering: pixelated; background: #fff; }
.d-ar strong { display: block; font: 700 15px var(--serif); margin-bottom: 4px; }
.d-ar p { font-size: 12px; line-height: 1.5; color: var(--ink-soft); margin-bottom: 6px; }
.d-ar a { font-size: 13px; color: var(--ink); }
.panel-fine { margin-top: 12px; font-size: 12px; color: var(--ink-muted); text-align: center; }
.drop { background: radial-gradient(circle at 50% 0%, #fff8e6, var(--white) 60%); }
.drop h2 { font-size: 48px; }
.drop img { width: 100%; margin: 8px 0 16px; }

/* Touch */
.joy { position: fixed; z-index: 15; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); background: rgba(20,20,20,.12); opacity: 0; pointer-events: none; }
.joy.show { opacity: 1; }
.joy span { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.85); }
.touch-act { position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 15; padding: 16px 20px; border: 0; background: rgba(20,20,20,.72); color: #fff; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.touch .touch-act.touch-only { display: none; }
.touch.in-gallery .touch-act.touch-only { display: block; }

@media (max-width: 640px) {
  .overlay-card { padding: 30px 24px; }
  .overlay-card h1 { font-size: 40px; }
  .keys { grid-template-columns: 1fr; }
  .g-pill { padding: 7px 10px; font-size: 11px; }
  .panel { padding: 52px 22px 28px; }
}

/* Photograph (photomode.js): the progress note while it develops, then the framed print */
.photo-dev { position: fixed; left: 50%; bottom: 38px; z-index: 40; transform: translate(-50%, 8px); display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: rgba(253,252,250,.9); backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(20,20,20,.12); font: italic 14px var(--serif); color: var(--ink); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); }
.photo-dev.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.photo-dev-bar { display: block; width: 120px; height: 2px; background: var(--border-strong); overflow: hidden; }
.photo-dev-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); transition: transform .25s linear; }
.photo-dev-cancel { border: 0; background: none; padding: 2px 0; font: 12px var(--sans); letter-spacing: .06em; color: var(--ink-muted); cursor: pointer; }
.photo-dev-cancel:hover, .photo-dev-cancel:focus-visible { color: var(--ink); }
.photo-viewer { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: rgba(28,26,23,.72); backdrop-filter: blur(4px); opacity: 0; transition: opacity .35s var(--ease); }
.photo-viewer.show { opacity: 1; }
.photo-viewer[hidden] { display: none; } /* display:flex above would otherwise override [hidden]: an invisible full-page layer that swallowed every click, Enter included */
.photo-print { margin: 0; padding: 14px 14px 10px; background: #fdfcfa; box-shadow: 0 18px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.photo-print img { display: block; max-width: min(88vw, 100%); max-height: 76vh; width: auto; height: auto; }
.photo-print figcaption { font: italic 12px var(--serif); color: var(--ink-muted); text-align: right; }
.photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; align-items: center; }
.photo-actions .btn { padding: 11px 22px; }
.touch .photo-dev, .touch .photo-viewer { display: none; }
