:root,
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --surface: #1e293b;
  --surface-hover: #273449;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --accent-border: rgba(56, 189, 248, 0.3);
  --accent-hover: #7dd3fc;
  --nav-bg: rgba(11, 17, 32, 0.85);
  --hero-glow: rgba(56, 189, 248, 0.12);
  --portfolio-shadow: rgba(56, 189, 248, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --max-width: 1100px;
  --nav-height: 64px;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elevated: #e2e8f0;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.12);
  --accent-border: rgba(2, 132, 199, 0.25);
  --accent-hover: #0369a1;
  --nav-bg: rgba(241, 245, 249, 0.92);
  --hero-glow: rgba(2, 132, 199, 0.1);
  --portfolio-shadow: rgba(2, 132, 199, 0.12);
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background:
    linear-gradient(rgba(11, 17, 32, 0.72), rgba(11, 17, 32, 0.82)),
    url("site/images/bg.jpg") center / cover no-repeat fixed;
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

[data-theme="light"] body {
  background:
    linear-gradient(rgba(241, 245, 249, 0.78), rgba(241, 245, 249, 0.88)),
    url("site/images/bg.jpg") center / cover no-repeat fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(92%, var(--max-width));
  margin: 0 auto;
}

/* Navigation */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.top-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: 1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-glow);
  color: var(--accent);
}

/* Hero */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero .tagline {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 36rem;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), #0369a1);
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.hero-actions .btn-secondary:hover {
  background: linear-gradient(135deg, var(--accent-strong), #0369a1);
  border-color: transparent;
  color: #fff;
  filter: brightness(1.08);
}

/* Sections */
section {
  padding: 3.5rem 0;
}

.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-muted);
  max-width: 40rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card p {
  color: var(--text-muted);
}

.card + .card {
  margin-top: 1rem;
}

/* Skills */
.skill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
}

.skill-grid li {
  padding: 0.45rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text);
}

/* Experience timeline */
.timeline {
  list-style: none;
  display: grid;
  gap: 1.25rem;
}

.timeline-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  border-left: 3px solid var(--accent);
  transition: border-color 0.2s, transform 0.2s;
}

.timeline-item:hover {
  border-left-color: var(--accent-hover);
  transform: translateX(4px);
}

.timeline-item h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.timeline-item .meta {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.timeline-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Education list */
.edu-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.edu-list li {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.edu-list strong {
  color: var(--text);
}

/* Contact page */
.contact-page {
  padding: 3.5rem 0 2rem;
}

.contact-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: start;
}

.contact-page-content {
  min-width: 0;
}

.contact-page-content h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.contact-page-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
}

.contact-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.contact-download {
  margin-bottom: 0.5rem;
}

.contact-download a {
  font-weight: 600;
}

.contact-photo {
  padding-top: 3.25rem;
}

.contact-avatar {
  width: 240px;
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--accent-border);
  padding: 6px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.contact-link-list {
  list-style: none;
  display: grid;
  gap: 0.9rem;
  max-width: 28rem;
}

.contact-link-list li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  font-size: 1.05rem;
  line-height: 1.5;
}

.contact-label {
  color: var(--text-muted);
  font-weight: 600;
}

.contact-link-list a {
  display: inline;
  width: fit-content;
  max-width: 100%;
  justify-self: start;
  font-weight: 500;
  word-break: break-word;
}

.contact-link-list span:not(.contact-label) {
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 900px) {
  .contact-page-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-photo {
    justify-self: start;
  }
}

@media (max-width: 480px) {
  .contact-link-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Portfolio teaser */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.portfolio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.portfolio-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px var(--portfolio-shadow);
}

.portfolio-card .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.portfolio-card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.portfolio-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.75rem;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.footer-brand-link:hover {
  color: var(--accent);
}

.footer-brand-link img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--accent-border);
  object-fit: cover;
}

.footer-brand p {
  max-width: 16rem;
  line-height: 1.6;
  font-size: 0.88rem;
}

.footer-col h3 {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.footer-col ul {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
  word-break: break-word;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  font-size: 0.82rem;
}

.footer-bottom a {
  color: var(--accent);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .top-nav .container {
    flex-direction: column;
    padding: 0.75rem 0;
  }

  .nav-right {
    flex-direction: column;
    width: 100%;
  }

  .nav-links {
    justify-content: center;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  section {
    padding: 2.5rem 0;
  }
}
