/*!
 * Retro World — based on Start Bootstrap Agency v7
 * https://startbootstrap.com/theme/agency
 */

/* Global */
body { font-family: 'Roboto Slab', sans-serif; -webkit-tap-highlight-color: rgba(0,0,0,0); }

p { font-size: 1rem; line-height: 1.75; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; font-family: 'Montserrat', sans-serif; }

a { color: #fed136; text-decoration: none; }
a:hover { color: #fec503; }

.text-primary { color: #fed136 !important; }

section, .page-section {
    padding: 6rem 0;
}

section h2.section-heading, .page-section h2.section-heading {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

section h3.section-subheading, .page-section h3.section-subheading {
    font-size: 1rem;
    font-weight: 400;
    font-style: italic;
    font-family: 'Roboto Slab', sans-serif;
    margin-bottom: 4rem;
    text-transform: none;
}

/* Buttons */
.btn { font-family: 'Montserrat', sans-serif; font-weight: 700; }
.btn-xl { font-size: 18px; padding: 1rem 2rem; }
.btn-primary, .btn-primary:focus { background-color: #fed136; border-color: #fed136; color: white; }
.btn-primary:hover, .btn-primary:active { background-color: #fec810 !important; border-color: #fec810 !important; color: white; }

.btn-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    border-radius: 100%;
}

/* Navigation */
#mainNav {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    background-color: #212529;
    transition: padding-top 0.3s, padding-bottom 0.3s;
}
#mainNav .navbar-brand { color: #fed136; font-family: 'Press Start 2P', 'Kaushan Script', cursive; }
#mainNav .navbar-brand img { height: 28px; }
#mainNav .navbar-brand .brand-text {
    color: #fed136;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    letter-spacing: 1px;
}
#mainNav .navbar-nav .nav-item .nav-link {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.75rem 0;
    color: white;
    letter-spacing: 1px;
    font-family: 'Montserrat', sans-serif;
}
#mainNav .navbar-nav .nav-item .nav-link:hover,
#mainNav .navbar-nav .nav-item .nav-link.active { color: #fed136; }

@media (min-width: 992px) {
    #mainNav .navbar-nav .nav-item .nav-link { padding: 0 1rem; }
    #mainNav.navbar-shrink {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        background-color: #212529;
    }
}

/* Masthead */
header.masthead {
    background-image: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.75)), url('../assets/img/ggg.gif');
    background-color: #1a1d20;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-size: cover;
    padding-top: 10rem;
    padding-bottom: 6rem;
    text-align: center;
    color: white;
}
header.masthead .masthead-subheading {
    font-size: 1.5rem;
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-family: 'Roboto Slab', sans-serif;
}
header.masthead .masthead-heading {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2rem;
    font-family: 'Press Start 2P', 'Montserrat', sans-serif;
    letter-spacing: 4px;
    text-shadow: 4px 4px 0 #fed136, 8px 8px 0 rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
    header.masthead { padding-top: 17rem; padding-bottom: 12.5rem; }
    header.masthead .masthead-subheading { font-size: 2.25rem; }
    header.masthead .masthead-heading { font-size: 5.5rem; }
}

/* Services */
section#services .fa-stack { margin-bottom: 1.5rem; }
section#services h4 { font-size: 1.25rem; font-weight: 700; }

/* Portfolio */
#portfolio .portfolio-item {
    cursor: pointer;
    position: relative;
    display: block;
    max-width: 25rem;
    margin: 0 auto 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#portfolio .portfolio-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 32px rgba(254, 209, 54, 0.35);
}
#portfolio .portfolio-item .portfolio-link {
    display: block;
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}
/* Wrap both images in the same slot so they overlay */
#portfolio .portfolio-item .portfolio-link img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.35s ease-in-out;
}
#portfolio .portfolio-item .portfolio-img-static { opacity: 1; z-index: 1; }
#portfolio .portfolio-item .portfolio-img-hover  { opacity: 0; z-index: 2; }
#portfolio .portfolio-item:hover .portfolio-img-static { opacity: 0; }
#portfolio .portfolio-item:hover .portfolio-img-hover  { opacity: 1; }

#portfolio .portfolio-item .portfolio-hover {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(254,209,54,0.85);
    opacity: 0;
    transition: opacity ease-in-out 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
#portfolio .portfolio-item:hover .portfolio-hover { opacity: 1; }
#portfolio .portfolio-item .portfolio-hover .portfolio-hover-content { color: white; font-size: 1.25rem; }

#portfolio .portfolio-item .portfolio-caption {
    padding: 1.5rem;
    text-align: center;
    background-color: #fff;
    position: relative;
    z-index: 1;
}
#portfolio .portfolio-item .portfolio-caption .portfolio-caption-heading {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-transform: none;
    font-size: 1.25rem;
}
#portfolio .portfolio-item .portfolio-caption .portfolio-caption-subheading {
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
}

/* Portfolio Modal */
.portfolio-modal .modal-dialog { margin: 1rem; max-width: 100vw; }
.portfolio-modal .modal-content {
    padding: 100px 0;
    text-align: center;
    border-radius: 0;
    border: none;
    background-clip: border-box;
}
.portfolio-modal .modal-content h2 { font-size: 2.25rem; margin-bottom: 15px; }
.portfolio-modal .modal-content .item-intro {
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
    font-size: 1rem;
    margin-bottom: 2rem;
}
.portfolio-modal .modal-content img { margin-bottom: 2rem; max-height: 320px; object-fit: contain; }
.portfolio-modal .modal-content img.modal-console-img {
    border-radius: 0.5rem;
    box-shadow: 0 12px 32px rgba(254, 209, 54, 0.25);
    max-height: 360px;
}
.portfolio-modal .modal-content ul.list-inline { margin-bottom: 2rem; }
.portfolio-modal .modal-content ul.list-inline li { display: inline-block; margin: 0 1rem; }
.portfolio-modal .close-modal {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    width: 3rem; height: 3rem;
    cursor: pointer;
    background-color: transparent;
    z-index: 10;
}
.portfolio-modal .close-modal:hover { opacity: 0.6; }

/* Featured Games */
#featured .featured-card {
    height: 100%;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    position: relative;
}
#featured .featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(254,209,54,0.25);
    border-color: #fed136;
}
#featured .featured-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}
#featured .featured-badge {
    display: inline-block;
    align-self: flex-start;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    padding: 0.4rem 0.6rem;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
}
#featured .featured-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #212529;
}
#featured .featured-meta {
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}
#featured .featured-blurb {
    font-size: 0.9rem;
    color: #495057;
    flex-grow: 1;
    margin-bottom: 1rem;
}
#featured .featured-launch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #212529;
    background: #fed136;
    padding: 0.6rem 1rem;
    border-radius: 0.3rem;
    text-decoration: none;
    transition: background 0.2s ease;
}
#featured .featured-launch:hover { background: #fec503; color: #212529; }

/* Controls cheat sheet */
#controls .controls-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.75rem;
    height: 100%;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}
#controls .controls-card-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #212529;
    border-bottom: 2px solid #fed136;
    padding-bottom: 0.5rem;
}
#controls .controls-table th {
    font-family: 'Roboto Slab', sans-serif;
    font-weight: 400;
    color: #495057;
    width: 50%;
    border-color: #f1f3f5;
}
#controls .controls-table td {
    text-align: right;
    color: #212529;
    border-color: #f1f3f5;
}
#controls kbd {
    background: #212529;
    color: #fed136;
    border: 1px solid #495057;
    border-bottom-width: 2px;
    border-radius: 0.25rem;
    padding: 0.15rem 0.5rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
}

/* Contact */
section#contact {
    background-color: #212529;
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.85)), url('../assets/img/map-image.png');
    background-repeat: no-repeat;
    background-position: center;
}
section#contact .section-heading { color: white; }
section#contact .form-group { margin-bottom: 1.5rem; }
section#contact .form-group input, section#contact .form-group textarea {
    padding: 1.25rem;
}
section#contact .form-group input.form-control { height: auto; }
section#contact .form-group textarea.form-control { height: 248px; }
section#contact .form-control:focus { border-color: #fed136; box-shadow: none; }
section#contact ::-webkit-input-placeholder { font-weight: 700; color: #ced4da; font-family: 'Montserrat', sans-serif; }
section#contact :-moz-placeholder { font-weight: 700; color: #ced4da; font-family: 'Montserrat', sans-serif; }
section#contact ::-moz-placeholder { font-weight: 700; color: #ced4da; font-family: 'Montserrat', sans-serif; }
section#contact :-ms-input-placeholder { font-weight: 700; color: #ced4da; font-family: 'Montserrat', sans-serif; }

/* Footer */
footer.footer { padding-top: 3rem; padding-bottom: 3rem; text-align: center; }
footer.footer span.copyright {
    font-size: 90%;
    line-height: 40px;
    font-family: 'Montserrat', sans-serif;
    text-transform: none;
}

/* ====================================================== */
/* Emulator page                                           */
/* ====================================================== */
body.emulator-page { padding-top: 76px; background: #1a1d20; color: #e9ecef; }
.emulator-section { padding-top: 3rem; padding-bottom: 3rem; }
.emulator-section .section-heading { color: white; }
.emulator-section .section-subheading { color: #adb5bd !important; }
/* Legacy .emulator-frame rules kept only for fullscreen reset.
   The active emulator styling lives under #emulator-section below. */
.emulator-frame:fullscreen, .emulator-frame:-webkit-full-screen { border: none; border-radius: 0; }

.rom-loader-placeholder { background-color: #2b3035 !important; color: #adb5bd; }
.rom-loader-placeholder code { color: #fed136; background: rgba(254,209,54,0.1); padding: 2px 6px; border-radius: 3px; }

/* When the emulator is on the page, lighten footer styling */
body.emulator-page footer.footer { background: transparent; color: #adb5bd; }
body.emulator-page footer.footer a { color: #adb5bd; }
body.emulator-page footer.footer a:hover { color: #fed136; }

/* ====================================================== */
/* Game Library                                            */
/* ====================================================== */
#library-section { background: #1a1d20; color: #e9ecef; min-height: 80vh; }
#library-header  { text-align: center; padding-bottom: 2rem; }
#library-header .section-heading  { color: #fed136; }
#library-header .section-subheading { color: #adb5bd !important; }
#library-header code {
    background: rgba(254,209,54,0.1);
    color: #fed136;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
}

/* Tiles */
.game-tile {
    position: relative;
    background: #25282d;
    border: 1px solid #343a40;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    height: 100%;
}
.game-tile:hover, .game-tile:focus {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(254,209,54,0.35);
    border-color: #fed136;
    outline: none;
}
.game-tile-art {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0d0e10;
    overflow: hidden;
}
.game-tile-cover, .game-tile-preview {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
    background: #25282d;
    transition: opacity 0.35s ease-in-out, transform 0.4s ease;
}
/* When the box art fails to load and we fall back to the favicon,
   shrink it to a centered icon rather than stretching it across the tile. */
.game-tile-cover.cover-fallback {
    object-fit: contain;
    padding: 25%;
    opacity: 0.4;
    filter: grayscale(1);
}
.game-tile-cover  { opacity: 1; z-index: 1; }
.game-tile-preview { opacity: 0; z-index: 2; }
/* When a preview GIF exists, crossfade to it on hover */
.game-tile:hover .game-tile-cover  { opacity: 0; }
.game-tile:hover .game-tile-preview { opacity: 1; }
/* When no preview is provided, just zoom the box art subtly on hover */
.game-tile:not(:has(.game-tile-preview)):hover .game-tile-cover { opacity: 1; transform: scale(1.06); }

.game-tile-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5rem;
}
.game-tile-score {
    align-self: flex-end;
    background: rgba(254, 209, 54, 0.95);
    color: #212529;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    padding: 0.35rem 0.55rem;
    border-radius: 0.25rem;
}
.game-tile-badge {
    align-self: flex-start;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.55rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-tile-info {
    padding: 0.75rem 1rem 1rem;
}
.game-tile-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 0.2rem;
    line-height: 1.25;
}
.game-tile-meta {
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
    font-size: 0.8rem;
    color: #adb5bd;
}

/* Unavailable state — grayed out, badge already shown */
.game-tile-unavailable .game-tile-cover,
.game-tile-unavailable .game-tile-preview {
    filter: grayscale(0.85) brightness(0.7);
}
.game-tile-unavailable:hover .game-tile-cover,
.game-tile-unavailable:hover .game-tile-preview {
    filter: grayscale(0.4) brightness(0.85);
}

/* Detail modal */
#gameDetailModal .modal-content {
    background: #1a1d20;
    color: #e9ecef;
    border: 1px solid #fed136;
    border-radius: 0.5rem;
}
#gameDetailModal .modal-header {
    border-bottom: 1px solid #343a40;
    padding: 1.5rem;
}
#gameDetailModal .modal-body { padding: 1.5rem; }
#gameDetailModal .modal-footer {
    border-top: 1px solid #343a40;
    padding: 1.25rem 1.5rem;
}
#gameDetailModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(2);
}
#gameDetailModal .game-modal-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #fed136;
    margin: 0;
}
#gameDetailModal .game-modal-subtitle {
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
    color: #adb5bd;
    margin: 0.25rem 0 0;
}
#gameDetailModal .game-modal-cover {
    width: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(254,209,54,0.2);
    margin-bottom: 1rem;
    /* Box art has its own natural aspect ratio — let the image dictate height */
    height: auto;
    background: transparent;
    display: block;
}
#gameDetailModal .game-modal-cover.cover-fallback {
    padding: 25%;
    opacity: 0.5;
    filter: grayscale(1);
    background: #0d0e10;
}
#gameDetailModal .game-modal-description {
    color: #dee2e6;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}
#gameDetailModal .game-modal-meta {
    background: #25282d;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}
#gameDetailModal .game-modal-meta div { padding: 0.3rem 0; }
#gameDetailModal .game-modal-meta strong { color: #fed136; }
#gameDetailModal .game-modal-trailer {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    margin-top: 1rem;
    background: #000;
}
#gameDetailModal .game-modal-trailer::before {
    /* Loading-state placeholder text — sits behind the iframe.
       When the iframe finishes loading it covers this completely. */
    content: 'Loading trailer\2026';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #6c757d;
    font-family: 'Roboto Slab', sans-serif;
    font-style: italic;
    font-size: 0.95rem;
    z-index: 0;
}
#gameDetailModal .game-modal-trailer iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0;
    background: #000;
    z-index: 1;
}
#gameDetailModal .game-modal-rom-hint {
    font-size: 0.85rem;
    color: #adb5bd;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(220, 53, 69, 0.1);
    border-left: 3px solid #dc3545;
    border-radius: 0.25rem;
}
#gameDetailModal .game-modal-rom-hint code {
    background: rgba(254,209,54,0.15);
    color: #fed136;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
}
#gameDetailModal .game-modal-play {
    background: #fed136;
    color: #212529;
    border: 0;
    padding: 0.75rem 1.75rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#gameDetailModal .game-modal-play:hover:not(.disabled) { background: #fec503; }
#gameDetailModal .game-modal-play.disabled,
#gameDetailModal .game-modal-play:disabled {
    background: #495057;
    color: #adb5bd;
    cursor: not-allowed;
}

/* Emulator section (when game is launched) */
#emulator-section { display: none; padding-top: 2rem; padding-bottom: 4rem; }

/* Simple emulator frame: yellow border, fixed height, EmulatorJS handles its own layout. */
#emulator-section .emulator-frame {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: #000;
    border: 2px solid #fed136;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(254, 209, 54, 0.25);
}
#emulator-section #game {
    width: 100%;
    height: 600px;
    background: #000;
}
#emulator-section .section-heading  { color: #fed136; }
#emulator-section .section-subheading { color: #adb5bd !important; }
#emulator-back-btn {
    background: transparent;
    color: #fed136;
    border: 1px solid #fed136;
    padding: 0.5rem 1.25rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    border-radius: 0.3rem;
    transition: all 0.2s;
}
#emulator-back-btn:hover { background: #fed136; color: #212529; }

/* Touch devices: hover doesn't apply, so don't waste preview bandwidth */
@media (hover: none) {
    .game-tile-preview { display: none; }
    .game-tile:hover, .game-tile:focus { transform: none; box-shadow: none; }
}
