/* Separate the dialog heading from the full-width search and scrolling tree. */
.folder-dialog{box-sizing:border-box;width:min(420px,calc(100vw - 32px));max-height:calc(100svh - 32px);padding:16px;overflow:hidden}
.folder-dialog[open]{display:flex;flex-direction:column;gap:12px}
.folder-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}
.folder-dialog-heading h2{margin:0;font:22px/1.3 Georgia,serif}
.folder-dialog-heading>button{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;padding:0;border:1px solid #aab49b;border-radius:50%;background:transparent;color:inherit;font:27px/1 Arial,sans-serif;cursor:pointer}
.folder-dialog .folder-panel{position:static;box-sizing:border-box;width:100%;min-height:0;max-height:none;overflow:auto;padding:3px;scrollbar-gutter:stable}
.folder-dialog input{box-sizing:border-box;min-width:0}
.folder-dialog .tree-row{min-width:0}.folder-dialog .tree-row a{min-width:0}
.folder-dialog :focus-visible{outline:2px solid #93734a;outline-offset:2px}
@media(max-width:900px){
 .folder-dialog .folder-panel input{font-size:16px;min-height:44px}
 .folder-dialog .tree-row button{width:36px;min-height:44px}
 .folder-dialog .tree-row a{display:flex;align-items:center;min-height:44px}
 main :is(input:not([type=checkbox]):not([type=radio]),textarea,select),.community-dialog :is(input:not([type=checkbox]):not([type=radio]),textarea,select),.photo-admin-dialog :is(input:not([type=checkbox]):not([type=radio]),textarea,select){font-size:16px}
 .photo-context-menu :is(a,button,summary){min-height:44px}
}
@media(max-width:760px){
 .site-header .header-tools :is(#menu,#language){width:44px;height:44px;min-width:44px}
 .gallery-tabs a{box-sizing:border-box;min-height:44px;display:flex;align-items:center}
 .viewer-arrow{position:relative}.viewer-arrow::after{content:'';position:absolute;inset:-5px -10px}
}

/* Dialog headings must remain readable in the high-contrast preference. */
body.a11y-contrast :is(.folder-dialog,.photo-admin-dialog,.community-dialog,.photo-context-menu){background:#111;color:#fff;border-color:#fff}
body.a11y-contrast :is(.folder-dialog,.photo-admin-dialog,.community-dialog) :is(input,select,textarea){background:#111;color:#fff;border-color:#fff}
body.a11y-contrast .photo-context-menu :is(a,button,summary){background:#111;color:#ffed82}

@media(max-width:380px){.gallery-toolbar{gap:4px}.gallery-tabs{gap:3px}.gallery-tabs a{padding:10px 8px;font-size:12px}}

/* One mobile navigation strip leaves the space above the photograph clear. */
.mobile-gallery-navigation[hidden]{display:none}
@media(max-width:1366px){
 .gallery-toolbar{justify-content:flex-start;flex-wrap:nowrap;gap:12px;margin-bottom:12px}
 .gallery-tabs{flex-shrink:0;gap:4px}.gallery-tabs a{padding:10px 5px;white-space:nowrap}
 .mobile-gallery-navigation{display:flex;align-items:center;gap:3px;flex-shrink:0}
 .mobile-gallery-navigation .album-neighbors{display:flex;flex-wrap:nowrap;gap:3px;margin:0}
 .mobile-gallery-navigation [hidden]{display:none}
 .mobile-gallery-navigation.mobile-photo-navigation #album-up{display:none}
 .mobile-gallery-navigation .mobile-compact-control{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;min-width:44px;height:44px;padding:8px!important;margin:0;border-radius:6px}
 .mobile-gallery-navigation .mobile-control-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .mobile-gallery-navigation .mobile-control-icon{display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
 .mobile-gallery-navigation #album-up{margin:0}
 .mobile-gallery-navigation>button{border:1px solid #b6b9a9;background:transparent;color:inherit}
 #photo-viewer #photo-filename,#photo-viewer #viewer-count{display:none}
 #photo-viewer .viewer-top{display:flex;min-height:0;margin-bottom:8px;justify-content:flex-end}
 #photo-viewer .viewer-name{min-height:0}
 #photo-viewer.mobile-no-metadata .viewer-top{display:none}
}
@media(max-width:760px){.mobile-gallery-navigation .mobile-compact-control{width:34px;min-width:34px;padding:4px!important}}
@media(max-width:380px){
 .gallery-toolbar{gap:8px}.gallery-tabs{gap:3px}.gallery-tabs a{padding:10px 4px;font-size:11px}
 .mobile-gallery-navigation,.mobile-gallery-navigation .album-neighbors{gap:2px}
 .mobile-gallery-navigation .mobile-compact-control{width:32px;min-width:32px;padding:4px!important}
}
@media(max-width:350px){
 .gallery-tabs a{padding:10px 2px;font-size:10px}
 .mobile-gallery-navigation,.mobile-gallery-navigation .album-neighbors{gap:0}
 .mobile-gallery-navigation .mobile-compact-control{width:30px;min-width:30px;padding:2px!important}
}

/* Clip viewport-fixed scenery to its homepage section, including mobile Safari. */
body[data-page="home"] :is(.photo-hero,.hero){clip-path:inset(0)}
body[data-page="home"] .photo-backdrop{position:fixed;inset:-12px;height:calc(100lvh + 24px);pointer-events:none}
body[data-page="home"] .photo-hero::after{position:fixed;inset:0;height:100lvh;pointer-events:none}
body[data-page="home"] .hero :is(.ambient,video,.shade){position:fixed;inset:0;width:100%;height:100lvh;padding:0;pointer-events:none}

/* Give the ordinary photograph the available viewport, with its actions in view. */
@media(max-width:1366px){
 body.gallery-photo-focus .site-header{height:auto;min-height:64px;padding:8px 16px;grid-template-columns:minmax(0,1fr) auto;gap:8px}
 body.gallery-photo-focus .site-header .brand{grid-column:1;grid-row:1;max-width:100%;gap:8px;min-width:0}
 body.gallery-photo-focus .site-header .brand>span{min-width:0}
 body.gallery-photo-focus .site-header .brand strong{font-size:20px;white-space:normal}
 body.gallery-photo-focus .site-header .brand small{font-size:8px}
 body.gallery-photo-focus .site-header .header-tools{grid-column:2;grid-row:1;gap:6px}
 body.gallery-photo-focus .site-header .header-tools :is(#menu,#language){width:44px;min-width:44px;height:44px}
 body.gallery-photo-focus .site-header #menu{display:block;border:1px solid #cbb68b66;border-radius:50%;padding:10px;background:transparent}
 body.gallery-photo-focus .site-header>#nav{display:none;position:absolute;top:100%;inset-inline:0;max-height:calc(100svh - 76px);overflow:auto;grid-column:auto;grid-row:auto;padding:16px 22px;gap:16px;background:#232923;border-top:1px solid #ffffff25;box-shadow:0 20px 30px #0004}
 body.gallery-photo-focus .site-header>#nav.open{display:flex;flex-direction:column;align-items:stretch}
 body.gallery-photo-focus #nav .site-links{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;margin:0;border:0;padding:0;gap:8px}
 body.gallery-photo-focus #nav .header-counters{display:flex;justify-content:center;flex-wrap:wrap;gap:8px}
 body.gallery-photo-focus .mobile-header-actions{display:flex;flex-direction:column;gap:8px;border-top:1px solid #cbb68b40;padding-top:12px}
 body.gallery-photo-focus .mobile-header-actions :is(a,button){display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:8px 0;border:0;border-radius:0;background:transparent;color:#e4c48e;text-align:start;font:14px/1.4 Arial,sans-serif;text-decoration:none}
 body.gallery-photo-focus .mobile-header-actions [hidden]{display:none}
 body.gallery-photo-focus .mobile-header-actions svg{width:22px;height:22px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
 body.gallery-photo-focus .mobile-action-label{display:inline}
 body.gallery-photo-focus .page-wrap{padding:8px 16px 36px}
 body.gallery-photo-focus .gallery-layout{display:block}
 body.gallery-photo-focus .folder-sidebar,body.gallery-photo-focus .gallery-filters,body.gallery-photo-focus .filter-chips{display:none}
 body.gallery-photo-focus .gallery-toolbar{margin-bottom:6px;min-height:44px}
 body.gallery-photo-focus .album-breadcrumbs{flex-wrap:nowrap;white-space:nowrap;overflow:auto;min-height:20px;gap:8px;font-size:11px;scrollbar-width:none}
 body.gallery-photo-focus .album-breadcrumbs>*{flex-shrink:0}
 body.gallery-photo-focus #photo-viewer{margin-top:6px}
 body.gallery-photo-focus .viewer-stage{min-height:0}
 body.gallery-photo-focus .viewer-stage>img{height:var(--photo-frame-height,calc(100svh - 200px));min-height:0;max-height:none;object-fit:contain}
 body.gallery-photo-focus #photo-viewer .viewer-actions{margin:8px 0 0;min-height:44px;gap:8px}
 body.gallery-photo-focus .viewer-actions .page-button{min-height:44px}
}
@media(max-width:760px){body.gallery-photo-focus .site-header .brand strong{font-size:17px}.gallery-photo-focus .site-header .photo-logo{width:22px}.gallery-photo-focus .site-header .candle{width:21px;height:40px}}

/* Reserve neighboring-album slots while their destinations load asynchronously. */
@media(max-width:1366px){
 .mobile-gallery-navigation{--album-neighbors-width:91px}
 body.gallery-photo-focus .mobile-gallery-navigation .album-neighbors{min-width:var(--album-neighbors-width);min-height:44px;flex-shrink:0}
 body.gallery-photo-focus .mobile-gallery-navigation .album-neighbors[hidden]{display:flex!important;visibility:hidden}
}
@media(max-width:760px){.mobile-gallery-navigation{--album-neighbors-width:71px}}
@media(max-width:380px){.mobile-gallery-navigation{--album-neighbors-width:66px}}
@media(max-width:350px){.mobile-gallery-navigation{--album-neighbors-width:60px}}

/* Reveal short captions only after measuring the complete single-row toolbar. */
.mobile-control-short{display:none}
@media(max-width:1366px){
 .mobile-gallery-navigation .mobile-show-label{width:auto;gap:6px;padding-inline:9px!important}
 .mobile-gallery-navigation .mobile-show-label .mobile-control-short{display:inline;white-space:nowrap;font-size:12px;line-height:1.2}
 .mobile-gallery-navigation .mobile-show-label .mobile-control-icon{width:20px;height:20px;flex-shrink:0}
}
