/* Reset and Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --text-primary: #111827;  /* gray-900 */
  --text-secondary: #4b5563; /* gray-600 */
  --accent-color: #2563eb;  /* blue-600 */
  --bg-white: #ffffff;
  --bg-light: #f9fafb;      /* gray-50 */
  --border-color: #e5e7eb;  /* gray-200 */
  --chip-bg: #f3f4f6;       /* gray-100 */
  --chip-border: #e5e7eb;   /* gray-200 */
  --shadow-sm: 0 1px 1px rgba(0,0,0,0.04);
  --shadow-md: 0 3px 6px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.08);
  --container-width: 1008px;
  --un-blue: #5B92E5;       /* UN blue for UNFCCC logo badge */
  --company-primary: #8f83ff; /* Company primary color for hero tile */
}

/* Respect system preference by default */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #e5e7eb;  /* gray-200 */
    --text-secondary: #9ca3af; /* gray-400 */
    --bg-white: #0f172a;       /* slate-900 */
    --bg-light: #0b1220;       /* deep background */
    --border-color: #1f2937;   /* gray-800 */
      --chip-bg: #17233b;        /* slightly lighter than bg */
      --chip-border: #24324c;    /* subtle border */
  }
}

/* Explicit theme overrides take precedence */
:root[data-theme="light"] {
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --bg-white: #ffffff;
  --bg-light: #f9fafb;
  --border-color: #e5e7eb;
  --chip-bg: #f3f4f6;
  --chip-border: #e5e7eb;
}

:root[data-theme="dark"] {
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --bg-white: #0f172a;
  --bg-light: #0b1220;
  --border-color: #1f2937;
  --chip-bg: #17233b;
  --chip-border: #24324c;
}
.timeline-skills li { display: inline-block; padding: 0.35rem 0.7rem; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); border-radius: 999px; font-size: 0.9rem; line-height: 1; }
.skill-category li { display: inline-block; padding: 0.35rem 0.7rem; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); border-radius: 999px; font-size: 0.9rem; }
.tag { display: inline-block; padding: 0.35rem 0.7rem; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); border-radius: 999px; font-size: 0.85rem; }

/* Slide theme toggle (track + thumb) */
.theme-toggle { position: fixed; top: 16px; right: 24px; z-index: 1000; border: 1px solid var(--chip-border); background: var(--bg-light); color: var(--text-secondary); border-radius: 999px; width: 56px; height: 28px; display: inline-flex; align-items: center; justify-content: space-between; padding: 0 6px; cursor: pointer; box-shadow: var(--shadow-sm); transition: background-color 0.2s ease, border-color 0.2s ease; }
.theme-toggle:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.theme-toggle:hover { box-shadow: var(--shadow-md); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { pointer-events: none; opacity: 0.6; transition: opacity 0.2s ease; }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; }
.theme-toggle .toggle-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #ffffff; box-shadow: var(--shadow-sm); transition: transform 0.2s ease, background-color 0.2s ease; }
[data-theme="dark"] .theme-toggle .toggle-thumb { transform: translateX(28px); }

html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: var(--text-primary); background: var(--bg-white); text-align: justify; transition: background-color 0.25s ease, color 0.25s ease; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 2rem; }

/* Hero */
.hero { background: var(--bg-white); color: var(--text-primary); display: flex; align-items: center; }
.hero-content { max-width: 780px; }
.hero-logo { display: flex;}
.hero-logo > img { height: 40px; margin-left: auto; margin-right: auto; padding: 8px 12px; background: #ffffff; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .hero-logo > img { background: var(--text-primary) }
.hero-headline { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; margin-top: 1rem; }
.hero-subtitle { font-size: 1.25rem; font-weight: 500; opacity: 0.9; margin-bottom: 0.5rem; }
.hero-description { padding-top: 2rem; font-size: 1.125rem; opacity: 0.9; margin-bottom: 1.5rem; }
.hero-actions { margin-top: 1.5rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.75rem 1.25rem; font-size: 1rem; font-weight: 600; text-decoration: none; border-radius: 999px; transition: all 0.2s ease; border: 1px solid var(--border-color); }
.btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.btn-primary { background: var(--text-primary); color: white; border-color: var(--text-primary); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-secondary { background: transparent; color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-light); transform: translateY(-2px); }

/* Sections */
section { padding: 3rem 0; }
.section-title { font-size: 0.9rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 2rem; }
/* Intro (profile + current role) */
.intro { min-height: 100vh; display: flex; align-items: center; background: var(--bg-white); color: var(--text-primary); }
.intro .intro-stack { display: grid; gap: 2.5rem; max-width: 960px; margin: 0 auto; width: 100%; }
.intro .hero-content, .intro .current-role-card { max-width: 960px; margin-left: auto; margin-right: auto; }
.current-role-card { border: 1px solid var(--border-color); background: var(--bg-light); border-radius: 12px; padding: 1rem 1.25rem; box-shadow: var(--shadow-sm); }
.current-role-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.12), transparent 70%), var(--company-primary); border-radius: 16px; height: 220px; box-shadow: var(--shadow-md); }
.current-role-logo img { height: 112px; width: auto; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1)); }
.current-role-eyebrow { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.25rem; text-align: center; }
.current-role-title { font-size: 1.05rem; text-align: center; margin-bottom: 0.25rem; }
.current-role-summary p { color: var(--text-secondary); text-align: center; }
/* Selected work link */
.selected-work-link { display: block; text-align: center; margin-top: 0.75rem; margin-bottom: 0.5rem; color: var(--accent-color); text-decoration: none; font-weight: 500; font-size: 0.95rem; transition: opacity 0.2s ease; }
.selected-work-link:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; border-radius: 4px; }
.selected-work-link:hover { opacity: 0.8; }
/* Current role skills as chips */
.current-role-skills { margin-top: 0.75rem; }
.current-role-skills ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.current-role-skills li { display: inline-block; padding: 0.35rem 0.7rem; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); border-radius: 999px; font-size: 0.85rem; line-height: 1; }

/* Entrance animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.animate-fade-up { animation: fadeUp 520ms cubic-bezier(.22,.61,.36,1) both; }
.delay-1 { animation-delay: 90ms; }
.delay-2 { animation-delay: 180ms; }
.delay-3 { animation-delay: 270ms; }
.delay-4 { animation-delay: 360ms; }
.delay-5 { animation-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  .animate-fade-up { animation: none !important; }
}

/* Experience */
.experience { background: var(--bg-light); }
.timeline { max-width: 900px; margin: 0 auto; position: relative; }
.timeline-item { margin-bottom: 1.25rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1.25rem; }
.timeline-item:last-of-type { border-bottom: 0; }
.timeline-item.collapsible { display: none; }
.timeline-item.collapsible.visible { display: block; }
.show-more-btn { display: block; margin: 2rem auto 0; padding: 0.75rem 1.5rem; background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 999px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.show-more-btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.show-more-btn:hover { background: var(--bg-white); transform: translateY(-1px); }
.show-more-btn.hidden { display: none; }
.timeline-title { display: flex; gap: 0.5rem; align-items: center; }
.timeline-content { border-radius: 8px; padding: 1rem 0.25rem; }
.timeline-content h3 { font-size: 1.25rem; color: var(--text-primary); margin-bottom: 0.25rem; }
.timeline-role { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.125rem; }
.timeline-period { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
/* New two-column body for each role */
.timeline-body { display: contents; }
.timeline-summary p { color: var(--text-secondary); line-height: 1.7; }
.timeline-skills { border-left: 1px solid var(--border-color); padding-left: 1rem; }
.timeline-skills ul { list-style: none; padding-left: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.timeline-skills li { display: inline-block; padding: 0.35rem 0.7rem; background: var(--bg-light); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 999px; font-size: 0.9rem; line-height: 1; }
/* Company logo & meta row */
/* Legacy .timeline-meta kept for backward compatibility (unused now) */
.timeline-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.125rem; }
.timeline-meta .timeline-role { margin: 0; }

/* New left logo column layout */
.timeline-row { display: grid; grid-template-columns: 56px 2fr 1.5fr; gap: 1rem; align-items: start; }
.timeline-logo { display: flex; align-items: flex-start; justify-content: center; padding-top: 2px; }
.company-logo { height: 32px; width: auto; display: block; filter: grayscale(30%); transition: filter 0.2s ease; background: #ffffff; border-radius: 6px; padding: 4px 6px; box-shadow: var(--shadow-sm); }
.swissre-logo { background-color: #bfbfbf; }
.julius-baer-logo { background-color: #141e55; }
.unfccc-logo { background: var(--un-blue); width: 36px;}
/* [data-theme="dark"] .company-logo { background: rgba(255, 255, 255, 0.95); border-color: rgba(255, 255, 255, 0.2); } */
.timeline-item:hover .company-logo { filter: grayscale(0%); }
.logo-fallback { width: 12px; height: 12px; background: var(--border-color); border-radius: 999px; margin-top: 4px; display: inline-block; }
/* Do not apply dark-mode white badge when logo is inside the current role hero tile */
.current-role-logo .company-logo { background: transparent !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1)) !important; box-shadow: none !important; }

/* Skills Section */
.skills { background: var(--bg-white); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.skill-category-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; letter-spacing: 0.03em; }
.skill-category ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-category li { display: inline-block; padding: 0.35rem 0.7rem; background: var(--chip-bg); color: var(--text-primary); border: 1px solid var(--chip-border); border-radius: 999px; font-size: 0.9rem; }

/* Contact */
.contact-content { max-width: 640px; margin: 0 auto; text-align: center; }
.contact-description { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.8; }
.contact-links { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.contact-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.1rem; background: transparent; color: var(--text-primary); text-decoration: none; border: 1px solid var(--border-color); border-radius: 999px; font-weight: 600; transition: all 0.2s ease; }
.contact-link:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.contact-link:hover { background: var(--chip-bg); border-color: var(--text-secondary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.contact-link svg { width: 24px; height: 24px; }
#copy-email { cursor: pointer; }
#copy-email.copied { background: var(--chip-bg); border-color: var(--text-secondary); }

/* Responsive */
@media (max-width: 768px) {
  .intro { min-height: auto; padding-top: 3rem; padding-bottom: 2rem; }
  .intro .intro-stack { gap: 2rem; }
  .intro .hero-content, .intro .current-role-card { max-width: 100%; }
  .hero-title { font-size: 2.25rem; }
  .hero-subtitle { font-size: 1.1rem; }
  .hero-description { font-size: 1rem; }
  .nav-menu { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .section-title { font-size: 0.85rem; }
  .btn { text-align: center; }
  .contact-links { flex-direction: column; }
  .current-role-logo { height: 160px; }
  .current-role-logo img { height: 88px; }
  /* Stack third column on small screens */
  .timeline-row { grid-template-columns: 40px 1fr; }
  .timeline-skills { grid-column: 1 / -1; border-left: 0; padding-left: 0; margin-top: 0.75rem; border-top: 1px solid var(--border-color); padding-top: 0.75rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .navbar .container { padding: 1rem; }
  .nav-brand { font-size: 1.05rem; }
  .nav-menu { font-size: 0.9rem; gap: 0.75rem; }
}

/* Improve button contrast in dark mode */
[data-theme="dark"] .btn-primary { background: var(--accent-color); border-color: var(--accent-color); color: #ffffff; }
