/* ============================================
   Self-hosted Fonts
   ============================================ */

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans-italic-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ============================================
   Theme Variables
   ============================================ */

:root,
[data-theme="dark"] {
  --bg: #0e0e0e;
  --bg-subtle: #161616;
  --surface: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --ink: #e8e6e3;
  --ink-secondary: #a09c97;
  --ink-tertiary: #6b6762;
  --accent: #e8e6e3;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --max-w: 860px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="light"] {
  --bg: #f5f3ef;
  --bg-subtle: #eae7e1;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --ink: #1a1917;
  --ink-secondary: #5c5a55;
  --ink-tertiary: #8a877f;
  --accent: #1a1917;
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink-secondary);
  outline-offset: 3px;
  border-radius: 2px;
}

ul {
  list-style: none;
}

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

/* ============================================
   Layout
   ============================================ */

.site {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* ============================================
   Nav
   ============================================ */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  gap: 16px;
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

.nav-links a {
  position: relative;
  transition: color 0.2s var(--ease);
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--ink);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
  flex-shrink: 0;
}

.nav-burger:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.nav-burger svg {
  width: 18px;
  height: 18px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
  flex-shrink: 0;
}

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

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ============================================
   Hero
   ============================================ */

.hero {
  padding: 80px 0 100px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.hero.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-greeting {
  font-size: 0.95rem;
  color: var(--ink-tertiary);
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.hero-name {
  font-family: var(--sans);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero-name em {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--ink-secondary);
  max-width: 520px;
  line-height: 1.7;
}

.hero-currently {
  font-size: 0.9rem;
  color: var(--ink-tertiary);
  margin-top: 20px;
  line-height: 1.6;
}

.hero-currently strong {
  color: var(--ink-secondary);
  font-weight: 500;
}

.hero-links {
  display: flex;
  gap: 24px;
  margin-top: 32px;
}

.hero-aside {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-tertiary);
  flex-shrink: 0;
  padding-top: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================
   Link Arrow
   ============================================ */

.link-arrow {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s var(--ease);
}

.link-arrow::after {
  content: "\2197";
  font-size: 0.85em;
  transition: transform 0.2s var(--ease);
}

.link-arrow:hover {
  color: var(--ink);
}

.link-arrow:hover::after {
  transform: translate(2px, -2px);
}

/* ============================================
   Sections
   ============================================ */

.section {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-tertiary);
  padding-top: 4px;
  font-weight: 500;
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ============================================
   About / Skills
   ============================================ */

.text-large {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  line-height: 1.75;
}

.text-large strong {
  color: var(--ink);
  font-weight: 500;
}

.skills-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 28px 32px;
}

.skill-col h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-tertiary);
  font-weight: 500;
  margin-bottom: 10px;
  font-family: var(--sans);
}

.skill-col ul {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.skill-col li {
  font-size: 0.95rem;
  color: var(--ink-secondary);
}

/* ============================================
   Work / Jobs
   ============================================ */

.job {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job + .job {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.job-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.job-top h2 {
  font-size: 1.1rem;
  font-weight: 500;
  font-family: var(--sans);
  letter-spacing: -0.01em;
}

.job-type {
  font-size: 0.88rem;
  color: var(--ink-tertiary);
  margin-top: 2px;
}

.job-top time {
  font-size: 0.88rem;
  color: var(--ink-tertiary);
  flex-shrink: 0;
}

.job p {
  font-size: 0.95rem;
  color: var(--ink-secondary);
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tags span {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--ink-tertiary);
  border: 1px solid var(--border);
  font-weight: 500;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* ============================================
   Education
   ============================================ */

.education-block {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.education-block h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-tertiary);
  font-weight: 500;
  margin-bottom: 8px;
  font-family: var(--sans);
}

.education-block p {
  font-size: 0.95rem;
  color: var(--ink-secondary);
}

.education-block strong {
  color: var(--ink);
  font-weight: 500;
}

.muted {
  color: var(--ink-tertiary);
}

/* ============================================
   Projects
   ============================================ */

.project {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.project:hover {
  border-color: var(--border-strong);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.project-top h2 {
  font-size: 1.1rem;
  font-weight: 500;
  font-family: var(--sans);
}

.project-status {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--ink-tertiary);
  border: 1px solid var(--border);
  font-weight: 500;
}

.project p {
  font-size: 0.95rem;
  color: var(--ink-secondary);
  line-height: 1.7;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  padding: 48px 0 40px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer .muted {
  font-size: 0.82rem;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 680px) {
  .site {
    padding: 0 20px;
  }

  .nav-burger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 20px 20px;
    gap: 14px;
    font-size: 0.95rem;
    z-index: 10;
  }

  .nav-links.open {
    display: flex;
  }

  .nav {
    position: relative;
  }

  .hero {
    flex-direction: column-reverse;
    padding: 48px 0 64px;
    gap: 20px;
  }

  .hero-name {
    font-size: clamp(1.9rem, 7vw, 2.6rem);
  }

  .hero-links {
    flex-wrap: wrap;
    gap: 16px;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 36px 0;
  }

  .section-label {
    padding-top: 0;
  }

  .skills-wrap {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .job-top {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 400px) {
  .skills-wrap {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero,
  .section {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .status-dot {
    animation: none;
  }

  .nav-links a::after,
  .link-arrow::after,
  .theme-toggle,
  .button,
  .tags span,
  .project {
    transition: none;
  }
}
