/* Base Theme Variables */
:root {
  --bg: #0f1215;
  --text: #e6e6e6;
  --muted: #b8bec7;
  --card: #161a1e;
  --border: #242a2f;
  /* Dark theme accent tuned for better contrast */
  --accent: #22c3e6;
  --shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* Light Theme Overrides */
:root.light {
  --bg: #f7f8fb;
  --text: #171a1f;
  --muted: #536175;
  --card: #ffffff;
  --border: #e6e9ef;
  --accent: #005b7f;
  --shadow: 0 6px 20px rgba(0,0,0,0.08);
}

/* Respect system preference on first load via JS class */
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Sora", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 64px;
}

.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { position: fixed; top: 0; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; max-width: 1040px; margin: 0 auto; padding: 0 20px; width: 100%; box-sizing: border-box; }
.brand a { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: 0.2px; }
.brand-link { transition: transform 0.3s ease; }
.brand-link:hover { transform: scale(1.05); }
.logo { width: 40px; height: 40px; color: var(--accent); flex-shrink: 0; }
.nav { display: flex; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; margin-left: 16px; }
.nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.3s ease; }
.lang-toggle:hover { background: var(--accent); color: #0a0f14; }
:root.light .lang-toggle:hover { color: #ffffff; }
.theme-toggle { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; }

/* Burger Menu */
.burger-toggle { display: none; flex-direction: column; gap: 4px; background: transparent; border: none; padding: 8px; cursor: pointer; }
.burger-toggle span { width: 24px; height: 2px; background: var(--text); transition: all 0.3s ease; }
.burger-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger-toggle.active span:nth-child(2) { opacity: 0; }
.burger-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

/* Hero */
.hero { 
  padding: 72px 0 24px; 
  background: radial-gradient(ellipse at center top, rgba(34, 195, 230, 0.08) 0%, rgba(34, 195, 230, 0.02) 40%, transparent 70%);
  position: relative;
}
:root.light .hero {
  background: radial-gradient(ellipse at center top, rgba(0, 91, 127, 0.06) 0%, rgba(0, 91, 127, 0.02) 40%, transparent 70%);
}
.hero-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 16px; }
.hero-inner h2 { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: clamp(1.4rem, 2.5vw, 2rem); margin: 0; }
.subtitle { color: var(--muted); margin-top: 10px; }
.cta-row { margin-top: 22px; display: flex; gap: 12px; }
.btn { display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); text-decoration: none; background: var(--card); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); color: #0a0f14; border-color: transparent; }
.btn.primary:hover { background: #1fbcd9; }
.btn.primary:focus { outline: none; box-shadow: 0 0 0 3px rgba(34, 195, 230, 0.25); }
:root.light .btn.primary { color: #ffffff; }
.quick-facts { display: flex; gap: 16px; padding: 0; margin: 24px 0 0; list-style: none; }
.quick-facts a { color: var(--text); }

/* Sections */
section { padding: 40px 0; }
.section-subtitle { color: var(--muted); }

/* Timeline */
.timeline { position: relative; margin-top: 24px; }
.timeline::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 48px; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: 10px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: var(--shadow); }
.timeline-header { display: flex; align-items: baseline; gap: 10px; }
.timeline-title { font-weight: 600; }
.timeline-meta { color: var(--muted); font-size: 0.95rem; }
.timeline-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag { font-size: 0.82rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--card); }
.timeline-desc { margin-top: 10px; color: var(--text); }
.timeline-achievements { margin-top: 8px; padding-left: 18px; list-style-type: disc; }
.timeline-achievements li { color: var(--muted); font-size: 0.95rem; margin-bottom: 4px; }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }
.project-card { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.project-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.project-card p { margin: 0; color: var(--muted); }
.project-meta { display: flex; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.card-actions { margin-top: 12px; display: flex; gap: 10px; }
.card-actions a { text-decoration: none; color: var(--text); border-bottom: 1px dashed var(--border); }
.load-more { margin-top: 16px; }

/* About */
.about-content { margin-bottom: 20px; }
.about-content p { margin: 12px 0; line-height: 1.8; color: var(--text); }
.about-content strong { color: var(--accent); }
.skills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; padding: 0; list-style: none; }
.skills li { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--card); }

/* Services Grid (Open For) */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
.service-card { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); text-align: center; }
.service-card .icon { font-size: 40px; margin-bottom: 10px; }
.service-card h3 { margin: 0 0 6px; font-size: 1rem; }
.service-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Contact */
.contact-list { list-style: none; padding: 0; }
.contact-list li { margin: 8px 0; }
.contact-list a { color: var(--text); }

/* Contact Form */
.contact-form-section { background: var(--card); }
.contact-form { max-width: 600px; margin-top: 24px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text); }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 227, 255, 0.1);
}
.form-group textarea { resize: vertical; }
.form-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
  display: none;
}
.form-status.success {
  background: rgba(76, 175, 80, 0.1);
  color: #4caf50;
  display: block;
}
.form-status.error {
  background: rgba(244, 67, 54, 0.1);
  color: #f44336;
  display: block;
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; }
.site-footer p { color: var(--muted); }

/* Back to Top */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.back-to-top.show { display: flex; }
.back-to-top:hover { transform: translateY(-1px); }

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 1000;
  display: none;
}
.cookie-banner.show { display: block; }
.cookie-banner__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cookie-banner__content p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .cookie-banner__content {
    flex-direction: column;
    align-items: flex-start;
  }
  .cookie-banner__actions {
    width: 100%;
  }
  .cookie-banner__actions .btn {
    width: 100%;
    text-align: center;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .burger-toggle { display: flex; }
  .nav { 
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 0;
    display: none;
  }
  .nav.active { display: flex; }
  .nav a { 
    margin: 0;
    padding: 12px 20px;
    width: 100%;
    border-bottom: 1px solid var(--border);
    text-align: center;
  }
  .nav a:last-child { border-bottom: none; }
}

@media (max-width: 640px) {
  .header-inner { gap: 10px; }
  .quick-facts { flex-direction: column; gap: 6px; }
  .logo { width: 36px; height: 36px; }
}

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  section { padding: 32px 0; }
  .hero { padding: 56px 0 20px; }
  .hero-title { font-size: clamp(1.6rem, 3vw, 2rem); }
  .hero-inner h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
  .cta-row { flex-direction: column; gap: 10px; align-items: stretch; }
  .btn { display: block; width: 100%; text-align: center; padding: 10px 16px; }
  .project-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .services-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .service-card { padding: 16px; }
  .service-card h3 { font-size: 0.95rem; }
  .service-card p { font-size: 0.85rem; }
  .about-content p { font-size: 0.95rem; line-height: 1.7; }
  .skills { gap: 6px; }
  .skills li { padding: 4px 8px; font-size: 0.85rem; }
  .timeline::before { left: 14px; }
  .timeline-dot { left: 6px; width: 14px; height: 14px; }
  .timeline-item { padding-left: 40px; }
  .timeline-title { font-size: 1rem; }
  .timeline-meta { font-size: 0.9rem; }
  .contact-list { padding: 0; }
  .contact-list li { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 12px; }
  section { padding: 24px 0; }
  .hero-title { font-size: clamp(1.4rem, 3vw, 1.8rem); }
  .hero-inner h2 { font-size: clamp(1.2rem, 2vw, 1.6rem); }
  .subtitle { font-size: 0.95rem; }
  .brand a { font-size: 0.95rem; }
  .cta-row { align-items: stretch; }
  .project-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .service-card { padding: 12px; }
  .service-card .icon { font-size: 32px; }
  .service-card h3 { font-size: 0.9rem; }
  .service-card p { font-size: 0.8rem; }
  .about-content p { font-size: 0.9rem; }
  .timeline-item { padding-left: 32px; padding-bottom: 16px; }
  .timeline-achievements li { font-size: 0.9rem; }
  .form-group { margin-bottom: 14px; }
  .form-group input,
  .form-group textarea { font-size: 16px; }
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.timeline-item {
  opacity: 0;
  animation: fadeInUp 0.7s ease-out forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.05s; }
.timeline-item:nth-child(2) { animation-delay: 0.1s; }
.timeline-item:nth-child(3) { animation-delay: 0.15s; }
.timeline-item:nth-child(4) { animation-delay: 0.2s; }
.timeline-item:nth-child(5) { animation-delay: 0.25s; }
.timeline-item:nth-child(6) { animation-delay: 0.3s; }
.timeline-item:nth-child(7) { animation-delay: 0.35s; }

.project-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(102, 227, 255, 0.15);
}
