@font-face {
    font-family: 'MS Sans Serif';
    src: local('Microsoft Sans Serif'), local('MS Sans Serif');
}

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

.browser-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: #D4D0C8;
    color: #000000;
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-top: 1px solid #FFFFFF;
    border-bottom: 1px solid #808080;
    z-index: 1000;
    flex-wrap: wrap;
}

.browser-title {
    font-size: 22px;
    padding: 4px 14px;
}

.dialup-button {
    background: #D4D0C8;
    border: 2px outset #FFFFFF;
    padding: 4px 14px;
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    font-size: 22px;
    color: black;
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 1 !important;
}

.dialup-button[data-enabled="true"],
.dialup-button[data-enabled="false"] {
    background: #D4D0C8;
    border: 2px outset #FFFFFF;
}

body {
    font-family: verdana, arial, helvetica, sans-serif;
    background-color: #FFFFFF;
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 28.8vw;
    min-width: 360px;
    padding: 24px 24px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    background-color: #dfbe00;
    background-image: url('images/leftbg.jpg');
    background-repeat: repeat;
    border-right: none;
    position: relative;
    z-index: 0;
}

.main-content {
    width: 76vw;
    min-width: 0;
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: url('images/rightbg.gif');
    background-repeat: repeat-y;
    background-position: left top;
    background-size: 200%;
    font-size: 1.25vw;
}

.navbutton {
    width: 100%;
    height: max(2.6vw, 9.36px);
    text-align: right;
    padding-right: 24px;
    line-height: max(2.6vw, 9.36px);
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: #800000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: max(1.875vw, 6.75px);
    font-weight: 600;
    position: relative;
}

/* Add visited state style */
a:visited .navbutton {
    color: #600000;
}

.navbutton:hover {
    text-decoration: underline;
    color: #FF6600;
}

select {
    width: 100%;
    height: 48px;
    font-size: 1.25vw;
    border: 2px inset #999;
    background-color: white;
    padding: 5px;
    margin-top: 48px;
}

.header-logo {
    width: 93.75%;
    max-width: 1200px;
    height: auto;
    margin: 58px auto 20px;
    background-color: #FFF;
    border: none;
}

.header-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.comic-nav {
    width: 100%;
    max-width: 1152px;
    text-align: center;
    padding: 18px;
    background-color: #EFEFEF;
    margin: 24px 0;
    font-size: 1.125vw;
}

.comic-nav a {
    margin: 0 20px;
    color: #0000FF;
    text-decoration: underline;
}

.comic-nav a.disabled {
    color: #999;
    pointer-events: none;
    text-decoration: none;
}

.comic-container {
    width: 100%;
    max-width: 1920px;
    aspect-ratio: 1;
    background-color: #FFF;
    margin: 20px 0;
    border: none;
}

h1 {
    font-family: arial;
    color: #555f68;
    font-size: 2.67vw;
    margin: 24px 0 12px;
    text-align: center;
    max-width: 1152px;
    width: 100%;
}

.badges {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.badge {
    width: 88px;
    height: 31px;
    border: 2px solid #999;
}

.footer-nav {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    font-size: 1.125vw;
    line-height: 2;
    font-family: verdana, arial, helvetica, sans-serif;
}

.sidebar-twochars-container {
    width: 100%;
    overflow: hidden;
    margin-left: -24px;
    padding-right: -24px;
    position: absolute;
    z-index: -1;
    transform: translateY(-24%);
}

.nav-container .sidebar-twochars {
    width: 250%;
    height: auto;
    max-width: none;
    object-fit: contain;
}

.nav-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: clamp(24px, 2.5vw, 32px) 0;
}

.nav-container .image-placeholder:not(.sidebar-twochars) {
    margin-top: 400px;
}

.image-placeholder:not(.sidebar-twochars) {
    margin-top: 0;
}

.sidebar .image-placeholder {
    margin-bottom: 24px;
}

.sidebar .nav-container {
    margin-bottom: 180px;
}

.nav-container .image-placeholder:last-child {
    margin-bottom: 0;
}

.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 4px
    );
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(
        circle at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 2px solid #999;
        padding: 10px;
    }

    .main-content {
        width: 100%;
        padding: 10px;
    }

    .browser-bar {
        height: auto;
        min-height: 84px;
        padding: 6px 15px;
    }

    .browser-title {
        width: 100%;
        margin-bottom: 6px;
        text-align: center;
    }

    .dialup-button {
        width: 100%;
        justify-content: center;
        visibility: visible !important;
        display: none !important;
    }

    .header-logo {
        padding-top: 84px;
    }

    .main-content > .comic-nav:first-of-type {
        margin-top: 84px;
    }

    .nav-container {
        padding: 24px 0;
    }
}

/* Add these missing styles */
.image-placeholder {
    background: transparent;
    position: relative;
    border: 2px solid transparent;
}

.image-placeholder.loading {
    border: none;
}

.image-placeholder .image-wrapper {
    visibility: hidden;
}

.image-placeholder::after {
    content: attr(data-dimensions);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-family: monospace;
    z-index: 1;
}

.image-wrapper {
    visibility: visible !important;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.image-canvas, .buffer-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-top: 3px solid #999;
    border-left: 3px solid #999;
    border-bottom: 3px solid #d8d8d8;
    border-right: 3px solid #d8d8d8;
}

.buffer-canvas {
    display: none;
}

.image-placeholder.loaded .image-canvas,
.image-placeholder.loaded .buffer-canvas {
    border: none !important;
}

#status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #D4D0C8;
    border-top: 2px solid #fff;
    border-bottom: 2px solid #808080;
    padding: 9px;
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 22px;
    color: #000;
    display: none;
    z-index: 1000;
}

/* Loading styles */
body.loading * {
    visibility: hidden;
}

body.loading .browser-bar,
body.loading #status-bar,
body.loading .crt-overlay {
    visibility: visible;
}

/* Ensure vignette shows during loading */
body.loading::after {
    visibility: visible;
}

/* Update title icon visibility during loading */
body.loading .browser-bar .title-icon {
    visibility: visible !important;
}

/* Title icon styles */
.title-icon {
    width: auto;
    height: 32px;
    vertical-align: middle;
    margin-right: 10px;
    image-rendering: pixelated;
}

/* Connection info styles */
.connection-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-text {
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    font-size: 22px;
}

.loading-text {
    margin-left: 10px;
}

/* Disabled button state */
.dialup-button[disabled] {
    background: #A0A0A0;
    border: 2px outset #D4D0C8;
    color: #808080;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Mobile connection info */
@media (max-width: 768px) {
    .connection-info {
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .connection-text {
        text-align: center;
    }
}

/* Banner container styles */
.banner-container {
    width: 100%;
    max-width: 1152px;
    height: auto;
    margin: 20px 0;
    background-color: #FFF;
    border: none;
}

.banner-container .image-placeholder {
    border: clamp(3px, 0.5vw, 6px) solid #555f68;
}

.banner-container img {
    width: 100%;
    height: auto;
    display: block;
}

.pub-date {
    font-size: 1.2vw;
    color: #666;
    margin-top: -10px;
    margin-bottom: 20px;
    font-style: italic;
}

.theme-song-page {
    font-family: verdana, arial, helvetica, sans-serif;
    line-height: 1.5;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.theme-song-page .download-section {
    background: #EFEFEF;
    padding: 15px;
    border: 2px solid #999;
    margin-bottom: 20px;
    text-align: center;
}

.theme-song-page .song-info {
    margin: 20px 0;
}

.theme-song-page h2 {
    color: #800000;
    margin-bottom: 10px;
}

.theme-song-page .artist-credit {
    font-style: italic;
    margin-bottom: 20px;
}

.theme-song-page a {
    color: #0000EE;
    text-decoration: underline;
}

.theme-song-page a:visited {
    color: #551A8B;
}

.theme-song-page a:hover {
    color: #FF6600;
}

/* Sidebar link styles */
.sidebar a {
    text-decoration: none;
    display: block;
    transition: opacity 0.2s ease;
}

.sidebar a:hover .image-placeholder {
    opacity: 0.8;
}

/* Main comic select styles */
.main-comic-select {
    text-align: center;
    margin: 10px 0;
    width: 100%;
    max-width: 800px;
}

.main-comic-select select {
    width: 300px;
    padding: 5px;
    height: 48px;
    font-size: 19px;
    border: 2px inset #999;
    background-color: white;
    margin-top: 0; /* Override the default margin from other selects */
}

@media (max-width: 768px) {
    .main-comic-select select {
        width: 100%;
        max-width: 300px;
    }
}

/* Downloads Page Styles */
.downloads-page {
    margin: 0 auto;
    padding: 20px;
}

.downloads-page h2 {
    color: #800000;
    font-size: 2em;
    margin: 30px 0 20px;
    font-family: "MS Sans Serif", Arial, sans-serif;
}

/* Desktop Section */
.desktop-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 40px;
}

.desktop-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 10px;
    background: #D4D0C8;
}

.preview-col {
    flex: 0 0 66%;  /* 40% of parent container width */
}

.preview-col img {
    width: 200px;
    height: 150px;
    display: block;
    image-rendering: pixelated;
}

.links-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    padding: 10px;
}

.links-col a {
    color: #800000;  /* Same as navbutton color */
    text-decoration: none;
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 1.1em;
}

.links-col a:visited {
    color: #600000;  /* Same as navbutton visited color */
}

.links-col a:hover {
    text-decoration: underline;
    color: #FF6600;  /* Same as navbutton hover color */
}

/* Banners Section */
.banners-section {
    margin-top: 40px;
}

.banner-main {
    width: 100%;
    margin-bottom: 30px;
}

.banner-main .image-placeholder {
    width: 100%;
    max-width: 1152px;
    height: auto;
    margin: 0 auto;
}

.banner-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.banner-grid .image-placeholder {
    flex: 0 0 auto;
    margin: 10px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .desktop-item {
        flex-direction: column;
        align-items: center;
    }

    .links-col {
        align-items: center;
    }

    .preview-col {
        flex: 0 0 auto;
    }

    .banner-grid {
        gap: 10px;
    }

    .downloads-page h2 {
        text-align: center;
    }
}

.page-content {
    width: 93.75%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: verdana, arial, helvetica, sans-serif;
    line-height: 1.5;
    padding: 20px;
}

.page-center {
    text-align: center;
}

/* Banner sizing relationships */
.image-placeholder.download-desktop {
    width: 100%;  /* 100% of preview-col width */
    height: auto;
}

.image-placeholder.download-banner {
    margin: 20px 0 10px 0;
    border: 4px solid black;
}

.image-placeholder.download-banner-sm {
    width: 30%;  /* 30% of parent container width */
    height: auto;
}

.banner-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.page-description {
    margin-bottom: 40px;
}

.trashcam-image {
    max-width: 1000px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.night-mode-button {
    background: #D4D0C8;
    border: 2px outset #FFFFFF;
    padding: 4px 14px;
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    font-size: 1.25vw; /* Match the main content font size */
    color: black;
    cursor: pointer;
    margin: 10px auto 0;
    display: block;
}

.night-mode-button:active {
    border-style: inset;
}

/* Apply borders to both canvas and img elements inside sidebar-slice */
a .sidebar-slice .image-canvas,
a .sidebar-slice img {
    border: 6px solid #800000 !important;
}

a:hover .sidebar-slice .image-canvas,
a:hover .sidebar-slice img {
    border-color: #FF6600 !important;
}

a:visited .sidebar-slice .image-canvas,
a:visited .sidebar-slice img {
    border-color: #600000 !important;
}

/* Keep the exclusion rule for non-sidebar-slice elements */
.image-placeholder:not(.sidebar-slice).loaded .image-canvas,
.image-placeholder:not(.sidebar-slice).loaded .buffer-canvas {
    border: none !important;
}
