/* =========================================================================
   cf-websites-sample — 共有スタイル
   デザイン方針: モダンなテック系（ダーク/ライト自動 · サンセリフ本文 · 等幅メタ）
   すべての記事・ページはこの1枚に寄せる。記事ごとに独自スタイルを増やさない。
   ========================================================================= */

/* ---- デザイントークン ------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* 面と境界 */
  --bg:            light-dark(#fbfbfd, #0b0e14);
  --surface:       light-dark(#ffffff, #12161f);
  --surface-2:     light-dark(#f4f6f9, #171c27);
  --border:        light-dark(#e5e8ee, #242c3a);

  /* 文字 */
  --text:          light-dark(#171a21, #e7eaf1);
  --text-muted:    light-dark(#5c6675, #8b95a8);

  /* アクセント（テックブルー） */
  --accent:        light-dark(#0b62f5, #5aa2ff);
  --accent-strong: light-dark(#0a4fc4, #7db6ff);
  --accent-soft:   light-dark(#e9f0ff, #14223d);

  /* タイポグラフィ */
  --font-sans: system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
               "Noto Sans JP", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo,
               "Cascadia Code", monospace;

  /* 流体タイポ */
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.36rem + 0.7vw, 1.95rem);
  --step-3:  clamp(2rem, 1.7rem + 1.5vw, 3rem);

  /* レイアウト */
  --measure: 42rem;          /* 本文の読みやすい行長 */
  --wrap:    64rem;          /* ページ全体の最大幅 */
  --radius:  14px;
  --gap:     clamp(1rem, 0.6rem + 2vw, 2rem);
}

/* ---- リセット寄りの基礎 ---------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-block-size: 100dvb;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-inline-size: 100%; block-size: auto; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

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

/* ---- ページの器 ------------------------------------------------------- */
.wrap {
  inline-size: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}

/* ---- サイトヘッダー / フッター ---------------------------------------- */
.site-header {
  border-block-end: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
}
.site-header__inner {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1rem;
}
.site-title {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
.site-title span { color: var(--accent); }
.site-nav {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.site-footer {
  margin-block-start: 4rem;
  border-block-start: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--step--1);
}
.site-footer__inner {
  padding-block: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.site-footer code { font-family: var(--font-mono); }

/* ---- トップ: ヒーロー ------------------------------------------------- */
.hero { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) 1rem; }
.hero h1 {
  font-size: var(--step-3);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.hero p {
  max-inline-size: var(--measure);
  color: var(--text-muted);
  margin: 0;
}

/* ---- トップ: 記事一覧（カードグリッド） ------------------------------- */
.post-grid {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.post-card a { text-decoration: none; color: inherit; }
.post-card__thumb {
  aspect-ratio: 16 / 9;
  inline-size: 100%;
  object-fit: cover;
  background: var(--surface-2);
  border-block-end: 1px solid var(--border);
}
.post-card__body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.post-card__title { font-size: var(--step-1); font-weight: 650; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
.post-card__excerpt { color: var(--text-muted); font-size: var(--step--1); margin: 0; }
.post-card__date {
  margin-block-start: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

/* ---- 記事ページ ------------------------------------------------------- */
.article { padding-block: clamp(2rem, 1.2rem + 3vw, 3.5rem); }
.article__header { max-inline-size: var(--measure); margin-inline: auto; }
.article__meta {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.article__title {
  font-size: var(--step-3);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.article__hero {
  inline-size: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-block: 1.5rem 0;
}

/* 本文: 読みやすい行長で中央寄せ。要素ごとのリズムを縦マージンで。 */
.article__body {
  max-inline-size: var(--measure);
  margin-inline: auto;
  margin-block-start: 2rem;
}
.article__body > * + * { margin-block-start: 1.25rem; }
.article__body h2 {
  font-size: var(--step-2);
  letter-spacing: -0.01em;
  margin-block-start: 2.5rem;
  line-height: 1.25;
}
.article__body h3 { font-size: var(--step-1); margin-block-start: 2rem; }
.article__body img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}
.article__body figure { margin: 2rem 0; }
.article__body figcaption {
  font-size: var(--step--1);
  color: var(--text-muted);
  text-align: center;
  margin-block-start: 0.6rem;
}
.article__body blockquote {
  margin: 0;
  padding-inline-start: 1.1rem;
  border-inline-start: 3px solid var(--accent);
  color: var(--text-muted);
}
.article__body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}
.article__body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.6;
}
.article__body pre code { all: unset; font-family: inherit; }

/* 記事末尾の一覧へ戻る導線 */
.article__back {
  max-inline-size: var(--measure);
  margin: 3rem auto 0;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
.article__back a { text-decoration: none; }
.article__back a::before { content: "← "; }

/* ---- 404 -------------------------------------------------------------- */
.notfound { padding-block: clamp(4rem, 2rem + 8vw, 8rem); text-align: center; }
.notfound h1 { font-size: var(--step-3); margin: 0 0 0.5rem; }
.notfound p { color: var(--text-muted); }

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