@charset "UTF-8";
/* ==========================================================================
   絵本のようなブログ — 共通テーマ
   色は SSR 時に D1 の settings から :root へ流し込まれる（下記はフォールバック）
   ========================================================================== */

:root {
  --cream:   #FFFBF4;
  --paper:   #FFF7EC;
  --sakura:  #F6D2D2;
  --apricot: #FBDCB9;
  --wakaba:  #DCEBD6;
  --sora:    #D9E7F3;
  --ink:     #5C4A3D;
  --accent:  #E29A6E;

  /* 上の色から派生させる副次的な色 */
  --ink-soft:   color-mix(in oklab, var(--ink) 68%, var(--paper));
  --ink-faint:  color-mix(in oklab, var(--ink) 42%, var(--paper));
  --line:       color-mix(in oklab, var(--ink) 16%, var(--paper));
  --line-soft:  color-mix(in oklab, var(--ink) 9%, var(--paper));
  --accent-ink: color-mix(in oklab, var(--accent) 72%, var(--ink));
  --milk:       color-mix(in oklab, var(--apricot) 45%, var(--paper));
  /* 夜の場面用。そら色をそのまま暗くしたいが、こげ茶を混ぜると濁るので
     相対カラーで明度だけ落とす。使えないブラウザには手前の値が残る。 */
  --night:      #3B4763;

  --font-jp: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic",
             "ヒラギノ丸ゴ ProN W4", sans-serif;
  --font-en: "Quicksand", var(--font-jp);

  /* やわらかい影は必ず多層で。1枚だと硬く見える */
  --shadow-soft:
    0 1px 2px color-mix(in oklab, var(--ink) 6%, transparent),
    0 6px 16px color-mix(in oklab, var(--ink) 7%, transparent),
    0 18px 40px color-mix(in oklab, var(--ink) 5%, transparent);
  --shadow-lift:
    0 2px 4px color-mix(in oklab, var(--ink) 7%, transparent),
    0 12px 26px color-mix(in oklab, var(--ink) 10%, transparent),
    0 28px 60px color-mix(in oklab, var(--ink) 7%, transparent);

  /* 手描き風の枠（角丸を上下左右で崩すと、定規で引いていない線に見える） */
  --wobble-1: 22px 30px 24px 28px / 28px 22px 30px 24px;
  --wobble-2: 30px 22px 28px 24px / 24px 30px 22px 28px;

  --page: 74rem;
  --prose: 40rem;
  --ease-soft: cubic-bezier(.34, 1.36, .64, 1);
}

@supports (color: oklch(from red l c h)) {
  :root { --night: oklch(from var(--sora) .36 calc(c * 2.2) h); }
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-jp);
  font-size: 1.0625rem;         /* 17px */
  line-height: 1.9;
  font-feature-settings: "palt" 1;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
}

/* 紙の質感。SVG ノイズを 1 枚だけ全面に重ねる（外部画像ゼロ） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

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

a {
  color: var(--accent-ink);
  text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent);
  text-underline-offset: .28em;
  text-decoration-thickness: .09em;
  transition: color .2s, text-decoration-color .2s;
}
a:hover { color: var(--ink); text-decoration-color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── 見出し ─────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .03em;
  margin: 0;
  text-wrap: balance;
}

.page { width: min(100% - 2.5rem, var(--page)); margin-inline: auto; }
.prose-width { width: min(100% - 2.5rem, var(--prose)); margin-inline: auto; }

/* ==========================================================================
   ヘッダー
   ========================================================================== */
.site-header {
  padding: 1.6rem 0 .8rem;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .06em;
}
.brand:hover { color: var(--ink); }
.brand__mark {
  width: 2.6rem; height: 2.6rem;
  flex: none;
  transition: transform .5s var(--ease-soft);
}
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }

.site-nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.site-nav a {
  display: inline-block;
  padding: .3rem .95rem;
  border-radius: 999px;
  font-size: .95rem;
  text-decoration: none;
  color: var(--ink-soft);
  transition: background-color .25s, color .25s, transform .25s var(--ease-soft);
}
.site-nav a:hover {
  background: var(--sakura);
  color: var(--ink);
  transform: translateY(-2px);
}

/* ==========================================================================
   ヒーロー（空 → 雲 → 丘 → 木 のレイヤー）
   ========================================================================== */
.hero {
  position: relative;
  margin: .5rem 0 3.5rem;
  padding: 2.9rem 0 0;
  border-radius: var(--wobble-1);
  background: linear-gradient(170deg,
    var(--sora) 0%,
    color-mix(in oklab, var(--sora) 45%, var(--paper)) 42%,
    var(--paper) 78%);
  overflow: hidden;
  isolation: isolate;
}
.hero__copy {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem 1rem;
}
.hero__title {
  font-size: clamp(1.9rem, 5.4vw, 3rem);
  margin-bottom: .7rem;
}
.hero__tagline {
  font-size: clamp(.98rem, 2.2vw, 1.12rem);
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 32em;
}
.hero__scene {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -.5rem;
}
/* 雲はゆっくり流れる */
.cloud-drift { animation: drift 34s ease-in-out infinite alternate; }
.cloud-drift--slow { animation-duration: 52s; animation-direction: alternate-reverse; }
@keyframes drift {
  from { transform: translateX(-2.5%); }
  to   { transform: translateX(2.5%); }
}

/* ==========================================================================
   記事カード（スクラップブック風にほんの少し傾ける）
   ========================================================================== */
.section-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: 1.32rem;
  margin-bottom: 1.6rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg,
    var(--line) 0 8px, transparent 8px 16px);
}
.section-title__icon { width: 1.7rem; height: 1.7rem; flex: none; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2rem 1.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--wobble-1);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform .38s var(--ease-soft), box-shadow .38s ease;
}
.card:nth-child(3n+1) { transform: rotate(-.7deg); border-radius: var(--wobble-2); }
.card:nth-child(3n+2) { transform: rotate(.5deg); }
.card:nth-child(3n)   { transform: rotate(-.3deg); border-radius: var(--wobble-2); }
.card:hover, .card:focus-within {
  transform: translateY(-7px) rotate(0deg);
  box-shadow: var(--shadow-lift);
}

.card__thumb {
  aspect-ratio: 16 / 10;
  background: var(--milk);
  overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.card__thumb svg { width: 100%; height: 100%; }

.card__body { padding: 1.35rem 1.5rem 1.6rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.card__title { font-size: 1.12rem; line-height: 1.65; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; } /* カード全面をリンクに */
.card__summary {
  margin: 0;
  font-size: .93rem;
  color: var(--ink-soft);
  line-height: 1.85;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-family: var(--font-en);
  font-size: .82rem;
  color: var(--ink-faint);
  letter-spacing: .06em;
}

/* ── タグ ─────────────────────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; margin: 0; list-style: none; }
.tag {
  position: relative;
  z-index: 2;
  display: inline-block;
  padding: .16rem .8rem;
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .05em;
  text-decoration: none;
  color: var(--ink);
  background: var(--wakaba);
  transition: transform .25s var(--ease-soft), background-color .25s;
}
.tag:nth-child(4n+2) { background: var(--sakura); }
.tag:nth-child(4n+3) { background: var(--apricot); }
.tag:nth-child(4n)   { background: var(--sora); }
.tag:hover { transform: translateY(-2px) rotate(-2deg); color: var(--ink); }

/* ==========================================================================
   記事本文
   ========================================================================== */
.article-header { text-align: center; margin: 1rem 0 2.5rem; }
.article-header__date {
  font-family: var(--font-en);
  font-size: .88rem;
  letter-spacing: .14em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.article-header__title {
  font-size: clamp(1.6rem, 4.6vw, 2.35rem);
  margin: .7rem 0 1.1rem;
}
.article-header .tag-list { justify-content: center; }

.article-cover {
  margin: 0 0 3rem;
  border-radius: var(--wobble-2);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.article-cover img { width: 100%; }

.prose { font-size: 1.09rem; line-height: 2.05; }
.prose > * + * { margin-top: 1.5em; }
.prose p { margin: 0; }

.prose h2 {
  font-size: 1.42rem;
  margin-top: 3.4rem;
  padding-bottom: .55rem;
  border-bottom: 2px dashed var(--line);
}
.prose h3 { font-size: 1.18rem; margin-top: 2.6rem; color: var(--accent-ink); }
/* 見出しの直後は、線と本文がくっつかないよう広めに取る */
.prose h2 + *, .prose h3 + * { margin-top: 1.15em; }

.prose ul, .prose ol { margin: 1.5em 0; padding-left: 1.5em; }
.prose li + li { margin-top: .55em; }
.prose ul { list-style: none; padding-left: 1.3em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: -1.3em;
  top: .78em;
  width: .5em;
  height: .5em;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--accent);
  opacity: .55;
}

/* 引用は絵本のふきだし風 */
.prose blockquote {
  position: relative;
  margin: 2.2em 0;
  padding: 1.5rem 1.75rem;
  background: var(--paper);
  border-radius: var(--wobble-1);
  box-shadow: var(--shadow-soft);
  color: color-mix(in oklab, var(--ink) 84%, var(--paper));
  font-size: 1.02rem;
}
.prose blockquote::after {
  content: "";
  position: absolute;
  left: 2.6rem;
  bottom: -.85rem;
  width: 1.5rem;
  height: 1.1rem;
  background: var(--paper);
  clip-path: polygon(0 0, 100% 0, 22% 100%);
}
.prose blockquote > :first-child { margin-top: 0; }

.prose img {
  border-radius: var(--wobble-2);
  box-shadow: var(--shadow-soft);
  margin-inline: auto;
}
.prose figure { margin: 2.4em 0; }
.prose figcaption {
  margin-top: .9rem;
  text-align: center;
  font-size: .88rem;
  color: var(--ink-faint);
}

.prose hr {
  border: 0;
  margin: 3rem auto;
  width: 7rem;
  height: 1.4rem;
  background:
    radial-gradient(circle at 50% 50%, var(--accent) 22%, transparent 24%) 0 0 / 2.33rem 100% repeat-x;
  opacity: .5;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  padding: .15em .45em;
  border-radius: 6px;
  background: var(--milk);
}
.prose pre {
  padding: 1.2rem 1.4rem;
  border-radius: 18px;
  background: color-mix(in oklab, var(--ink) 92%, var(--paper));
  color: var(--paper);
  overflow-x: auto;
  line-height: 1.7;
}
.prose pre code { background: none; padding: 0; color: inherit; }

.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { background: var(--milk); }

.prose strong { background: linear-gradient(transparent 62%, var(--apricot) 62%); font-weight: 700; }

/* 前後の記事 */
.article-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.25rem;
  margin-top: 4rem;
}
.article-nav a {
  display: block;
  padding: 1.15rem 1.4rem;
  background: var(--paper);
  border-radius: var(--wobble-1);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  transition: transform .3s var(--ease-soft), box-shadow .3s;
}
.article-nav a:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.article-nav span {
  display: block;
  font-family: var(--font-en);
  font-size: .78rem;
  letter-spacing: .12em;
  color: var(--ink-faint);
  margin-bottom: .3rem;
}
.article-nav a.is-next { text-align: right; }

/* ==========================================================================
   ボタン・ページ送り・空の状態
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .62rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: .97rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .3s var(--ease-soft), box-shadow .3s, filter .3s;
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); filter: brightness(1.04); color: #fff; }
.btn--quiet { background: var(--paper); color: var(--ink); }
.btn--quiet:hover { color: var(--ink); }

.pager { display: flex; justify-content: center; gap: 1rem; margin-top: 3.5rem; flex-wrap: wrap; }

.empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--ink-soft);
}
.empty svg { width: 8rem; height: 8rem; margin: 0 auto 1.5rem; opacity: .85; }

/* ==========================================================================
   フッター（丘のシルエット）
   ========================================================================== */
.site-footer { margin-top: auto; padding-top: 5rem; }
.site-footer__hills { display: block; width: 100%; height: auto; }
.site-footer__inner {
  background: var(--wakaba);
  padding: 1.5rem 0 2.5rem;
  text-align: center;
  font-size: .9rem;
  color: var(--ink-soft);
}
.site-footer__inner p { margin: .3rem 0; }
.site-footer__inner a { color: var(--ink-soft); }

main { padding-bottom: 2rem; }

/* ==========================================================================
   配慮
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .card { transform: none !important; }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; line-height: 1.85; }
  .hero { padding-top: 2.5rem; margin-bottom: 2.5rem; }
  .card-grid { gap: 1.5rem 1.25rem; }
  .card { transform: none; }
  .prose { font-size: 1.03rem; line-height: 1.95; }
}

@media print {
  body::before, .site-header, .site-footer, .article-nav { display: none; }
  body { background: #fff; }
}

/* 本文へ移動（キーボード操作のときだけ現れる） */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: .6rem 1.2rem;
  border-radius: 0 0 14px 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; }

/* ── 目次 ───────────────────────────────────────────────────── */
.toc {
  margin: 0 0 3rem;
  padding: 1.35rem 1.7rem;
  background: var(--milk);
  border-radius: var(--wobble-2);
}
.toc__label {
  margin: 0 0 .6rem;
  font-size: .88rem;
  letter-spacing: .1em;
  color: var(--ink-faint);
}
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li + li { margin-top: .35em; }
.toc a { color: var(--ink); text-decoration-color: var(--line); font-size: .96rem; }

/* ── タグ一覧ページ ─────────────────────────────────────────── */
.tag-list--large { gap: .7rem; }
.tag-list--large .tag { font-size: .98rem; padding: .4rem 1.2rem; }
.tag-list--large .tag small {
  margin-left: .5rem;
  font-family: var(--font-en);
  opacity: .6;
}

/* ── 下書きプレビューの帯 ───────────────────────────────────── */
.preview-banner {
  margin: 0 0 2rem;
  padding: .85rem 1.4rem;
  border-radius: 999px;
  background: var(--apricot);
  color: var(--ink);
  font-size: .92rem;
  text-align: center;
}
.preview-banner a { margin-left: .6rem; }
