/* ============================================================
   iPhone Catalog — Apple-Inspired Design System
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  /* Colors */
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f7;
  --color-text: #1d1d1f;
  --color-text-secondary: #86868b;
  --color-text-tertiary: #6e6e73;
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-dark: #000000;
  --color-dark-surface: #1d1d1f;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-light: rgba(0, 0, 0, 0.04);
  --color-success: #30d158;
  --color-warning: #ff9f0a;

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'SFMono-Regular', 'Menlo', 'Consolas', monospace;

  /* Spacing */
  --section-padding: 100px 24px;
  --section-padding-mobile: 60px 20px;
  --max-width: 1200px;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-slow: 0.6s;
  --duration-normal: 0.35s;
  --duration-fast: 0.2s;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ----- NAVBAR ----- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.navbar.hidden {
  transform: translateY(-100%);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  color: var(--color-text);
  opacity: 0.8;
  transition: opacity var(--duration-fast);
}

.nav-logo:hover {
  opacity: 1;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-secondary);
  transition: color var(--duration-fast) var(--ease-smooth);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  transition: width var(--duration-normal) var(--ease-smooth);
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  width: 100%;
}

/* ----- HERO ----- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-dark);
  overflow: hidden;
  padding: 80px 24px 40px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(0, 113, 227, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 30% 80%, rgba(0, 113, 227, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 70% 60%, rgba(100, 100, 120, 0.03) 0%, transparent 50%);
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 113, 227, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  width: 100%;
  gap: 60px;
}

.hero-text {
  flex: 1;
  max-width: 560px;
}

.hero-eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-smooth) 0.2s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-smooth) 0.35s forwards;
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 36px;
  max-width: 480px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-smooth) 0.5s forwards;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  background: var(--color-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-smooth);
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-smooth) 0.65s forwards;
  position: relative;
  overflow: hidden;
}

.hero-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  transition: opacity var(--duration-normal);
}

.hero-cta:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 113, 227, 0.3);
}

.hero-cta:active {
  transform: translateY(0);
}

.hero-device {
  flex: 0 0 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 1s var(--ease-smooth) 0.5s forwards;
}

.iphone-hero-svg {
  width: 100%;
  height: auto;
  max-width: 240px;
  filter: drop-shadow(0 20px 80px rgba(0, 113, 227, 0.15));
  animation: float 6s var(--ease-smooth) infinite;
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.4;
  animation: fadeUp 1s var(--ease-smooth) 1s forwards;
}

.hero-scroll span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.scroll-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

/* ----- SECTIONS ----- */
.section {
  padding: var(--section-padding);
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  background: rgba(0, 113, 227, 0.08);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.section-desc {
  font-size: clamp(16px, 1.5vw, 20px);
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ----- GALLERY GRID ----- */
.gallery {
  background: var(--color-bg);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* ----- PHONE CARD ----- */
.phone-card {
  --accent: #0071e3;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-smooth);
  cursor: default;
  display: flex;
  flex-direction: column;
}

.phone-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 113, 227, 0.15);
}

.card-device {
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg) 100%);
  padding: 32px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  position: relative;
}

.card-device::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: var(--color-border);
}

.card-iphone {
  width: 110px;
  height: auto;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.phone-card:hover .card-iphone {
  transform: scale(1.08) translateY(-4px);
}

.card-body {
  padding: 20px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.badge-new {
  background: var(--color-accent);
  color: #fff;
}

.badge-old {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-tertiary);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  line-height: 1.2;
}

.card-specs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  flex: 1;
}

.card-specs li {
  font-size: 14px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.spec-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  min-width: 52px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-colors {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-light);
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--dot, #ccc);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.color-dot:hover {
  transform: scale(1.4);
  z-index: 2;
}

/* ----- COMPARISON TABLE ----- */
.compare {
  background: var(--color-bg-secondary);
  max-width: 100%;
  padding: 100px 24px;
}

.compare .section-header {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.table-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}

.compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 700px;
}

.compare-table thead th {
  background: var(--color-bg);
  padding: 18px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 48px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  transition: color var(--duration-fast);
  white-space: nowrap;
}

.compare-table thead th:first-child {
  text-align: left;
  min-width: 120px;
}

.compare-table thead th:not(:first-child):hover {
  color: var(--color-accent);
}

.compare-table tbody tr {
  transition: background var(--duration-fast) var(--ease-smooth);
}

.compare-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.compare-table tbody tr:hover {
  background: rgba(0, 113, 227, 0.04);
}

.compare-table tbody td {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.4;
}

.compare-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  font-size: 13px;
  white-space: nowrap;
}

.compare-table tbody td strong {
  color: var(--color-text);
  font-weight: 700;
}

.compare-table tbody td small {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.table-note {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-top: 20px;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* ----- COLORS SECTION ----- */
.colors {
  background: var(--color-bg);
}

.colors-grid {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.color-row {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  gap: 24px;
  transition: background var(--duration-fast);
}

.color-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.color-row:hover {
  background: rgba(0, 113, 227, 0.04);
}

.color-model {
  font-size: 14px;
  font-weight: 600;
  min-width: 100px;
  color: var(--color-text);
}

.color-swatches {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--swatch, #ccc);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  position: relative;
}

.swatch::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color var(--duration-fast);
}

.swatch:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.12);
}

.swatch:hover::after {
  border-color: var(--color-accent);
}

/* ----- FOOTER ----- */
.footer {
  background: var(--color-dark-surface);
  color: rgba(255, 255, 255, 0.6);
  padding: 48px 24px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.footer-links a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-2px);
}

.footer-text {
  font-size: 13px;
  line-height: 1.6;
  max-width: 480px;
}

.footer-small {
  font-size: 12px;
  opacity: 0.6;
}

/* ----- ANIMATIONS ----- */

/* Float animation for hero iPhone */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(0.6); }
}

/* Fade-in on scroll — triggered by IntersectionObserver */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-smooth), transform 0.7s var(--ease-smooth);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children animation */
.fade-in:nth-child(1) { transition-delay: 0s; }
.fade-in:nth-child(2) { transition-delay: 0.1s; }
.fade-in:nth-child(3) { transition-delay: 0.2s; }
.fade-in:nth-child(4) { transition-delay: 0.3s; }
.fade-in:nth-child(5) { transition-delay: 0.4s; }

/* ----- REDUCED MOTION ----- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}

/* ----- RESPONSIVE ----- */

/* Tablet */
@media (max-width: 1024px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }

  .hero-text {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-subtitle {
    max-width: 100%;
  }

  .hero-device {
    flex: 0 0 auto;
    width: 200px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 640px) {
  .section {
    padding: var(--section-padding-mobile);
  }

  .compare {
    padding: 60px 16px;
  }

  .hero {
    padding: 60px 20px 32px;
    min-height: 90vh;
  }

  .hero-device {
    width: 160px;
  }

  .iphone-hero-svg {
    max-width: 180px;
  }

  .nav-links {
    gap: 20px;
  }

  .nav-links a {
    font-size: 12px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card-device {
    min-height: 160px;
    padding: 24px 20px 12px;
  }

  .card-iphone {
    width: 90px;
  }

  .color-row {
    padding: 14px 16px;
    gap: 16px;
    flex-wrap: wrap;
  }

  .color-model {
    min-width: 80px;
    font-size: 13px;
  }

  .swatch {
    width: 24px;
    height: 24px;
  }

  .table-wrapper {
    border-radius: var(--radius-md);
    margin: 0 -16px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .section-title {
    font-size: 28px;
  }
}

/* Small mobile */
@media (max-width: 380px) {
  .hero-title {
    font-size: 26px;
  }

  .hero-device {
    width: 130px;
  }

  .nav-links a {
    font-size: 11px;
  }
}


/* Real product images */
.card-iphone-real {
  width: 110px;
  height: auto;
  object-fit: contain;
  transition: transform var(--duration-normal) var(--ease-spring);
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.1));
}

.phone-card:hover .card-iphone-real {
  transform: scale(1.08) translateY(-4px);
}
