:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #14161a;
  --text-dim: #55585f;
  --border: #e3e5ea;
  --accent: #3d5afe;
  --accent-2: #00c2a8;
  --sidebar-bg: #101218;
  --sidebar-text: #f4f5f8;
  --sidebar-dim: #9a9db0;
  --sidebar-border: #262a36;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --shadow: 0 10px 30px -12px rgba(20, 22, 26, 0.12);
}

[data-theme="dark"] {
  --bg: #0d0e12;
  --surface: #16181d;
  --text: #eef0f4;
  --text-dim: #9a9ea8;
  --border: #262932;
  --sidebar-bg: #08090c;
  --sidebar-border: #1c1e26;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 40%, transparent 100%);
}

#theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, background 0.3s ease;
}
#theme-toggle:hover { transform: scale(1.08); }
#theme-toggle svg { width: 20px; height: 20px; position: absolute; transition: opacity 0.2s ease, transform 0.3s ease; }
#icon-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] #icon-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"] #icon-moon { opacity: 1; transform: rotate(0); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
  max-width: 1800px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
}

.sidebar-inner {
  padding: 72px 48px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-height: 100%;
}

.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent-2);
  font-weight: 600;
  line-height: 1.6;
}

.sidebar h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 3.2vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--sidebar-text);
}

.tagline {
  font-size: 1rem;
  color: var(--sidebar-dim);
  max-width: 320px;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-dim);
  text-decoration: none;
  font-size: 0.88rem;
  word-break: break-word;
  transition: color 0.2s ease;
}
a.contact-item:hover { color: var(--accent-2); }
.contact-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--sidebar-border);
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease, padding-left 0.2s ease;
}
.side-nav a:hover {
  color: var(--sidebar-text);
  background: rgba(255,255,255,0.05);
  padding-left: 16px;
}
.side-nav a.active {
  color: var(--sidebar-text);
  background: rgba(61, 90, 254, 0.18);
}

.study-link {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  font-weight: 600;
  font-size: 0.9rem;
  background: linear-gradient(120deg, rgba(61,90,254,0.18), rgba(0,194,168,0.18));
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.study-link:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.nav-num {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--accent-2);
  font-weight: 700;
}

main {
  padding: 72px 72px 40px;
  max-width: 1100px;
}

.section {
  padding: 0 0 88px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  scroll-margin-top: 40px;
}
.section.is-visible { opacity: 1; transform: translateY(0); }

.section-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
}
.section-title .num {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.summary-text {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 780px;
  line-height: 1.75;
}

.timeline { display: flex; flex-direction: column; gap: 28px; }

.job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 40px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.job:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -14px rgba(20, 22, 26, 0.2);
}
.job::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.job h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.org { color: var(--accent); font-weight: 500; font-size: 0.95rem; margin-top: 3px; }

.date {
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.job ul {
  padding-left: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 32px;
}
.job li { color: var(--text-dim); font-size: 0.96rem; }
.job li::marker { color: var(--accent-2); }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.skill-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -14px rgba(20, 22, 26, 0.2);
}
.skill-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 18px;
  color: var(--accent);
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
  font-size: 0.82rem;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.edu-card, .cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.edu-card:hover, .cert-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -14px rgba(20, 22, 26, 0.2);
}
.edu-card h3, .cert-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.edu-card .date, .cert-card .date {
  display: inline-block;
  margin-top: 12px;
}

.cert-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.cert-card { min-width: 240px; }

footer {
  padding: 40px 0 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 1200px) {
  .job ul { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .sidebar-inner { padding: 56px 32px; }
  .side-nav { margin-top: 16px; }
  main { padding: 56px 32px 40px; max-width: 100%; }
}

@media (max-width: 600px) {
  .job-head { flex-direction: column; }
  .job { padding: 26px 24px; }
  .edu-grid, .cert-row, .skills-grid { grid-template-columns: 1fr; }
  .sidebar-inner { padding: 40px 24px; }
  main { padding: 40px 20px; }
}

#lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}

#lock-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px;
  width: min(90vw, 320px);
}

#lock-label {
  font-family: var(--font-display);
  color: var(--sidebar-text);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

#lock-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: #181b24;
  color: var(--sidebar-text);
  font-family: var(--font-body);
}

#lock-input:focus {
  outline: none;
  border-color: var(--accent);
}

#lock-form button {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}

#lock-form button:hover { opacity: 0.9; }

#lock-error {
  display: none;
  color: #ff6b6b;
  font-size: 0.85rem;
}

