/* ============================================= */
/* iamahlramz.dev — Shared Design System         */
/* Single source of truth for all pages           */
/* ============================================= */

/* ============================================= */
/* CSS Variables                                 */
/* ============================================= */
:root {
  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Font Sizes — Fluid */
  --text-xs: clamp(0.7rem, 0.65rem + 0.2vw, 0.75rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  --text-lg: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-xl: clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
  --text-2xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-3xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --text-4xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --text-5xl: clamp(2.5rem, 2rem + 3vw, 4rem);
  --text-6xl: clamp(3rem, 2rem + 5vw, 6rem);
  --text-hero: clamp(3.5rem, 2.5rem + 6vw, 8rem);

  /* 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;

  /* Layout */
  --container-max: 1400px;
  --container-padding: clamp(1.5rem, 4vw, 4rem);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration-fast: 200ms;
  --duration-base: 400ms;
  --duration-slow: 600ms;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* ============================================= */
/* Dark Theme (Default)                          */
/* ============================================= */
[data-theme="dark"] {
  --bg-base: #0f172a;
  --bg-elevated: #1e293b;
  --bg-muted: #334155;
  --bg-subtle: #475569;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-inverse: #0f172a;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);

  --accent: #14919b;
  --accent-muted: rgba(20, 145, 155, 0.15);
  --accent-hover: #17a5b0;

  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --warning: #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.15);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.15);
  --purple: #a78bfa;
  --purple-muted: rgba(167, 139, 250, 0.15);
  --info: #457b9d;

  --gradient-hero: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(20, 145, 155, 0.25), transparent);
  --noise-opacity: 0.03;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* ============================================= */
/* Light Theme                                   */
/* ============================================= */
[data-theme="light"] {
  --bg-base: #f9fafb;
  --bg-elevated: #ffffff;
  --bg-muted: #f3f4f6;
  --bg-subtle: #e5e7eb;

  --text-primary: #111827;
  --text-secondary: #374151;
  --text-tertiary: #6b7280;
  --text-inverse: #f9fafb;

  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-default: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);

  --accent: #0d7377;
  --accent-muted: rgba(13, 115, 119, 0.1);
  --accent-hover: #0a5c5f;

  --success: #16a34a;
  --success-muted: rgba(22, 163, 74, 0.1);
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.1);
  --danger: #dc2626;
  --danger-muted: rgba(220, 38, 38, 0.1);
  --purple: #7c3aed;
  --purple-muted: rgba(124, 58, 237, 0.1);
  --info: #3a6a8a;

  --gradient-hero: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(13, 115, 119, 0.12), transparent);
  --noise-opacity: 0.02;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

::selection {
  background: var(--accent);
  color: var(--text-inverse);
}

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

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

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

ul, ol {
  list-style: none;
}

/* Focus Visibility — WCAG 2.4.7 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Skip to Content — WCAG 2.4.1 */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 10000;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}

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

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

@media (min-width: 768px) {
  section {
    padding: var(--space-32) 0;
  }
}

/* ============================================= */
/* Theme Toggle (Unified)                        */
/* ============================================= */
.theme-toggle {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-base) var(--ease-out-expo);
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  transition: color var(--duration-fast) ease;
}

.theme-toggle:hover svg {
  color: var(--accent);
}

.theme-icon--sun { display: none; }
.theme-icon--moon { display: block; }

[data-theme="dark"] .theme-icon--sun { display: block; }
[data-theme="dark"] .theme-icon--moon { display: none; }

/* ============================================= */
/* Navigation (Shared)                           */
/* ============================================= */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6) 0;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  width: 100%;
}

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

.nav__brand a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav__logo,
.brand-mark {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.nav__items {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast) ease;
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-base) var(--ease-out-expo);
}

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

.nav__link:hover::after {
  width: 100%;
}

.nav__link--cta {
  color: var(--accent);
  font-weight: 600;
}

.nav__link--cta::after {
  display: none;
}

.nav__link--cta:hover {
  color: var(--accent-hover);
}

/* Mobile hamburger */
.nav__mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 101;
}

.nav__mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--duration-fast) ease;
}

.nav__mobile-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav__mobile-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .nav__items {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    flex-direction: column;
    justify-content: center;
    gap: var(--space-8);
    z-index: 100;
  }

  .nav__items.active {
    display: flex;
  }

  .nav__items .nav__link {
    font-size: var(--text-2xl);
  }

  .nav__mobile-toggle {
    display: flex;
  }
}

/* ============================================= */
/* Section Headers                               */
/* ============================================= */
.section-header {
  margin-bottom: var(--space-12);
  text-align: center;
}

.section-header--left {
  text-align: left;
}

.section-number {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-4);
  letter-spacing: 0.1em;
}

.section-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.section-subtitle,
.section-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

/* ============================================= */
/* Buttons                                       */
/* ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--duration-base) var(--ease-out-expo);
  white-space: nowrap;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(20, 145, 155, 0.3);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 145, 155, 0.4);
}

.btn--ghost,
.btn--outline {
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
}

.btn--ghost:hover,
.btn--outline:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.btn--small {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--large {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-base);
}

.btn--full {
  width: 100%;
}

.btn--app-store {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.btn--app-store:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn svg {
  flex-shrink: 0;
}

/* ============================================= */
/* Project Cards (Shared)                        */
/* ============================================= */
.project-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  transition: all var(--duration-base) var(--ease-out-expo);
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-muted), transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-base) ease;
}

.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card__badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-muted);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  z-index: 2;
}

.project-card__header {
  position: relative;
  z-index: 2;
}

.project-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.project-card__footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
}

.project-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: var(--radius-lg);
  color: white;
}

.project-icon svg {
  width: 32px;
  height: 32px;
}

.project-icon--alt {
  background: var(--bg-subtle);
  color: var(--accent);
}

.project-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.project-tagline {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.project-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

.project-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: auto;
}

.project-status {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--success);
}

.project-status--coming {
  color: var(--warning);
}

/* Tags */
.tag {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.tag--ios {
  background: rgba(129, 178, 154, 0.15);
  color: var(--success);
}

.tag--web {
  background: rgba(69, 123, 157, 0.15);
  color: var(--info);
}

.tag--free {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Tech Stack Badges */
.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  transition: all var(--duration-fast) ease;
}

.tech-badge:hover {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Project tech stack (inline) */
.project-tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.project-tech-stack span {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}

/* Project metrics */
.project-metrics {
  display: flex;
  gap: var(--space-4);
}

.project-metrics .metric {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: 0;
  background: none;
  border: none;
  text-align: left;
}

.project-metrics .metric strong {
  color: var(--accent);
  font-weight: 700;
}

/* Project features (pill badges) */
.project-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.project-features span {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-full);
}

/* ============================================= */
/* Social Links                                  */
/* ============================================= */
.social-link {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--duration-base) var(--ease-out-expo);
}

.social-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* ============================================= */
/* Footer (Shared)                               */
/* ============================================= */
.footer {
  padding: var(--space-10) 0;
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

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

.footer-brand .brand-mark,
.footer-brand .nav__logo {
  font-size: var(--text-lg);
}

.footer-copy {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.footer-nav,
.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-nav a,
.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--duration-fast) ease;
}

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

.footer-tagline {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.footer-tagline .highlight {
  color: var(--accent);
  font-weight: 500;
}

.footer-social {
  display: flex;
  gap: var(--space-4);
}

.footer-social a {
  color: var(--text-tertiary);
  transition: color var(--duration-fast) ease;
}

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

/* ============================================= */
/* Animations (Shared)                           */
/* ============================================= */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--duration-slow) var(--ease-out-expo),
    transform var(--duration-slow) var(--ease-out-expo);
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* CSS stagger via custom property */
[data-animate] {
  transition-delay: calc(var(--stagger, 0) * 100ms);
}

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

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

/* ============================================= */
/* Back to Top                                   */
/* ============================================= */
.back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: all var(--duration-base) var(--ease-out-expo);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-4px);
}

/* ============================================= */
/* 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;
  }
}
