/* FPM.photo – mobile first, no framework. */

:root {
    --bg: #f5f6f3;
    --card: #ffffff;
    --ink: #18211f;
    --muted: #5d6a66;
    --line: #dfe4e1;
    --accent: #1f6f5c;
    --accent-ink: #ffffff;
    --share: #1fa855;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 6px 24px rgba(16, 24, 22, .06);
}

/* Messaging app themes: light page tint + that app's share colour. */
.app-whatsapp  { --bg: #e8f6eb; --share: #1fa855; }
.app-messenger { --bg: #e9f1ff; --share: #0a7cff; }
.app-facebook  { --bg: #e9effb; --share: #1877f2; }
.app-telegram  { --bg: #e5f3fb; --share: #2a9fd8; }
.app-wechat    { --bg: #ecf7e7; --share: #07a653; }
.app-x         { --bg: #eff1f3; --share: #0f1419; }
.app-instagram { --bg: #fbeef4; --share: #c72a74; }
.app-line      { --bg: #e8f8ec; --share: #05a648; }
.app-viber     { --bg: #f1eefb; --share: #7360f2; }
.app-snapchat  { --bg: #fffbdc; --share: #1b1b1b; }

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

html { -webkit-text-size-adjust: 100%; }
html.lb-open { overflow: hidden; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: 1.2rem; }

/* ---------- chrome ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 16px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.site-nav { display: flex; gap: .9rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }

.page { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px 2rem; }

.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 16px 2rem; }
.site-footer p { margin: .25rem 0; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin: 1rem 0;
}
.center { text-align: center; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 40rem; }
.center .lead, .hero .lead { margin-left: auto; margin-right: auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0 0 .25rem; }
.hint { color: var(--muted); font-size: .875rem; }
.notice { background: #fff4e5; border-radius: 10px; padding: .6rem .9rem; }
.notice.ok { background: #e6f6ec; }
.error-text { color: #b3261e; font-weight: 600; }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: .6rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, background-color .2s ease, box-shadow .2s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-big { width: 100%; font-size: 1.1rem; min-height: 54px; }
.btn-small { min-height: 32px; padding: .25rem .7rem; font-size: .85rem; }
.btn-danger { background: #b3261e; border-color: #b3261e; color: #fff; }

.btn-share { background: var(--share); border-color: var(--share); width: 100%; font-size: 1.1rem; min-height: 54px; }
.btn-whatsapp  { background: #1fa855; border-color: #1fa855; }
.btn-messenger { background: #0a7cff; border-color: #0a7cff; }
.btn-facebook  { background: #1877f2; border-color: #1877f2; }
.btn-telegram  { background: #2a9fd8; border-color: #2a9fd8; }
.btn-x         { background: #0f1419; border-color: #0f1419; }
.btn-line      { background: #05a648; border-color: #05a648; }
.btn-viber     { background: #7360f2; border-color: #7360f2; }

/* ---------- create form ---------- */

.hero { text-align: center; padding: 1.5rem 0 .5rem; }

fieldset { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
legend { font-weight: 750; font-size: 1.1rem; margin-bottom: .75rem; padding: 0; }
.step-no {
    display: inline-grid; place-items: center;
    width: 1.7rem; height: 1.7rem; margin-right: .4rem;
    border-radius: 50%; background: var(--accent); color: #fff; font-size: .9rem;
}

.types { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .types { grid-template-columns: 1fr 1fr; } }

.type-card {
    position: relative;
    display: block;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    cursor: pointer;
    color: var(--ink);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}
.type-card input { position: absolute; left: 1rem; top: 1.15rem; width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.type-card:hover { border-color: #b9c6c1; }
.type-card:has(input:checked) { border-color: var(--accent); background: #eef6f3; }
.type-title { display: block; font-weight: 700; }
.type-desc { display: block; color: var(--muted); font-size: .9rem; }
.type-link { border-style: dashed; }
.type-link::before { content: "⌕"; position: absolute; left: 1rem; top: .8rem; font-size: 1.3rem; color: var(--accent); }

.field { display: block; font-weight: 600; margin-bottom: 1rem; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select, .copy-row input, .inline-form input {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.check { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0 1rem; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--accent); flex: none; }

.geo-fields { background: #f3f7f5; border-radius: 12px; padding: 1rem; }
.geo-fields legend { float: left; width: 100%; font-size: 1rem; }
/* Location only matters for Geo galleries. Browsers without :has() just show it. */
form:has(input[name=type]):not(:has(#type-geo:checked)) .geo-fields { display: none; }

.step-details { transition: opacity .3s ease; }
.step-details.is-hidden { display: none; }

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 140px;
    padding: 1.5rem;
    border: 2px dashed #b9c6c1;
    border-radius: 14px;
    background: #f8faf9;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: #eef6f3; }
.dropzone-text { font-weight: 650; color: var(--muted); }
.dropzone-text::before { content: "＋"; display: block; font-size: 1.8rem; color: var(--accent); }
/* With JS the whole zone is the target; without it the native input stays visible. */
.js .dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.no-js .dropzone-text { display: none; }

.previews {
    list-style: none; margin: .75rem 0; padding: 0;
    display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
}
.previews li {
    position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #e8ecea;
    opacity: 0; transform: scale(.92); transition: opacity .25s ease, transform .25s ease;
}
.previews li.ready { opacity: 1; transform: none; }
.previews img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-name { display: block; padding: .3rem; font-size: .7rem; word-break: break-all; }
.preview-remove {
    position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}

.progress { margin: .75rem 0; }
.progress progress { width: 100%; height: 10px; accent-color: var(--accent); }
.progress-text { display: block; text-align: center; color: var(--muted); font-size: .9rem; }
form.uploading .dropzone, form.uploading .previews { opacity: .5; pointer-events: none; }

.how { text-align: center; padding: 1rem 0; }
.how-list { list-style: none; padding: 0; display: grid; gap: .75rem; counter-reset: how; max-width: 640px; margin: 1rem auto; }
.how-list li { counter-increment: how; background: var(--card); border-radius: 12px; padding: .9rem 1rem; box-shadow: var(--shadow); text-align: left; }
.how-list li::before { content: counter(how); font-weight: 800; color: var(--accent); margin-right: .6rem; }

/* ---------- gallery ---------- */

/* Compact so the photos start as high up the page as possible. Title and
   description share a line when both fit; otherwise the description wraps
   underneath, and only a title wider than the page wraps itself. */
.gallery-head { padding: .5rem 0 .5rem; }
.gh-row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 1rem; row-gap: .15rem; }
.gh-row h1 { flex: 0 1 auto; margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: clamp(1.35rem, 4.5vw, 2rem); }
.gh-desc { flex: 1 1 16rem; margin: 0; color: var(--muted); }
.gallery-head p { margin: .35rem 0 0; }
.gh-row .gh-desc { margin: 0; }
.meta-line { color: var(--muted); font-size: .9rem; }
.owner-bar { background: var(--card); border-radius: 10px; padding: .5rem .8rem; display: inline-block; box-shadow: var(--shadow); }

.grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 4px;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; background: #e3e8e5; } /* square corners */
.tile a { display: block; height: 100%; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, opacity .5s ease; }
.tile a:hover img { transform: scale(1.04); }
/* gallery.js adds .fade-in to the grid itself, so images can never be left hidden
   on a page that doesn't load it. */
.grid.fade-in img:not(.loaded) { opacity: 0; }
.tile-remove { position: absolute; top: 6px; right: 6px; margin: 0; }
.tile-remove button {
    width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(0, 0, 0, .6); color: #fff; font-size: 20px; line-height: 1;
}
.tile-remove button:hover { background: #b3261e; }
/* "Add photos" tile: same square as the photos, first in the grid. */
.tile-add { background: var(--card); box-shadow: inset 0 0 0 2px #b9c6c1; }
.add-form { height: 100%; display: flex; flex-direction: column; margin: 0; }
.add-zone { flex: 1; min-height: 0; border: 0; border-radius: inherit; background: transparent; padding: .5rem; }
.add-zone .dropzone-text { font-size: .95rem; color: var(--accent); }
.add-zone .dropzone-text::before { font-size: 2.2rem; }
.no-js .add-zone input { width: 100%; font-size: .75rem; }
.no-js .add-zone .dropzone-text { display: block; }
.add-submit { margin: 0 .5rem .5rem; }
.js .add-submit { display: none; }
.add-form .progress { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; margin: 0; }
.add-form .progress-text { font-size: .75rem; }
.add-form .error-text { position: absolute; left: .4rem; right: .4rem; bottom: .3rem; margin: 0; font-size: .75rem; text-align: center; }
.add-form.uploading .dropzone-text::before { content: "↑"; animation: rise 1s ease-in-out infinite; }
@keyframes rise { 50% { transform: translateY(-6px); } }

.created { border: 2px solid var(--accent); }
.created h2 { font-size: 1.4rem; }
.created .share { margin: 1rem 0 .5rem; }
.type-fixed { cursor: default; padding-left: 1rem; margin: 0; }
.tile-video a::after {
    content: "▶"; position: absolute; inset: 0; margin: auto; width: 48px; height: 48px;
    display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px;
}

.actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin: 1.25rem 0; }

.share { display: grid; gap: .6rem; }
.copy-row { display: flex; gap: .5rem; align-items: stretch; }
.copy-row input { margin-top: 0; flex: 1; min-width: 0; color: var(--muted); }
.share-more summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .25rem 0; }
.share-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.chip {
    display: inline-block; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line);
    background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.chip:hover { border-color: var(--accent); }
button.chip { font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.share-more .copy-row { margin-top: .6rem; }

/* ---------- access gates, personal links ---------- */

.gate { max-width: 560px; margin: 1.5rem auto; }
.gate .inline-form { flex-wrap: wrap; }
.gate .inline-form input { min-width: 12rem; }
.manual-coords { margin-top: .75rem; }
.manual-coords summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.manual-coords .coords { margin-top: .5rem; }
.invite-form { flex-wrap: wrap; margin: .75rem 0 0; }
.invite-form input { min-width: 12rem; }
.invite-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .4rem; }
.invite-list li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.invite-list span { display: grid; }
.invite-list small { color: var(--muted); }
.invite-list form { margin: 0; }

/* ---------- account ---------- */

.account-forms { display: grid; gap: 0 1rem; }
@media (min-width: 720px) { .account-forms { grid-template-columns: 1fr 1fr; } }
li.result { padding: .4rem .6rem .4rem .4rem; }
.result-link { display: flex; gap: .9rem; align-items: center; flex: 1; min-width: 0; color: var(--ink); text-decoration: none; }
.result-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.result-actions form { margin: 0; }

.success { max-width: 560px; margin-left: auto; margin-right: auto; }
.success .share { text-align: left; margin: 1rem 0; }
.inline-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.inline-form input { margin-top: 0; flex: 1; }

.cta { text-align: center; padding: 1.5rem 0 .5rem; color: var(--muted); }
.danger-zone { border: 1px solid #f2c9c6; }

/* ---------- search ---------- */

.search-form .row { display: flex; gap: .6rem; flex-wrap: wrap; }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.result { display: flex; gap: .9rem; align-items: center; background: var(--card); border-radius: 12px; padding: .6rem; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.result img, .result-ph { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; background: #e3e8e5; }
.result-body { display: grid; }
.result-body span { color: var(--muted); font-size: .875rem; }

/* ---------- lightbox ---------- */

.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(8, 10, 10, .96);
    opacity: 0; transition: opacity .2s ease;
}
.lightbox.visible { opacity: 1; }
.lb-stage { position: absolute; inset: 0 0 56px; display: grid; place-items: center; padding: 8px; overflow: hidden; touch-action: none; }
.lb-media { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; touch-action: none; transition: transform .15s ease; cursor: grab; }
.lb-media.is-zoomed { cursor: grabbing; transition: none; }
.lb-bar {
    position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
    display: flex; align-items: center; gap: .5rem; padding: 0 12px; color: #fff;
}
.lb-count { flex: 1; font-size: .9rem; opacity: .8; }
.lb-btn { color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 999px; padding: .5rem .9rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 64px; border: 0; background: rgba(255, 255, 255, .08); color: #fff;
    font-size: 2rem; cursor: pointer; border-radius: 10px;
}
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
@media (hover: none) { .lb-nav { display: none; } }

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