/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f7;
  --text: #1a1d1d;
  --text-muted: #5a615f;
  --border: #e3e6e5;
  --accent: #e4572e;
  --accent-contrast: #ffffff;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --max-width: 900px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121716;
    --bg-soft: #191f1e;
    --text: #edf1f0;
    --text-muted: #9aa4a1;
    --border: #2a3230;
    --accent: #ff7a52;
    --accent-contrast: #2a120a;
    --card-bg: #171d1c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  }
}

/* Manual override via toggle button */
html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f6f7f7;
  --text: #1a1d1d;
  --text-muted: #5a615f;
  --border: #e3e6e5;
  --accent: #e4572e;
  --accent-contrast: #ffffff;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] {
  --bg: #121716;
  --bg-soft: #191f1e;
  --text: #edf1f0;
  --text-muted: #9aa4a1;
  --border: #2a3230;
  --accent: #ff7a52;
  --accent-contrast: #2a120a;
  --card-bg: #171d1c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 1rem; }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 1.25rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }

p { margin: 0 0 1rem; color: var(--text); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  max-width: 900px;
}

.wordmark {
  font-weight: 650;
  font-size: 1rem;
  color: var(--text);
}

.wordmark:hover {
  text-decoration: none;
  color: var(--accent);
}

.accent {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
  justify-content: center;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  padding: 4.5rem 1.5rem 3rem;
}

.hero p {
  font-size: 1rem;
  color: var(--text);
  max-width: none;
}

.hero-split {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-split .hero-text {
  flex: 1.3;
  min-width: 0;
}

.hero-split .hero-photo {
  flex: 1;
  display: flex;
  justify-content: center;
}

.hero-split .hero-photo img {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 3px solid var(--card-bg);
}

.hero-contact {
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Sections ---------- */
.section {
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border);
}

.section-intro {
  color: var(--text-muted);
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem 1.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-date {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timeline-org {
  color: var(--text-muted);
  font-weight: 550;
  margin: 0 0 0.5rem;
}

/* ---------- Skills / tags ---------- */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.tag-list li {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.project-card p:last-child {
  margin-bottom: 0;
}

.project-card--placeholder {
  border-style: dashed;
  box-shadow: none;
  color: var(--text-muted);
}

.project-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 900px;
}

.footer-note {
  margin: 0;
}

.footer-inner p {
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    gap: 1rem;
    overflow-x: auto;
  }

  .hero {
    padding-top: 3rem;
  }

  .hero-split {
    flex-direction: column-reverse;
    gap: 2rem;
    text-align: center;
  }

  .hero-split .hero-photo img {
    width: 180px;
    height: 180px;
  }
}
