body {
    margin: 0;
    background: #d6d6d6;
    font-family: "Lucida Grande", "Helvetica Neue", Arial, sans-serif;
    color: #222;
}

.titlebar {
    position: relative;
    background: linear-gradient(#eeeeee, #bcbcbc);
    border-bottom: 1px solid #8a8a8a;
    box-shadow: inset 0 1px 0 #ffffff;
    padding: 28px 16px;
}

/* Language Selector Styles */
.lang-selector-container {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
}

.mac-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(#ffffff, #e6e6e6);
    border: 1px solid #999;
    border-radius: 5px;
    padding: 4px 28px 4px 10px;
    font-size: 13px;
    font-family: "Lucida Grande", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 #fff;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position-x: calc(100% - 2px);
    background-position-y: 50%;
    outline: none;
}

.mac-select:focus {
    border-color: #4f8df7;
    box-shadow: 0 0 0 3px rgba(79, 141, 247, 0.4), inset 0 1px 0 #fff;
}

.title-content {
    max-width: 960px;
    margin: auto;
    text-align: center;
}

.titlebar h1 {
    margin: 0;
    font-size: 34px;
}

.titlebar p {
    margin: 6px 0 18px;
    color: #444;
}

.titlebar img {
    max-width: 100%;
    width: 480px;
}

.window {
    max-width: 960px;
    margin: 24px auto;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow:
        0 10px 30px rgba(0,0,0,0.25),
        inset 0 1px 0 #ffffff;
    padding: 28px;
}

h2 {
    margin-top: 0;
    border-bottom: 1px solid #c0c0c0;
    padding-bottom: 6px;
}

.about p {
    line-height: 1.6;
}

.features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.features li {
    padding-left: 22px;
    margin: 8px 0;
    position: relative;
}

.features li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #2b6cb0;
    font-size: 12px;
}

.download-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 26px;
    background: linear-gradient(#6fb4ff, #1e63d8);
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 2px 4px rgba(0,0,0,0.3);
}

.download-btn:hover {
    background: linear-gradient(#82c2ff, #2a74e6);
}

.github-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 26px;
    background: linear-gradient(#555555, #1a1a1a);
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.4),
        0 2px 4px rgba(0,0,0,0.3);
}

.github-btn:hover {
    background: linear-gradient(#6e6e6e, #262626);
}

.screenshots {
    margin-top: 42px;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
    margin-top: 20px;
}

figure {
    margin: 0;
    text-align: center;
}

/* Most screenshots are exported from macOS with the window shadow baked into transparent padding,
   so a CSS shadow would draw a second one around the padded rectangle. Only opaque, shadowless
   images (e.g. Discord) get .shadowed from the page script, which detects them from their pixels. */
/* Screenshots carry different amounts of transparent padding above the window (it scales with each
   file's resolution), which staggered the visible window tops within a row. --top-pad is that padding as a
   fraction of the image width, measured by the page script; a percentage margin resolves against the figure width, and the image is
   --fit of it wide, so the negative margin pulls every visible window top up to the row's top edge. */
figure img {
    --fit: 80%;
    width: 100%;
    max-width: var(--fit);
    margin-top: calc(var(--top-pad, 0) * var(--fit) * -1);
    cursor: zoom-in;
    transition: transform 0.16s ease;
}

/* Reproduces the shadow baked into the macOS screenshots (measured from them: black at 40%,
   79px blur, 36px down, in the image's own pixels). --u is displayed px per image px, set by script,
   so the shadow scales with the image exactly as a baked one does. */
img.shadowed {
    border-radius: 4px;
    box-shadow: 0 calc(var(--u, 0.5px) * 35.75) calc(var(--u, 0.5px) * 79) rgba(0, 0, 0, 0.4);
}

@media (hover: hover) {
    figure img:hover {
        transform: translateY(-2px);
    }
}

figure img:focus-visible {
    outline: 3px solid #4f8df7;
    outline-offset: 4px;
}

figcaption {
    margin-top: 10px;
    font-size: 14px;
    color: #333;
}

body.modal-open {
    overflow: hidden;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(22, 22, 22, 0.45);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.lightbox-overlay[hidden] {
    display: none;
}

.lightbox-window {
    width: min(920px, 100%);
    max-height: 90vh;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #8d8d8d;
    background: linear-gradient(#f4f4f4, #dadada 42px, #f7f7f7 42px, #f7f7f7);
    box-shadow:
        0 30px 60px rgba(0,0,0,0.38),
        inset 0 1px 0 rgba(255,255,255,0.8);
    animation: macWindowPop 0.18s ease-out;
}

.lightbox-titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(#efefef, #cfcfcf);
    border-bottom: 1px solid #a2a2a2;
}

.traffic-lights {
    display: flex;
    gap: 8px;
}

.traffic {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid rgba(0,0,0,0.22);
    border-radius: 50%;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.65);
}

button.traffic {
    position: relative;
    padding: 0;
    cursor: pointer;
}

/* The dot stays 12px to look like a macOS window control; this widens the touch target to a usable size. */
button.traffic::after {
    content: "";
    position: absolute;
    inset: -14px;
}

.close {
    background: #ff5f57;
}

.minimize {
    background: #febb2e;
}

.zoom {
    background: #28c840;
}

.lightbox-title {
    flex: 1;
    margin-right: 56px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #404040;
}

.lightbox-body {
    padding: 18px;
    background: #f7f7f7;
}

.lightbox-body img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
}

.lightbox-caption {
    margin: 14px 0 4px;
    text-align: center;
    color: #4a4a4a;
}

@keyframes macWindowPop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

footer {
    text-align: center;
    padding: 18px;
    color: #444;
    font-size: 14px;
}

@media (max-width: 600px) {
    .window {
        padding: 16px;
        margin: 10px;
    }

    .titlebar {
        padding: 20px 12px;
    }

    .titlebar h1 {
        font-size: 28px;
    }

    figure img {
        --fit: 100%;
    }

    .lang-selector-container {
        position: static;
        text-align: center;
        margin-bottom: 12px;
    }

    /* 16px keeps iOS Safari from zooming the page when the dropdown is focused. */
    .mac-select {
        font-size: 16px;
        padding: 8px 32px 8px 12px;
    }

    .download-btn,
    .github-btn {
        display: block;
        box-sizing: border-box;
        width: 100%;
        padding: 14px 20px;
        text-align: center;
    }

    /* The <br> between the buttons would add a blank line on top of the margin once they stack. */
    .about br {
        display: none;
    }

    .github-btn {
        margin-top: 12px;
    }

    /* Screenshots are far too dense to read at phone width, so the preview shows them at a readable
       size and lets the viewer pan sideways instead of shrinking them to fit. */
    .lightbox-overlay {
        padding: 10px;
    }

    .lightbox-window {
        display: flex;
        flex-direction: column;
        max-height: 92vh;
    }

    .lightbox-body {
        padding: 10px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lightbox-body img {
        max-width: none;
        max-height: none;
        width: max(100%, 720px);
        margin: 0;
    }

    .lightbox-caption {
        position: sticky;
        left: 0;
    }
}

/* Plain anchors back up the JS-only language <select> so every translation is reachable without scripting. */
.footer-langs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    margin-bottom: 10px;
}

.footer-langs a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 0;
}

.footer-langs a:hover,
.footer-langs a[aria-current="true"] {
    text-decoration: underline;
}
