/* =========================================================
   bluenets1 — academic homepage (adamdoupe.com style)
   ========================================================= */
:root {
  --ink: #222222;
  --ink-soft: #444444;
  --ink-dim: #767676;
  --link: #1c50a8;
  --link-hover: #12387a;
  --rule: #cfcfcf;
  --rule-soft: #e2e2e2;
  --paper: #ffffff;
  --news: #fbfbe8;       /* pale-yellow sidebar */
  --news-border: #e6e6c8;
  --serif: "PT Serif", Georgia, "Times New Roman", Times,
    "Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
  --mono: "JetBrains Mono", ui-monospace, "Courier New", monospace;
  --wrap: 1040px;
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }   /* no horizontal page scroll on phones */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  background-color: #efefe9;
  background-image: repeating-linear-gradient(135deg,
    rgba(0, 0, 0, 0.035) 0, rgba(0, 0, 0, 0.035) 1px,
    transparent 1px, transparent 7px);
}

.page {
  max-width: var(--wrap);
  margin: 0 auto;
  background: var(--paper);
  padding: 28px 34px 0;
  min-height: 100vh;
  border-left: 1px solid var(--rule-soft);
  border-right: 1px solid var(--rule-soft);
}

a { color: var(--link); text-decoration: underline; text-underline-offset: 1.5px; }
a:hover { color: var(--link-hover); }
.dim { color: var(--ink-dim); }

/* ---------- masthead ---------- */
.masthead { padding-bottom: 12px; }
.site-name { margin: 0; font-size: clamp(38px, 7vw, 62px); font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; }
.site-name a { color: var(--ink); text-decoration: none; }
.site-name a:hover { color: var(--ink); }
.site-sub { margin: 6px 0 0; font-size: clamp(16px, 2.4vw, 21px); font-weight: 700; color: var(--ink-soft); }

/* ---------- nav bar ---------- */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 7px 0;
}
.nav-left { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.nav-left li + li { border-left: 1px solid var(--rule); }
.nav-left a { display: block; padding: 2px 14px; color: var(--link); text-decoration: none; font-size: 17px; }
.nav-left li:first-child a { padding-left: 0; }
.nav-left a:hover { text-decoration: underline; }
.nav-left a.on { color: var(--ink); font-weight: 700; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-right a { color: var(--ink-dim); display: inline-flex; text-decoration: none; }
.nav-right a:hover { color: var(--ink); }
.nav-right svg { width: 17px; height: 17px; display: block; }
.nav-right .rss { gap: 5px; color: var(--link); font-size: 14px; }
.nav-right .rss svg { width: 14px; height: 14px; color: #e8820a; }
.nav-right .rss:hover { color: var(--link-hover); }

/* ---------- body grid ---------- */
.body-grid { display: block; padding: 24px 0 8px; }
.body-grid.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 40px; }
.sidebar { display: none; }
.body-grid.with-sidebar .sidebar { display: block; }
.main { min-width: 0; }

/* ---------- about ---------- */
.about-head { display: flex; align-items: center; gap: 28px; margin-bottom: 8px; }
.about-head .intro { flex: 1; min-width: 0; margin: 0; }
.avatar {
  flex: none;
  width: 240px; height: 240px;       /* JS resizes this square to match the text height */
  object-fit: cover;                 /* fill it, no distortion */
  object-position: center;
  border: 1px solid #bcbcbc;
  background: #eee;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.bio { margin: 0 0 1em; }
.bio + .bio { margin-top: 1em; }
.roles-inline { color: var(--ink-soft); }

.intro { margin: 2px 0 0; padding-left: 1.3em; }
.intro li { margin: .3em 0; }
.intro li strong { font-weight: 700; }

.h-section { font-size: 26px; font-weight: 700; margin: 1.3em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--rule-soft); clear: both; }

/* ---------- experience timeline ---------- */
.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 30px 62px; }
.timeline > li::before {          /* connector line through the avatars */
  content: ""; position: absolute; left: 21px; top: 44px; bottom: -6px;
  width: 2px; background: var(--rule);
}
.timeline > li:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 0; top: 2px;
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 1px solid #bcbcbc; background: #fff; z-index: 1;
}
.tl-dot.logo-fallback { display: grid; place-items: center; color: var(--ink-soft); font-family: var(--mono); font-weight: 600; font-size: 14px; }
.tl-dot.contain { object-fit: contain; padding: 5px; background: #fff; }
.tl-body { min-width: 0; }
.tl-headline { font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; }
a.tl-headline:hover { color: var(--link); }
.tl-org { color: var(--ink-soft); }
.tl-period { color: var(--ink-dim); font-size: 14px; font-family: var(--mono); }
.tl-loc { color: var(--ink-dim); font-size: 14px; }
.tl-positions { list-style: none; margin: 8px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--rule-soft); }
.tl-positions li { margin: 0 0 8px; }
.tl-positions li:last-child { margin-bottom: 0; }
.tl-pos-title { font-weight: 600; display: block; }
.tl-points { margin: 8px 0 0; padding-left: 1.3em; color: var(--ink-soft); }
.tl-points li { margin: 3px 0; }
.tl-skills { margin-top: 8px; font-size: 14px; color: var(--ink-dim); font-style: italic; }
/* legacy (kept for the logo-fallback shared class) */
.logo-fallback { display: grid; place-items: center; }

/* ---------- sidebar: recent writing ---------- */
.sidebar-box { background: var(--news); border: 1px solid var(--news-border); padding: 4px 16px 14px; }
.sidebar-title { font-size: 23px; font-weight: 700; margin: 12px 0 4px; }
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { padding: 10px 0; border-top: 1px solid var(--news-border); font-size: 16px; line-height: 1.4; }
.sidebar-list li:first-child { border-top: 0; }
.sidebar-list .s-meta { display: block; color: var(--ink-dim); font-size: 13px; margin-top: 2px; }

/* ---------- listings ---------- */
.crumbs { font-size: 15px; color: var(--ink-dim); margin-bottom: 10px; overflow-wrap: anywhere; }
.crumbs a { color: var(--link); }
.crumbs .sep { color: var(--ink-dim); margin: 0 6px; text-decoration: none; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 34px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-soft); font-style: italic; }

.cards { list-style: none; padding: 0; margin: 0; }
.cards li { padding: 14px 0; border-bottom: 1px dotted var(--rule); }
.cards li:last-child { border-bottom: 0; }
.card { display: block; text-decoration: none; }
.card .card-title { font-size: 21px; font-weight: 700; color: var(--link); }
.card:hover .card-title { text-decoration: underline; }
.card .card-desc { color: var(--ink-soft); margin-top: 2px; }
.card .card-meta { color: var(--ink-dim); font-size: 14px; margin-top: 3px; }

.posts { list-style: none; padding: 0; margin: 0; }
.posts li { padding: 11px 0; border-bottom: 1px dotted var(--rule); }
.posts li:last-child { border-bottom: 0; }
.posts a { text-decoration: none; }
.posts .post-name { font-size: 20px; font-weight: 700; color: var(--link); }
.posts a:hover .post-name { text-decoration: underline; }
.posts .post-line { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.posts .post-date { color: var(--ink-dim); font-size: 14px; }
.posts .post-tags { color: var(--ink-dim); font-size: 14px; font-family: var(--mono); }
.empty { color: var(--ink-dim); padding: 14px 0; font-style: italic; }

/* ---------- post ---------- */
.post-title { font-size: 34px; line-height: 1.15; margin: 4px 0 8px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 26px; font-size: 15px; color: var(--ink-dim); }
.post-meta .tag { color: var(--ink-dim); font-family: var(--mono); font-size: 13px; }

.toc { margin: 0 0 26px; padding: 8px 18px; background: var(--news); border: 1px solid var(--news-border); font-size: 16px; }
.toc summary { cursor: pointer; font-weight: 700; }
.toc ol { list-style: none; margin: 8px 0 2px; padding: 0 0 0 4px; }
.toc li { margin: 2px 0; }
.toc li.h3 { padding-left: 18px; }

.prose { font-size: 18px; overflow-wrap: break-word; word-break: break-word; }
.prose pre, figure.code, .prose table, .prose img, .video { max-width: 100%; }
.prose > *:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose h2 { font-size: 27px; margin: 1.5em 0 .45em; padding-bottom: 3px; border-bottom: 1px solid var(--rule-soft); }
.prose h3 { font-size: 21px; margin: 1.5em 0 .4em; }
.prose h4 { font-size: 18px; margin: 1.4em 0 .4em; color: var(--ink-soft); }
.prose .anchor { color: var(--ink-dim); opacity: 0; margin-left: 8px; text-decoration: none; font-family: var(--mono); font-size: .7em; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: .25em 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--rule); display: block; margin: 1.4em auto; }
.prose blockquote { margin: 0 0 1.05em; padding: 2px 0 2px 18px; border-left: 3px solid var(--rule); color: var(--ink-soft); font-style: italic; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose :not(pre) > code { font-family: var(--mono); font-size: .82em; background: #f3f3f0; border: 1px solid #e4e4de; padding: .06em .32em; border-radius: 3px; color: #7a1f1f; overflow-wrap: anywhere; }

.callout { background: #f7f7f2; border-left: 3px solid var(--ink-dim) !important; padding: 12px 18px !important; font-style: normal !important; }
.callout-title { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--ink-dim); margin-bottom: 3px; }
.callout.tip { border-left-color: #2e7d32 !important; } .callout.tip .callout-title { color: #2e7d32; }
.callout.warning, .callout.caution { border-left-color: #b26a00 !important; } .callout.warning .callout-title, .callout.caution .callout-title { color: #b26a00; }
.callout.important { border-left-color: #b3261e !important; } .callout.important .callout-title { color: #b3261e; }

.prose table { border-collapse: collapse; margin: 0 0 1.2em; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 6px 12px; text-align: left; }
.prose th { background: #f4f4f0; font-weight: 700; }

/* ---------- code blocks ---------- */
figure.code { margin: 0 0 1.3em; border: 1px solid #ddd; background: #fafafa; border-radius: 3px; overflow: hidden; }
figure.code figcaption { display: flex; align-items: center; gap: 10px; padding: 5px 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); background: #f0f0ec; border-bottom: 1px solid #e0e0da; }
figure.code .lang { font-weight: 600; }
figure.code .copy { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
figure.code .copy:hover { color: var(--link-hover); }
figure.code pre { margin: 0; overflow-x: auto; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; }
figure.code code { display: block; font-family: var(--mono); background: none; padding: 0; color: #24292e; }
.line { display: block; }
.line.mark { background: #fff6bf; margin: 0 -14px; padding: 0 14px; box-shadow: inset 3px 0 0 #d0a000; }

/* highlight.js — GitHub-light palette */
.hljs { color: #24292e; }
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag { color: #d73a49; }
.hljs-built_in, .hljs-type, .hljs-title.class_ { color: #6f42c1; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #6f42c1; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #032f62; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #005cc5; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #24292e; }
.hljs-attr, .hljs-attribute { color: #005cc5; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #6f42c1; }
.hljs-meta .hljs-string { color: #032f62; }
.hljs-tag, .hljs-name { color: #22863a; }
.hljs-deletion { color: #b31d28; }
.hljs-property, .hljs-subst { color: #e36209; }
.hljs-operator, .hljs-punctuation { color: #24292e; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------- video ---------- */
.video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 26px; border: 1px solid var(--rule); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-empty { display: grid; place-items: center; background: #f2f2ee; color: var(--ink-dim); font-size: 14px; padding: 16px; text-align: center; font-family: var(--mono); }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: space-between; gap: 20px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 16px; }
.pager a { display: flex; flex-direction: column; gap: 1px; max-width: 48%; text-decoration: none; }
.pager .lbl { color: var(--ink-dim); font-size: 13px; font-family: var(--mono); }
.pager .ttl { color: var(--link); font-weight: 700; }
.pager a:hover .ttl { text-decoration: underline; }
.pager .next { text-align: right; margin-left: auto; align-items: flex-end; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 28px; padding: 14px 0 26px; color: var(--ink-dim); font-size: 14px; }
.site-footer p { margin: 0; }

.notfound { padding: 28px 0; }
.notfound h1 { font-size: 30px; margin: 0 0 8px; }
.notfound p { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .body-grid.with-sidebar { grid-template-columns: 1fr; gap: 8px; }
  .body-grid.with-sidebar .sidebar { margin-top: 16px; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .page { padding: 20px 18px 0; }
  .about-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .about-head .intro { align-self: stretch; }
  .avatar { align-self: flex-start; width: 150px !important; height: 150px !important; }
  .prose { font-size: 17px; }
  .nav-left li:first-child a { padding-left: 0; }
  .post-title, .page-head h1 { font-size: 27px; }
}
