@font-face {
    font-family: "Manrope";
    src:url("/fonts/Manrope-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Manrope";
    src: url("/fonts/Manrope-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 16px;
    background: #f3f4f6;
    color: #111827;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.pdf-print-header,
.pdf-print-footer {
    display: none;
}

@media print {
    html {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body {
        background: #ffffff;
        margin: 0;
        padding: 0;
    }
    .no-print {
        display: none !important;
    }
    .pdf-print-header,
    .pdf-print-footer {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        color: #666;
        z-index: 9999;
    }
    .pdf-print-header {
        top: 0;
    }
    .pdf-print-footer {
        bottom: 0;
    }
    @page {
        size: A4;
        margin-top: 12mm;
        margin-bottom: 12mm;
    }
    .container {
        max-width: 100%;
        margin: 0;
        box-shadow: none;
    }
    .year-layout {
        padding: 0;
        margin: 0;
        gap: 1mm;
        border: none;
    }
    .year-calendar-panel,
    .year-holidays-panel {
        padding: 1mm 1mm;
        border: 1px solid #ddd;
    }
    .year-title {
        margin: 0 0 2mm;
        font-size: 1em;
    }
    .year-title-calendar {
        font-size: 1em;
    }
    .year-layout .months-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1mm;
    }
    .year-layout .month {
        padding: 1mm;
        border-radius: 2px;
    }
    .year-layout .month h2 {
        margin: 0 0 1mm;
        font-size: 14pt;
    }
    .year-layout .months-grid th,
    .year-layout .months-grid td {
        font-size: 5pt;
        padding: 1mm;
    }
    .year-layout .month-link {
        padding: 0;
    }
    .holidays {
        page-break-before: always;
        padding: 8mm 0;
        margin: 0;
    }
    .holidays h2 {
        font-size: 1em;
        margin: 0 0 6pt;
    }
    .holidays ul {
        font-size: 10pt;
    }
    .holidays li {
        padding: 2pt 0;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.year-layout {
    display: flex;
    flex-direction: column;
    gap: 1em;
    align-items: stretch;
    margin-top: 1em;
}

.year-calendar-panel {
    position: relative;
    padding: 1em;
    background-color: #fff;
    border: 1px solid #d1d5db;
}

.year-holidays-panel {
    padding: 1.25em 1.5em 1.75em;
    background-color: #fff;
    border: 1px solid #d1d5db;
}

.year-holidays-panel .holidays {
    padding: 0;
    margin: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.year-holidays-panel .holidays h2 {
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.year-holidays-panel .holidays p {
    margin: 0;
    color: #6b7280;
    line-height: 1.5;
}

.year-holidays-panel .holidays li {
    padding: 10px 0;
}

.month-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1em;
    align-items: stretch;
    margin-top: 16px;
    padding: 4em;
    background-color: #fff;
}

.year-image {
    padding: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.year-image img {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: block;
    object-fit: cover;
    object-position: center;
}

.year-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.month-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.month-header-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;    
}

.month-header-line h1 {
    display: flex;
    justify-content: space-between;
    width: 100%;  
    margin-top: 0;  
}

.month-header-month {
    text-align: left;
    padding-left: 0.8em;
}

.month-header-year {
    text-align: right;
    color: #6b7280;
    padding-right: 0.8em;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.year-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25em;
    text-align: center; 
    display: grid;
    grid-template-columns: 1fr;
    padding-top: 1.5em;
}
.year-title-year{
    font-size: 2.5rem;
    font-weight: 600; 
    text-align: center; 
}
.year-title-calendar{
    font-size: 0.6em;
    color: #6b7280;
}

.year-subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted, #666);
    margin-bottom: 0.5rem;
}

header .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
}

header .nav a {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

header .nav a:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

header .nav a.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

header .nav .nav-pdf-buttons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.nav-left {
    display: flex;
    gap: 8px;    
    justify-content: flex-start;
}
.btn-download-pdf {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font: inherit;
    cursor: pointer;
}

.btn-download-pdf:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.year-layout__pdf-v3-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font: inherit;
    cursor: pointer;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}

.year-layout__pdf-v3-btn:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

header .nav .btn-lang {
    padding: 6px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    min-height: 32px;
}
header .nav .btn-lang:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-lang-icon {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lang-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100% !important;
    min-height: 100% !important;
    z-index: 2147483647 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    background: #f3f4f6 !important;
    isolation: isolate;
}
.lang-overlay.lang-overlay--open {
    display: flex !important;
}
html.lang-overlay-open body {
    overflow: hidden !important;
}
.lang-overlay-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #f3f4f6 !important;
}
.lang-overlay-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 48px 24px 24px;
}
.lang-overlay-title {
    margin: 0 0 32px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: #111827;
}
.lang-overlay-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lang-overlay-list li {
    margin: 0;
    padding: 0;
}
.lang-overlay-item {
    display: block;
    padding: 18px 24px;
    font-size: 1.25rem;
    text-decoration: none;
    color: #2563eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.15s, box-shadow 0.15s;
}
.lang-overlay-item:hover {
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}
.lang-overlay-item--current {
    color: #374151;
    font-weight: 600;
    cursor: default;
    background: #e5e7eb;
}
.lang-overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.75rem;
    line-height: 1;
    border: none;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: color 0.15s, background 0.15s;
}
.lang-overlay-close:hover {
    color: #111827;
    background: #e5e7eb;
}


.year-layout .months-grid {
    display: grid;
}

.pdf-export .year-layout {
    padding-top: 100mm;
}
.pdf-export .year-title {
    margin: 0mm 0 0mm 0;
    font-size: 1rem;
}
.pdf-export .year-title-year {
    font-size: 1rem;
}
.pdf-export .year-title-calendar {
    font-size: 0.6em;
}

.pdf-export .months-grid {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 0mm;
}
.pdf-export .month h2 {
    margin: 0 0 0mm;
    font-size: 12pt;
}
.pdf-export .year-layout .months-grid th,
.pdf-export .year-layout .months-grid td {
    font-size: 0.3em;
}

.year-layout .month-link {
    padding-bottom: 0;
}

.year-layout .months-grid th{
    font-size: 0.7em;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}
.year-layout .months-grid td{
    padding: 0.5em;
    font-size: 0.7em;
}

.months-grid {
    background: #ffffff;
    
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.month {
    border-radius: 12px;
    padding: 12px;
}

.month h2 {
    font-size: 1rem;
    margin: 0 0 8px;
    text-align: center;
}

.month-link {
    color: inherit;
    text-decoration: none;
}

.month-link:hover {
    text-decoration: underline;
}


.holidays {
    background: #ffffff;
    padding: 12px 16px;
    margin-bottom: 20px;
}

hr{
    border: solid 1px #e5e7eb;
}

.holidays h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.holidays ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.holidays li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border-bottom: 1px solid #e5e7eb;
}

.holidays li:last-child {
    border-bottom: none;
}

.holiday-date {
    font-variant-numeric: tabular-nums;
    color: #4b5563;
    min-width: 80px;
}

.holiday-name {
    font-weight: 500;
}

.holiday-badge {
    padding: 2px 6px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.75rem;
}

.site-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-logo {
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.site-logo-main {
    font-weight: 800;
    color: #111827;
}

.site-logo-dot {
    font-weight: 300;
    color: #9ca3af;
}

.month table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 1.3rem;
}

.month th,
.month td {
    text-align: center;
    padding: 1em 0;
}

.month thead th {
    font-weight: 600;
    color: #6b7280;
}

.month thead th.weekend {
    color: #9ca3af;
}

.month td {
    border-radius: 6px;
}

.month td.day {
    aspect-ratio: 1 / 1;
}

.month td.empty {
    color: transparent;
}

.month td.day-holiday {
    color: #92400e;
    font-weight: 600;
}

.month td.day-holiday-public {
    color: #b91c1c;
    font-weight: 600;
    position: relative;
    z-index: 0; /* для стэка с псевдоэлементом */
}

/* Десктоп: как раньше по размеру (~70% стороны), но круг за счёт одной оси + aspect-ratio */
.month td.day-holiday-public::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70%;
    aspect-ratio: 1;
    height: auto;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background-color: #fee2e2; /* как .holiday-badge */
    z-index: -1; /* фон под текстом */
}

@media (max-width: 640px) {
    .month td.day-holiday-public {
        container-type: size;
    }

    .month td.day-holiday-public::before {
        width: min(2.12em, 68.4%);
    }

    @supports (width: 1cqmin) {
        .month td.day-holiday-public::before {
            width: min(2.12em, 70.2cqmin);
            height: min(2.12em, 70.2cqmin);
            aspect-ratio: unset;
        }
    }
}

.month td.day-weekend {
    color: #9ca3af;
}

.related-calendars {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 0.9rem;
    width: 100%;
}

.related-calendars-label {
    color: #4b5563;
    flex-shrink: 0;
}

.related-calendars-more {
    display: contents;
}

.related-calendars-more[hidden] {
    display: none;
}

.related-calendars-toggle {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #93c5fd;
    background: #fff;
    color: #1d4ed8;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.related-calendars-toggle:hover {
    background: #eff6ff;
}

.related-calendars-link {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}

.related-calendars-link:hover {
    background: #dbeafe;
    text-decoration: none;
}

.region-search {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 50%;
    position: relative;
    display: flex;
    justify-content: center;
}

.region-search-label {
    font-size: 0.85rem;
    color: #4b5563;
}

.region-search-field {
    position: relative;
    display: block;
    margin-top: 2px;
}

.region-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.region-search-icon-svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.region-search-input {
    padding: 6px 10px 6px 32px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    width: 100%;
    background: #ffffff;
    box-sizing: border-box;
}

.region-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.region-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    max-height: 260px;
    overflow-y: auto;
    z-index: 20;
}

.region-search-item {
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.region-search-item:hover {
    background: #eff6ff;
}

.region-search-item-name {
    font-weight: 500;
    min-width: 0;
    flex: 1 1 auto;
}

.region-search-item-slug {
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 11ch;
    text-align: right;
}

.region-search-empty {
    color: #6b7280;
    cursor: default;
}


body.admin {
    padding: 20px;
}

body.admin .admin-nav {
    margin-bottom: 20px;
}

body.admin .admin-nav a {
    margin-right: 12px;
}

body.admin table {
    border-collapse: collapse;
    width: 100%;
    background: #ffffff;
}

body.admin th,
body.admin td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    font-size: 0.9rem;
}

body.admin th {
    background: #f9fafb;
    text-align: left;
}

body.admin form.inline {
    display: inline-block;
    margin: 0;
}

body.admin input[type="text"],
body.admin input[type="date"],
body.admin select {
    padding: 4px 6px;
    font-size: 0.9rem;
    width: 100%;
}

body.admin .box {
    background: #ffffff;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
}

body.admin .btn {
    padding: 4px 10px;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    cursor: pointer;
}

body.admin .btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

body.admin .btn-danger {
    background: #dc2626;
    border-color: #b91c1c;
    color: #ffffff;
}

body.admin .row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

body.admin .row > div {
    flex: 1 1 160px;
}

body.admin h1 {
    margin-top: 0;
}


@media (max-width: 640px) {
    .year-title {
        font-size: 1.4rem;
    }


    .month-layout {
        grid-template-columns: 1fr;
    }

    header .nav {
        flex-wrap: wrap;
    }
    .nav-left {
        order: 1;
    }
    header .nav .btn-lang {
        order: 1;
        margin-left: auto;
    }
    .region-search {
        order: 2;
        flex-basis: 100%;
        width: 100%;
        min-width: 0;
    }
}

