/* App styles. Branding comes from brand/ (vendored from https://brand.letsimpl.fyi, the source of truth):
   tokens, fonts, base and ls- components load first. This file defines no colour, font or size of its own,
   only layout, built from brand tokens. Kept small on purpose: the photos are the interface. */
body { margin: 0; background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }
button, input { font: inherit; }
.page { max-width: 960px; margin: 0 auto; padding: var(--space-3) var(--pad, var(--space-4)) var(--space-6); }
.meta, .status { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--text-secondary); }
.page h2 { margin: var(--space-5) 0 var(--space-2); padding: 0; border: 0; color: var(--muted); font-size: var(--text-secondary); font-weight: 700; }
button.quiet { min-height: var(--touch-min); padding: 0 var(--space-1); color: inherit; background: none; border: 0; font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
button.quiet:disabled { color: var(--muted); }

/* App bar */
.app-header { position: sticky; top: 0; z-index: 5; background: var(--page); border-bottom: var(--rule); padding-top: env(safe-area-inset-top); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); max-width: 960px; min-height: 56px; margin: 0 auto; padding: var(--space-1) var(--pad, var(--space-4)); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--touch-preferred); color: var(--ink); text-decoration: none; font-size: 1.25rem; font-weight: 700; }
.mark { display: block; }
:root[data-theme="dark"] .mark--light, :root:not([data-theme="dark"]) .mark--dark { display: none; }
.theme { min-width: var(--touch-preferred); padding: 0; }

/* Search field: one row, label above */
.ls-field { margin-bottom: var(--space-3); }
.field-row { display: flex; gap: var(--space-2); }
.field-row .ls-input { flex: 1; min-width: 0; }
.suggest { margin: var(--space-1) 0 0; padding: 0; list-style: none; border: var(--rule); }
.suggest li { min-height: var(--touch-preferred); padding: var(--space-3) var(--space-4); overflow-wrap: anywhere; cursor: pointer; }
.suggest li + li { border-top: 1px solid var(--line); }
.suggest li.active { color: var(--page); background: var(--ink); }

/* Home */
.potd { display: block; position: relative; margin: 0 0 var(--space-4); color: var(--ink); text-decoration: none; border: var(--rule); }
.potd img { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: cover; }
.potd-cap { display: flex; flex-direction: column; padding: var(--space-3); overflow-wrap: anywhere; }
.potd-cap .meta { margin: 0; }
.ls-tags { margin: 0 0 var(--space-3); }
.ls-tag { min-height: var(--touch-min); display: inline-flex; align-items: center; color: inherit; background: none; font: inherit; font-size: var(--text-secondary); text-decoration: none; cursor: pointer; }
.more-cats > summary, .related > summary { min-height: var(--touch-preferred); display: flex; align-items: center; color: var(--muted); font-weight: 700; cursor: pointer; }
.recent { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.recent a { display: block; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }

/* Gallery */
.titlebar { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.titlebar h1 { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; font-size: var(--text-section); line-height: var(--leading-section); overflow-wrap: anywhere; }
.back { display: inline-flex; align-items: center; justify-content: center; min-width: var(--touch-preferred); min-height: var(--touch-preferred); margin-left: calc(var(--space-2) * -1); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.segmented { display: inline-flex; }
.segmented .ls-btn + .ls-btn { margin-left: -2px; }
.segmented .ls-btn[aria-pressed="true"], .actions .ls-btn[aria-expanded="true"] { color: var(--page); background: var(--ink); }
.segmented.wrap { flex-wrap: wrap; margin-bottom: var(--space-3); }
.segmented.wrap .ls-btn { margin: 0 -2px -2px 0; }
.refine { margin: 0 0 var(--space-3); padding: var(--space-3); border: var(--rule); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.chip-x { display: inline-flex; align-items: center; justify-content: center; min-width: var(--touch-min); min-height: var(--touch-min); margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) calc(var(--space-2) * -1) 0; padding: 0; color: inherit; background: none; border: 0; cursor: pointer; }
.refine .segmented { margin-bottom: var(--space-3); }
.check { display: flex; align-items: center; gap: var(--space-2); min-height: var(--touch-preferred); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 calc(var(--pad, var(--space-4)) * -1); }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); margin: 0; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.tile { display: block; position: relative; aspect-ratio: 1; min-width: 0; min-height: 0; padding: 0; background: var(--line); border: 0; overflow: hidden; cursor: pointer; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile .badge { position: absolute; left: 0; bottom: 0; display: inline-flex; padding: var(--space-1); color: var(--page); background: var(--ink); }
.tile .blank { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); }
.slide video, .slide audio { max-width: 100%; max-height: 100%; }
.slide video { width: 100%; }
.media-card { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); max-width: 100%; max-height: 100%; padding: var(--space-4); overflow-wrap: anywhere; }
.media-card img { max-width: 100%; max-height: 50vh; object-fit: contain; }
.media-card audio { width: 100%; }
.more { display: flex; justify-content: center; padding: var(--space-4) 0; }
.support-card { margin-top: var(--space-5); }
.support-card h2 { margin: 0 0 var(--space-2); padding: 0; border: 0; color: var(--ink); }
.foot { border-top: var(--rule); color: var(--muted); font-size: var(--text-secondary); }
.foot p { max-width: var(--measure); margin: 0 0 var(--space-2); }

/* Viewer: a full-screen modal dialog with a sideways scroll-snap track, so swiping is native */
.viewer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ink); background: var(--page); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: var(--page); }
.viewer-bar { display: flex; align-items: center; gap: var(--space-2); padding: env(safe-area-inset-top) var(--space-2) 0; }
.viewer-bar .counter { margin-right: auto; font-weight: 700; }
.viewer-bar .nav { display: none; }
@media (min-width: 600px), (hover: hover) and (pointer: fine) { .viewer-bar .nav { display: inline-flex; } }
.track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior: contain; touch-action: pan-x pinch-zoom; scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; scroll-snap-stop: always; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-caption { max-height: 40%; overflow-y: auto; padding: var(--space-2) var(--space-4) calc(var(--space-2) + env(safe-area-inset-bottom)); }
.viewer-caption h2 { margin: 0 0 var(--space-1); padding: 0; border: 0; color: var(--ink); font-size: var(--text-secondary); overflow-wrap: anywhere; }
.viewer-caption .meta { margin-bottom: var(--space-2); }
.details { margin: var(--space-2) 0 0; font-size: var(--text-secondary); }
.details dt { font-weight: 700; }
.details dd { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }

/* Donation sheet: the brand's ls-sheet; only its contents are styled here */
.support > p { margin: var(--space-2) 0 var(--space-3); }
.upi-id { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-3) 0; font-size: var(--text-secondary); overflow-wrap: anywhere; }
.upi-id .ls-btn { flex: none; }
.other-apps summary { min-height: var(--touch-min); display: flex; align-items: center; color: var(--muted); cursor: pointer; }
.qr { max-width: 240px; margin: var(--space-3) auto; padding: var(--space-3); background: #FFFFFF; border: var(--rule); } /* QR codes stay black on white in both themes so cameras can read them */
.qr:empty { display: none; }
.qr canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
@media (hover: none) { .qr { display: none; } } /* on a phone the button opens the UPI app; the code is for paying from another device */

.toast-wrap { position: fixed; z-index: 20; left: 0; right: 0; bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.ls-sheet__head h2, .support-card h2 { flex: 1; min-width: 0; font-size: var(--text-body); text-wrap: balance; }
