/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  color: #1a1a1a;
}

body {
  background-image: url("assets/mobile_background.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: #b48a4a;
}

/* lock the viewport to a phone-shaped stage but let the background fill */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2000ms ease;
  padding: 0 6vw;
}

/* the thank-you screen fades in slower for a more contemplative beat */
#thanks { transition: opacity 2500ms ease; }

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* a transient "background only" state — used when we want everything to fade out
   and you only see the background image for a beat before the next screen fades in */
.screen.fading-out { opacity: 0; pointer-events: none; }

/* ---------- cream panel ---------- */
.cream-panel {
  background-color: #f5f1e1;
  width: min(68vw, 330px);
  padding: 4.5vw 4.5vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3vw;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* home panel is narrower than record/write/thanks so the painting reads
   prominently behind it — matches the proportions of the home mockup.
   Nudged below center so more sky/houses show above. */
.home-panel {
  width: min(52vw, 250px);
  padding: 3vw 3vw;
  gap: 2.5vw;
  transform: translateY(3vh);
}

/* ---------- home screen ---------- */
.home-panel .card-button {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  display: block;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: none;
}

.home-panel .card-button img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* ---------- record screen ---------- */
.record-panel {
  gap: 5vw;
  padding-top: 7vw;
  padding-bottom: 7vw;
}

.name-input {
  width: 92%;
  padding: 3vw 4vw;
  font: inherit;
  font-size: clamp(16px, 4.6vw, 22px);
  color: #555;
  background: #fdfcf6;
  border: 1.2px solid #111;
  border-radius: 999px;
  outline: none;
  text-align: center;
}

.name-input::placeholder { color: #9a9a93; }
.name-input:focus { border-color: #000; }

.record-button {
  background: transparent;
  border: none;
  padding: 0;
  margin: 2vw 0 0;
  cursor: pointer;
  width: 55%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-button img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  transition: opacity 300ms ease;
}

/* heartbeat: flash, short dip, flash, smooth long fade out, repeat.
   Two beats live in the first ~20% of the cycle (peaks at 0% and 20%);
   the remaining 80% is one continuous decay from full opacity down to 0,
   so the tail glides out instead of stalling at low opacity. */
@keyframes heartbeat-fade {
  0%    { opacity: 1;   transform: scale(1.04); }
  10%   { opacity: 0.2; transform: scale(0.98); }
  12.5% { opacity: 1;   transform: scale(1.04); }
  100%  { opacity: 0;   transform: scale(1); }
}

.record-button.recording img {
  /* linear easing on the tail keeps the long fade-out from stalling near zero;
     the two beat peaks still pop because they're driven by adjacent keyframes. */
  animation: heartbeat-fade 3.2s linear infinite;
  transform-origin: center;
}

.record-status {
  margin: 0;
  font-size: clamp(18px, 5vw, 24px);
  color: #444;
  text-align: center;
  font-weight: 500;
}

.record-sub {
  margin: -1.5vw 0 0;
  font-size: clamp(12px, 3.4vw, 16px);
  color: #888;
  text-align: center;
  font-weight: 400;
}

/* ---------- write screen ---------- */
.write-panel {
  gap: 4vw;
  padding-top: 6vw;
  padding-bottom: 6vw;
}

.story-input {
  width: 92%;
  height: 48vh;
  padding: 5vw;
  font: inherit;
  font-size: clamp(16px, 4.6vw, 22px);
  color: #555;
  background: #ffffff;
  border: 1.2px solid #111;
  border-radius: 22px;
  outline: none;
  resize: none;
  text-align: center;
}

.story-input::placeholder { color: #9a9a93; }
.story-input:focus { border-color: #000; }

.submit-button {
  background: #fdfcf6;
  border: 1.2px solid #111;
  border-radius: 18px;
  padding: 2.5vw 6vw;
  font: inherit;
  font-size: clamp(14px, 4vw, 18px);
  color: #2a2a2a;
  cursor: pointer;
  text-align: center;
  line-height: 1.15;
}

/* ---------- thanks screen ---------- */
.thanks-panel {
  gap: 3.5vw;
  padding-top: 5vw;
  padding-bottom: 5vw;
}

.thanks-image {
  width: 92%;
  height: auto;
  display: block;
}

.thanks-quote {
  margin: 0;
  padding: 0 2vw;
  font-size: clamp(13px, 3.7vw, 17px);
  line-height: 1.35;
  color: #777;
  text-align: center;
  font-style: italic;
}

.thanks-attrib {
  display: block;
  margin-top: 0.4em;
  font-style: normal;
}

.another-button {
  background: #fdfcf6;
  border: 1.2px solid #111;
  border-radius: 14px;
  padding: 2.5vw 8vw;
  font: inherit;
  font-size: clamp(14px, 4vw, 18px);
  color: #2a2a2a;
  cursor: pointer;
  margin-top: 1vw;
}

/* ---------- small tweaks for narrow phones ---------- */
@media (max-height: 700px) {
  .story-input { height: 42vh; }
  .cream-panel { padding: 4vw 4.5vw; }
}
