/* =========================================================================
   3D Viewer — Printed Wicked
   Reskin by editing the custom properties below.
   ========================================================================= */

:root {
  --bg: #14161a;
  --surface: #1c1f26;
  --surface-2: #262a33;
  --border: #33384345;
  --border-strong: #3a3f4a;
  --text: #eef0f3;
  --text-dim: #9aa2b1;
  --accent: #ff5a36;      /* brand accent — swap to match printedwicked.com */
  --accent-text: #ffffff;
  --danger: #e5484d;
  --radius: 10px;
  --drawer-width: 340px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* Guarantee the [hidden] attribute always wins over any component's own
   `display` rule (e.g. `.panel-section { display: flex }`), since at equal
   specificity an author rule otherwise beats the browser's built-in
   `[hidden] { display: none }` regardless of source order. Without this,
   any hidden panel/section here would render visible despite JS correctly
   setting `.hidden = true`. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  display: block;
}

/* ---------------------------------------------------------------------
   Drawer toggle button
   --------------------------------------------------------------------- */

.drawer-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, transform 0.15s ease;
}

.drawer-toggle:hover { background: var(--surface-2); }
.drawer-toggle:active { transform: scale(0.94); }

body.drawer-open .drawer-toggle {
  right: calc(var(--drawer-width) + 16px);
}

/* ---------------------------------------------------------------------
   Drawer panel
   --------------------------------------------------------------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--drawer-width);
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  z-index: 25;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

body.drawer-open .drawer {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.drawer__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.drawer__close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer__close:hover { background: var(--surface-2); color: var(--text); }

.drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------------------------------------------------------------------
   Panel sections / controls
   --------------------------------------------------------------------- */

.panel-section { display: flex; flex-direction: column; gap: 10px; }

.panel-section__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0;
}

.panel-section--about {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.panel-section--about p {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 28px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255, 90, 54, 0.06);
}

.drop-zone__text { font-size: 13.5px; font-weight: 500; }
.drop-zone__hint { font-size: 11px; color: var(--text-dim); letter-spacing: 0.02em; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  width: 100%;
}

.btn:hover { background: #2f3441; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.btn--secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.btn--danger { color: var(--danger); border-color: var(--danger); }

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.field__label { color: var(--text-dim); flex: 0 0 auto; }

.field input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); }

.field input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: none;
  padding: 0;
  cursor: pointer;
}

.info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12.5px;
}

.info-list dt { color: var(--text-dim); }
.info-list dd { margin: 0; text-align: right; word-break: break-all; }

/* ---------------------------------------------------------------------
   Drop overlay (full-window drag target)
   --------------------------------------------------------------------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 22, 26, 0.78);
  border: 3px dashed var(--accent);
  pointer-events: none;
}

body.is-dragging .drop-overlay { display: flex; }

.drop-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.drop-overlay__inner p { margin: 0; font-size: 15px; font-weight: 500; }

/* ---------------------------------------------------------------------
   Loading indicator
   --------------------------------------------------------------------- */

.loading {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.loading__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

.loading__progress { color: var(--text-dim); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Toast
   --------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  z-index: 45;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: var(--danger); color: #ffb4b6; }

/* ---------------------------------------------------------------------
   Small screens / tablets
   --------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root { --drawer-width: 100vw; }
  body.drawer-open .drawer-toggle { right: 16px; opacity: 0; pointer-events: none; }
}
