/* Final layout guard: loaded after style.css to prevent text/image overlap.
   The hero text and image remain left-right on desktop, but each is locked to its own grid column. */

.hero-minimal,
.page-hero {
  overflow-x: clip !important;
}

.image-frame img,
.top-hero-visual img,
.page-hero-visual-compact img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  color: transparent !important; /* hides broken-image alt text from visually looking like overlay */
  font-size: 0 !important;
}

.hero-minimal .hero-inner.hero-single,
.page-hero-inner.page-hero-split {
  display: grid !important;
  box-sizing: border-box !important;
  position: relative !important;
  isolation: isolate !important;
}

.hero-minimal .hero-inner.hero-single > div:first-child,
.page-hero-copy {
  grid-column: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  position: relative !important;
  z-index: 1 !important;
  box-sizing: border-box !important;
}

.top-hero-visual,
.page-hero-visual-compact {
  grid-column: 2 !important;
  min-width: 0 !important;
  width: 100% !important;
  position: relative !important;
  z-index: 0 !important;
  box-sizing: border-box !important;
  justify-self: end !important;
  align-self: center !important;
  margin: 0 !important;
}

/* Japanese top page: desktop left-right layout. */
@media (min-width: 960px) {
  html[lang="ja"] .hero-minimal .hero-inner.hero-single {
    grid-template-columns: minmax(0, 590px) minmax(280px, 360px) !important;
    column-gap: clamp(48px, 6vw, 82px) !important;
    row-gap: 0 !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  html[lang="ja"] .hero-minimal .hero-inner.hero-single > div:first-child {
    max-width: 590px !important;
  }

  html[lang="ja"] .top-hero-visual {
    max-width: 360px !important;
  }

  html[lang="ja"] .image-frame-top {
    aspect-ratio: 16 / 9 !important;
  }

  html[lang="ja"] .hero h1.hero-title-tight {
    font-size: clamp(2.25rem, 3.45vw, 3.15rem) !important;
    line-height: 1.18 !important;
    letter-spacing: -0.045em !important;
    max-width: 100% !important;
  }

  html[lang="ja"] .hero-title-tight .title-line {
    display: block !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }

  html[lang="ja"] .hero-copy {
    max-width: 34em !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
}

/* Japanese research page: desktop left-right layout. */
@media (min-width: 960px) {
  html[lang="ja"] .page-hero-inner.page-hero-split {
    grid-template-columns: minmax(0, 600px) minmax(280px, 360px) !important;
    column-gap: clamp(48px, 6vw, 82px) !important;
    row-gap: 0 !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  html[lang="ja"] .page-hero-copy {
    max-width: 600px !important;
  }

  html[lang="ja"] .page-hero-visual-compact {
    max-width: 360px !important;
  }

  html[lang="ja"] .image-frame-compact {
    aspect-ratio: 16 / 9 !important;
  }

  html[lang="ja"] .research-title {
    font-size: clamp(2.15rem, 3.25vw, 3.05rem) !important;
    line-height: 1.18 !important;
    letter-spacing: -0.045em !important;
    max-width: 100% !important;
  }

  html[lang="ja"] .research-title span {
    display: block !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }

  html[lang="ja"] .page-hero-copy .lead {
    max-width: 37em !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
}

/* Intermediate desktop/tablet: keep left-right, but reduce image and text size so columns cannot collide. */
@media (min-width: 840px) and (max-width: 959px) {
  html[lang="ja"] .hero-minimal .hero-inner.hero-single,
  html[lang="ja"] .page-hero-inner.page-hero-split {
    grid-template-columns: minmax(0, 1fr) 250px !important;
    column-gap: 32px !important;
    row-gap: 0 !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  html[lang="ja"] .top-hero-visual,
  html[lang="ja"] .page-hero-visual-compact {
    max-width: 250px !important;
  }

  html[lang="ja"] .image-frame-top,
  html[lang="ja"] .image-frame-compact {
    aspect-ratio: 16 / 9 !important;
  }

  html[lang="ja"] .hero h1.hero-title-tight,
  html[lang="ja"] .research-title {
    font-size: 2.1rem !important;
    line-height: 1.18 !important;
    letter-spacing: -0.04em !important;
  }

  html[lang="ja"] .hero-title-tight .title-line,
  html[lang="ja"] .research-title span {
    display: block !important;
    white-space: nowrap !important;
  }
}

/* Mobile/small tablet: stacking is appropriate and prevents horizontal clipping. */
@media (max-width: 839px) {
  html[lang="ja"] .hero-minimal .hero-inner.hero-single,
  html[lang="ja"] .page-hero-inner.page-hero-split {
    grid-template-columns: 1fr !important;
    row-gap: 28px !important;
  }

  html[lang="ja"] .top-hero-visual,
  html[lang="ja"] .page-hero-visual-compact {
    grid-column: 1 !important;
    justify-self: start !important;
    max-width: min(100%, 520px) !important;
  }

  html[lang="ja"] .hero-title-tight .title-line,
  html[lang="ja"] .research-title span {
    white-space: normal !important;
  }
}

/* English pages: keep previous left-right look, with safer wrapping. */
@media (min-width: 1000px) {
  html[lang="en"] .hero-minimal .hero-inner.hero-single,
  html[lang="en"] .page-hero-inner.page-hero-split {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) !important;
    column-gap: clamp(44px, 5vw, 72px) !important;
    justify-content: space-between !important;
  }

  html[lang="en"] .top-hero-visual,
  html[lang="en"] .page-hero-visual-compact {
    max-width: 360px !important;
  }

  html[lang="en"] .image-frame-top,
  html[lang="en"] .image-frame-compact {
    aspect-ratio: 16 / 9 !important;
  }
}

@media (max-width: 999px) {
  html[lang="en"] .hero-minimal .hero-inner.hero-single,
  html[lang="en"] .page-hero-inner.page-hero-split {
    grid-template-columns: 1fr !important;
    row-gap: 28px !important;
  }

  html[lang="en"] .top-hero-visual,
  html[lang="en"] .page-hero-visual-compact {
    grid-column: 1 !important;
    justify-self: start !important;
    max-width: min(100%, 520px) !important;
  }
}

/* Keep cards and tables from overflowing. */
.card,
.grid,
.table-wrap,
.news-item {
  min-width: 0 !important;
}

.card h2,
.card h3,
.card p,
.prose p,
.table-wrap td,
.table-wrap th {
  overflow-wrap: anywhere !important;
}


/* 2026-07-01: affiliation and English content refinements */
html[lang="ja"] .brand-small,
html[lang="ja"] .brand-main,
.nowrap-ja {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

html[lang="ja"] .brand-main {
  font-size: clamp(1.08rem, 2.2vw, 1.34rem) !important;
}

html[lang="ja"] .brand-small {
  font-size: 0.84rem !important;
}

html[lang="en"] .news-list-full .news-item {
  display: grid !important;
  grid-template-columns: 96px minmax(0, 1fr) !important;
  align-items: start !important;
}

html[lang="en"] .news-list-full .news-text {
  min-width: 0 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

@media (max-width: 640px) {
  html[lang="en"] .news-list-full .news-item {
    grid-template-columns: 1fr !important;
    row-gap: 4px !important;
  }
}


/* 2026-07-01: History page copy refinement */
@media (min-width: 1024px) {
  .history-lead {
    max-width: 1180px;
    font-size: clamp(1rem, 1.25vw, 1.12rem);
  }

  .history-lead-nowrap {
    white-space: nowrap;
  }
}

@media (max-width: 1023px) {
  .history-lead-nowrap {
    white-space: normal;
  }
}


/* 2026-07-01: Links page */
.links-grid {
  align-items: stretch;
}

.link-card h2 {
  margin-bottom: 14px;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  border-top: 1px solid rgba(15, 42, 61, 0.10);
}

.link-list li:first-child {
  border-top: 0;
}

.link-list a {
  display: block;
  padding: 12px 0;
  font-weight: 700;
  text-decoration: none;
}

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


@media (min-width: 980px) {
  .links-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.link-list a {
  line-height: 1.55;
}


/* 2026-07-01: English links heading no-wrap */
@media (min-width: 980px) {
  html[lang="en"] .links-grid .link-card h2 {
    white-space: nowrap;
    font-size: clamp(1.05rem, 1.35vw, 1.3rem);
  }
}


/* 2026-07-01: English brand no-wrap */
html[lang="en"] .brand-main {
  white-space: nowrap;
  font-size: clamp(1.02rem, 1.55vw, 1.18rem);
  letter-spacing: -0.01em;
}

html[lang="en"] .brand-text {
  min-width: 0;
}

@media (max-width: 760px) {
  html[lang="en"] .brand-main {
    white-space: normal;
  }
}


/* 2026-07-01: Multi-line link labels */
.link-title-line {
  display: block;
  line-height: 1.45;
}

.link-list a .link-title-line + .link-title-line {
  margin-top: 0.08em;
}


/* 2026-07-01: Emeritus member section */
.member-subsection {
  margin-top: 34px;
}


/* 2026-07-01: Members page final spacing and column balance */
.member-table,
.table-wrap table {
  table-layout: fixed;
  width: 100%;
}

.member-table th:first-child,
.member-table td:first-child,
.table-wrap table th:first-child,
.table-wrap table td:first-child {
  width: 46%;
}

.member-table th:nth-child(2),
.member-table td:nth-child(2),
.table-wrap table th:nth-child(2),
.table-wrap table td:nth-child(2) {
  width: 54%;
}

.member-table th,
.member-table td,
.table-wrap table th,
.table-wrap table td {
  vertical-align: middle;
}

.table-wrap + .member-subsection {
  margin-top: 82px;
}

.member-subsection + .table-wrap {
  margin-top: 18px;
}

.member-subsection {
  margin-bottom: 18px;
}

@media (max-width: 680px) {
  .member-table th:first-child,
  .member-table td:first-child,
  .table-wrap table th:first-child,
  .table-wrap table td:first-child {
    width: 48%;
  }

  .member-table th:nth-child(2),
  .member-table td:nth-child(2),
  .table-wrap table th:nth-child(2),
  .table-wrap table td:nth-child(2) {
    width: 52%;
  }

  .table-wrap + .member-subsection {
    margin-top: 62px;
  }

  .member-subsection + .table-wrap {
    margin-top: 14px;
  }
}




/* Optional thumbnail support for future news items */
.news-item.has-image {
  grid-template-columns: 128px minmax(0, 1fr) !important;
  align-items: start !important;
}

.news-item.has-image .news-body {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.news-thumb {
  display: block;
  width: 128px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--soft-blue);
  border: 1px solid var(--line);
}

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

@media (max-width: 760px) {
  .news-item.has-image {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .news-item.has-image .news-body {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .news-thumb {
    width: 92px;
    border-radius: 12px;
  }
}


/* Individual news article pages */
.news-article {
  max-width: 860px;
  margin: 0 auto;
}

.news-article-meta {
  color: var(--accent-red);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.8rem;
}

.news-article h2 {
  margin-top: 2.2rem;
}

.news-article p {
  line-height: 1.9;
}

.news-article-image {
  margin: 1.8rem 0;
}

.news-article-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--soft-blue);
}

.news-article-image figcaption {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.news-article-actions {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
