/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-chip: #0f172a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-green: #4ade80;
  --border: #334155;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ==========================================================================
   Layout
   ========================================================================== */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 48px;
  padding: 64px 0;
}

.hero-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.lang-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Lang picker dropdown ─────────────────────────────────────────────── */
.lang-picker {
  position: relative;
}

.lang-picker-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-picker-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-picker-arrow {
  font-size: 0.7rem;
  line-height: 1;
}

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 120px;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.lang-menu--open {
  display: flex;
  flex-direction: column;
}

.lang-menu-item {
  display: block;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.lang-menu-item:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
  opacity: 1;
}

.lang-menu-other {
  border-top: 1px solid var(--border);
  color: var(--accent);
}

/* ── Translate dialog overlay ─────────────────────────────────────────── */
.dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.dialog-overlay--open {
  display: flex;
}

.dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dialog-title {
  font-size: 1rem;
  font-weight: 600;
}

.dialog-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.dialog-close:hover {
  color: var(--text-primary);
}

.dialog-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.translate-combo {
  position: relative;
  flex: 1;
  display: flex;
}

.translate-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 8px 36px 8px 12px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.translate-dropdown-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 30px;
  background: var(--bg-card);
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: color 0.2s;
}
.translate-dropdown-toggle:hover {
  color: var(--accent);
}

.translate-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.translate-dropdown--open {
  display: block;
}

.translate-dropdown-item {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}
.translate-dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.translate-dropdown-empty {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}
.translate-input:focus {
  border-color: var(--accent);
}
.translate-input::placeholder {
  color: var(--text-muted);
}

.translate-btn {
  background: var(--accent);
  border: none;
  color: var(--bg-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
}
.translate-btn:hover {
  opacity: 0.85;
}
.translate-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.translate-spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.translate-status {
  display: none;
  font-size: 0.8rem;
  color: #64ffda;
  margin-top: 12px;
}

.hero-name {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-role {
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 500;
}

.hero-location {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-summary {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: min(600px, 100%);
  line-height: 1.7;
}

/* ==========================================================================
   Contact Bar
   ========================================================================== */
.contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
}

.contact-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.contact-link:hover {
  color: var(--accent);
  opacity: 1;
}

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

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-chip {
  background-color: var(--bg-chip);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all 0.2s;
  cursor: default;
}
.skill-chip:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   Experience Timeline
   ========================================================================== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.timeline-item {
  background-color: var(--bg-card);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.timeline-item:hover {
  border-color: #475569;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.timeline-company {
  font-size: 1.2rem;
  font-weight: 600;
}

.timeline-role {
  font-size: 1rem;
  color: var(--accent);
}

.timeline-period {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-achievements {
  list-style: disc;
  padding-left: 20px;
}

.timeline-achievements li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 6px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Education
   ========================================================================== */
.education-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.education-card {
  background-color: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.education-degree {
  font-size: 1rem;
  font-weight: 600;
}

.education-school {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.education-year {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Infrastructure at Scale
   ========================================================================== */
.infra-subtitle {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s;
}
.metric-card:hover {
  border-color: var(--accent);
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.services-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.service-group {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.service-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* ==========================================================================
   Certifications
   ========================================================================== */
.cert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cert-item {
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 4px 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ==========================================================================
   Responsive: Tablet
   ========================================================================== */
@media screen and (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 24px;
    padding: 40px 0;
  }
  .hero-info {
    align-items: center;
  }
  .hero-top-row {
    flex-direction: column;
    gap: 12px;
  }
  .lang-controls {
    flex-direction: column;
    gap: 8px;
  }
  .hero-summary {
    text-align: center;
  }
  .contact-bar {
    justify-content: center;
  }
  .hero-photo {
    width: 130px;
    height: 130px;
  }
  .hero-name {
    font-size: 2rem;
  }
  .timeline-header {
    flex-direction: column;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Responsive: Mobile
   ========================================================================== */
@media screen and (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  .hero-name {
    font-size: 1.6rem;
  }
  .hero-photo {
    width: 110px;
    height: 110px;
  }
  .section {
    padding: 32px 0;
  }
  .section-title {
    font-size: 1.25rem;
  }
  .education-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .services-grid {
    grid-template-columns: 1fr;
  }
  .metric-value {
    font-size: 1.5rem;
  }
}
