/* ==========================================================================
   Website preview — browser window with a full-page screenshot that scrolls
   on hover. Shared by the landing page and the portfolio.
   Behaviour: js/previews.js
   ========================================================================== */

/* --------------------------------------------------------------------------
   Browser window
   -------------------------------------------------------------------------- */

.project-frame {
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--frame-radius);
  background: var(--white);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(23, 19, 15, 0.04);
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease),
    box-shadow var(--t-med) var(--ease);
}

.project-frame:hover,
.project-frame:focus-visible {
  transform: translateY(-6px);
  border-color: var(--orange);
  box-shadow: 0 26px 50px -24px rgba(23, 19, 15, 0.34);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 14px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}

.browser-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.browser-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d8cfc3;
  transition: background-color var(--t-med) var(--ease);
}

.project-frame:hover .browser-dots i:nth-child(1) { background: #ec6a5e; }
.project-frame:hover .browser-dots i:nth-child(2) { background: #f4bf4f; }
.project-frame:hover .browser-dots i:nth-child(3) { background: #61c454; }

.browser-url {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 320px;
  margin-inline: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-open {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--ink-3);
  transition: color var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}

.project-frame:hover .browser-open {
  color: var(--orange);
  transform: translate(2px, -2px);
}

/* The scrolling viewport. Fixed heights keep every card in a row ending on
   the same line; pages override the height for their own card sizes. */
.browser-view {
  position: relative;
  display: block;
  height: clamp(300px, 25vw, 420px);
  overflow: hidden;
  background: var(--cream);
}

.project--sm .browser-view {
  height: clamp(240px, 19vw, 300px);
}

.browser-shot {
  display: block;
  width: 100%;
  height: auto;
  transform: translate3d(0, 0, 0);
  transition: transform 0s linear;
  will-change: transform;
}

/* Hover hint */
.preview-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(21, 17, 14, 0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
  transform: translate(-50%, 0);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}

.preview-hint .icon {
  width: 14px;
  height: 14px;
  color: var(--orange-bright);
}

.project-frame:hover .preview-hint,
.project-frame.is-playing .preview-hint {
  opacity: 0;
  transform: translate(-50%, 8px);
}

@media (max-width: 1023px) {
  .browser-view {
    height: clamp(280px, 34vw, 380px);
  }
}

@media (max-width: 767px) {
  .browser-bar {
    height: 34px;
    padding: 0 10px;
  }

  .browser-dots i {
    width: 8px;
    height: 8px;
  }

  .browser-view {
    height: min(62vw, 340px);
  }
}

/* Reduced motion: no auto-scroll — the preview scrolls by hand instead */
@media (prefers-reduced-motion: reduce) {
  .browser-view {
    overflow-y: auto;
  }

  .browser-shot {
    transform: none !important;
    transition: none !important;
  }

  .preview-hint {
    opacity: 1 !important;
    transform: translate(-50%, 0) !important;
  }
}
