body.rtc {
    /* Override universal body layout/typography */
    display: flex;
    height: 100vh;
    align-items: center;
    justify-content: center;
    overflow: hidden;

    color: white;
    font-family: var(--font-clock);
    user-select: none;

    --link-hover-bg: transparent;

    /* Glow background */
    background: radial-gradient(circle at center, darkslateblue 0%, #181818 100%);
}

body.rtc a {
    /* Remove underline and color from links */
    color: inherit;
    text-decoration: none;
}

body.rtc a:hover {
    color: yellow;
}

.btn {
    --rtc-btn-inset: clamp(16px, 4vw, 32px);

    /* 
    1rem = Never go below user's preferred font size (default: 16px)
    calc(0.5rem + 1.5vw) = Preferred size based on root font size and viewport width
    2rem = Never go above double the user's preferred font size
    */
    --rtc-btn-font-size: clamp(1rem, calc(0.5rem + 1.5vw), 2rem);

    position: absolute;
    font-size: var(--rtc-btn-font-size);
}

#back-btn {
    top: var(--rtc-btn-inset);
    left: var(--rtc-btn-inset);
}

#info-btn {
    bottom: var(--rtc-btn-inset);
    right: var(--rtc-btn-inset);
}

/* Overrides */
nav {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

/* Overrides */
nav a {
    font-weight: normal;
    margin: 0;
}

#container {
    --rtc-content-padding: 1rem;

    /* Overrides */
    width: auto;
    max-width: 100vw;
    min-width: 0;

    background-color: transparent;
    border: none;
    padding: 0 var(--rtc-content-padding);
    /* --------- */

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

#date {
    --rtc-date-font-size: clamp(1rem, calc(0.5rem + 6vw), 6rem);
    --rtc-date-clock-gap: 0.2em; /* 0.2x the date font's size */

    font-size: var(--rtc-date-font-size);
    margin-bottom: var(--rtc-date-clock-gap);
    white-space: nowrap;
}

#clock-rtc {
    --rtc-clock-font-size: clamp(1.2rem, calc(0.5rem + 12vw), 16rem);

    color: white;
    font-size: var(--rtc-clock-font-size);
    line-height: 1;
    white-space: nowrap;
}

/* --- Effects --- */

/* Scanline overlay */
body.rtc::before {
    --scanline-row-spacing: clamp(2px, 0.5vh, 8px);
    --scanline-column-spacing: clamp(2px, 0.3vw, 6px);
    --scanline-row-opacity: 0.1;
    --scanline-column-opacity: 0.02;

    z-index: 1;
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;

    background:
        linear-gradient(transparent 50%, rgba(0, 0, 0, var(--scanline-row-opacity)) 50%),
        linear-gradient(90deg, transparent 50%, rgba(0, 0, 0, var(--scanline-column-opacity)) 50%);
    background-size:
        100% var(--scanline-row-spacing),
        var(--scanline-column-spacing) 100%;
}

/* Glitch effect */
@keyframes glitch-shake {
    0% {
        transform: translate(0);
        text-shadow: none;
    }
    20% {
        transform: translate(calc(-1 * var(--glitch-shift-x)), var(--glitch-shift-y));
        text-shadow:
            var(--glitch-shadow-offset) 0 rgba(255, 0, 0, var(--glitch-shadow-opacity)),
            calc(-1 * var(--glitch-shadow-offset)) 0 rgba(0, 255, 255, var(--glitch-shadow-opacity));
    }
    40% {
        transform: translate(calc(-1 * var(--glitch-shift-x)), calc(-1 * var(--glitch-shift-y)));
        text-shadow:
            calc(-1 * var(--glitch-shadow-offset)) 0 rgba(255, 0, 0, var(--glitch-shadow-opacity)),
            var(--glitch-shadow-offset) 0 rgba(0, 255, 255, var(--glitch-shadow-opacity));
    }
    60% {
        transform: translate(var(--glitch-shift-x), var(--glitch-shift-y));
        text-shadow:
            var(--glitch-shadow-offset) 0 rgba(0, 255, 0, var(--glitch-shadow-opacity)),
            calc(-1 * var(--glitch-shadow-offset)) 0 rgba(255, 0, 255, var(--glitch-shadow-opacity));
    }
    80% {
        transform: translate(var(--glitch-shift-x), calc(-1 * var(--glitch-shift-y)));
        text-shadow:
            calc(-1 * var(--glitch-shadow-offset)) 0 rgba(0, 255, 0, var(--glitch-shadow-opacity)),
            var(--glitch-shadow-offset) 0 rgba(255, 0, 255, var(--glitch-shadow-opacity));
    }
    100% {
        transform: translate(0);
        text-shadow: none;
    }
}

/* Glitch effect timing */
.glitch-active {
    --glitch-shift-x: 0.02em;
    --glitch-shift-y: 0.01em;
    --glitch-shadow-offset: 4px;
    --glitch-shadow-opacity: 0.6;
    --glitch-duration: 0.25s;

    animation: glitch-shake var(--glitch-duration) cubic-bezier(0.3, 0.2, 0.05, 0.99);
}
