/* iPhone hero — fleet command app mockup */

.hero-video-wrap {
  width: 100%;
}

.hero-video-wrap .hero-video {
  width: 100%;
}

.hero-video-wrap .video-slot-placeholder {
  background-color: var(--gray-100);
}

.iphone {
  position: relative;
  width: min(100%, 292px);
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.1));
}

/* Side hardware buttons */
.iphone-side-btn {
  position: absolute;
  background: linear-gradient(180deg, #48484a 0%, #2c2c2e 45%, #1c1c1e 100%);
  border-radius: 1px;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.iphone-side-btn--silent {
  left: -2px;
  top: 100px;
  width: 2px;
  height: 24px;
}

.iphone-side-btn--vol-up {
  left: -2px;
  top: 138px;
  width: 2px;
  height: 38px;
}

.iphone-side-btn--vol-down {
  left: -2px;
  top: 186px;
  width: 2px;
  height: 38px;
}

.iphone-side-btn--power {
  right: -2px;
  top: 156px;
  width: 2px;
  height: 56px;
}

.iphone-frame {
  position: relative;
  background: linear-gradient(160deg, #3a3a3c 0%, #1c1c1e 38%, #0d0d0f 100%);
  border-radius: 46px;
  padding: 9px;
  border: 0.5px solid #525255;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

.iphone-frame::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 42px;
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 1;
}

/* Dynamic Island */
.iphone-island {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 22px;
  background: #000;
  border-radius: 18px;
  z-index: 12;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 9px;
}

.iphone-island-cam {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1a2840 0%, #060608 60%, #000 100%);
  box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.12);
}

.iphone-screen {
  position: relative;
  border-radius: 37px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9 / 19.5;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);
}

.iphone-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 15;
}

.iphone-home-bar {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 3px;
  background: rgba(255, 255, 255, 0.42);
  border-radius: 3px;
  z-index: 20;
  pointer-events: none;
}

.app-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
  font-family: var(--font-mono);
  color: #e8e8e8;
}

.app-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 2px;
  font-size: 0.5625rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

.app-status-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-header {
  padding: 0 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.app-header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.app-title {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 600;
}

.app-live {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.app-live-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 6px rgba(62, 207, 142, 0.55);
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.app-subtitle {
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.42);
}

/* ── Farm map with aerial photo ── */

.app-map {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #0a0a0a;
}

.app-map-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% center;
}

.app-map-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.3) 100%);
  z-index: 1;
}

.app-map-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.app-map-blocks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
}

.app-map-field {
  fill: rgba(62, 207, 142, 0.1);
  stroke: rgba(62, 207, 142, 0.6);
  stroke-width: 1;
}

.app-map-field--b {
  fill: rgba(210, 170, 80, 0.12);
  stroke: rgba(210, 170, 80, 0.55);
}

.app-map-field--c {
  fill: rgba(80, 160, 255, 0.08);
  stroke: rgba(80, 160, 255, 0.42);
}

.app-map-road {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
}

.app-map-divider {
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.app-map-grid-label {
  font-size: 6.5px;
  fill: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.65);
  stroke-width: 2px;
}

.app-map-robot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.app-map-robot-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 1px solid rgba(62, 207, 142, 0.45);
  border-radius: 50%;
  animation: robot-ring 2.8s ease-out infinite;
}

.app-map-robot-pin {
  position: relative;
  width: 8px;
  height: 8px;
  border: 1.5px solid #3ecf8e;
  background: #3ecf8e;
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(62, 207, 142, 0.5);
}

.app-map-robot-pin--drone {
  transform: none;
  border-radius: 50%;
  width: 7px;
  height: 7px;
  background: #fff;
  border: 2px solid #3ecf8e;
  box-shadow: 0 0 10px rgba(62, 207, 142, 0.55);
}

.app-map-robot--a1 { left: 16%; top: 30%; animation: robot-path-a1 18s ease-in-out infinite alternate; }
.app-map-robot--a2 { left: 16%; top: 72%; animation: robot-path-a2 22s ease-in-out infinite alternate; }
.app-map-robot--a3 { left: 46%; top: 50%; animation: robot-path-a3 16s ease-in-out infinite alternate; }
.app-map-robot--a4 { left: 78%; top: 34%; animation: robot-path-a4 20s ease-in-out infinite alternate; }
.app-map-robot--a5 { left: 82%; top: 68%; animation: robot-path-a5 19s ease-in-out infinite alternate; }

.app-map-robot--a1 .app-map-robot-ring { animation-delay: 0s; }
.app-map-robot--a2 .app-map-robot-ring { animation-delay: 0.5s; }
.app-map-robot--a3 .app-map-robot-ring { animation-delay: 1s; }
.app-map-robot--a4 .app-map-robot-ring { animation-delay: 1.5s; }
.app-map-robot--a5 .app-map-robot-ring { animation-delay: 2s; }

@keyframes robot-ring {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes robot-path-a1 {
  from { left: 14%; top: 26%; }
  to { left: 20%; top: 36%; }
}

@keyframes robot-path-a2 {
  from { left: 14%; top: 70%; }
  to { left: 19%; top: 78%; }
}

@keyframes robot-path-a3 {
  from { left: 42%; top: 46%; }
  to { left: 50%; top: 54%; }
}

@keyframes robot-path-a4 {
  from { left: 74%; top: 30%; }
  to { left: 81%; top: 40%; }
}

@keyframes robot-path-a5 {
  from { left: 78%; top: 64%; }
  to { left: 86%; top: 72%; }
}

.app-map-robot-label {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.4rem;
  letter-spacing: 0.05em;
  color: #fff;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 4px;
  border-radius: 2px;
}

.app-map-overlay {
  position: absolute;
  inset: auto 8px 8px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 0.4rem;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 7px;
  border-radius: 2px;
}

/* ── Fleet panel (desktop) ── */

.app-fleet {
  background: #080808;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 8px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.app-fleet-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.5rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 1px;
}

.app-robot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
}

.app-robot-id {
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  color: #fff;
}

.app-robot-task {
  font-size: 0.4375rem;
  color: rgba(255, 255, 255, 0.36);
  letter-spacing: 0.03em;
}

.app-robot-pct {
  font-size: 0.5rem;
  color: rgba(255, 255, 255, 0.52);
  text-align: right;
}

.app-robot-bar {
  grid-column: 1 / -1;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 1px;
  overflow: hidden;
}

.app-robot-bar-fill {
  height: 100%;
  width: var(--bar-from, 50%);
  background: linear-gradient(90deg, #2a9d63, #3ecf8e);
  border-radius: 1px;
  animation: bar-drift 8s ease-in-out infinite alternate;
}

.app-robot-row:nth-child(2) .app-robot-bar-fill { animation-duration: 9s; animation-delay: -1s; }
.app-robot-row:nth-child(3) .app-robot-bar-fill { animation-duration: 7s; animation-delay: -2s; }
.app-robot-row:nth-child(4) .app-robot-bar-fill { animation-duration: 10s; animation-delay: -3s; }
.app-robot-row:nth-child(5) .app-robot-bar-fill { animation-duration: 8.5s; animation-delay: -4s; }
.app-robot-row:nth-child(6) .app-robot-bar-fill { animation-duration: 9.5s; animation-delay: -5s; }

@keyframes bar-drift {
  from { width: var(--bar-from, 40%); }
  to { width: var(--bar-to, 85%); }
}

/* ── Desktop ── */

@media (min-width: 901px) {
  .hero-app-wrap {
    padding-right: clamp(0px, 2vw, 24px);
  }

  .iphone {
    width: min(100%, 318px);
  }

  .iphone--showcase {
    width: min(100%, 368px);
    filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.12));
  }

  .iphone--showcase .app-ui {
    min-height: 640px;
  }

  .app-ui {
    min-height: 560px;
  }
}

/* ── App showcase phone ── */

.app-showcase .iphone--showcase {
  width: min(100%, 368px);
}

.app-showcase .app-fleet {
  display: flex;
}

/* ── Mobile: compact phone only outside app showcase ── */

@media (max-width: 900px) {
  .hero-app-wrap {
    justify-content: center;
    margin-bottom: 4px;
  }

  .iphone:not(.iphone--showcase) {
    width: min(234px, 70vw);
    overflow: visible;
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.1));
  }

  .iphone:not(.iphone--showcase) .iphone-frame {
    border-radius: 42px;
    padding: 8px;
  }

  .iphone:not(.iphone--showcase) .iphone-screen {
    aspect-ratio: 9 / 16;
    height: auto;
    border-radius: 34px;
  }

  .iphone:not(.iphone--showcase) .iphone-side-btn--silent { top: 64px; height: 18px; }
  .iphone:not(.iphone--showcase) .iphone-side-btn--vol-up { top: 90px; height: 28px; }
  .iphone:not(.iphone--showcase) .iphone-side-btn--vol-down { top: 126px; height: 28px; }
  .iphone:not(.iphone--showcase) .iphone-side-btn--power { top: 104px; height: 40px; }

  .iphone:not(.iphone--showcase) .app-ui {
    min-height: 0;
    height: 100%;
  }

  .iphone:not(.iphone--showcase) .app-status {
    padding-top: 10px;
  }

  .iphone:not(.iphone--showcase) .app-fleet {
    display: none;
  }

  .iphone:not(.iphone--showcase) .app-map {
    flex: 1;
    min-height: 200px;
  }

  .iphone:not(.iphone--showcase) .iphone-home-bar {
    display: block;
  }

  /* App showcase — full phone, same proportions as desktop */
  .app-showcase .iphone--showcase {
    width: min(368px, 90vw);
    filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.12));
  }

  .app-showcase .iphone--showcase .iphone-frame {
    border-radius: 46px;
    padding: 9px;
  }

  .app-showcase .iphone--showcase .iphone-screen {
    aspect-ratio: 9 / 19.5;
    border-radius: 37px;
    height: auto;
  }

  .app-showcase .iphone--showcase .iphone-side-btn--silent { top: 100px; height: 24px; }
  .app-showcase .iphone--showcase .iphone-side-btn--vol-up { top: 138px; height: 38px; }
  .app-showcase .iphone--showcase .iphone-side-btn--vol-down { top: 186px; height: 38px; }
  .app-showcase .iphone--showcase .iphone-side-btn--power { top: 156px; height: 56px; }

  .app-showcase .iphone--showcase .app-ui {
    min-height: 640px;
    height: auto;
  }

  .app-showcase .iphone--showcase .app-fleet {
    display: flex;
    padding-bottom: 18px;
  }

  .app-showcase .iphone--showcase .app-map {
    flex: 1;
    min-height: 0;
  }

  .app-showcase-device {
    overflow: visible;
    padding: 8px 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-live-dot,
  .app-map-robot,
  .app-map-robot-ring,
  .app-robot-bar-fill {
    animation: none;
  }

  .app-robot-row:nth-child(2) .app-robot-bar-fill { width: 72%; }
  .app-robot-row:nth-child(3) .app-robot-bar-fill { width: 58%; }
  .app-robot-row:nth-child(4) .app-robot-bar-fill { width: 91%; }
  .app-robot-row:nth-child(5) .app-robot-bar-fill { width: 34%; }
  .app-robot-row:nth-child(6) .app-robot-bar-fill { width: 67%; }
}
