% Copyright 2026 Open-Guji (https://github.com/open-guji)
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
%     http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.

% luatex-cn-vbook-common.cfg
% Common configuration for vertical book layouts (cn-vbook and tw-vbook)
% Shared settings for modern vertical book typesetting
% Note: This file should be included by specific vbook variants

% ==========================================================================
% Page Geometry (16-kai: 170mm × 240mm)
% ==========================================================================
% Standard configuration for modern vertical books
% Two margin modes available:
%
% 1. Symmetric margins (default, for screen reading / single-sided printing)
%    margin-left = 22mm, margin-right = 18mm
%
% 2. Mirror margins (for binding / professional printing)
%    twoside = true, margin-inner = 18mm, margin-outer = 22mm
%    - Odd pages: left=inner (18mm), right=outer (22mm)
%    - Even pages: left=outer (22mm), right=inner (18mm)
%
\pageSetup{
    paper-width = 170mm,
    paper-height = 240mm,
    margin-top = 30mm,
    margin-bottom =20mm,
    % Default: Symmetric margins (uncomment line below to enable mirror margins)
    % margin-left = 22mm,
    % margin-right = 18mm,
    % For binding with mirror margins, uncomment these and comment margin-left/right:
    twoside = true,
    margin-inner = 16mm,
    margin-outer = 24mm,
    page-split-enabled = false,
    page-number-style = digits,
    page-number-font-size = 9pt,
    % Running header: book name (even) / chapter title (odd) on outer margin
    header-enabled = true,
    header-font-size = 9pt,
}

% ==========================================================================
% Content Configuration (Grid, Typography, and Border)
% ==========================================================================
% Natural layout mode: cell height follows font size, not fixed grid
% Suitable for modern, clean typography without rigid grid constraints
%
\contentSetup{
    % Font and grid settings
    font-size = 14pt,
    line-spacing = 14pt,
    grid-width = 25pt,
    grid-height = 14pt,
    % Center alignment for balanced appearance
    vertical-align = center,
    % No column divisions (n-column=0 means free mode)
    n-column = 0,
    % Natural layout: cell height follows font size (not fixed grid)
    layout-mode = natural,
    inter-cell-gap = 2pt,
    % No border for clean modern look
    border = false,
    % Paragraph indent: first line of each paragraph indented by 2 characters
    first-indent = 2,
}

% Note: punct-style is set per-variant (mainland vs taiwan)
% Note: 脚注设置 (footnote config) is set per-variant if needed

% ==========================================================================
% Book Title and Chapter Commands
% ==========================================================================

% \卷名{文字} - Book/Volume title (large font size)
% Used for titles like "史記卷十六" in vertical layout
% - spacing-top: right margin (towards book edge) for visual separation
% - spacing-bottom: left margin (towards binding) — gap before chapter title
% - grid-height: inter-character spacing within the title
%
\newcommand{\卷名}[1]{%
  \行[font-size=24pt, column-width=42pt, spacing-top=48pt, spacing-bottom=24pt, grid-height=34pt]{#1}%
}

% \章节名{文字} - Chapter/Section title (medium font size)
% Used for chapter titles like "秦楚之際月表第四"
% - spacing-bottom: left margin — gap before body text
% - grid-height: inter-character spacing within the title
% - Indent: 2-character top indent via \空格\空格 prefix
%
\newcommand{\章节名}[1]{%
  \行[font-size=20pt, column-width=28pt, spacing-bottom=18pt, grid-height=27pt]{\空格\空格#1}%
}
