/* 文字まわり（フォント・サイズ・太さ・行間・文字色）は www.primagest.net/document（APIdog）の値に合わせている */
:root {
  --rn-font:
    -apple-system, "BlinkMacSystemFont", "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  --rn-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --rn-color-text: #344054;
  --rn-color-sub: #475467;
  --rn-color-muted: #667085;
  --rn-color-border: #d9dee3;
  --rn-color-bg: #ffffff;
  --rn-color-surface: #f6f8fa;
  --rn-color-accent: #0b5cad;
  --rn-color-accent-soft: #e8f0fb;
  --rn-color-focus: #0b5cad;
  --rn-color-new-bg: #dcf5e4;
  --rn-color-new-text: #0f6a34;
  --rn-color-improvement-bg: #e3edfb;
  --rn-color-improvement-text: #1b4f9c;
  --rn-color-bug-bg: #fde7e4;
  --rn-color-bug-text: #a52a1e;
  --rn-color-mark: #fff2a8;
  --rn-radius: 8px;
  --rn-sidebar-width: 220px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--rn-font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--rn-color-text);
  background: var(--rn-color-bg);
}

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

/* 操作部品の文字は、ドキュメントのボタン・入力欄と同じ 14px / 行間 22px */
button,
input,
select {
  font: inherit;
  font-size: 14px;
  line-height: 22px;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--rn-color-focus);
  outline-offset: 2px;
}

mark {
  background: var(--rn-color-mark);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.rn-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
 * サイトヘッダー（www.primagest.net と同じ構成。テーマ切替は持たない）
 * ------------------------------------------------------------------------- */

.rn-site-header {
  border-bottom: 1px solid #e5e7eb;
  background: var(--rn-color-bg);
  color: var(--rn-color-text);
}

.rn-site-header[hidden] {
  display: none;
}

.rn-site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1560px;
  min-height: 65px;
  margin: 0 auto;
  padding: 0 20px;
}

.rn-site-brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.rn-site-logo {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.rn-site-brand-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 28px;
  white-space: nowrap;
}

.rn-site-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.rn-site-nav-link,
.rn-site-action {
  color: var(--rn-color-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.rn-site-nav-link {
  position: relative;
  padding: 5px 0;
  line-height: 22px;
}

.rn-site-nav-link:hover,
.rn-site-action:hover {
  color: var(--rn-color-text);
}

.rn-site-nav-link.is-current {
  color: var(--rn-color-text);
}

.rn-site-nav-link.is-current::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -16px;
  left: 0;
  height: 2px;
  background: #1a1a1a;
}

.rn-site-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.rn-site-action {
  padding: 6px 4px;
  color: var(--rn-color-text);
  font-weight: 400;
  line-height: 20px;
}

.rn-site-contact {
  padding: 2px 12px;
  border: 1px solid #1a1a1a;
  border-radius: var(--rn-radius);
  color: #1a1a1a;
  font-size: 14px;
  line-height: 26px;
  text-decoration: none;
  white-space: nowrap;
}

.rn-site-contact:hover {
  background: var(--rn-color-surface);
}

/* ヘッダーのメニューが 1 行に収まらない幅では縦に積む */
@media (max-width: 1099px) {
  .rn-site-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .rn-site-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0 16px;
  }

  .rn-site-nav-link.is-current::after {
    bottom: 0;
  }
}

/* ---------------------------------------------------------------------------
 * ページヘッダー（www.primagest.net のページ上部と同じ「モジュール名 ＋ ページタイトル」）
 * ------------------------------------------------------------------------- */

.rn-page-header {
  margin-bottom: 16px;
  color: var(--rn-color-text);
}

.rn-page-header[hidden] {
  display: none;
}

.rn-page-title {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 40px;
  padding-bottom: 16px;
}

/* ---------------------------------------------------------------------------
 * レイアウト
 * ------------------------------------------------------------------------- */

.rn-app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* キーワード検索。右カラム（rn-main）の先頭、絞り込みの上に置く */
.rn-search {
  position: relative;
  max-width: 640px;
  margin-bottom: 12px;
}

.rn-search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  display: inline-flex;
  color: var(--rn-color-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.rn-search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--rn-color-border);
  border-radius: var(--rn-radius);
  background: var(--rn-color-bg);
  appearance: none;
}

.rn-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

/* プロダクトの説明文。絞り込みの下に置く（罫線なし） */
.rn-intro {
  margin: 16px 0 0;
  color: var(--rn-color-text);
}

.rn-intro[hidden] {
  display: none;
}

.rn-body {
  display: grid;
  grid-template-columns: var(--rn-sidebar-width) minmax(0, 1fr);
  gap: 32px;
}

.rn-app--embedded .rn-body {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------------------------------------------------------------------------
 * プロダクト一覧
 * ------------------------------------------------------------------------- */

.rn-sidebar[hidden] {
  display: none;
}

.rn-product-list {
  position: sticky;
  top: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rn-product-item + .rn-product-item {
  margin-top: 2px;
}

.rn-product-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--rn-radius);
  color: var(--rn-color-sub);
  font-size: 14px;
  line-height: 22px;
  text-decoration: none;
}

.rn-product-link:hover {
  background: var(--rn-color-surface);
}

.rn-product-link.is-selected {
  background: var(--rn-color-accent-soft);
  color: var(--rn-color-accent);
  font-weight: 600;
}

.rn-product-select-label,
.rn-product-select {
  display: none;
}

/* ---------------------------------------------------------------------------
 * 絞り込み
 * ------------------------------------------------------------------------- */

.rn-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--rn-color-border);
  border-radius: var(--rn-radius);
  background: var(--rn-color-surface);
}

.rn-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rn-filter-group[hidden] {
  display: none;
}

.rn-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.rn-filter-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  color: var(--rn-color-muted);
  white-space: nowrap;
}

.rn-filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* fieldset / legend は flex の横並びに乗らないため、期間と同じ div 構成にしている */
.rn-type-group {
  flex-wrap: nowrap;
  min-width: max-content;
}

.rn-type-buttons {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.rn-type-button {
  padding: 4px 12px;
  border: 1px solid var(--rn-color-border);
  border-radius: 999px;
  background: var(--rn-color-bg);
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .rn-type-group {
    gap: 8px;
  }

  .rn-type-buttons {
    gap: 4px;
  }

  .rn-type-button {
    padding-inline: 8px;
  }
}

.rn-type-button:hover {
  border-color: var(--rn-color-muted);
}

.rn-type-button[aria-pressed="true"] {
  font-weight: 600;
}

.rn-type-button--all[aria-pressed="true"] {
  background: var(--rn-color-accent-soft);
  border-color: var(--rn-color-accent);
  color: var(--rn-color-accent);
}

.rn-type-button--new[aria-pressed="true"] {
  background: var(--rn-color-new-bg);
  border-color: var(--rn-color-new-text);
  color: var(--rn-color-new-text);
}

.rn-type-button--improvement[aria-pressed="true"] {
  background: var(--rn-color-improvement-bg);
  border-color: var(--rn-color-improvement-text);
  color: var(--rn-color-improvement-text);
}

.rn-type-button--bug[aria-pressed="true"] {
  background: var(--rn-color-bug-bg);
  border-color: var(--rn-color-bug-text);
  color: var(--rn-color-bug-text);
}

.rn-filter-toggle {
  display: none;
  padding: 6px 12px;
  border: 1px solid var(--rn-color-border);
  border-radius: var(--rn-radius);
  background: var(--rn-color-bg);
  cursor: pointer;
}

.rn-filter-toggle[aria-expanded="true"] {
  background: var(--rn-color-accent-soft);
  border-color: var(--rn-color-accent);
  color: var(--rn-color-accent);
}

.rn-filter-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.rn-select,
.rn-input {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--rn-color-border);
  border-radius: var(--rn-radius);
  background: var(--rn-color-bg);
}

.rn-select {
  padding-right: 28px;
}

.rn-input {
  width: 140px;
}

.rn-clear-button,
.rn-button {
  padding: 6px 12px;
  border: 1px solid var(--rn-color-border);
  border-radius: var(--rn-radius);
  background: var(--rn-color-bg);
  cursor: pointer;
}

.rn-clear-button {
  margin-left: auto;
}

.rn-clear-button:hover,
.rn-button:hover {
  border-color: var(--rn-color-muted);
}

.rn-button {
  background: var(--rn-color-accent);
  border-color: var(--rn-color-accent);
  color: #fff;
}

.rn-button:hover {
  border-color: var(--rn-color-accent);
  opacity: 0.9;
}

.rn-count {
  margin: 16px 0 8px;
  font-size: 14px;
  line-height: 22px;
  color: var(--rn-color-muted);
}

/* ---------------------------------------------------------------------------
 * 一覧
 * ------------------------------------------------------------------------- */

.rn-month + .rn-month {
  margin-top: 32px;
}

.rn-month-heading {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rn-color-border);
  /* ドキュメントの h2 */
  font-size: 24px;
  font-weight: 600;
  line-height: 30px;
}

.rn-date + .rn-date {
  margin-top: 20px;
}

.rn-date-heading {
  margin: 0 0 8px;
  /* ドキュメントの h3 */
  font-size: 20px;
  font-weight: 600;
  line-height: 25px;
  color: var(--rn-color-text);
}

.rn-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
  padding: 12px;
  margin: 0 -12px;
  border-radius: var(--rn-radius);
  scroll-margin-top: 16px;
  transition: background-color 0.2s;
}

.rn-entry:hover {
  background: var(--rn-color-surface);
}

.rn-entry.is-highlighted {
  background: var(--rn-color-accent-soft);
  box-shadow: inset 3px 0 0 var(--rn-color-accent);
}

.rn-entry:focus {
  outline: none;
}

.rn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
  /* 題名 1 行目（行間 28px）の中央に絵文字を置く */
  height: 28px;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}

.rn-entry-content {
  min-width: 0;
}

.rn-entry-title {
  margin: 0;
  /* ドキュメント本文中の太字 */
  font-size: 16px;
  font-weight: 600;
  line-height: 28px;
  color: var(--rn-color-text);
  overflow-wrap: anywhere;
}

.rn-entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 14px;
  line-height: 22px;
  color: var(--rn-color-muted);
}

.rn-entry-products {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
}

.rn-entry-product::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  opacity: 0.6;
}

.rn-entry-version {
  font-family: var(--rn-font-mono);
}

.rn-entry-description {
  margin: 6px 0 0;
  /* ドキュメントの本文 */
  font-size: 16px;
  line-height: 28px;
  color: var(--rn-color-text);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
 * 状態表示
 * ------------------------------------------------------------------------- */

.rn-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 24px;
  border: 1px dashed var(--rn-color-border);
  border-radius: var(--rn-radius);
}

.rn-message--error {
  border-color: var(--rn-color-bug-text);
  background: var(--rn-color-bug-bg);
}

.rn-message-title {
  margin: 0;
  font-weight: 600;
}

.rn-message-text {
  margin: 0;
  color: var(--rn-color-muted);
}

.rn-skeleton {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rn-skeleton-heading,
.rn-skeleton-badge,
.rn-skeleton-line {
  border-radius: 4px;
  background: linear-gradient(90deg, #e9edf1 25%, #f4f6f8 50%, #e9edf1 75%);
  background-size: 200% 100%;
  animation: rn-shimmer 1.4s ease-in-out infinite;
}

.rn-skeleton-heading {
  width: 140px;
  height: 24px;
}

.rn-skeleton-entry {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.rn-skeleton-badge {
  width: 56px;
  height: 22px;
  flex-shrink: 0;
}

.rn-skeleton-lines {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

.rn-skeleton-line {
  height: 16px;
}

.rn-skeleton-line--short {
  width: 40%;
}

@keyframes rn-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rn-skeleton-heading,
  .rn-skeleton-badge,
  .rn-skeleton-line {
    animation: none;
  }
  .rn-entry {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
 * 幅 960px 未満: プロダクト一覧をセレクトボックスに、種別以外の絞り込みを開閉式に
 * ------------------------------------------------------------------------- */

@media (max-width: 959px) {
  .rn-app {
    padding: 16px 16px 40px;
  }

  .rn-page-title {
    padding-bottom: 12px;
  }

  .rn-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .rn-product-list {
    display: none;
  }

  .rn-product-select-label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 22px;
    color: var(--rn-color-muted);
  }

  .rn-product-select {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--rn-color-border);
    border-radius: var(--rn-radius);
    background: var(--rn-color-bg);
  }

  .rn-filters {
    padding: 12px;
  }

  .rn-filter-toggle {
    display: inline-block;
  }

  .rn-filter-details {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rn-color-border);
  }

  .rn-filter-details.is-open {
    display: flex;
  }

  .rn-filter-details .rn-filter-group {
    flex-direction: column;
    align-items: stretch;
  }

  .rn-filter-details .rn-filter-controls {
    flex-wrap: nowrap;
  }

  .rn-filter-details .rn-select,
  .rn-filter-details .rn-input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .rn-clear-button {
    margin-left: 0;
  }

  .rn-entry {
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 12px 0;
    border-radius: 0;
  }

  .rn-entry:hover {
    background: transparent;
  }

  .rn-entry.is-highlighted {
    padding-left: 12px;
    margin-left: -12px;
  }

  .rn-badge {
    grid-column: 1;
    justify-self: start;
    height: auto;
    margin-top: 0;
  }

  .rn-entry-content {
    grid-column: 1;
  }
}
