/* ─── Accessibility ─────────────────────────────────────────────────────────── */

/* Visually hidden but readable by screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link — visible on focus only */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.15s;
}
.skip-nav:focus { top: 0; }

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.dl-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #0d1117;
    --surface:      #161b22;
    --surface-2:    #1f2937;
    --border:       #30363d;
    --text:         #e6edf3;
    --text-muted:   #9ca3af;
    --accent:       #2563eb;
    --accent-hover: #1d4ed8;
    --accent-dim:   #1e3a5f;
    --mac-color:    #6366f1;
    --win-color:    #0ea5e9;
    --tag-bg:       #21262d;

    /* Live download highlight — default (unbranded) palette. */
    /* Per-app cards override these three vars to re-color their enabled buttons. */
    --live-rgb:   37, 99, 235;
    --live-solid: #2563eb;
    --live-text:  #60a5fa;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header / Nav ──────────────────────────────────────────────────────────── */
.site-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 9999;
}

.site-header .inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.site-header .brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.site-header .brand:hover { text-decoration: none; }

.site-header .brand span:not(.re-accent),
.auth-form h1 span:not(.re-accent) { color: var(--accent); }

/* "Re" accent used in brand name and headings */
.re-accent { color: #D32F2F; }

nav { display: flex; gap: 4px; }

nav a {
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

nav a:hover {
    color: var(--text);
    background: var(--surface-2);
    text-decoration: none;
}

nav a.active {
    color: var(--text);
    background: var(--surface-2);
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
main { flex: 1; }

.page-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 64px 24px;
}

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 56px;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero h1 span:not(.re-accent) { color: var(--accent); }

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

.hero .badge {
    display: inline-block;
    margin-bottom: 20px;
    padding: 4px 12px;
    background: var(--accent-dim);
    color: #93c5fd;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ─── Section Heading ───────────────────────────────────────────────────────── */
.section-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 10px;
}

/* Every section heading except the first gets a divider + extra top spacing.   */
.section-heading ~ .section-heading {
    margin-top: 80px;
    padding-top: 48px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.section-heading + .page-grid { margin-top: 0; }

/* ─── Page Grid ─────────────────────────────────────────────────────────────── */
/* Shared grid base for both software (.app-grid) and content (.content-grid).  */
/* Each page's CSS overrides grid-template-columns as needed.                   */
/* auto-fill (vs auto-fit) keeps empty column tracks so sections with fewer    */
/* cards don't stretch — all cards keep consistent width across sections.       */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Fixed 2-column modifier — use on sections that should be 50/50 regardless   */
/* of width (e.g. software page Communication, content page card grid).        */
.page-grid-2col { grid-template-columns: repeat(2, 1fr); }

/* ─── Section Labels ─────────────────────────────────────────────────────────── */
.section-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-bottom: 10px;
}

/* ─── Base Card ─────────────────────────────────────────────────────────────── */
/* Shared base for .app-card (software page) and .content-card (content page).  */
/* Each page's CSS adds border-radius, padding, and any other overrides.        */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* ─── Card Name ─────────────────────────────────────────────────────────────── */
/* Replaces .app-name (software) and .content-card-name (content) — identical.  */
.card-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    margin: 0 0 10px;
}

/* ─── Card Description ──────────────────────────────────────────────────────── */
/* Base shared between pages; each page CSS overrides line-height + margin.     */
.card-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ─── Downloads Section ──────────────────────────────────────────────────────── */
.card-downloads {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.card-downloads .section-label {
    margin-bottom: 14px;
}

.card-downloads .download-buttons {
    margin-bottom: 0;
}

/* ─── Download Buttons ──────────────────────────────────────────────────────── */
.download-buttons { display: flex; flex-direction: column; gap: 10px; }

.dl-btn {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    text-decoration: none !important;
}

.dl-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dl-btn .os-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
}

.dl-btn .os-icon img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 10px;
}

.dl-btn.mac .os-icon  { background: #2b333f; color: #94a3b8; }
.dl-btn.win .os-icon  { background: #2b333f; color: #94a3b8; }

.dl-btn .dl-label { flex: 1; }

.dl-btn .dl-label strong,
.dl-btn .dl-label .entry-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.dl-btn .dl-label span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dl-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.01em;
    width: 100%;
}

/* ─── Live Download Highlight ──────────────────────────────────────────────── */
/* Applied to every enabled, available download button. Uses the --live-* vars */
/* from :root by default; per-app cards override those vars for brand colors.  */

.dl-btn:not(.disabled):not(.dl-unavailable) {
    border-color: rgba(var(--live-rgb), 0.4);
    background:   rgba(var(--live-rgb), 0.07);
}

.dl-btn:not(.disabled):not(.dl-unavailable):hover {
    border-color: var(--live-solid);
    background:   rgba(var(--live-rgb), 0.14);
    text-decoration: none;
}

.dl-btn:not(.disabled):not(.dl-unavailable) .dl-cta {
    background: rgba(var(--live-rgb), 0.15);
    color:      var(--live-text);
    border:     1px solid rgba(var(--live-rgb), 0.45);
}

/* Per-app brand color overrides — just re-set the three vars. */
.card-direct,    .entry-direct    { --live-rgb: 255, 117, 24;  --live-solid: #FF7518; --live-text: #FF7518; }
.card-stage,     .entry-stage     { --live-rgb: 211, 47, 47;   --live-solid: #D32F2F; --live-text: #f87171; }
.card-broadcast, .entry-broadcast { --live-rgb: 58, 54, 240;   --live-solid: #3A36F0; --live-text: #8b89f8; }
.card-music                       { --live-rgb: 109, 40, 217;  --live-solid: #6D28D9; --live-text: #a78bfa; }
.card-jukebox                     { --live-rgb: 236, 72, 153;  --live-solid: #EC4899; --live-text: #f472b6; }
.card-robot-os,  .entry-robot-os  { --live-rgb: 30, 64, 175;   --live-solid: #1E40AF; --live-text: #60a5fa; }
.card-office                      { --live-rgb: 37, 99, 235;   --live-solid: #2563EB; --live-text: #60a5fa; }
.card-workflow                    { --live-rgb: 251, 113, 133; --live-solid: #FB7185; --live-text: #FB7185; }
.card-nearmail                    { --live-rgb: 245, 158, 11;  --live-solid: #F59E0B; --live-text: #F59E0B; }
.card-finance                     { --live-rgb: 16, 185, 129;  --live-solid: #10B981; --live-text: #10B981; }
.card-till                        { --live-rgb: 132, 204, 22;  --live-solid: #84CC16; --live-text: #84CC16; }
.card-exchange                    { --live-rgb: 128, 128, 128; --live-solid: #808080; --live-text: #a3a3a3; }
.card-hard-drive                  { --live-rgb: 59, 130, 246;  --live-solid: #3B82F6; --live-text: #60a5fa; }
.card-protect                     { --live-rgb: 67, 56, 202;   --live-solid: #4338CA; --live-text: #818cf8; }
.card-admin                       { --live-rgb: 146, 64, 14;   --live-solid: #92400E; --live-text: #fbbf24; }
.card-link                        { --live-rgb: 20, 184, 166;  --live-solid: #14B8A6; --live-text: #2dd4bf; }
.card-gps                         { --live-rgb: 14, 165, 233;  --live-solid: #0EA5E9; --live-text: #38bdf8; }

/* ─── Disabled / Unavailable Download Button ───────────────────────────────── */
/* .disabled — "Coming Soon" / "Future Release"; may become clickable later.   */
/* .dl-unavailable — permanently unavailable (e.g. iOS on Direct). Keeps       */
/* pointer events enabled so the nested .dl-na info tooltip can still fire.    */
.dl-btn.disabled {
    cursor: not-allowed;
    pointer-events: none;
}
.dl-btn.dl-unavailable { cursor: default; }

.dl-btn.disabled .dl-top,
.dl-btn.dl-unavailable .dl-top {
    opacity: 0.45;
}

.dl-btn.disabled .dl-cta {
    background: rgba(128,128,128,0.12);
    color: var(--text-muted);
    border-color: rgba(128,128,128,0.25);
}

/* ─── Version Note ──────────────────────────────────────────────────────────── */
.version-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 14px;
    line-height: 1.5;
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }
.footer-sep { margin: 0 8px; opacity: 0.4; }

/* ─── Hamburger Nav ──────────────────────────────────────────────────────────── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle:hover span { background: var(--text); }

body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Jump Nav ───────────────────────────────────────────────────────────────── */
.jump-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 40px;
}

.jump-nav a {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.jump-nav a:hover {
    color: var(--text);
    border-color: rgba(255,255,255,0.3);
    background: var(--surface-2);
    text-decoration: none;
}

/* Hidden by default; shown at mobile breakpoint below. */
.jump-select { display: none; }

/* ─── Auth Gate ─────────────────────────────────────────────────────────────── */
/* Standalone login screen rendered by auth-gate.php (no header/footer).        */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    min-height: 60vh;
}

.auth-form {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.auth-form h1 {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.auth-form p {
    font-size: 0.92rem;
    color: var(--text);
    text-align: center;
    line-height: 1.55;
    margin-bottom: 8px;
}

.auth-form p a { color: var(--accent); text-decoration: underline; }
.auth-form p a:hover { color: var(--accent-hover); }

.auth-form .auth-subnote {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: -4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-field input {
    padding: 10px 12px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.auth-field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.auth-form button {
    margin-top: 4px;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.auth-form button:hover { background: var(--accent-hover); }

.auth-error {
    color: #ef5350;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero h1        { font-size: 2rem; }
    .page-section   { padding: 40px 16px; }
    .page-grid      { grid-template-columns: 1fr; }
    .nav-toggle     { display: flex; }
    .jump-nav       { display: none; }

    .jump-select {
        display: block;
        width: 100%;
        margin-bottom: 28px;
        padding: 10px 14px;
        background: var(--surface);
        color: var(--text);
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        padding-right: 36px;
    }
    .jump-select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

    #site-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 16px;
        gap: 4px;
        z-index: 9998;
    }

    body.nav-open #site-nav { display: flex; }

    #site-nav a {
        padding: 10px 14px;
        font-size: 1rem;
        border-radius: 8px;
    }
}


/* ─── Footnote ──────────────────────────────────────────────────────── */
.footnote {
    margin-top: 24px;
    margin-bottom: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}