@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&family=Catamaran:wght@800&display=swap");

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #555;
  --color-border: #e0e0e0;
  --color-card-bg: #ffffff;
  --color-card-hover: #f8f9fa;
  --color-link: #0969da;
  --color-navbar-bg: #ffffff;
  --color-navbar-border: #e0e0e0;
  --max-width: 910px;
  --article-max-width: 720px;
}

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

html {
  font-family:
    "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Site wrapper */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header */
.site-header {
  padding: 2rem 0 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.header-logo {
  display: block;
  margin-bottom: 0.75rem;
}

.header-logo img {
  width: 100%;
  max-width: 910px;
  height: auto;
}

.header-nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
}

.header-nav a {
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

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

/* Main content */
.main-content {
  padding: 0 0 2rem;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* Blog Card */
.blog-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.2s, transform 0.2s;
}

.blog-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.blog-card-image {
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: #f0f0f0;
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card-body {
  padding: 1rem;
}

.blog-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.blog-card-description {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Article Content */
.article-content {
  max-width: var(--article-max-width);
  margin: 0 auto;
}

.article-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.article-meta {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

/* Markdown Body */
.markdown-body {
  font-size: 1rem;
  line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.markdown-body h2 {
  font-size: 1.5rem;
}

.markdown-body h3 {
  font-size: 1.25rem;
}

.markdown-body p {
  margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
  margin-bottom: 1em;
}

.markdown-body li {
  margin-bottom: 0.25em;
}

.markdown-body a {
  color: var(--color-link);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body h1 a.anchor,
.markdown-body h2 a.anchor,
.markdown-body h3 a.anchor,
.markdown-body h4 a.anchor,
.markdown-body h5 a.anchor,
.markdown-body h6 a.anchor {
  display: none;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1em 0;
}

.markdown-body pre {
  background: #f6f8fa;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1em;
}

.markdown-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.875em;
}

.markdown-body :not(pre) > code {
  background: #f0f0f0;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.markdown-body blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1em;
  margin-left: 0;
  margin-bottom: 1em;
  color: var(--color-text-secondary);
}

.markdown-body iframe {
  width: 100%;
  min-height: 400px;
  border: none;
  margin: 1em 0;
  border-radius: 4px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--color-border);
  padding: 0.5rem;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2em 0;
}

/* Mermaid diagrams */
.mermaid {
  text-align: center;
  margin: 1.5em 0;
}

.mermaid svg {
  max-width: 100%;
}

/* Open Graph link cards */
.markdown-body a.link-card {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  margin: 1.5em 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-card-bg);
  color: var(--color-text);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.markdown-body a.link-card:hover {
  background: var(--color-card-hover);
  border-color: var(--color-link);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.link-card-image {
  flex: 0 0 33%;
  max-width: 200px;
  min-height: 130px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-right: 1px solid var(--color-border);
}

.link-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  min-width: 0;
  padding: 0.85em 1em;
}

.link-card-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--color-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.link-card-description {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.link-card-site {
  margin-top: auto;
  padding-top: 0.2em;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

@media (max-width: 600px) {
  .markdown-body a.link-card {
    flex-direction: column;
  }

  .link-card-image {
    flex-basis: 160px;
    max-width: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
}

/* 404 Page */
.not-found {
  text-align: center;
  padding: 4rem 2rem;
}

.not-found h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.not-found a {
  color: var(--color-link);
  text-decoration: none;
}

/* Hide site header on CV page */
.site-wrapper:has(.cv) .site-header {
  display: none;
}

/* CV Page */
.cv {
  max-width: var(--max-width);
  margin: 0 auto;
}

.cv-banner {
  background: rgba(12, 12, 10, 0.8);
  color: #fff;
  padding: 0.6rem 0.6rem 0.3rem 0.6rem;
  border: 5px solid rgba(12, 12, 10, 0.8);
  border-radius: 5px 5px 0 0;
  border-bottom: none;
}

.cv-banner h1 {
  font-family: "Catamaran", sans-serif;
  font-weight: 800;
  font-size: 4em;
  line-height: 1;
  text-transform: uppercase;
  margin: 0;
}

.cv-banner p {
  text-transform: uppercase;
  font-size: 1.2rem;
  margin: 0;
  letter-spacing: 0.1em;
  padding-left: 0.2rem;
}

.cv-meta {
  display: flex;
  border: 5px solid rgba(12, 12, 10, 0.8);
  border-top: none;
  border-radius: 0 0 5px 5px;
  margin-bottom: 2.5rem;
  align-items: stretch;
}

.cv-face {
  background: rgb(131, 131, 131);
  flex-shrink: 0;
  width: 250px;
  min-width: 250px;
}

.cv-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv-details {
  padding: 0.5rem 1rem;
}

.cv-details p {
  font-size: 1.1rem;
  margin: 0.5rem 0;
  line-height: 1.5;
}

.cv-details ul {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
  font-size: 1rem;
}

.cv-details li::before {
  content: "\2219\20";
  margin-left: 0;
}

.cv-details a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #a3ffa0;
  box-shadow: inset 0 -2px 0 #a3ffa0;
  transition: background 0.25s;
}

.cv-details a:hover {
  background-color: #a3ffa0;
}

@media (max-width: 600px) {
  .cv-meta {
    flex-direction: column;
  }

  .cv-face img {
    width: 100%;
    height: auto;
  }

  .cv-banner h1 {
    font-size: 2.5em;
  }

  .cv-banner p {
    font-size: 1rem;
  }
}

.cv-section {
  margin-bottom: 2.5rem;
}

.cv-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}

.cv-entry {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.cv-entry-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.cv-entry-logo img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

.cv-entry-content {
  flex: 1;
  min-width: 0;
}

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.cv-entry-dates {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.cv-entry-org {
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 0.3rem;
}

.cv-entry-org a {
  color: var(--color-link);
  text-decoration: none;
}

.cv-entry-org a:hover {
  text-decoration: underline;
}

.cv-entry-content p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-top: 0.2rem;
}

.cv-list {
  padding-left: 1.5rem;
}

.cv-list li {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.cv-list a {
  color: var(--color-link);
  text-decoration: none;
}

.cv-list a:hover {
  text-decoration: underline;
}

.cv-section > p a {
  color: var(--color-link);
  text-decoration: none;
}

@media (max-width: 600px) {
  .cv-entry-logo {
    width: 36px;
    height: 36px;
  }

  .cv-entry-logo img {
    max-width: 36px;
    max-height: 36px;
  }

  .cv-entry-header {
    flex-direction: column;
    gap: 0;
  }
}

/* Download-PDF button (screen only) */
.cv-download-bar {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0c0c0a;
  background: #a3ffa0;
  border: 2px solid #0c0c0a;
  border-radius: 4px;
  text-decoration: none;
  box-shadow: 2px 2px 0 rgba(12, 12, 10, 0.8);
  transition: transform 0.1s, box-shadow 0.1s;
}

.cv-download:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgba(12, 12, 10, 0.8);
}

.cv-download:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(12, 12, 10, 0.8);
}

.cv-download svg {
  display: block;
}

/* Print / PDF layout. Also used by the build-time PDF renderer
   (scripts/build-cv-pdf.ts), which drives headless Chromium in print mode. */
@media print {
  @page {
    size: Letter;
    margin: 13mm 15mm;
  }

  html,
  body {
    background: #fff;
    /* Preserve the dark banner + logos when printing to PDF. */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .site-header,
  .no-print {
    display: none !important;
  }

  .main-content {
    padding: 0 !important;
  }

  .cv {
    max-width: 100% !important;
    margin: 0 !important;
  }

  .cv-meta {
    margin-bottom: 1.5rem;
  }

  .cv-banner h1 {
    font-size: 2.8em;
  }

  .cv-section {
    margin-bottom: 1.4rem;
  }

  /* Keep headings with their content and avoid splitting entries. */
  .cv-section h2 {
    break-after: avoid;
  }

  .cv-entry,
  .cv-meta,
  .cv-list li {
    break-inside: avoid;
  }

  /* Links stay black in print; the on-screen underlines add noise on paper. */
  a {
    color: inherit;
    text-decoration: none;
    box-shadow: none;
  }

  .cv-details a {
    border-bottom: none;
  }
}
