:root {
  color-scheme: light;
  --paper: #fffdf8;
  --ink: #1c2530;
  --muted: #67717e;
  --line: #dfe4ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --soft: #eef7f5;
  --code-bg: #f4f6f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.75;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

.notes-header,
.notes-footer {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 18px;
  border-bottom: 1px solid var(--line);
}

.notes-brand {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.notes-feed {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.notes-main {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 46px 0 64px;
}

.notes-index h1,
.note-article h1 {
  margin: 0 0 26px;
  color: var(--ink);
  font-size: 3.1rem;
  line-height: 1.15;
}

.notes-list {
  display: grid;
  gap: 22px;
}

.notes-list-item {
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.notes-list-item time,
.note-date {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.notes-list-item h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  line-height: 1.35;
}

.notes-list-item h2 a {
  color: var(--ink);
  text-decoration: none;
}

.notes-list-item p {
  margin: 0;
  color: var(--muted);
}

.note-article {
  font-size: 1.04rem;
}

.note-body > * {
  margin-top: 0;
  margin-bottom: 1.2rem;
}

.note-body h2,
.note-body h3 {
  margin-top: 2.2rem;
  line-height: 1.35;
}

.note-body ul {
  padding-left: 1.4rem;
}

.note-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.note-body code {
  border-radius: 5px;
  background: var(--code-bg);
  padding: 0.12em 0.36em;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.note-body pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
  padding: 16px;
}

.note-body pre code {
  display: block;
  padding: 0;
  background: transparent;
}

.note-body blockquote {
  margin-left: 0;
  border-left: 4px solid var(--accent);
  background: var(--soft);
  padding: 12px 16px;
  color: var(--ink);
}

.note-back {
  margin-top: 38px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.notes-footer {
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* Header nav (search + RSS) */
.notes-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.notes-search-link,
.notes-home-link {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.notes-home-link {
  color: var(--accent-dark);
}

/* Index pagination (もどる / つぎへ) */
.notes-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.notes-page-link {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--accent-dark);
  background: var(--paper);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.4;
}

.notes-page-link:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--soft);
}

.notes-page-link:disabled {
  color: var(--muted);
  opacity: 0.45;
  border-style: dashed;
  cursor: not-allowed;
}

.notes-page-status {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Index toolbar (page-size selector) */
.notes-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.notes-page-size-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.notes-page-size-label select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.notes-noscript {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Notes footer site-wide links */
.notes-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.notes-footer-nav a {
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Prev / next pager on article pages */
.note-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.note-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
}

.note-pager a:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.note-pager-next {
  text-align: right;
}

.note-pager-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.note-pager-title {
  font-size: 0.98rem;
  line-height: 1.4;
}

/* Related articles */
.note-related {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.note-related h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.note-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.note-related a {
  display: block;
  text-decoration: none;
  color: var(--ink);
}

.note-related a:hover .note-related-title {
  color: var(--accent);
  text-decoration: underline;
}

.note-related time {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.note-related-title {
  font-size: 1.02rem;
  line-height: 1.4;
}

/* Search page */
.notes-search h1 {
  margin: 0 0 22px;
  font-size: 2.4rem;
}

.notes-search-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

.notes-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--soft);
}

.notes-search-status {
  margin: 14px 2px 24px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 560px) {
  .notes-header {
    padding-top: 20px;
  }

  .notes-main {
    padding-top: 34px;
  }

  .notes-index h1,
  .note-article h1 {
    font-size: 2.1rem;
  }

  .notes-list-item h2 {
    font-size: 1.28rem;
  }

  .note-pager {
    grid-template-columns: 1fr;
  }

  .note-pager-next {
    text-align: left;
  }
}
