.academic-calendar {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 100vh;
}

.calendar-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.info-section {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1200px;
    padding: 10px;
    box-sizing: border-box;
}

.info-box {
    background-color: white;
    border: 1px solid #000;
    padding: 20px;
    box-sizing: border-box;
    flex: 1 1 calc(33.333% - 40px);
    margin: 10px;
    min-width: 250px;
}

.info-box-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.key-legend {
    display: grid;
    grid-template-columns: 40px auto;
    row-gap: 10px;
    align-items: center;
    margin-top: 1rem;
}

.key-item {
    display: contents;
}

.key-symbol {
    width: 40px;
    height: 20px;
    border: 1px solid black;
    text-align: center;
    font-size: 0.8rem;
    position: relative;
}

.key-description {
    padding-left: 10px;
}

.key-dates li,
.holidays li {
    margin: 5px 0;
}

.calendar {
    background-color: #ddd;
    border: 1px solid #ddd;
    overflow: visible;
    min-height: auto;
    /*min-height: 340px;*/
}

.month {
    background-color: white;
    color: #000;
    text-align: center;
    padding: 10px 0;
    font-size: 1.2em;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ddd;
    padding: 2px;
}

.days div {
    background-color: white;
    text-align: center;
    padding: 10px 0;
    box-sizing: border-box;
    /*border: 2px solid transparent;*/
}

.no-classes .day-wrapper,
.break-non-instruction .day-wrapper {
    color: #000;
}

.holiday {
    background-color: #687882 !important;
    color: white !important;
}

.no-classes {
    background-color: #a6b0b7 !important;
}

.instruction {
    background-color: #CD1041 !important;
    color: white !important;
}

.holiday-non-instruction {
    background-image: repeating-linear-gradient(135deg, #000 0, #000 2px, transparent 0, transparent 50%) !important;
    background-size: 16px 16px !important;
}

.break-non-instruction {
    background-color: #f58220 !important;
}

.classes-in-session-offices-closed {
    background-image: 
        repeating-linear-gradient(135deg, #CD1041 0, #CD1041 2px, transparent 0, transparent 50%),
        repeating-linear-gradient(45deg, #CD1041 0, #CD1041 2px, transparent 0, transparent 50%) !important;
    background-size: 16px 16px !important;
}

.finals {
    background-image: repeating-linear-gradient(135deg, #f58220 0, #f58220 2px, transparent 0, transparent 50%) !important;
    background-size: 16px 16px !important;
}

.striped-digit {
    background-color: white;
    padding: 5px;
    border: 1px solid black;
    border-radius: 4px;
}

.aos {
    border: 3px solid black;
    box-sizing: border-box;
    width: 40px;
    height: 20px;
}

.key-symbol.aos {
    position: relative;
    /* Ensure the pseudo-elements are positioned relative to this element */
}

.key-symbol.aos::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-bottom: 12px solid #000;
    border-left: 12px solid transparent;
}

.key-symbol.aos::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 12px solid #000;
    border-right: 12px solid transparent;
}

@media (max-width: 1500px) {
    .calendar-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1300px) {
    .calendar-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-box {
        flex: 1 1 calc(50% - 40px);
    }
}

@media (max-width: 600px) {
    .calendar-container {
        grid-template-columns: repeat(1, 1fr);
    }

    .calendar,
    .info-box {
        font-size: 0.8em;
        min-height: auto;
    }

    .info-box {
        flex: 1 1 100%;
    }
}

.aos-bdr-top {
    border-top: 3px solid black;
}

.aos-bdr-bottom {
    border-bottom: 3px solid black;
}

.aos-bdr-right {
    border-right: 3px solid black;
}

.aos-bdr-left {
    border-left: 3px solid black;
}

.summer-block-1::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-bottom: 15px solid #00AACC;
    border-right: 15px solid transparent;
}

.key-symbol.summer-block-1::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-bottom: 12px solid #00AACC;
    border-right: 12px solid transparent;
}

.summer-block-2::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-bottom: 15px solid #A2E61B;
    border-right: 15px solid transparent;
}

.key-symbol.summer-block-2::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-bottom: 12px solid #A2E61B;
    border-right: 12px solid transparent;
}

.commencement::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-top: 15px solid #CD1041;
    border-left: 15px solid transparent;
}

.key-symbol.commencement::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-top: 12px solid #CD1041;
    border-left: 12px solid transparent;
}

.aos-start::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 15px solid #000000;
    border-right: 15px solid transparent;
}

.aos-end::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-bottom: 15px solid #000000;
    border-left: 15px solid transparent;
}

.days div.summer-block-1,
.days div.summer-block-2,
.days div.aos-start,
.days div.aos-end,
.days div.commencement {
    position: relative;
}

.day-wrapper {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    padding: 0 !important;
    background-color: transparent !important;
    box-sizing: border-box;
}

.tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    color: #000;
    padding: 10px;
    border: 1px solid black;
    font-size: 12px;
    width: 9rem;
    z-index: 1000;
    border-radius: 4px;
    white-space: normal;
    pointer-events: none;
    margin-bottom: 6px;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Tooltip forced to align left when close to the right edge */
.tooltip.tooltip-left {
    left: auto;
    right: 0;
    transform: translateX(0);
}

/* Tooltip forced to align right when close to the left edge */
.tooltip.tooltip-right {
    left: 0;
    right: auto;
    transform: translateX(0);
}

/* Show tooltip on hover (desktop) */
@media (min-width: 1025px) {
    .day-wrapper:hover .tooltip {
        display: block;
    }
}

/* Mobile: tap to show */
@media (max-width: 1024px) {
    .day-wrapper.show-tooltip .tooltip {
        display: block;
    }
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.day-wrapper span {
    padding: 4px;
}

.day-wrapper.show-tooltip>.tooltip {
    display: block;
    opacity: 1;
    visibility: visible;
}

.academic-calendar * {
    cursor: default;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        margin: 0;
        padding: 0;
    }

    h1 {
        page-break-after: avoid;
        break-after: avoid;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-top: 0;
        margin-bottom: 10px;
    }

    .calendar-container {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        /* Show 3 per row */
        gap: 10px;
        padding: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        /* Removed page-break-inside due to Firefox issues */
        /* page-break-inside: avoid; */
        /* break-inside: avoid; */
    }

    .calendar-container>* {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .info-section {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-top: 20px;
        padding: 10px;
    }

    .info-box {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 15px;
    }

    .info-box-title {
        font-weight: bold;
        margin-bottom: 5px;
    }

    .key-legend,
    .key-item,
    .key-description {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .striped-digit {
        background-color: white !important;
    }

    .headline__eyebrow,
    .sidebar__title {
        display: none !important;
    }

    .instruction span,
    .holiday span {
        color: white !important;
    }
    
    .days div {
        padding: 0;
    }
    
    .days {
        font-size: 0.8em;
    }
    
    .month {
        font-size: 0.8em;
        font-weight: bold;
        padding: 0;
    }
    
    .day-wrapper span {
        padding: 1px;
    }
    
    .aos-end::before {
        border-bottom: 8px solid #000000;
        border-left: 8px solid transparent;
    }
    
    .aos-start::before {
        border-top: 8px solid #000000;
        border-right: 8px solid transparent;
    }
    
    .summer-block-1::before {
        border-bottom: 8px solid #00AACC;
        border-right: 8px solid transparent;
    }
    
    .summer-block-2::before {
        border-bottom: 8px solid #A2E61B;
        border-right: 8px solid transparent;
    }
    
    .aos-bdr-top {
        border-top: 2px solid black;
    }

    .aos-bdr-bottom {
        border-bottom: 2px solid black;
    }
    
    .aos-bdr-right {
        border-right: 2px solid black;
    }
    
    .aos-bdr-left {
        border-left: 2px solid black;
    }
    
    .info-section * {
        font-size: 1em;
        line-height: 1.4em;
    }

    /* Firefox-specific fixes */
    @supports (-moz-osx-font-smoothing: auto) {
        h1 {
            font-size: 14pt !important;
            line-height: 1.1 !important;
            margin-top: 0 !important;
            margin-bottom: 5px !important;
        }

        .calendar-container {
            display: block !important;
            /* Avoid Firefox print bug with grid */
            break-inside: auto !important;
            page-break-inside: auto !important;
            margin: 0 !important;
        }

        body {
            margin-top: 0 !important;
            padding-top: 0 !important;
        }

        *::before,
        *::after {
            content: none !important;
            display: none !important;
        }
    }
}