/*
 * Homepage welcome pop-up (index.php): a native <dialog class="hm-welcome"> shown to visitors who are not signed in;
 * js/home-welcome.js decides when. Prefixed hm-welcome, scoped under .hm-home (the dialog sits inside it, so the colour
 * tokens from css/home.css apply). Light theme only. Motion is opacity/transform and is off for prefers-reduced-motion.
 */

/* the page behind must not scroll; the gutter stays so nothing shifts when the scrollbar goes away */
html.hm-welcome-open {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.hm-home .hm-welcome {
  width: min(30rem, calc(100vw - 2rem));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hm-ink);
  overflow: visible;
}
/* browsers without <dialog> support have no built-in rule that hides a closed one */
.hm-home .hm-welcome:not([open]) { display: none; }
.hm-home .hm-welcome::backdrop {
  background: rgba(6, 16, 36, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.hm-home .hm-welcome__panel {
  position: relative;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 2.5rem clamp(1.4rem, 1rem + 3vw, 2.75rem) 1.5rem;
  overflow: auto;
  border: 1px solid rgba(201, 164, 107, 0.5);
  border-radius: 22px;
  background: #fffdf8;
  box-shadow: 0 40px 80px -30px rgba(6, 16, 36, 0.75);
  text-align: center;
}
/* a gold band along the top edge */
.hm-home .hm-welcome__panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, #f2cb7e, #d4a24a, #f2cb7e);
}

.hm-home .hm-welcome__mark {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: var(--hm-navy);
  color: var(--hm-gold);
  font-size: 1.5rem;
  box-shadow: 0 0 0 5px #fffdf8, 0 0 0 6px rgba(201, 164, 107, 0.7);
}
.hm-home .hm-welcome__eyebrow {
  margin: 0 0 0.55rem;
  font: 700 0.74rem / 1 var(--hm-sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--hm-gold-ink);
}
.hm-home .hm-welcome__title {
  margin: 0;
  padding: 0;
  border: 0;
  font: 700 clamp(1.7rem, 1.4rem + 1.3vw, 2.2rem) / 1.15 var(--hm-serif);
  color: var(--hm-navy);
  text-wrap: balance;
}
.hm-home .hm-welcome__text {
  margin: 0.85rem auto 1.6rem;
  max-width: 24rem;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--hm-muted);
  text-wrap: pretty;
}

.hm-home .hm-welcome__actions { display: grid; gap: 0.7rem; }
.hm-home .hm-welcome__actions .hm-btn { width: 100%; }

/* "Continue with Google" (markup from includes/login_page.php; css/login-page.css only styles it on the login page) */
.hm-home .hm-welcome .lg-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid #c9ced6;
  border-radius: 999px;
  background: #fff;
  color: #1f2a40;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.hm-home .hm-welcome .lg-google:hover { background: #f6f8fb; border-color: #aab2bf; box-shadow: 0 6px 16px -10px rgba(10, 35, 66, 0.5); }
.hm-home .hm-welcome .lg-google__mark { display: inline-flex; }
.hm-home .hm-welcome .lg-google__logo { display: block; width: 18px; height: 18px; }

.hm-home .hm-welcome__later {
  min-height: 2.75rem;
  margin-top: 0.6rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--hm-muted);
  font: inherit;
  font-size: 0.93rem;
  text-decoration: underline;
  text-decoration-color: rgba(10, 35, 66, 0.3);
  text-underline-offset: 0.25em;
  cursor: pointer;
}
.hm-home .hm-welcome__later:hover { color: var(--hm-navy); text-decoration-color: var(--hm-navy); }

.hm-home .hm-welcome__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hm-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.hm-home .hm-welcome__close:hover { background: rgba(10, 35, 66, 0.08); color: var(--hm-navy); }
.hm-home .hm-welcome button:focus-visible { outline: 3px solid var(--hm-gold-ink); outline-offset: 2px; }

/* Phones: a compact sheet along the bottom edge, not a box that fills the screen */
@media (max-width: 600px) {
  .hm-home .hm-welcome { width: 100%; margin: auto 0 0; }
  .hm-home .hm-welcome__panel {
    max-height: 88vh;
    max-height: 88dvh;
    padding: 3.4rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: 22px 22px 0 0;
  }
  .hm-home .hm-welcome__mark,
  .hm-home .hm-welcome__eyebrow { display: none; }
  .hm-home .hm-welcome__title { font-size: 1.55rem; }
  .hm-home .hm-welcome__text { margin: 0.6rem auto 1.1rem; font-size: 0.97rem; line-height: 1.5; }
  .hm-home .hm-welcome__actions { gap: 0.55rem; }
  .hm-home .hm-welcome__close { top: 0.4rem; right: 0.4rem; }
  .hm-home .hm-welcome__later { margin-top: 0.3rem; }
}

@keyframes hm-welcome-in { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
@keyframes hm-welcome-sheet { from { transform: translateY(100%); } }
@keyframes hm-welcome-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .hm-home .hm-welcome[open] .hm-welcome__panel { animation: hm-welcome-in 0.45s var(--hm-ease) both; }
  .hm-home .hm-welcome[open]::backdrop { animation: hm-welcome-fade 0.35s ease both; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 600px) {
  .hm-home .hm-welcome[open] .hm-welcome__panel { animation: hm-welcome-sheet 0.4s var(--hm-ease) both; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-home .hm-welcome .lg-google,
  .hm-home .hm-welcome__close { transition: none; }
}
