:root {
    --panel-h: clamp(420px, 68vh, 860px);
    /* tweak to taste */
    /*Light mode colors*/
    --body-bg-color-light: #000000;
    --body-text-color-light: #FFFFFF;
    --nav-text-color-light: #FFFFFF;
    --dropdown-bg-color-light: #000000;
    --dropdown-text-color-light: #FFFFFF;
    --wrapper-bg-color-light: #FAEBD7;
    --wrapper-text-color-light: #000000;
    /*Dark mode colors*/
    --body-bg-color-dark: #FAEBD7;
    --body-text-color-dark: #000000;
    --nav-text-color-dark: #000000;
    --dropdown-bg-color-dark: #FAEBD7;
    --dropdown-text-color-dark: #000000;
    --wrapper-bg-color-dark: #212121;
    --wrapper-text-color-dark: #FAEBD7;
}

* {
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
}

body {
    height: 100vh;
    background-color: var(--body-bg-color-light);
    color: var(--body-text-color-light);
}

body.dark-mode {
    height: 100vh;
    background-color: var(--body-bg-color-dark);
    color: var(--body-text-color-dark);
}

header {
    margin-top: 1%;
    margin-left: 3%;
    margin-right: 3%;
}

td a {
    text-decoration: none;
    color: var(--nav-text-color-dark);
    font-style: italic;
}

td a.dark-mode {
    text-decoration: none;
    color: var(--wrapper-text-color-dark);
    font-style: italic;
}

a {
    color: var(--nav-text-color-light);
    text-decoration: none;
    font-weight: bold;
}

a.dark-mode {
    color: var(--nav-text-color-dark);
    text-decoration: none;
    font-weight: bold;
}

#home {
    background-image: url('./icons8-home.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: auto;
    width: 2em;
    height: 2em;
}

#home.dark-mode {
    background-image: url('./icons8-home-filled.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: auto;
    width: 2em;
    height: 2em;
}

#about {
    margin-top: 10px;
}

.header-left,
.header-right {
    text-align: center;
    padding: 1px;
    letter-spacing: 0.20em;
    line-height: 1.5em;
}

.header-right #toggle {
    background-image: url('images/icons8-lightbulb-50-white.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: auto;
    width: 2em;
    height: 2em;
}

.header-right #toggle.dark-mode {
    background-image: url('images/icons8-lightbulb-50.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: auto;
    width: 2em;
    height: 2em;
}

#dropdown-content {
    display: none;
}

#dropdown-content a {
    padding: 5px;
    font-weight: normal;
    color: var(--body-text-color-light);
}

#dropdown-content a.dark-mode {
    padding: 5px;
    font-weight: normal;
    color: var(--body-text-color-dark);
}


#welcome h1 {
    font-size: 250%;
}

#message p {
    font-size: 130%;
}

.title a {
    text-decoration: none;
    color: var(--nav-text-color-dark);
}

.title a.dark-mode {
    text-decoration: none;
    color: var(--wrapper-text-color-dark);
}

.presentation {
    flex-direction: column;
}

.scores {
    margin-top: 50px;
}

.table-head {
    display: flex;
    justify-content: center;
}

.table-body {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    width: 100%;
    margin: auto;
}

td {
    padding: 2px;
}

.column-left {
    text-align: left;
}

.column-right {
    text-align: center;
}

.subtitle {
    text-align: left;
}

img {
    width: 80%;
    margin: 10px auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

hr {
    border-top: solid black;
}

form {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    padding: 1em;
    margin: auto;
    width: 90%;
}

input[type="submit"] {
    margin-top: 1em;
    background-color: var(--body-bg-color-light);
    opacity: 85%;
    color: var(--body-text-color-light);
}

input.dark-mode[type="submit"] {
    margin-top: 1em;
    background-color: var(--body-bg-color-dark);
    opacity: 85%;
    color: var(--body-text-color-dark);
}

dl {
    padding: 5px;
}

dt {
    font-weight: bold;
    padding: 2px;
}

dd {
    padding: 2px;
}

.list {
    text-align: left;
}

.list a {
    text-decoration: none;
    color: var(--wrapper-text-color-light);
}

.list a.dark-mode {
    text-decoration: none;
    color: var(--wrapper-text-color-dark);
}

/* Make the iframe page fill the panel */
#wrapper:has(.sample iframe) {
    padding: 12px;
}

#wrapper:has(.sample iframe) main {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sample {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: calc(var(--panel-h) - 24px);
    /* wrapper height minus padding */
    overflow: hidden;
    /* <-- clip the scrollbar */
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    /* display: flex; */
}

/* Hide scrollbar visually but keep scrolling */
.sample iframe {
    display: block;
    width: calc(100% + 24px);
    /* make it wider than the clip */
    height: 100%;
    border: 0;
    transform: translateX(-12px);
    /* recenter; pushes bar outside */
}


footer p {
    color: var(--body-text-color-light);
    text-align: center;
}

footer.dark-mode p {
    color: var(--body-text-color-dark);
    text-align: center;
}

footer a {
    text-decoration: none;
    color: var(--body-text-color-light);
}

/* ---- Video panel inside #wrapper ---- */
#wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: var(--panel-h);
    min-height: var(--panel-h);
    overflow: hidden;
    /* gives the nice “panel” height */
    background-color: var(--wrapper-bg-color-light);
    color: var(--wrapper-text-color-light);
    text-align: center;
    border-radius: 12px;
    padding: 30px;
    max-width: 100%;
    overflow: hidden;
    /* keeps corners on any media inside */
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}

#wrapper.dark-mode {
    background-color: var(--wrapper-bg-color-dark);
    color: var(--wrapper-text-color-dark);
}

/* Content stays above anything decorative */
.wrapper-content {
    position: relative;
    z-index: 2;
    overflow-y: auto;
    /* padding: 1rem; */
    width: 100%;
    height: 100%;
    /* full height of wrapper */
    scroll-behavior: smooth;
}

.wrapper-content::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Optional: for Firefox */
.wrapper-content {
    scrollbar-width: none;
}

/* Make the background transparent only on video pages */
#wrapper.has-video {
    background-color: transparent;
}

#wrapper.has-video.dark-mode {
    background-color: transparent;
}

/* Video + overlay exist only on video pages */
#wrapper.has-video .panel-video,
#wrapper.has-video .panel-overlay {
    position: absolute;
    inset: 0;
    height: 100%;
}

/* Video layer (behind content) */
#wrapper.has-video .panel-video {
    z-index: 0;
    pointer-events: none;
}

#wrapper.has-video .panel-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .4s ease;
    /* filter: brightness(70%); */
}

/* Crossfade between light/dark videos */
#panel-video-light {
    opacity: 1;
}

#panel-video-dark {
    opacity: 0;
}

body.dark-mode #panel-video-light {
    opacity: 0;
}

body.dark-mode #panel-video-dark {
    opacity: 1;
}

/* Overlay above video but below content */
#wrapper.has-video .panel-overlay {
    z-index: 1;
    /* background: rgba(0, 0, 0, .30); */
}

#wrapper.has-video.dark-mode .panel-overlay {
    background: rgba(0, 0, 0, .22);
}

/* Hide overlay container by default on non-video pages */
.panel-video,
.panel-overlay {
    display: none;
}

#wrapper.has-video .panel-video,
#wrapper.has-video .panel-overlay {
    display: block;
}

/* (Optional) keep some breathing room inside the panel */
.wrapper-content {
    padding: 1rem 0;
}

body.dark-mode #panel-video-dark {
    /* filter: grayscale(100%); */
    filter: sepia(90%) saturate(100%) brightness(100%) contrast(95%);
}

/* Only apply scrollable behavior on non-video pages */
#wrapper:not(.has-video) {
    height: var(--panel-h);
    max-height: var(--panel-h);
    overflow: hidden;
    /* clip outside the rounded panel */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* <-- was center; show the top */
}

#wrapper:not(.has-video)>.wrapper-content,
#wrapper:not(.has-video)>main {
    /* covers pages that don't use .wrapper-content */
    flex: 1 1 auto;
    min-height: 0;
    /* critical for flex children to allow scrolling */
    overflow-y: auto;
    /* padding: 1rem; */
    scroll-behavior: smooth;
}

#wrapper:not(.has-video)>.wrapper-content,
#wrapper:not(.has-video)>main {
    -webkit-mask-image: linear-gradient(to bottom, #000 88%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to bottom, #000 88%, rgba(0, 0, 0, 0) 100%);
}


/* (Optional) hide scrollbars aesthetically, keeps scrolling */
#wrapper:not(.has-video)>.wrapper-content::-webkit-scrollbar,
#wrapper:not(.has-video)>main::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

#wrapper:not(.has-video)>.wrapper-content,
#wrapper:not(.has-video)>main {
    scrollbar-width: none;
}

#wrapper:not(.has-video) .wrapper-content {
    scrollbar-width: none;
    /* Firefox */
}

/* --- CONTACT PAGE LAYOUT — applies at all widths --- */
#wrapper:has(.form) .wrapper-content {
    padding: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Contact card: size to content, cap by panel, scroll inside if needed */
#wrapper:has(.form) .form {
    width: min(920px, 100%);
    height: auto;
    /* <-- let it grow */
    max-height: calc(var(--panel-h) - 24px);
    /* <-- only cap it */
    overflow: auto;
    /* <-- scroll inside the card on short screens */
    overscroll-behavior: contain;

    display: flex;
    flex-direction: column;
    /* stays column at all sizes */
    align-items: center;
    justify-content: flex-start;

    padding: clamp(16px, 3vw, 32px);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    background: var(--wrapper-bg-color-light);
    color: var(--wrapper-text-color-light);
}

/* Hide the card’s scrollbar aesthetically but keep scrolling */
#wrapper:has(.form) .form::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

#wrapper:has(.form) .form {
    scrollbar-width: none;
}



#wrapper.dark-mode:has(.form) .form {
    background: var(--wrapper-bg-color-dark);
    color: var(--wrapper-text-color-dark);
}

/* Form grid inside the contact card */
.form form {
    width: 100%;
    display: grid;
    gap: 12px 16px;
    grid-template-columns: 160px 1fr;
    /* label | field */
    align-items: center;
}

/* More specific than old global rules */
.form label {
    grid-column: 1;
    text-align: right;
}

.form input,
.form textarea {
    grid-column: 2;
    width: 100%;
    max-width: none;
    /* override the old 250px cap */
    padding: .6rem .75rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .2);
    background: rgba(255, 255, 255, .85);
    outline: none;
}

body.dark-mode .form input,
body.dark-mode .form textarea {
    background: rgba(0, 0, 0, .15);
    border-color: rgba(255, 255, 255, .25);
    color: var(--wrapper-text-color-dark);
}

.form input[type="submit"] {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(260px, 60%);
    padding: .7rem 1rem;
    border-radius: 8px;
    border: 0;
    background: #000;
    color: #fff;
    opacity: .9;
}

body.dark-mode .form input[type="submit"] {
    background: #fff;
    color: #000;
}

.form h2 {
    margin: 0 0 .5rem;
    font-size: clamp(1.25rem, 1.8vw, 1.6rem);
}

.form>p {
    margin: 0 0 1rem;
    opacity: .85;
}

/* Stack labels/fields on small phones only */
@media (max-width: 560px) {
    .form form {
        grid-template-columns: 1fr;
    }

    .form label {
        grid-column: 1;
        text-align: left;
    }

    .form input,
    .form textarea {
        grid-column: 1;
    }
}



@media screen and (min-width: 426px) {
    #home {
        float: left;
        height: 1.5em;
        width: 1.5em;
    }

    #home.dark-mode {
        float: left;
        height: 1.5em;
        width: 1.5em;
    }

    .header-right #toggle {
        float: right;
        margin-left: 1em;
        height: 1.5em;
        width: 1.5em;
    }

    .header-right #toggle.dark-mode {
        float: right;
        margin-left: 1em;
        height: 1.5em;
        width: 1.5em;
    }

    #about {
        margin-top: 0px;
    }

    nav {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .header-left {
        display: flex;
        flex-direction: row;
    }

    .header-left,
    .header-right {
        padding: 0;
        margin-top: 0;
    }

    .header-left div {
        margin-left: 1em;
        padding-top: 0.10em;
    }

    #dropdown:hover #dropdown-content {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        position: absolute;
        background-color: var(--dropdown-bg-color-light);
        left: 0;
        margin-right: 25%;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        z-index: 3;
    }

    #dropdown:hover #dropdown-content.dark-mode {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        position: absolute;
        background-color: var(--dropdown-bg-color-dark);
        left: 0;
        margin-right: 25%;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
    }

    #dropdown-content a,
    #dropdown-content a.dark-mode {
        padding-left: 2em;
        padding-right: 2em;
    }

    #wrapper {
        clear: both;
        height: fit-content;
        min-height: 90vh;
        padding: 50px
    }

    #wrapper.dark-mode {
        clear: both;
        height: fit-content;
        min-height: 90vh;
        padding: 50px
    }

    .presentation {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        margin: 20px 0;
        max-height: 600px;
    }

    .presentation div {
        flex: 1;
        margin: 10px;
    }

    #pictures {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
    }

    #welcome h1 {
        font-size: 300%;
    }

    #message p {
        font-size: 150%;
    }

    .table-head {
        display: flex;
        justify-content: center;
    }

    .table-body {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        align-content: stretch;
        align-items: stretch;
        width: 90%;
        margin: auto;
    }

    td {
        padding: 5px;
    }

    .column-left {
        text-align: left;
    }

    .column-right {
        text-align: right;
    }

    .subtitle {
        text-align: left;
    }


    .gallery img {
        max-width: 320px;
    }

}