/* ============================================================
   桜坂 - スタイルシート（ネイビー配色）
   色を変えたいときは、まず下の :root の値を書き換えてください
   ============================================================ */

:root {
  /* ネイビー系の配色（明るいテーマ） */
  --bg: #f6f8fc;
  --bg-card: #ffffff;
  --bg-subtle: #eaeff8;
  --text: #16233d;
  --text-muted: #5b6a88;
  --border: #d9e1ef;
  --accent: #2f4c8a;
  --accent-soft: #e6edfa;
  --accent-strong: #1d3466;
  --shadow: 0 1px 2px rgba(22, 35, 61, .06), 0 8px 24px -16px rgba(22, 35, 61, .28);
  --radius: 14px;
  --measure: 44rem;

  /* ネイビーの面（ヘッダーとトップの見出し部分） */
  --header-bg: #1b3160;
  --header-fg: #f1f5fd;
  --header-fg-muted: #b6c6e5;
  --header-active-bg: rgba(255, 255, 255, .17);
  --header-mark: #8fb0ea;
  --hero-bg: linear-gradient(140deg, #1a2f5c, #2b4783 55%, #365699);
  --hero-fg: #f2f6fd;
  --hero-fg-muted: #bccce9;

  --font-sans: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* ネイビー系の配色（暗いテーマ） */
    --bg: #0c1425;
    --bg-card: #131d33;
    --bg-subtle: #1a2540;
    --text: #e3eaf7;
    --text-muted: #93a3c1;
    --border: #24314e;
    --accent: #7c9fdf;
    --accent-soft: #1a2848;
    --accent-strong: #a9c4ee;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -16px rgba(0, 0, 0, .7);

    --header-bg: #0f1a2f;
    --header-fg: #e3eaf7;
    --header-fg-muted: #93a3c1;
    --header-active-bg: #1f3157;
    --header-mark: #7c9fdf;
    --hero-bg: linear-gradient(140deg, #14213c, #1b2d52 60%, #223a67);
    --hero-fg: #e3eaf7;
    --hero-fg-muted: #a5b5d2;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.container {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.main { padding-block: clamp(2rem, 6vw, 3.5rem) 4rem; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem; top: 1rem;
  z-index: 10;
  background: var(--bg-card);
  padding: .5rem 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

:where(a, input, button, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- ヘッダー ---------- */

.site-header {
  background: var(--header-bg);
  color: var(--header-fg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-block: .85rem;
}

.site-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--header-fg);
  text-decoration: none;
  line-height: 1.35;
}
.site-title:hover { color: var(--header-fg); }
.site-title__mark { flex: none; color: var(--header-mark); }
.site-title__name { display: block; font-weight: 700; font-size: 1.05rem; }
.site-title__tagline { display: block; font-size: .76rem; color: var(--header-fg-muted); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .35rem;
  font-size: .875rem;
}
.site-nav a {
  color: var(--header-fg-muted);
  text-decoration: none;
  padding: .3rem .65rem;
  border-radius: 999px;
}
.site-nav a:hover { background: var(--header-active-bg); color: var(--header-fg); }
.site-nav a[aria-current="page"] { background: var(--header-active-bg); color: var(--header-fg); font-weight: 600; }

/* ---------- トップページ ---------- */

.hero {
  padding: clamp(1.75rem, 5vw, 2.75rem);
  margin-bottom: 3rem;
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero__title { margin: 0 0 .4rem; font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: .02em; }
.hero__text { margin: 0; color: var(--hero-fg); }
.hero__meta { margin: 1rem 0 0; font-size: .82rem; color: var(--hero-fg-muted); }

.section-title {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- 記事カード ---------- */

.entry-list { display: grid; gap: 1rem; }

.entry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.35rem 1.1rem;
  transition: transform .15s ease, border-color .15s ease;
}
.entry-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.entry-card__link { display: block; text-decoration: none; color: inherit; }
.entry-card__date { display: block; font-size: .76rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.entry-card__title { margin: .2rem 0 .4rem; font-size: 1.12rem; line-height: 1.6; color: var(--text); }
.entry-card__link:hover .entry-card__title { color: var(--accent-strong); }
.entry-card__excerpt { margin: 0; font-size: .9rem; color: var(--text-muted); }

.more-link { margin-top: 1.75rem; text-align: center; font-size: .9rem; }

/* ---------- タグ ---------- */

.tag-list, .tag-cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .75rem 0 0;
  padding: 0;
}
.tag-cloud { margin-bottom: 2.5rem; gap: .5rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .74rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
}
.tag:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tag--lg { font-size: .85rem; padding: .35rem .85rem; }
.tag__count {
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 0 .4rem;
}

.tag-section { margin-bottom: 2.5rem; scroll-margin-top: 5rem; }
.tag-section__title { font-size: 1.1rem; margin: 0 0 .5rem; display: flex; align-items: baseline; gap: .75rem; }

/* ---------- 記事ページ ---------- */

.post__header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.post__date { font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.post__title { margin: .3rem 0 0; font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.5; }
.post__mood { margin: .75rem 0 0; font-size: .85rem; color: var(--text-muted); }

.page-title { margin: 0 0 .5rem; font-size: clamp(1.4rem, 5vw, 1.85rem); }
.page-lead { margin: 0 0 2rem; color: var(--text-muted); font-size: .92rem; }

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.4em; }
.prose h2 {
  margin-top: 2.5em;
  font-size: 1.25rem;
  padding-left: .7rem;
  border-left: 4px solid var(--accent);
  line-height: 1.5;
}
.prose h3 { margin-top: 2em; font-size: 1.08rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose blockquote {
  margin-inline: 0;
  padding: .3rem 1.1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.prose img {
  max-width: min(100%, 420px);
  height: auto;
  margin-inline: auto;
  border-radius: 10px;
  display: block;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin-block: 2.5em; }
.prose code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-subtle);
  padding: .15em .4em;
  border-radius: 5px;
}
.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: .85rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.prose th { background: var(--bg-subtle); }

/* ---------- 前後の記事 ---------- */

.post-nav {
  display: grid;
  gap: .75rem;
  margin-top: 3.5rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.post-nav__item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  text-decoration: none;
  color: inherit;
}
.post-nav__item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.post-nav__item--next { text-align: right; }
.post-nav__label { display: block; font-size: .72rem; color: var(--text-muted); }
.post-nav__title { display: block; font-size: .9rem; margin-top: .2rem; }

/* ---------- アーカイブ ---------- */

.search { margin-bottom: 1.75rem; }
.search__label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; }
.search__input {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  padding: .6rem .9rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.search__status { margin: .5rem 0 0; font-size: .78rem; color: var(--text-muted); min-height: 1.4em; }

.archive-year { margin-bottom: 2.75rem; }
.archive-year__title {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-size: 1.3rem;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.archive-year__count { font-size: .74rem; font-weight: 400; color: var(--text-muted); }

.archive-month { margin-bottom: 1.5rem; }
.archive-month__title { font-size: .8rem; color: var(--text-muted); margin: 0 0 .4rem; letter-spacing: .08em; }

.archive-items { list-style: none; margin: 0; padding: 0; }
.archive-item { padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.archive-item a {
  display: flex;
  gap: .9rem;
  align-items: baseline;
  text-decoration: none;
  color: inherit;
}
.archive-item a:hover .archive-item__title { color: var(--accent-strong); text-decoration: underline; }
.archive-item__date {
  flex: none;
  min-width: 3.6rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.archive-item__title { font-size: .95rem; }
.archive-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .1rem .7rem;
  padding-left: 4.5rem;
  font-size: .72rem;
  color: var(--text-muted);
}
.archive-item[hidden], .archive-month[hidden], .archive-year[hidden] { display: none; }

/* 年 → 月 → 日付の順に開く日記一覧 */
.diary-browser .archive-year {
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.diary-browser summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 48px;
  margin: 0;
  padding: .8rem 1rem;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.diary-browser summary::-webkit-details-marker { display: none; }
.diary-browser summary::before {
  content: '';
  width: .5rem;
  height: .5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  flex: none;
}
.diary-browser details[open] > summary::before { transform: rotate(45deg); }
.diary-browser summary:hover { background: var(--accent-soft); }
.diary-browser .archive-year__count { margin-left: auto; white-space: nowrap; }
.diary-browser .archive-year__months { padding: 0 .75rem .75rem; }
.diary-browser .archive-month { margin: .25rem 0 0; }
.diary-browser .archive-month__title { font-size: 1rem; font-weight: 600; }
.diary-browser .archive-items { padding: 0 1rem .5rem; }
.diary-browser .archive-item a { min-height: 44px; padding-block: .5rem; }
.diary-browser .archive-item__title { overflow-wrap: anywhere; }

/* ---------- そのほか ---------- */

.empty {
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .92rem;
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  font-size: .8rem;
  color: var(--text-muted);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.5rem;
  justify-content: space-between;
  padding-block: 1.5rem;
}
.site-footer p { margin: 0; }
.site-footer__links { display: flex; gap: .5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
