/*
 * sakaiyoshiki.dev のスタイル（design.md §6）
 * モノトーン・ライトモードのみ。余白とタイポグラフィで階層を表す。
 * 罫線は、範囲を示す必要がある部品（カード・コードブロック・表）にだけ使う。
 */

/* ---------- フォント ---------- */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- デザイントークン ---------- */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-muted: #f2f2f2;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --text: #111111;
  --text-muted: #666666;
  --accent: #000000;

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

  --container: 1080px;
  --measure: 720px;
  --gutter: 24px;
  --radius: 10px;
  --radius-small: 6px;
}

/* ---------- ベース ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

::selection {
  background: var(--text);
  color: var(--bg);
}

h1,
h2,
h3,
h4 {
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-small);
  z-index: 10;
}

.skip-link:focus {
  top: 8px;
}

/* ---------- ヘッダー・フッター ---------- */


.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.site-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-small);
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-muted);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

main {
  padding-block: 48px 96px;
}

.site-footer {
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 32px;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- 共通部品 ---------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 40px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
}

.page-header a,
.more-link a {
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
}

.page-header a:hover,
.more-link a:hover {
  color: var(--text);
}

.page-lead {
  flex-basis: 100%;
  color: var(--text-muted);
}

.page-lead p {
  margin: 0;
}

.more-link {
  margin: 16px 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-small);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.button:hover {
  background: #333333;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li,
.chips a {
  display: inline-block;
  padding: 1px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.8;
  text-decoration: none;
}

.chips li:has(> a) {
  padding: 0;
  border: 0;
}

.chips a:hover {
  border-color: var(--text);
  color: var(--text);
}

.chips-large a {
  padding: 4px 14px;
  font-size: 15px;
}

.count {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-muted);
}

.callout {
  margin-top: 40px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

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

.hero {
  display: flex;
  align-items: center;
  gap: 40px;
  padding-block: 24px 64px;
}

.hero-photo {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

.hero-name {
  margin: 0;
  font-size: clamp(36px, 6vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-lead {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 18px;
}

.hero-lead p {
  margin: 0;
}

.home-section {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 24px 32px;
  padding-block: 56px;
}

.home-section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-section-body > :first-child {
  margin-top: 0;
}

.home-section-body > :last-child {
  margin-bottom: 0;
}

/* ---------- デモ ---------- */

.demo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s ease;
}

.demo-card:hover {
  border-color: var(--border-strong);
}

.demo-shot {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.demo-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.demo-title {
  margin: 0;
  font-size: 18px;
}

.demo-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.demo-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: auto 0 0;
  padding-top: 4px;
  font-size: 14px;
}

/* ---------- 記事一覧 ---------- */

.article-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-list li {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding-block: 10px;
}

.article-list time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.article-list a {
  font-weight: 500;
  text-decoration: none;
}

.article-list a:hover {
  text-decoration: underline;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  font-size: 14px;
}

.pagination a {
  text-decoration: none;
}

.pagination a:hover {
  text-decoration: underline;
}

.pagination-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- 記事 ---------- */

.article {
  max-width: var(--measure);
  margin-inline: auto;
}

.article-header {
  margin-bottom: 48px;
}

.article-header h1 {
  margin: 8px 0 20px;
  font-size: clamp(28px, 4.5vw, 40px);
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
}

.article-nav a {
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
}

.article-nav a:hover {
  border-color: var(--text);
}

.article-nav span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}

.article-nav-next {
  grid-column: 2;
  text-align: right;
}

/* ---------- 本文（Markdown） ---------- */

.prose {
  overflow-wrap: anywhere;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose blockquote,
.prose .highlight {
  margin-block: 0 1.5em;
}

.prose h2 {
  margin: 2.5em 0 1em;
  font-size: 24px;
}

.prose h3 {
  margin: 2em 0 0.75em;
  font-size: 19px;
}

.prose h4 {
  margin: 1.75em 0 0.5em;
  font-size: 16px;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li + li {
  margin-top: 0.25em;
}

.prose img {
  display: block;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prose hr {
  margin-block: 3em;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose blockquote {
  margin-inline: 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 3px solid var(--text);
  color: var(--text-muted);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  border-bottom-color: var(--text);
  font-weight: 600;
}

.prose code {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--bg-muted);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.prose .highlight {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.prose .highlight pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
}

.prose .highlight code,
.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* 見出しのパーマリンク（¶）はホバー時だけ表示する */
.headerlink {
  margin-left: 0.4em;
  color: var(--border-strong);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

:is(h1, h2, h3, h4):hover .headerlink,
.headerlink:focus-visible {
  opacity: 1;
}

/* ---------- 404 ---------- */

.not-found {
  padding-block: 64px;
  text-align: center;
}

.not-found-code {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
}

.not-found h1 {
  margin: 8px 0 16px;
  font-size: clamp(28px, 4vw, 40px);
}

.not-found-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
}

/* ---------- 狭い画面 ---------- */

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }

  main {
    padding-block: 32px 64px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding-block: 8px 40px;
  }

  .hero-photo {
    width: 112px;
    height: 112px;
  }

  .home-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding-block: 40px;
  }

  .home-section-title {
    font-size: 20px;
  }

  .article-list li {
    padding-block: 8px;
  }

  .article-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .article-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-nav-next {
    grid-column: 1;
  }

  .site-footer-inner {
    flex-direction: column;
    gap: 8px;
  }
}

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

/* ---------- 空の状態 ---------- */

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