/* Custom bits beyond Tailwind */

/* App fills the *visible* viewport: 100dvh tracks Safari's collapsing
   toolbar on iPad/iPhone, so the sidebar bottom is actually reachable. */
.app-shell {
  height: 100vh;
  height: 100dvh;
}

/* Keep sidebar scrolling inside the sidebar — no rubber-band chaining
   to the page on touch devices. */
aside#sidebar {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- dark mode (html.dark toggled by the 🌙 button) ---------- */

html.dark body { background: #141416; color: #e9e7e2; }
html.dark .bg-cream { background-color: #141416 !important; }
html.dark .bg-white { background-color: #1f2023 !important; }
html.dark .bg-white\/60 { background-color: rgba(23, 24, 26, 0.75) !important; }
html.dark .bg-white\/80,
html.dark .bg-white\/90,
html.dark .bg-white\/95 { background-color: rgba(28, 29, 32, 0.92) !important; }
html.dark .bg-stone-100 { background-color: #2c2d31 !important; }
html.dark .hover\:bg-stone-200:hover { background-color: #3a3b40 !important; }
html.dark .hover\:bg-stone-100:hover { background-color: #34353a !important; }
html.dark .focus\:bg-white:focus { background-color: #26272b !important; }
html.dark .bg-stone-900\/40 { background-color: rgba(0, 0, 0, 0.65) !important; }
html.dark .bg-red-50 { background-color: rgba(219, 18, 24, 0.16) !important; }
html.dark .hover\:bg-red-100:hover { background-color: rgba(219, 18, 24, 0.28) !important; }
html.dark .bg-brandblue\/10 { background-color: rgba(96, 98, 255, 0.16) !important; }
html.dark .hover\:bg-brandblue\/20:hover { background-color: rgba(96, 98, 255, 0.28) !important; }
html.dark .text-brandblue { color: #8a8cff !important; }
html.dark .text-stone-900,
html.dark .text-stone-800 { color: #ededea !important; }
html.dark .text-stone-700 { color: #d8d6d1 !important; }
html.dark .text-stone-600 { color: #bcbab4 !important; }
html.dark .text-stone-500 { color: #a3a19b !important; }
html.dark .hover\:text-stone-600:hover { color: #d8d6d1 !important; }
html.dark .border-stone-200 { border-color: #37383c !important; }
html.dark .border-jade { border-color: #03c059 !important; }
html.dark .bg-stone-200 { background-color: #3a3b40 !important; }
html.dark .text-jade-dark { color: #2fd57f !important; }
html.dark input#layout-title,
html.dark input#saveas-title { color: #ededea; }
html.dark .toast { background: #f0efe9 !important; color: #1c1c1e !important; }
html.dark kbd { background: #2c2d31; border-color: #47484d; color: #d8d6d1; }
html.dark .comp-chip { background: #2c2d31; color: #c9c7c1; }
html.dark .comp-chip:hover { background: rgba(3, 192, 89, 0.2); color: #3fe38c; }
html.dark .view-btn { background: rgba(32, 33, 36, 0.92); color: #d8d6d1; }
html.dark .view-btn:hover { background: #2c2d31; }
html.dark .view-menu-btn { color: #d8d6d1; }
html.dark .view-menu-btn:hover { background: #2c2d31; }
html.dark aside::-webkit-scrollbar-thumb,
html.dark #layout-list::-webkit-scrollbar-thumb { background: #45464b; }
html.dark details summary::after { color: #6f6e6a; }

/* ---------- end dark mode ---------- */

#viewport canvas {
  display: block;
  outline: none;
  touch-action: none;
}

.view-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  font-weight: 800;
  font-size: 1.05rem;
  color: #44403c;
  box-shadow: 0 4px 14px -6px rgba(35, 39, 47, 0.25);
  transition: background 0.15s, transform 0.1s;
}
.view-btn:hover { background: #ffffff; }
.view-btn:active { transform: scale(0.94); }
.view-btn-active {
  background: #03c059 !important;
  color: #ffffff !important;
}

/* comfortable touch targets on coarse pointers */
@media (pointer: coarse) {
  .view-btn { width: 2.9rem; height: 2.9rem; }
  .view-menu-btn { padding: 0.7rem 1rem; }
  .comp-chip { padding: 0.55rem 0.8rem; }
  .layer-target { padding: 0.5rem 0.6rem !important; }
}

.marquee {
  position: absolute;
  z-index: 20;
  border: 1.5px dashed #03c059;
  background: rgba(3, 192, 89, 0.12);
  border-radius: 4px;
  pointer-events: none;
}

.comp-chip {
  padding: 0.35rem 0.65rem;
  border-radius: 0.6rem;
  background: #f5f5f4;
  font-weight: 700;
  font-size: 0.8rem;
  color: #57534e;
  transition: background 0.15s, color 0.15s;
}
.comp-chip:hover {
  background: rgba(3, 192, 89, 0.12);
  color: #00814e;
}

input[type='range'] {
  accent-color: #03c059;
}

#view-menu:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#sel-tools:not(.hidden) {
  display: flex;
}
.view-menu-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 0.65rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #44403c;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s;
}
.view-menu-btn:hover { background: #f5f5f4; }

kbd {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 0.375rem;
  border: 1px solid #d6d3d1;
  border-bottom-width: 2px;
  background: #fafaf9;
  font-family: inherit;
  font-size: 0.78em;
  font-weight: 800;
}

.toast {
  animation: toast-in 0.22s ease-out;
}
.toast-out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.35s, transform 0.35s;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: '▸';
  float: right;
  color: #a8a29e;
  transition: transform 0.15s;
}
details[open] summary::after { transform: rotate(90deg); }

/* friendly scrollbars */
aside::-webkit-scrollbar, #layout-list::-webkit-scrollbar { width: 8px; }
aside::-webkit-scrollbar-thumb, #layout-list::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 8px;
}
