button {
    all: unset;
    cursor: pointer;
    box-sizing: border-box;
}

/* GRID BACKGROUND ANIMATION */
html {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    position: relative;
    height: 100vh;
    margin: 0;
    padding: 30px;
    background: linear-gradient(
        #000000 25%,
        #ff3131 50%,
        #ff3131 50%,
        #000000 100%
    );
    background-attachment: fixed;
    font-family: "Orbitron", "Courier New", monospace;
    color: red;
}

.wrap {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    margin: 0 auto;
    perspective: 360px;
    perspective-origin: 50% 50%;
    pointer-events: none;
    z-index: 0;
}

.top-plane {
    width: 200%;
    height: 130%;
    position: absolute;
    bottom: -30%;
    left: -50%;
    background-image: 
        linear-gradient(#ff3131 2px, transparent 2px),
        linear-gradient(to right, #ff3131 2px, transparent 2px);
    background-size: 100px 100px, 100px 100px;
    background-position: -1px -1px, -1px -1px;
    transform: rotateX(85deg);
    animation: planeMoveTop 2s infinite linear;
}

.bottom-plane {
    width: 200%;
    height: 130%;
    position: absolute;
    top: -30%;
    left: -50%;
    background-image: 
        linear-gradient(#ff3131 2px, transparent 2px),
        linear-gradient(to right, #ff3131 2px, transparent 2px);
    background-size: 100px 100px, 100px 100px;
    background-position: -1px -1px, -1px -1px;
    transform: rotateX(-85deg);
    animation: planeMoveBot 2s infinite linear;
}

@keyframes planeMoveTop {
    from {
        background-position: 0px -100px, 0px 0px;
    }
    to {
        background-position: 0px 0px, 100px 0px;
    }
}

@keyframes planeMoveBot {
    from {
        background-position: 0px 0px, 0px 0px;
    }
    to {
        background-position: 0px -100px, 100px 0px;
    }
}

@media (max-height: 350px) {
    .wrap {
        perspective: 210px;
    }
}

/* OVERALL STYLE STUFFS */
body {
    background-attachment: fixed;
    font-family: "Orbitron", "Courier New", monospace;
    color: red;
    margin: 0;
    padding: 30px;
}

header h1 {
    font-family: "Audiowide", "Courier New", monospace;
    font-size: 2em;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

h1, h2, h3, h4, h5 {
    font-family: "Audiowide", "Courier New", monospace;
    margin: 0;
    padding: 0;
}

p {
    margin: 0;
    padding: 0;
    font-size: small;
}

/* MAINCONTAINER */
.maincontainer {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: black; 
    border: 10px double red;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 20px red;
    z-index: 1;
    position: relative;
}

/* HEADER STUFFS AND MARQUEES */
header {
    text-align: center;
}

header marquee {
    display: block;
    border: 4px dotted red; 
    padding: 3px;
    margin-bottom: 10px;
    color: red;
    background: black;
    font-weight: bold;
}

footer marquee {
    display: block;
    border: 2px solid red; 
    padding: 3px;
    margin-top: 10px;
    color: red;
    background: black;
    font-size: 10px;
    font-weight: bold;
}

/* NAV STUFFS */
nav {
    display: flex;
    justify-content: space-evenly;
    margin-bottom: 10px;
}

nav a {
    color: red !important;
    text-decoration: none;
    border: 2px solid red;
    background: black;
    padding: 5px 15px;
    font-weight: bold;
    font-family: "Audiowide", "Courier New", monospace;
    transition: all 0.2s ease-in-out;
    position: relative;
}

nav a:visited {
    color: red !important;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 3px red) drop-shadow(0 0 6px red);
    }
    50% {
        filter: drop-shadow(0 0 6px red) drop-shadow(0 0 12px red);
    }
}

nav a:hover {
    background: black !important; 
    color: red !important; 
    transform: translateY(-3px);
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

/* NAV ACTIVE TAB WITH SCREEN TEAR GLITCH */
nav a.active {
    background: black !important;
    color: red !important;
    transform: translateY(-2px);
    animation: pulseGlow 3s ease-in-out infinite alternate;
}

nav a.active::before,
nav a.active::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 5px 15px;
    pointer-events: none;
    opacity: 0;
    overflow: hidden;
    background: black;
}

nav a.active.glitch {
    animation: navShake 0.5s ease-in-out, pulseGlow 3s ease-in-out infinite alternate;
}

nav a.active.glitch::before {
    animation: navTearLeft 0.5s ease-in-out;
    color: #ff00ff;
    z-index: 1;
}

nav a.active.glitch::after {
    animation: navTearRight 0.5s ease-in-out;
    color: #00ffff;
    z-index: 2;
}

@keyframes navShake {
    0%, 100% { transform: translateY(-2px) translate(0, 0); }
    10% { transform: translateY(-2px) translate(-2px, 0); }
    20% { transform: translateY(-2px) translate(2px, 0); }
    30% { transform: translateY(-2px) translate(-1px, 0); }
    40% { transform: translateY(-2px) translate(3px, 0); }
    50% { transform: translateY(-2px) translate(-2px, 0); }
    60% { transform: translateY(-2px) translate(1px, 0); }
    70% { transform: translateY(-2px) translate(-3px, 0); }
    80% { transform: translateY(-2px) translate(2px, 0); }
    90% { transform: translateY(-2px) translate(-1px, 0); }
}

@keyframes navTearLeft {
    0%, 100% { opacity: 0; clip-path: inset(0 0 0 0); transform: translateX(0); }
    5% { opacity: 0.8; clip-path: inset(23% 0 67% 0); transform: translateX(-8px); }
    15% { opacity: 0.7; clip-path: inset(61% 0 12% 0); transform: translateX(-5px); }
    25% { opacity: 0.9; clip-path: inset(8% 0 88% 0); transform: translateX(-10px); }
    35% { opacity: 0.6; clip-path: inset(47% 0 31% 0); transform: translateX(-6px); }
    45% { opacity: 0.8; clip-path: inset(72% 0 15% 0); transform: translateX(-9px); }
    55% { opacity: 0.7; clip-path: inset(19% 0 73% 0); transform: translateX(-7px); }
    65% { opacity: 0.9; clip-path: inset(54% 0 28% 0); transform: translateX(-11px); }
    75% { opacity: 0.6; clip-path: inset(33% 0 59% 0); transform: translateX(-5px); }
    85% { opacity: 0.8; clip-path: inset(68% 0 7% 0); transform: translateX(-8px); }
    95% { opacity: 0.5; clip-path: inset(11% 0 81% 0); transform: translateX(-4px); }
}

@keyframes navTearRight {
    0%, 100% { opacity: 0; clip-path: inset(0 0 0 0); transform: translateX(0); }
    8% { opacity: 0.7; clip-path: inset(41% 0 48% 0); transform: translateX(7px); }
    18% { opacity: 0.9; clip-path: inset(77% 0 9% 0); transform: translateX(9px); }
    28% { opacity: 0.6; clip-path: inset(14% 0 79% 0); transform: translateX(5px); }
    38% { opacity: 0.8; clip-path: inset(52% 0 36% 0); transform: translateX(11px); }
    48% { opacity: 0.7; clip-path: inset(29% 0 64% 0); transform: translateX(6px); }
    58% { opacity: 0.9; clip-path: inset(66% 0 18% 0); transform: translateX(10px); }
    68% { opacity: 0.6; clip-path: inset(7% 0 86% 0); transform: translateX(8px); }
    78% { opacity: 0.8; clip-path: inset(44% 0 42% 0); transform: translateX(7px); }
    88% { opacity: 0.7; clip-path: inset(81% 0 3% 0); transform: translateX(9px); }
    98% { opacity: 0.5; clip-path: inset(26% 0 68% 0); transform: translateX(4px); }
}

/* LINK STYLES */
a:not(nav a) {
    position: relative;
    display: inline-block;
    color: blueviolet;
    background-color: transparent;
    text-decoration: none;
}

a:not(nav a):visited {
    color: darkred;
}

a:not(nav a):hover {
    animation: linkShake 0.3s ease-in-out;
}

@keyframes linkShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 0); }
    50% { transform: translate(1px, 0); }
    75% { transform: translate(-1px, 0); }
}

/* GRID LAYOUT */
main {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    grid-template-areas: 
        "studiobox calendarbox nextbox"
        ". calendarbox ."
        ". calendarbox ."
        "multibox multibox multibox";
}

.studiobox { 
    grid-area: studiobox;
    border: none;
    padding: 10px;
    background: rgba(255, 0, 0, 0.2);
    text-align: left;
}

.nextbox { 
    grid-area: nextbox;
    border: 2px solid red;
    padding: 10px;
    background: transparent;
    text-align: left;
}

.calendarbox {
    grid-area: calendarbox;
}

.multibox { 
    grid-area: multibox;
    border: none;
    padding: 10px;
    background: transparent;
    text-align: center;
    margin-top: 20px;
}

.descriptionbox { 
    border: none;
    padding: 10px;
    background: transparent;
}

.accessbox { 
    border: none;
    padding: 10px;
    background: transparent;
    text-align: left;
    margin-top: 20px;
}

.accessbox h4 {
    text-align: center;
}

/* CLASS BOXES IN DESCRIPTIONBOX */
.class-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.class-box {
    position: relative;
    border: 2px solid red;
    border-radius: 5px;
    padding: 8px 5px;
    background: black;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
}

.class-box:hover {
    background: black;
    transform: translateY(-3px);
    z-index: 1001;
    border-color: #ff3366;
    animation: borderPulse 2s ease-in-out infinite alternate;
}

@keyframes borderPulse {
    0%, 100% {
        border-color: red;
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.6);
    }
    50% {
        border-color: #ff3366;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.9), 0 0 25px rgba(255, 0, 0, 0.6);
    }
}

.class-name {
    font-family: "Audiowide", "Courier New", monospace;
    font-size: 1em;
    margin-bottom: 3px;
}

.class-level {
    font-size: 0.7em;
    opacity: 0.8;
}

.class-location {
    color: red;
    font-style: italic;
    font-size: 18px !important;
    margin-bottom: 8px;
}

.class-online {
    color: blueviolet;
    font-size: 14px !important;
    font-weight: bold;
    margin-bottom: 8px;
}

.class-prerequisites {
    color: red;
    font-weight: bold;
    font-size: 16px !important;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid red;
}

.class-tagline {
    font-size: 14px !important;
    margin-bottom: 10px;
    color: red;
}

.class-description p:not([class]) {
    font-family: "Space Mono", monospace;
    font-size: 14px !important;
}

.class-description {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: black;
    border: 3px solid red;
    padding: 15px;
    min-width: 250px;
    max-width: 300px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    text-align: left;
}

.class-box:hover .class-description {
    opacity: 1;
    pointer-events: auto;
}

.class-description p {
    font-size: 12px;
    line-height: 1.5;
}

/* Adjust positioning for boxes on edges */
.class-box:nth-child(5n) .class-description,
.class-box:nth-child(5n-1) .class-description {
    left: auto;
    right: 0;
    transform: none;
}

.class-box:nth-child(5n+1) .class-description,
.class-box:nth-child(5n+2) .class-description {
    left: 0;
    transform: none;
}

/*DROPDOWN MENU STUFF FOR ACCESSBOX*/
.accessbox h4 {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 10px;
}

.accessbox h4:first-child {
    margin-top: 0;
}

.access-dropdown {
    margin-bottom: 8px;
}

.access-dropdown h5 {
    cursor: pointer;
    padding: 15px 20px;
    background: rgba(255, 0, 0, 0.15);
    border: 2px solid red;
    margin: 0;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.access-dropdown h5:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateX(3px);
}

.access-dropdown h5 .arrow {
    transition: transform 0.3s;
    font-size: 0.8em;
}

.access-dropdown h5.open .arrow {
    transform: rotate(180deg);
}

.access-content {
    display: none;
    padding: 10px;
    border: 2px solid red;
    border-top: none;
    background: black;
    margin-bottom: 5px;
}

.access-content.show {
    display: block;
}

.access-content p {
    margin: 5px 0;
    line-height: 1.5;
}

.access-content ul {
    margin: 10px 0;
    padding-left: 20px;
    list-style: none;  /* Remove default bullets */
}

.access-content li {
    margin-bottom: 10px;
    line-height: 1.6;
    position: relative;
    padding-left: 20px;  /* Make room for the arrow */
    font-family: "space mono"
}

.access-content li::before {
    content: "»";
    position: absolute;
    left: 0;
    top: 0;
    color: red;
    font-size: 25px; 
    line-height: 1;
}

.access-content li strong {
    color: blueviolet;
    font-family: "orbitron";
}

/* CALENDAR STYLES */
.calendar-container {
    border: none;
    padding: 15px;
    background-image: url(IMAGES/starspurple.gif);
    background-repeat: repeat;
    background-size: auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    border: 2px solid red;
    background: rgba(255, 0, 0, 0.1);
}

.calendar-header h3 {
    margin: 0;
    font-family: "Audiowide", "Courier New", monospace;
    color: red;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    background: black;
    border: 2px solid red;
    color: red;
    padding: 5px 15px;
    cursor: pointer;
    font-family: "Audiowide", "Courier New", monospace;
    font-weight: bold;
    transition: all 0.2s;
}

.calendar-nav button:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateY(-2px);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-header {
    text-align: center;
    padding: 10px;
    font-weight: bold;
    border: 2px solid red;
    background: rgba(255, 0, 0, 0.2);
    color: red;
    font-size: 12px;
    font-family: "Audiowide", "Courier New", monospace;
}

.calendar-cell {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid red;
    background: black;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
}

.calendar-cell.has-event {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff0066;
}

.calendar-cell.other-month {
    opacity: 0.3;
}

.calendar-cell:hover {
    background: rgba(255, 0, 0, 0.3);
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 15px red;
}

.cell-date {
    font-weight: bold;
    margin-bottom: 5px;
    color: red;
    font-family: "Audiowide", "Courier New", monospace;
}

.cell-indicator {
    font-size: 10px;
    color: #ff0066;
    text-align: center;
    font-family: "Orbitron", "Courier New", monospace;
}

/* HOVER WINDOW */
.hover-window {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    background: black;
    border: 3px solid red;
    padding: 15px;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.calendar-cell:hover .hover-window,
.hover-window.active {
    opacity: 1;
    pointer-events: auto;
}

.hover-window.multi-event {
    min-width: 280px;
    max-width: 400px;
}

.hover-window h4 {
    color: red;
    margin: 0 0 10px 0;
    font-family: "Audiowide", "Courier New", monospace;
    border-bottom: 2px solid red;
    padding-bottom: 5px;
}

.hover-window p {
    color: red;
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.4;
    font-family: "Orbitron", "Courier New", monospace;
}

.hover-window hr {
    border: none;
    border-top: 2px dashed red; 
    margin: 10px 0;
}

.event-time {
    color: #ff0066;
    font-weight: bold;
}

.event-location {
    color: #ff3366;
    font-style: italic;
}

.event-link {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 0, 0, 0.3);
}

/* Hover window positioning for edge cells */
.calendar-cell:nth-child(7n+6) .hover-window,
.calendar-cell:nth-child(7n+7) .hover-window {
    left: auto;
    right: 0;
    transform: none;
}

.calendar-cell:nth-child(7n+1) .hover-window,
.calendar-cell:nth-child(7n+2) .hover-window {
    left: 0;
    transform: none;
}