/* Shared look for every page, in the same artistic direction as the other Jaja
   Family sites (Pitchoun, Jobs, jajafamily.org): warm cream background, white
   cards with a thin warm border, pill buttons, one brand color (the logo's green),
   handwritten title. Mobile first; follows the system light/dark setting. */

:root {
    color-scheme: light dark;
    --bg: #fffaf3;
    --bg-dot: #f1e6d4;
    --surface: #ffffff;
    --text: #1f2430;
    --muted: #5d6475;
    --brand: #3f9a7f;       /* logo green */
    --accent: #2e7d66;      /* logo green, darkened for text contrast */
    --accent-text: #ffffff;
    --sun: #ffd052;         /* logo sun */
    --coral: #c4452e;       /* logo rays, darkened: errors and deletions */
    --warn: #b7791f;
    --ok: #2e7d66;
    --border: #ece4d8;
    --radius: 14px;
    --tap: 44px;            /* minimum touch target */
    --gutter: 16px;
    --shadow: 0 1px 0 rgba(60, 40, 20, .04), 0 6px 18px rgba(60, 40, 20, .07);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --hand: "Caveat Brush", "Comic Sans MS", cursive;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15171c;
        --bg-dot: #22252d;
        --surface: #1e2128;
        --text: #eef0f4;
        --muted: #a3a9b6;
        --brand: #6cc4a8;
        --accent: #6cc4a8;
        --accent-text: #15171c;
        --coral: #ff8b74;
        --warn: #f0b85a;
        --ok: #6cc4a8;
        --border: #2c3039;
        --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .35);
    }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
    margin: 0;
    min-height: 100dvh;
    background-color: var(--bg);
    background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    color: var(--text);
    font: 16px / 1.45 var(--font);
    padding-bottom: env(safe-area-inset-bottom);
}

a, button, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.page { max-width: 720px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 32px; }
.page.wide { max-width: 1100px; }

/* ---------- Top bar: back / brand on the left, tools on the right ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 56px;
    margin-bottom: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--tap);
    color: var(--accent);
    text-decoration: none;
    font-family: var(--hand);
    font-size: 1.7rem;
    line-height: 1;
}

.brand img { width: 44px; height: 44px; display: block; }

.tools { display: flex; gap: 6px; }

.pill, .back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.back { padding: 0 14px 0 10px; color: var(--accent); }
.back::before { content: "‹"; font-size: 1.5rem; line-height: 1; margin-top: -3px; }
.pill:active, .back:active, .btn:active { transform: scale(0.97); }

/* Labels next to icons only when there is room. */
.pill .label { display: none; }
@media (min-width: 420px) { .pill .label { display: inline; } }

/* ---------- Titles ---------- */
.title {
    font-family: var(--hand);
    font-weight: 400;
    font-size: clamp(2.2rem, 8vw, 3rem);
    line-height: 1;
    color: var(--accent);
    margin: 8px 0 4px;
    transform: rotate(-1.5deg);
    transform-origin: left center;
}

.subtitle { color: var(--muted); margin: 0 0 16px; }

/* ---------- Buttons and fields ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--tap);
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}

.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn.danger { background: var(--surface); color: var(--coral); border-color: var(--border); }
.btn.small { min-height: var(--tap); padding: 0 14px; font-size: 0.85rem; }

input, textarea, select {
    width: 100%;
    min-height: var(--tap);
    font: inherit;
    font-size: 1rem; /* 16px: no zoom on focus in iOS Safari */
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    outline: none;
}

input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
textarea { min-height: 7rem; resize: vertical; }

.field label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 0.8rem 0 0.25rem; }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; border-radius: 999px; padding: 0 1rem; }

/* ---------- Cards and thumbnails ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.thumb {
    width: 48px;
    height: 68px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: cover;
    background: color-mix(in srgb, var(--brand) 18%, var(--surface));
    color: var(--accent);
    font-family: var(--hand);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    width: max-content;
    max-width: calc(100% - 2rem);
    text-align: center;
    z-index: 20;
}

.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
