/* ============================================
   PDF42 - Design System & Styles
   AI-Native PDF Tools for Gen Z
   Elegant, Light Theme
   ============================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Color Palette - Light & Elegant */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-glass: rgba(255, 255, 255, 0.8);

  /* Accent Colors - Clean Blues */
  --accent-primary: #2563eb;
  --accent-secondary: #7c3aed;
  --accent-hover: #1d4ed8;

  /* Text Colors */
  --text-primary: #0a0a0a;
  --text-secondary: #666666;
  --text-tertiary: #999999;

  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  /* Borders & Shadows */
  --border-light: #e5e5e5;
  --border-medium: #d4d4d4;
  --shadow-sm: rgba(0, 0, 0, 0.04);
  --shadow-md: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.12);

  /* Typography */
  --font-primary: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', serif;

  --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --font-size-lg: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  --font-size-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --font-size-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 2rem);
  --font-size-3xl: clamp(2rem, 1.7rem + 1.5vw, 3rem);
  --font-size-4xl: clamp(2.5rem, 2rem + 2.5vw, 4.5rem);

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.15;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.7;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 5rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-modal: 30;
  --z-toast: 40;

  /* Layout */
  --container-max-width: 1400px;
  --header-height: 4rem;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* Reduced Motion Support */
@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;
  }
}

/* Enhanced touch targets for mobile */
button,
a,
input {
  min-height: 44px;
}

/* ============================================
   Typography
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-xl);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

p {
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* ============================================
   Layout & Container
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-2xl);
  }
}

section {
  padding: var(--space-4xl) 0;
}

@media (max-width: 768px) {
  section {
    padding: var(--space-3xl) 0;
  }
}

/* ============================================
   Header & Navigation
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  z-index: var(--z-sticky);
  transition: transform var(--transition-base);
  animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.header__logo {
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav__list {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
  align-items: center;
}

.nav__link {
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  font-size: 0.95rem;
  position: relative;
  padding: var(--space-sm);
  transition: color var(--transition-fast);
}

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

.nav__mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--text-primary);
  min-width: auto;
}

.nav__mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .nav__list {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    padding: var(--space-xl);
    gap: var(--space-md);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform var(--transition-base), opacity var(--transition-base);
    border-bottom: 1px solid var(--border-light);
  }

  .nav__list.is-open {
    transform: translateY(0);
    opacity: 1;
  }

  .nav__mobile-toggle {
    display: block;
  }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px var(--shadow-md);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-lg);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-medium);
}

.btn--secondary:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.btn--large {
  padding: 1rem 2rem;
  font-size: var(--font-size-lg);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero__background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.4;
  background: radial-gradient(circle at 30% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
  z-index: -1;
}

.hero__container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3xl);
  align-items: center;
  text-align: center;
}

@media (min-width: 1024px) {
  .hero__container {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
}

.hero__content {
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--accent-primary);
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.8s ease-out 0.2s both;
  box-shadow: 0 2px 8px var(--shadow-sm);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__badge .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.hero__title {
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero__subtitle {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2xl);
  color: var(--text-secondary);
  max-width: 650px;
  line-height: var(--line-height-relaxed);
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

@media (min-width: 1024px) {
  .hero__subtitle {
    margin-left: 0;
    margin-right: auto;
  }
}

.hero__cta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  animation: fadeInUp 0.8s ease-out 0.8s both;
}

@media (min-width: 1024px) {
  .hero__cta {
    justify-content: flex-start;
  }
}

@media (max-width: 1023px) {
  .hero__cta {
    justify-content: center;
  }
}

.hero__visual {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 32px var(--shadow-md);
  animation: fadeInUp 0.8s ease-out 1s both;
}

/* ============================================
   Section Headings
   ============================================ */
.section__header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto var(--space-4xl);
}

.section__tag {
  font-size: var(--font-size-sm);
  color: var(--accent-primary);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.section__title {
  margin-bottom: var(--space-md);
}

.section__subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* ============================================
   Demo Sections
   ============================================ */
.demo {
  background: var(--bg-secondary);
}

.demo__container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

@media (min-width: 1024px) {
  .demo__container {
    grid-template-columns: 1fr 1fr;
  }
}

.demo__visual {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: 0 8px 32px var(--shadow-md);
}

/* ============================================
   AI Chat Interface (Demo)
   ============================================ */
.chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 400px;
  max-height: 500px;
  overflow-y: auto;
}

.chat__message {
  display: flex;
  gap: var(--space-md);
  animation: message-appear 400ms ease-out;
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat__message--user {
  flex-direction: row-reverse;
}

.chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  border: 2px solid white;
}

.chat__bubble {
  padding: 0.875rem 1rem;
  border-radius: 12px;
  max-width: 75%;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat__message--user .chat__bubble {
  background: var(--accent-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat__message--ai .chat__bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat__bubble--smart {
  border: 2px solid var(--accent-primary);
  background: var(--bg-secondary);
}

.typing-indicator {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-md);
}

.typing-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator__dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-10px);
  }
}

/* ============================================
   Collaboration Demo
   ============================================ */
.collab__canvas {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  min-height: 400px;
  overflow: hidden;
}

.collab__cursor {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  transition: transform 500ms cubic-bezier(0.17, 0.67, 0.5, 1.03);
  z-index: 10;
}

.collab__cursor svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.collab__cursor-label {
  position: absolute;
  top: 100%;
  left: 100%;
  padding: var(--space-xs) var(--space-sm);
  background: currentColor;
  color: white;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-top: var(--space-xs);
  font-weight: var(--font-weight-medium);
}

.collab__comment {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  max-width: 250px;
  animation: comment-appear 300ms ease-out;
}

@keyframes comment-appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.collab__comment-author {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--accent-primary);
  margin-bottom: var(--space-xs);
}

.collab__comment-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   Feature Grid
   ============================================ */
.features {
  background: white;
}

.features__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

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

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

.feature__card {
  padding: 2rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.feature__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.feature__card:hover::before {
  transform: scaleX(1);
}

.feature__card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 24px var(--shadow-md);
}

.feature__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.feature__icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--text-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature__title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.feature__description {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: 0.95rem;
}

/* ============================================
   Trust Section
   ============================================ */
.trust {
  background: var(--bg-secondary);
}

.trust__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2xl);
  margin-top: var(--space-3xl);
}

.trust__item {
  text-align: center;
}

.trust__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.trust__icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trust__label {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  display: block;
  margin-bottom: var(--space-xs);
}

.trust__description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* ============================================
   CTA Section
   ============================================ */
.cta {
  background: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.cta .container {
  position: relative;
  z-index: 1;
}

.stats {
  display: flex;
  gap: var(--space-2xl);
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.stat__value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  color: var(--accent-primary);
  font-family: var(--font-serif);
}

.stat__label {
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
  font-size: var(--font-size-sm);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer__section-title {
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer__link {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--accent-primary);
}

.footer__bottom {
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* ============================================
   Utility Classes
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Accessibility: Focus visible for keyboard navigation */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}