/* ============================================================
   CINEMATIC DESIGN SYSTEM — v2.0
   Source of truth: DESIGN.md
   Every token maps to a YAML key in that file.
   ============================================================ */

:root {
  /* — Colors — */
  --color-primary: #0066cc;
  --color-primary-focus: #0071e3;
  --color-primary-on-dark: #2997ff;
  --color-ink: #1d1d1f;
  --color-body: #1d1d1f;
  --color-body-on-dark: #ffffff;
  --color-body-muted: #cccccc;
  --color-ink-muted-80: #333333;
  --color-ink-muted-48: #7a7a7a;
  --color-surface-black: #000000;
  --color-canvas-parchment: #f5f5f7;
  --color-surface-tile-1: #272729;

  /* — Typography — */
  --font-display: "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  --font-text: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;

  /* — Spacing (DESIGN.md tokens) — */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 17px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;
  --spacing-section: 80px;

  /* — Radii — */
  --rounded-sm: 8px;
  --rounded-lg: 18px;
  --rounded-pill: 9999px;

  /* — Motion — */
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-fast: 0.2s;
  --duration-normal: 0.4s;
  --duration-slow: 0.8s;

  /* — Device (mobile-first) — */
  --device-w: 240px;
  --device-h: 490px;
  --device-r: 36px;
  --device-b: 10px;
  --notch-w: 96px;
  --notch-h: 20px;
  --device-scale: 1;
}

@media (min-width: 420px) {
  :root {
    --device-w: 260px;
    --device-h: 530px;
  }
}

@media (min-width: 734px) {
  :root {
    --device-w: 300px;
    --device-h: 610px;
    --device-r: 44px;
    --device-b: 12px;
    --notch-w: 110px;
    --notch-h: 22px;
  }
}

@media (min-width: 1068px) {
  :root {
    --device-w: 360px;
    --device-h: 740px;
    --device-r: 52px;
    --device-b: 14px;
    --notch-w: 126px;
    --notch-h: 26px;
  }
}

/* ============================================================
   GLOBAL
   ============================================================ */
body.cinematic-mode {
  background-color: var(--color-surface-black);
  color: var(--color-body-on-dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LOADER — Cinematic Black-Screen Intro
   ============================================================ */
.cinematic-loader {
  position: fixed;
  inset: 0;
  background: var(--color-surface-black);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cinematic-light {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  /* Layered glow: tight core + wide diffuse halo */
  box-shadow:
    0 0 4px 2px rgba(255, 255, 255, 0.9),
    0 0 30px 15px rgba(255, 255, 255, 0.25),
    0 0 80px 40px rgba(200, 220, 255, 0.08);
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: opacity, transform;
}

.cinematic-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--spacing-lg);
}

.cinematic-text h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 4.5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--color-body-on-dark);
  margin: 0;
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
}

.cinematic-text h2 .muted {
  color: var(--color-ink-muted-48);
}

.cinematic-text .page-label {
  display: none;
}

.cinematic-text .page-label.active {
  display: block;
}

/* ============================================================
   STICKY DEVICE SHELL — The always-present fixed protagonist
   ============================================================ */
.cinematic-sticky-device {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  pointer-events: none;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 3D perspective for the camera-pan effect */
  perspective: 1400px;
  perspective-origin: 50% 48%;
  will-change: transform;
}

@media (max-width: 733px) {
  .cinematic-sticky-device {
    align-items: flex-start;
    padding-top: 8svh;
  }
}

/* ============================================================
   THREE.JS CANVAS — Desktop only, alpha composited
   ============================================================ */
.amros-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 1.2s ease;
  z-index: 8;
  /* Hidden on mobile — CSS device shows instead */
}

@media (max-width: 733px) {
  .amros-canvas {
    display: none !important;
  }
}

/* When Three.js is ready, JS adds .amros-ready to body */
body.amros-ready .amros-canvas {
  pointer-events: auto;
}

body.amros-ready #heroDevice {
  /* CSS device fades away on desktop once Three.js is ready */
  transition: opacity 1s ease;
}

@media (min-width: 734px) {
  body.amros-ready #heroDevice {
    opacity: 0 !important;
    pointer-events: none;
  }
}

/* ============================================================
   HERO SPOTLIGHT — Ambient floor glow
   ============================================================ */
.hero-spotlight {
  position: absolute;
  bottom: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 70vh;
  background: radial-gradient(ellipse at bottom, rgba(255, 255, 255, 0.07) 0%, rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, background;
  filter: blur(2px);
}

/* ============================================================
   DEVICE FRAME CONTAINER — 3D camera stage
   The intro GSAP timeline animates:
     rotateX, rotateY, rotateZ → camera pan
     scale                     → Z-depth emergence
     opacity                   → fade-in from void
   ============================================================ */
.device-frame-container {
  position: relative;
  z-index: 10;
  /* Initial state for GSAP: below + rotated (camera-from-below angle) */
  transform: rotateX(28deg) rotateY(-18deg) rotateZ(4deg) scale(0.72) translateY(60px);
  opacity: 0;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

/* ============================================================
   STUDIO EDGE LIGHTS — Simulated titanium-edge reflection
   Two pseudo-light sources: left warm rim, right cool highlight
   ============================================================ */
.device-edge-light {
  position: absolute;
  top: 6%;
  width: 2px;
  height: 88%;
  border-radius: 2px;
  pointer-events: none;
  will-change: opacity;
  z-index: 20;
  opacity: 0;
}

.device-edge-light--left {
  left: calc(var(--device-b) * -0.5);
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 240, 200, 0.0) 15%,
    rgba(255, 240, 200, 0.55) 40%,
    rgba(255, 240, 200, 0.7) 55%,
    rgba(255, 240, 200, 0.35) 75%,
    transparent 100%
  );
  filter: blur(1px);
}

.device-edge-light--right {
  right: calc(var(--device-b) * -0.5);
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(160, 200, 255, 0.0) 20%,
    rgba(160, 200, 255, 0.65) 45%,
    rgba(160, 200, 255, 0.5) 60%,
    rgba(160, 200, 255, 0.15) 80%,
    transparent 100%
  );
  filter: blur(1px);
}

/* ============================================================
   CSS DEVICE FRAME — Physical depth, studio finish
   ============================================================ */
.device-frame {
  width: var(--device-w);
  height: var(--device-h);
  border-radius: var(--device-r);
  border: var(--device-b) solid #252527;
  background: #0a0a0c;
  box-shadow:
    /* Deep ambient shadow */
    0 60px 120px rgba(0, 0, 0, 0.85),
    0 20px 40px rgba(0, 0, 0, 0.6),
    /* Inner bevel — physical edge depth */
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.06),
    inset 0 1px 3px rgba(0, 0, 0, 0.8),
    inset 0 -1px 2px rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
  /* Studio key-light gradient on the titanium shell */
  background-image:
    linear-gradient(
      152deg,
      rgba(255, 255, 255, 0.065) 0%,
      rgba(255, 255, 255, 0.02) 35%,
      transparent 60%
    );
}

/* Dynamic Island */
.device-frame::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: var(--notch-w);
  height: var(--notch-h);
  background: #060608;
  border-radius: 20px;
  z-index: 20;
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Home Indicator */
.device-frame::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 38%;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  z-index: 20;
}

/* ============================================================
   DEVICE SCREEN
   ============================================================ */
.device-screen {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: calc(var(--device-r) - var(--device-b));
  overflow: hidden;
  position: relative;
}

.device-screen video,
.device-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  will-change: opacity;
}

/* Screen ignition glare — simulates backlight activation */
.device-screen-glare {
  position: absolute;
  inset: 0;
  z-index: 30;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.04) 30%,
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

/* ============================================================
   CHAPTERS — The scroll narrative
   ============================================================ */
.cinematic-chapter {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  z-index: 10;
  pointer-events: none;
  box-sizing: border-box;
}

.cinematic-chapter .chapter-content {
  pointer-events: auto;
}

.intro-chapter {
  min-height: 120vh;
}

/* ─── MOBILE: Text below device as frosted panel ─── */
.project-chapter {
  min-height: 100vh;
  justify-content: center;
  align-items: flex-end;
  padding: 0 var(--spacing-lg) 36px;
}

.chapter-content {
  max-width: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  padding: var(--spacing-lg);
  border-radius: var(--rounded-lg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  opacity: 0;
  transform: translateY(40px);
  will-change: transform, opacity;
}

.chapter-content .apple-display-lg {
  font-size: clamp(22px, 6vw, 38px);
  margin-bottom: var(--spacing-sm);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chapter-content .apple-lead {
  font-size: clamp(14px, 3.5vw, 17px);
  margin-bottom: var(--spacing-lg);
  line-height: 1.47;
  letter-spacing: -0.374px;
}

/* ─── TABLET: Text floats beside device ─── */
@media (min-width: 734px) {
  .project-chapter {
    align-items: center;
    justify-content: flex-start;
    padding: 0 var(--spacing-xxl);
  }

  .project-chapter:nth-child(even) {
    justify-content: flex-end;
  }

  .chapter-content {
    max-width: 360px;
    padding: var(--spacing-xl);
  }
}

/* ─── DESKTOP: Full editorial layout ─── */
@media (min-width: 1068px) {
  .project-chapter {
    padding: 0 8vw;
  }

  .chapter-content {
    max-width: 420px;
    padding: 40px;
    border-radius: 24px;
  }
}

/* ============================================================
   APPLE TYPOGRAPHY
   ============================================================ */
.apple-display-lg {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.28px;
  margin-bottom: var(--spacing-lg);
}

.apple-lead {
  font-family: var(--font-display);
  font-size: clamp(17px, 3vw, 28px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.196px;
  color: var(--color-body-muted);
  margin-bottom: var(--spacing-xl);
}

.text-muted {
  color: var(--color-ink-muted-48);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.apple-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary);
  color: #fff;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  padding: 11px 22px;
  border-radius: var(--rounded-pill);
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) ease;
  -webkit-tap-highlight-color: transparent;
}

.apple-btn-primary:hover {
  background-color: var(--color-primary-focus);
}

.apple-btn-primary:active {
  transform: scale(0.95);
}

/* ============================================================
   ABOUT, PORTRAIT, FEATURES
   ============================================================ */
.apple-about-section {
  background-color: var(--color-surface-black);
  padding: var(--spacing-section) 0;
  color: var(--color-body-on-dark);
}

.apple-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 var(--spacing-xl);
}

.apple-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xxl);
}

@media (min-width: 734px) {
  .apple-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.apple-portrait-card {
  border-radius: var(--rounded-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4/5;
  background-color: var(--color-ink);
  box-shadow: rgba(0, 0, 0, 0.22) 3px 5px 30px 0;
}

.apple-portrait-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}

.apple-portrait-card:hover img {
  transform: scale(1.03);
}

.apple-features {
  padding: var(--spacing-section) 0;
  background-color: var(--color-surface-tile-1);
}

.apple-feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xxl);
}

@media (min-width: 640px) {
  .apple-feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1068px) {
  .apple-feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.apple-feature-card {
  padding: var(--spacing-lg);
  background-color: var(--color-surface-black);
  border-radius: var(--rounded-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform var(--duration-normal) var(--ease-out);
}

.apple-feature-card:hover {
  transform: translateY(-6px);
}

.apple-feature-icon {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--color-primary-on-dark);
  margin-bottom: var(--spacing-lg);
}

.apple-feature-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
  margin-bottom: var(--spacing-sm);
  color: #fff;
}

.apple-feature-desc {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--color-body-muted);
}

/* ============================================================
   FOOTER & NAV
   ============================================================ */
.cinematic-footer-chapter {
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.nav-bar.cinematic-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   IDLE BREATHING ANIMATION (CSS keyframes, GSAP overrides)
   ============================================================ */
@keyframes deviceBreathe {
  0%,  100% { transform: rotateY(0deg)  rotateX(0deg)  translateY(0px); }
  25%        { transform: rotateY(1.5deg) rotateX(0.5deg) translateY(-5px); }
  50%        { transform: rotateY(0deg)  rotateX(0.8deg) translateY(-8px); }
  75%        { transform: rotateY(-1.5deg) rotateX(0.5deg) translateY(-4px); }
}

.device-frame-container.breathing {
  animation: deviceBreathe 4.5s ease-in-out infinite;
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .device-frame-container.breathing {
    animation: none !important;
  }
}

/* ============================================================
   AMROS APP CHROME (details.php)
   ============================================================ */
body[data-barba-namespace="work-single"] {
  background-color: #000;
}

.amros-app-chrome {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.amros-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.amros-dynamic-island {
  width: 120px;
  height: 30px;
  background: #000;
  border-radius: 20px;
}

.amros-status-icons {
  display: flex;
  gap: 6px;
  font-size: 16px;
}

.amros-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 16px;
}

.amros-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #007AFF;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  text-decoration: none;
}

.amros-back-btn i {
  font-size: 20px;
}

.amros-app-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amros-app-title .app-icon {
  font-size: 24px;
}

.amros-app-title h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.amros-get-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 16px;
  border-radius: 16px;
  text-decoration: none;
}

.amros-home-indicator-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.amros-home-indicator {
  width: 130px;
  height: 5px;
  background: #fff;
  border-radius: 100px;
}

.amros-app-content {
  padding-top: 110px; /* Space for chrome */
  padding-bottom: 34px; /* Space for home indicator */
}

/* ============================================================
   AMROS INCOMING CALL (footer.php)
   ============================================================ */
.amros-footer-call {
  position: relative;
  width: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.amros-call-screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8vh 20px 4vh;
  background: radial-gradient(circle at center, #1a1a24 0%, #000000 100%);
  z-index: 2;
}

.amros-caller-info {
  text-align: center;
  margin-top: 10vh;
}

.amros-caller-avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 40px rgba(255,255,255,0.05);
}

.amros-caller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(20%) contrast(1.1);
}

.amros-caller-info h2 {
  font-size: 38px;
  font-weight: 400;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}

.amros-caller-info p {
  font-size: 18px;
  color: #8E8E93;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.amros-caller-details {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  color: rgba(255,255,255,0.6);
}

.amros-caller-details a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}

.amros-caller-details a:hover {
  color: #fff;
}

.amros-call-actions {
  display: flex;
  gap: 60px;
  justify-content: center;
  margin-top: auto;
  margin-bottom: 12vh;
}

.amros-call-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.amros-call-btn-wrap span {
  font-size: 15px;
  color: #fff;
}

.amros-btn-decline,
.amros-btn-accept {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: #fff;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.amros-btn-decline {
  background: #FF3B30;
}

.amros-btn-accept {
  background: #34C759;
  animation: pulse-call 2s infinite;
}

.amros-btn-decline:hover,
.amros-btn-accept:hover {
  transform: scale(1.1);
}

@keyframes pulse-call {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
  70% { box-shadow: 0 0 0 20px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.amros-call-footer {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.amros-social-grid {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.amros-social-grid a {
  color: rgba(255,255,255,0.5);
  font-size: 24px;
  transition: color 0.3s;
}

.amros-social-grid a:hover {
  color: #fff;
}

.amros-system-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}