/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 400;
  src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v15/S6u8w4BMUTPHjxsAUi-qNiXg7eU0.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 400;
  src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v15/S6u8w4BMUTPHjxsAXC-qNiXg7Q.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 700;
  src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v15/S6u_w4BMUTPHjxsI5wq_FQftx9897sxZ.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 700;
  src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v15/S6u_w4BMUTPHjxsI5wq_Gwftx9897g.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v15/S6uyw4BMUTPHjxAwXiWtFCfQ7A.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v15/S6uyw4BMUTPHjx4wXiWtFCc.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v15/S6u9w4BMUTPHh6UVSwaPGQ3q5d0N7w.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v15/S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

a {
  color: #1772d0;
  text-decoration: none;
}

a:focus,
a:hover {
  color: #f09228;
  text-decoration: none;
}

body,
td,
th,
tr,
p,
a {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 14px
}

strong {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 14px;
}

heading {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 22px;
}

papertitle {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700
}

name {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 32px;
}

.one {
  width: 160px;
  height: 160px;
  position: relative;
}

.two {
  width: 160px;
  height: 160px;
  position: absolute;
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
}

.fade {
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
}

span.highlight {
  background-color: #ffffd0;
}

.profile-photo {
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.paper-thumb {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

/* News section */
.news-item {
  line-height: 1.45;
  margin-top: 9px;
}

.news-date {
  font-weight: 700;
  color: #333;
}

.news-meta {
  font-style: italic;
  color: #666;
  font-size: 13px;
}

.news-upcoming {
  background-color: #e6f4ea;
  color: #137333;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.news-placeholder {
  color: #000;
}

/* ---- Theme (light / dark) ---- */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --link: #1772d0;
  --link-hover: #f09228;
  --muted: #666666;
  --date: #333333;
  --hl-bg: #ffffd0;
  --hl-fg: inherit;
  --pill-bg: #e6f4ea;
  --pill-fg: #137333;
  --thumb-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  --photo-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  --btn-bg: #f2f2f2;
  --btn-border: #d4d4d4;
}

[data-theme="dark"] {
  --bg: #15181d;
  --fg: #e4e6ea;
  --link: #6ab0f3;
  --link-hover: #f09228;
  --muted: #99a2ad;
  --date: #e4e6ea;
  --hl-bg: #4b4000;
  --hl-fg: #ffe08a;
  --pill-bg: #16351f;
  --pill-fg: #7fe3a0;
  --thumb-shadow: 0 0 0 1px rgba(255, 255, 255, 0.30), 0 0 24px 4px rgba(255, 255, 255, 0.30);
  --photo-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32), 0 0 30px 6px rgba(255, 255, 255, 0.34);
  --btn-bg: #23272e;
  --btn-border: #363b44;
}

body {
  background-color: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}

body,
td,
th,
tr,
p {
  color: var(--fg);
}

a {
  color: var(--link);
}

a:focus,
a:hover {
  color: var(--link-hover);
}

span.highlight {
  background-color: var(--hl-bg);
  color: var(--hl-fg);
}

.news-date {
  color: var(--date);
}

.news-meta {
  color: var(--muted);
}

.news-placeholder {
  color: var(--fg);
}

.news-upcoming {
  background-color: var(--pill-bg);
  color: var(--pill-fg);
}

.paper-thumb {
  box-shadow: var(--thumb-shadow);
}

.profile-photo {
  box-shadow: var(--photo-shadow);
}

/* ---- Top bar: language switch + theme toggle ---- */
.topbar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid var(--btn-border);
  border-radius: 15px;
  background-color: var(--btn-bg);
}

.theme-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--btn-border);
  border-radius: 50%;
  background-color: var(--btn-bg);
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--link-hover);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Japanese text fallbacks */
body,
td,
th,
tr,
p,
a {
  font-family: 'Lato', Verdana, Helvetica, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

.link-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}

name ruby rt {
  font-size: 0.32em;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #666;
}

[data-theme="dark"] name ruby rt {
  color: #9aa1ab;
}

/* ---- Photo links in News: hover preview strip + click-to-open gallery ---- */
.photo-preview {
  position: absolute;
  z-index: 30;
  display: none;
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  background: var(--btn-bg, #fff);
  border: 1px solid var(--btn-border, #ddd);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;  /* the max-width gallery.js sets is the whole box, border included */
  overflow-x: auto;        /* a strip wider than the screen scrolls sideways instead of widening the page */
}

.photo-preview img {
  flex: none;            /* never squeezed: a long strip scrolls instead */
  max-width: none;       /* not the phones' img { max-width: 100% } rule either */
  height: 190px;         /* same height as the slide / poster previews */
  width: 253px;          /* fixed 4:3 box: the strip's size is known before the images load */
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  background: rgba(127, 127, 127, 0.15);
}

.photo-preview.doc img {
  width: auto;           /* a document page: keep its own aspect, no cropping */
  height: 190px;
  object-fit: contain;
  cursor: pointer;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.86);
}

.photo-lightbox figure {
  margin: 0;
  max-width: 92vw;
  max-height: 92vh;
  text-align: center;
}

.photo-lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.photo-lightbox figcaption {
  color: #ddd;
  font-size: 13px;
  margin-top: 8px;
}

.photo-lightbox button {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
  padding: 10px 16px;
  opacity: 0.85;
}

.photo-lightbox button:hover { opacity: 1; }
.photo-lightbox .lb-close { top: 10px; right: 16px; font-size: 40px; }
.photo-lightbox .lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.photo-lightbox .lb-next { right: 6px; top: 50%; transform: translateY(-50%); }

/* ---- Narrow screens (phones): stack the two-column layouts ---- */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  body { padding: 0 4px; }
  img { max-width: 100%; height: auto; }

  /* every two-column table row becomes a vertical stack */
  table, tbody, tr, td { display: block; width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
  td { padding: 8px 10px !important; }

  /* header: bio first, photo below, centred and smaller */
  td[style*="width:40%"] { text-align: center; padding-top: 0 !important; }
  .profile-photo { width: 58% !important; max-width: 58% !important; }

  /* publication cards: centred thumbnail above the text, tighter spacing */
  td[style*="width:25%"] { padding: 18px 10px 4px !important; }
  td[style*="width:25%"] img.paper-thumb { width: 62%; max-width: 240px; }
  td[style*="width:75%"] { padding: 4px 10px 14px !important; }
  td[style*="width:75%"] p:last-child { margin: 0; }

  papertitle { font-size: 15px; }
  .news-meta { font-size: 12px; }
  heading { font-size: 22px; }
  .topbar { top: 8px; right: 8px; }

  /* stacked cards: the tint (set below for all widths) wraps top and bottom */
  tr:has(> td[style*="width:25%"]) { margin: 10px 0; padding: 4px 0 6px; }
  tr:has(> td[style*="width:25%"]) > td:first-child { border-radius: 12px 12px 0 0 !important; }
  tr:has(> td[style*="width:25%"]) > td:last-child { border-radius: 0 0 12px 12px !important; }
}

/* ---- All widths: every second publication card gets a barely-there tint,
   news items are separated by a hairline ---- */
tr:has(> td[style*="width:25%"]):nth-child(even) > td { background: var(--card-alt, rgba(0, 0, 0, 0.015)); }
tr:has(> td[style*="width:25%"]) > td:first-child { border-radius: 12px 0 0 12px; }
tr:has(> td[style*="width:25%"]) > td:last-child { border-radius: 0 12px 12px 0; }

.news-item { padding: 8px 0; margin-top: 0; border-top: 1px solid var(--divider, rgba(0, 0, 0, 0.12)); }
.news-item:first-child { border-top: none; padding-top: 0; }

:root {
  --card-alt: rgba(0, 0, 0, 0.015);
  --divider: rgba(0, 0, 0, 0.12);
}
:root[data-theme="dark"] {
  --card-alt: rgba(255, 255, 255, 0.035);
  --divider: rgba(255, 255, 255, 0.14);
}

/* ---- Email: the envelope icon opens the mail program, the word copies the address ---- */
.copy-email {
  position: relative;
}

.copy-email::after {
  content: attr(data-copied);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);   /* below the links, where nothing is covered */
  z-index: 5;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.copy-email.copied::after {
  opacity: 1;
}
