:root {
  --bg: #f6f8f6;
  --fg: #111513;
  --muted: #5f6b65;
  --surface: #ffffff;
  --surface-soft: #edf2ef;
  --border: #dce5df;
  --link: #0f766e;
  --accent: #0f766e;
  --accent-warm: #9a4f12;
  --accent-red: #a7353b;
  --shadow: 0 18px 50px rgba(17, 21, 19, 0.08);
  --max: 1040px;
  --content: 720px;
}

html[data-theme="dark"] {
  --bg: #101312;
  --fg: #e8eee9;
  --muted: #9aa8a1;
  --surface: #171d1a;
  --surface-soft: #121815;
  --border: #2d3833;
  --link: #7dd6cb;
  --accent: #39b8a7;
  --accent-warm: #d17a28;
  --accent-red: #d85f63;
  --shadow: none;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding-top: 18px;
  padding-bottom: 18px;
}

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

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

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

.theme-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.95rem;
  height: 34px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 34px;
}

.home-hero {
  background-color: #0c100e;
  background-image:
    linear-gradient(90deg, rgba(7, 10, 9, 0.94), rgba(7, 10, 9, 0.78) 50%, rgba(7, 10, 9, 0.34)),
    url("/assets/images/infra-board.png");
  background-position: center;
  background-size: cover;
  color: #f2faf6;
  padding: 78px 0 58px;
}

.hero-content {
  max-width: var(--max);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.home-hero .eyebrow {
  color: #7dd6cb;
}

.home-hero h1 {
  font-size: 3.2rem;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
  max-width: 780px;
}

.lead {
  color: var(--muted);
  margin: 0;
}

.home-hero .lead {
  color: #c3d2cc;
  font-size: 1.12rem;
  margin-top: 18px;
  max-width: 690px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.action-link {
  border-radius: 6px;
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  padding: 13px 16px;
  text-decoration: none;
}

.action-primary {
  background: #f2faf6;
  color: #101312;
}

.action-secondary {
  border: 1px solid rgba(242, 250, 246, 0.42);
  color: #f2faf6;
}

.hero-facts {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 42px 0 0;
  max-width: 920px;
}

.hero-facts div {
  background: rgba(12, 18, 16, 0.74);
  border: 1px solid rgba(221, 238, 230, 0.17);
  border-radius: 8px;
  padding: 15px 16px;
}

.hero-facts dt {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
}

.hero-facts dd {
  color: #aebeb7;
  font-size: 0.9rem;
  margin: 2px 0 0;
}

.home-section {
  padding: 54px 0;
}

.posts-section {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 1.65rem;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.project-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-slider {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.project-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: project-scroll 28s linear infinite;
}

.project-slider:hover .project-track {
  animation-play-state: paused;
}

.project-track .project-card {
  width: 300px;
  flex: 0 0 auto;
}

@keyframes project-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .project-track {
    animation: none;
  }
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 190px;
  padding: 18px;
  text-decoration: none;
}

.project-card:hover strong,
.post-link:hover .post-title {
  text-decoration: underline;
}

.project-kicker {
  color: var(--accent-warm);
  font-size: 0.8rem;
  font-weight: 800;
}

.project-card strong {
  color: var(--fg);
  font-size: 1.2rem;
  line-height: 1.2;
}

.project-card span:last-child {
  color: var(--muted);
  font-size: 0.95rem;
}

.post-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.post-link {
  color: var(--fg);
  display: block;
  padding: 18px;
  text-decoration: none;
}

.post-date {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.post-title {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
}

.post-excerpt {
  color: var(--muted);
  display: block;
  font-size: 0.95rem;
  margin-top: 4px;
}

.prose {
  max-width: var(--content);
  padding: 52px 0 68px;
}

.prose h1 {
  font-size: 2.35rem;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0 0 14px;
}

.prose .post-meta,
.page-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 32px;
}

.prose h2 {
  border-top: 1px solid var(--border);
  font-size: 1.22rem;
  letter-spacing: 0;
  margin: 38px 0 12px;
  padding-top: 24px;
}

.prose p {
  margin: 0 0 18px;
}

.prose a {
  color: var(--link);
  font-weight: 700;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li {
  margin-bottom: 8px;
}

.compact-list {
  margin-top: -4px;
}

.cv-container {
  max-width: 1120px;
}

.cv-hero-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  margin: 44px 0 22px;
  padding: 28px;
}

.cv-hero-panel h1 {
  font-size: 2.8rem;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0 0 14px;
}

.cv-hero-panel p {
  color: var(--muted);
  font-size: 1.04rem;
  margin: 0;
  max-width: 680px;
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.cv-actions .action-primary {
  background: var(--fg);
  color: var(--bg);
}

.cv-actions .action-secondary {
  border-color: var(--border);
  color: var(--fg);
}

.cv-stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.cv-stats div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.cv-stats dt {
  color: var(--fg);
  font-weight: 800;
}

.cv-stats dd {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 2px 0 0;
}

.resume-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 320px minmax(0, 1fr);
  margin: 0 0 44px;
}

.resume-sidebar,
.resume-main,
.pdf-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.resume-sidebar {
  align-self: start;
  display: grid;
  gap: 24px;
  padding: 22px;
}

.resume-sidebar h2,
.resume-section h2,
.pdf-section h2 {
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0 0 12px;
}

.skill-cloud,
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-cloud li {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  padding: 8px 10px;
}

.plain-list li {
  color: var(--muted);
  font-size: 0.94rem;
  margin-bottom: 7px;
}

.plain-list a {
  color: var(--link);
  font-weight: 700;
}

.resume-main {
  padding: 24px 26px;
}

.resume-section + .resume-section {
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding-top: 26px;
}

.timeline-item h3 {
  font-size: 1.16rem;
  line-height: 1.25;
  margin: 0 0 12px;
}

.timeline-meta {
  color: var(--accent-warm);
  font-size: 0.86rem;
  font-weight: 800;
  margin-bottom: 7px;
}

.timeline-item ul {
  color: var(--muted);
  margin: 0;
  padding-left: 20px;
}

.timeline-item li {
  margin-bottom: 8px;
}

.resume-projects {
  display: grid;
  gap: 10px;
}

.resume-projects a {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  display: block;
  padding: 14px 16px;
  text-decoration: none;
}

.resume-projects a:hover span {
  text-decoration: underline;
}

.resume-projects span {
  color: var(--fg);
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.pdf-section {
  margin-bottom: 64px;
  padding: 24px;
}

.pdf-section .section-heading {
  margin-bottom: 16px;
}

.cv-embed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  height: min(78vh, 880px);
  min-height: 620px;
  overflow: hidden;
}

.cv-embed iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.prose pre {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  overflow-x: auto;
  padding: 14px 16px;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.prose blockquote {
  border-left: 3px solid var(--border);
  color: var(--muted);
  margin: 0 0 18px;
  padding-left: 16px;
}

.back-link {
  color: var(--muted);
  display: inline-block;
  font-size: 0.9rem;
  margin-top: 24px;
  text-decoration: none;
}

.back-link:hover {
  color: var(--fg);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 0;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 780px) {
  .home-hero {
    background-position: 58% center;
    padding: 56px 0 42px;
  }

  .home-hero h1 {
    font-size: 2.3rem;
  }

  .hero-facts,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .cv-hero-panel,
  .resume-layout {
    grid-template-columns: 1fr;
  }

  .cv-hero-panel {
    margin-top: 28px;
    padding: 22px;
  }

  .cv-hero-panel h1 {
    font-size: 2.25rem;
  }

  .home-section {
    padding: 42px 0;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 18px;
  }

  .header-inner {
    align-items: flex-start;
  }

  .nav {
    justify-content: flex-start;
    width: 100%;
  }

  .home-hero h1,
  .prose h1 {
    font-size: 2rem;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-link {
    justify-content: center;
  }

  .cv-actions {
    flex-direction: column;
  }

  .resume-main,
  .resume-sidebar,
  .pdf-section {
    padding: 18px;
  }

  .cv-embed {
    height: 560px;
    min-height: 0;
  }
}
