/* Jihanki Map — public site.
   Deep green (#3B7A57) is the project colour; the red pin (#D64550) is
   reserved for machines on the map so it never competes with UI chrome. */

:root {
    --green: #3B7A57;
    --green-dark: #2c5c41;
    --pin: #D64550;
    --ink: #1c1f1d;
    --muted: #5f6b64;
    --line: #e2e6e3;
    --bg: #fbfaf7;
    --card: #fff;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--green-dark); }

/* --- header ------------------------------------------------------------ */

.site-header { background: var(--green); color: #fff; }

.site-header .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    padding: .85em 1.25em;
    max-width: 1100px;
    margin: 0 auto;
}

.site-header .brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .01em;
}

.site-header nav { display: flex; gap: 1.25em; align-items: center; }

.site-header nav a {
    color: #fff;
    text-decoration: none;
    font-size: .95rem;
    opacity: .92;
}

.site-header nav a:hover { opacity: 1; text-decoration: underline; }

.site-header nav a.lang {
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 999px;
    padding: .15em .8em;
}

.hero {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1em 1.25em 2.25em;
}

.hero h1 {
    margin: .2em 0 .35em;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    line-height: 1.25;
}

.hero p {
    margin: 0;
    max-width: 60ch;
    color: rgba(255, 255, 255, .88);
}

.hero .stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 2em;
    margin: 1.4em 0 0;
    padding: 0;
}

.hero .stats strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.hero .stats span { font-size: .9rem; color: rgba(255, 255, 255, .8); }

/* --- map --------------------------------------------------------------- */

main { max-width: 1100px; margin: 0 auto; padding: 0 1.25em; }

.map-section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    /* Pull the map up so it straddles the header edge. */
    margin-top: -1.5em;
}

.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    flex-wrap: wrap;
    padding: .75em 1em;
    border-bottom: 1px solid var(--line);
}

.map-status { margin: 0; font-size: .9rem; color: var(--muted); }
.map-status.is-error { color: #b00020; font-weight: 600; }

#browse-map { width: 100%; height: min(70vh, 640px); }

.btn {
    font: inherit;
    font-size: .9rem;
    color: #fff;
    background: var(--green);
    border: 1px solid var(--green);
    border-radius: 6px;
    padding: .45em 1em;
    cursor: pointer;
}

.btn:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); }
.btn:disabled { opacity: .6; cursor: default; }

/* --- map popup --------------------------------------------------------- */

.popup { display: flex; flex-direction: column; gap: .2em; min-width: 170px; }
.popup img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; margin-bottom: .35em; }
.popup strong { font-size: 1rem; }
.popup .popup-type, .popup .popup-count { font-size: .82rem; color: var(--muted); }
.popup a { margin-top: .4em; font-size: .9rem; font-weight: 600; }

/* --- content pages ----------------------------------------------------- */

.page {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5em;
    margin: 1.5em 0;
}

.page h1 { margin-top: 0; }

.map-preview { width: 100%; height: 300px; border-radius: 8px; overflow: hidden; }

.machine-photo { width: 100%; max-height: 420px; object-fit: cover; border-radius: 8px; }

.meta { color: var(--muted); margin: .25em 0; }

/* Recorded machine attributes: label/value pairs, two columns on wide screens. */
.attrs { display: grid; grid-template-columns: auto 1fr; gap: .35em 1em; margin: 1em 0; }
.attrs dt { color: var(--muted); }
.attrs dd { margin: 0; }

.rank-list { list-style: none; margin: 0; padding: 0; }

.rank-list li {
    display: flex;
    align-items: baseline;
    gap: .75em;
    padding: .55em 0;
    border-bottom: 1px solid var(--line);
}

.rank-list li:last-child { border-bottom: 0; }
.rank-list .rank { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.rank-list .name { flex: 1; }
.rank-list .score { font-weight: 600; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); font-style: italic; }

/* --- footer ------------------------------------------------------------ */

footer {
    text-align: center;
    padding: 3em 1.25em;
    color: var(--muted);
}

footer .cta-title { font-weight: 600; color: var(--ink); margin-bottom: .25em; }

/* MapLibre injects its own attribution styling; keep it legible on our card. */
.maplibregl-ctrl-attrib { font-size: 11px; }

@media (max-width: 600px) {
    .hero .stats { gap: 1.5em; }
    #browse-map { height: 60vh; }
}
