/* Fun Palaces photo library - brand: red #E81902, white, black, Yellix. */

@font-face { font-family: "Yellix"; src: url("/fonts/Yellix-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Yellix"; src: url("/fonts/Yellix-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Yellix"; src: url("/fonts/Yellix-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --red: #e81902;
  --red-dark: #b81400;
  --tint: #fce7e4;
  --ink: #000;
  --grey: #5c5c5c;
  --line: #e6e0df;
  --paper: #fff;
  --radius: 14px;
  --font: "Yellix", Futura, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top { background: var(--red); color: #fff; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 18px 24px 26px; }
.bar { display: flex; align-items: center; gap: 16px; }
.bar .logo { height: 34px; width: auto; display: block; }
.bar .title { font-weight: 900; font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.bar .spacer { flex: 1; }
.menu-btn { background: transparent; border: 2px solid #fff; color: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 700; }
.menu-btn:hover { background: #fff; color: var(--red); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); min-width: 220px; padding: 8px; z-index: 30; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--tint); }
.menu-list .who { padding: 8px 12px; color: var(--grey); font-size: 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.search { margin-top: 22px; display: flex; gap: 0; background: #fff; border-radius: 999px; padding: 6px 6px 6px 22px; align-items: center; max-width: 900px; }
.search input { flex: 1; border: 0; outline: none; font-size: 19px; padding: 10px 0; min-width: 0; background: transparent; }
.search button { border: 0; background: var(--ink); color: #fff; font-weight: 700; padding: 12px 22px; border-radius: 999px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.search button:hover { background: var(--red-dark); }
.pennant { display: inline-block; width: 22px; height: 14px; background: currentColor; clip-path: polygon(0 0, 100% 38%, 0 100%); transform: rotate(-6deg); }
.ideas { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.ideas span { opacity: .9; margin-right: 4px; }
.ideas button { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.ideas button:hover { background: #fff; color: var(--red); }

/* ---------- filters ---------- */
.filters { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.filters-inner { max-width: 1400px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select { appearance: none; border: 2px solid var(--line); border-radius: 999px; padding: 7px 34px 7px 14px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; cursor: pointer; max-width: 230px; }
.filters select.on { border-color: var(--red); background-color: var(--tint); font-weight: 700; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; font-weight: 700; }
.seg-label { font-size: 14px; color: var(--grey); margin-right: -4px; }
.clear { background: none; border: 0; color: var(--red); font-weight: 700; cursor: pointer; text-decoration: underline; }

/* ---------- results ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 18px 24px 60px; }
.summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; color: var(--grey); }
.summary h2 { margin: 0; color: var(--ink); font-weight: 900; font-size: 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { position: relative; border: 0; padding: 0; background: var(--tint); border-radius: var(--radius); overflow: hidden; cursor: pointer; aspect-ratio: 3 / 2; display: block; width: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.tile:hover img { transform: scale(1.03); }
.tile .cap { position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px; color: #fff; text-align: left; font-size: 13px; line-height: 1.3; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transition: opacity .2s; }
.tile:hover .cap, .tile:focus-visible .cap, .tile .cap.shown { opacity: 1; }
.tile .cap.shown { font-size: 16px; font-weight: 700; }
.tile .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.badge { font-size: 12px; font-weight: 700; background: #fff; color: var(--ink); border-radius: 999px; padding: 2px 9px; }
.badge.warn { background: var(--ink); color: #fff; }
.badge.red { background: var(--red); color: #fff; }
.more { display: block; margin: 28px auto 0; }
.empty { text-align: center; padding: 70px 20px; color: var(--grey); }
.empty strong { display: block; color: var(--ink); font-size: 22px; font-weight: 900; margin-bottom: 6px; }

.btn { border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 18px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- photo detail ---------- */
dialog.photo { border: 0; padding: 0; border-radius: 18px; width: min(1200px, 96vw); max-height: 94vh; overflow: hidden; }
dialog.photo::backdrop { background: rgba(0,0,0,.75); }
.photo-wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); max-height: 94vh; }
.photo-img { background: #111; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.photo-img img { max-width: 100%; max-height: 94vh; display: block; }
.photo-info { padding: 22px 24px; overflow-y: auto; max-height: 94vh; }
.photo-info h2 { margin: 0 32px 6px 0; font-weight: 900; font-size: 22px; line-height: 1.2; }
.photo-info .meta { color: var(--grey); font-size: 14px; margin-bottom: 14px; }
.photo-info h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--red); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.photo-info h3::before { content: ""; width: 14px; height: 9px; background: var(--red); clip-path: polygon(0 0, 100% 38%, 0 100%); }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; border: 0; width: 38px; height: 38px; border-radius: 50%; background: #fff; font-size: 22px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.9); font-size: 22px; cursor: pointer; z-index: 2; }
.nav.prev { left: 12px; }
.nav.next { right: calc(min(1200px, 96vw) * 0.385 + 12px); }
.downloads { display: grid; gap: 8px; }
.download { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.download:hover { border-color: var(--red); background: var(--tint); }
.download b { display: block; }
.download small { color: var(--grey); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--red); color: var(--red); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 0; }
.facts dt { color: var(--grey); }
.facts dd { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.path { font-size: 13px; color: var(--grey); word-break: break-word; }
.consent-ok_public { background: #fff; border: 2px solid var(--ink); }
.admin-box { background: var(--tint); border-radius: 12px; padding: 12px 14px; margin-top: 10px; display: grid; gap: 8px; font-size: 14px; }
.admin-box label { display: grid; gap: 4px; }
.admin-box select, .admin-box input, .admin-box textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }

/* ---------- forms (sign in / admin) ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--red); padding: 24px 16px; }
.auth-card { background: #fff; border-radius: 22px; padding: 34px 30px; width: min(440px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.auth-card .logo { height: 54px; display: block; margin-bottom: 18px; }
.auth-card h1 { margin: 0 0 6px; font-weight: 900; font-size: 28px; }
.auth-card p { margin: 0 0 18px; color: var(--grey); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; }
.field input { border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; }
.field input:focus { border-color: var(--red); outline: none; }
.auth-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 17px; }
.msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--tint); color: var(--ink); }
.small-print { font-size: 13px; color: var(--grey); margin-top: 16px; }

.panel { border: 2px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 10px; font-weight: 900; font-size: 20px; }
table.users { width: 100%; border-collapse: collapse; font-size: 15px; }
table.users th, table.users td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users th { color: var(--grey); font-weight: 700; font-size: 13px; }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { flex: 1; border: 2px solid var(--red); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form input, .inline-form select { border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat { display: inline-block; margin-right: 20px; }
.stat b { font-size: 26px; font-weight: 900; display: block; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 100; font-size: 15px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .photo-wrap { grid-template-columns: 1fr; overflow-y: auto; }
  .photo-info { max-height: none; overflow: visible; }
  .photo-img img { max-height: 60vh; }
  .nav.next { right: 12px; }
  .nav { top: 30vh; }
}
.filter-toggle { display: none; }
@media (max-width: 600px) {
  .filters { position: static; }
  .filter-toggle { display: flex; align-items: center; gap: 8px; margin: 12px 16px; border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 7px 16px; font-weight: 700; cursor: pointer; }
  .filter-toggle.active { background: var(--red); border-color: var(--red); color: #fff; }
  .filters-inner { display: none; padding-top: 0; }
  .filters.open .filters-inner { display: flex; }
  .top-inner, .filters-inner, main { padding-left: 16px; padding-right: 16px; }
  .bar .title { font-size: 17px; }
  .bar .logo { height: 26px; }
  .search input { font-size: 17px; }
  .search button .label { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .filters select { max-width: 46vw; }
}
@media (prefers-reduced-motion: reduce) { .tile img, .tile .cap { transition: none; } }
