@media (min-width: 57.8125em) {
  .sidebar {
    max-width: 330px;
  }
}

/* Sidebar text with a fixed break (&#10; in data-en/zh/ja), e.g. "东京大学 / 原子力国际专攻" */
.sidebar .author__urls .line-split {
  white-space: pre-line;
  word-break: keep-all;
}

/* Chinese name as a quiet subtitle under the English name */
.author__name-cjk {
  display: block;
  margin-top: 0.15em;
  font-size: 0.75em;
  font-weight: normal;
  color: #7a8288;
}

/* Keep anchor targets clear of the sticky masthead */
.page__content [id] {
  scroll-margin-top: 4em;
}

/* Leave room on the right of the masthead for the fixed language switcher */
.masthead__menu {
  padding-right: 150px; /* switcher is ~135px wide */
}

.masthead__menu .greedy-nav {
  min-width: 0; /* theme's 250px pushes the menu button under the switcher on phones */
}

.sidebar .author__urls,
.sidebar .author__urls-wrapper,
.sidebar .profile_box {
  max-width: 100%;
}

.sidebar .author__urls li,
.sidebar .author__urls a {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar .author__urls .contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
}

.sidebar .author__urls .contact-item > a {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  min-width: 0;
}

.sidebar .author__urls .contact-item i {
  flex-shrink: 0;
  margin-top: 0.15em;
}

.sidebar .author__urls .contact-item > a i {
  flex-shrink: 0;
  margin-top: 0.15em;
}

.sidebar .sidebar-cv-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  width: 100%;
  margin: 0.9em 0 0.75em;
  padding: 0.65em 1em;
  text-decoration: none;
}

.sidebar .sidebar-cv-link i {
  margin: 0;
}

.page__content .award-cont {
  display: block;
  margin-left: 2.8em;
}

/* Justify only on wide columns; on phones it stretches CJK lines around long words like the email */
@media (min-width: 48em) {
  .page__content > [data-lang] > p,
  .page__content > [data-lang] > ul li,
  .page__content .paper-box-text ul li {
    text-align: justify;
    text-justify: auto;
  }
}

.page__content .experience-entry {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr); /* fits "2026.08 – Present:" at 1.1em */
  column-gap: 0.35em;
  align-items: baseline;
}

.page__content .experience-date {
  white-space: nowrap;
}

.page__content .experience-body {
  min-width: 0;
}

/* Education / Awards reuse the experience grid so all text starts on one column */
.page__content .date-list .experience-date {
  font-size: 1em;
}

.page__content .experience-date,
.page__content .experience-role {
  font-size: 1.1em;
}

.page__content .experience-detail {
  display: block;
  margin-top: 0.1em;
  color: #5f6368;
  font-size: 0.95em;
  line-height: 1.45;
}

.page__content .experience-detail::before {
  content: none;
}

.page__content ul.experience-detail {
  margin: 0.1em 0 0;
  padding-left: 1.1em;
}

.page__content ul.experience-detail li {
  margin: 0.1em 0;
}

@media (max-width: 35em) {
  .page__content .experience-entry {
    grid-template-columns: 1fr;
  }
}

/* Card titles: one look for linked and unlinked titles; links reveal themselves on hover */
.paper-box-text p a,
.paper-box-text p .paper-title {
  font-size: 1.3em;
  font-weight: 600;
  color: #2b2f33;
  text-decoration: none;
}

.paper-box-text p a:hover {
  color: #224b8d;
  text-decoration: underline;
}

.paper-box-text p a[href*="github.com"]::after {
  content: "\f09b";
  font-family: "Font Awesome 5 Brands";
  font-weight: normal;
  font-size: 0.75em;
  margin-left: 0.4em;
  color: #7a8288;
  display: inline-block; /* keeps the icon out of the hover underline */
}
/* ── Language switcher ── */
#lang-switcher {
  position: fixed;
  top: 0.6em;
  right: 1em;
  z-index: 100;
  display: flex;
  gap: 0.3em;
}

#lang-switcher button {
  padding: 0.25em 0.65em;
  font-size: 0.8em;
  font-family: "Trebuchet MS", Helvetica, sans-serif;
  border: 1px solid #bdc1c4;
  border-radius: 4px;
  background: #fff;
  color: #494e52;
  cursor: pointer;
  transition: all 0.2s;
}

#lang-switcher button:hover {
  background: #f2f3f3;
}

#lang-switcher button.active {
  background: #224b8d;
  color: #fff;
  border-color: #224b8d;
}

/* hide inactive lang blocks */
[data-lang] { display: none; }
[data-lang].lang-active { display: block; }

/* ── paper-box: image 35%, text fills the rest so every section ends on the same right edge ── */
@media (min-width: 48em) {
  .paper-box .paper-box-image {
    min-width: 0;
    max-width: 35%;
    flex: 0 0 35%;
  }
  .paper-box .paper-box-image img {
    max-width: 100%;
    width: 100%;
  }
  .paper-box .paper-box-text {
    max-width: none;
    min-width: 0;
    flex: 1 1 0;
  }
}

/* Softer image frame instead of the theme's heavy 3px 3px 6px #888 */
.paper-box .paper-box-image img {
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* The next h1 already draws a rule; drop the card's own so headings aren't boxed by two lines */
.paper-box:has(+ :not(.paper-box)) {
  border-bottom: none;
}

/* CJK has no italic; the browser fakes a slant on 至今/現在 */
[data-lang="zh"] em,
[data-lang="ja"] em {
  font-style: normal;
}

/* Justified English needs hyphenation, otherwise long words open wide gaps */
[data-lang="en"] {
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* ── Responsive paper-box fix: stack on narrow screens ── */
@media (max-width: 47.99em) {
  .paper-box {
    flex-direction: column;
    align-items: center;
  }
  .paper-box .paper-box-text {
    max-width: 100%;
    padding-left: 0;
    order: 2;
  }
  .paper-box .paper-box-image {
    width: 80%;
    order: 1;
  }
  .paper-box .paper-box-image img {
    max-width: 100%;
    width: 80%;
  }

}

/* ── Sidebar map widget ── */
.sidebar-map-widget {
  margin-top: 1em;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  /* height is set dynamically by JS after scale is applied */
}

/* Hide on narrow screens where the sidebar is not pinned to the side */
@media (max-width: 57.8em) {
  .sidebar-map-widget {
    display: none;
  }
}

.date-placeholder {
  visibility: hidden;
}
