/* ============================================
   HAPPY BIRTHDAY SHANNON
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Dark linen texture */
  background-color: #1a1a1a;
  background-image:
    repeating-linear-gradient(
      92deg,
      transparent 0px, transparent 3px,
      rgba(26,26,26,0.55) 3px, rgba(26,26,26,0.55) 4px,
      transparent 4px, transparent 7px,
      rgba(26,26,26,0.30) 7px, rgba(26,26,26,0.30) 8px
    ),
    repeating-linear-gradient(
      178deg,
      transparent 0px, transparent 4px,
      rgba(26,26,26,0.50) 4px, rgba(26,26,26,0.50) 5px,
      transparent 5px, transparent 9px,
      rgba(26,26,26,0.25) 9px, rgba(26,26,26,0.25) 10px
    ),
    repeating-linear-gradient(
      47deg,
      transparent 0px, transparent 11px,
      rgba(26,26,26,0.18) 11px, rgba(26,26,26,0.18) 12px
    ),
    repeating-linear-gradient(
      -43deg,
      transparent 0px, transparent 13px,
      rgba(26,26,26,0.14) 13px, rgba(26,26,26,0.14) 14px
    ),
    repeating-linear-gradient(
      83deg,
      transparent 0px, transparent 22px,
      rgba(26,26,26,0.08) 22px, rgba(26,26,26,0.08) 23px,
      transparent 23px, transparent 38px,
      rgba(13,13,13,0.12) 38px, rgba(13,13,13,0.12) 39px
    );
}

/* ---- Phone container ---- */
.phone-container {
  position: relative;
  aspect-ratio: 393 / 852;
  width: min(82vw, calc(84dvh * 393 / 852));
  filter:
    drop-shadow(0 28px 56px rgba(0,0,0,0.70))
    drop-shadow(0 8px 20px rgba(0,0,0,0.50));
}

/* SVG fills the container — home screen drawn inside it */
.phone-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Shell overlay — always on top of views, clicks pass through */
.phone-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

/* ---- Screen overlay — clipped to SVG screen rect (x=8,y=8,w=377,h=836,rx=47) ---- */
.screen {
  position: absolute;
  left:   2.04%;    /* 8/393 */
  top:    0.94%;    /* 8/852 */
  width:  95.93%;   /* 377/393 */
  height: 98.12%;   /* 836/852 */
  border-radius: 12.47% / 5.62%; /* rx=47/377, ry=47/836 */
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

/* ---- Views ---- */
.view {
  position: absolute;
  inset: 0;
  background: #fff;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  pointer-events: none;
  overflow: hidden;
}

.view.active {
  transform: translateY(0);
  pointer-events: auto;
}

/* ---- Shared iOS header ---- */
.ios-header {
  height: 52px;
  margin-top: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  flex-shrink: 0;
  position: relative;
  background: #1c1c1e;
}

.ios-header--light {
  background: rgba(255,255,255,0.94);
  border-bottom-color: rgba(0,0,0,0.12);
}

.header-title {
  font-family: -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.header-title--dark { color: #000; }

.back-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: #4FC3F7;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

.back-btn--dark { color: #007AFF; }

.back-btn--messages {
  position: absolute;
  top: 46px;
  left: 12px;
  z-index: 20;
  color: #4FC3F7;
  font-size: 34px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
  padding: 4px 8px;
}

/* ======= PHONE / VOICEMAIL ======= */
.view-phone {
  background: #1c1c1e;
  display: flex;
  flex-direction: column;
}

.voicemail-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.vm-item {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vm-item:active { background: rgba(255,255,255,0.015); }

.vm-caller {
  font-family: -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}

.vm-meta {
  font-family: -apple-system, sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
}

.vm-player {
  display: none;
  margin-top: 12px;
  align-items: center;
  gap: 10px;
}

.vm-item.expanded .vm-player { display: flex; }

.vm-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4FC3F7;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vm-play-btn svg { width: 14px; height: 14px; fill: #fff; margin-left: 2px; }
.vm-play-btn.playing svg { margin-left: 0; }

.vm-scrubber {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  cursor: pointer;
}

.vm-progress {
  height: 100%;
  background: #4FC3F7;
  border-radius: 2px;
  width: 0%;
}

.vm-duration {
  font-family: -apple-system, sans-serif;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
}

/* ======= MESSAGES ======= */
.view-messages {
  background: #000;
  display: flex;
  flex-direction: column;
}

/* Contact header — floating, transparent, glowing */
.msg-contact-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 42px 0 14px;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(0,0,0,0.90) 0%, rgba(0,0,0,0.60) 55%, transparent 100%);
}

.msg-contact-glow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 24px 4px;
  opacity: 0.80;
}

.msg-avatar-sm {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.msg-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
  transform: scale(1.3);
  transform-origin: center 20%;
}

.msg-header-name {
  font-family: -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #007AFF;
}

/* Thread */
.message-thread {
  flex: 1;
  overflow-y: auto;
  padding: 110px 12px 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.bubble-time {
  font-family: -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #636366;
  text-align: center;
  align-self: center;
  margin: 6px 0 4px;
  opacity: 0;
  transition: opacity 0.28s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.bubble-time.visible { opacity: 1; }

.bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 18px;
  font-family: -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  word-break: break-word;
}

.bubble.visible { opacity: 1; transform: translateY(0); }

.bubble.right {
  background: #007AFF;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}
.bubble.left {
  background: #3A3A3C;
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

/* Delivered receipt */
.msg-delivered {
  font-family: -apple-system, sans-serif;
  font-size: 10px;
  color: #8E8E93;
  align-self: flex-end;
  padding-right: 2px;
  margin-top: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.msg-delivered.visible { opacity: 1; }


/* Bottom fade — messages dissolve before dock */
.view-messages::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, #000);
  pointer-events: none;
  z-index: 5;
}

/* ======= PHOTOS / VIDEO ======= */
.view-photos {
  background: #000;
  transform: translateY(calc(100% + 4px));
}

.view-photos video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.back-btn--video {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  color: #fff;
  font-size: 34px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.video-tap-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 5;
}

/* ======= HTML DOCK BAR (overlays views) ======= */
.dock-bar {
  position: absolute;
  /* SVG dock rect: x=24 y=698 w=345 h=112 out of 393x852 */
  left:   6.11%;   /* 24/393 */
  top:    81.92%;  /* 698/852 */
  width:  87.79%;  /* 345/393 */
  height: 13.15%;  /* 112/852 */
  border-radius: 6.6% / 23%;
  background: rgba(30, 30, 30, 0.72);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1.5px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4%;
  z-index: 10;
  pointer-events: auto;
}

.dock-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 6% 0;
  border-radius: 12px;
  transition: opacity 0.15s ease;
}

.dock-btn:active { opacity: 0.6; }

.dock-btn img {
  width: 62%;
  height: auto;
  display: block;
}

.dock-btn span {
  font-family: -apple-system, sans-serif;
  font-size: clamp(8px, 1.5vw, 11px);
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

/* Dim non-active icons when a view is open */
.dock-btn.inactive {
  opacity: 0.45;
}

