/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;
  --font-display: 'Clash Display', 'General Sans', sans-serif;

  --color-text: #e8e6e1;
  --color-text-muted: #a09e96;
  --color-text-faint: #6b6960;
  --color-accent: #5eead4;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-medium: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* iPhone 15 Pro screen area (% of 400x788 frame) — pixel-verified */
  --iphone-screen-left: 8.50%;
  --iphone-screen-top: 4.31%;
  --iphone-screen-width: 83.00%;
  --iphone-screen-height: 91.37%;

  /* MacBook Pro 14 screen area (% of 800x520 frame) — pixel-verified */
  --macbook-screen-left: 11.75%;
  --macbook-screen-top: 11.73%;
  --macbook-screen-width: 76.50%;
  --macbook-screen-height: 76.54%;

  /* iPad Pro 11 screen area (% of 500x690 frame) — pixel-verified */
  --ipad-screen-left: 6.00%;
  --ipad-screen-top: 4.35%;
  --ipad-screen-width: 88.00%;
  --ipad-screen-height: 91.30%;
}

/* ============================================
   BASE RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  text-size-adjust: none;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: #2a2a28;
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; height: auto; user-select: none; pointer-events: none; }

::selection {
  background: oklch(from var(--color-accent) l c h / 0.3);
  color: var(--color-text);
}

/* ============================================
   CONCRETE FLOOR BACKGROUND
   ============================================ */
.scene {
  min-height: 100dvh;
  position: relative;
  background:
    url('./assets/concrete-bg.jpg') center / 800px repeat;
}

/* Subtle vignette overlay to add depth */
.scene::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
  z-index: 1;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%);
}

.site-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.site-tag {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: lowercase;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ============================================
   DEVICE FLOOR — the scattered collage
   ============================================ */
.device-floor {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100dvh;
  padding: 80px 20px 60px;
}

/* Mobile: stack vertically */
@media (max-width: 767px) {
  .device-floor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
    padding: 80px 16px 80px;
  }
}

/* Desktop: absolute positioned scattered layout */
@media (min-width: 768px) {
  .device-floor {
    min-height: max(100dvh, 980px);
    padding: 80px 40px 80px;
  }
}

@media (min-width: 1200px) {
  .device-floor {
    min-height: max(100dvh, 1020px);
  }
}

/* ============================================
   DEVICE — shared styles
   ============================================ */
.device {
  display: block;
  position: relative;
  cursor: pointer;
  transition:
    transform var(--transition-medium),
    filter var(--transition-medium);
  will-change: transform;
}

/* Desktop: absolute positioned with scattered rotation */
@media (min-width: 768px) {
  .device {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: rotate(var(--rot));
  }
  .device:hover {
    transform: rotate(0deg) scale(1.05) translateY(-12px);
    z-index: 50;
    filter: drop-shadow(0 30px 40px rgba(0,0,0,0.5));
  }
}

/* Mobile: stacked with gentle rotation preserved */
@media (max-width: 767px) {
  .device {
    transform: rotate(var(--rot));
    flex-shrink: 0;
    max-width: 88vw;
  }
  .device:active {
    transform: rotate(0deg) scale(0.97);
  }
}

/* ============================================
   DEVICE FRAME + SCREEN LAYERING
   The key approach: position both the screen clip
   and the frame absolutely within the same container.
   Frame sits on top (z-index), screenshot beneath it,
   clipped to the exact screen area coordinates.
   ============================================ */

/* The frame image determines the device's intrinsic size */
.device__frame {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* Screen clip: absolutely positioned behind the frame,
   matching the exact screen area */
.device__screen-clip {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  border-radius: 4px;
}

/* iPhone screen area */
.device__screen-clip--phone {
  left: var(--iphone-screen-left);
  top: var(--iphone-screen-top);
  width: var(--iphone-screen-width);
  height: var(--iphone-screen-height);
  border-radius: 6% / 3%;
}

/* MacBook screen area */
.device__screen-clip--laptop {
  left: var(--macbook-screen-left);
  top: var(--macbook-screen-top);
  width: var(--macbook-screen-width);
  height: var(--macbook-screen-height);
  border-radius: 1.2% / 1.6%;
}

/* iPad screen area */
.device__screen-clip--tablet {
  left: var(--ipad-screen-left);
  top: var(--ipad-screen-top);
  width: var(--ipad-screen-width);
  height: var(--ipad-screen-height);
  border-radius: 3% / 2.2%;
}

/* Screenshot image: fills the clip area with no gaps.
   min-height: 100% ensures landscape images fill the full clip height.
   object-fit: cover scales up proportionally (no distortion).
   Tall images overflow naturally and are scrolled by JS. */
.device__screenshot {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: cover;
  object-position: top center;
  transform: translateY(var(--scroll-y, 0px));
  will-change: transform;
}

/* ============================================
   DEVICE SIZES
   ============================================ */

/* Phone */
.device--phone {
  width: 160px;
}
@media (min-width: 768px) {
  .device--phone {
    width: 190px;
  }
}
@media (min-width: 1200px) {
  .device--phone {
    width: 210px;
  }
}

/* Laptop */
.device--laptop {
  width: 300px;
}
@media (min-width: 768px) {
  .device--laptop {
    width: 400px;
  }
}
@media (min-width: 1200px) {
  .device--laptop {
    width: 440px;
  }
}

/* Tablet */
.device--tablet {
  width: 220px;
}
@media (min-width: 768px) {
  .device--tablet {
    width: 280px;
  }
}
@media (min-width: 1200px) {
  .device--tablet {
    width: 320px;
  }
}

/* Drop shadow on the whole device container for realism */
.device {
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4))
          drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ============================================
   COMING SOON (Faithlens.app)
   ============================================ */
.device--soon {
  cursor: default;
}

.device__screen-clip--dark {
  background: #111;
}

.device__coming-soon-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: var(--space-2);
}

.cs-icon {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 24px;
  color: var(--color-accent);
  opacity: 0.5;
}

.cs-name {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.cs-sub {
  font-size: 10px;
  color: var(--color-text-faint);
  text-transform: lowercase;
  letter-spacing: 0.06em;
}

/* ============================================
   HOVER LABEL
   ============================================ */
.device__label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: max-content;
  max-width: 260px;
  padding: var(--space-3) var(--space-4);
  background: rgba(20, 20, 18, 0.92);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  opacity: 0;
  transition:
    opacity var(--transition-medium),
    transform var(--transition-medium);
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .device:hover .device__label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Mobile: show label below device */
@media (max-width: 767px) {
  .device__label {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    opacity: 1;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
    padding: var(--space-2) 0 0;
    max-width: none;
    width: 100%;
    text-align: center;
    align-items: center;
    border-radius: 0;
  }
}

.device__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.device__desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.site-footer a {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: var(--color-text-muted);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .device__label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  .device__screenshot {
    transform: none !important;
  }
}
