/* Shared by every page under /apps. Extends the tokens in the site's
   style.css; the theme class and its localStorage key come from /script.js. */

@font-face {
    font-family: 'Fredoka';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('/apps/fonts/fredoka.woff2') format('woff2');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    --bg-color: white;
    --surface-color: #fafafa;
    --text-color: rgba(0, 0, 0, 0.8);
    --muted-color: rgba(0, 0, 0, 0.55);
    --border-color: rgba(0, 0, 0, 0.12);
    --link-color: #0d7c73;
    --accent-color: #0d7c73;
    --on-accent: white;
}

body.dark-theme {
    --bg-color: #0a0a0a;
    --surface-color: #151515;
    --text-color: rgba(245, 245, 245, 0.8);
    --muted-color: rgba(245, 245, 245, 0.5);
    --border-color: rgba(255, 255, 255, 0.14);
    --link-color: #3fbdb1;
    --accent-color: #3fbdb1;
    --on-accent: #0a0a0a;
}

/* Puppy's own blue, taken from the game's --stage token. */
body.puppy {
    --link-color: #0b6bb5;
    --accent-color: #007cd1;
    --on-accent: white;
}

body.puppy.dark-theme {
    --link-color: #6bbcf0;
    --accent-color: #0188e4;
    --on-accent: white;
}

/* ---------- theme toggle, same as the rest of the site ---------- */

#theme-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    border: 2px solid var(--text-color);
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

#theme-toggle .moon,
body.dark-theme #theme-toggle .sun {
    display: none;
}

body.dark-theme #theme-toggle .moon {
    display: block;
}

/* ---------- page frame ---------- */

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px 100px;
}

.up {
    display: inline-block;
    margin-bottom: 40px;
    font-size: 16px;
    color: var(--muted-color);
    text-decoration: none;
}

.up:hover {
    color: var(--link-color);
}

h1 {
    font-size: 56px;
    font-weight: 100;
    letter-spacing: -1px;
    margin-bottom: 24px;
}

h2 {
    font-size: 32px;
    font-weight: 600;
    margin-top: 80px;
    margin-bottom: 24px;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    font-size: 18px;
    margin-bottom: 20px;
}

.lead {
    font-size: 22px;
    color: var(--muted-color);
    margin-bottom: 40px;
}

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

ul {
    margin: 0 0 20px 24px;
}

li {
    font-size: 18px;
    margin-bottom: 10px;
}

dt {
    font-size: 20px;
    font-weight: 600;
    margin-top: 32px;
}

dd {
    font-size: 18px;
    margin-top: 8px;
    color: var(--muted-color);
}

footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-color);
    font-size: 16px;
}

footer p {
    font-size: 16px;
    margin-bottom: 8px;
}

/* ---------- the app gallery on /apps ---------- */

.apps {
    display: grid;
    gap: 40px;
    grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
    margin-top: 48px;
}

.app {
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.app img.cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 500;
    object-fit: cover;
}

.app .body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 24px;
}

.app .head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.app .head img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
}

.app h2 {
    font-size: 26px;
    margin: 0;
}

.app p {
    font-size: 17px;
    color: var(--muted-color);
    margin-bottom: 20px;
}

.app .links {
    margin-top: auto;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 999px;
    background: var(--accent-color);
    color: var(--on-accent);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
}

.button:hover {
    opacity: 0.85;
}

.button.quiet {
    background: transparent;
    color: var(--link-color);
    border: 1px solid var(--border-color);
}

/* ---------- the Puppy pages ---------- */

body.puppy h1,
body.puppy h2,
body.puppy h3,
body.puppy .lead,
body.puppy .button {
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body.puppy h1 {
    font-weight: 600;
    letter-spacing: 0;
}

.hero {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 20px;
    margin-bottom: 40px;
}

figure {
    margin: 0 0 40px;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

figcaption {
    margin-top: 12px;
    font-size: 17px;
    color: var(--muted-color);
}

.shots {
    margin-top: 40px;
}

/* A two-audience block: the child's half and the grown-up's half. */
.halves {
    display: grid;
    gap: 40px;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.plain {
    list-style: none;
    margin-left: 0;
}

.plain li {
    padding-left: 28px;
    position: relative;
}

.plain li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 11px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
}

.note {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    margin-top: 40px;
}

.note p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    main {
        padding: 40px 20px 80px;
    }

    footer {
        padding: 32px 20px;
    }

    #theme-toggle {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    h1 {
        font-size: 40px;
    }

    h2 {
        font-size: 28px;
        margin-top: 60px;
    }

    .lead {
        font-size: 20px;
    }
}

/* ---------- tables and code, used by the how-to-play page ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 18px;
}

th,
td {
    text-align: left;
    padding: 12px 16px 12px 0;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

th {
    font-weight: 600;
    color: var(--muted-color);
    font-size: 16px;
}

td:first-child,
th:first-child {
    width: 34%;
}

code,
pre {
    font-family: 'Cascadia Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code {
    font-size: 0.94em;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 7px;
}

pre {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    overflow-x: auto;
    font-size: 18px;
    line-height: 1.5;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
}
