/* ============================================================
   ESG Personal Homepage — Custom Styles
   Color palette derived from moderncv "green" theme (LaTeX)
   Primary green: #2a7f3f  (moderncv green ≈ #2e7d32 / forest)
   ============================================================ */

:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --primary:        #2a7f3f;   /* moderncv classic green — accent only */
  --primary-light:  #3aaa55;
  --primary-dark:   #1d5c2d;

  --surface:     #ffffff;
  --surface-alt: #f5f5f5;   /* neutral light gray */
  --border:      #e6e6e6;   /* neutral */
  --text:        #111111;   /* near-black */
  --text-muted:  #555555;
  --text-light:  #888888;

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .07), 0 1px 2px -1px rgb(0 0 0 / .07);
  --shadow:    0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .08);
  --radius:    0.75rem;
  --radius-sm: 0.4rem;
}

[data-theme="dark"] {
  --surface:     #111111;
  --surface-alt: #1c1c1c;
  --border:      #2e2e2e;
  --text:        #eeeeee;
  --text-muted:  #aaaaaa;
  --text-light:  #666666;
  --primary:        #4ade80;
  --primary-light:  #86efac;
  --primary-dark:   #22c55e;
}

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

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

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.7;
  transition: background .3s, color .3s;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color .2s;
}
a:hover { color: var(--primary-light); }

img { max-width: 100%; }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── navbar ────────────────────────────────────────────────── */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: .75rem;
}

.nav-brand {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.nav-brand:hover { color: var(--primary); }

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color .2s;
}
.nav-brand:hover .nav-avatar { border-color: var(--primary); }

.nav-links {
  display: flex;
  gap: .25rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: .85rem;
  padding: .3rem .55rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background .2s, color .2s;
}
.nav-links a:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.nav-controls {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.btn-ctrl {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: .25rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  transition: color .2s, background .2s;
}
.btn-ctrl:hover {
  color: var(--primary);
  background: var(--surface-alt);
}

.btn-icon {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.btn-icon:hover {
  background: var(--surface-alt);
  color: var(--primary);
}
.btn-icon svg { width: 18px; height: 18px; }

/* ── Hero ──────────────────────────────────────────────────── */
#hero {
  padding: 5rem 0 3.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-light);
  background: var(--surface-alt);
  border-radius: 999px;
  padding: .25rem .75rem;
  margin-bottom: .8rem;
  border: 1px solid var(--border);
}

.hero-tag span.dot {
  width: 7px; height: 7px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
}

h1.hero-name {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--text);
}

.hero-alias {
  font-size: .95rem;
  color: var(--text-light);
  font-weight: 400;
  margin-left: .3rem;
}

.hero-title {
  font-size: 1.05rem;
  color: var(--primary);
  font-weight: 600;
  margin: .45rem 0 .25rem;
}

.hero-location {
  font-size: .875rem;
  color: var(--text-light);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.hero-location svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.hero-bio {
  font-size: .975rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.8;
}

.hero-bio a {
  color: var(--primary);
  text-decoration: none;
  padding: 0 2px;
  border-radius: 2px;
  transition: background .2s, color .2s;
}

.hero-bio a:hover {
  background: var(--primary);
  color: #fff;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.5rem;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
  padding: .4rem .9rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: all .2s;
}
.hero-link:hover, .hero-link.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.hero-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.hero-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--green-200);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--primary);
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
}
.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Section Commons ───────────────────────────────────────── */
.section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }

.section-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.section-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.25rem;
  background: var(--primary);
  border-radius: 2px;
}

/* ── Project Cards ─────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.3rem;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.card-title svg { width: 14px; height: 14px; color: var(--primary); }

.card-badge {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .6rem;
  display: inline-block;
  align-self: flex-start;
}

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

/* ── Timeline ──────────────────────────────────────────────── */
.timeline-group-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin: 1.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.timeline-group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.timeline {
  position: relative;
  padding-left: 1.6rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

.tl-item {
  position: relative;
  padding-bottom: 2rem;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -1.9rem;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  transition: border-color .2s, background .2s;
}
.tl-item.highlight .tl-dot {
  background: var(--primary);
  border-color: var(--primary);
  width: 14px;
  height: 14px;
  left: -2rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.tl-period {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .2rem;
}

.tl-role {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.tl-item.highlight .tl-role { color: var(--primary); }

.tl-org {
  font-size: .9rem;
  color: var(--text-muted);
  margin: .15rem 0;
}
.tl-org .tl-location {
  font-size: .8rem;
  color: var(--text-light);
}

.tl-desc {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .45rem;
  line-height: 1.7;
}

/* ── Skills ────────────────────────────────────────────────── */
.skills-grid {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.skill-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: .75rem;
}

.skill-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.skill-years {
  font-size: .75rem;
  color: var(--text-light);
  text-align: right;
  white-space: nowrap;
}

.skill-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}
.skill-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
  transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* tooltip via title is fine for accessibility */

/* ── Hobbies ───────────────────────────────────────────────── */
.hobby-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}
.hobby-tag {
  font-size: .85rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Education ─────────────────────────────────────────────── */
.edu-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
}
.edu-degree { font-weight: 700; font-size: 1rem; color: var(--text); }
.edu-school { font-size: .9rem; color: var(--primary); font-weight: 600; margin: .15rem 0; }
.edu-period { font-size: .8rem; color: var(--text-light); }
.edu-detail { font-size: .85rem; color: var(--text-muted); margin-top: .4rem; line-height: 1.65; }

/* ── Contact ───────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .75rem;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: border-color .2s, color .2s;
  min-width: 0;
  overflow: hidden;
}
.contact-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-item:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.contact-item svg { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .82rem;
  color: var(--text-light);
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-avatar { display: none; }
  .skill-row { grid-template-columns: 1fr; gap: .3rem; }
  .skill-years { text-align: left; }
  .nav-links { display: none; }
}

/* ── Transitions via class toggling ───────────────────────── */
.fade-in {
  animation: fadeIn .4s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Show more button ──────────────────────────────────────── */
.btn-show-more {
  margin-top: 1.25rem;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--primary);
  font-size: .875rem;
  font-weight: 600;
  padding: 0;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: color .2s;
}
.btn-show-more:hover { color: var(--primary-light); }
.btn-show-more::before {
  content: '↓';
  font-size: .8rem;
}
