/*
 * 越中ラボ（etchulab.com）の見た目。全ページ（トップ・記事一覧・記事・運営者・編集方針・プライバシーポリシー・404）で共有する。
 *
 * 方針: 白地、落ち着いた色、余白多め。漢方帖（深い緑・生成り・明朝の見出し）と onegai（白黒・ゴシック）の
 * どちらとも喧嘩しないよう、色は墨色と、漢方帖より彩度を落とした深い緑1色だけ。
 * 文字は本文もラベルも 16px 以上。外部フォントは読み込まない（端末に入っている字体を使う）。
 */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f6f7f5;
  --ink: #1d2522;          /* 本文。白地とのコントラスト 約15:1 */
  --ink-muted: #4f5a55;    /* 補足。白地とのコントラスト 約7:1 */
  --line: #dfe4e1;
  --accent: #23413a;       /* 越中ラボの色（ファビコンと同じ） */
  --link: #245747;         /* リンク。白地とのコントラスト 約8:1 */
  --kampo: #194b3d;        /* 漢方帖のテーマ色 */
  --onegai: #1a1a1a;       /* onegai の文字色 */
  --focus: #245747;
  --sans: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", Georgia, serif;
}

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

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

/* 中身が短いページでも、下の帯を画面の下端に置く */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
main { flex: 1 0 auto; }
/* .wrap の左右の余白（スマホで 20px）を、上下の余白を決める規則で消さないこと。上下は padding-top / padding-bottom で書く。 */

/* 上の帯（全ページ共通。左に越中ラボ、右に上部メニュー。スマホ幅ではメニューが2段目に回る） */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 24px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; color: var(--ink); font-family: var(--serif); font-size: 20px; letter-spacing: .08em; text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark { width: 28px; height: 28px; flex: 0 0 auto; }
/* 押しやすさのため、メニューの文字は高さ 44px の範囲を押せるようにする。幅 320px でも4つが1行に収まる間隔 */
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-weight: 600; text-decoration: none; }
.site-nav a:hover { color: var(--accent); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* トップの冒頭 */
.hero { padding: 56px 0 56px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 500; letter-spacing: .1em; line-height: 1.3; }
.hero-latin { display: block; margin-top: 4px; color: var(--ink-muted); font-family: var(--sans); font-size: 16px; font-weight: 400; letter-spacing: .2em; }
.lead { margin: 32px 0 0; font-size: 21px; font-weight: 600; line-height: 1.7; }
.hero p:not(.lead) { margin: 16px 0 0; color: var(--ink-muted); }

/* 節 */
.section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section h2 { margin: 0 0 24px; font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: .06em; line-height: 1.4; }
.section > p { margin: 0 0 16px; }

/* 提供しているもの */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.card { display: flex; flex-direction: column; min-width: 0; padding: 28px 24px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 8px; background: var(--bg); }
.card--kampo { border-top-color: var(--kampo); }
.card--onegai { border-top-color: var(--onegai); }
.card h3 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: .04em; line-height: 1.4; }
.card h3 .reading { font-family: var(--sans); font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--ink-muted); }
/* ラベルは見た目では見出しの上に出すが、読み上げでは見出しの後に読まれるよう、HTML では見出しの後に置いている */
.card-kind { order: -1; margin: 0 0 8px; color: var(--ink-muted); font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.card p { margin: 12px 0 0; }
.card .card-note { color: var(--ink-muted); }
.card-links { margin-top: auto !important; padding-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 22px; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: #ffffff; font-weight: 600; text-decoration: none; }
.button:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
.text-link { display: inline-flex; align-items: center; min-height: 48px; font-weight: 600; }

/* お問い合わせ（冒頭が越中ラボ全体の窓口、その下にサービスごとの窓口） */
.contact-main { margin: 0 0 48px; padding: 24px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.contact-main p { margin: 0; }
.contact-address { margin-top: 8px !important; font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.contact-address a { display: inline-block; padding: 6px 0; }
.contact-sub-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; line-height: 1.5; }
.contact-list { margin: 0; padding: 0; display: grid; gap: 16px; }
.contact-list > div { padding: 20px 24px; border-radius: 8px; background: var(--surface); }
.contact-list dt { margin: 0; font-weight: 700; }
.contact-list dd { margin: 4px 0 0; }
.contact-list dd + dd { margin-top: 4px; color: var(--ink-muted); }

/* トップの「読みもの」「運営と編集の方針」の案内のリンク */
.section-links { margin: 24px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }

/* 下の帯 */
.site-footer { margin-top: 24px; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { padding-top: 32px; padding-bottom: 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.site-footer p { margin: 0; }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.copyright { color: var(--ink-muted); }

/* 文書ページ（記事一覧・記事・運営者・編集方針・プライバシーポリシー） */
.doc { padding-top: 48px; padding-bottom: 32px; }
/* 見出しは幅 320px の画面でも1行に収まる大きさ（折り返すと「ー」や「ん」だけが次の行に落ちる） */
.doc h1 { margin: 0 0 8px; font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: .02em; line-height: 1.4; }
.doc .doc-meta { margin: 0 0 32px; color: var(--ink-muted); }
.doc h2 { margin: 48px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 21px; line-height: 1.5; }
.doc h3 { margin: 28px 0 8px; font-size: 18px; line-height: 1.5; }
.doc p { margin: 0 0 16px; }
.doc ul { margin: 0 0 16px; padding-left: 1.4em; }
.doc li { margin: 6px 0; }
.doc dl { margin: 0 0 16px; }
.doc dt { margin-top: 12px; font-weight: 700; }
.doc dd { margin: 2px 0 0; }
.doc ol { margin: 0 0 16px; padding-left: 1.6em; }
.doc .contact-address { margin: 0 0 16px; }
.doc .doc-date { margin-top: 48px; color: var(--ink-muted); }

/* 運営者（表のような並び。スマホでは見出しと中身が縦に並ぶ） */
.profile { margin: 0 0 16px; padding: 8px 24px 20px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.profile dt { margin-top: 12px; color: var(--ink-muted); font-weight: 600; }

/* 記事一覧 */
.article-list { list-style: none; margin: 0 0 16px; padding: 0 !important; display: grid; gap: 16px; }
.article-list li { margin: 0; padding: 20px 24px; border: 1px solid var(--line); border-radius: 8px; }
.article-list h3 { margin: 0; font-size: 18px; line-height: 1.5; }
.article-list p { margin: 6px 0 0; color: var(--ink-muted); }
.aside-box { margin: 32px 0 16px; padding: 20px 24px; border-radius: 8px; background: var(--surface); }
.aside-box p:last-child { margin-bottom: 0; }
.doc .aside-box h2 { margin: 0 0 8px; padding: 0; border: 0; font-size: 18px; }

/* 記事（雛形は templates/article.html） */
.article-byline { margin: 16px 0 32px; padding: 12px 20px 16px; border-radius: 8px; background: var(--surface); }
.article-byline dt { margin-top: 8px; color: var(--ink-muted); font-weight: 600; }
.article .lead-text { font-size: 18px; }
/* 出典は「※1」の番号を文字で書くので、リストの番号や点は付けない */
.doc .source-list { list-style: none; padding-left: 0; }
.source-list li { margin: 8px 0; }
.back-link { margin-top: 40px; }

/* 404 */
.not-found { padding-top: 72px; padding-bottom: 48px; }
.not-found h1 { margin: 0 0 16px; font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: 0; line-height: 1.4; }
.not-found ul { margin: 24px 0 0; padding-left: 1.4em; }
.not-found li { margin: 8px 0; }

@media (min-width: 480px) {
  .site-nav ul { gap: 0 24px; }
}

@media (min-width: 720px) {
  .hero { padding: 88px 0 80px; }
  .hero h1 { font-size: 52px; }
  .lead { font-size: 24px; }
  .section { padding: 72px 0; }
  .section h2 { font-size: 28px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .doc h1 { font-size: 36px; letter-spacing: .06em; }
  .not-found h1 { font-size: 32px; letter-spacing: .04em; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .brand { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}
