/* ============================================================================
   Portfolio Hamza Atig - PRO Stylesheet
   Version 2.0 - Mars 2026
   ============================================================================ */

/* ----------------------------------------------------------------------------
   CSS Variables & Themes
   ---------------------------------------------------------------------------- */
:root {
  /* Colors - Light Theme */
  --bg: #f9f9f9;
  --bg-accent: #e3ecf8;
  --text: #2c3e50;
  --text-muted: #5a6a7a;
  --link: #2c3e50;
  --link-hover: #3498db;
  --card: #ffffff;
  --border: #e0e0e0;
  --shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.12);
  --hero-overlay: rgba(0, 0, 0, 0.25);
  --badge-expert: #2c3e50;
  --badge-expert-hover: #3498db;
  --badge-standard: #e5ebf4;
  --badge-standard-hover: #b9d4f4;
  --table-header: #f3f6fb;
  --table-row-even: #fafbfe;
  --header-bg: rgba(255, 255, 255, 0.85);
  --cta-bg: #3498db;
  --cta-hover: #2980b9;
  --accent: #3498db;
  --accent-light: #e8f4fc;
  --success: #27ae60;
  --code-bg: #f4f4f4;

  /* Typography */
  --font-sans: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Fira Code", "SF Mono", Consolas, monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* Dark Theme */
:root[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #0f1420;
  --bg-accent: #141b2b;
  --text: #e6edf5;
  --text-muted: #a0aec0;
  --link: #e6edf5;
  --link-hover: #7dc4ff;
  --card: #1a2234;
  --border: #2d3a4f;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  --card-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.5);
  --hero-overlay: rgba(0, 0, 0, 0.5);
  --badge-expert: #3a4a64;
  --badge-expert-hover: #4f8ed6;
  --badge-standard: #1c2434;
  --badge-standard-hover: #2b3a52;
  --table-header: #1c2434;
  --table-row-even: #151c28;
  --header-bg: rgba(15, 20, 32, 0.9);
  --cta-bg: #4f8ed6;
  --cta-hover: #3a7bc8;
  --accent: #7dc4ff;
  --accent-light: #1c2a3a;
  --code-bg: #1e2738;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ----------------------------------------------------------------------------
   Typography
   ---------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md) 0;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: 2.25rem; }
h2 {
  font-size: 1.5rem;
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  margin-bottom: 0.9rem;
}
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-muted);
}

strong {
  color: var(--text);
  font-weight: 600;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
}

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

/* Underline animation for content links */
.container a:not(.offer-card):not([style*="display"]) {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size var(--transition-base), color var(--transition-fast);
}

.container a:not(.offer-card):not([style*="display"]):hover {
  background-size: 100% 2px;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin: 0 0 var(--space-md) 0;
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

li::marker {
  color: var(--accent);
}

/* Blockquotes */
blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}

blockquote p {
  margin: 0;
  color: var(--text);
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

pre {
  background: var(--code-bg);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* Horizontal Rule */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 1.5rem 0;
}

/* ----------------------------------------------------------------------------
   Header & Navigation
   ---------------------------------------------------------------------------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: box-shadow var(--transition-base);
}

header.scrolled {
  box-shadow: var(--shadow);
}

.nav-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.burger {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.burger:hover {
  background: var(--accent-light);
}

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

.nav-right a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-right a:hover,
.nav-right a.active {
  color: var(--text);
  background: var(--accent-light);
}

.nav-right a.active {
  color: var(--accent);
}

/* Language Switch */
.lang-switch {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: var(--space-sm);
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.lang-switch a {
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition-fast);
}

.lang-switch a:hover {
  background: var(--card);
}

.lang-switch a.active {
  background: var(--accent);
  color: #fff;
}

/* Theme Toggle */
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* Mobile Navigation */
@media (max-width: 768px) {
  .burger {
    display: block;
  }

  .nav-right {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 65px;
    left: var(--space-md);
    right: var(--space-md);
    background: var(--card);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow-hover);
    border: 1px solid var(--border);
    gap: var(--space-xs);
  }

  .nav-right.open {
    display: flex;
    animation: slideDown 0.3s ease;
  }

  .nav-right a {
    width: 100%;
    text-align: center;
    padding: var(--space-md);
  }

  .lang-switch {
    margin: var(--space-sm) 0 0 0;
    justify-content: center;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----------------------------------------------------------------------------
   Hero Banner
   ---------------------------------------------------------------------------- */
.hero-banner {
  background:
    linear-gradient(135deg, var(--hero-overlay) 0%, rgba(52, 152, 219, 0.3) 100%),
    url("https://images.unsplash.com/photo-1522071820081-009f0129c71c?auto=format&fit=crop&w=1400&q=80")
    center/cover fixed;
  min-height: 260px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 65px;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

.hero-text {
  font-size: 2rem;
  line-height: 1.3;
  text-align: center;
  max-width: 800px;
  padding: var(--space-lg);
  color: #ffffff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.8s ease;
}

.hero-text .icon {
  font-size: 1.5rem;
  margin-right: var(--space-sm);
}

.hero-text .highlight {
  color: #ffe082;
  font-weight: 700;
}

.hero-subtitle {
  display: block;
  font-size: 1.1rem;
  font-weight: 400;
  margin-top: var(--space-sm);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}

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

/* ----------------------------------------------------------------------------
   CTA Banner
   ---------------------------------------------------------------------------- */
.cta-banner {
  background: linear-gradient(135deg, var(--cta-bg) 0%, var(--cta-hover) 100%);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  to {
    left: 100%;
  }
}

.cta-banner a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  display: inline-block;
  padding: 12px 28px;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  position: relative;
  z-index: 1;
}

.cta-banner a:hover {
  background: #fff;
  color: var(--cta-bg);
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* ----------------------------------------------------------------------------
   Main Container
   ---------------------------------------------------------------------------- */
.container {
  max-width: 900px;
  margin: 2.5rem auto;
  padding: 1.75rem 1.5rem;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
}

/* Fade-in animation for sections */
.container > * {
  animation: fadeIn 0.6s ease both;
}

.container > *:nth-child(1) { animation-delay: 0.1s; }
.container > *:nth-child(2) { animation-delay: 0.15s; }
.container > *:nth-child(3) { animation-delay: 0.2s; }
.container > *:nth-child(4) { animation-delay: 0.25s; }
.container > *:nth-child(5) { animation-delay: 0.3s; }

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

.section-spacing {
  margin-bottom: 1.5rem;
}

/* ----------------------------------------------------------------------------
   Skills Badges
   ---------------------------------------------------------------------------- */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-md);
}

.skills span {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-base);
  cursor: default;
}

/* Expert badges */
.skills.expert span {
  background: linear-gradient(135deg, var(--badge-expert) 0%, #1a252f 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}

.skills.expert span:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
  background: linear-gradient(135deg, var(--badge-expert-hover) 0%, var(--badge-expert) 100%);
}

/* Standard badges */
.skills.standard span {
  background: var(--badge-standard);
  color: var(--text);
  border: 1px solid var(--border);
}

.skills.standard span:hover {
  background: var(--badge-standard-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ----------------------------------------------------------------------------
   Offer Cards
   ---------------------------------------------------------------------------- */
.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.offer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background: var(--card);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.offer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--cta-hover));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.offer-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
}

.offer-card:hover::before {
  transform: scaleX(1);
}

.offer-card h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: 1.1rem;
  color: var(--text);
  border: none;
  padding: 0;
  display: block;
}

.offer-card p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.offer-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--border);
}

/* ----------------------------------------------------------------------------
   Tables
   ---------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border);
}

th, td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--table-header);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) td {
  background: var(--table-row-even);
}

tr:hover td {
  background: var(--accent-light);
}

/* Responsive table */
@media (max-width: 600px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ----------------------------------------------------------------------------
   Footer
   ---------------------------------------------------------------------------- */
footer {
  background: var(--card);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
  padding: var(--space-lg) var(--space-md);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

footer strong {
  color: var(--text);
}

/* ----------------------------------------------------------------------------
   Buttons (for CV download, etc.)
   ---------------------------------------------------------------------------- */
.container a[style*="display: inline-block"] {
  transition: all var(--transition-base) !important;
}

.container a[style*="display: inline-block"]:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}

/* ----------------------------------------------------------------------------
   Profile Image
   ---------------------------------------------------------------------------- */
.container img[alt="Hamza Atig"] {
  transition: all var(--transition-base);
  border: 3px solid var(--card);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.container img[alt="Hamza Atig"]:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ----------------------------------------------------------------------------
   Scroll animations (Intersection Observer)
   ---------------------------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------------------------------------------
   Selection
   ---------------------------------------------------------------------------- */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ----------------------------------------------------------------------------
   Scrollbar
   ---------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ----------------------------------------------------------------------------
   Print Styles
   ---------------------------------------------------------------------------- */
@media print {
  header, .cta-banner, footer, .theme-toggle, .lang-switch {
    display: none !important;
  }

  .container {
    box-shadow: none;
    margin: 0;
    padding: var(--space-md);
  }

  body {
    background: white;
  }
}

/* ----------------------------------------------------------------------------
   Responsive Adjustments
   ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-wrapper {
    padding: var(--space-md);
  }

  .container {
    margin: 2rem var(--space-md);
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }

  .hero-banner {
    min-height: 200px;
  }

  .hero-text {
    font-size: 1.5rem;
    padding: var(--space-md);
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .container {
    margin: 1.75rem var(--space-md);
    padding: 1.25rem var(--space-md);
    border-radius: var(--radius-md);
  }

  .offer-grid {
    gap: var(--space-md);
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }

  .hero-banner {
    min-height: 180px;
  }

  .hero-text {
    font-size: 1.25rem;
  }

  .hero-text .icon {
    display: none;
  }

  .skills span {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

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

  .cta-banner a {
    font-size: 0.95rem;
    padding: 10px 20px;
  }

  th, td {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

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