/* 白磁（アプリ Chado/Shitsurai/Hakuji.swift・TextStyles.swift の値）。色と大きさは変数だけで持ち、本文に直接書かない。 */
@font-face {
  font-family: "Chado Mincho";
  src: url("/assets/fonts/shippori-mincho-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #f7f4ee;
  --bg-top: #fbf9f4;
  --bg-bottom: #f3efe6;
  --ink: #2b2a28;
  --ink-soft: #4a4946;
  --sub: #6e6b65;
  --line: #e3ded3;
  --accent: #b23a48; /* 点と線にだけ使う。字の色には使わない */
  --font: "Chado Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --gap-section: 30px;
  --gap-label: 18px;
  --tap: 44px;
}

html {
  font-size: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(rgba(120, 110, 90, .05) 1px, transparent 1.2px),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-size: 5px 5px, 100% 100%;
  background-repeat: repeat, no-repeat;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 768px) {
  html { font-size: 112.5%; }
}

body {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font);
  font-weight: 400;
  font-synthesis: none;
  font-size: .8125rem;       /* body 13px */
  letter-spacing: .06em;
  line-height: 1.95;
  line-break: strict;
  overflow-wrap: anywhere;
  padding: 0 28px;
}

header, nav, main, footer { max-width: 36rem; margin-left: auto; margin-right: auto; }
main { padding: 56px 0 48px; display: block; }
img { max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }
b, strong, em, i { font-weight: 400; font-style: normal; }

/* 文字の型 */
h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-weight: 400;
  font-size: 1.5rem;         /* pageTitle 24px */
  letter-spacing: .10em;
  line-height: 1.4;
}
.letter h1 {
  font-size: 2.5rem;         /* seasonTitle 40px */
  letter-spacing: .18em;
  line-height: 1.2;
}
.reading {
  margin-left: 14px;
  color: var(--sub);
  font-size: .8125rem;       /* seasonReading 13px */
  letter-spacing: .20em;
  line-height: 1.4;
}
.date, .kou-date {
  color: var(--sub);
  font-size: .8125rem;       /* date 13px */
  letter-spacing: .14em;
  line-height: 1.4;
}
.letter .date { margin: 0 0 var(--gap-section); }
.lead {
  margin: 0 0 var(--gap-section);
  padding-left: 12px;
  border-left: 1px solid var(--accent);
  color: var(--ink-soft);
  font-size: 1rem;           /* lead 16px */
  letter-spacing: .10em;
  line-height: 1.9;
}
h2 {
  margin: var(--gap-section) 0 var(--gap-label);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--sub);
  font-weight: 400;
  font-size: .65625rem;      /* sectionLabel 10.5px */
  letter-spacing: .24em;
  line-height: 1.4;
}
.item-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1.125rem;       /* itemTitle 18px */
  letter-spacing: .10em;
  line-height: 1.6;
}
.tool-item h2 {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  color: var(--ink);
  font-size: 1.125rem;
  letter-spacing: .10em;
  line-height: 1.6;
}
.caption, .stage-note, .note, .meta, .policy-dates, .policy-footer {
  color: var(--sub);
  font-size: .75rem;         /* caption 12px */
  letter-spacing: .06em;
  line-height: 1.4;
}
.stage-note, .note { line-height: 1.8; }
.story { line-height: 2.0; }
p { margin: 0 0 12px; }
.w { white-space: nowrap; }

/* 節 */
section { margin: 0 0 var(--gap-section); }
section > h2:first-child { margin-top: 0; }
.sweet h2::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.kou li { margin: 0 0 14px; }
.kou-head { margin: 0 0 2px; color: var(--ink); }
.kou .caption { margin: 0 0 2px; }
.tool-item { padding-top: 6px; border-top: 1px solid var(--line); }
.tool-item:first-of-type { margin-top: var(--gap-section); }

/* 一覧 */
.lesson-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.125rem;
  letter-spacing: .10em;
  line-height: 1.6;
}
.state { margin-left: 8px; color: var(--sub); font-size: .75rem; letter-spacing: .06em; line-height: 1.4; }
.letter-list a, .tool-list a {
  display: block;
  padding: 10px 0;
  min-height: var(--tap);
  box-sizing: border-box;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
}
.name { color: var(--ink); font-size: 1.125rem; letter-spacing: .10em; }

/* リンク */
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.go {
  display: inline-block;
  padding: 12px 0;
  min-height: var(--tap);
  box-sizing: border-box;
  font-size: .75rem;         /* link 12px */
  letter-spacing: .20em;
  line-height: 1.4;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}
.quiet, .quiet a { color: var(--sub); }
.quiet a, .prevnext a, .crumb a, .site-footer a, .site-header nav a {
  display: inline-block;
  padding: 12px 0;
  min-height: var(--tap);
  box-sizing: border-box;
  font-size: .75rem;
  letter-spacing: .20em;
  line-height: 1.4;
}
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 上下の案内 */
.site-header { padding: 20px 0 0; }
.site-header .site-name {
  display: inline-block;
  padding: 10px 0;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: .10em;
  text-decoration: none;
}
.site-header ul, .site-footer ul, .crumb ol { display: flex; flex-wrap: wrap; gap: 0 18px; }
.site-header nav a, .site-footer a { color: var(--sub); text-decoration: none; }
.crumb { color: var(--sub); }
.crumb li + li::before { content: "›"; margin-right: 8px; color: var(--sub); }
.crumb a { color: var(--sub); text-decoration: none; }
.site-footer { padding: 18px 0 48px; border-top: 1px solid var(--line); }

/* 便りの終わり・前後 */
.letter-end { margin-top: var(--gap-section); padding-top: 18px; border-top: 1px solid var(--line); }
.prevnext { margin-top: 6px; }
.appstore { color: var(--ink); }

/* トップの画面写真 */
.shots { display: flex; gap: 10px; margin: 24px 0; }
.shots img { flex: 1 1 0; min-width: 0; border: 1px solid var(--line); }
.subtitle { margin: 0 0 var(--gap-section); color: var(--sub); letter-spacing: .14em; }

/* 画面の言葉・設定アプリの言葉 */
.ui, .ios { color: var(--ink); }

/* 定義・ポリシー */
dt { margin-top: 14px; color: var(--sub); font-size: .75rem; letter-spacing: .14em; line-height: 1.4; }
dd { margin: 2px 0 0; }
.policy ul { margin: 0 0 12px; }
.policy li { position: relative; padding-left: 14px; }
.policy li::before { content: ""; position: absolute; left: 2px; top: .95em; width: 3px; height: 3px; border-radius: 50%; background: var(--sub); }
.policy h2 { margin-top: var(--gap-section); }

/* ===== 案A「縦書きと余白」（社長の決め 2026-11-25・S1）=====
   縦に組むのは名前だけ（トップの題と一句・各ページの大見出し・便りの頭・一覧の季節と短冊）。本文は横のまま。動きは入れない。
   静けさは字の向きと大きな間で出す。色は上の変数だけ。カード・影・角丸は使わない。
   包む div（.hero・.page-head・.letter-head・.season）と body の class（.p-top・.p-koyomi・.p-letter）は書き出しが出す
   （tools/sitelib/render.py・letters.py・learn_tools.py・content/pages/）。 */

/* 縦書きの字。切り出した書体は縦の形（vert・vrt2）を落としてあるので、縦で形と位置の変わる字
   （、。（）「」ー ― … と小さい仮名など＝tools/sitelib/fontchars.py の VERTICAL_FORMS）だけを端末の明朝
   （縦の形を持つ）へ回す。ほかの字はしっぽり明朝のまま。範囲は tools/check-fonts.py の⑤が確かめる。 */
@font-face {
  font-family: "Chado Mincho Tate";
  src: url("/assets/fonts/shippori-mincho-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0-2012, U+2016-2024, U+2027-3000, U+3003-3007, U+3012-3013, U+3020-3040,
    U+3042, U+3044, U+3046, U+3048, U+304A-3062, U+3064-3082, U+3084, U+3086, U+3088-308D, U+308F-3094, U+3097-309A, U+309D-30A0,
    U+30A2, U+30A4, U+30A6, U+30A8, U+30AA-30C2, U+30C4-30E2, U+30E4, U+30E6, U+30E8-30ED, U+30EF-30F4, U+30F7-30FB, U+30FD-31EF,
    U+3200-FF00, U+FF02-FF07, U+FF0A-FF0B, U+FF0D, U+FF0F-FF19, U+FF1C, U+FF1E, U+FF20-FF3A, U+FF3C, U+FF3E-FF5A, U+FF5C, U+FF61-10FFFF;
}

:root {
  --font-tate: "Chado Mincho Tate", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --gap-section: 44px;       /* 節と節の間（上の 30px から広げる） */
  --ma: 72px;                /* 大きな間（ページの頭の前後） */
  --rule: 1px solid var(--line);
}
@media (min-width: 768px) {
  :root { --gap-section: 60px; --ma: 120px; }
}

main { padding-top: var(--ma); padding-bottom: var(--ma); }
.site-footer { padding-top: 24px; }
h2 { margin-top: calc(var(--gap-section) + 12px); }
.crumb ol { align-items: baseline; }   /* 「ホーム」だけ下がっていたのを揃える */
.lead { text-wrap: pretty; }           /* 最後の行に1〜2字だけ残さない（効かない端末では今までどおり） */

/* 縦に組む物の共通 */
.hero h1, .hero .subtitle,
.page-head h1,
.season h2, .season .letter-list li,
.letter-head h1, .letter-head .date, .letter-head .lead {
  writing-mode: vertical-rl;
  font-family: var(--font-tate);
  height: max-content;       /* 画面の高さで折り返しが変わらないように、高さは字で決める */
}

/* ── トップ: 右に縦の題と一句、左下に横の一文 ── */
.hero {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 0 0 var(--ma);
}
.hero-title { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 12px; flex: none; }
.hero h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: .22em;
  line-height: 1.5;
}
.hero .subtitle {
  margin: 7.5em 0 0;
  color: var(--sub);
  font-size: .875rem;
  letter-spacing: .34em;
  line-height: 1.4;
}
.hero-text { flex: 1 1 auto; max-width: 20rem; }
.hero .lead { margin: 0 0 22px; }
.hero .appstore { margin: 0; color: var(--sub); }
.p-top .shots { margin: 0 0 var(--ma); gap: 14px; }
@media (min-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .hero .subtitle { margin-top: 8.5em; font-size: .9375rem; }
}

/* 机の画面のトップ: 節の見出しを左の列、本文を右の列に（案B の並べ方だけ。字と順は変えない） */
@media (min-width: 768px) {
  .p-top main { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); }
  .p-top main > * { grid-column: 2; }
  .p-top main > .hero, .p-top main > .shots { grid-column: 1 / -1; }
  .p-top main > h2, .p-top main > h2 + p {
    margin-top: calc(var(--gap-section) + 12px);
    padding-top: 18px;
    border-top: var(--rule);   /* 見出しの列と本文の列で1本の線 */
  }
  .p-top main > .shots + h2, .p-top main > .shots + h2 + p { margin-top: 0; }   /* 画面写真の下の大きな間だけにする */
  .p-top main > h2 { grid-column: 1; margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
  .p-top main > h2 + p { margin-bottom: 12px; }
}

/* ── ページの頭: 右に縦の大見出し、左に横の一文（導入・前置き） ── */
.page-head {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 24px;
  margin: 0 0 var(--ma);
}
.page-head h1 { flex: none; margin: 0; font-size: 1.75rem; letter-spacing: .24em; line-height: 1.5; }
.page-head > :not(h1) {
  flex: 1 1 auto;
  max-width: 22rem;
  margin: 3.2rem 0 0;
}
.page-head .lead {
  padding: 0 20px 0 0;
  border-left: 0;
  border-right: 1px solid var(--accent);
}
.page-head-text p:last-child { margin-bottom: 0; }
@media (min-width: 768px) {
  .page-head > :not(h1) { max-width: 24rem; }
}

/* ── 便りの一覧: 季節ごとに暦の一枚（右から左へ短冊を縦の罫で区切る） ── */
.season {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 14px;
  padding: 36px 0 48px;
  border-top: var(--rule);
}
.season h2 {
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  font-size: 1.375rem;
  letter-spacing: 0;
  line-height: 1;
}
.season .letter-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row-reverse;   /* 右から左へ、暦をめくる向き */
  flex-wrap: wrap;
  row-gap: 22px;
}
.season .letter-list li {
  flex: 0 0 50%;
  box-sizing: border-box;
  border-left: var(--rule);
}
.season .letter-list li:nth-child(odd) { border-right: var(--rule); }
.season .letter-list a {
  display: flex;                 /* 縦の中の flex: 1行目＝名、2行目＝日付、3行目から＝ひとこと */
  flex-wrap: wrap;
  align-content: center;         /* 列を短冊の真ん中に */
  width: 100%;                   /* 短冊の幅いっぱい（押せる所も短冊全体） */
  height: 16.5rem;
  min-height: 0;
  box-sizing: border-box;
  padding: 14px 8px 12px;
  border: 0;
  color: var(--ink-soft);
  font-size: .8125rem;
  letter-spacing: .08em;
  line-height: 1.8;
  text-wrap: balance;            /* ひとことの列の長さを揃える（「頃。」だけの列を作らない） */
  /* word-break: auto-phrase は入れない（芒種のひとことが3列になり、短冊が太って段から落ちた＝S1 直し第1回） */
}
/* 幅 375px 未満の電話: 短冊1枚が約114px しかなく、芒種のひとことが3列（約133px）だと段から落ちる。
   短冊を高くして2列に収める（375px 以上は見本と同じ高さ）。 */
@media (max-width: 374.98px) {
  .season .letter-list a { height: 20rem; }
}
.season .letter-list .name {
  flex: none;
  color: var(--ink);
  font-size: 1.0625rem;
  letter-spacing: .14em;
  line-height: 1.45;
}
.season .letter-list .date {
  flex: 0 0 100%;
  box-sizing: border-box;
  padding-top: 2.2em;
  font-size: .75rem;
  letter-spacing: .16em;
  line-height: 1.7;
}
.season .letter-list a:hover .name { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 6px; }

@media (min-width: 768px) {
  .p-koyomi .site-header, .p-koyomi .crumb, .p-koyomi main, .p-koyomi .site-footer { max-width: 50rem; }
  .p-koyomi .site-header nav, .p-koyomi .site-footer nav { max-width: none; margin: 0; }
  .season { gap: 22px; padding: 44px 0 56px; }
  .season .letter-list { row-gap: 0; }
  /* 6枚を同じ幅で1段に。ただし短冊は字（列）より細くならない（幅 768〜824px では、ひとことが2列の短冊だけ少し太く、
     ほかが少し細くなって1段に収まる。それより広い幅では6枚とも同じ幅＝見本どおり） */
  .season .letter-list li { flex: 1 1 4rem; }   /* 6枚とも同じ 4rem から同じだけ伸ばす（0 だと右端の1枚だけ罫1本ぶん太る） */
  .season .letter-list li:nth-child(odd) { border-right: 0; }
  .season .letter-list li:first-child { border-right: var(--rule); }
  .season .letter-list a { height: 19rem; padding: 16px 8px; }   /* 列は真ん中に寄せるので、左右の空きは細い幅で効くだけ */
}

/* ── 便り1通: 右から 節気の名・よみ・日付・ひとこと（七十二候から下は横のまま） ── */
.letter-head {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;              /* 狭い画面で長いひとこと（幅320の芒種）が入りきらないときだけ、ひとことを下の段へ */
  align-items: flex-start;
  row-gap: 28px;
  margin: 0 0 var(--ma);
}
.letter-head h1 {
  flex: none;
  margin: 0;
  font-size: 2.75rem;
  letter-spacing: .2em;
  line-height: 1.4;
}
.letter-head h1 .reading {
  display: block;               /* 名の左に、よみの列 */
  margin: 0 12px 0 0;
  padding-top: 2.6em;
  font-size: .8125rem;
  letter-spacing: .34em;
}
.letter-head .date {
  flex: none;
  margin: 0 40px 0 0;
  padding-top: 7.5em;
  letter-spacing: .2em;
}
.letter-head .lead {
  flex: none;
  max-height: 21rem;            /* 長いひとこと（芒種など）は列を分ける */
  text-wrap: balance;
  word-break: auto-phrase;      /* 列の切れ目を文節に（「ほ／ぼ同じ」のように語の途中で切らない。効かない端末では今までどおり） */
  margin: 0 26px 0 0;
  padding: 2em 18px 0 0;
  border-left: 0;
  border-right: 1px solid var(--accent);
  font-size: 1.0625rem;
  letter-spacing: .18em;
  line-height: 1.9;
}
/* 2列以上に分かれるひとことは、箱（＝右の紅の線）を字の列の長さにそろえる。
   21rem のままだと balance で字の列だけ短くなり、線が字の1.5〜2倍に伸びる（秋分など）。
   1列の字数 N は書き出しが字数から決めて、頭の div に lead-col-N を付ける（tools/sitelib/letters.py の lead_column_chars・
   N は 9〜16＝試験が全部あることを確かめる）。1字＝1em＋字間 .18em。 */
.lead-col-9 { --lead-col: 9; }
.lead-col-10 { --lead-col: 10; }
.lead-col-11 { --lead-col: 11; }
.lead-col-12 { --lead-col: 12; }
.lead-col-13 { --lead-col: 13; }
.lead-col-14 { --lead-col: 14; }
.lead-col-15 { --lead-col: 15; }
.lead-col-16 { --lead-col: 16; }
.letter-head[class*="lead-col-"] .lead { max-height: calc(var(--lead-col) * 1.18em + .1em); }
.p-letter .letter section { margin-bottom: var(--gap-section); }
.p-letter .kou li { margin-bottom: 20px; }
.p-letter .letter-end { margin-top: var(--ma); padding-top: 28px; }
