/* ========== Base ========== */
:root {
  --navy: #0f2742;
  --navy-light: #1b3a5c;
  --slate: #475569;
  --slate-light: #64748b;
  --accent: #0e8a8a;
  --accent-soft: #e0f2f2;
  --bg: #f6f8fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(15, 39, 66, 0.07);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== Header / Nav ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; }

.nav__brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.nav__brand:hover { text-decoration: none; color: var(--accent-soft); }

.nav__links { display: flex; list-style: none; gap: 6px; }

.nav__links a {
  color: #cbd5e1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.nav__links a:hover { background: var(--navy-light); color: #fff; text-decoration: none; }

.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* ========== Hero ========== */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 70%, var(--accent) 130%);
  color: #fff;
  padding: 72px 0 64px;
  text-align: center;
}

.hero__name { font-size: 2.6rem; font-weight: 800; letter-spacing: 0.01em; }
.hero__title { font-size: 1.3rem; color: var(--accent-soft); margin-top: 8px; font-weight: 500; }

.hero__contact {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero__contact a {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
  transition: background 0.15s;
}
.hero__contact a:hover { background: rgba(255, 255, 255, 0.22); text-decoration: none; }

/* ========== Sections ========== */
.section { padding: 48px 0 8px; }

.section__title {
  font-size: 1.6rem;
  color: var(--navy);
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.subsection__title {
  font-size: 1.15rem;
  color: var(--navy-light);
  margin-bottom: 14px;
}

/* ========== About ========== */
.about__summary { font-size: 1.05rem; color: var(--slate); max-width: 70ch; }

.languages { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.languages .lang-chip {
  background: var(--accent-soft);
  color: var(--navy-light);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}
.languages .lang-chip small { font-weight: 400; color: var(--slate); }

/* ========== Timeline (experience & education) ========== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline__item { position: relative; margin-bottom: 28px; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline__card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

.timeline__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.timeline__role { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.timeline__company { color: var(--accent); font-weight: 600; font-size: 0.98rem; }
.timeline__date { color: var(--slate-light); font-size: 0.88rem; white-space: nowrap; }
.timeline__detail { color: var(--slate); font-size: 0.92rem; font-weight: 600; margin-top: 2px; }

.timeline__card ul { margin: 10px 0 0 18px; color: var(--slate); font-size: 0.96rem; }
.timeline__card li { margin-bottom: 6px; }

/* ========== Skills ========== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.skill-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.skill-group h3 { font-size: 0.95rem; color: var(--navy-light); margin-bottom: 10px; }

.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tags span {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--slate);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.skill-tags span:hover { border-color: var(--accent); color: var(--accent); }

/* ========== Awards & Activities ========== */
.awards-activities { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.card__title { font-weight: 700; color: var(--navy); font-size: 0.98rem; }
.card__meta { color: var(--slate-light); font-size: 0.86rem; margin-top: 3px; }
.card__detail { color: var(--slate); font-size: 0.9rem; margin-top: 4px; }

/* ========== Contact ========== */
.contact-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  max-width: 640px;
}
.contact-box p { color: var(--slate); margin-bottom: 12px; }
.contact-box ul { list-style: none; color: var(--slate); }
.contact-box li { margin-bottom: 6px; }

/* ========== Footer ========== */
.site-footer {
  margin-top: 56px;
  background: var(--navy);
  color: #94a3b8;
  text-align: center;
  padding: 22px 0;
  font-size: 0.9rem;
}

/* ========== Load error ========== */
.load-error {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
/* Keep the hidden attribute working despite the display:flex rule above */
.load-error[hidden] { display: none; }
.load-error p { max-width: 420px; text-align: center; color: #b91c1c; font-weight: 600; }

/* ========== Fade-in animation ========== */
.fade-in { animation: fadeIn 0.45s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in { animation: none; }
}

/* ========== Responsive ========== */
@media (max-width: 720px) {
  .nav__toggle { display: block; }

  .nav__links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--navy);
    padding: 10px 16px 16px;
    gap: 2px;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
  }
  .nav__links.open { display: flex; }
  .nav__links a { display: block; padding: 12px; }

  .hero { padding: 52px 0 44px; }
  .hero__name { font-size: 1.9rem; }
  .hero__title { font-size: 1.1rem; }

  .awards-activities { grid-template-columns: 1fr; }
  .timeline__head { flex-direction: column; gap: 0; }
  .timeline__date { white-space: normal; }
}
