@font-face {
    font-family: "Cinzel";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/cinzel-600-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Cinzel";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/cinzel-600-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Cinzel";
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url("/static/fonts/cinzel-700-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Cinzel";
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url("/static/fonts/cinzel-700-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400i-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/eb-garamond-400-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/eb-garamond-500-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/eb-garamond-600-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("/static/fonts/inter-400-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("/static/fonts/inter-500-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url("/static/fonts/inter-600-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Blu42 Library — reading-first theme.
   Themes via <html data-theme>: light (default), sepia, dark. */

:root {
    --bg: #faf7f0;
    --bg-elev: #ffffff;
    --bg-sunk: #f1ecdf;
    --ink: #2a2520;
    --ink-soft: #5f5748;
    --ink-faint: #8a8272;
    --line: #e2dac8;
    --accent: #8a5a2b;
    --accent-ink: #6f451e;
    --accent-soft: #f3e8d7;
    --link: #1d5c9e;
    --shadow: 0 1px 3px rgb(42 37 32 / .08), 0 8px 24px rgb(42 37 32 / .06);
    --shadow-lg: 0 2px 6px rgb(42 37 32 / .10), 0 16px 40px rgb(42 37 32 / .12);
    --radius: 10px;
    --font-ui: "Inter", system-ui, sans-serif;
    --font-display: "Cinzel", Georgia, serif;
    --font-body: "EB Garamond", Georgia, serif;
    --reader-size: 19px;
    --reader-line: 1.72;
    --measure: 42rem;
    --top-h: 56px;
}

html[data-theme="sepia"] {
    --bg: #f4ecd8;
    --bg-elev: #f9f3e3;
    --bg-sunk: #ece2c8;
    --ink: #43372a;
    --ink-soft: #6b5a45;
    --ink-faint: #93816a;
    --line: #ddcfb0;
    --accent: #8a5a2b;
    --accent-soft: #e9d9bd;
}

html[data-theme="dark"] {
    --bg: #161512;
    --bg-elev: #201e19;
    --bg-sunk: #0f0e0b;
    --ink: #e6dfd0;
    --ink-soft: #b3a893;
    --ink-faint: #857a66;
    --line: #37332a;
    --accent: #c99a5e;
    --accent-ink: #e0b478;
    --accent-soft: #2e2820;
    --link: #7fb3e8;
    --shadow: 0 1px 3px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / .45), 0 16px 40px rgb(0 0 0 / .5);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s, color .25s;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- top bar ---------- */

#top {
    position: sticky; top: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.top-inner {
    max-width: 74rem; margin: 0 auto;
    display: flex; align-items: center; gap: 1.25rem;
    padding: 0 1rem; height: var(--top-h);
}
.brand { display: flex; align-items: center; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-name {
    font-family: var(--font-display);
    font-weight: 700; font-size: 1.3rem; letter-spacing: .04em;
    color: var(--accent-ink);
}
#main-nav ul {
    display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0;
}
#main-nav a {
    display: block; padding: .45rem .75rem; border-radius: 7px;
    color: var(--ink-soft); font-weight: 500; font-size: .92rem;
}
#main-nav a:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.site-search input {
    width: 11rem; padding: .42rem .75rem;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg); color: var(--ink); font-size: .9rem;
    transition: width .2s, border-color .2s;
}
.site-search input:focus { width: 15rem; outline: none; border-color: var(--accent); }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2rem; height: 2rem; padding: 0 .45rem;
    border: 1px solid var(--line); border-radius: 7px;
    background: var(--bg-elev); color: var(--ink-soft);
    font-size: .95rem; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }

/* ---------- reading progress ---------- */

#reading-progress {
    position: fixed; top: 0; left: 0; z-index: 40;
    width: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-ink));
    transition: width .1s linear;
}

/* ---------- layout / ads ---------- */

#main {
    max-width: 76rem; margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
    position: relative;
}
.ad { text-align: center; }
.ad-top { margin: 0 auto 1.5rem; min-height: 60px; }
.ad-left, .ad-right {
    position: absolute; top: 4rem; width: 170px; min-height: 400px;
}
.ad-left { left: -190px; }
.ad-right { right: -190px; }
@media (max-width: 1280px) { .ad-left, .ad-right { display: none; } }

/* ---------- crumbs ---------- */

.crumbs {
    font-size: .85rem; color: var(--ink-faint);
    margin-bottom: 1.25rem;
}
.crumbs ol {
    display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
    list-style: none; margin: 0; padding: 0;
}
.crumbs a { color: var(--ink-soft); }
.crumbs .sep { color: var(--line); margin-left: .4rem; }
.crumbs .current { color: var(--ink-soft); }

/* ---------- generic page ---------- */

.page-single {
    max-width: var(--measure); margin: 0 auto 2rem;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow);
}
.kind-article .page-single { max-width: 54rem; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.9rem; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1.3rem; margin: 1.75rem 0 .75rem; }
h3 { font-size: 1.1rem; }
.meta { color: var(--ink-faint); font-size: .88rem; margin-bottom: 1rem; }
.kind-note { color: var(--accent-ink); font-size: .9rem; font-style: italic; }

.entry-content {
    font-family: var(--font-body);
    font-size: var(--reader-size);
    line-height: var(--reader-line);
}
.entry-content p { margin: 0 0 1.1em; }
.entry-content h2, .entry-content h3 { font-family: var(--font-display); }
.entry-content img { display: block; margin: 1.5rem auto; border-radius: 6px; }
.entry-content blockquote {
    margin: 1.5rem 0; padding: .5rem 1.25rem;
    border-left: 3px solid var(--accent);
    color: var(--ink-soft); font-style: italic;
}
.entry-content ul, .entry-content ol { padding-left: 1.5em; }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.1rem;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg-elev); color: var(--ink);
    font-family: var(--font-ui); font-size: .92rem; font-weight: 500;
    cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn.primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

/* ---------- card grid ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0 2rem;
}
.card {
    display: flex; flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden; color: var(--ink);
    transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.card img {
    width: 100%; aspect-ratio: 3 / 4; object-fit: contain;
    background: var(--bg-sunk);
    border-bottom: 1px solid var(--line);
}
.card-title {
    display: block; padding: .7rem .8rem .3rem;
    font-family: var(--font-display);
    font-size: .92rem; font-weight: 600; line-height: 1.3;
    color: var(--ink);
}
.card-meta {
    display: block; padding: 0 .8rem;
    font-size: .8rem; color: var(--ink-faint);
}
.card-desc {
    display: block; padding: .35rem .8rem .8rem;
    font-size: .82rem; color: var(--ink-soft);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta:last-child, .card-title:last-child { padding-bottom: .8rem; }

/* Article index: editorial list instead of the book-cover grid */
.article-list {
    display: block;
    max-width: var(--measure);
    margin: 0 auto 2rem;
}
.article-list .card {
    flex-direction: row; align-items: flex-start; gap: 1.5rem;
    background: transparent; border: none; border-radius: 0;
    border-top: 1px solid var(--line);
    padding: 1.6rem 0 1.7rem;
    overflow: visible;
}
.article-list .card-text {
    flex: 1 1 auto; min-width: 0;
    display: flex; flex-direction: column;
}
.article-list .card img {
    flex: 0 0 96px; width: 96px; aspect-ratio: 3 / 4;
    object-fit: cover;
    margin-top: .15rem;
    border: 1px solid var(--line); border-radius: 8px;
}
.article-list .card:first-child { border-top: none; padding-top: .4rem; }
.article-list .card:hover { transform: none; box-shadow: none; }
.article-list .card-meta {
    order: -1; padding: 0 0 .45rem;
    font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-faint);
}
.article-list .card-title { padding: 0; font-size: 1.45rem; line-height: 1.28; }
.article-list .card:hover .card-title { color: var(--accent-ink); }
.article-list .card-author { padding: .35rem 0 0; }
.article-list .card-desc {
    padding: .55rem 0 0; font-size: .98rem; line-height: 1.55;
    -webkit-line-clamp: 2;
}
.article-list .card-more {
    display: inline-block; padding: .55rem 0 0;
    font-size: .85rem; color: var(--accent-ink);
}
.article-list .card:hover .card-more { text-decoration: underline; }
@media (max-width: 560px) { .article-list .card img { flex-basis: 72px; width: 72px; } }

/* Article cover figure on the article page */
.article-hero {
    float: right;
    width: 25rem; max-width: 55%;
    margin: .2rem 0 1.1rem 1.6rem;
}
.article-hero img {
    display: block; width: 100%; height: auto;
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.kind-article .share { clear: both; }
@media (max-width: 640px) {
    .article-hero { float: none; width: auto; max-width: 30rem; margin: 0 auto 1.4rem; }
}

/* ---------- book landing ---------- */

.book-landing { max-width: 62rem; margin: 0 auto; }
.book-hero {
    display: grid; grid-template-columns: 220px 1fr; gap: 2rem;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.book-cover {
    width: 220px; aspect-ratio: 3 / 4; object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    background: var(--bg-sunk);
}
.book-meta h1 { margin-bottom: .4rem; }
.book-author, .book-year, .book-pages {
    margin: .2rem 0; color: var(--ink-soft); font-size: .95rem;
}
.book-author { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent-ink); }
.book-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.book-desc {
    margin: 1.5rem auto 0; max-width: var(--measure);
    color: var(--ink-soft);
}
@media (max-width: 640px) {
    .book-hero { grid-template-columns: 1fr; }
    .book-cover { margin: 0 auto; }
}

/* ---------- table of contents ---------- */

.toc {
    margin: 2rem auto 0; max-width: var(--measure);
    background: var(--bg-elev); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
}
.toc h2 { margin-top: 0; }
.toc ol { margin: 0; padding-left: 1.4rem; columns: 1; }
.toc li { margin: .35rem 0; font-family: var(--font-body); font-size: 1.05rem; }
.toc li a { color: var(--ink); }
.toc li a:hover { color: var(--accent-ink); }
.toc li.current a { font-weight: 700; color: var(--accent-ink); }

/* ---------- reader ---------- */

.book-layout { position: relative; }
.book-page {
    max-width: var(--measure); margin: 0 auto;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.5rem 2.75rem 2rem;
    box-shadow: var(--shadow);
}
@media (max-width: 640px) { .book-page { padding: 1.5rem 1.25rem; } }
.page-head h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.page-head { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
#toc-open { font-size: .85rem; }
.reader-tools {
    display: flex; gap: .5rem; align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--line); padding-bottom: 1rem;
}
.reader-tools .like-count { font-size: .8rem; }
.page-nav {
    display: flex; justify-content: space-between; gap: .75rem;
    margin-top: 2rem; padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.share {
    margin-top: 1.5rem; font-size: .85rem; color: var(--ink-faint);
    display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
}
.share a { display: inline-flex; align-items: center; gap: .3rem; }
.share svg { display: block; }
.share a.share-x { color: var(--ink-soft); }
.share a.share-fb { color: #1877f2; }
.share a.share-tg { color: #229ed9; }
.share a.share-pin { color: #e60023; }
.share a:hover { color: var(--accent-ink); }

/* Engagement bar under article titles */
.engage {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    margin: .85rem 0 1.75rem;
    font-family: var(--font-ui); font-size: .85rem; color: var(--ink-soft);
}
.engage-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    font: inherit; color: var(--ink-soft);
    background: var(--bg-elev); border: 1px solid var(--line);
    border-radius: 999px; padding: .35rem .85rem; cursor: pointer;
}
.engage-btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.engage-btn .like-count { font-size: .78rem; }
.engage-views { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-faint); }
.engage-share { display: inline-flex; align-items: center; gap: .45rem; margin-left: auto; flex-wrap: wrap; }
.engage-share-label { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--ink-faint); }
.engage-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink-soft);
}
.engage-ic.share-fb { color: #1877f2; }
.engage-ic.share-tg { color: #229ed9; }
.engage-ic.share-pin { color: #e60023; }
.engage-ic.share-wa { color: #25d366; }
.engage-ic:hover { border-color: currentColor; }
.copy-link.is-done { color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 720px) { .engage-share { margin-left: 0; } }

/* Original scan reader (archive.org embed) */
.orig-reader { display: flex; flex-direction: column; gap: 1rem; }
.orig-reader-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
}
.orig-reader-head h1 { margin: 0; font-size: 1.4rem; }
.orig-reader-head h1 a { color: inherit; text-decoration: none; }
.orig-reader-head h1 a:hover { color: var(--accent-ink); }
.orig-reader-tag { color: var(--ink-faint); font-size: .85rem; font-weight: 400; }
.orig-reader-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.orig-reader-frame {
    width: 100%;
    height: calc(100dvh - var(--top-h) - 130px);
    min-height: 640px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-elev);
}
.orig-reader-wrap { position: relative; }
.orig-reader-loading {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elev);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: opacity .3s ease;
}
.orig-reader-wrap.is-loaded .orig-reader-loading { opacity: 0; pointer-events: none; }
.orig-reader-spinner {
    width: 44px; height: 44px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--accent);
    animation: orig-reader-spin .8s linear infinite;
}
@keyframes orig-reader-spin { to { transform: rotate(1turn); } }

/* TOC drawer */
.book-toc {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: min(320px, 88vw); height: 100dvh;
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
body.toc-open .book-toc { transform: translateX(0); }
.toc-head {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.1rem;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
}
.toc-book {
    font-family: var(--font-display); font-weight: 600;
    color: var(--accent-ink); font-size: .95rem;
}
.book-toc ol { margin: 0; padding: 1rem 1.25rem 1.25rem 2.25rem; }
.book-toc li { margin: .45rem 0; font-family: var(--font-body); font-size: 1rem; }
.book-toc li a { color: var(--ink); }
.book-toc li.current > a { font-weight: 700; color: var(--accent-ink); }
.book-toc-backdrop {
    position: fixed; inset: 0; z-index: 45;
    background: rgb(0 0 0 / .4);
}
body.toc-open .book-toc-backdrop { display: block; }

/* Desktop: TOC as a persistent expanded left sidebar */
@media (min-width: 1024px) {
    .book-layout {
        display: grid;
        grid-template-columns: 285px minmax(0, 1fr);
        gap: 1.75rem;
        align-items: start;
    }
    .book-toc {
        position: sticky;
        top: calc(var(--top-h) + .75rem);
        transform: none;
        width: auto; height: auto;
        max-height: calc(100dvh - var(--top-h) - 1.5rem);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        z-index: 1;
    }
    body.toc-open .book-toc { transform: none; }
    body.toc-open .book-toc-backdrop { display: none; }
    #toc-close, #toc-open { display: none; }
    .book-page { margin: 0; }
}

/* ---------- search ---------- */

.search-page-form {
    display: flex; gap: .6rem; margin-bottom: 1.25rem;
}
.search-page-form input {
    flex: 1; padding: .6rem 1rem;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg); color: var(--ink); font-size: 1rem;
}
.search-count { color: var(--ink-faint); font-size: .9rem; }
.results { list-style: none; margin: 0; padding: 0; }
.results li {
    padding: .9rem 0; border-bottom: 1px solid var(--line);
}
.results li a { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.results li p { margin: .3rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.results mark { background: var(--accent-soft); color: var(--accent-ink); padding: 0 .15em; border-radius: 3px; }

/* ---------- pager ---------- */

.pager {
    display: flex; justify-content: center; gap: .35rem;
    margin: 2rem 0; flex-wrap: wrap;
}
.pager a, .pager span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.1rem; height: 2.1rem; padding: 0 .55rem;
    border: 1px solid var(--line); border-radius: 7px;
    background: var(--bg-elev); color: var(--ink-soft); font-size: .9rem;
}
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .ellipsis { border: none; background: none; }

/* ---------- footer ---------- */

#bottom {
    margin-top: 3rem;
    border-top: 1px solid var(--line);
    background: var(--bg-sunk);
}
.foot-inner {
    max-width: 74rem; margin: 0 auto;
    padding: 2.5rem 1rem 1.25rem;
    font-size: .85rem; color: var(--ink-faint);
}
.foot-grid {
    display: grid;
    grid-template-columns: minmax(15rem, 1.5fr) repeat(4, minmax(7.5rem, 1fr));
    gap: 1.5rem 2.5rem;
    padding-bottom: 2rem;
}
.foot-site {
    font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
    color: var(--ink);
}
.foot-site:hover { color: var(--accent-ink); text-decoration: none; }
.foot-desc { margin: .6rem 0 0; color: var(--ink-soft); max-width: 24rem; }
.foot-note { margin-top: .6rem; font-size: .8rem; }
.foot-col { display: flex; flex-direction: column; gap: .45rem; }
.foot-head {
    margin: 0 0 .35rem;
    font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--ink);
}
.foot-col a { color: var(--ink-soft); width: fit-content; }
.foot-col a:hover { color: var(--accent-ink); }
.foot-links {
    margin: 0 0 1rem; padding-top: 1rem;
    border-top: 1px solid var(--line);
}
.foot-links a { margin-right: .75rem; color: var(--ink-soft); font-size: .8rem; }
.foot-bottom {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem;
    border-top: 1px solid var(--line); padding-top: 1.25rem;
}
.copyright { margin-right: auto; color: var(--ink-faint); font-size: .8rem; }
.foot-langs { display: flex; gap: .5rem; }
.foot-langs a {
    padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px;
    color: var(--ink-soft); font-weight: 500; font-size: .8rem;
}
.foot-langs a:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.foot-langs a.current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.foot-top { color: var(--ink-soft); font-size: .8rem; }
.foot-top:hover { color: var(--accent-ink); }
@media (max-width: 900px) {
    .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foot-brand { grid-column: 1 / -1; }
}

/* ---------- like/fav buttons states ---------- */

.favorite-btn svg { display: block; }
.favorite-btn[data-on="1"], .favorite-btn.is-on { color: #c22; border-color: #c22; }
.favorite-btn.is-on svg { fill: currentColor; }
.like-btn { gap: .3rem; }
.like-btn svg { display: block; }
.like-btn.is-on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.like-btn.is-on svg { fill: currentColor; }

/* ---------- misc ---------- */

.hero {
    text-align: center; padding: 3rem 1rem 2rem;
}
.hero h1 { font-size: 2.4rem; }
.hero h1 .hero-brand { display: block; }
.hero h1 .hero-sub { display: block; margin-top: .45rem; font-size: 1.05rem; font-weight: 400; font-family: var(--font-body); color: var(--ink-soft); }
.hero p { color: var(--ink-soft); font-family: var(--font-body); font-size: 1.25rem; max-width: 40rem; margin: 0 auto; }
.section-title {
    font-size: 1.15rem; margin: 2.5rem 0 1rem;
    display: flex; align-items: baseline; gap: 1rem;
}
.section-title a { font-size: .85rem; font-family: var(--font-ui); font-weight: 500; margin-left: auto; }
.empty-note { color: var(--ink-faint); text-align: center; padding: 3rem 0; font-family: var(--font-body); font-size: 1.15rem; }

/* ---------- lightbox ---------- */

#lightbox {
    position: fixed; inset: 0; z-index: 60;
    display: none; align-items: center; justify-content: center;
    background: rgb(0 0 0 / .82); cursor: zoom-out;
    padding: 3vmin;
}
#lightbox.on { display: flex; }
#lightbox img {
    max-width: 94vw; max-height: 94vh;
    border-radius: 4px; box-shadow: var(--shadow-lg);
}
.entry-content img { cursor: zoom-in; }

/* ---------- cookie banner ---------- */

.cookie-bar {
    position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
    z-index: 55; max-width: 40rem; width: calc(100% - 2rem);
    display: flex; align-items: center; gap: 1rem;
    background: var(--bg-elev); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .8rem 1.1rem;
    box-shadow: var(--shadow-lg); font-size: .88rem;
}
.cookie-bar p { margin: 0; color: var(--ink-soft); }
.cookie-bar .btn { flex-shrink: 0; }

/* ---------- reader compatibility + professional polish ---------- */

/* map standalone-reader CSS vars used inside imported book bodies */
:root, html[data-theme="sepia"], html[data-theme="dark"] {
    --font-heading: var(--font-display);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-soft);
    --text-muted: var(--ink-faint);
    --bg-surface: var(--bg-elev);
    --bg-sidebar: var(--bg-sunk);
    --card-bg: var(--bg-elev);
    --border: var(--line);
    --border-light: var(--line);
}

/* active menu / language */
#main-nav li.current-menu-item a { background: var(--accent-soft); color: var(--accent-ink); }
.foot-langs a.current-lang { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pager .gap { border: none; background: none; padding: 0 .3rem; color: var(--ink-faint); }

/* side ads must not overflow the viewport */
@media (max-width: 1620px) { .ad-left, .ad-right { display: none; } }

/* card author + placeholder covers */
.card-author {
    display: block; padding: 0 .8rem .15rem;
    font-size: .78rem; color: var(--accent-ink);
    font-family: var(--font-display); font-weight: 600;
}
.card-cover-ph, .book-cover-ph {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .6rem; text-align: center; padding: 1rem .9rem;
    width: 100%; aspect-ratio: 3 / 4;
    background:
      linear-gradient(90deg, var(--accent) 0, var(--accent) 7px, transparent 7px),
      linear-gradient(160deg, var(--bg-sunk), var(--bg-elev));
    border: 1px solid var(--accent); border-left-width: 7px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.card-cover-ph i, .bcp-year {
    font-style: normal; font-family: var(--font-display);
    font-size: .8rem; letter-spacing: .12em; color: var(--accent-ink);
}
.card-cover-ph b, .bcp-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: .85rem; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-cover-ph em, .bcp-author {
    font-style: italic; font-family: var(--font-body);
    font-size: .78rem; color: var(--ink-soft);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-cover-ph { width: 220px; border-bottom: none; box-shadow: var(--shadow-lg); border-radius: 6px; }
.book-cover-ph .bcp-title { font-size: 1rem; }
.book-cover-ph .bcp-author { font-size: .85rem; }

/* ---------- imported book typography ---------- */

.entry-content .drop-cap {
    float: left; font-family: var(--font-display); font-weight: 700;
    font-size: 3.4em; line-height: .85; padding: .06em .12em 0 0;
    color: var(--accent-ink);
}
.entry-content .editorial-intro {
    margin: 0 0 1.4rem; padding: 1.1rem 1.3rem;
    background: var(--accent-soft); border: 1px solid var(--line);
    border-left: 4px solid var(--accent); border-radius: 8px;
    font-size: .95em; color: var(--ink-soft);
}
.entry-content .editorial-intro h3 { margin-top: .3rem; }
.entry-content .intro-badge, .entry-content .chap-badge {
    display: inline-block; padding: .15rem .6rem; margin-bottom: .4rem;
    font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 999px;
}
.entry-content .author-preface { margin: 0 0 1.2rem; }
.entry-content .author-signature {
    margin: 1rem 0; text-align: right;
    font-style: italic; font-family: var(--font-body); color: var(--ink-soft);
}
.entry-content .note-box {
    margin: 1.4rem 0; padding: 1rem 1.25rem;
    background: var(--bg-sunk); border: 1px dashed var(--accent);
    border-radius: 8px; font-size: .92em; color: var(--ink-soft);
}
.entry-content .chapter-sub, .entry-content .chapter-sub-en {
    font-family: var(--font-ui); font-size: .82em; letter-spacing: .06em;
    color: var(--ink-faint); margin: -.6rem 0 1.2rem; font-style: italic;
}
.entry-content .section-subtitle, .entry-content .chapter-synopsis {
    font-family: var(--font-display); font-weight: 600;
    color: var(--accent-ink); font-size: 1.05em;
    margin: 1.4rem 0 .6rem; font-style: normal;
}
.entry-content .historical-section-heading {
    font-family: var(--font-display); font-weight: 700; font-size: 1.15em;
    color: var(--ink); margin: 1.6rem 0 .7rem;
    padding-bottom: .3rem; border-bottom: 1px solid var(--line);
}
.entry-content .historical-footnote, .entry-content .footnote-item {
    font-size: .82em; color: var(--ink-faint);
    padding-left: 1rem; border-left: 2px solid var(--line);
    margin: .5rem 0;
}
.entry-content .footnote-block, .entry-content .footnotes-section, .entry-content .chapter-notes {
    margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line);
    font-size: .85em; color: var(--ink-soft);
}
.entry-content .chapter-notes-title { font-weight: 600; color: var(--accent-ink); }
.entry-content .footnote-ref, .entry-content .footnote-back {
    font-size: .75em; color: var(--accent-ink); text-decoration: none;
    vertical-align: super;
}
.entry-content .dialogue-line {
    margin: .35rem 0 .35rem 1.5rem; font-style: italic; color: var(--ink-soft);
}
.entry-content .list-record { margin: .3rem 0; padding-left: .8rem; }
.entry-content .historical-doc {
    margin: 1.3rem 0; padding: 1rem 1.2rem;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg-sunk); font-size: .92em; font-style: italic;
}
.entry-content .book-illustration, .entry-content .chapter-figure {
    margin: 1.6rem auto; text-align: center;
}
.entry-content .book-illustration img, .entry-content .chapter-figure img {
    border-radius: 6px; box-shadow: var(--shadow);
}
.entry-content .caption {
    margin-top: .5rem; font-size: .8em; font-style: italic; color: var(--ink-faint);
    font-family: var(--font-ui);
}
.entry-content table {
    width: 100%; border-collapse: collapse; margin: 1.4rem 0;
    font-family: var(--font-ui); font-size: .82em;
}
.entry-content th, .entry-content td {
    border: 1px solid var(--line); padding: .4rem .6rem; text-align: left;
    vertical-align: top;
}
.entry-content th { background: var(--bg-sunk); font-weight: 600; }
.entry-content tbody tr:nth-child(even) td { background: var(--bg-sunk); }
.entry-content .row { display: block; }
@media (max-width: 640px) {
    .entry-content table { display: block; overflow-x: auto; }
}

/* slim heading for index pages (books/categories/articles) */
.index-head { max-width: var(--measure); margin: 0 auto 1.6rem; }
.index-head h1 {
    margin: 0; padding-bottom: .55rem;
    font-size: 2rem; border-bottom: 2px solid var(--accent);
}

/* taxonomy chips on book landing */
.book-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem auto 0; max-width: var(--measure); }
.chip {
    display: inline-block; padding: .28rem .75rem; border-radius: 999px;
    border: 1px solid var(--line); background: var(--bg-elev);
    font-size: .82rem; text-decoration: none; color: var(--ink);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* Perlego-style filter bar */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: .5rem; max-width: var(--measure);
    margin: 0 auto 1.4rem;
}
.chip-filter {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .32rem .55rem .32rem .85rem;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg-elev); font-size: .82rem;
}
.chip-filter:hover { border-color: var(--accent); }
.chip-filter span { color: var(--ink-soft); white-space: nowrap; }
.chip-filter select {
    appearance: none; border: 0; padding: 0 1.1rem 0 0;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23666'/%3E%3C/svg%3E") no-repeat right center;
    font: inherit; font-size: .82rem; color: var(--ink); cursor: pointer;
}
.chip-filter select:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chip-reset { color: var(--ink-soft); }
.index-note { margin: .3rem 0 0; color: var(--ink-soft); font-size: .9rem; }
@media (max-width: 640px) {
    .filter-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .3rem; }
    .chip-filter select { white-space: nowrap; }
}

/* ---------- places world map ---------- */
.places-map {
    position: relative; margin: 0 0 1.6rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg-elev); overflow: hidden;
}
.map-viewport {
    overflow: hidden; max-height: 72vh; cursor: grab;
    user-select: none; -webkit-user-select: none; touch-action: none;
}
.map-viewport.map-drag { cursor: grabbing; }
.map-viewport.map-drag .map-pin { pointer-events: none; }
.map-inner { position: relative; width: 100%; }
.places-map .world-svg { display: block; width: 100%; height: auto; }
.places-map .world-svg path { fill: var(--bg-sunk); stroke: var(--bg-elev); }
.map-zoom {
    position: absolute; right: .6rem; top: .6rem; z-index: 3;
    display: flex; gap: .25rem;
}
.map-zoom button {
    min-width: 1.9rem; height: 1.9rem; padding: 0 .4rem;
    border: 1px solid var(--line); border-radius: .4rem;
    background: var(--bg-elev); color: var(--ink);
    font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.map-zoom button:hover { border-color: var(--accent); color: var(--accent); }
.map-pin {
    position: absolute; display: flex; align-items: center; gap: .3rem;
    text-decoration: none; z-index: 2;
}
.map-pin.lab-r { transform: translate(0, -50%); }
.map-pin.lab-l { flex-direction: row-reverse; transform: translate(-100%, -50%); }
.map-pin.lab-t { flex-direction: column-reverse; transform: translate(-50%, -100%); }
.map-pin.lab-b { flex-direction: column; transform: translate(-50%, 0); }
.map-pin i {
    width: .6rem; height: .6rem; flex: none;
    border-radius: 50%; background: var(--accent);
    border: 2px solid var(--bg-elev); box-shadow: 0 0 0 2px rgb(0 0 0 / .18);
}
.lab-r > i { margin-left: -.3rem; }
.lab-l > i { margin-right: -.3rem; }
.lab-t > i { margin-bottom: -.3rem; }
.lab-b > i { margin-top: -.3rem; }
.map-pin-country i, .map-pin-region i {
    width: .8rem; height: .8rem;
    background: transparent; border: 2px solid var(--accent);
    box-shadow: 0 0 0 .3rem rgb(138 90 43 / .25);
}
.lab-r > .map-pin-country i, .lab-r > .map-pin-region i { margin-left: -.4rem; }
.lab-l > .map-pin-country i, .lab-l > .map-pin-region i { margin-right: -.4rem; }
.lab-t > .map-pin-country i, .lab-t > .map-pin-region i { margin-bottom: -.4rem; }
.lab-b > .map-pin-country i, .lab-b > .map-pin-region i { margin-top: -.4rem; }
.map-pin span {
    font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
    color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line);
    border-radius: .3rem; padding: .05rem .3rem; white-space: nowrap;
}
.map-pin:hover i { background: var(--accent-ink); }
.map-pin:hover span { border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 640px) {
    .map-pin span { font-size: .58rem; }
}

/* header language switcher */
.lang-switch { position: relative; display: inline-block; }
.lang-switch > summary { list-style: none; cursor: pointer; display: inline-flex; }
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px;
    background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: .3rem; z-index: 60;
}
.lang-menu a { display: block; padding: .45rem .7rem; border-radius: 7px; font-size: .88rem; text-decoration: none; color: var(--ink); }
.lang-menu a:hover { background: var(--bg-sunk); }
.lang-menu a.active, .lang-menu a[aria-current] { font-weight: 700; color: var(--accent); }

/* wider nav — wrap on narrow screens */
#main-nav ul { flex-wrap: wrap; }
@media (max-width: 900px) {
    #main-nav { width: 100%; order: 3; }
    #main-nav ul { justify-content: center; gap: .2rem .8rem; }
}

/* book details table */
.book-details { max-width: var(--measure); margin: 1rem auto 0; }
.details-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.details-table th {
    text-align: left; font-weight: 600; color: var(--ink-soft);
    padding: .35rem .9rem .35rem 0; width: 11rem; vertical-align: top;
    border-bottom: 1px solid var(--line);
}
.details-table td { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.book-details .book-chips { margin-top: .7rem; max-width: none; }

/* homepage taxonomy strips */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; max-width: var(--measure); margin: 0 auto 1.6rem; }
.chip-count { color: var(--ink-soft); font-size: .78em; }
.section-title a { color: inherit; text-decoration: none; }
.section-title a:hover { color: var(--accent); }

.index-lead { color: var(--ink-soft); max-width: 60ch; margin-top: .4rem; }

/* edition badge on book landing */
.badge {
    display: inline-block; padding: .3rem .8rem; margin-bottom: .7rem;
    border: 1px solid var(--accent); border-radius: 999px;
    color: var(--accent); font-size: .78rem; letter-spacing: .04em;
    text-transform: uppercase;
}

/* taxonomy sections on homepage */
.tax-sec { max-width: var(--measure); margin: 0 auto 2rem; }
.tax-head {
    display: flex; align-items: baseline; justify-content: space-between;
    border-bottom: 1px solid var(--line); padding-bottom: .45rem; margin-bottom: .8rem;
}
.tax-head h3 {
    margin: 0; font-size: .85rem; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-soft); font-weight: 700;
}
.tax-all { font-size: .82rem; text-decoration: none; color: var(--accent); }
.tax-all:hover { text-decoration: underline; }
.tax-sec .chip-row { margin-bottom: 0; }

/* years timeline */
.timeline { position: relative; height: 100px; margin: .5rem 0 0; }
.timeline::before {
    content: ''; position: absolute; left: 0; right: 0; top: 60px;
    height: 2px; background: var(--line); border-radius: 1px;
}
.tl-tick {
    position: absolute; top: 0; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; min-width: 3rem;
}
.tl-tick b {
    font-size: .82rem; font-weight: 600; color: var(--ink);
    margin-bottom: 24px;
}
.tl-tick i {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2.5px solid var(--accent); background: var(--bg);
    position: absolute; top: 53px;
}
.tl-tick span { position: absolute; top: 70px; font-size: .72rem; color: var(--ink-soft); }
.tl-tick:hover i { background: var(--accent); }
.tl-tick:hover b { color: var(--accent); }
@media (max-width: 640px) {
    .timeline { overflow-x: auto; }
    .tl-tick { min-width: 2.5rem; }
}

/* ---------- accessibility ---------- */

.skip-link {
    position: fixed; left: .75rem; top: .5rem; z-index: 100;
    transform: translateY(-200%);
    background: var(--accent); color: #fff;
    padding: .55rem 1rem; border-radius: 8px;
    font-family: var(--font-ui); font-size: .9rem;
    transition: transform .15s ease;
}
.skip-link:focus { transform: none; }
#main:focus { outline: none; }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
    .top-inner {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--top-h);
        padding-block: .5rem;
        gap: .45rem .9rem;
    }
    .site-search { flex: 1 1 7rem; min-width: 0; }
    .site-search input { width: 100%; min-width: 0; }
    .site-search input:focus { width: 100%; }
    #main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #main-nav::-webkit-scrollbar { display: none; }
    #main-nav ul { flex-wrap: nowrap; justify-content: flex-start; }
}

@media (max-width: 1023px) {
    body.toc-open { overflow: hidden; }
}

@media (max-width: 640px) {
    .icon-btn { min-width: 2.4rem; height: 2.4rem; }
    .page-single { padding: 1.5rem 1rem; }
    .toc { padding: 1.25rem; }
    .book-hero { padding: 1.25rem; gap: 1.25rem; }
    .hero { padding: 2rem 1rem 1.25rem; }
    .hero h1 { font-size: 1.8rem; }
    .index-head h1 { font-size: 1.55rem; }
    .orig-reader-frame { min-height: 65vh; }
    .cookie-bar { flex-wrap: wrap; gap: .6rem; }
    .cookie-bar p { flex: 1 1 12rem; }
    .book-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* sticky page nav on phones */
@media (max-width: 640px) {
    .book-page .page-nav {
        position: sticky;
        bottom: .5rem;
        z-index: 5;
        margin-top: 1rem;
        padding: .6rem;
        background: var(--bg-elev);
        border: 1px solid var(--line);
        border-radius: 10px;
        box-shadow: var(--shadow-lg);
    }
    .book-page .page-nav .btn { flex: 1 1 auto; justify-content: center; padding: .55rem .5rem; font-size: .85rem; }
}

/* pull-to-refresh / rubber-band inside the toc drawer */
.book-toc { overscroll-behavior: contain; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .book-toc, .card { transition: none; }
}
