/* ==========================================================================
   Landing (B1) — the promise, the AI line that proves it, and the
   portfolio box resting half below the screen edge.
   ========================================================================== */

.landing {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 460px;
  overflow: hidden;
  background: var(--white);
  color: var(--black);
}

body:not([data-view="landing"]) .landing {
  display: none;
}

/* ---- Hero: tagline + AI line + "Customize manually" -------------------- */

.landing__hero {
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  transform: translateY(-50%);
  z-index: var(--z-landing-cta);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2vh, 22px);
  padding: 0 20px;
  transition: opacity .4s var(--ease-out);
}

.landing__tagline {
  font-weight: var(--fw-thin);
  font-size: clamp(13px, 1.5vw, 20px);
  letter-spacing: .02em;
  text-align: center;
  text-transform: uppercase;
  animation: fadeIn .3s ease backwards;
}

/* The prompt line. Placeholder is a separate layer so it can carry a caret. */
.ai-line {
  position: relative;
  display: block;
  width: min(680px, 92vw);
  cursor: text;
  animation: fadeIn .5s ease .12s backwards;
}

.ai-line__ghost,
.ai-line__input {
  font-weight: var(--fw-thin);
  font-size: clamp(24px, 4.4vw, 58px);
  letter-spacing: -.03em;
}

.ai-line__ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  opacity: .28;
  pointer-events: none;
}

/* Drawn with CSS so it looks the same in every font */
.ai-line__caret {
  display: inline-block;
  flex: none;
  width: .38em;
  height: 1.1em;
  margin-left: .04em;
  background: currentColor;
  opacity: .7;
  animation: caretBlink 1.05s step-end infinite;
}

.ai-line.is-focused .ai-line__caret,
.ai-line.has-text .ai-line__ghost {
  display: none;
}

.ai-line__input {
  display: block;
  width: 100%;
  padding: 8px 0 14px;
  background: none;
  border: 0;
  outline: none;
  text-align: center;
  color: var(--black);
  caret-color: var(--black);
  text-shadow: 0 3px 18px rgba(0, 0, 0, .16);
}

/* Visible focus ring would clash with the caret — the caret *is* the focus cue. */
.ai-line__input:focus-visible {
  outline: none;
}

.landing__manual {
  display: inline-flex;
  align-items: center;
  gap: clamp(9px, 1vw, 14px);
  margin-top: clamp(4px, 1.4vh, 18px);
  padding: 6px 0;
  font-weight: var(--fw-thin);
  font-size: clamp(17px, 2vw, 26px);
  line-height: .95;
  letter-spacing: -.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.landing__manual .chev {
  width: clamp(18px, 2vw, 26px);
  height: clamp(18px, 2vw, 26px);
}

.landing__manual:hover .chev {
  transform: translateX(12px);
}

/* Hide the hero while the AI is working or showing a plan, and while the
   portfolio box is lifted over it. */
.landing.is-ai-busy .landing__hero {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.landing.is-box-lifted .landing__manual {
  opacity: 0;
  pointer-events: none;
}

/* ---- AI states: thinking / plan / error --------------------------------- */

.ai-stage {
  position: absolute;
  inset: 0;
  z-index: 38;
  pointer-events: none;
}

.ai-stage > * {
  pointer-events: auto;
}

.ai-thinking,
.ai-error {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(190px, 34vh, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  text-align: center;
  animation: fadeIn .3s ease;
}

.ai-thinking__text {
  font-weight: var(--fw-thin);
  font-size: clamp(20px, 2.6vw, 32px);
  letter-spacing: -.02em;
  text-shadow: 0 12px 24px rgba(0, 0, 0, .18);
}

.ai-thinking__dot {
  animation: aiPulse 1s ease-in-out infinite;
}

.ai-error__text {
  font-weight: var(--fw-thin);
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: -.02em;
  text-shadow: 0 12px 24px rgba(0, 0, 0, .16);
}

/* Text-only buttons used on the plan ("Adjust", "Start over", "Try again") */
.text-btn {
  padding: 14px 4px;
  font-weight: var(--fw-light);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .55;
  transition: opacity .2s;
}

.text-btn:hover {
  opacity: 1;
}

.ai-plan {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(72px, 15vh, 150px);
  bottom: clamp(14px, 2.6vh, 26px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(20px, 5vw, 48px) 8px;
}

.ai-plan__inner {
  display: flex;
  flex-direction: column;
  max-width: 620px;
  margin: 0 auto;
}

.ai-plan__echo {
  margin-bottom: clamp(16px, 2.6vh, 26px);
  font-weight: var(--fw-thin);
  font-size: clamp(14px, 1.6vw, 18px);
  letter-spacing: -.01em;
  opacity: .4;
  overflow-wrap: anywhere;
  animation: planIn .4s var(--ease-out) backwards;
}

.ai-plan__kicker {
  font-weight: var(--fw-regular);
  font-size: 10px;
  letter-spacing: .26em;
  text-transform: uppercase;
  opacity: .5;
  animation: planIn .45s var(--ease-out) backwards;
}

.ai-plan__options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(14px, 2.2vh, 20px);
  animation: planIn .5s var(--ease-out) backwards;
}

.ai-option {
  flex: 1 1 150px;
  padding: 14px 16px;
  border: 1px solid var(--black);
  background: var(--white);
  color: var(--black);
  text-align: left;
  transition: background .2s, color .2s;
}

.ai-option.is-active {
  background: var(--black);
  color: var(--white);
}

.ai-option__label {
  display: block;
  font-weight: var(--fw-regular);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .7;
}

.ai-option__price {
  display: block;
  margin-top: 6px;
  font-weight: var(--fw-light);
  font-size: clamp(19px, 2.3vw, 26px);
  letter-spacing: -.02em;
}

.ai-option__note {
  display: block;
  margin-top: 6px;
  font-weight: var(--fw-light);
  font-size: 12px;
  line-height: 1.4;
  opacity: .6;
  text-wrap: pretty;
}

.ai-plan__included {
  margin-top: clamp(18px, 2.6vh, 24px);
  font-weight: var(--fw-regular);
  font-size: 10px;
  letter-spacing: .26em;
  opacity: .4;
}

.ai-plan__items {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 16px);
  margin-top: clamp(14px, 2.4vh, 22px);
}

.ai-plan__item,
.ai-plan__discount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
}

.ai-plan__item {
  animation: planIn .5s var(--ease-out) backwards;
}

.ai-plan__item-name {
  font-weight: var(--fw-thin);
  font-size: clamp(17px, 2.1vw, 25px);
  letter-spacing: -.01em;
  text-shadow: 0 10px 20px rgba(0, 0, 0, .14);
}

.ai-plan__item-price {
  font-weight: var(--fw-light);
  font-size: clamp(14px, 1.5vw, 17px);
  white-space: nowrap;
  opacity: .6;
}

.ai-plan__discount {
  margin-top: clamp(10px, 1.6vh, 16px);
  font-size: 13px;
  opacity: .55;
}

.ai-plan__total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(16px, 2.8vh, 26px);
}

.ai-plan__from {
  font-weight: var(--fw-light);
  font-size: 10px;
  letter-spacing: .24em;
  opacity: .5;
}

.ai-plan__amount {
  font-weight: var(--fw-black);
  font-size: clamp(36px, 6.4vw, 72px);
  line-height: .88;
  letter-spacing: -.04em;
  text-shadow: 0 20px 38px rgba(0, 0, 0, .3);
}

.ai-plan__summary {
  margin-top: clamp(14px, 2.2vh, 20px);
  font-weight: var(--fw-light);
  font-size: clamp(13px, 1.5vw, 16px);
  line-height: 1.55;
  opacity: .7;
  text-wrap: pretty;
}

.ai-plan__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: clamp(18px, 3vh, 28px);
}

.ai-plan__pay {
  flex: 1 1 190px;
  padding: 19px 26px;
  background: var(--black);
  color: var(--white);
  font-weight: var(--fw-regular);
  font-size: 14px;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .28);
  transition: transform .2s var(--ease-out), box-shadow .2s;
}

.ai-plan__pay:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(0, 0, 0, .34);
}

.ai-plan__pay:active {
  transform: translateY(1px);
}

/* ---- Portfolio box ------------------------------------------------------ */

.pf-box {
  position: absolute;
  left: clamp(10px, 1.6vw, 24px);
  right: clamp(10px, 1.6vw, 24px);
  bottom: 0;
  z-index: 30;
  display: block;
  width: auto;
  aspect-ratio: 22 / 9;
  max-height: 88vh;
  max-height: 88dvh;
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  background: #111;
  color: var(--white);
  cursor: pointer;
  transform: translateY(72%);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out);
  animation: boxUp .42s var(--ease-out) .06s backwards;
}

.pf-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.pf-box img.is-active {
  opacity: 1;
}

.pf-box__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: var(--fw-thin);
  font-size: clamp(22px, 2.8vw, 44px);
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .45);
  transition: letter-spacing .5s var(--ease-out);
}

/* Lifted: hover on pointer devices, first tap on touch devices */
.pf-box.is-lifted {
  transform: translateY(22%) scale(1.012);
  box-shadow: 0 -30px 80px rgba(0, 0, 0, .34);
}

.pf-box.is-lifted .pf-box__label {
  letter-spacing: .34em;
}

@media (hover: none) and (pointer: coarse) {
  .pf-box.is-lifted {
    transform: translateY(-38vh) scale(1.012);
  }
}

.landing.is-ai-busy .pf-box {
  transform: translateY(100%);
}

/* ---- Small / short screens --------------------------------------------- */

@media (max-width: 479px) {
  .ai-line__ghost,
  .ai-line__input {
    font-size: clamp(22px, 7.4vw, 30px);
  }

  .ai-plan__actions .ai-plan__pay {
    flex-basis: 100%;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .landing__hero {
    top: 34%;
  }

  .pf-box {
    max-height: 70dvh;
  }
}
