/* Site styles: flat, minimal, single reading column, light & dark. No framework. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --logo-bg: #ffffff;
  --width: 760px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark theme: opt-in through the toggle in the navbar (light by default) */
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --text: #e6e8eb;
  --muted: #9aa1ab;
  --border: #262a33;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.12);
  color-scheme: dark;
}

/* ---------- Minimal reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, h5 { margin: 0 0 0.5rem; font-weight: 500; line-height: 1.2; }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.75rem; } h4 { font-size: 1.5rem; } h5 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
ul, ol, dl { margin: 0 0 1rem; }
ul ul, ol ol, ul ol, ol ul { margin-bottom: 0; }
b, strong { font-weight: bolder; }
img { max-width: 100%; vertical-align: middle; }
iframe { border: 0; }
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
[hidden] { display: none !important; }

/* Inline SVG icons (same box as Font Awesome's fixed-width icons) */
.icon { display: inline-block; width: 1.25em; height: 1em; vertical-align: -0.125em; fill: currentColor; overflow: visible; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* keep the footer at the bottom on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4, h5 { font-family: var(--font); color: var(--text); }

/* Links: same colour as the text, with a discreet underline that darkens on hover */
a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--text) 30%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
a:hover, a:focus { color: var(--text); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
#mainNav a, .btn-cv, .icon-link { text-decoration: none; }

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

/* ---------- Navigation ---------- */

#mainNav {
  position: sticky;
  top: 0;
  z-index: 1030;
  padding: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
#mainNav .wrap { display: flex; flex-wrap: wrap; align-items: center; min-height: 56px; }
#mainNav .navbar-brand { font-weight: 600; font-size: 0.95rem; color: var(--text); margin-right: auto; white-space: nowrap; }
.nav-links { display: flex; list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.5rem 0.65rem;
}
.nav-link:hover, .nav-link.active { color: var(--text); text-decoration: none; }
.nav-links li:last-child .nav-link { padding-right: 0; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.theme-toggle, .nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
}
.theme-toggle { margin-left: 8px; }
.theme-toggle:hover, .theme-toggle:focus-visible,
.nav-toggle:hover, .nav-toggle:focus-visible { color: var(--text); background: var(--bg-soft); }
.theme-toggle:focus, .nav-toggle:focus { outline: none; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.nav-toggle { display: none; color: var(--text); font-size: 1.1rem; margin-right: -8px; }
@media (max-width: 991px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { order: 3; flex-basis: 100%; flex-direction: column; display: none; padding-bottom: 0.75rem; }
  #mainNav.open .nav-links { display: flex; }
  .nav-link { padding: 0.4rem 0; }
}

/* ---------- Hero ---------- */

.hero { padding: 72px 0 8px; }
.hero-top { display: flex; align-items: center; gap: 24px; }
.hero-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.hero h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.hero-role { color: var(--muted); margin: 4px 0 0; font-size: 1.05rem; }
.hero-tagline { font-size: 1.15rem; margin: 28px 0 0; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }

.btn-cv {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  font-size: 0.875rem; font-weight: 500;
  color: var(--bg); background: var(--text);
  border-radius: 8px;
}
.btn-cv .icon { width: 1em; }
.btn-cv:hover, .btn-cv:focus { color: var(--bg); text-decoration: none; opacity: 0.85; }

.icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted);
}
.icon-link:hover, .icon-link:focus { color: var(--text); border-color: var(--muted); text-decoration: none; }

@media (max-width: 575px) {
  .hero { padding-top: 48px; }
  .hero-top { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero h1 { font-size: 1.7rem; }
}

/* ---------- Sections ---------- */

.section { padding: 56px 0 0; }
.section > .wrap { position: relative; padding-top: 40px; }
.section > .wrap::before,
.site-footer .wrap::before {
  content: ''; position: absolute; top: 0; left: 24px; right: 24px;
  border-top: 1px solid var(--border);
}
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 24px;
}
.section p { margin: 0 0 1em; }

/* TL;DR */
.tldr { list-style: none; padding: 0; margin: 0; }
.tldr li { position: relative; padding: 4px 0 4px 20px; }
.tldr li::before {
  content: ''; position: absolute; left: 0; top: calc(4px + 0.6em);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ---------- Timeline (experience & education) ---------- */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding-bottom: 36px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline-image img {
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--logo-bg);
  object-fit: contain;
}
.timeline-heading h3 { font-size: 1.05rem; font-weight: 600; margin: 0; line-height: 1.4; }
.timeline-heading h4 { font-size: 0.95rem; font-weight: 400; margin: 0; color: var(--text); }
.timeline h5 { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin: 2px 0 0; }
.timeline .company-intro { color: var(--muted); font-size: 0.95rem; margin: 10px 0 0; }
.timeline-body { margin-top: 10px; }

ul.text { padding-left: 1.1em; margin: 0; }
ul.text li { margin: 4px 0; }
ul.text li::marker { color: var(--muted); }
ul.text ul.text { margin: 4px 0; list-style-type: circle; }

/* Several roles in the same company (LinkedIn-style) */
.role-group { list-style: none; padding: 0; margin: 20px 0 0; }
.role-group .role { position: relative; padding: 0 0 20px 22px; }
.role-group .role:last-child { padding-bottom: 0; }
.role-group .role::before {
  content: ''; position: absolute; left: 0; top: 0.5em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.role-group .role:first-child::before { border-color: var(--accent); background: var(--accent); }
.role-group .role:not(:last-child)::after {
  content: ''; position: absolute; left: 4px; top: calc(0.5em + 13px); bottom: 2px;
  width: 1px; background: var(--border);
}
.role-group .role > h4 { font-size: 0.98rem; font-weight: 600; margin: 0; line-height: 1.5; }
.role-group .role > h5 { margin: 0; }

/* ---------- Portfolio ---------- */

.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 640px) { .projects { grid-template-columns: 1fr; } }

.project {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s ease;
}
.project:hover { border-color: var(--muted); }
.project-thumb { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.project-meta { font-size: 0.78rem; color: var(--muted); margin: 0 0 6px; }
.project h3 { font-size: 1rem; font-weight: 600; margin: 0 0 6px; line-height: 1.4; }
.project p { font-size: 0.9rem; color: var(--muted); margin: 0 0 12px; }
.project-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.875rem; font-weight: 500; }
.project-links a::after { content: ' \2192'; }

/* Collapsible course lists (education) */
.courses { margin-top: 8px; }
.courses summary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.875rem; color: var(--muted);
  cursor: pointer; list-style: none; user-select: none;
}
.courses summary::-webkit-details-marker { display: none; }
.courses summary::before {
  content: ''; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
.courses[open] summary::before { transform: rotate(45deg); }
.courses summary:hover { color: var(--text); }
.courses ul.text { margin-top: 6px; font-size: 0.92rem; }
.project.is-hidden { display: none; }

.btn-more {
  display: block; margin: 24px auto 0;
  padding: 7px 16px;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}
.btn-more:hover { border-color: var(--muted); }

/* ---------- Skills & interests ---------- */

.skill-groups { display: grid; grid-template-columns: 140px 1fr; gap: 14px 20px; margin: 0; }
.skill-groups dt { font-weight: 500; font-size: 0.9rem; padding-top: 3px; }
.skill-groups dd { margin: 0; }
@media (max-width: 575px) {
  .skill-groups { grid-template-columns: 1fr; gap: 6px; }
  .skill-groups dd { margin-bottom: 10px; }
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.interests { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.interests h3 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
@media (max-width: 640px) { .interests { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Footer ---------- */

.site-footer { padding: 56px 0 48px; }
.site-footer .wrap {
  position: relative;
  padding-top: 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.site-footer p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.site-footer p a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.socials { display: flex; gap: 8px; }

/* ---------- Modals ---------- */

.portfolio-modal {
  width: min(820px, calc(100% - 32px));
  max-height: calc(100vh - 64px);
  padding: 40px 32px 28px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
}
.portfolio-modal:focus { outline: none; }
.portfolio-modal::backdrop { background: rgba(0, 0, 0, 0.6); }
body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 575px) { .portfolio-modal { padding: 40px 18px 20px; } }
.portfolio-modal h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 20px; }
.portfolio-modal h3 { font-size: 1rem; font-weight: 600; margin: 24px 0 10px; }
.portfolio-modal img, .portfolio-modal iframe { border: 0; border-radius: 10px; max-width: 100%; }
.portfolio-modal .item-details { padding-left: 0; list-style: none; }
.portfolio-modal iframe.video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.close-modal {
  position: absolute; top: 12px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  color: var(--muted); font-size: 1.1rem;
}
.close-modal:hover, .close-modal:focus-visible { background: var(--bg-soft); color: var(--text); }
.close-modal:focus:not(:focus-visible) { outline: none; }

/* ---------- Small screens: give the timeline content the full width ---------- */

@media (max-width: 575px) {
  .timeline > li { display: block; }
  .timeline > li::after { content: ''; display: block; clear: both; }
  .timeline-image { float: left; margin-right: 12px; }
  .timeline-image img { width: 40px; height: 40px; }
  .timeline .company-intro, .timeline-body, .role-group { clear: both; }
  .timeline-heading { min-height: 40px; overflow: hidden; }
  .role-group .role { padding-left: 18px; }
  ul.text { padding-left: 1em; }
}

/* ---------- Posts (list & articles) ---------- */

.page { padding: 64px 0 0; }
.page-title { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin: 0 0 8px; }
.page-meta { color: var(--muted); font-size: 0.9rem; margin: 0; }
.page-meta a { color: var(--muted); }
.page-header { padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--border); }

/* List of posts */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1px solid var(--border); }
.post-list li:last-child { border-bottom: 0; }
.post-list .post-date { font-size: 0.85rem; color: var(--muted); margin: 0 0 6px; }
.post-list h2 { font-size: 1.2rem; font-weight: 600; line-height: 1.4; margin: 0 0 8px; }
.post-list h2 a { text-decoration: none; }
.post-list h2 a:hover { text-decoration: underline; }
.post-list p { color: var(--muted); margin: 0; }

/* Article body */
.post-body { font-size: 1.05rem; line-height: 1.75; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body pre { margin: 0 0 1.25em; }
.post-body h1, .post-body h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 2em 0 0.6em; line-height: 1.3; }
.post-body h3 { font-size: 1.15rem; font-weight: 600; margin: 1.75em 0 0.5em; }
.post-body h4 { font-size: 1rem; font-weight: 600; margin: 1.5em 0 0.5em; }
.post-body > :first-child { margin-top: 0; }
.post-body li { margin: 0.3em 0; }
.post-body img { display: block; max-width: 100%; height: auto; margin: 0.5em auto; border-radius: 10px; }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.post-body blockquote { border-left: 3px solid var(--border); padding: 0.1em 0 0.1em 1.1em; color: var(--muted); }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code {
  font-size: 0.86em;
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}
.post-body pre {
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  overflow-x: auto;
  color: var(--text);
}
.post-body pre code, .post-body pre code.hljs { padding: 0; border: 0; background: transparent; font-size: inherit; }
.post-body table { width: 100%; border-collapse: collapse; margin: 0 0 1.25em; font-size: 0.95rem; }
.post-body th, .post-body td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; }
@media (max-width: 575px) {
  .page { padding-top: 40px; }
  .page-title { font-size: 1.6rem; }
  .post-body { font-size: 1rem; }
}
