/* Variables */
:root {
  --bg: #f7fafc;
  --text: #2d3748;
  --text-secondary: #718096;
  --text-muted: #a0aec0;
  --heading: #2d3748;
  --subheading: #4a5568;
  --border: #e2e8f0;
  --card-bg: white;
  --nav-bg: #2d3748;
  --nav-text: #e2e8f0;
  --footer-bg: #2d3748;
  --footer-text: #e2e8f0;
  --code-bg: #edf2f7;
  --primary: #dfb160;
  --primary-hover: #c89a3f;
  --swiper-bg: #1a202c;
}

[data-theme="dark"] {
  --bg: #1a202c;
  --text: #e2e8f0;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --heading: #f7fafc;
  --subheading: #cbd5e0;
  --border: #2d3748;
  --card-bg: #2d3748;
  --nav-bg: #0d1117;
  --nav-text: #e2e8f0;
  --footer-bg: #0d1117;
  --footer-text: #e2e8f0;
  --code-bg: #2d3748;
  --swiper-bg: #0d1117;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Nav */
nav {
  background: var(--nav-bg);
  padding: 1rem 2rem;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

nav li:last-child {
  margin-left: auto;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.lang-switch {
  border: 1px solid var(--primary);
  color: var(--primary) !important;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  height: 30px;
  width: 50px;
  text-align: center;
}

.lang-switch:hover {
  background: var(--primary);
  color: var(--nav-bg) !important;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s;
  height: 30px;
  width: 50px;
}

.theme-toggle:hover {
  background: var(--primary);
  color: var(--nav-bg);
}

nav a {
  color: var(--nav-text);
  text-decoration: none;
  font-weight: 500;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--primary);
}

main {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
}

pre[class*="language-"] {
  border-radius: 8px;
  margin: 1rem 0;
}

/* CV */
.cv-header {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.cv-header .info h1 {
  font-size: 2rem;
  color: var(--heading);
}

.cv-header .info p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.cv-header picture img {
  border-radius: 50%;
  width: 150px;
  height: 150px;
  object-fit: cover;
}

.cv-download {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1.2rem;
  background: var(--primary);
  color: #2d3748;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 6px;
}

.cv-download:hover {
  background: var(--primary-hover);
}

/* 404 */
.page-404 {
  text-align: center;
  padding: 6rem 2rem;
  border: none;
}

.page-404 h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 1rem;
}

.page-404 p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .cv-header {
    flex-direction: column;
    text-align: center;
  }

  .cv-header .info h1 {
    font-size: 1.5rem;
  }
}

section {
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

section:last-child {
  border-bottom: none;
}

section h2 {
  font-size: 1.4rem;
  color: var(--heading);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

.job, .formation-item {
  margin-bottom: 1.5rem;
}

.job h3, .formation-item h3 {
  font-size: 1.1rem;
  color: var(--subheading);
}

.job .period, .formation-item .period {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.job .role {
  margin: 0.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--primary);
}

.job .role h4 {
  font-size: 0.95rem;
  color: var(--subheading);
  font-weight: 500;
}

.job .role .period {
  margin-bottom: 0.25rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.skill-category h3 {
  font-size: 1rem;
  color: var(--subheading);
  margin-bottom: 0.5rem;
}

.skill-category ul {
  list-style: none;
}

.skill-category li {
  padding: 0.2rem 0;
  color: var(--text-secondary);
}

.skill-category li::before {
  content: "\2192 ";
  color: var(--primary);
}

/* Swiper */
.swiper {
  margin-top: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.swiper-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--swiper-bg);
}

.swiper-slide img {
  max-width: 100%;
  max-height: 500px;
  height: auto;
  display: block;
  object-fit: contain;
}

.swiper-button-prev,
.swiper-button-next {
  color: var(--primary);
}

.swiper-pagination-bullet-active {
  background: var(--primary);
}

/* Footer */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 3rem 2rem;
  margin-top: 2rem;
}

footer h2 {
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 1.5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.contact-grid {
  max-width: 800px;
  margin: 0 auto;
}

.contact-grid p {
  color: var(--text-muted);
}

.contact-grid a {
  color: var(--primary);
  text-decoration: none;
}

.contact-grid a:hover {
  color: #fff;
}

/* Blog list */
.blog-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.blog-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  transition: border-color 0.2s;
}

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

.blog-card a {
  display: block;
  padding: 1.5rem;
  text-decoration: none;
}

.blog-card h2 {
  border: none;
  font-size: 1.2rem;
  color: var(--heading);
  padding: 0;
  margin-bottom: 0.25rem;
}

.blog-card time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.blog-card p {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.blog-empty {
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1rem;
}

/* Blog single */
.blog-single h1 {
  font-size: 1.8rem;
  color: var(--heading);
  margin-bottom: 0.25rem;
}

.blog-date {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.back-link:hover {
  color: var(--primary-hover);
}

.blog-body h2 {
  font-size: 1.3rem;
  color: var(--heading);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.3rem;
  margin: 2rem 0 1rem;
}

.blog-body h3 {
  font-size: 1.1rem;
  color: var(--subheading);
  margin: 1.5rem 0 0.5rem;
}

.blog-body p {
  margin-bottom: 1rem;
}

.blog-body pre {
  border-radius: 8px;
  margin: 1rem 0;
}

.blog-body code:not([class]) {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* About */
.about-page h1 {
  font-size: 2rem;
  color: var(--heading);
  margin-bottom: 2rem;
}

.about-page p {
  margin-bottom: 1.8rem;
  line-height: 1.85;
  color: var(--text);
  font-size: 1.05rem;
}

.about-page p:last-child {
  margin-bottom: 0;
}

.about-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}

.about-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.about-section:last-child {
  border-bottom: none;
}

.about-section h2 {
  font-size: 1.3rem;
  color: var(--heading);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

.about-section p {
  margin-bottom: 0.75rem;
  color: var(--text);
}

.about-section strong {
  color: var(--primary);
  font-weight: 600;
}

/* Scroll animations */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Print */
@media print {
  nav, footer, .swiper, .cv-download, .lang-switch, .theme-toggle {
    display: none !important;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  main {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  section {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  section h2 {
    border-bottom-color: #333;
  }

  .cv-header picture img {
    width: 100px;
    height: 100px;
  }

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

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}
