/* =====================================================
   GLOBAL
   ===================================================== */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;

    width: 100%;
    min-height: 100vh;

    background-color: #2e5266;
    color: white;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    overflow-x: hidden;
}


/* =====================================================
   MAIN
   ===================================================== */

.main {
    width: min(95%, 1400px);

    margin: 40px auto;
    padding: 30px;

    background-color: #6e8898;
}


/* =====================================================
   FIRST HALF
   ===================================================== */

.firsthalf {
    display: flex;

    flex-direction: column;

    gap: 30px;

    width: 100%;
}


/* =====================================================
   CALENDAR
   ===================================================== */

.calender {
    display: flex;

    align-items: flex-start;

    justify-content: center;

    gap: 45px;

    width: 100%;
}


/* =====================================================
   BOTTOM INFORMATION
   ===================================================== */

.bottomfirsthalf {
    display: flex;

    align-items: flex-start;

    justify-content: center;

    gap: 45px;

    width: 100%;
}


/* =====================================================
   INFORMATION BLOCKS
   ===================================================== */

.daydiv,
.monthdiv,
.yeardiv,
.hoursdiv,
.daynamediv,
.daynumberdiv,
.weeknumberdiv,
.hhdiv,
.mmdiv,
.ssdiv {
    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 10px;

    min-width: 0;
}


/* =====================================================
   LABELS
   ===================================================== */

.daydiv > span,
.monthdiv > span,
.yeardiv > span,
.hoursdiv > span,
.daynamediv > span,
.daynumberdiv > span,
.weeknumberdiv > span,
.hhdiv > span,
.mmdiv > span,
.ssdiv > span {
    font-size: 20px;

    color: white;

    white-space: nowrap;

    text-align: center;
}


/* =====================================================
   SECOND HALF
   ===================================================== */

.secondhalf {
    width: 100%;

    margin-top: 40px;
}


/* =====================================================
   TIME
   ===================================================== */

.time {
    display: flex;

    justify-content: center;

    align-items: flex-end;

    gap: 12px;

    width: 100%;
}


/* =====================================================
   GENERATED FIELD
   ===================================================== */

.flip-field {
    display: flex;

    justify-content: center;

    gap: 5px;

    min-width: 0;
}


/* =====================================================
   SINGLE SPLIT-FLAP CHARACTER
   ===================================================== */

.flip-card {
    position: relative;

    width: 48px;
    height: 64px;

    flex: 0 0 48px;

    perspective: 500px;

    color: white;

    font-family:
        "Courier New",
        monospace;

    font-size: 38px;
    font-weight: bold;
}


/* =====================================================
   COMMON HALF
   ===================================================== */

.card-half {
    position: absolute;

    left: 0;

    width: 100%;
    height: 50%;

    overflow: hidden;

    background-color: #292929;
}


/* =====================================================
   TOP
   ===================================================== */

.card-top {
    top: 0;

    border-radius:
        5px 5px 0 0;

    border-bottom:
        1px solid #050505;
}


/* =====================================================
   BOTTOM
   ===================================================== */

.card-bottom {
    bottom: 0;

    border-radius:
        0 0 5px 5px;

    border-top:
        1px solid #444;
}


/* =====================================================
   TEXT INSIDE CARD
   ===================================================== */

.card-half span {
    position: absolute;

    left: 0;

    width: 100%;
    height: 64px;

    line-height: 64px;

    text-align: center;
}


.card-top span {
    top: 0;
}


.card-bottom span {
    bottom: 0;
}


/* =====================================================
   OLD TOP FLAP
   ===================================================== */

.animated-top {
    position: absolute;

    z-index: 10;

    top: 0;
    left: 0;

    width: 100%;
    height: 50%;

    overflow: hidden;

    background-color: #333;

    border-radius:
        5px 5px 0 0;

    transform-origin: bottom;

    backface-visibility: hidden;
}


/* =====================================================
   NEW BOTTOM FLAP
   ===================================================== */

.animated-bottom {
    position: absolute;

    z-index: 9;

    bottom: 0;
    left: 0;

    width: 100%;
    height: 50%;

    overflow: hidden;

    background-color: #242424;

    border-radius:
        0 0 5px 5px;

    transform-origin: top;

    transform: rotateX(90deg);

    backface-visibility: hidden;
}


/* =====================================================
   ANIMATION TEXT
   ===================================================== */

.animated-top span,
.animated-bottom span {
    position: absolute;

    left: 0;

    width: 100%;
    height: 64px;

    line-height: 64px;

    text-align: center;
}


.animated-top span {
    top: 0;
}


.animated-bottom span {
    bottom: 0;
}


/* =====================================================
   ANIMATION
   ===================================================== */

.flip-old {
    animation:
        flipOld
        0.25s
        ease-in
        forwards;
}


.flip-new {
    animation:
        flipNew
        0.25s
        0.25s
        ease-out
        forwards;
}


/* =====================================================
   OLD TOP HALF FALLS
   ===================================================== */

@keyframes flipOld {

    from {
        transform:
            rotateX(0deg);

        filter:
            brightness(1);
    }

    to {
        transform:
            rotateX(-90deg);

        filter:
            brightness(0.5);
    }

}


/* =====================================================
   NEW BOTTOM HALF OPENS
   ===================================================== */

@keyframes flipNew {

    from {
        transform:
            rotateX(90deg);

        filter:
            brightness(0.5);
    }

    to {
        transform:
            rotateX(0deg);

        filter:
            brightness(1);
    }

}


/* =====================================================
   SPLIT LINE
   ===================================================== */

.flip-card::after {
    content: "";

    position: absolute;

    z-index: 20;

    left: 0;
    top: 50%;

    width: 100%;
    height: 1px;

    background-color: black;
}


/* =====================================================
   COLONS
   ===================================================== */

.spacediv {
    display: flex;

    flex-direction: column;

    align-items: center;

    min-width: 0;
}


.spacediv .dot {
    display: none;
}


.spacedata {
    height: 64px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 42px;
    font-weight: bold;

    color: #ef604e;
}


/* =====================================================
   LARGE CLOCK DIGITS
   ===================================================== */

.hhdata .flip-card,
.mmdata .flip-card,
.ssdata .flip-card {
    width: 60px;
    height: 80px;

    flex-basis: 60px;

    font-size: 48px;
}


.hhdata .card-half span,
.mmdata .card-half span,
.ssdata .card-half span,

.hhdata .animated-top span,
.mmdata .animated-top span,
.ssdata .animated-top span,

.hhdata .animated-bottom span,
.mmdata .animated-bottom span,
.ssdata .animated-bottom span {
    height: 80px;

    line-height: 80px;
}


.time .spacedata {
    height: 80px;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1000px) {

    .main {
        width: calc(100% - 30px);

        margin: 20px auto;

        padding: 24px 18px;
    }


    .calender {
        gap: 25px;
    }


    .bottomfirsthalf {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap:
            28px
            15px;
    }


    .hoursdiv,
    .daynamediv,
    .daynumberdiv,
    .weeknumberdiv {
        width: 100%;
    }

}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 600px) {

    html,
    body {
        width: 100%;

        max-width: 100%;

        overflow-x: hidden;
    }


    body {
        background-color: #2e5266;
    }


    /* =================================================
       MAIN
       ================================================= */

    .main {
        width: calc(100% - 12px);

        max-width: 100%;

        margin: 6px auto;

        padding:
            20px
            8px
            28px;

        overflow: hidden;
    }


    .firsthalf {
        width: 100%;

        gap: 28px;
    }


    /* =================================================
       DATE / MONTH / YEAR
       ================================================= */

    .calender {
        width: 100%;

        display: grid;

        grid-template-columns:
            minmax(0, 0.8fr)
            minmax(0, 1fr)
            minmax(0, 1.25fr);

        align-items: start;

        justify-content: stretch;

        gap: 6px;
    }


    .daydiv,
    .monthdiv,
    .yeardiv {
        width: 100%;

        min-width: 0;

        gap: 6px;
    }


    /* =================================================
       LOWER INFORMATION

       Running Hour | Day
       Total Days   | Week Number
       ================================================= */

    .bottomfirsthalf {
        width: 100%;

        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap:
            24px
            8px;

        align-items: start;

        justify-content: stretch;
    }


    .hoursdiv,
    .daynamediv,
    .daynumberdiv,
    .weeknumberdiv {
        width: 100%;

        min-width: 0;

        gap: 6px;
    }


    /* =================================================
       LABELS
       ================================================= */

    .daydiv > span,
    .monthdiv > span,
    .yeardiv > span,
    .hoursdiv > span,
    .daynamediv > span,
    .daynumberdiv > span,
    .weeknumberdiv > span {
        font-size: 13px;

        white-space: nowrap;

        text-align: center;
    }


    /* =================================================
       NORMAL INFORMATION CARDS
       ================================================= */

    .flip-field {
        width: auto;

        max-width: 100%;

        gap: 2px;

        justify-content: center;
    }


    .flip-card {
        width: 27px;
        height: 40px;

        flex:
            0
            0
            27px;

        font-size: 21px;
    }


    .card-half span,
    .animated-top span,
    .animated-bottom span {
        height: 40px;

        line-height: 40px;
    }


    /* =================================================
       CLOCK AREA
       ================================================= */

    .secondhalf {
        width: 100%;

        margin-top: 34px;
    }


    .time {
        width: 100%;

        display: grid;

        grid-template-columns:
            auto
            9px
            auto
            9px
            auto;

        justify-content: center;

        align-items: end;

        gap: 2px;
    }


    .hhdiv,
    .mmdiv,
    .ssdiv {
        width: auto;

        min-width: 0;

        gap: 5px;
    }


    .hhdiv > span,
    .mmdiv > span,
    .ssdiv > span {
        font-size: 11px;

        white-space: nowrap;

        text-align: center;
    }


    /* =================================================
       MOBILE CLOCK CARDS
       ================================================= */

    .hhdata .flip-card,
    .mmdata .flip-card,
    .ssdata .flip-card {
        width: 32px;
        height: 46px;

        flex:
            0
            0
            32px;

        font-size: 25px;
    }


    .hhdata .card-half span,
    .mmdata .card-half span,
    .ssdata .card-half span,

    .hhdata .animated-top span,
    .mmdata .animated-top span,
    .ssdata .animated-top span,

    .hhdata .animated-bottom span,
    .mmdata .animated-bottom span,
    .ssdata .animated-bottom span {
        height: 46px;

        line-height: 46px;
    }


    /* =================================================
       MOBILE COLON
       ================================================= */

    .spacediv {
        width: 9px;

        min-width: 9px;
    }


    .time .spacedata {
        width: 9px;
        height: 46px;

        padding: 0;

        font-size: 21px;

        justify-content: center;
    }

}


/* =====================================================
   SMALL PHONE
   ===================================================== */

@media (max-width: 400px) {

    .main {
        width: calc(100% - 8px);

        margin: 4px auto;

        padding:
            16px
            4px
            24px;
    }


    .firsthalf {
        gap: 24px;
    }


    /* =================================================
       CALENDAR
       ================================================= */

    .calender {
        gap: 3px;
    }


    .daydiv > span,
    .monthdiv > span,
    .yeardiv > span {
        font-size: 11px;
    }


    /* =================================================
       INFORMATION GRID
       ================================================= */

    .bottomfirsthalf {
        gap:
            20px
            4px;
    }


    .hoursdiv > span,
    .daynamediv > span,
    .daynumberdiv > span,
    .weeknumberdiv > span {
        font-size: 11px;
    }


    /* =================================================
       NORMAL CARDS
       ================================================= */

    .flip-field {
        gap: 1px;
    }


    .flip-card {
        width: 24px;
        height: 36px;

        flex:
            0
            0
            24px;

        font-size: 19px;
    }


    .card-half span,
    .animated-top span,
    .animated-bottom span {
        height: 36px;

        line-height: 36px;
    }


    /* =================================================
       CLOCK
       ================================================= */

    .secondhalf {
        margin-top: 28px;
    }


    .time {
        grid-template-columns:
            auto
            7px
            auto
            7px
            auto;

        gap: 1px;
    }


    .hhdiv > span,
    .mmdiv > span,
    .ssdiv > span {
        font-size: 9px;
    }


    .hhdata .flip-card,
    .mmdata .flip-card,
    .ssdata .flip-card {
        width: 28px;
        height: 42px;

        flex:
            0
            0
            28px;

        font-size: 22px;
    }


    .hhdata .card-half span,
    .mmdata .card-half span,
    .ssdata .card-half span,

    .hhdata .animated-top span,
    .mmdata .animated-top span,
    .ssdata .animated-top span,

    .hhdata .animated-bottom span,
    .mmdata .animated-bottom span,
    .ssdata .animated-bottom span {
        height: 42px;

        line-height: 42px;
    }


    .spacediv {
        width: 7px;

        min-width: 7px;
    }


    .time .spacedata {
        width: 7px;
        height: 42px;

        font-size: 18px;
    }

}


/* =====================================================
   EXTRA SMALL PHONE
   350px AND BELOW
   ===================================================== */

@media (max-width: 350px) {

    .main {
        width: calc(100% - 4px);

        margin: 2px auto;

        padding:
            14px
            2px
            20px;
    }


    /* =================================================
       LABELS
       ================================================= */

    .daydiv > span,
    .monthdiv > span,
    .yeardiv > span,
    .hoursdiv > span,
    .daynamediv > span,
    .daynumberdiv > span,
    .weeknumberdiv > span {
        font-size: 10px;
    }


    /* =================================================
       NORMAL CARDS
       ================================================= */

    .flip-card {
        width: 22px;
        height: 34px;

        flex:
            0
            0
            22px;

        font-size: 17px;
    }


    .card-half span,
    .animated-top span,
    .animated-bottom span {
        height: 34px;

        line-height: 34px;
    }


    /* =================================================
       CLOCK
       ================================================= */

    .time {
        grid-template-columns:
            auto
            6px
            auto
            6px
            auto;

        gap: 1px;
    }


    .hhdata .flip-card,
    .mmdata .flip-card,
    .ssdata .flip-card {
        width: 26px;
        height: 40px;

        flex:
            0
            0
            26px;

        font-size: 20px;
    }


    .hhdata .card-half span,
    .mmdata .card-half span,
    .ssdata .card-half span,

    .hhdata .animated-top span,
    .mmdata .animated-top span,
    .ssdata .animated-top span,

    .hhdata .animated-bottom span,
    .mmdata .animated-bottom span,
    .ssdata .animated-bottom span {
        height: 40px;

        line-height: 40px;
    }


    .spacediv {
        width: 6px;

        min-width: 6px;
    }


    .time .spacedata {
        width: 6px;
        height: 40px;

        font-size: 17px;
    }

}