/* Root homepage only. The editor keeps its existing responsive canvas sizes. */
html#drawing {
  --df-home-header: 90px;
  --df-home-toggle-space: 0px;
}

html#drawing:not(.df-in-gallery) body {
  height: auto;
  min-height: 100svh;
  overflow-x: clip;
  overflow-y: visible;
}

html#drawing:not(.df-in-gallery) body > .container {
  position: relative !important;
  inset: auto !important;
  transform: none !important;
  margin-top: var(--df-home-header) !important;
  height: auto;
  min-height: calc(100svh - var(--df-home-header));
  box-sizing: border-box;
  flex: none;
}

html#drawing:not(.df-in-gallery):has(#df-home-disclosure:not([open])) {
  overflow: hidden;
}

html#drawing:not(.df-in-gallery):has(#df-home-disclosure:not([open])) body > .container {
  height: calc(100dvh - var(--df-home-header));
  min-height: 0;
  /* Short windows can reach every drawing tool while the homepage is closed. */
  overflow: auto !important;
  padding-bottom: var(--df-home-toggle-space);
}

#df-home-disclosure {
  width: 100%;
  flex: none;
}

#df-home-disclosure > summary {
  position: fixed;
  z-index: 13;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  box-sizing: border-box;
  list-style: none;
  border: 1px solid #b77e2c;
  border-radius: 24px;
  background: #17130d;
  color: #ffca75;
  font: 700 13px/1.2 system-ui, sans-serif;
  cursor: pointer;
  user-select: none;
}

#df-home-disclosure > summary::-webkit-details-marker { display: none; }
#df-home-disclosure > summary:hover { background: #302213; }
#df-home-disclosure > summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#df-home-disclosure:not([open]) .df-home-return,
#df-home-disclosure[open] .df-home-unlock { display: none; }
#df-home-disclosure[open] > summary svg { transform: rotate(180deg); }

#df-home-sections {
  display: block;
  width: 100%;
  scroll-margin-top: var(--df-home-header);
  text-align: left;
  user-select: text;
  border-top: 1px solid #493116;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

html.df-in-gallery #df-home-disclosure { display: none; }

@media (max-width: 900px) {
  html#drawing { --df-home-toggle-space: calc(60px + env(safe-area-inset-bottom)); }
}

@media (max-width: 600px) {
  html#drawing { --df-home-header: 56px; }
}
