/* ============================================================
   BLOOM & YOU — layout (mobile-first)
   ============================================================ */

/* ---------------- OPENING ---------------- */
.opening {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b));
  text-align: center;
  transition: opacity var(--t-slow) var(--ease-soft), visibility var(--t-slow);
}
.opening.is-leaving { opacity: 0; visibility: hidden; }

.opening-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.opening-art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--sage-deep);
  opacity: 0.28;
}
.opening-blooms { fill: var(--soft-pink); opacity: 0.5; }
.opening-lines { opacity: 0.6; }

.opening-copy {
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: rise-in 900ms var(--ease-soft) both;
}

.opening-title {
  font-size: clamp(2.9rem, 15vw, 5.2rem);
  letter-spacing: -0.01em;
}
.opening-title .amp { color: var(--dusty-rose); font-style: italic; }

.opening-tagline {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 4.6vw, 1.6rem);
  font-style: italic;
  color: var(--ink-soft);
}
.opening-sub {
  font-size: 0.94rem;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.petal {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 60% 20% 60% 20%;
  background: linear-gradient(140deg, var(--blush), var(--soft-pink));
  opacity: 0.75;
  animation: petal-fall linear infinite;
}
.petal-1 { left: 12%; top: -6%;  animation-duration: 17s; animation-delay: -2s; }
.petal-2 { left: 34%; top: -10%; animation-duration: 22s; animation-delay: -9s; transform: scale(0.8); }
.petal-3 { left: 58%; top: -8%;  animation-duration: 19s; animation-delay: -14s; transform: scale(1.15); }
.petal-4 { left: 78%; top: -12%; animation-duration: 25s; animation-delay: -5s; transform: scale(0.7); }
.petal-5 { left: 92%; top: -6%;  animation-duration: 21s; animation-delay: -18s; transform: scale(0.95); }

/* ---------------- WORKSPACE SHELL ---------------- */
.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "top"
    "stage"
    "tool"
    "nav";
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.workspace.is-appearing { animation: fade-in var(--t-slow) var(--ease-soft) both; }

/* ---------------- TOPBAR ---------------- */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(6px + var(--safe-t)) 8px 6px;
  background: linear-gradient(var(--surface-glass), rgba(255, 253, 250, 0.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.step-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  line-height: 1.15;
}
.step-count {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.step-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.24rem;
  font-weight: 600;
}

.topbar-actions { display: flex; gap: 2px; }

/* ---------------- STAGE ---------------- */
.stage-wrap {
  grid-area: stage;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 2px;
  overflow: hidden;
}
#bouquet-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: var(--surface-glass);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease-soft);
}
.stage-hint.is-hidden { opacity: 0; }

/* ---------------- TOOL PANEL (mobile bottom sheet) ---------------- */
.toolpanel {
  grid-area: tool;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-3);
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  transition: max-height var(--t-med) var(--ease-soft);
}
.toolpanel.is-collapsed { max-height: 62px; }

/* ---------------- SELECTED PANEL (mobile bottom sheet) ---------------- */
.selectedpanel {
  grid-area: tool;
  position: relative;
  z-index: 20;
  min-width: 0;
  max-height: 68vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-3);
  padding-bottom: var(--safe-b);
  animation: sheet-up var(--t-med) var(--ease-spring) both;
}

/* while something is selected the tool sheet steps aside entirely on
   mobile, so there is never a covered-but-tappable region underneath */
@media (max-width: 879px) {
  .workspace.has-selection .toolpanel { display: none; }
}

/* ---------------- REVEAL MODE ---------------- */
.workspace.is-reveal {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "stage";
}
.workspace.is-reveal .topbar,
.workspace.is-reveal .toolpanel,
.workspace.is-reveal .selectedpanel,
.workspace.is-reveal .stepnav,
.workspace.is-reveal .stage-hint {
  display: none !important;
}
.is-reveal .stage-wrap { padding-bottom: 168px; }

.reveal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 22px 18px calc(24px + var(--safe-b));
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease-soft);
}
.reveal.is-on { opacity: 1; }
.reveal-petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.reveal-card {
  position: relative;
  width: min(30rem, 100%);
  pointer-events: auto;
  text-align: center;
}

@media (min-width: 880px) {
  .is-reveal .stage-wrap { padding-bottom: 150px; }
  .reveal { padding-bottom: calc(40px + var(--safe-b)); }
}

/* ---------------- STEP NAV (mobile) ---------------- */
.stepnav {
  grid-area: nav;
  display: flex;
  justify-content: space-between;
  gap: 2px;
  padding: 4px 6px calc(6px + var(--safe-b));
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.stepnav::-webkit-scrollbar { display: none; }

/* ============================================================
   DESKTOP / TABLET
   ============================================================ */
@media (min-width: 880px) {
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "top  top   top"
      "tool stage sel";
  }

  .toolpanel {
    max-height: none;
    height: 100%;
    border-top: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    background: var(--surface-2);
  }
  .toolpanel.is-collapsed { max-height: none; }

  .selectedpanel {
    position: static;
    grid-area: sel;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--line);
    box-shadow: none;
    background: var(--surface-2);
    animation: none;
    padding-bottom: 0;
  }

  .stepnav { display: none; }

  .topbar { padding: 8px 16px; }
  .step-name { font-size: 1.4rem; }
  .topbar-actions { gap: 4px; }

  .stage-wrap { padding: 10px; }
  .stage-hint { bottom: 14px; }
}

@media (min-width: 1200px) {
  .workspace { grid-template-columns: 340px minmax(0, 1fr) 340px; }
}

/* short phones: give the bouquet more room */
@media (max-height: 720px) and (max-width: 879px) {
  .toolpanel { max-height: 40vh; }
}

/* short landscape phones */
@media (max-height: 560px) and (max-width: 879px) {
  .toolpanel { max-height: 40vh; }
  .opening-sub { display: none; }
}
