:root {
  --text: #222;
  --muted: #666;
  --border: #e5e5e5;
  --bg: #ffffff;
  --link: #1f4e79;
  --max-width: 860px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Hiragino Sans", "Yu Gothic", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  margin-bottom: 56px;
}

.site-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

main {
  min-height: 65vh;
}

h1 {
  font-size: 2.1rem;
  line-height: 1.25;
  margin: 0 0 20px;
  font-weight: 650;
}

h2 {
  font-size: 1.35rem;
  margin-top: 52px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

h3 {
  font-size: 1.08rem;
  margin-top: 32px;
  margin-bottom: 8px;
}

p {
  margin: 0 0 1.1em;
}

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

a:hover {
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

ul,
ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.35em;
}

.lead {
  font-size: 1.12rem;
  color: #444;
  max-width: 720px;
}

.news-list {
  padding-left: 0;
  list-style: none;
}

.news-list li {
  margin-bottom: 10px;
}

.news-date {
  display: inline-block;
  min-width: 5.8em;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 72px;
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .site-header {
    margin-bottom: 40px;
  }

  .site-header .container {
    display: block;
  }

  .site-title {
    display: inline-block;
    margin-bottom: 14px;
  }

  .site-nav {
    gap: 12px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    margin-top: 40px;
  }
}

.publication-list {
  margin-top: 20px;
}

.publication-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.publication-entry {
  margin: 0;
}

.publication-action {
  margin-left: 0.35em;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.publication-action {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

button.publication-action:hover,
a.publication-action:hover {
  text-decoration-thickness: 1.5px;
}

.cite-dialog {
  width: min(640px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  color: var(--text);
}

.cite-dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}

.cite-dialog h2 {
  margin-top: 0;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.citation-style-label {
  font-weight: 600;
  margin-bottom: 8px;
}

.citation-preview {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.6;
  margin-bottom: 16px;
  background: #fff;
}

.copy-citation-button {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
}

.copy-citation-button:hover {
  border-color: var(--text);
}

.cite-dialog {
  position: relative;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
}

.dialog-close:hover {
  border-color: var(--text);
}

@media (max-width: 700px) {
  .cite-dialog {
    padding: 56px 20px 24px;
  }

  .dialog-close {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
  }
}

.page-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 14px 0 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.page-toc strong {
  margin-right: 6px;
  color: var(--text);
}

.page-toc a {
  color: var(--link);
  text-decoration: none;
}

.page-toc a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
}

.cite-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: min(640px, calc(100% - 32px));
  max-height: min(80vh, 720px);
  overflow-y: auto;

  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  color: var(--text);
  background: #fff;
}

.cite-dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}

@media (max-width: 700px) {
  .cite-dialog {
    width: calc(100% - 24px);
    max-height: 82vh;
    padding: 56px 20px 24px;
  }
}

.header-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.language-switcher label {
  font-size: 0.85rem;
}

.language-switcher select {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 28px 5px 8px;
  cursor: pointer;
}

.language-switcher select:hover {
  border-color: var(--text);
}

@media (max-width: 700px) {
  .header-inner {
    display: block;
  }

  .header-right {
    display: block;
  }

  .language-switcher {
    margin-top: 14px;
  }
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding: 0;
  margin: 12px 0 24px;
  list-style: none;
}

.profile-links li {
  margin: 0;
}

.profile-links a,
.profile-link-disabled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.95rem;
}

.profile-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.profile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.profile-link-disabled {
  color: var(--muted);
}

.profile-link-disabled .profile-icon {
  color: var(--muted);
  background: #fafafa;
}

.profile-status {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 24px;
}

.profile-links li {
  margin: 0;
}

.profile-links a,
.profile-link-disabled {
  min-height: 28px;
}
