/* Hide main content by default to prevent the "Login Flash" */
.main-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-content.auth-ready {
    opacity: 1;
}

:root {
    --font-body: "Manrope", sans-serif;
    --font-display: "Playfair Display", serif;
    --bg: #d4d8de;
    --bg-tint: rgba(241, 244, 248, 0.28);
    --surface: rgba(240, 243, 247, 0.26);
    --surface-strong: rgba(246, 248, 251, 0.38);
    --shadow: 0 28px 80px rgba(40, 49, 70, 0.14);
    --text: #1a2232;
    --muted: #606d84;
    --heading: #111827;
    --accent: #45d2c5;
    --accent-2: #6698ff;
    --line: rgba(255, 255, 255, 0.18);
}

.darkmode {
    --bg: #020308;
    --bg-tint: rgba(7, 9, 15, 0.46);
    --surface: rgba(10, 13, 20, 0.54);
    --surface-strong: rgba(13, 17, 26, 0.72);
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.68);
    --text: #e5e9f5;
    --muted: #8792a8;
    --heading: #fbfcff;
    --accent: #56e4d4;
    --accent-2: #6ea8ff;
    --line: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: var(--text);
    font-family: var(--font-body);
}

*::selection {
    background: rgba(86, 228, 212, 0.16);
    color: var(--heading);
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 26%),
        radial-gradient(circle at bottom right, rgba(102, 152, 255, 0.14), transparent 28%),
        linear-gradient(180deg, var(--bg-tint), rgba(255,255,255,0.02)),
        var(--bg);
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -3;
}

.backdrop-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(44px);
}

.orb-one {
    width: 34rem;
    height: 34rem;
    top: -12rem;
    left: -10rem;
    background: rgba(86, 228, 212, 0.12);
}

.orb-two {
    width: 30rem;
    height: 30rem;
    right: -8rem;
    top: 18%;
    background: rgba(110, 168, 255, 0.14);
}

.backdrop-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 84px 84px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 88%);
}

.glass-panel,
header,
.sidebar,
footer,
.editorial-card,
.editorial-quote {
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

.sidebar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: min(22rem, calc(100vw - 2rem));
    height: calc(100vh - 2rem);
    padding: 1.4rem 1rem 1rem;
    border-radius: 1.9rem;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.32s ease, opacity 0.32s ease;
    z-index: 30;
}

.sidebar.closed {
    transform: translateX(calc(100% + 1.5rem));
    opacity: 0;
    pointer-events: none;
}

.sidebar li {
    display: flex;
}

.sidebar li:first-child {
    padding: 0.2rem 0.2rem 0.8rem;
}

.sidebar li:first-child h1 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    color: var(--heading);
    line-height: 1;
}

.sidebar a,
.dark-mode-toggle,
#profile-section {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.05rem;
    border-radius: 1.15rem;
    background: transparent;
}

.sidebar a {
    font-weight: 700;
    color: var(--text);
}

.sidebar a svg {
    color: inherit;
    flex-shrink: 0;
}

#menu {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    color: var(--heading);
}

.dark-mode-toggle {
    justify-content: space-between;
}

.theme-switch {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.theme-switch span {
    color: var(--muted);
    font-weight: 700;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 3.5rem;
    min-width: 3.5rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.slider::before {
    content: "";
    position: absolute;
    top: 0.2rem;
    left: 0.22rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.28s ease;
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

input:checked + .slider::before {
    transform: translateX(1.46rem);
}

#profile-section {
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
}

#sign-in-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

#sign-in-section a {
    width: 100%;
}

#sign-in-section button,
#profile-section button {
    width: 100%;
    min-height: 3rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.sidebar-signout {
    color: var(--text);
    border-color: var(--line);
    background: transparent;
}

main {
    width: min(1220px, calc(100% - 2rem));
    min-height: 100vh;
    margin: 0 auto;
    padding: 1rem 0 1.2rem;
    display: grid;
    gap: 0.9rem;
}

header {
    padding: 1rem 0.4rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 4.8rem);
    color: var(--heading);
    line-height: 1;
    letter-spacing: -0.03em;
}

#h_icons {
    display: flex;
    align-items: center;
}

#profile-icon {
    width: 3.3rem;
    height: 3.3rem;
    border-radius: 999px;
    background: var(--surface-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 1.2rem;
    align-items: stretch;
}

#intro,
#joinnhost {
    border-radius: 2rem;
    padding: 1.4rem 0.2rem;
    background: transparent;
    box-shadow: none;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.section-kicker {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
    font-weight: 800;
}

#dynamic-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 6.8rem);
    line-height: 0.94;
    color: var(--heading);
    margin-bottom: 1rem;
    max-width: 9ch;
}

#intro p {
    color: var(--muted);
    line-height: 1.9;
    font-size: 1.03rem;
    max-width: 39rem;
}

#joinnhost {
    display: flex;
    align-items: center;
}

.action-stack {
    width: 100%;
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 2rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

#cnb button,
#join form input[type="submit"] {
    width: 100%;
    min-height: 3.45rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 800;
}

#cnb button a {
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.45rem;
}

.join-caption {
    color: var(--muted);
    font-size: 0.95rem;
}

#join-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6.75rem;
    gap: 0.75rem;
    align-items: stretch;
}

#joincode {
    min-height: 3.45rem;
    border-radius: 1.2rem;
    border: 0;
    padding: 0 1rem;
    background: rgba(9, 13, 22, 0.42);
    color: var(--heading);
}

body:not(.darkmode) #joincode {
    background: rgba(255, 255, 255, 0.4);
}

.editorial-grid {
    display: grid;
    grid-template-columns: 1.05fr 1.05fr 0.9fr;
    gap: 1rem;
    align-items: stretch;
}

.editorial-card,
.editorial-quote {
    border-radius: 1.8rem;
    padding: 1.25rem 0.3rem;
    background: transparent;
    box-shadow: none;
    border: 0;
}

.editorial-card h3 {
    color: var(--heading);
    font-size: 1.45rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.editorial-card p {
    color: var(--muted);
    line-height: 1.8;
}

.editorial-quote {
    display: flex;
    align-items: flex-end;
}

.editorial-quote p {
    color: var(--heading);
    font-size: 1.18rem;
    line-height: 1.8;
}

footer {
    margin-top: auto;
    border-radius: 1.5rem;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

@media (max-width: 1024px) {
    .hero-shell,
    .editorial-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .sidebar {
        width: calc(100vw - 1rem);
        top: 0.5rem;
        right: 0.5rem;
        height: calc(100vh - 1rem);
    }

    main {
        width: min(100%, calc(100% - 1rem));
    }

    #join-form {
        grid-template-columns: 1fr;
    }

    #dynamic-title {
        max-width: none;
    }
}

.sidebar-title {
    font-family: var(--font-body) !important;
    font-size: 0.78rem !important;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted) !important;
}

.brand-link {
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    width: clamp(5.2rem, 10vw, 7.5rem);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.12));
}
