/* ===== リセット & 基底 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
  line-height: 1.75;
  min-height: 100vh;
}

a {
  color: #7c4f1a;
  text-decoration: none;
}

/* ===== レイアウト ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ===== ヘッダー ===== */
.site-header {
  text-align: center;
  padding: 2rem 0;
}

.site-header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  color: #5c3d11;
  letter-spacing: 0.05em;
}

.site-header .subtitle {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #666;
}

/* ===== 検索エリア ===== */
.search-section {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  position: relative;
  /* ソートUIの基準 */
}

.search-controls {
  position: absolute;
  top: 2rem;
  right: 2rem;
  z-index: 10;
  display: flex;
  align-items: center;
}

.search-controls label {
  font-size: 0.9rem;
  color: #555;
}

.sort-select {
  padding: 0 0.8rem;
  height: 46px;
  line-height: 44px;
  /* 垂直方向の中央揃え */
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid var(--pagefind-ui-border);
  color: var(--pagefind-ui-text);
  font-family: inherit;
  font-size: 0.95rem;
  background-color: var(--pagefind-ui-background);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.sort-select:focus {
  border-color: var(--pagefind-ui-primary);
}

@media (max-width: 600px) {
  .search-section {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
  }

  .search-controls {
    position: static;
    display: flex;
    width: 100%;
    margin-top: 1rem;
    order: 2;
  }

  .sort-select {
    width: 100%;
  }
}

/* ----- Pagefind UI カスタマイズ ----- */
:root {
  --pagefind-ui-scale: 1;
  --pagefind-ui-primary: #7c4f1a;
  --pagefind-ui-text: #1a1a1a;
  --pagefind-ui-background: #fff;
  --pagefind-ui-border: #d4b896;
  --pagefind-ui-tag: #f0e8da;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 4px;
  --pagefind-ui-font: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
}

/* 検索コンテナ */
#search {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.pagefind-ui__form {
  /* 幅の制限を入力欄のみにするため、ここは100%のままにする */
  margin-bottom: 2rem !important;
}

/* 検索アイコン（虫眼鏡）を垂直中央に配置 */
.pagefind-ui__form::before {
  top: 14px !important;
}

@media (max-width: 600px) {
  .pagefind-ui__form {
    margin-bottom: 0 !important;
  }
}

.pagefind-ui__results-area {
  width: 100% !important;
}

.pagefind-ui__search-input {
  width: calc(100% - 170px) !important;
  font-size: 1rem !important;
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
  height: 46px !important;
}

@media (max-width: 600px) {
  .pagefind-ui__search-input {
    width: 100% !important;
  }
}

.pagefind-ui__results-area,
.pagefind-ui__result {
  width: 100% !important;
}

.pagefind-ui__search-clear {
  color: var(--pagefind-ui-primary);
  /* 入力欄の右端に合わせる */
  right: 175px !important;
  /* 垂直方向の中央揃え */
  top: 50% !important;
  transform: translateY(-50%) !important;
  height: auto !important;
  padding: 8px 10px !important;
}

@media (max-width: 600px) {
  .pagefind-ui__search-clear {
    right: 5px !important;
  }
}

/* 検索結果 */
.pagefind-ui__result {
  border-top: 1px solid #ede8e0;
  padding: 1rem 0;
}

.pagefind-ui__result-link {
  color: #5c3d11;
  font-weight: 700;
  text-decoration: none;
}

.pagefind-ui__result-link:hover {
  text-decoration: underline;
}

.pagefind-ui__result-excerpt {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.3rem;
}

/* ===== 記事ページ ===== */
header .back {
  display: inline-block;
  font-size: 0.9rem;
  color: #7c4f1a;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid #c8a96e;
  border-radius: 6px;
  margin: 1rem 0;
  transition: background 0.2s;
}

header .back:hover {
  background: #f0e8da;
}

main[data-pagefind-body] {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

main[data-pagefind-body] h1 {
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 900;
  color: #5c3d11;
  margin-bottom: 0.5rem;
}

main[data-pagefind-body] time {
  font-size: 0.85rem;
  color: #888;
  display: block;
  margin-bottom: 1.5rem;
}

.body p {
  margin-bottom: 1em;
}

/* ===== フッター ===== */
.site-footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: #999;
}

footer p {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #aaa;
}