/* ---------- Reset ---------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Montserrat", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    padding-top: 200px;
    height: 100vh;
    overflow: hidden;
}

:root {
    /* Shared "frosted glass" look used by buttons, the nav list, and the toggle switch. */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.6);
}

/* ---------- Background gradient layers (Granim) ---------- */

.granim-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.granim-layer--screen {
    mix-blend-mode: screen;
    opacity: 0.8;
}

.granim-layer--overlay {
    mix-blend-mode: overlay;
    opacity: 0.85;
}

/* ---------- Hero / logo ---------- */

#hero {
    width: fit-content;
    margin: 0 auto;
}

h1 {
    position: relative;
    color: #fff;
    text-align: center;
    font-weight: 300;
    font-size: 10vw;
    opacity: 0;
    user-select: none;
    white-space: nowrap;
}

#visualizer {
    position: relative;
    width: 65%;
    height: 240px;
    margin: auto;
}

/* ---------- Buttons ---------- */

.btn {
    padding: 0.6em 1.2em;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

#audio-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

#remix {
    position: fixed;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

#remix:disabled {
    cursor: default;
}

/* ---------- "Playing:" label ---------- */

#playing {
    color: white;
    font-size: 12px;
    position: fixed;
    bottom: 15px;
    left: 15px;
    width: 85%;
}

#playing-list span {
    opacity: 0;
}

#playing-list span:not(:last-child)::after {
    content: ', ';
}

/* ---------- Parental controls toggle ---------- */

#parental {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    color: #fff;
    font-size: 0.9rem;
}

#parental p {
    margin: 0;
    user-select: none;
}

/* Container wrapping the toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 75px; /* Widened slightly to fit the text comfortably */
    height: 34px;
}

/* Hide the native checkbox while keeping it accessible */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The track of the switch (the pill shape) */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-bg);
    border-radius: 34px;
    transition: background-color 0.3s ease;
}

/* The ON/OFF text label inside the track */
.slider::before {
    content: "OFF";
    position: absolute;
    right: 10px; /* Aligns "OFF" to the right side initially */
    top: 50%;
    transform: translateY(-50%); /* Perfectly centers text vertically */
    color: white;
    font-family: sans-serif;
    font-size: 12px;
    font-weight: bold;
}

/* The sliding circle (the knob) inside the switch */
.slider::after {
    content: "";
    position: absolute;
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

/* State changes when the switch is ON */
.switch input:checked + .slider {
    background-color: rgba(76, 175, 80, 0.8); /* Changes track to green */
}

/* Switch the text content and position when ON */
.switch input:checked + .slider::before {
    content: "ON";
    left: 12px; /* Moves "ON" to the left side */
    right: auto;
}

/* Move the circle knob to the right when ON */
.switch input:checked + .slider::after {
    transform: translateX(41px); /* Adjusted distance for the wider track */
}

/* Keyboard navigation accessibility outline */
.switch input:focus-visible + .slider {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

/* ---------- Hamburger menu / nav ---------- */

nav {
    position: absolute;
    right: 20px;
    top: calc( 100svh - 70px );
    width: 150px;
    display: flex;
    flex-direction: column;
    transition: all 500ms ease-out;
}

/* Both states repeat their own `top` (matching the base above) so the
   class swap in script.js has two explicit values to transition between. */
.menu-hidden {
    top: calc( 100svh - 70px );
}

.menu-showing {
    top: calc( 100svh - 200px );
}

.menu-btn {
    align-self: flex-end;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 70px;
    height: 70px;
    padding: 25px 20px 20px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 50%;
    border-top-right-radius: 50%;
    border-bottom: none;
    /* Nudged down 1px to line up with nav ul's clip-path notch below. */
    position: relative;
    top: 1px;
}

.menu-btn span {
    background: #fff;
    border-radius: 2px;
    display: block;
    height: 3px;
    transition: all 0.3s ease-in-out;
    width: 100%;
}

nav .menu-btn.is-active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

nav .menu-btn.is-active span:nth-child(2) {
    opacity: 0;
}

nav .menu-btn.is-active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

nav ul {
    list-style-type: none;
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 20px;
    /* menu-btn sits directly above the right ~70px of this list, so its own
       top border would show through under the button. This clips away that
       1px strip (from x=80px, where the button's left edge lands, to the
       right edge) while leaving the rounded top-left corner untouched. */
    clip-path: polygon(0 0, 80px 0, 80px 1px, 100% 1px, 100% 100%, 0 100%);
}

nav ul li {
    margin-bottom: 1em;
}

nav ul li a {
    text-decoration: none;
    font-weight: 700;
    color: #fff;
}

nav ul li a:hover {
    color: #2e5cb2;
}

nav ul li:last-of-type {
    display: flex;
    gap: 5px;
}

nav ul li img {
    display: block;
    width: 30px;
}

/* ---------- About panel ---------- */

#about {
    position: fixed;
    top: 10%;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 650px;
    padding: 20px;
    border: 1px solid #000;
    border-radius: 20px;
    background-color: rgba(51, 51, 51, 0.8);
    color: #fff;
    font-weight: 600;
    overflow-y: scroll;
    transition: opacity 500ms ease;
}

#about p, #about h2 {
    margin-bottom: 1em;
}

#about-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

#about a {
    color: #7fa2e1;
    text-decoration: none;
}

.article-showing {
    opacity: 1;
    z-index: 1000;
    pointer-events: auto;
}

.article-hidden {
    opacity: 0;
    z-index: -1000;
    pointer-events: none;
}
