/* --- General Styles --- */
body {
    background-color: #008080;
    font-family: "Pixelated MS Sans Serif", "Tahoma", sans-serif;
    padding-top: 58px;
    padding-bottom: 30px;
}

.container {
    margin: 0 auto;
    padding: 5px;
}

/* --- Header Bar --- */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    padding: 4px;
    height: 44px;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.header-link {
    display: inline-block;
    height: 32px;
    line-height: 32px;
    padding: 0 5px;
}
.header-link.icon {
    padding: 0;
    width: 32px;
    flex-shrink: 0;
}

.header-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    vertical-align: middle;
}

.search-container {
    flex-grow: 1;
    display: flex;
    margin: 0 5px;
    min-width: 150px;
}

.search-container input[type="text"] {
    flex-grow: 1;
}

.handle {
    width: 100%;
    height: 14px;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    cursor: n-resize;
    position: fixed;
    top: 44px;
    left: 0;
    z-index: 999;
    box-sizing: border-box;
}


/* --- Main Content Grid --- */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.window .title-bar {
    display: none;
}

/* --- Title Bar Icons --- */
.title-bar-text {
    display: flex;
    align-items: center;
}

.title-bar-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
}


.window {
    margin-bottom: 0;
}

.links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 24px 8px;
    padding: 12px 4px;
}

.link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: black;
}

.link-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.link-title {
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
}

/* --- Quote Section --- */
.quote-window {
    margin-top: 0;
}

#quote-container {
    cursor: pointer;
    padding: 10px;
}

#quote-text {
    font-size: 1em;
    margin-bottom: 5px;
}

#quote-attribution {
    text-align: right;
    font-style: italic;
}

/* --- Gemini Interface --- */
.gemini-window {
    margin-top: 0;
}

.gemini-window .window-body {
    display: flex;
    flex-direction: column;
    height: 250px;
}

#gemini-response {
    flex-grow: 1;
    padding: 8px;
    overflow-y: auto;
    margin-bottom: 8px;
    background-color: white;
	background-position: fixed;
    position: relative;
    isolation: isolate;
}

/* --- Encarta Background --- */
#gemini-response::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('./img/bg_encarta_1.jpg');
    background-size: cover;
    background-position: bottom;
    opacity: 0.3;
    z-index: -1;
}


#gemini-response p {
    margin: 0 0 8px 0;
	margin-left: 64px;
}
#gemini-response ul, #gemini-response ol {
    margin: 0 0 8px 1.5em;
    padding: 0;
	margin-left: 76px;
}

#gemini-form {
    display: flex;
    flex-direction: column;
}

#gemini-prompt {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.gemini-controls {
    display: flex;
    justify-content: flex-end; /* Align button to the right */
}


/* --- Desktop Styles --- */
@media (min-width: 641px) {
    body {
        padding-top: 0;
    }

    .container {
        padding: 10px;
    }

    .header-bar {
        position: static;
        height: auto;
    }

    .handle {
        display: none;
    }

    .header-link {
        padding: 0 10px;
    }
    
    .search-container {
        margin: 0 10px;
        min-width: 200px;
    }

    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 16px;
    }

    .window {
        margin-bottom: 0;
    }

    .window .title-bar {
        display: flex;
    }

    .links {
        gap: 24px 8px;
        padding: 8px;
    }

    .link-icon {
        margin-bottom: 8px;
    }
    
    .quote-window, .gemini-window {
        margin-top: 16px;
    }

    #quote-container, .gemini-window .window-body {
        padding: 10px;
    }

    #quote-text {
        margin-bottom: 10px;
    }
}

/* --- Wide Desktop Styles --- */
@media (min-width: 1024px) {
    .container {
        display: grid;
        grid-template-columns: minmax(0, 458px) 1fr;
        gap: 16px;
        align-items: stretch;
    }

    main.content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .right-column-container {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .gemini-window {
        margin-top: 0;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    
    .gemini-window .window-body {
        height: auto;
        flex-grow: 1;
    }

    .quote-window {
        margin-top: 0;
        height: fit-content;
    }
}

/* --- Site Footer --- */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 24px;
    background-color: #c0c0c0;
    border-top: 1px solid #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    z-index: 1001;
}

.footer-icon-link {
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
}

.footer-icon-link img {
    width: 16px;
    height: 16px;
}