/* ────────────────────────────────────
   Reset
──────────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: #ebd19b;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Main page container */
#page.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;  /* Ensures the whole page is at least full screen */
}

/* Push footer to bottom 
.site-content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 100px); 
}
*/
#page > .container {
  width: 100vw;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height, 80px) + 120px);
 /* min-height: calc(100vh - var(--header-height, 80px)); /* adjust if header height varies */
  box-sizing: border-box;
}


/* Footer (example) */
.site-footer {
  flex-shrink: 0;   /* Prevent footer from shrinking to nothing */
  z-index: 10;
  position: relative;
}

/* ────────────────────────────────────────
   Container for Mobile Device Scaling 
──────────────────────────────────────── */
/* Each .my-journey-container stretches inside .container */
.my-journey-container {
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0;
}

/* ────────────────────────────────────
   Canvas Root Layout
──────────────────────────────────── */
.key3mhp-canvas-root {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  display: flex;
  justify-content: center;
  align-items: flex-start; /* start at top of the tall canvas */
  width: 100%;
}

/* ────────────────────────────────────
   Canvas
──────────────────────────────────── */
.key3mhp-canvas {
  position: relative;
  --bg-image-alpha: 0; /* Overlay to adjust background image transparency. 0 = no overlay; 1 = fully covered*/
  width: 100%;
  height: auto;
  min-height: calc(var(--vh, 1vh) * 900); /* 9× viewport */
  margin: 0 auto;
  
  background-size: 100% auto;      /* keep aspect ratio, fit width */
  background-repeat: repeat-y;     /* tile vertically for tall canvas */
  background-position: center top;

  overflow: visible;
  user-select: none;
  transition: background 0.5s;
  z-index: 1;
  pointer-events: auto;
}


.key3mhp-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, var(--bg-image-alpha));
  pointer-events: none;
  z-index: 0;
}

/* ────────────────────────────────────
   Dashboard Button
──────────────────────────────────── */
#key3mhp-dashboard-btn {
  position: fixed;      /* 🔸 stick to viewport */
  top: 80px;
  right: 2px;
  z-index: 10000;
  background: rgba(255,255,255,0.8);
  padding: 4px 8px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
}

/* ────────────────────────────────────
   Tool Bar Toggle Handle Button
──────────────────────────────────── */
#key3mhp-toolbar-handle {
  position: fixed;
  left: 0;
  top: 70px;
  width: 50px;
  height: 40px;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 0 0 0 0;
  font-size: 18px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  z-index: 10001;
}

/* ────────────────────────────────────
   Toolbar Container
──────────────────────────────────── */
.key3mhp-toolbar {
  position: fixed;
  top: 110px;
  left: 0;
  z-index: 10000;
  width: 50px;
  max-width: 50px;
  padding: 12px 3px;
  background: rgba(255,255,255,0.95);
  box-shadow: 2px 6px 24px #9992;
  border-radius: 0px;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  /*transition: left 0.2s;*/
  transition: transform 0.3s ease;
  touch-action: none;
  pointer-events: auto;
  cursor: move;
}

/* Fully slide it left */
#key3mhp-toolbar.hidden-left {
  transform: translateX(-100%);
}

/* Toolbar Elements */
.key3mhp-toolbar label,
.key3mhp-toolbar select,
.key3mhp-toolbar input,
.key3mhp-toolbar button {
  width: 100%;
  font-size: 12px;
  margin-bottom: 2px;
  box-sizing: border-box;
}
.key3mhp-toolbar button {
  border-radius: 16px;
  border: 1px solid;
  min-width: 0;
}
.key3mhp-toolbar hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid #eee;
}

/* Locked state */
.locked {
  opacity: 0.4;
  cursor: allowed;
  pointer-events: none;
}

/* ────────────────────────────────────
   Template-Picker Dropdown
──────────────────────────────────── */
#key3mhp-template-picker,
#key3mhp-bg-anim,
#key3mhp-font-family {
  width: 100% !important;
  padding: 2px 4px !important;
  font-size: 12px !important;
  background: white !important;
  border: 1px solid #ccc !important;
  appearance: auto !important;
  box-sizing: border-box !important;
}
#key3mhp-template-picker::-ms-expand,
#key3mhp-bg-anim::-ms-expand,
#key3mhp-font-family::-ms-expand {
  display: block !important;
}

/* Font size input */
#key3mhp-font-size {
  width: 3.5em !important;
  padding: 0 4px !important;
  font-size: 12px !important;
  appearance: none !important;
}
#key3mhp-font-size::-webkit-inner-spin-button,
#key3mhp-font-size::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ────────────────────────────────────
   Text Boxes
──────────────────────────────────── */
/* STYLING For All BOXES */
.key3mhp-textbox {
  position: absolute;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: #222;
  font-weight: bold;
  text-align: center;
  outline: none;
  resize: none;
  overflow: visible;
  z-index: 10;
  transition: box-shadow 0.12s;
  will-change: left, top, width, height;
  pointer-events: auto;
  cursor: default;
  font-family: inherit;
  transform-origin: center center;
}

/* Image inside box */
.key3mhp-textbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
}

/* force every “×” delete‐handle to render at exactly 20px */
.key3mhp-textbox .delete-handle {
  font-size: 20px !important;
  line-height: 15px !important; /* keep it vertically centered */
  width:      20px !important;
  height:     20px !important;
}

/* END STYLING For All BOXES */

/* OWNER ONLY STYLING */
.key3mhp-textbox.owner:hover {
    cursor: default;
}
.key3mhp-textbox.owner.selected {
  border: 3px dashed #d66e24;
  box-shadow: 2px 4px 20px #b7a57a18, 0 1px 0 #ccc;
  cursor: move;
}
/* Owner handles on hover/selected */
.key3mhp-textbox.owner:hover .resize-handle,
.key3mhp-textbox.owner.selected .resize-handle{
  display: block;
  pointer-events: auto;
}
.key3mhp-textbox.owner:hover .delete-handle,
.key3mhp-textbox.owner.selected .delete-handle {
  display: block;
  pointer-events: auto;
}
/* new rule: if user hovers the image itself */
.key3mhp-textbox.owner img:hover + .delete-handle {
  display: block;
  pointer-events: auto;
}

/* VISITOR ONLY STYLING */
.key3mhp-textbox:not(.owner):hover,
.key3mhp-textbox:not(.owner).selected {
  border: none !important;
  box-shadow: none !important;
  cursor: default !important;
}
.key3mhp-textbox:not(.owner) .resize-handle,
.key3mhp-textbox:not(.owner) .delete-handle {
  display: none !important;
}

/* ────────────────────────────────────
   Resize & Delete Handles
──────────────────────────────────── */
/* Resize handle: blue with double-direction (NW↔SE) arrow */
.key3mhp-textbox .resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background-color: #3c6bc2;       /* requested blue */
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
  cursor: nwse-resize;
  z-index: 11;
  display: none; /* your logic shows it on hover/selected */
}

/* Arrow icon (SVG) */
.key3mhp-textbox .resize-handle::before {
  content: "";
  position: absolute;
  inset: 3px;                      /* padding inside the square */
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* white double-headed diagonal arrow (NW <-> SE) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5 L19 19'/%3E%3Cpath d='M5 9 L5 5 L9 5'/%3E%3Cpath d='M15 19 L19 19 L19 15'/%3E%3C/svg%3E");
}

/* Hover/selected polish (optional) */
.key3mhp-textbox.owner:hover .resize-handle,
.key3mhp-textbox.owner.selected .resize-handle {
  display: block;
}
.key3mhp-textbox .resize-handle:hover {
  background-color: #4a7bd6;       /* subtle lift on hover */
}

/* Bigger touch target on mobile (no hover on touch) */
@media (pointer: coarse) {
  .key3mhp-textbox.owner .resize-handle {
    display: block;                 /* show for owners on touch */
  }
  .key3mhp-textbox .resize-handle {
    width: 20px;
    height: 20px;
    bottom: 2px;
    right: 2px;
    border-radius: 8px;
  }
}

.key3mhp-textbox .delete-handle {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  line-height: 15px;
  padding: 0;
  text-align: center;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  color: #992400;
  cursor: default;
  z-index: 12;
  font-size: 0.8em;
  display: none;
  pointer-events: auto !important;
}

@media (pointer: coarse) {
  .key3mhp-textbox.owner.selected .resize-handle { display: block; }
}

/* ────────────────────────────────────
   Built-In Template Sizes
──────────────────────────────────── */
.key3mhp-textbox[data-template="title"]    { font-size: 3em  !important; }
.key3mhp-textbox[data-template="subtitle"] { font-size: 2em  !important; }
.key3mhp-textbox[data-template="body"]     { font-size: 1.5em!important; }
.key3mhp-textbox[data-template="quote"]    { font-size: 1.7em!important; }
.key3mhp-textbox[data-template="timeline"] { font-size: 1.4em!important; }
.key3mhp-textbox[data-template="memory"]   {
  font-size: 1.6em!important;
  background: rgba(255,245,204,0.96);
  font-family: "Comic Sans MS", cursive, sans-serif;
}

/* Other template backgrounds */
.key3mhp-textbox[data-template="quote"]    { background: rgba(245,245,255,0.97); font-style: italic; }
.key3mhp-textbox[data-template="timeline"] { background: rgba(230,246,255,0.97); }
.key3mhp-textbox[data-template="memory"]   { /* merged above */ }

.key3mhp-textbox-content {
  width: 100%;
  height: 100%;
  outline: none;
}

/* ────────────────────────────────────
   Canvas Animations
──────────────────────────────────── */
.key3mhp-canvas-root.template-starter .key3mhp-canvas,
.key3mhp-canvas-root.template-collage .key3mhp-canvas {
  animation: key3mhp-kenburns 30s ease-in-out infinite alternate;
}

/* ────────────────────────────────────
   Keyframes
──────────────────────────────────── */
@keyframes key3mhp-kenburns {
  from { background-position: 60% 50%; }
  to   { background-position: 40% 55%; }
}
@keyframes key3mhp-pan {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 55%; }
}

/* ────────────────────────────────────
   Media Queries
──────────────────────────────────── */
@media (max-width: 600px) {
  .key3mhp-toolbar {
    top: 0;
    left: 0;
    border-radius: 0;
  }
}
