*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --accent: #58a6ff;
  --accent2: #3fb950;
  --text: #e6edf3;
  --muted: #8b949e;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --accent: #0969da;
  --accent2: #1a7f37;
  --text: #24292f;
  --muted: #57606a;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

/* ✅ anchor offset so sticky nav won't cover headings */
section {
  scroll-margin-top: 90px; /* desktop-ish default */
}

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
}

nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

/* Desktop nav layout */
.nav-panel {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.1rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  white-space: nowrap;
}

nav a:hover {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-decoration: none;
  font-weight: 600;
  transition:
    opacity 0.2s,
    border-color 0.2s;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

/* Hamburger (only on mobile) */
.nav-toggle {
  display: none;
  padding: 0.45rem 0.75rem;
}

/* Mobile top-right actions (Theme/Lang) */
.nav-top-actions {
  display: none; /* desktop hidden */
  align-items: center;
  gap: 0.6rem;
}

/* ── Hero ── */
.hero {
  max-width: 860px;
  margin: 3rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  transition:
    transform 0.2s,
    opacity 0.2s;
}

.avatar-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}

.avatar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.avatar-btn:hover .avatar {
  transform: scale(1.03);
  opacity: 0.95;
}

/* Lightbox (in-page) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.lightbox.open {
  display: flex;
}

.lightbox-panel {
  max-width: min(92vw, 720px);
  max-height: 86vh;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  padding: 12px;
}

.lightbox-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(86vh - 24px);
  border-radius: 12px;
  object-fit: contain;
}

.lightbox-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* .doc-picker-panel {
  position: relative;
  width: min(92vw, 520px);
  padding: 1.2rem;
}

.doc-picker-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  text-align: center;
}

.doc-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0;
}

.doc-picker-option {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem 1.05rem;
}

.doc-picker-option:hover {
  border-color: var(--accent);
}

.doc-picker-option-title {
  font-size: 1rem;
  font-weight: 700;
} */

.hero-text h1 {
  font-size: 2rem;
}

.hero-text h1 span {
  color: var(--accent);
}

.hero-text .tagline {
  color: var(--muted);
  margin-top: 0.4rem;
  font-size: 1rem;
}

.hero-text .location {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

.hero-text .motto {
  margin-top: 0.55rem;
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0.95;
  letter-spacing: 0.2px;
}

.hero-text .motto em {
  color: var(--muted);
  font-style: normal;
}

.hero-links {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Sections ── */
main {
  max-width: 860px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
}

section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.section-header .left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.section-header .icon {
  font-size: 1.2rem;
}

.section-header .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
  text-align: right;
}

/* About */
.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.about-list li::before {
  content: "▸ ";
  color: var(--accent);
}

.callout {
  margin-top: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.callout h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.callout p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}

/* Shared tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tag.green {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent2) 14%, transparent);
  color: var(--accent2);
}

/* Skills */
.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skill-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.skill-label {
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 0.15rem;
  min-width: 0;
}

/* Card grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: inherit;
}

/* Projects */
.project-card {
  text-decoration: none;
  transition:
    border-color 0.2s,
    transform 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card h3 {
  font-size: 1rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

/* Experience */
.exp-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.exp-title h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 700;
}

.exp-org {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Highlights (desktop default: dot | year | text) */
.bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bullet-list li {
  display: grid;
  grid-template-columns: 14px 6.2rem 1fr;
  gap: 0.6rem;
  align-items: start;
  color: var(--muted);
  line-height: 1.55;
}

.bullet-list li::before {
  content: "●";
  color: var(--muted);
  line-height: 1.55;
  transform: translateY(0.2rem);
}

.bullet-list strong {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

/* Contact */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
}

.contact-list a:hover {
  text-decoration: underline;
}

.contact-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: 0 0 20px;
}

.contact-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 760px) {
  /* .doc-picker-actions {
    grid-template-columns: 1fr;
  } */

  /* nav height changes on mobile; adjust scroll margin */
  section {
    scroll-margin-top: 140px;
  }

  nav {
    padding: 0.75rem 1rem;
  }

  .nav-top-actions {
    display: inline-flex; /* ✅ show in top row */
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* ✅ keep top row: brand | (theme/lang) | hamburger */
  .nav-right-top {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
  }

  /* dropdown panel: only links */
  .nav-panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
  }

  nav.is-open .nav-panel {
    display: flex;
  }

  nav ul {
    flex-direction: column;
    gap: 0.6rem;
  }

  /* hide actions inside dropdown on mobile */
  .nav-panel .nav-actions {
    display: none;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .section-header .subtitle {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: left;
    font-size: 0.95rem;
  }

  .skill-row {
    grid-template-columns: 96px 1fr;
    gap: 0.6rem;
  }

  /* ✅ Highlights on mobile: year on its own line, text below */
  .bullet-list li {
    grid-template-columns: 14px 1fr;
    grid-template-areas:
      "dot year"
      "dot text";
    gap: 0.35rem 0.6rem;
  }

  .bullet-list li::before {
    grid-area: dot;
  }

  .bullet-list strong {
    grid-area: year;
    min-width: 0;
  }
}

.to-top {
  --to-top-offset: 0px;
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--to-top-offset));
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.to-top.show.is-idle {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
}

.to-top:hover {
  border-color: var(--accent);
}
