/* Crossroads - A Journal of Nagasaki History and Culture */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 1.2rem; /* default; overridden by controls.js */
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: none;
  text-size-adjust: 100%;
  color: #2c2c2c;
  background: #fff;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  overflow-wrap: break-word;
}

h1 {
  font-size: 1.6em;
  font-weight: normal;
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: 0.15em;
  color: #1a1a1a;
}

h2 {
  font-size: 0.95em;
  font-weight: normal;
  text-align: center;
  color: #555;
  margin-bottom: 1.5rem;
  font-style: italic;
}

h3 {
  font-size: 1.15em;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}

h4 {
  font-size: 1.05em;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #1a1a1a;
}

h5 {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: #333;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1.5rem 0;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: #1d4a73;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Home page */
.site-header {
  margin-bottom: 1rem;
}

.header-images {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.header-images img {
  height: 160px;
  width: auto;
  min-width: 0;
  object-fit: cover;
  border-radius: 3px;
  opacity: 0.9;
}

.issue-toc {
  margin: 0.5rem 0;
}

.issue-toc h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: #333;
}

.issue-toc ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}

.issue-toc li {
  font-size: 0.95rem;
}

.issue-toc a {
  font-weight: 600;
}

.issue-date {
  color: #888;
  font-size: 0.85rem;
  margin-left: 0.25rem;
}

.site-description {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.site-description p {
  margin-bottom: 1.25rem;
}

.site-description a {
  font-weight: 600;
}

.contact-info {
  font-size: 0.95rem;
  color: #555;
  margin-top: 1.5rem;
}

.contact-info a {
  color: #1d4a73;
}

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
  font-size: 0.85rem;
  color: #999;
}

/* Issue pages (number1, number2, etc.) */
.issue-header {
  text-align: center;
  margin-bottom: 2rem;
}

.issue-header h1 {
  margin-bottom: 0.1em;
}

.issue-header h2 {
  font-style: normal;
  color: #444;
}

.article-list {
  list-style: none;
  margin: 1rem 0 2rem;
}

.article-list li {
  margin-bottom: 0.75rem;
  padding-left: 0;
}

.article-list a {
  font-size: 1.05rem;
}

.back-link {
  margin-top: 2rem;
  font-size: 0.95rem;
}

.back-link a {
  color: #1d4a73;
}

/* Table of Contents pages */
.toc-section-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #333;
}

.toc-entry {
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.toc-entry .title {
  display: block;
}

.toc-entry .author {
  display: block;
  font-size: 0.9rem;
  color: #666;
  margin-left: 1.5rem;
}

.toc-entry .page {
  color: #999;
  font-size: 0.9rem;
}

/* Article pages */
.article-header {
  text-align: center;
  margin-bottom: 2rem;
}

.article-header h1 {
  font-size: 1.4em;
  line-height: 1.35;
  letter-spacing: 0.03em;
}

.article-header .subtitle {
  font-size: 1.05em;
  font-weight: normal;
  color: #444;
  margin-top: 0.25rem;
}

.article-header .author {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.75rem;
  font-style: italic;
}

.article-header .translator {
  font-size: 0.8em;
  color: #888;
  margin-top: 0.25rem;
  font-style: italic;
}

.article-downloads {
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
}

.article-downloads .citation {
  color: #444;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.article-downloads .download-links {
  color: #666;
}

.article-downloads .download-links a {
  font-weight: 600;
}

.article-body {
  line-height: 1.8;
}

.article-body p {
  margin-bottom: 1rem;
}

.article-body .section-heading {
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  margin: 1rem 2.5rem;
  font-size: 0.95em;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.article-body blockquote p {
  margin-bottom: 0.75rem;
}

/* Info/ordering page */
.info-block {
  font-size: 1rem;
  line-height: 1.8;
}

.info-block p {
  margin-bottom: 0.75rem;
}

/* Introduction pages */
.intro-body {
  font-size: 1rem;
  line-height: 1.8;
}

.intro-body p {
  margin-bottom: 1rem;
  text-align: justify;
}

.intro-signature {
  margin-top: 2rem;
  font-style: italic;
  color: #555;
}

/* View controls (font size, night mode) */
.view-controls {
  position: absolute;
  top: 0.4rem;
  right: 0.75rem;
}

@media (max-width: 600px) {
  .view-controls {
    position: static;
    text-align: right;
    margin-bottom: 0.25rem;
  }
}

.view-btn {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  margin-left: 0.25rem;
  font-family: inherit;
  line-height: 1;
}

.view-btn:hover {
  background: #e8e8e8;
}

/* Search */
.search-box {
  margin: 1.2rem 0 0.5rem;
}

.search-input-wrap {
  display: flex;
  gap: 0.5rem;
}

#search-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #2c2c2c;
}

#search-input:focus {
  outline: none;
  border-color: #888;
}

.search-result-count {
  font-size: 0.85rem;
  color: #777;
  margin: 0.6rem 0 0.3rem;
}

.search-no-results {
  font-size: 0.9rem;
  color: #999;
  margin: 0.6rem 0;
}

.search-result {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.search-result-title {
  display: block;
  font-weight: bold;
  font-size: 0.95rem;
}

.search-result-meta {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.15rem;
}

.search-result-snippet {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-top: 0.2rem;
  line-height: 1.5;
}

.search-result-snippet mark {
  background: #fff3a8;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.search-show-all {
  display: block;
  margin: 0.75rem auto;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
}

.search-show-all:hover {
  background: #e8e8e8;
}

.search-reset {
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
  white-space: nowrap;
}

.search-reset:hover {
  background: #e8e8e8;
}

/* Night mode */
body.night-mode {
  background: #1a1a1a;
  color: #d4d4d4;
}

body.night-mode h1,
body.night-mode h2,
body.night-mode h3 {
  color: #e0e0e0;
}

body.night-mode a {
  color: #6baadb;
}

body.night-mode hr {
  border-top-color: #444;
}

body.night-mode .view-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #d4d4d4;
}

body.night-mode .view-btn:hover {
  background: #383838;
}

body.night-mode .article-downloads {
  background: #222;
  border-color: #444;
}

body.night-mode .article-downloads .citation {
  color: #bbb;
}

body.night-mode .article-downloads .download-links {
  color: #999;
}

body.night-mode .toc-entry .author {
  color: #999;
}

body.night-mode .toc-entry .page {
  color: #777;
}

body.night-mode .article-header .subtitle {
  color: #bbb;
}

body.night-mode .article-header .author,
body.night-mode .article-header .translator {
  color: #999;
}

body.night-mode .contact-info {
  color: #999;
}

body.night-mode .article-body blockquote {
  color: inherit;
}

body.night-mode .site-footer {
  color: #666;
  border-top-color: #444;
}

body.night-mode .issue-date {
  color: #777;
}

body.night-mode #search-input {
  background: #2a2a2a;
  border-color: #444;
  color: #d4d4d4;
}

body.night-mode #search-input:focus {
  border-color: #666;
}

body.night-mode .search-result {
  border-bottom-color: #333;
}

body.night-mode .search-result-meta {
  color: #777;
}

body.night-mode .search-result-snippet {
  color: #aaa;
}

body.night-mode .search-result-snippet mark {
  background: #5a4e00;
  color: #e0d89a;
}

body.night-mode .search-no-results,
body.night-mode .search-result-count {
  color: #777;
}

body.night-mode .search-show-all {
  background: #2a2a2a;
  border-color: #444;
  color: #d4d4d4;
}

body.night-mode .search-show-all:hover {
  background: #383838;
}

body.night-mode .search-reset {
  background: #2a2a2a;
  border-color: #444;
  color: #d4d4d4;
}

body.night-mode .search-reset:hover {
  background: #383838;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem 0.75rem 2rem;
    font-size: 1rem;
  }

  h1 {
    font-size: 1.35rem;
    letter-spacing: 0.05em;
  }

  h2 {
    font-size: 1rem;
  }

  .article-header h1 {
    font-size: 1.25rem;
  }

  .article-header .subtitle {
    font-size: 1rem;
  }

  .article-body p {
    text-align: left;
  }

  .issue-toc ul {
    flex-direction: column;
    gap: 0.3rem;
  }

  .article-downloads {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
  }

  .toc-entry .author {
    margin-left: 0.75rem;
  }

  .article-body blockquote {
    margin: 0.75rem 1rem;
  }

  .intro-body p {
    text-align: left;
  }

  .view-btn {
    padding: 0.5rem 0.75rem;
    font-size: 16px;
  }

  .issue-header img {
    max-width: 160px;
  }

  .back-link {
    font-size: 0.85rem;
  }

  .site-description {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .header-images img {
    height: 100px;
  }

  .contact-info {
    font-size: 0.85rem;
  }
}
