/* ============================================================
   ПРАВОСЛАВЕН КАЛЕНДАР — главен стил
   Зарежда се след tokens.css (виж base.html)
   Всички цветове — през CSS променливи от tokens.css
   ============================================================ */

html {
    font-size: 20px;
    font-family: 'EB Garamond', Garamond, 'Times New Roman', Georgia, serif;
    /* Prevent page shifting when scrollbar disappears on short pages */
    overflow-y: scroll;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}
body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
}
h1, h2, h3, h4 {
    text-align: center;
    text-wrap: balance;
    font-family: 'Old Standard TT', 'EB Garamond', Garamond, serif;
    color: var(--accent);
}
.rubric {
    color: var(--rubric);
}

/* Site title and navigation */
body > header {
    margin: 0;
    padding: 1.75em 0 0.25em 0;
    text-align: center;
    font-size: 2.2em;
    color: var(--header-color);
	font-weight: bold;
    font-variant: small-caps;
    font-family: 'Old Standard TT', 'EB Garamond', Garamond, serif;
}
body > header a {
    text-decoration: none;
    color: var(--header-color);
    text-shadow: 2px 2px 4px var(--shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
    flex-wrap: wrap;
}
body > header .brand-mark {
    display: inline-block;
    height: 2.1em;
    width: 2.1em;
    vertical-align: middle;
    background-image: url("logo-symbol-light.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: background-image 0.25s ease;
    flex-shrink: 0;
}
html[data-theme="dark-blue"] body > header .brand-mark {
    background-image: url("logo-symbol-dark-blue.png");
}
html[data-theme="dark-sepia"] body > header .brand-mark {
    background-image: url("logo-symbol-dark-sepia.png");
}
body > nav {
    margin: 0;
    padding: 0;
    text-align: center;
}
body > nav ul {
    list-style: none;
    margin: 0 0 1.5em 0;
    padding: 0;
}
body > nav li {
    display: inline;
    border-right: 3px solid var(--border);
    padding: 8px;
    margin-left: -4px;
}
body > nav li:last-child {
    border-right: none;
}
body > nav a:link, body > nav a:visited {
    text-decoration: none;
    color: var(--text-muted);
    transition-property: color, text-shadow;
    transition-duration: 0.3s;
}
body > nav a:hover {
    color: var(--text);
    text-shadow: 2px 2px 3px var(--shadow);
}

/* Readings and Calendar navigation */
body > nav a.cal-nav {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px;
	text-decoration: none;
    transition-property: color, border, text-shadow;
    transition-duration: 0.4s;
}
body > nav a.cal-nav:hover {
    color: var(--text-muted);
    cursor: pointer;
}
a.active {
    background-color: var(--border);
}

main#orthocal {
    margin: 1em auto 4em auto;
    border-top: 8px solid var(--border-soft);
	width: 75%;
    min-height: 100%;
}
main#orthocal p {
    text-indent: 1.5em;
    margin-top: 0;
    margin-bottom: 0;
}
main#orthocal iframe {
    margin: 4% auto;
    width: 100%;
}
main#orthocal > header {
    padding-top: 1.5em;
    padding-bottom: 1em;
}
main#orthocal > header h1 {
	margin-top: 0;
	color: var(--text-muted);
	font-size: 1.5em;
}
main#orthocal > header h1 span {
	margin-top: 0;
	color: var(--text);
	font-size: 1.1em;
}

#content {
    text-align: justify;
    text-wrap: pretty;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}
#content a {
    color: var(--link);
    text-decoration: none;
}
#content a:hover {
    text-decoration: underline;
}

section.readings {
	border-top: 3px solid var(--border);
	padding-top: 1.5em;
	margin-top: 1.5em;
}
section.readings h2 {
    color: var(--link);
}

.fasting {
	font-size: 1.4em;
	text-align: center;
	text-indent: 0 !important;
    color: var(--rubric);
}
.day {
    margin-top: 1em;
    padding-top: 1.5em;
    border-top: 5px solid var(--border-soft);
}
.commemorations li, .feasts li, .day > p {
    color: var(--text-muted);
}
.passage {
    columns: 3 20em;
    column-gap: 2em;
    column-rule: 1px solid var(--border);
    padding-top: 2em;
    widows: 3;
    orphans: 3;
    text-align: justify;
    text-wrap: pretty;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}
.passage h2 {
    margin-top: 0;
	font-size: 1.1em;
    break-inside: avoid;
}
.passage p .verse-number {
    vertical-align: super;
    font-size: 0.70em;
    color: var(--text-subtle);
    margin-right: 1px;
}
.day>p {
    text-align: center;
}
.day section {
    text-align: left;
}
label {
    font-size: 0.75em;
}
label input[type="radio"] {
    accent-color: var(--accent);
}
.service-notes ul, .commemorations ul, .feasts ul {
    text-align: center;
    margin: 0;
    padding: 0;
	list-style-type: none;
}
.service-notes h2, .feasts h2, .commemorations h2 {
    margin-bottom: 0em;
	font-size: 1.2em;
}

table.month {
	font-size: 1.65vw;
    margin: 2em auto;
	table-layout: fixed;
	border-collapse: collapse;
}
table.month td {
	margin: 0;
	padding: 0;
	border: 1px solid var(--border);
	font-size: 0.75em;
	vertical-align: top;
	background-color: var(--calendar-cell-bg);
	text-align: left;
    width: 14.28%;
}
table.month td.fast {
	background-color: var(--fast-bg);
}
table.month td.fast:hover {
	background-color: var(--border) !important;
}
table.month td.today {
	background-color: var(--accent) !important;
	box-shadow: inset 0 0 0 3px var(--gold);
	position: relative;
}
table.month td.today a,
table.month td.today p,
table.month td.today li {
	color: var(--bg) !important;
	font-weight: 600;
}
table.month td.today p.day-number {
	font-weight: 700;
}
table.month td.today:hover {
	background-color: var(--accent) !important;
	opacity: 0.92;
}
table.month td.noday {
	border: 0;
	background-color: var(--bg);
}
table.month tr td p {
	text-indent: 0 !important;
	text-align: left;
    margin-bottom: 1em !important;
}
table.month tr th {
	text-align: center;
	color: var(--text-muted);
}
table.month tr:first-child th {
	font-size: 1.5em;
    color: var(--text);
    padding-top: 0;
	padding-bottom: 1em;
}

.commemorations li, .feasts li, .service-notes li {
	display: inline;
    color: var(--rubric);
}
.commemorations li + li:before, .feasts li + li:before {
	content: "●";
    color: var(--text);
	padding: 0.5em;
}

p.feast {
	font-weight: bold;
	color: var(--text);
}

table.month ul {
	list-style-type: none;
	margin: 0 0 1em 0;
	padding: 0;
}
table.month li {
	display: inline;
}
table.month li + li:before {
	content: "●";
	padding: 0 0.5vw;
}
ul.feasts li {
	font-weight: bold;
	color: var(--text);
}
ul.saints li {
	font-size: 0.75em;
}

p.day-number {
	font-size: 1.5em;
}
table.month td {
    transition-property: background-color;
    transition-duration: 0.25s;
}
table.month td a {
	display: block;
	padding: 1vw;
	text-decoration: none;
	color: var(--text);
	height: 100%;
}
table.month td.sun:hover,
table.month td.mon:hover,
table.month td.tue:hover,
table.month td.wed:hover,
table.month td.thu:hover,
table.month td.fri:hover,
table.month td.sat:hover
{
	background-color: var(--bg-alt);
    cursor: pointer;
}

/* ============================================================
   КОНТРОЛИ ЗА ЧЕТЕНЕ (горе вдясно — фиксирани)
   Тема (цвят) + размер на шрифта — един клъстер
   ============================================================ */
.site-controls {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 50;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.theme-toggle,
.font-toggle {
    display: flex;
    gap: 4px;
    align-items: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 4px;
    box-shadow: 0 2px 4px var(--shadow);
}
.theme-toggle button,
.font-toggle button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 18px;
    transition: background-color 0.2s, color 0.2s;
}
.theme-toggle button:hover,
.font-toggle button:hover {
    color: var(--text);
}
.theme-toggle button.active,
.font-toggle button.active {
    background: var(--accent);
    color: var(--bg);
}
.theme-toggle .night-sub {
    display: none;
    gap: 4px;
}
.theme-toggle.night-open .night-sub {
    display: flex;
}
.theme-toggle .night-sub button {
    font-size: 12px;
    padding: 3px 8px;
}
/* Размер на шрифта — 5 стъпки */
html[data-fontsize="small"] body {
    font-size: 85%;
}
/* normal = 100%, няма нужда от правило */
html[data-fontsize="medium"] body {
    font-size: 115%;
}
html[data-fontsize="large"] body {
    font-size: 130%;
}
html[data-fontsize="xlarge"] body {
    font-size: 150%;
}
/* Календарна таблица — наследява font-size промените */
html[data-fontsize="small"] table.month { font-size: max(1.4vw, 10px); }
html[data-fontsize="medium"] table.month { font-size: max(1.9vw, 13px); }
html[data-fontsize="large"] table.month { font-size: max(2.15vw, 14px); }
html[data-fontsize="xlarge"] table.month { font-size: max(2.5vw, 15px); }

/* ============================================================
   FOOTER (минималистичен — copyright + поверителност)
   ============================================================ */
.site-footer {
    margin: 4em auto 0;
    padding: 1.5em 1em 5em;
    text-align: center;
    border-top: 1px solid var(--border-soft);
    font-family: 'EB Garamond', Garamond, serif;
    max-width: 800px;
}
.site-footer .footer-line {
    text-indent: 0;
    margin: 0;
    font-size: 0.8em;
    color: var(--text-subtle);
    letter-spacing: 0.02em;
}
.site-footer .footer-line a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.site-footer .footer-line a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
}
.site-footer .footer-line .sep {
    color: var(--gold);
    margin: 0 0.5em;
    font-size: 0.95em;
    display: inline-block;
    vertical-align: middle;
}

/* ============================================================
   COOKIE CONSENT BANNER (минималистична лента долу)
   ============================================================ */
.cookie-consent {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px var(--shadow);
    padding: 10px 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 640px;
    width: calc(100% - 24px);
    font-size: 13px;
    line-height: 1.4;
}
.cookie-consent[hidden] { display: none; }
.cookie-consent .cookie-text {
    flex: 1;
    margin: 0;
    text-indent: 0;
    color: var(--text-muted);
}
.cookie-consent .cookie-text a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 2px;
}
.cookie-consent .cookie-text a:hover {
    text-decoration-color: var(--accent);
}
.cookie-consent .cookie-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.cookie-consent button {
    font-family: inherit;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.2;
}
.cookie-consent .btn-primary {
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
}
.cookie-consent .btn-primary:hover {
    opacity: 0.85;
}
.cookie-consent .btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.cookie-consent .btn-secondary:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ============================================================
   БУТОН „ВЪРНИ СЕ В НАЧАЛОТО" (долу вляво — фиксиран)
   ============================================================ */
/* Визуално в синхрон с .theme-toggle и .font-toggle „капсулите" отгоре.
   Идентични: фон, граница, цветове на текст и хover/active състояния. */
.back-to-top {
    position: fixed;
    bottom: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px var(--shadow);
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    /* Малко по-плътна стрелка чрез фини text-shadow в същия цвят. */
    text-shadow: 0 0 0.6px currentColor;
    z-index: 50;
    padding: 0;
    /* По default — невидим. JS добавя .is-visible при scroll > 200px. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.back-to-top.is-visible:hover {
    background: var(--accent);
    color: var(--bg);
    transform: translateY(-2px);
}
.back-to-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
@media (max-width: 720px) {
    .back-to-top {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* ============================================================
   DISCLAIMER „СЪОБЩИ ЗА НЕТОЧНОСТ" (долу вдясно — фиксиран)
   ============================================================ */
.error-report {
    position: fixed;
    bottom: 12px;
    left: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    color: var(--text);
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid var(--text-muted);
    background: var(--bg-alt);
    border-radius: 4px;
    opacity: 0.8;
    box-shadow: 0 1px 3px var(--shadow);
    transition: opacity 0.3s, border-color 0.3s, color 0.3s, transform 0.2s;
    z-index: 10;
    line-height: 1;
    font-weight: 500;
}
.error-report:hover {
    opacity: 1;
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px var(--shadow);
}

/* ============================================================
   МОБИЛНИ MEDIA QUERIES
   ============================================================ */
@media (max-width: 720px) {
    main#orthocal {
        width: 92%;
    }
    body > header {
        font-size: 1.6em;
        padding: 1em 0 0.25em 0;
    }
    body > nav li {
        display: block;
        border-right: none;
        padding: 6px;
        border-bottom: 1px solid var(--border-soft);
        margin-left: 0;
    }
    body > nav li:last-child {
        border-bottom: none;
    }
    body > nav a.cal-nav {
        padding: 10px 14px;
        min-width: 90px;
        display: inline-block;
    }
    table.month {
        font-size: 11px;
    }
    html[data-fontsize="small"] table.month { font-size: 10px; }
    html[data-fontsize="medium"] table.month { font-size: 13px; }
    html[data-fontsize="large"] table.month { font-size: 14px; }
    html[data-fontsize="xlarge"] table.month { font-size: 16px; }
    table.month td a {
        padding: 6px 4px;
    }
    .passage {
        columns: 1;
    }
    .fasting {
        font-size: 1.2em;
    }
    .site-controls {
        top: 8px;
        right: 8px;
        gap: 4px;
    }
    .theme-toggle,
    .font-toggle {
        padding: 3px;
    }
    .theme-toggle button,
    .font-toggle button {
        font-size: 12px;
        padding: 4px 6px;
    }
    .error-report {
        font-size: 11px;
        bottom: 8px;
        left: 8px;
        padding: 5px 8px;
    }
    .site-footer {
        padding: 1.2em 0.5em 5em;
    }
    .site-footer .footer-line {
        font-size: 0.75em;
    }
    .site-footer .footer-line .sep {
        margin: 0 0.35em;
    }
    .cookie-consent {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
        font-size: 12px;
        bottom: 8px;
    }
    .cookie-consent .cookie-text {
        text-align: center;
    }
    .cookie-consent .cookie-actions {
        width: 100%;
        justify-content: center;
    }
    .cookie-consent button {
        font-size: 11px;
        padding: 5px 10px;
        flex: 1;
        max-width: 140px;
    }
}

@media (max-width: 420px) {
    main#orthocal {
        width: 96%;
    }
    body > header {
        font-size: 1.4em;
    }
}
