/* ==================================================
   Sohaib Haouam Portfolio - Consolidated Styles
   ================================================== */

/* CSS Variables */
:root {
  --flutter-blue: #0175C2;
  --flutter-navy: #02569B;
  --flutter-sky: #0553B1;
  --flutter-light-blue: #027DFD;
  --flutter-cyan: #13B9FD;
  --flutter-white: #ffffff;
  --flutter-bg: #F5F5F5;
  --flutter-dark: #001E3C;
  --text-primary: #001E3C;
  --text-secondary: #5A5A5A;
  --border-color: #E0E0E0;

  /* Dark mode colors */
  --dark-bg: #0A1929;
  --dark-surface: #0F2035;
  --dark-text: #E3F3FF;
  --dark-text-secondary: #B6C7D9;
  --dark-border: #1E3A52;
}

/* Dark mode overrides */
[data-theme="dark"] {
  --flutter-white: #0A1929;
  --flutter-bg: #0F2035;
  --flutter-dark: #E3F3FF;
  --text-primary: #E3F3FF;
  --text-secondary: #B6C7D9;
  --border-color: #1E3A52;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--flutter-white);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.7;
  min-height: 100vh;
}

/* Page Loading States */
body.page-loading {
  opacity: 0;
}

body.page-loaded {
  opacity: 1;
  transition: opacity 0.4s ease 0.2s;
}

body.transitioning {
  overflow: hidden;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Focus Indicators */
*:focus-visible {
  outline: 2px solid var(--flutter-light-blue);
  outline-offset: 2px;
}

/* Background Animation */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(150deg,
    #667EEA 0%,
    #5170D7 15%,
    #4B6ECF 25%,
    #3D8BCC 35%,
    #54B1DF 50%,
    #63C5E8 65%,
    #72D6EC 80%,
    #7FE3EE 100%
  );
}

[data-theme="dark"] .bg-animation {
  background: linear-gradient(150deg,
    #1E3A52 0%,
    #2A4A62 25%,
    #1E4A6A 50%,
    #2A5A7A 75%,
    #3A6A8A 100%
  );
}

.bg-shape {
  position: absolute;
  opacity: 0.7;
}

.shape-1 {
  width: 1000px;
  height: 1000px;
  background: linear-gradient(135deg, rgba(84, 177, 223, 0.6), rgba(99, 197, 232, 0.4));
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  top: -300px;
  right: -200px;
  transform: rotate(20deg);
  animation: float1 25s ease-in-out infinite;
}

.shape-2 {
  width: 800px;
  height: 800px;
  background: linear-gradient(135deg, rgba(75, 110, 207, 0.5), rgba(61, 139, 204, 0.6));
  clip-path: polygon(30% 0%, 70% 0%, 100% 100%, 0% 100%);
  bottom: -200px;
  left: -150px;
  transform: rotate(-15deg);
  animation: float2 30s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% {
    transform: rotate(20deg) translateY(0px);
  }
  50% {
    transform: rotate(25deg) translateY(-30px);
  }
}

@keyframes float2 {
  0%, 100% {
    transform: rotate(-15deg) translateY(0px);
  }
  50% {
    transform: rotate(-20deg) translateY(40px);
  }
}

/* Layout */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 3rem;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

[data-theme="dark"] header {
  background: rgba(10, 25, 41, 0.95);
}

header.is-scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-family: 'Google Sans', sans-serif;
  font-weight: 500;
  font-size: 1.25rem;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.8;
}

.brand-logo {
  width: 40px;
  height: 40px;
}

.brand-logo__svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Navigation */
nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  position: relative;
}

nav a.active {
  color: var(--flutter-blue);
}

nav a:hover {
  color: var(--flutter-blue);
}

nav a.active::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--flutter-blue);
  border-radius: 2px;
}

.site-nav__toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 1rem;
}

.site-nav__toggle:focus-visible {
  outline: 2px solid var(--flutter-light-blue);
  outline-offset: 3px;
}

.site-nav__bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--text-secondary);
  margin: 4px 0;
  transition: all 0.3s ease;
}

/* Typography */
h1 {
  font-family: 'Google Sans', sans-serif;
  font-size: clamp(1.5rem, 4vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--flutter-blue);
}

h2 {
  font-family: 'Google Sans', sans-serif;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.2;
  color: var(--text-primary);
}

h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Buttons */
.btn {
  padding: 1rem 2rem;
  border-radius: 28px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: inline-block;
  cursor: pointer;
  border: none;
  font-family: inherit;
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: var(--flutter-blue);
  color: white;
  box-shadow: 0 4px 12px rgba(1, 117, 194, 0.25);
}

.btn-primary:hover {
  background: var(--flutter-navy);
  box-shadow: 0 6px 16px rgba(1, 117, 194, 0.35);
  transform: translateY(-2px);
}

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

.btn-ghost {
  background: transparent;
  border: 2px solid var(--flutter-blue);
  color: var(--flutter-blue);
}

.btn-ghost:hover {
  background: rgba(1, 117, 194, 0.05);
}

/* Pills */
.pill {
  padding: 0.5rem 1.25rem;
  background: rgba(1, 117, 194, 0.08);
  border-radius: 24px;
  color: var(--flutter-blue);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-block;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.pill:hover {
  background: rgba(1, 117, 194, 0.15);
}

.pill-nav {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  flex-wrap: wrap;
  margin-bottom: 3rem;
  justify-content: center;
}

/* Sections */
section {
  padding: 6rem 0;
  position: relative;
  background: white;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

[data-theme="dark"] section {
  background: var(--dark-bg);
}

section:nth-child(even) {
  background: var(--flutter-bg);
}

[data-theme="dark"] section:nth-child(even) {
  background: var(--dark-surface);
}

.section-head {
  max-width: 800px;
  margin: 0 auto 4rem;
  text-align: center;
}

.eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--flutter-blue);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1rem;
  display: block;
}

.section-head p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Cards */
.card {
  width: 100%;
  padding: 2.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

[data-theme="dark"] .card {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.card-head {
  margin-bottom: 1.5rem;
}

.card-eyebrow {
  font-size: 0.875rem;
  color: var(--flutter-blue);
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
}

.card h3 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.card > p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.card-meta-list {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.card-meta-list li {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: default;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--flutter-blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: gap 0.3s ease;
}

.card-link:hover {
  gap: 1rem;
}

.card-link::after {
  content: '→';
  font-size: 1.25rem;
}

/* Platform Cards */
.platforms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.platform-card {
  padding: 2.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .platform-card {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

.platform-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--flutter-blue);
}

.platform-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1.5rem;
}

.platform-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.platform-card > p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.platform-card ul {
  list-style: none;
}

.platform-card li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.platform-card li::before {
  content: '✓';
  color: var(--flutter-blue);
  font-weight: 700;
  font-size: 1.125rem;
}

/* Skills */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  max-width: 1000px;
  margin: 0 auto;
}

.skill {
  padding: 0.75rem 1.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: default;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

[data-theme="dark"] .skill {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

.skill:hover {
  background: rgba(1, 117, 194, 0.05);
  border-color: var(--flutter-blue);
}

/* Footer */
footer {
  padding: 4rem 0 3rem;
  background: linear-gradient(135deg, var(--flutter-dark) 0%, #002847 100%);
  color: white;
  text-align: center;
  position: relative;
  border-top: 3px solid var(--flutter-blue);
}

[data-theme="dark"] footer {
  background: linear-gradient(135deg, #0A1929 0%, #0F1F2E 100%);
  border-top-color: var(--flutter-light-blue);
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--flutter-cyan), transparent);
  opacity: 0.3;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-inner p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 400;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: all 0.3s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.footer-links a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(19, 185, 253, 0.2), transparent);
  transition: left 0.4s ease;
}

.footer-links a:hover {
  color: var(--flutter-cyan);
  background: rgba(19, 185, 253, 0.1);
  transform: translateY(-2px);
}

.footer-links a:hover::before {
  left: 100%;
}

.footer-links a:focus-visible {
  outline: 2px solid var(--flutter-cyan);
  outline-offset: 3px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  text-align: left;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: white;
  background: linear-gradient(135deg, var(--flutter-cyan), var(--flutter-light-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.footer-brand .footer-tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-style: italic;
  margin-top: 0.75rem;
}

.footer-section h4 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: white;
}

.footer-section .footer-links {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.footer-section .footer-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.footer-section .footer-links a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.footer-section .footer-links a:hover svg {
  transform: scale(1.1);
}

.footer-section .footer-links a span {
  transition: color 0.3s ease;
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  margin: 0;
}

@media (max-width: 768px) {
  footer {
    padding: 3rem 0 2rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-section .footer-links {
    align-items: center;
  }

  .footer-brand h3 {
    font-size: 1.25rem;
  }
}

/* Page Transitions */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--flutter-blue);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
  pointer-events: none;
}

.page-transition.active {
  transform: translateX(0);
}

.page-transition.exit {
  transform: translateX(100%);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .platforms-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Navigation */
  nav {
    position: relative;
  }

  .site-nav__toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
  }

  nav ul {
    position: absolute;
    top: 60px;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex-direction: column;
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
    min-width: 200px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    transform-origin: top right;
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  [data-theme="dark"] nav ul {
    background: rgba(15, 32, 53, 0.98);
  }

  nav ul.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }

  nav a {
    font-size: 0.875rem;
  }

  nav a.active::after {
    bottom: -0.25rem;
  }

  /* Layout */
  .container {
    padding: 0 1rem;
  }

  h1 {
    font-size: clamp(1.5rem, 5.5vw, 2.25rem);
  }

  h2 {
    font-size: clamp(1.5rem, 5.5vw, 2rem);
  }

  section {
    min-height: auto;
    padding: 4rem 0 3rem;
  }

  .section-head p {
    font-size: 1.05rem;
  }

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

  .platform-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
  }

  .platform-card {
    padding: 1.25rem;
    border-radius: 12px;
  }

  .platform-card h3 {
    font-size: 1.125rem;
  }

  .platform-card > p {
    font-size: 0.95rem;
  }

  .pill {
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
  }

  .skills-grid {
    gap: 0.75rem;
  }

  .skill {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
  }

  .card {
    padding: 1.25rem;
    border-radius: 12px;
  }

  .card h3 {
    font-size: 1.25rem;
  }

  .card > p {
    font-size: 0.95rem;
  }

  .card-meta-list {
    gap: 0.4rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

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

/* Print Styles */
@media print {
  header {
    position: relative;
    box-shadow: none;
  }

  .bg-animation,
  .page-transition,
  .site-nav__toggle {
    display: none !important;
  }

  section {
    min-height: auto;
    page-break-inside: avoid;
  }
}
