/*
 * site.css — CoaRaMause のページ（scripts/build-pages.mjs が作る）のスタイル
 *
 * Django 版から引き継いだ CSS は使わず、このファイルだけで完結させる。
 * ページは build-pages.mjs が site.css?v=<内容のハッシュ> で読み込むので、このファイルを変えれば
 * ブラウザーやキャッシュに古い版が残っていても新しい版が読み込まれる。
 */

:root {
  --bg: #fbf8fa;
  --surface: #ffffff;
  --ink: #2a2529;
  --muted: #6d6369;
  --line: #e9dfe5;
  --accent: #a3577e;
  --accent-ink: #ffffff;
  --accent-soft: #f6eaf2;
  --teal: #237f8a;
  --green-soft: #eef1df;
  --code-bg: #f7f5f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 30, 45, 0.06), 0 6px 18px rgba(60, 30, 45, 0.07);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans KR", "Apple SD Gothic Neo",
    "Malgun Gothic", "Yu Gothic", Meiryo, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

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

a {
  color: var(--teal);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

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

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  padding: 6px 12px;
  background: var(--surface);
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.lang-bar {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
}

.lang-bar .wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
}

.lang-bar .lang-label {
  margin-right: 6px;
  opacity: 0.85;
}

.lang-bar a,
.lang-bar span[aria-current] {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--accent-ink);
  text-decoration: none;
  line-height: 1.6;
}

.lang-bar a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--accent-ink);
}

.lang-bar span[aria-current] {
  background: var(--accent-ink);
  color: var(--accent);
  font-weight: 700;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.brand-name {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-tagline {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   本文の共通
   --------------------------------------------------------------------------- */

main {
  padding: 32px 0 64px;
}

h1,
h2,
h3 {
  line-height: 1.4;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4.5vw, 34px);
}

.page-lead {
  margin: 0 0 28px;
  color: var(--muted);
}

.panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------------------
   コース一覧（トップ）
   --------------------------------------------------------------------------- */

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.category-nav a {
  display: inline-block;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.category-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category {
  margin: 0 0 44px;
  scroll-margin-top: 16px;
}

.category h2 {
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 5px solid var(--accent);
  font-size: 22px;
}

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

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(60, 30, 45, 0.08), 0 12px 28px rgba(60, 30, 45, 0.12);
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 7 / 4;
  object-fit: cover;
  background: var(--accent-soft);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

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

.card-meta {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------------------
   コースのページ
   --------------------------------------------------------------------------- */

.breadcrumb {
  margin: 0 0 20px;
  font-size: 14px;
}

.course-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 32px;
}

.course-head img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.course-meta {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--ink);
  font-size: 13px;
}

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

.toc {
  margin: 0 0 40px;
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.toc ol {
  margin: 0;
  padding-left: 1.4em;
}

.module {
  margin: 0 0 48px;
  scroll-margin-top: 16px;
}

.module-title {
  margin: 0 0 8px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
}

.module-desc {
  margin: 0 0 16px;
  color: var(--muted);
}

.post {
  margin: 0 0 28px;
}

.post-title {
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-soft);
  color: var(--teal);
  font-size: 19px;
}

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

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

.post-image {
  margin: 0;
  text-align: center;
}

.post-image img {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.post pre[class*="language-"] {
  margin: 0;
  border-radius: 10px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
}

.post code[class*="language-"] {
  font-family: var(--mono);
  white-space: pre;
}

.course-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

/* ---------------------------------------------------------------------------
   プロフィール・利用規約
   --------------------------------------------------------------------------- */

.profile {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.profile img {
  display: block;
  width: 200px;
  height: auto;
  border-radius: 50%;
  background: var(--accent-soft);
}

.profile h2 {
  margin: 28px 0 8px;
  font-size: 20px;
}

.profile p {
  margin: 0 0 14px;
}

.mail {
  font-weight: 700;
}

.terms-actions {
  margin: 0 0 20px;
}

.button {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  background: #8b4569;
  color: var(--accent-ink);
}

.terms-text {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.95;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------------------
   フッター
   --------------------------------------------------------------------------- */

.site-footer {
  padding: 24px 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

@media (max-width: 720px) {
  main {
    padding-top: 24px;
  }

  .course-head {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .profile {
    grid-template-columns: 1fr;
  }

  .profile img {
    width: 140px;
  }

  .panel {
    padding: 18px;
  }

  .module-title {
    font-size: 19px;
  }
}
