/* Page builder: rendemdingen.com dusk style */
:root {
  --bg: #121a17;
  --box: #18231f;
  --box-2: #1c2a25;
  --line: #25332d;
  --text: #dfe7e2;
  --muted: #8a9a91;
  --link: #74c9b2;
  --amber: #f2b45a;
  --danger: #e4826f;
  --font: "Atkinson Hyperlegible Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --gjs-main-color: var(--box);
  --gjs-primary-color: var(--box);
  --gjs-secondary-color: var(--text);
  --gjs-tertiary-color: #2c6b5b;
  --gjs-quaternary-color: var(--link);
  --gjs-font-color: var(--text);
  --gjs-font-color-active: #fff;
  --gjs-main-dark-color: rgba(0, 0, 0, .25);
  --gjs-secondary-dark-color: rgba(0, 0, 0, .15);
  --gjs-main-light-color: rgba(255, 255, 255, .06);
  --gjs-color-blue: var(--link);
  --gjs-color-highlight: var(--link);
  --gjs-main-font: var(--font);
  --gjs-font-size: .8rem;
  --gjs-canvas-top: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.4 var(--font);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--box-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 11px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--link); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
button.primary { background: #23574a; border-color: #2f7564; }
button.on { border-color: var(--link); color: var(--link); }
button.icon { padding: 4px 6px; line-height: 0; }
button.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.hint { color: var(--muted); font-size: .85em; margin: 6px 0; }

/* top bar */
#top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 7px 12px; background: var(--box); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.file { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 260px; color: var(--muted); }
#file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dirty { color: var(--amber); font-size: .8em; }
.group { display: flex; gap: 4px; }
#size { margin-left: auto; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

#banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px; background: #2a2416; border-bottom: 1px solid #4a3d1f; color: #f3dfb6;
}
#banner button { background: #3a3220; }

/* work area */
#work { flex: 1; display: flex; min-height: 0; }
.panel { width: 270px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--box); min-height: 0; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 9px; color: var(--muted); }
.tabs button.on { color: var(--text); box-shadow: inset 0 -2px var(--link); }
.tab-body { flex: 1; overflow: auto; padding: 8px 10px 20px; }
#canvas-wrap { flex: 1; min-width: 0; position: relative; background: #0d1311; }
#gjs { height: 100%; }

/* GrapesJS inside our layout */
.gjs-editor { background: transparent; }
.gjs-cv-canvas { top: 0; width: 100%; height: 100%; background: #0d1311; }
.gjs-blocks-c { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gjs-block {
  width: auto; min-height: 0; margin: 0; padding: 10px 6px; border-radius: 8px;
  background: var(--box-2); border: 1px solid var(--line); box-shadow: none;
  font-family: var(--font); font-size: .82rem; color: var(--text);
}
.gjs-block:hover { border-color: var(--link); color: var(--link); }
.gjs-block svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.gjs-block-category .gjs-title { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--muted); }
.gjs-block-categories, .gjs-block-category { background: transparent; }
.gjs-sm-sector .gjs-sm-sector-title, .gjs-layer-title { background: var(--box-2); }
.gjs-field { background: var(--bg); border: 1px solid var(--line); }
/* classes are a coder thing: styling goes to the selected item itself */
#selector-box, #styles .gjs-clm-tags, #styles .gjs-clm-sels-info { display: none !important; }
#styles.empty { display: none; }
.gjs-layer { background: transparent; }
.gjs-toolbar { background: #23574a; }
.gjs-badge { background: #23574a; }
.gjs-mdl-dialog { background: var(--box); border: 1px solid var(--line); color: var(--text); font-family: var(--font); }
.gjs-am-assets-cont, .gjs-am-file-uploader > form { background: var(--box-2); }

/* preview */
#preview { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); }
#preview[hidden] { display: none; }
.preview-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; background: var(--box); border-bottom: 1px solid var(--line); }
.preview-bar .devices { margin-left: auto; }
.preview-stage { flex: 1; display: flex; justify-content: center; background: #0d1311; overflow: auto; }
#preview-frame { width: 100%; height: 100%; border: 0; background: #fff; transition: width .2s; }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* dialogs */
dialog {
  background: var(--box); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 22px; max-width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(5, 9, 8, .7); }
dialog h2 { margin: 0 0 10px; font-size: 1.25rem; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 18px 0 0; padding: 0; }
dialog label { display: block; margin: 10px 0; }
dialog label small { color: var(--muted); }
dialog input:not([type=color]):not([type=checkbox]), dialog textarea, dialog select {
  display: block; width: 100%; margin-top: 4px; padding: 6px 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.colours { display: flex; gap: 14px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; }
.colours label { margin: 4px 0; display: flex; flex-direction: column; gap: 3px; font-size: .9em; }
.colours input { width: 54px; height: 32px; border: 1px solid var(--line); background: none; padding: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cards button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; text-align: left; white-space: normal; height: 100%; }
.cards button b { font-size: 1rem; }
.cards button span { color: var(--muted); font-size: .85em; }
#report-body ul { margin: 6px 0; padding-left: 20px; }
#report-body li { margin: 3px 0; }
#report-body .ok { color: var(--link); }
#report-body .warn { color: var(--amber); }
#report-body .list { max-height: 140px; overflow: auto; font-size: .85em; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: #23574a; color: #fff; padding: 8px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: 90vw; /* above the device note */
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: #6b2c22; }

/* shown on every visit until closed with the cross */
#device-note {
  position: fixed; z-index: 60; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-start; gap: 12px;
  width: min(460px, calc(100vw - 24px)); padding: 14px 14px 14px 18px;
  background: #2a2416; color: #f3dfb6; border: 1px solid #4a3d1f; border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  animation: note-in .25s ease-out;
}
#device-note p { margin: 0; flex: 1; }
#device-note button { flex-shrink: 0; background: #3a3220; border-color: #4a3d1f; color: #f3dfb6; }
#device-note button:hover { border-color: #f3dfb6; }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { #device-note { animation: none; } }

@media (max-width: 760px) {
  .panel { width: 200px; }
  #left { display: none; }
  #device-note { bottom: 12px; }
}
