/**
 * Project: Main-Website
 * Module: public/CSS/japps.css
 * Author: J. Apps (JohnV2002 / Sodakiller1)
 * Version: 1.0.0
 * Description: The J. Apps look (based on the About page): tokens, navigation, header band,
 *     cards, buttons, badges, forms, accordion, legal text, reader and download progress.
 * New in v1.0.0: One shared stylesheet for all non-themed pages, light and dark (body.dark-mode).
 * Copyright: MIT (c) 2026 J. Apps
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    --bg: #ffffff;
    --surface: #f8f9fa;
    --card: #ffffff;
    --text: #1f2328;
    --text-muted: #57606a;
    --border: #dee2e6;
    --accent: #0056b3;
    --accent-hover: #004494;
    --accent-soft: rgba(0, 86, 179, 0.08);
    --accent-text: #ffffff;
    --danger: #b42318;
    --success: #1a7f37;
    --adult: #b4235a;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --max: 960px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

body.dark-mode {
    --bg: #1f2124;
    --surface: #2a2d31;
    --card: #2f3337;
    --text: #f2f3f5;
    --text-muted: #b6bcc4;
    --border: #44494f;
    --accent: #6ea8fe;
    --accent-hover: #8fbcff;
    --accent-soft: rgba(110, 168, 254, 0.12);
    --accent-text: #0b1220;
    --danger: #ff8a80;
    --success: #6fdc8c;
    --adult: #ff8fb7;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background-color 0.25s ease, color 0.25s ease;
}

.page-container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 0.6rem;
}

p {
    margin: 0 0 0.9rem;
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-hover);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
}

/* ── Top navigation (partials/site-nav.html) ───────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 980;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
    padding: 0.7rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.site-nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.site-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.site-nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
}

.site-nav-links a:hover,
.site-nav-links a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ── Header band ───────────────────────────────────────────────────────── */
.j-header {
    width: 100%;
    padding: 2.6rem 1rem 2.2rem;
    text-align: center;
    background: linear-gradient(180deg, var(--accent-soft), transparent 85%), var(--surface);
    border-bottom: 1px solid var(--border);
}

.j-header h1 {
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    margin: 0;
}

.j-header .j-sub {
    margin: 0.5rem auto 0;
    max-width: 40rem;
    color: var(--text-muted);
}

.j-kicker {
    display: inline-block;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ── Main column ──────────────────────────────────────────────────────── */
.j-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.j-main--narrow {
    max-width: 760px;
}

.j-section + .j-section {
    margin-top: 2.4rem;
}

.j-section > h2 {
    font-size: 1.35rem;
}

.j-section-intro {
    color: var(--text-muted);
    margin-top: -0.2rem;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.j-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.5rem;
}

.j-card + .j-card {
    margin-top: 1.2rem;
}

.j-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

.j-cards > .j-card + .j-card {
    margin-top: 0;
}

.j-card h2,
.j-card h3 {
    margin-bottom: 0.4rem;
}

.j-card-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
}

.j-card-icon {
    flex: 0 0 auto;
    width: 2.6rem;
    height: 2.6rem;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    border-radius: 12px;
    background: var(--accent-soft);
}

.j-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.j-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.6rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    background: var(--accent);
    color: var(--accent-text);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.j-btn:hover {
    background: var(--accent-hover);
    color: var(--accent-text);
}

.j-btn:active {
    transform: translateY(1px);
}

.j-btn--ghost {
    background: transparent;
    color: var(--accent);
    border-color: var(--border);
}

.j-btn--ghost:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.j-btn--fancy {
    background: linear-gradient(90deg, #6d5dfc, #b15cff);
    color: #fff;
}

.j-btn--fancy:hover {
    filter: brightness(1.08);
    background: linear-gradient(90deg, #6d5dfc, #b15cff);
    color: #fff;
}

.j-btn[disabled],
.j-btn[aria-disabled="true"] {
    cursor: not-allowed;
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border);
}

.j-btn--block {
    width: 100%;
}

/* ── Badges ───────────────────────────────────────────────────────────── */
.j-badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--accent-soft);
    color: var(--accent);
    vertical-align: middle;
}

.j-badge--adult {
    background: color-mix(in srgb, var(--adult) 14%, transparent);
    color: var(--adult);
}

.j-badge--muted {
    background: var(--surface);
    color: var(--text-muted);
}

/* ── Notices, code, lists ─────────────────────────────────────────────── */
.j-notice {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.j-notice--adult {
    border-color: color-mix(in srgb, var(--adult) 45%, var(--border));
    background: color-mix(in srgb, var(--adult) 7%, var(--surface));
}

.j-code {
    display: block;
    width: 100%;
    margin: 0.3rem 0 0;
    padding: 0.7rem 0.9rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    word-break: break-all;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}

.j-list {
    margin: 0;
    padding-left: 1.2rem;
}

.j-list li + li {
    margin-top: 0.35rem;
}

/* ── Accordion (native <details>) ─────────────────────────────────────── */
.j-accordion details {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.j-accordion details + details {
    margin-top: 0.7rem;
}

.j-accordion summary {
    cursor: pointer;
    list-style: none;
    padding: 0.9rem 1.1rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.j-accordion summary::-webkit-details-marker {
    display: none;
}

.j-accordion summary::after {
    content: "＋";
    color: var(--text-muted);
}

.j-accordion details[open] summary::after {
    content: "－";
}

.j-accordion .j-accordion-body {
    padding: 0 1.1rem 1rem;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.j-field {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.j-input {
    flex: 1 1 18rem;
    min-height: 2.6rem;
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.j-input:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent-soft);
}

/* ── Download progress (downloadgame.html) ─────────────────────────────── */
.j-progress {
    width: 100%;
    height: 12px;
    margin: 0.8rem 0 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.j-progress .bar {
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    animation: j-bar-slide 1.15s linear infinite;
}

.j-progress .bar.done {
    animation: none;
    width: 100%;
    background: var(--success);
}

@keyframes j-bar-slide {
    from { transform: translateX(-110%); }
    to { transform: translateX(260%); }
}

/* ── "Finja, erklär mir das!" (scripts/finjaai.js) ─────────────────────── */
.gemini-description {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    white-space: pre-line;
    border-radius: var(--radius-sm);
    transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease, padding 0.4s ease;
}

.gemini-description.visible {
    max-height: 60rem;
    opacity: 1;
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
}

.spinner {
    width: 1.2rem;
    height: 1.2rem;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: j-spin 0.9s linear infinite;
}

@keyframes j-spin {
    to { transform: rotate(360deg); }
}

/* ── Legal text (privacy, terms, impressum) ───────────────────────────── */
.j-prose h2 {
    font-size: 1.3rem;
    margin-top: 1.8rem;
}

.j-prose h3 {
    font-size: 1.08rem;
    margin-top: 1.3rem;
}

.j-prose ul {
    padding-left: 1.2rem;
}

.j-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.92rem;
}

.j-prose th,
.j-prose td {
    text-align: left;
    vertical-align: top;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.j-prose code {
    font-family: var(--mono);
    font-size: 0.88em;
}

.j-table-scroll {
    overflow-x: auto;
}

.lang-en {
    display: none;
}

.j-prose #lang-switcher {
    float: right;
    margin: 0 0 1rem 1rem;
    min-height: 2.2rem;
    padding: 0.35rem 0.8rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ── Affiliate box (shown after consent: body.ads-enabled) ─────────────── */
.ad-placeholder {
    display: none;
    margin-top: 2rem;
    text-align: center;
}

body.ads-enabled .ad-placeholder {
    display: block;
}

/* ── 404 ──────────────────────────────────────────────────────────────── */
.j-404 {
    font-size: clamp(5rem, 22vw, 9rem);
    font-weight: 800;
    line-height: 1;
    margin: 0 0 0.6rem;
    color: var(--accent);
    letter-spacing: -0.04em;
}

/* ── Reader (readbook.html) ───────────────────────────────────────────── */
#age-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.82);
}

#age-gate-overlay.overlay-hidden {
    display: none;
}

#age-gate-overlay .j-card {
    max-width: 36rem;
    text-align: center;
    border-top: 4px solid var(--adult);
}

.book-hidden {
    visibility: hidden;
}

#page-content {
    transition: opacity 0.2s ease-in-out;
}

#page-content.fade-out {
    opacity: 0;
}

.j-reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1.4rem;
}

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .j-card {
        padding: 1.15rem 1.1rem;
    }

    .site-nav {
        justify-content: center;
    }

    .j-prose #lang-switcher {
        float: none;
        margin: 0 0 1rem;
    }

    .j-reader-nav {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ── About page bits ───────────────────────────────────────────────────── */
.j-link-arrow {
    display: inline-block;
    margin-top: 0.4rem;
    font-weight: 600;
    text-decoration: none;
}

.j-link-arrow:hover {
    text-decoration: underline;
}

.disclaimer,
.quote-line {
    color: var(--text-muted);
}

.j-card .j-card-icon + h3 {
    margin-top: 0.7rem;
}
