/* TICAD Youth Drive 2026 — Photo Frame
   Mobile first. Desktop enhancements at the bottom. */

:root {
    --green: #4e6338;
    --green-dark: #3c4d2b;
    --orange: #ce843c;
    --cream: #f4f1e8;
    --paper: #ffffff;
    --ink: #23281c;
    --ink-soft: #5d6552;
    --line: #ddd8c8;
    --radius: 14px;
    --tap: 48px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--cream);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Header ---------- */

.site-header {
    background: var(--green);
    color: #fff;
    padding: 14px 0 16px;
    padding-top: calc(14px + env(safe-area-inset-top));
}

.header-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand {
    font-size: 20px;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.brand-mark {
    font-weight: 800;
}

.brand-rest {
    font-weight: 400;
    opacity: 0.92;
}

.event-meta {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

/* ---------- Main ---------- */

.main {
    padding-top: 20px;
    padding-bottom: 32px;
}

.page-title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -0.01em;
    color: var(--green-dark);
}

.page-sub {
    margin: 4px 0 18px;
    font-size: 14px;
    color: var(--ink-soft);
}

/* ---------- Canvas ---------- */

.stage {
    margin-bottom: 22px;
}

.canvas-container {
    position: relative;
    background: var(--paper);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(35, 40, 28, 0.12);
    transition: box-shadow 0.15s ease;
}

.canvas-container.drag-over {
    box-shadow: 0 0 0 3px var(--orange);
}

#photoCanvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.drop-hint {
    position: absolute;
    /* Matches the white photo window inside the frame artwork
       (x 166/1274, y 275/1068, w 420/1274, h 454/1068). */
    left: 13.03%;
    top: 25.75%;
    width: 32.97%;
    height: 42.51%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--green);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.drop-hint:active {
    background: rgba(78, 99, 56, 0.06);
}

.drop-hint.hidden {
    display: none;
}

.drop-text {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.drop-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--ink-soft);
    line-height: 1.2;
}

.zoom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.zoom-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

#zoom {
    flex: 1;
    accent-color: var(--green);
    height: 28px;
}

.link-btn {
    border: none;
    background: none;
    color: var(--green);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    padding: 6px 2px;
    cursor: pointer;
}

.drag-tip {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--ink-soft);
}

/* ---------- Form ---------- */

.controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field input,
.field select {
    min-height: var(--tap);
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    appearance: none;
}

.field select {
    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 fill='%235d6552' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

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

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}

.btn {
    min-height: var(--tap);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn:not(:disabled):active {
    transform: translateY(1px);
}

.btn-outline {
    background: var(--paper);
    border-color: var(--green);
    color: var(--green);
}

.btn-primary {
    background: var(--green);
    color: #fff;
}

.btn-ghost {
    grid-column: 1 / -1;
    background: var(--orange);
    color: #fff;
}

.hashtags {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--ink-soft);
    word-spacing: 0.02em;
}

/* ---------- Help ---------- */

.help {
    margin-top: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 16px;
}

.help summary {
    min-height: var(--tap);
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--green);
    cursor: pointer;
}

.help ol {
    margin: 0 0 14px;
    padding-left: 20px;
    font-size: 14px;
    color: var(--ink-soft);
}

.help li {
    margin-bottom: 6px;
}

/* ---------- Footer ---------- */

.site-footer {
    background: var(--green-dark);
    color: rgba(255, 255, 255, 0.85);
    padding: 18px 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    font-size: 12px;
}

.site-footer p {
    margin: 0 0 4px;
}

.archive-link a {
    color: #fff;
    opacity: 0.75;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 50;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Larger screens ---------- */

@media (min-width: 720px) {
    .wrap {
        max-width: 960px;
    }

    .header-inner {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
    }

    .brand {
        font-size: 24px;
    }

    .event-meta {
        font-size: 13px;
    }

    .page-title {
        font-size: 34px;
    }

    .main {
        padding-top: 28px;
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
        grid-template-areas:
            "title  title"
            "sub    sub"
            "stage  controls"
            "help   help";
        column-gap: 32px;
        align-items: start;
    }

    .page-title {
        grid-area: title;
    }

    .page-sub {
        grid-area: sub;
    }

    .stage {
        grid-area: stage;
    }

    .controls {
        grid-area: controls;
    }

    .help {
        grid-area: help;
    }

    .drop-text {
        font-size: 15px;
    }

    .drop-sub {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
