/**
 * Manarat iPhone prototype — scoped under .manarat-prototype only.
 * Tweak sizes via the variables below (desktop defaults; tablet/mobile override in mq).
 */

/**
 * Work page: allow tooltip beside device (fp-visual is overflow:hidden by default).
 */
.fp-visual.manarat {
  overflow: visible;
}

.manarat-prototype {
  /* ── Phone / screen sizing (desktop) ───────────────────────────────── */
  --mp-frame-w: 360px;       /* outer device width */
  --mp-frame-h: 740px;       /* outer device height */
  --mp-bezel-x: 10px;        /* horizontal bezel → inner width 340px at 360 frame */
  --mp-bezel-top: 10px;      /* + bottom = 20px vertical chrome → inner height ~720 */
  --mp-bezel-bottom: 10px;
  --mp-frame-radius: 50px;     /* outer corner radius */
  --mp-screen-radius: 38px;    /* inner “glass” corner radius */
  --mp-bezel-color: #1a1a1a;
  --mp-screen-bg: #f5f5f4;

  /* Inner scroll viewport: auto-derived from frame minus bezel, or set manually */
  --mp-inner-w: calc(var(--mp-frame-w) - (var(--mp-bezel-x) * 2));
  --mp-inner-h: calc(var(--mp-frame-h) - var(--mp-bezel-top) - var(--mp-bezel-bottom));

  --mp-status-h: 28px;       /* iOS status bar height */
  --mp-island-w: 92px;
  --mp-island-h: 28px;
  --mp-island-offset-top: 10px; /* from top of frame */

  /* Hover lift (also combined with media scale in transform) */
  --mp-hover-lift: 4px;

  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body, 'Inter', system-ui, -apple-system, sans-serif);
}

/* Lift wrapper: apply hover here so scale + translate compose cleanly */
.manarat-prototype__lift {
  display: block;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.manarat-prototype:hover .manarat-prototype__lift,
.manarat-prototype:focus-within .manarat-prototype__lift {
  transform: translateY(calc(-1 * var(--mp-hover-lift)));
}

/* Outer shell: bezel + shadow + gloss */
.manarat-prototype__frame {
  position: relative;
  width: var(--mp-frame-w);
  height: var(--mp-frame-h);
  background: var(--mp-bezel-color);
  border-radius: var(--mp-frame-radius);
  box-shadow:
    0 28px 56px rgba(0, 0, 0, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: var(--mp-bezel-top) var(--mp-bezel-x) var(--mp-bezel-bottom);
  box-sizing: border-box;
  transition: box-shadow 0.3s ease;
}

.manarat-prototype:hover .manarat-prototype__frame {
  box-shadow:
    0 28px 56px rgba(0, 0, 0, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 32px rgba(45, 212, 191, 0.22),
    0 0 52px rgba(34, 211, 238, 0.12);
}

/* Subtle edge highlight */
.manarat-prototype__frame::after {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: 0;
  border-radius: var(--mp-frame-radius);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Dynamic Island */
.manarat-prototype__island {
  position: absolute;
  top: var(--mp-island-offset-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--mp-island-w);
  height: var(--mp-island-h);
  background: #0a0a0a;
  border-radius: 999px;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Screen cutout */
.manarat-prototype__screen {
  width: var(--mp-inner-w);
  height: var(--mp-inner-h);
  max-width: 100%;
  background: var(--mp-screen-bg);
  border-radius: var(--mp-screen-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Scroll region + custom scrollbar overlay */
.manarat-prototype__body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.manarat-prototype__vscroll {
  position: absolute;
  top: 0;
  right: 2px;
  bottom: 0;
  width: 3px;
  z-index: 6;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.manarat-prototype--vscroll-idle .manarat-prototype__vscroll {
  opacity: 0;
}

.manarat-prototype__vscroll-track {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 10%;
  bottom: 10%;
  width: 2px;
  border-radius: 1px;
  background: rgba(80, 80, 80, 0.35);
}

.manarat-prototype__vscroll-thumb {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 40px;
  border-radius: 1.5px;
  background: linear-gradient(180deg, #5eead4, #22d3ee);
  top: 10%;
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.35);
  transition: top 0.08s ease-out;
}

.manarat-prototype__vscroll.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Hint below device */
.manarat-prototype__ext-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 1;
  transition: opacity 1s ease;
  user-select: none;
}

.manarat-prototype--hint-dismissed .manarat-prototype__ext-hint {
  opacity: 0;
  pointer-events: none;
}

.manarat-prototype__ext-hint-chevron {
  display: flex;
  color: #999;
  line-height: 0;
}

.manarat-prototype__chev {
  display: block;
  width: 18px;
  height: auto;
}

.manarat-prototype__ext-hint-chevron {
  animation: manarat-prototype-hint-bounce 1.5s ease-in-out infinite;
}

.manarat-prototype__ext-hint-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: #999;
}

@keyframes manarat-prototype-hint-bounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(4px);
  }
}

/* First-visit tooltip */
.manarat-prototype__tooltip {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 200px;
  padding: 10px 14px 10px 12px;
  background: rgba(18, 18, 20, 0.94);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 8;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
}

.manarat-prototype__tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: rgba(18, 18, 20, 0.94);
}

.manarat-prototype__tooltip.is-dismissed {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 900px) {
  .manarat-prototype__tooltip {
    left: auto;
    right: calc(100% + 12px);
  }

  .manarat-prototype__tooltip::before {
    right: auto;
    left: 100%;
    border-right-color: transparent;
    border-left-color: rgba(18, 18, 20, 0.94);
  }
}

/* Fixed iOS status bar (does not scroll with HOME.svg) */
.manarat-prototype__status {
  flex-shrink: 0;
  height: var(--mp-status-h);
  min-height: var(--mp-status-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0d0d0d;
  background: var(--mp-screen-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  z-index: 3;
  box-sizing: border-box;
}

.manarat-prototype__status-time {
  margin-right: auto;
  padding-left: 2px;
}

.manarat-prototype__status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
}

.manarat-prototype__status-icons svg {
  display: block;
  flex-shrink: 0;
}

/* Scrollable app canvas — keyboard focusable for PageUp/PageDown */
.manarat-prototype__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  outline: none;
  background: var(--mp-screen-bg);
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Space below fixed HTML status bar + clearance for screen radius / island so the date isn’t clipped. */
  padding: 40px 0 0;
  margin: 0;
}

.manarat-prototype__scroll:focus-visible {
  outline: 2px solid rgba(141, 124, 185, 0.75);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .manarat-prototype__screen {
    cursor: grab;
  }

  .manarat-prototype__scroll:active {
    cursor: grabbing;
  }
}

.manarat-prototype__scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* SVG: full width of inner scroll area; height follows aspect ratio */
.manarat-prototype__svg {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  pointer-events: none;
  user-select: none;
  margin: 0;
  padding: 0;
}

/* ── Tablet: ~80% of desktop dimensions ───────────────────────────── */
@media (max-width: 1024px) {
  .manarat-prototype {
    --mp-frame-w: 288px;
    --mp-frame-h: 592px;
    --mp-bezel-x: 8px;
    --mp-bezel-top: 10px;
    --mp-bezel-bottom: 8px;
    --mp-frame-radius: 40px;
    --mp-screen-radius: 30px;
    --mp-status-h: 26px;
    --mp-island-w: 76px;
    --mp-island-h: 24px;
    --mp-island-offset-top: 8px;
  }

  .manarat-prototype__status {
    font-size: 11px;
    padding: 0 10px 2px;
  }

  .manarat-prototype__status-icons {
    gap: 4px;
  }

  .manarat-prototype__status-icons svg {
    transform: scale(0.9);
    transform-origin: center center;
  }
}

/* ── Mobile: fit viewport width with comfortable padding ──────────── */
@media (max-width: 640px) {
  .manarat-prototype {
    width: min(360px, calc(100vw - 32px));
    margin-inline: auto;
    --mp-frame-w: min(360px, calc(100vw - 32px));
    --mp-frame-h: calc(var(--mp-frame-w) * 740 / 360);
    --mp-bezel-x: 10px;
    --mp-bezel-top: 10px;
    --mp-bezel-bottom: 10px;
    --mp-frame-radius: 44px;
    --mp-screen-radius: 34px;
    --mp-status-h: 26px;
    --mp-island-w: min(92px, 26vw);
    --mp-island-h: 26px;
    --mp-island-offset-top: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .manarat-prototype__lift {
    transition-duration: 0.01ms;
  }

  .manarat-prototype__scroll {
    scroll-behavior: auto;
  }

  .manarat-prototype__ext-hint-chevron {
    animation: none;
  }

  .manarat-prototype--vscroll-idle .manarat-prototype__vscroll {
    opacity: 1;
  }
}
