:root {
  font-family: Inter, sans-serif;
  font-feature-settings: 'liga' 1, 'calt' 1;
  --navy-950: #081a31;
  --navy-900: #0e2440;
  --navy-800: #122e52;
  --navy-700: #1a3a6b;
  --navy-500: #2e5ea8;
  --navy-100: #e7edf6;
  --text: #2d3748;
  --muted: #68778d;
  --bg: #fff;
  --bg-alt: #f7f9fc;
  --border: #e3e9f2;
  --elevation-1: 0 1px 2px rgba(8,26,49,.12), 0 2px 6px rgba(8,26,49,.08);
  --elevation-2: 0 4px 8px rgba(8,26,49,.14), 0 8px 18px rgba(8,26,49,.10);
}

@supports (font-variation-settings: normal) {
  :root { font-family: InterVariable, sans-serif; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding-top: 76px; color: var(--text); background: var(--bg);
  font-family: inherit;
  line-height: 1.7; font-size: 16px;
}
a { color: var(--navy-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--navy-500); text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 3px solid rgba(46,94,168,.4); outline-offset: 3px; }
.page-content { max-width: 1140px; padding: 2.8rem 1.5rem 1rem; min-height: calc(100vh - 150px); }
.text-navy { color: var(--navy-700) !important; }
.text-muted { color: var(--muted) !important; }

/* al-folio masthead */
.site-nav { background: rgba(255,255,255,.94); border-bottom: 1px solid var(--border); box-shadow: 0 3px 16px rgba(14,36,64,.05); backdrop-filter: blur(10px); }
.site-nav .container { min-height: 76px; }
.navbar-brand { display: flex; align-items: center; gap: .55rem; color: var(--navy-900); font-size: 1.08rem; font-weight: 650; letter-spacing: -.01em; }
.navbar-brand:hover { color: var(--navy-700); }
.brand-mark { color: var(--navy-500); font-size: 1.15rem; line-height: 1; }
.site-nav .nav-link { color: var(--navy-900); padding: .6rem .85rem; font-size: .92rem; border-bottom: 2px solid transparent; }
.site-nav .nav-link:hover, .site-nav .nav-link.active { color: var(--navy-700); border-bottom-color: var(--navy-700); }
.navbar-toggler { color: var(--navy-900); border: 1px solid var(--border); padding: .35rem .55rem; }
.navbar-toggler-icon { width: auto; height: auto; background: none; }

/* about */
.profile { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(230px, 1fr); gap: 4rem; align-items: start; margin-bottom: 3.2rem; }
.profile h1 { margin: 0 0 .3rem; color: var(--navy-900); font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.15; font-weight: 400; letter-spacing: -.035em; }
.profile h1 strong { font-weight: 700; }
.profile .subtitle { margin: 0 0 1.25rem; color: var(--muted); font-size: 1.08rem; }
.profile .bio { font-size: 1.03rem; max-width: 670px; }
.profile .bio p { margin: 0 0 1rem; }
.profile-aside { text-align: center; }
.profile-img { width: min(245px, 100%); object-fit: cover; border: 0px solid var(--navy-100); box-shadow: 0 12px 30px rgba(14,36,64,.12); }
.profile-img.circular { border-radius: 50%; }
.profile-more-info { margin-top: 1rem; white-space: pre-line; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.social-icons { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 1.6rem; }
.social-icons a.social-icon { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: #fff; color: var(--navy-700); }
.social-icons a.social-icon:hover { color: #fff; background: var(--navy-700); border-color: var(--navy-700); }
.section-title { display: flex; align-items: center; gap: .8rem; color: var(--navy-900); font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; margin: 0 0 .8rem; }
.section-title::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.home-section { margin-bottom: 2.5rem; }
.news-list, .post-list { list-style: none; padding: 0; margin: 0; }
.news-item, .post-item { padding: .42rem 0; border-bottom: 1px solid var(--border); }
.news-item { display: grid; grid-template-columns: 7.3rem minmax(0, 1fr); gap: .4rem; align-items: baseline; }
.news-item > span:last-child p { display: inline; margin: 0; }
.news-item:last-child, .post-item:last-child { border-bottom: 0; }
.news-date, .post-date { display: inline-block; min-width: 7.3rem; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.scroll-box { max-height: 245px; overflow-y: auto; padding-right: 1rem; scrollbar-color: var(--navy-100) transparent; }
.pub-card { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; padding: 1.1rem; margin: .35rem 0; border: 1px solid transparent; border-radius: .35rem; transition: border-color .18s ease, box-shadow .18s ease; }
.pub-card > div { min-width: 0; }
.pub-card:hover { border-color: var(--border); box-shadow: var(--elevation-1); }
.pub-card:last-child { border-bottom: 0; }
.pub-preview { width: 130px; height: 92px; object-fit: cover; border-radius: .3rem; background: var(--navy-100); }
.pub-title { color: var(--navy-900); font-size: 1.05rem; font-weight: 650; line-height: 1.4; }
.artifact-badge { width: 24px; height: 24px; margin-left: .35rem; vertical-align: -.35rem; object-fit: contain; }
.pub-authors { color: #536174; font-size: .94rem; margin-top: .25rem; }
.pub-venue { font-size: .88rem; margin-top: .25rem; }
.pub-links a { margin-right: .75rem; font-size: .84rem; font-weight: 600; }
.pub-links .collapse { min-width: 0; max-width: 100%; }
.pub-links .collapse pre {
  max-width: 100%;
  margin: .65rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
}
.badge-navy { background: var(--navy-700); color: #fff; font-weight: 500; }
.badge-outline { border: 1px solid #c9d5e6; background: #fff; color: var(--navy-700); font-weight: 500; }
.badge-outline:hover { border-color: var(--navy-500); background: var(--navy-100); }

/* blog */
.page-header { margin-bottom: 1.8rem; }
.page-header h1 { color: var(--navy-900); font-size: 2.5rem; font-weight: 700; letter-spacing: -.03em; }
.tag-pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag-pills .badge, .post-tags .badge { padding: .4rem .65rem; border-radius: 999px; }
.blog-year-section { margin-bottom: 1.8rem; }
.blog-year { font-size: 1.25rem; }
.post-title-link { font-weight: 600; }
.post-excerpt { margin-left: 7.3rem; color: var(--muted); font-size: .9rem; }
.post-detail { max-width: 820px; margin: 0 auto; }
.post-title { color: var(--navy-900); font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.25; }
.post-content { font-size: 1.04rem; }
.post-content h2, .post-content h3 { color: var(--navy-900); margin-top: 2rem; }
.post-content img { max-width: 100%; height: auto; border-radius: .35rem; }

/* cv and friends */
.btn-navy { display: inline-flex; align-items: center; gap: .4rem; border: 0; border-radius: .3rem; padding: .6rem 1rem; background: var(--navy-700); color: #fff; font-weight: 600; box-shadow: var(--elevation-1); transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
.btn-navy:hover { background: var(--navy-900); color: #fff; box-shadow: var(--elevation-2); transform: translateY(-1px); }
.cv-section { margin-bottom: 3rem; }
.cv-timeline { border-left: 2px solid var(--navy-100); margin: 0 0 0 .5rem; }
.cv-entry { position: relative; padding: 0 0 2rem 1.7rem; }
.cv-entry-with-image { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 34%); gap: 1.5rem; align-items: stretch; }
.cv-entry-text { min-width: 0; }
.cv-entry-image { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; max-height: 180px; overflow: hidden; align-self: start; display: flex; align-items: center; justify-content: center; border-radius: .35rem; background: var(--navy-100); }
.cv-entry-image img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.cv-entry::before { content: ""; position: absolute; left: -7px; top: .45rem; width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--navy-500); box-shadow: 0 0 0 2px var(--navy-500); }
.cv-entry-meta { font-size: .85rem; color: var(--navy-500) !important; font-weight: 600; }
.cv-entry-title { color: var(--navy-900); font-size: 1.08rem; }
.cv-entry-subtitle { color: #536174; }
.cv-entry-location { font-size: .88rem; }
.cv-entry-summary { margin-top: .5rem; }
.cv-entry-highlights { padding-left: 1.2rem; color: #536174; }
.friend-card { height: 100%; padding: 1.5rem 1rem; text-align: center; border: 1px solid var(--border); border-radius: .45rem; background: #fff; box-shadow: var(--elevation-1); transition: transform .18s ease, box-shadow .18s ease; }
.friend-card:hover { transform: translateY(-3px); box-shadow: var(--elevation-2); }
.friend-avatar, .friend-avatar-placeholder { width: 96px; height: 96px; margin: 0 auto .8rem; border-radius: 50%; object-fit: cover; }
.friend-avatar-placeholder { display: flex; align-items: center; justify-content: center; background: var(--navy-100); color: var(--navy-500); font-size: 2rem; }
.friend-name { font-weight: 650; color: var(--navy-900); }
.friend-description { margin-top: .3rem; font-size: .9rem; }

/* markdown and footer */
pre, .post-content pre { overflow-x: auto; padding: 1rem 1.15rem; border-radius: .35rem; background: var(--navy-950); color: #e7edf6; }
.post-content :not(pre) > code { padding: .15rem .35rem; border-radius: .2rem; background: var(--navy-100); color: var(--navy-900); }
blockquote { border-left: 4px solid var(--navy-500); margin: 1.5rem 0; padding: .3rem 1rem; color: var(--muted); }
.post-content table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: .5rem .7rem; }
.site-footer { margin-top: 3rem; padding: 1.6rem 0; border-top: 1px solid var(--border); background: var(--bg-alt); color: var(--muted); font-size: .85rem; }
.error-page { padding: 5rem 1rem; }

@media (max-width: 767.98px) {
  body { padding-top: 66px; }
  .page-content { padding-top: 2.3rem; }
  .site-nav .container { min-height: 66px; }
  .site-nav .nav-link { border-bottom: 0; padding: .65rem 0; }
  .profile { display: flex; flex-direction: column-reverse; gap: 1.5rem; margin-bottom: 3rem; }
  .profile-aside { width: 100%; }
  .profile-img { width: 190px; }
  .pub-card { grid-template-columns: 1fr; }
  .pub-preview { width: 100%; height: 150px; }
  .cv-entry-with-image { grid-template-columns: 1fr; gap: .8rem; }
  .cv-entry-image { max-width: 100%; max-height: 180px; }
  .post-excerpt { margin-left: 0; }
  .news-date, .post-date { min-width: 6.5rem; }
  .news-item { grid-template-columns: 6.5rem minmax(0, 1fr); }
}
