/* HUM-103 land-on-chat. The existing Ask Amp panel fills this page.
   Scoped to html.ask-land so the homepage panel is untouched. */

html.ask-land,
html.ask-land body {
  margin: 0;
  min-height: 100%;
  background: var(--ha-paper);
  color: var(--ha-ink);
}

html.ask-land body > main {
  box-sizing: border-box;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  text-align: center;
}

html.ask-land h1 {
  margin: 0;
  font:
    700 28px/1.2 Manrope,
    var(--ha-font-sans),
    sans-serif;
}

html.ask-land p {
  margin: 0;
  max-width: 28rem;
  font:
    16px/1.5 Manrope,
    var(--ha-font-sans),
    sans-serif;
}

html.ask-land a {
  color: var(--ha-bloom-deep);
}

/* Shown only if the panel is minimised. Not the wet-note launcher. */
.ask-land-reopen {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--ha-ink);
  border-radius: 999px;
  background: var(--ha-ink);
  color: var(--ha-paper);
  font:
    600 15px/1.2 Manrope,
    var(--ha-font-sans),
    sans-serif;
  cursor: pointer;
}

html.amp-chat-is-open .ask-land-reopen {
  display: none;
}

html.ask-land.amp-chat-is-open,
html.ask-land.amp-chat-is-open body {
  overflow: hidden;
  height: 100%;
}

html.ask-land .amp-chat-expand,
html.ask-land .amp-chat-resize {
  display: none;
}

html.ask-land .amp-chat-header {
  cursor: default;
  touch-action: auto;
}

/* Edge to edge. Safe areas sit in the header and composer so the keyboard
   pin from amp-chat.js still owns the shell box. Review mode keeps the
   letter layout from amp-chat.css. */
html.ask-land:not(.amp-review-is-open) .amp-chat-shell {
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-height: none;
  border-radius: 0;
  background: var(--ha-paper);
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}

html.ask-land:not(.amp-review-is-open) .amp-chat-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

html.ask-land:not(.amp-review-is-open) .amp-chat-header {
  padding-top: calc(3px + env(safe-area-inset-top, 0px));
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
}

html.ask-land:not(.amp-review-is-open) .amp-chat-thread {
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

html.ask-land:not(.amp-review-is-open) .amp-chat-composer {
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

/* HUM-110. Compact Lee mark in the land-on-chat header. Host-gated by
   html.ask-land-lee, so this never becomes a banner on other hosts. */
html.ask-land.ask-land-lee .amp-chat-header {
  justify-content: space-between;
  min-height: 72px;
}

html.ask-land.ask-land-lee .amp-chat-header-actions {
  flex: none;
}

html.ask-land.ask-land-lee .ask-land-persona {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font:
    600 13px/1.2 Manrope,
    var(--ha-font-sans),
    sans-serif;
}

html.ask-land.ask-land-lee .ask-land-persona-mark {
  display: block;
  width: auto;
  height: 64px;
  max-width: 72px;
  max-height: 72px;
  flex: none;
  object-fit: contain;
  border-radius: 8px;
}

html.ask-land.ask-land-lee .ask-land-persona-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

html.ask-land.ask-land-lee .ask-land-persona-sep {
  color: var(--ha-ink-soft);
  font-weight: 500;
}

@media (max-width: 380px) {
  html.ask-land.ask-land-lee .amp-chat-header {
    min-height: 56px;
  }

  html.ask-land.ask-land-lee .ask-land-persona-mark {
    height: 48px;
  }
}

/* Dave's mark on dave.humanamp.bot only. dave-persona.js adds ask-dave
   from that host, so humanamp.ai/ask/ keeps the plain header. A 44px
   round chip and the name, on the same row as the window controls, the
   way Archie's header carries his avatar. The thread and the microphone
   hint stay where they are. */
html.ask-dave .amp-chat-header {
  justify-content: flex-start;
}

html.ask-dave .amp-chat-persona {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-right: auto;
}

html.ask-dave .amp-chat-persona img {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ha-paper);
}

html.ask-dave .amp-chat-identity {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  html.ask-land .ask-land-reopen {
    transition: none;
  }
}
