/* ==========================================================================
   iOS App Portfolio & Support Platform - Apple HIG Inspired Design System
   ========================================================================== */

:root {
  --bg-page: #F5F5F7;
  --bg-surface: #FFFFFF;
  --bg-surface-secondary: #EFEFF4;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #86868B;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --accent-blue: #007AFF;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.11);
  --radius-card: 24px;
  --radius-pill: 9999px;
  --transition-base: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] {
  --bg-page: #000000;
  --bg-surface: #1C1C1E;
  --bg-surface-secondary: #2C2C2E;
  --bg-glass: rgba(28, 28, 30, 0.78);
  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #8E8E93;
  --border-subtle: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin-top: 0;
}

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

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

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Glassmorphic Navbar
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.28);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-base), background-color var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background-color: var(--bg-surface-secondary);
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s ease;
  z-index: 120;
}

.nav-dropdown.open .dropdown-menu,
.nav-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-surface-secondary);
}

.dropdown-app-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.dropdown-app-meta {
  min-width: 0;
}

.dropdown-app-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-app-tag {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Theme & Mobile Controls */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color var(--transition-base);
}

.icon-btn:hover {
  background: var(--bg-surface-secondary);
  transform: scale(1.04);
}

.mobile-menu-btn {
  display: none;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  padding: 76px 0 48px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  max-width: 780px;
  margin: 0 auto 20px;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.hero-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.hero-stat-item strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ==========================================================================
   App Showcase (Zig-Zag / Alternating Layout)
   ========================================================================== */
.showcase-list {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 24px 0 72px;
}

.showcase-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 48px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 56px;
  align-items: center;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.showcase-card:hover {
  box-shadow: var(--shadow-lg);
}

.showcase-card.is-reversed .showcase-visual {
  order: 2;
}

.showcase-card.is-reversed .showcase-info {
  order: 1;
}

/* Realistic CSS iPhone Mockup */
.iphone-frame {
  position: relative;
  width: 270px;
  height: 552px;
  margin: 0 auto;
  border-radius: 46px;
  padding: 11px;
  background: linear-gradient(145deg, #2c2c2e, #141416);
  box-shadow:
    0 24px 50px rgba(0, 0, 0, 0.25),
    inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.iphone-frame::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 120px;
  width: 3px;
  height: 44px;
  background: #3a3a3c;
  border-radius: 3px 0 0 3px;
  box-shadow: 0 58px 0 #3a3a3c;
}

.iphone-frame::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 145px;
  width: 3px;
  height: 68px;
  background: #3a3a3c;
  border-radius: 0 3px 3px 0;
}

.iphone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: #0f172a;
}

.iphone-dynamic-island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 86px;
  height: 24px;
  background: #000;
  border-radius: 999px;
  z-index: 5;
}

.iphone-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.iphone-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  color: #fff;
}

.iphone-placeholder-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 16px;
}

/* App Info Column */
.app-header-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.app-icon-squircle {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
}

.app-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.app-tagline {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

.app-short-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0 0 24px;
}

.highlights-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.highlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.96rem;
  font-weight: 500;
}

.highlight-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.appstore-badge-link {
  display: inline-flex;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.appstore-badge-link:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-base);
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
}

/* QR Popover */
.qr-wrapper {
  position: relative;
}

.qr-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  width: 196px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 40;
}

.qr-wrapper.open .qr-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.qr-popover img {
  width: 150px;
  height: 150px;
  margin: 0 auto 8px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.qr-popover span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   CTA Banner & Shared Cards
   ========================================================================== */
.cta-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 72px;
}

.cta-banner h2 {
  font-size: 1.85rem;
  margin-bottom: 12px;
}

.cta-banner p {
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 24px;
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   App Detail Page, Gallery, Features, FAQ
   ========================================================================== */
.page-section {
  padding: 48px 0 72px;
}

.gallery-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 12px 4px 20px;
  scroll-snap-type: x mandatory;
}

.gallery-item {
  flex: 0 0 230px;
  scroll-snap-align: start;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  background: var(--bg-surface);
}

.gallery-item img {
  width: 100%;
  height: 460px;
  object-fit: cover;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px 22px;
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--text-secondary);
}

/* ==========================================================================
   iOS Segmented Control (4-Language Selector) & Legal Prose
   ========================================================================== */
.segmented-control {
  display: inline-flex;
  background: var(--bg-surface-secondary);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  gap: 4px;
  flex-wrap: wrap;
}

.segmented-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.segmented-btn:hover {
  color: var(--text-primary);
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.legal-prose h2,
.legal-prose h3,
.legal-prose h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.legal-prose p,
.legal-prose ul {
  color: var(--text-secondary);
  margin-bottom: 1em;
}

.legal-prose li {
  margin-bottom: 0.4em;
}

.legal-link {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* ==========================================================================
   Forms & Alerts
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.alert {
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 500;
}

.alert-success {
  background: rgba(52, 199, 89, 0.14);
  color: #1f8a3b;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

[data-theme="dark"] .alert-success {
  color: #6ee787;
}

.alert-error {
  background: rgba(255, 59, 48, 0.12);
  color: #d92d20;
  border: 1px solid rgba(255, 59, 48, 0.28);
}

[data-theme="dark"] .alert-error {
  color: #ff7b72;
}

.alert-info {
  background: rgba(0, 122, 255, 0.12);
  color: #0062cc;
  border: 1px solid rgba(0, 122, 255, 0.25);
}

[data-theme="dark"] .alert-info {
  color: #66b2ff;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.4fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .showcase-card {
    grid-template-columns: 1fr;
    padding: 32px 24px;
    gap: 32px;
  }

  .showcase-card.is-reversed .showcase-visual,
  .showcase-card.is-reversed .showcase-info {
    order: initial;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    margin-top: 6px;
  }
}
