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

:root {
  --bg:          #ffffff;
  --bg-alt:      #f5f5f5;
  --sidebar-bg:  #f0f0f0;
  --text:        #1a1a1a;
  --text-muted:  #4f4f4f;
  --border:      #e0e0e0;
  --accent:      #1a1a1a;
  --radius:      4px;
  --sidebar-w:   220px;
  --font:        'Source Sans Pro', sans-serif;
  --transition:  0.18s ease;
}

body.dark {
  --bg:         #121212;
  --bg-alt:     #1e1e1e;
  --sidebar-bg: #181818;
  --text:       #e8e8e8;
  --text-muted: #999;
  --border:     #2e2e2e;
  --accent:     #e8e8e8;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { opacity: 0.65; }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.35rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 1.5rem; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul { padding-left: 1.25rem; }
li { margin-bottom: 0.3rem; }

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

#sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 5rem 0 1.5rem;
}

#sidebar-nav a {
  display: block;
  padding: 0.65rem 1.75rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color var(--transition), background var(--transition);
  border-left: 2px solid transparent;
}

#sidebar-nav a:hover {
  color: var(--text);
  background: rgba(0,0,0,.04);
  opacity: 1;
}

#sidebar-nav a.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(0,0,0,.04);
}

.sidebar-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Language toggle ──────────────────────────────────── */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

.lang-switch .switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.lang-switch .switch input { display: none; }

.lang-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}

.lang-switch .slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform var(--transition);
}

.lang-switch .switch input:checked + .slider { background: #bbb; }
.lang-switch .switch input:checked + .slider::before { transform: translateX(16px); }

/* ── Main content area ────────────────────────────────── */
#content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

.page {
  display: none;
  padding: 3.5rem 4rem 4rem;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease;
}

.page.active { display: block; }

#projects {
  max-width: none;
  padding: 3.5rem 2.5rem 4rem;
}

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

/* ── Home page ────────────────────────────────────────── */
#home {
  display: none;
  min-height: 100vh;
  padding: 2rem 4rem 2rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: none;
  width: 100%;
}

#home.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.home-inner {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.home-greeting {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.home-greeting a { color: var(--text-muted); }

.home-name {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.home-bio {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 0;
  text-align: justify;
}

.home-actions {
  max-width: 600px;
  width: 100%;
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition);
}

.btn:hover { opacity: 0.75; color: #fff; }

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

.btn-outline:hover { background: var(--bg-alt); opacity: 1; }

/* ── Section header ───────────────────────────────────── */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h2 { margin-bottom: 0; }

/* ── Skills page ──────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
}

.skill-group { }

.skill-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.skill-group p,
.skill-group .skill-value {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* ── Skill detail list (qualities / spoken / hobbies) ─── */
.skill-detail-list {
  list-style: none;
  padding: 0;
}

.skill-detail-list li {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.skill-detail-list li strong {
  font-weight: 600;
}

/* ── Project modal ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--bg);
  border-radius: var(--radius);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}

.modal-close {
  position: sticky;
  top: 0.75rem;
  float: right;
  margin: 0.75rem 0.75rem 0 0;
  width: 28px;
  height: 28px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background var(--transition);
  z-index: 1;
}

.modal-close:hover { background: var(--border); }

.modal-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.modal-year {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.modal-title a { color: var(--text); }

.modal-desc {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.modal-bullets {
  list-style: disc;
  padding-left: 1.25rem;
}

.modal-bullets li {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

/* ── Timeline ─────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2.25rem 1.75rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
}

.timeline-period {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.timeline-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timeline-description {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.timeline-bullets {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.timeline-bullets li {
  font-size: 0.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem 0.55rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Projects grid ────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.project-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.project-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--bg-alt);
}

.project-card-body {
  padding: 0.9rem 1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card-year {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.project-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-card-title a {
  color: var(--text);
  text-decoration: none;
}

.project-card-title a:hover { opacity: 0.65; }

.project-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

/* ── Contact page ─────────────────────────────────────── */
.contact-info {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.contact-info li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.contact-info li i {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.social-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

.social-links li { margin: 0; }

.social-links a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.social-links a:hover { background: var(--bg-alt); opacity: 1; }

.spoken-flags {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.spoken-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Theme toggle button (sidebar) ───────────────────── */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.2rem 0.3rem;
  line-height: 1;
  transition: color var(--transition);
}

.theme-toggle-btn:hover { color: var(--text); }

/* ── Mobile controls (top-right on mobile) ────────────── */
.mobile-controls {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  gap: 0.4rem;
  align-items: center;
}

.mobile-lang-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.55rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  cursor: pointer;
}

.mobile-lang-btn:hover { background: var(--bg-alt); }

/* ── Burger button (mobile only) ──────────────────────── */
#burger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--transition);
}

#burger:hover { background: var(--bg-alt); }

#burger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Burger → X when sidebar open */
body.sidebar-open #burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.sidebar-open #burger span:nth-child(2) { opacity: 0; }
body.sidebar-open #burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 99;
}

body.sidebar-open .sidebar-overlay { display: block; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .skills-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 101;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  #burger { display: flex; }
  .mobile-controls { display: flex; }

  #content {
    margin-left: 0;
  }

  .page {
    padding: 4.5rem 1.5rem 2.5rem;
  }

  #home {
    padding: 5rem 1.5rem 2rem;
  }


}

@media (max-width: 480px) {
  .home-name { font-size: 2rem; }
  h2 { font-size: 1.1rem; }
}
