:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f8;
  --text: #1a1a1a;
  --text-muted: #5a5a5f;
  --border: #e4e4e7;
  --accent: #2f6feb;
  --accent-text: #ffffff;
  --radius: 8px;
  --max-width: 880px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --bg-alt: #191919;
  --text: #eaeaea;
  --text-muted: #a0a0a5;
  --border: #2a2a2d;
  --accent: #5b9dff;
  --accent-text: #0b0b0b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --bg-alt: #191919;
    --text: #eaeaea;
    --text-muted: #a0a0a5;
    --border: #2a2a2d;
    --accent: #5b9dff;
    --accent-text: #0b0b0b;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* Hero */
.hero {
  padding: 96px 0 72px;
}

.mode-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 24px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.mode-btn:hover {
  color: var(--text);
}
.mode-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}
.hero-lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 0 32px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.hero-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-alt); }

/* Sections */
.section {
  padding: 72px 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section-title {
  font-size: 1.6rem;
  margin: 0 0 40px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  letter-spacing: -0.01em;
}
.section-num {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.about-grid p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 720px;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.timeline-item {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.timeline-header h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.timeline-org {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.timeline-teams {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}
.timeline-date {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeline-item ul {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.timeline-item li { margin-bottom: 6px; }
.timeline-tags {
  margin: 0;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

body[data-mode="ios"] .timeline-item[data-emphasis="ios-primary"] {
  border-top-color: var(--accent);
  border-top-width: 2px;
}
body[data-mode="ios"] .timeline-item[data-emphasis="ios-secondary"] {
  opacity: 0.7;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.project-card-featured {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
}
.project-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
}
.project-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.project-card p:not(.project-tag):not(.project-tags) {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex-grow: 1;
  margin: 0 0 14px;
}
.project-tags {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.project-link {
  font-size: 0.88rem;
  font-weight: 600;
}
.ai-assistant-note {
  margin-top: 32px;
  padding: 16px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.opensource-note {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}
.opensource-note strong {
  color: var(--text);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
}
.skill-group h3 {
  font-size: 0.9rem;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.skill-group p {
  margin: 0;
  font-size: 0.95rem;
}

.skill-group[data-skill="ios"] { display: none; }
body[data-mode="general"] .skill-group[data-skill="languages"] { order: 1; }
body[data-mode="general"] .skill-group[data-skill="data"] { order: 2; }
body[data-mode="general"] .skill-group[data-skill="cloud"] { order: 3; }
body[data-mode="general"] .skill-group[data-skill="genai"] { order: 4; }
body[data-mode="general"] .skill-group[data-skill="practices"] { order: 5; }

body[data-mode="ios"] .skill-group[data-skill="ios"] { display: block; order: 1; }
body[data-mode="ios"] .skill-group[data-skill="languages"] { order: 2; }
body[data-mode="ios"] .skill-group[data-skill="cloud"] { order: 3; }
body[data-mode="ios"] .skill-group[data-skill="genai"] { order: 4; }
body[data-mode="ios"] .skill-group[data-skill="data"] { order: 5; }
body[data-mode="ios"] .skill-group[data-skill="practices"] { order: 6; }

/* Education */
.edu-block { margin-bottom: 40px; }
.edu-block h3 { margin: 0 0 4px; font-size: 1.1rem; }
.edu-block p { margin: 2px 0; color: var(--text-muted); font-size: 0.92rem; }

.award-list h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.award-list ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.award-list li { margin-bottom: 8px; }

/* Contact */
.contact-lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 0 28px;
}
.contact-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.site-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Mobile */
@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 56px 0; }
}
