/* Site layer on top of system.css (style.css) and docs.css.
   Menu bar, window behaviour states, compact Info window, video thumbnails. */

:root {
    --menubar-h: 30px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--menubar-h) + 12px); }

body {
    background: #8a8aff url("../background_0.png");
    padding-top: var(--menubar-h);
    min-height: 100vh;
    color: #000;
}

img { max-width: 100%; }

/* ---------- Menu bar ---------- */
.menubar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--menubar-h);
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: #fff;
    border-bottom: 2px solid #000;
    font-family: Chicago_12, Chicago, sans-serif;
    font-size: 16px;
    user-select: none;
}
.menubar-list { display: flex; margin: 0; padding: 0; list-style: none; }
.menu { position: relative; }
.menu-button {
    height: 100%;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: #000;
    font: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.menu-button:hover,
.menu-button[aria-expanded="true"],
.menu-button:focus-visible { background: #000; color: #fff; outline: none; }
.menu-logo img { image-rendering: pixelated; }

.menubar .menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    margin: 0;
    padding: 2px 0;
    list-style: none;
    background: #fff;
    border: 2px solid #000;
    border-top: 0;
    box-shadow: 3px 3px 0 #000;
}
.menubar .menu.open > .menu-dropdown { display: block; }
.menu-dropdown li { margin: 0; }
.menu-dropdown [role="menuitem"] {
    display: block;
    width: 100%;
    padding: 3px 14px 3px 24px;
    border: 0;
    background: transparent;
    color: #000;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    position: relative;
}
.menu-dropdown [role="menuitem"]:hover,
.menu-dropdown [role="menuitem"]:focus-visible { background: #000; color: #fff; outline: none; }
.menu-dropdown [role="separator"] { height: 0; margin: 3px 0; border-top: 2px dotted #000; }
/* check mark for open windows */
.menu-dropdown [data-toggle-window].is-open::before {
    content: "\2713";
    position: absolute;
    left: 7px;
}
/* submenu (Apple menu > Games) */
.has-submenu { position: relative; }
.has-submenu > [role="menuitem"]::after {
    content: "";
    position: absolute;
    right: 8px; top: 50%;
    margin-top: -5px;
    border-left: 7px solid currentColor;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}
.menubar .menu-dropdown.submenu {
    top: -2px;
    left: 100%;
    min-width: 170px;
    border-top: 2px solid #000;
}
.menubar .menu-dropdown .has-submenu:hover > .submenu,
.menubar .menu-dropdown .has-submenu.sub-open > .submenu { display: block; }
.menubar .menu-dropdown .has-submenu:hover > [role="menuitem"],
.menubar .menu-dropdown .has-submenu.sub-open > [role="menuitem"] { background: #000; color: #fff; }
.menubar-clock { display: flex; align-items: center; padding: 0 12px; }

/* ---------- Layout ---------- */
.desktop { padding: 0 1rem; max-width: 1440px; margin: 0 auto; }
.layout { display: block; }
.col-side, .col-main, .col-links { min-width: 0; }
.col-side { grid-area: side; }
.col-main { grid-area: main; }
.col-links { grid-area: links; }

/* two columns: Info + Cool Websites stacked on the left, windows on the right */
@media (min-width: 700px) {
    .layout {
        display: grid;
        grid-template-columns: 300px minmax(0, 1fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "side main" "links main";
        column-gap: 1rem;
        align-items: start;
    }
}
/* wide screens: Cool Websites gets its own column on the right */
@media (min-width: 1180px) {
    .layout {
        grid-template-columns: 300px minmax(0, 1fr) 270px;
        grid-template-rows: auto;
        grid-template-areas: "side main links";
    }
}

.window.compact { max-width: 100%; }
.links-pane { padding: 0.75rem 1rem 1rem; overflow: visible; }
.links-pane p { margin: 0 0 0.75rem; line-height: 1.4; }
.site-list { list-style: none; margin: 0; padding: 0; }
.site-list li { margin: 0 0 0.5rem; }
.site-list .btn { display: block; }

footer .footer-logo { image-rendering: pixelated; vertical-align: -2px; margin-right: 8px; }
footer {
    text-align: center;
    padding: 1.5rem 0 2rem;
    font-family: Chicago_12, Chicago, sans-serif;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

/* ---------- Windows ---------- */
.window {
    position: relative;
    margin: 1rem 0;
    min-width: 0;
    box-shadow: 3px 3px 0 #000;
    display: flex;
    flex-direction: column;
}
.window .window-pane { overflow-y: auto; }
.scroll-pane { max-height: min(62vh, 640px); }
.about-pane { padding: 0.5rem 2rem; overflow: visible; }
.about-pane p { font-size: 1.05em; line-height: 1.45; }
.window-pane .subheading { margin-top: 0.5rem; }

/* inactive windows: no stripes, no controls, grey title (System 7) */
.window:not(.active) .title-bar { background: none; }
.window:not(.active) .title-bar button { visibility: hidden; }
.window:not(.active) .title-bar .title { background: transparent; color: #8a8a8a; }
.title-bar .title { user-select: none; white-space: nowrap; }
.title-bar { cursor: grab; touch-action: none; }
.title-bar button { cursor: pointer; }
.window.dragging, .window.dragging .title-bar { cursor: grabbing; }
.window.dragging { will-change: transform; }

/* windowshade (double-click the title bar) */
.window.shaded > :not(.title-bar) { display: none; }

/* zoomed */
.window.zoomed {
    position: fixed;
    top: calc(var(--menubar-h) + 8px);
    left: 8px; right: 8px; bottom: 8px;
    margin: 0;
    transform: none !important;
    max-width: none;
}
.window.zoomed .window-pane { flex: 1; max-height: none; }
.zoom-placeholder { margin: 1rem 0; }

.window[hidden] { display: none; }

/* ---------- System 7 scrollbar (drawn by js/desktop.js, so it looks the same in every browser) ---------- */
.scroll-pane { scrollbar-width: none; padding-right: 2.2rem; }
.scroll-pane::-webkit-scrollbar { display: none; width: 0; }
.s7-scroll {
    position: absolute;
    right: 0;
    width: 22px;
    display: none;
    z-index: 3;
    border-left: 2px solid #000;
    background:
        linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%) 0 0 / 4px 4px,
        linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%) 2px 2px / 4px 4px,
        #fff;
    user-select: none;
    touch-action: none;
}
.s7-scroll.on { display: block; }
.s7-arrow {
    position: absolute;
    left: 0; right: 0;
    height: 22px;
    background: #fff;
    cursor: default;
}
.s7-arrow.up { top: 0; border-bottom: 2px solid #000; }
.s7-arrow.down { bottom: 0; border-top: 2px solid #000; }
.s7-arrow::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    margin-left: -6px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}
.s7-arrow.up::after { margin-top: -5px; border-bottom: 9px solid #000; }
.s7-arrow.down::after { margin-top: -4px; border-top: 9px solid #000; }
.s7-arrow:active { background: #000; }
.s7-arrow.up:active::after { border-bottom-color: #fff; }
.s7-arrow.down:active::after { border-top-color: #fff; }
.s7-thumb {
    position: absolute;
    left: 0; right: 0;
    background: #fff;
    border: 2px solid #000;
    border-right: 0;
    cursor: default;
}
.s7-thumb:active { background: #000; }

/* ---------- Floating window (game) ---------- */
.window.floating {
    position: fixed;
    top: calc(var(--menubar-h) + 36px);
    left: 50%;
    margin: 0 0 0 -320px;
    width: 640px;
    max-width: calc(100vw - 16px);
}
.window.floating .resize { visibility: hidden; }
.window .game-pane { padding: 0; overflow: hidden; background: #000; line-height: 0; }
.game-pane iframe { display: block; width: 624px; height: 560px; max-width: 100%; margin: 0 auto; border: 0; }

/* ---------- Info window (compact) ---------- */
.window.compact { width: 100%; }
.info-body { padding: 1.1rem 1rem 1.2rem; text-align: center; }
.portrait {
    display: block;
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto 0.9rem;
    border: 2px solid #000;
    border-radius: 6px;
}
.info-name { font-size: 1.5rem; margin: 0 0 0.3rem; line-height: 1.15; }
.info-role { font-family: Geneva_9, Geneva, sans-serif; font-size: 1.5rem; line-height: 1.4; margin: 0 0 0.9rem; }
.link-row { display: flex; justify-content: center; gap: 0.5rem; }
.link-row .btn { display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; min-width: 52px; }

/* ---------- Files (Finder-style) window ---------- */
.finder-info {
    display: flex;
    justify-content: space-between;
    padding: 2px 10px;
    border-bottom: 2px solid #000;
    font-family: Chicago_12, Chicago, sans-serif;
    font-size: 0.8rem;
}
.files-pane {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.9rem 0.4rem;
    padding: 0.9rem 0.6rem 1rem;
    overflow: visible;
}
.file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #000;
    font-family: Chicago_12, Chicago, sans-serif;
    font-size: 0.85rem;
    text-align: center;
}
.file-thumb {
    display: block;
    width: 72px;
    aspect-ratio: 4 / 3;
    border: 2px solid #000;
    background: #fff;
    box-shadow: 2px 2px 0 #000;
    overflow: hidden;
}
.file-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-name { padding: 0 4px; background: #fff; }
.file:hover .file-name, .file:focus-visible .file-name { background: #000; color: #fff; outline: none; }
.file:hover .file-thumb, .file:focus-visible .file-thumb { filter: invert(1); }

/* ---------- Buttons rendered as links ---------- */
a.btn { display: inline-block; }
.example .btn { margin: 4px 4px 4px 0; }

/* ---------- Video thumbnails ---------- */
.video {
    position: relative;
    display: block;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    padding: 0;
    margin: 0 0 0.6rem;
    border: 2px solid #000;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}
.video img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
    position: absolute;
    left: 50%; top: 50%;
    width: 56px; height: 56px;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 3px solid #000;
    box-shadow: 3px 3px 0 #000;
}
.video-play::after {
    content: "";
    position: absolute;
    left: 20px; top: 12px;
    border-left: 20px solid #000;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
}
.video:hover .video-play, .video:focus-visible .video-play { background: #000; }
.video:hover .video-play::after, .video:focus-visible .video-play::after { border-left-color: #fff; }
.video-frame { width: 100%; max-width: 560px; aspect-ratio: 16 / 9; border: 2px solid #000; margin-bottom: 0.6rem; display: block; }

/* ---------- About box ---------- */
.about-overlay {
    position: fixed; inset: 0;
    z-index: 20000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.25);
}
.about-overlay[hidden] { display: none; }
.about-dialog {
    background: #fff;
    border: 3px solid #000;
    outline: 2px solid #fff;
    box-shadow: 0 0 0 4px #000, 6px 6px 0 4px #000;
    padding: 1.5rem 2rem;
    text-align: center;
    max-width: 90vw;
    font-family: Chicago_12, Chicago, sans-serif;
}
.about-dialog img { image-rendering: pixelated; width: 128px; height: 128px; display: block; margin: 0 auto 0.5rem; }
.about-dialog h2 { font-size: 1.4rem; margin: 0.4rem 0; }
.about-dialog p { margin: 0 0 1rem; }

/* ---------- Small screens ---------- */
@media (max-width: 699px) {
    .desktop { padding: 0 0.6rem; }
    .window.compact { width: 100%; }
    .title-bar { cursor: default; }
    .about-pane, .window-pane { padding: 0.75rem 1rem; }
    .example { margin: 0.75rem 0; padding: 0.5rem 0.9rem; }
    .menubar-clock { display: none; }
}

