/* ============================================
   EXCUSE GENERATOR — DESIGN TOKENS & STYLES
   ============================================ */

/* --- Type Scale --- */
:root {
  --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);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3.5rem,   1rem    + 8vw,    9rem);

  /* --- Spacing --- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Fonts --- */
  --font-display: 'Clash Display', 'Space Grotesk', sans-serif;
  --font-body: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* --- 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-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Content widths --- */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* ============================================
   COLOR PALETTE — Dark-first, Lebanese street
   ============================================ */

:root, [data-theme="dark"] {
  --color-bg: #0a0a0c;
  --color-surface: #131318;
  --color-surface-2: #1a1a22;
  --color-surface-3: #222230;
  --color-border: #2a2a3a;
  --color-border-subtle: #1e1e2c;

  --color-text: #e8e6e1;
  --color-text-muted: #8a8898;
  --color-text-faint: #55546a;

  --color-accent: #ff6b35;
  --color-accent-hover: #ff8555;
  --color-accent-glow: rgba(255, 107, 53, 0.15);
  --color-accent-2: #ffd23f;

  --color-success: #4ade80;
  --color-error: #f87171;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 60px rgba(255, 107, 53, 0.08);
}

[data-theme="light"] {
  --color-bg: #f5f3ef;
  --color-surface: #ffffff;
  --color-surface-2: #f9f7f4;
  --color-surface-3: #edeae5;
  --color-border: #d4d1ca;
  --color-border-subtle: #e5e2dc;

  --color-text: #1a1818;
  --color-text-muted: #6b6962;
  --color-text-faint: #a5a29b;

  --color-accent: #e85520;
  --color-accent-hover: #d14a18;
  --color-accent-glow: rgba(232, 85, 32, 0.08);
  --color-accent-2: #d4a017;

  --color-success: #22c55e;
  --color-error: #ef4444;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 60px rgba(232, 85, 32, 0.05);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg: #f5f3ef;
    --color-surface: #ffffff;
    --color-surface-2: #f9f7f4;
    --color-surface-3: #edeae5;
    --color-border: #d4d1ca;
    --color-border-subtle: #e5e2dc;
    --color-text: #1a1818;
    --color-text-muted: #6b6962;
    --color-text-faint: #a5a29b;
    --color-accent: #e85520;
    --color-accent-hover: #d14a18;
    --color-accent-glow: rgba(232, 85, 32, 0.08);
    --color-accent-2: #d4a017;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 60px rgba(232, 85, 32, 0.05);
  }
}

/* ============================================
   GRAIN OVERLAY
   ============================================ */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border-subtle);
}

.header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header nav button {
  color: var(--color-text-muted);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.header nav button:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hero-content {
  text-align: center;
  max-width: 720px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  background: var(--color-accent-glow);
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  margin-bottom: var(--space-6);
}

.hero-line-1 {
  display: block;
  font-size: var(--text-2xl);
  color: var(--color-text-muted);
}

.hero-line-2 {
  display: block;
  font-size: var(--text-hero);
  color: var(--color-accent);
  margin-top: var(--space-2);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  font-weight: 500;
}

.hero-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-10);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   GENERATE BUTTON
   ============================================ */
.generate-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  color: #fff;
  background: var(--color-accent);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.generate-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.3);
}

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

.generate-btn .btn-icon {
  display: flex;
  transition: transform 0.2s ease;
}

.generate-btn:hover .btn-icon {
  transform: translateX(4px);
}

.generate-btn.loading {
  pointer-events: none;
}

.generate-btn.loading .btn-text {
  opacity: 0;
}

.generate-btn.loading::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   EXCUSE CARD
   ============================================ */
.excuse-section {
  padding: 0 var(--space-6) var(--space-16);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.excuse-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.excuse-card {
  max-width: 560px;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  position: relative;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.excuse-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(255, 107, 53, 0.12);
}

.excuse-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.excuse-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.excuse-category {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  background: var(--color-accent-glow);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.excuse-text {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: var(--space-8);
  min-height: 80px;
}

.excuse-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}

.excuse-site {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
  background: var(--color-accent-glow);
}

.copy-btn.copied {
  color: var(--color-success);
  border-color: var(--color-success);
}

/* ============================================
   EXCUSE ACTIONS
   ============================================ */
.excuse-actions {
  margin-top: var(--space-6);
  display: flex;
  gap: var(--space-4);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}

.action-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  background: var(--color-surface-2);
}

/* ============================================
   STATS
   ============================================ */
.stats-section {
  padding: var(--space-16) var(--space-6);
}

.stats-grid {
  max-width: var(--content-default);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.stat-card {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================
   HOW IT WORKS
   ============================================ */
.how-section {
  padding: clamp(var(--space-12), 6vw, var(--space-24)) var(--space-6);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  margin-bottom: var(--space-12);
}

.steps-grid {
  max-width: var(--content-default);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.step-card {
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  transition: border-color 0.2s ease;
}

.step-card:hover {
  border-color: var(--color-border);
}

.step-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.step-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.step-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ============================================
   CATEGORIES
   ============================================ */
.categories-section {
  padding: clamp(var(--space-8), 4vw, var(--space-16)) var(--space-6);
  padding-bottom: clamp(var(--space-16), 8vw, var(--space-32));
}

.categories-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  max-width: var(--content-default);
  margin: 0 auto;
}

.category-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-chip:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.category-chip.active {
  color: #fff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: var(--space-8) var(--space-6);
}

.footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.footer-link {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-decoration: none;
}

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

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  animation: fadeInUp 0.6s ease both;
}

.hero-title {
  animation: fadeInUp 0.6s ease 0.1s both;
}

.hero-subtitle {
  animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-desc {
  animation: fadeInUp 0.6s ease 0.3s both;
}

.generate-btn {
  animation: fadeInUp 0.6s ease 0.4s both;
}

/* Card shake animation on generate */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px) rotate(-1deg); }
  20% { transform: translateX(8px) rotate(1deg); }
  30% { transform: translateX(-6px) rotate(-0.5deg); }
  40% { transform: translateX(6px) rotate(0.5deg); }
  50% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.excuse-card.shake {
  animation: shake 0.5s ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .hero {
    min-height: 70vh;
    padding: var(--space-12) var(--space-4);
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .stat-card {
    padding: var(--space-5) var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .stat-number {
    margin-bottom: 0;
    font-size: var(--text-xl);
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }

  .excuse-card {
    padding: var(--space-6);
  }

  .excuse-text {
    font-size: var(--text-lg);
  }

  .excuse-site {
    display: none;
  }

  .excuse-card-footer {
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .hero-line-2 {
    font-size: var(--text-3xl);
  }

  .generate-btn {
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-6);
  }
}
