/* SGS Gallery Core 2.0.7 — whitespace-led card hierarchy */
:root{--sgsc-ink:#111827;--sgsc-muted:#6b7280}
/* Gallery cards: image first, measured typography, subdued utility actions. */
.sg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.sg-card{background:#fff;border:1px solid #e9eaec;border-radius:12px;overflow:hidden;box-shadow:0 2px 4px rgba(0,0,0,.025);position:relative;min-width:0;display:flex;flex-direction:column;transition:box-shadow .18s ease}
.sg-card:hover{box-shadow:0 5px 22px rgba(22,32,49,.07)}
.sg-thumb-link{display:block;width:100%;text-decoration:none;background:#f7f7f7}
.sg-thumb-link .sg-thumb{display:block;box-sizing:border-box;width:100%;height:auto;padding:0;aspect-ratio:3/4;object-fit:contain;object-position:center;background:#f7f7f7}
.sg-thumb--empty{display:flex!important;align-items:center;justify-content:center;font-size:13px;color:var(--sgsc-muted)}
.sg-title{font-size:17px;line-height:1.43;font-weight:700;letter-spacing:-.018em;overflow-wrap:anywhere;margin:20px 15px 4px}
.sg-title a{color:var(--sgsc-ink);text-decoration:none;text-underline-offset:3px}
.sg-title a:hover,.sg-title a:focus-visible{text-decoration:underline}
/* The text area has a stable grid of title + summary rows across each visual row.
   Text stays intact in the DOM; long descriptions are visually summarized to five lines. */
.sgsc-card-text{display:flex;flex-direction:column;min-width:0}
.sg-cmt{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;line-clamp:5;overflow:hidden;min-height:8.5em}
.sg-cmt{font-size:12.5px;color:#57616d;margin:6px 15px 13px;line-height:1.7;overflow-wrap:anywhere}
/* Card metadata: no divider lines. Separate layers through vertical rhythm and typography.
   Each group is a block and may wrap independently when terms multiply. */
.sgsc-card-footer{display:flex;flex-direction:column;align-items:stretch;gap:0;min-width:0;margin:auto 16px 14px}
.sgsc-meta-panel{display:flex;flex-direction:column;align-items:stretch;gap:13px;min-width:0;width:100%}
.sgsc-cats,.wpts-tags{display:flex;flex-wrap:wrap;align-items:center;align-content:flex-start;min-width:0;width:100%;box-sizing:border-box;margin:0;padding:0;border:0}
.sgsc-cats{gap:6px}
.wpts-tags{gap:6px 11px}
.sgsc-cat,.wpts-tag{display:inline-flex;align-items:center;box-sizing:border-box;text-decoration:none;max-width:100%;overflow-wrap:anywhere;transition:background-color .16s ease,color .16s ease}
.sgsc-cat{min-height:25px;padding:4px 10px;border-radius:4px;background:#f0f2f5;color:#344255;font-weight:550;font-size:11.5px;line-height:1.35}
.sgsc-cat:hover,.sgsc-cat:focus-visible{background:#e2e7ed;color:#1f2b3c}
.wpts-tag{padding:1px 0;background:transparent;color:#808995;font-size:12px;font-weight:400;line-height:1.5}
.wpts-tag:before{content:'#';margin-right:2px;color:#a5acb4}
.wpts-tag:hover,.wpts-tag:focus-visible{color:#26354a;text-decoration:underline;text-underline-offset:3px}
/* Independent action row, not a third metadata line and not a heavy CTA. */
.sgsc-card-actions{box-sizing:border-box;display:flex;justify-content:flex-end;align-items:center;width:100%;margin:20px 0 0;padding:0;border:0}
.sgsc-detail-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:38px;max-width:100%;white-space:nowrap;border:0;border-radius:4px;background:transparent;color:#344255;padding:0;cursor:pointer;font:600 12px/1.4 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;letter-spacing:.01em;transition:color .16s ease}
.sgsc-detail-btn:hover{color:#111827}
.sgsc-detail-btn:focus-visible{outline:2px solid #70839c;outline-offset:3px}
.sgsc-detail-arrow{display:inline-flex;align-items:center;justify-content:center;width:27px;height:27px;flex:none;border-radius:50%;background:#243044;color:#fff;font-family:Arial,sans-serif;font-size:14px;font-weight:400;line-height:1;transition:transform .16s ease,background-color .16s ease}
.sgsc-detail-btn:hover .sgsc-detail-arrow{background:#42546c;transform:translateX(2px)}
.sg-ad{display:flex;align-items:center;justify-content:center;min-height:120px;color:#666;font-size:13px}
.sg-pagination{text-align:center;margin:24px 0}
.sg-pagination .page-numbers{display:inline-block;text-decoration:none;padding:6px 10px;margin:2px;color:var(--sgsc-ink);border-radius:7px}
.sg-pagination .page-numbers.current{background:#f3f4f6;font-weight:700}
.sgs-infinite-loader{text-align:center;margin:18px 0;color:#6b7280;font-size:13px}
.sgs-infinite-loader[hidden]{display:none!important}
.sg-cat-index{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:24px}
.sg-cat-list{columns:2;list-style:none;padding:0}
.sg-cat-list a{color:inherit;text-decoration:none;line-height:2.3}
.sg-cat-list a:hover{text-decoration:underline}
.sgsc-controls{display:flex;flex-wrap:wrap;gap:14px 24px;align-items:center;justify-content:space-between;margin:0 0 18px}
.sgsc-search{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0;min-width:0}
.sgsc-search input,.sgsc-search select{height:40px;min-height:40px;box-sizing:border-box;border:1px solid #e0e5eb;border-radius:8px;background:#fff;padding:8px 12px;color:var(--sgsc-ink);font-size:13px;max-width:100%;box-shadow:0 1px 2px rgba(0,0,0,.02)}
.sgsc-search input{width:225px;min-width:155px;max-width:100%}
.sgsc-search select{width:165px;max-width:100%}
.sgsc-search button{min-height:40px;padding:8px 18px;background:#172238;color:#fff;border:1px solid #172238;border-radius:8px;cursor:pointer;font-size:13px;font-weight:650}
.sgsc-search button:hover,.sgsc-search button:focus-visible{background:#35445c}
.sgsc-search-clear{font-size:12px;color:#687586;text-underline-offset:3px;padding:6px 2px}
#sgs-search{scroll-margin-top:110px}
.sg-sortbar{display:flex;gap:10px;align-items:center;font-size:13px;flex-wrap:wrap;min-height:22px}
.sg-sortbar span{font-size:13px;color:var(--sgsc-muted)}
.sg-sortbar a{color:var(--sgsc-ink);text-decoration:none}
.sg-sortbar .is-active{font-weight:700;text-decoration:underline;text-underline-offset:2px}
.sgsc-archive-title{font-size:20px;margin:6px 0 16px}
.sgsc-empty{color:var(--sgsc-muted);font-size:14px}

/* Original fixed minimal header, navigation styling from user's third script */
.sgs-topbar{position:fixed;left:0;right:0;top:0;z-index:100002;background:#fff;color:var(--sgsc-ink);border-bottom:1px solid transparent}
.sgs-topbar__inner{width:100%;max-width:none;margin:0 auto;padding:16px 28px;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:80px;box-sizing:border-box}
.sgs-topbar__brand{display:inline-flex;align-items:center;gap:12px;min-width:0;text-decoration:none;color:inherit}
.sgs-topbar__brand img{height:auto;max-height:46px;width:auto;display:block;flex:none}
.sgs-topbar__title{font-weight:800;font-size:34px;letter-spacing:-.035em;line-height:1.1;white-space:nowrap}
.sgs-header-tagline{font-size:12px;line-height:1.35;color:#4b5563;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:52vw}.sgs-topbar__nav{display:flex;align-items:center;gap:28px;flex:none}
.sgs-topbar .sgs-topbar__nav a.sgs-topbar__link{appearance:none;background:#fff;color:#111827;border:1px solid #e6e6e6;border-radius:100px;padding:7px 13px;line-height:1;display:inline-flex;align-items:center;font-weight:400;box-shadow:none;text-decoration:none;cursor:pointer;font-size:13px}
.sgs-topbar .sgs-topbar__nav a.sgs-topbar__link:hover,.sgs-topbar .sgs-topbar__nav a.sgs-topbar__link:focus-visible{background:#f3f3f3}
.sgs-topbar .sgs-topbar__nav #sgs-catbtn.sgs-topbar__catbtn{appearance:none;background:#111827;color:#fff;border:0;border-radius:8px;padding:8px 12px;line-height:1.2;display:inline-flex;align-items:center;font-weight:600;box-shadow:none;cursor:pointer;font-size:14px}
.sgs-topbar .sgs-topbar__nav #sgs-catbtn.sgs-topbar__catbtn:hover,.sgs-topbar .sgs-topbar__nav #sgs-catbtn.sgs-topbar__catbtn:focus-visible{background:#374151;color:#fff}
body.sgsc-has-header{padding-top:120px}
body.sgsc-modal-open{overflow:hidden}

/* Category button opens a dedicated, compact taxonomy picker. It contains no search fields. */
.sgs-overlay,.sgsc-modal{position:fixed;inset:0;z-index:2147483000}
.sgs-overlay[hidden],.sgsc-modal[hidden]{display:none!important}
.sgs-overlay__bg,.sgsc-modal-backdrop{position:absolute;inset:0;background:rgba(17,24,39,.52)}
.sgs-overlay__panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);box-sizing:border-box;background:#fff;border-radius:15px;box-shadow:0 25px 70px rgba(0,0,0,.22);width:min(860px,calc(100vw - 40px));max-height:min(720px,calc(100dvh - 72px));overflow-y:auto;overscroll-behavior:contain;padding:26px 28px 28px}
.sgs-overlay__head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:0 0 20px;margin:0 0 22px;border-bottom:1px solid #e9edf1}
.sgs-overlay__eyebrow{font-size:10px;font-weight:700;letter-spacing:.13em;color:#8491a2;margin:0 0 8px}
.sgs-overlay__title{font-size:21px;font-weight:750;letter-spacing:-.025em;line-height:1.4;margin:0;color:#172238}
.sgs-overlay__intro{font-size:12px;color:#758091;margin:7px 0 0}
.sgs-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:28px;row-gap:16px}
.sgs-sec{min-width:0}
.sgs-sec + .sgs-sec{border-left:1px solid #edf0f3;padding-left:28px}
.sgs-sec h3{font-size:15px;font-weight:750;line-height:1.5;margin:0 0 10px;color:#172238}
.sgs-list{list-style:none;margin:0;padding:0}
.sgs-list li{margin:0 0 3px}
.sgs-list a{display:flex;justify-content:space-between;align-items:center;gap:12px;text-decoration:none;color:#223044;padding:10px 12px;border-radius:8px;font-size:13px;font-weight:550;transition:background-color .15s ease}
.sgs-list a:hover,.sgs-list a:focus-visible{background:#f1f4f8;color:#101a2a}
.sgs-count{font-size:11px;color:#6e7c8c;background:#f1f3f6;padding:3px 8px;border-radius:20px;flex:none}
.sgs-empty-tax{color:var(--sgsc-muted);font-size:12px;padding:12px;background:#f8f9fb;border-radius:8px}
.sgs-overlay__close,.sgsc-modal-close{display:flex;flex:none;align-items:center;justify-content:center;background:#f3f5f8;color:#35445c;border:1px solid #e5e9ef;border-radius:9px;width:34px;height:34px;cursor:pointer;font-size:22px;line-height:1}
.sgs-overlay__close:hover,.sgsc-modal-close:hover{background:#e8edf3}
/* Detail pop-up: only verified optional fields are output */
.sgsc-modal-panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);box-sizing:border-box;width:min(560px,calc(100vw - 40px));max-height:calc(100dvh - 70px);overflow:auto;background:#fff;border-radius:14px;padding:24px;box-shadow:0 12px 30px rgba(0,0,0,.18)}
.sgsc-modal-close{margin:0 0 4px auto}.sgsc-modal-title{font-size:20px;margin:4px 0 22px}
.sgsc-specs{margin:0;display:grid;gap:16px}
.sgsc-specs div{padding-bottom:14px;border-bottom:1px solid #ededed}
.sgsc-specs div:last-child{border-bottom:0;padding-bottom:0}
.sgsc-specs dt{font-weight:700;font-size:13px;color:#6b7280;margin-bottom:7px}
.sgsc-specs dd{margin:0;line-height:1.8;color:var(--sgsc-ink);font-size:14px;overflow-wrap:anywhere}

/* Original mobile bottom navigation / back-to-top, without favorites */
#sgs-bottomnav{position:fixed;left:0;right:0;bottom:0;z-index:100000;background:#fff;border-top:1px solid #e5e7eb;padding:8px 10px calc(8px + env(safe-area-inset-bottom));box-shadow:0 -6px 12px rgba(0,0,0,.05);display:none}
#sgs-bottomnav .wrap{max-width:1000px;margin:0 auto;display:flex;align-items:center;justify-content:space-around;gap:8px}
#sgs-bottomnav .item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-decoration:none;color:#111827;background:transparent;border:0;padding:6px 8px;font-size:12px;line-height:1;cursor:pointer}
#sgs-bottomnav .icon{font-size:24px;line-height:1;display:block;height:23px}
#sgs-bottomnav .label{font-size:12px}
#sgs-backtotop{position:fixed;right:14px;bottom:22px;width:40px;height:40px;display:none;align-items:center;justify-content:center;border-radius:9999px;border:1px solid #e5e7eb;background:#fff;box-shadow:0 6px 16px rgba(0,0,0,.12);z-index:100001;font-size:21px;cursor:pointer;color:#111827}
#sgs-backtotop.is-visible{display:flex}
@media(max-width:1100px){
  .sgsc-controls{align-items:flex-start}
  .sgsc-search{flex:1 1 100%}
  .sg-sortbar{margin-top:0}
}
@media(max-width:820px){
  body.sgsc-has-header{padding-top:70px;padding-bottom:calc(62px + env(safe-area-inset-bottom))}
  .sgs-topbar__inner{height:54px;min-height:54px;padding:8px 12px}
  .sgs-topbar__brand{margin:0 auto}
  .sgs-topbar__brand img{max-height:40px}
  .sgs-topbar__title{font-size:26px}
  .sgs-header-tagline{display:none}
  .sgs-topbar__nav{display:none}
  #sgs-bottomnav{display:block}
  #sgs-backtotop{bottom:calc(78px + env(safe-area-inset-bottom))}
  .sgsc-search input{flex:1 1 190px}
  .sgsc-search select{flex:1 1 145px}
  .sgs-overlay__panel{max-height:calc(100dvh - 44px)}
}
@media(max-width:540px){
  .sg-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr))}
  .sgsc-controls{gap:12px}
  .sgsc-search{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;width:100%}
  .sgsc-search input{grid-column:1/-1;width:100%;min-width:0}
  .sgsc-search select{width:100%;min-width:0}
  .sgsc-search button{grid-column:1/-1}
  .sgsc-search-clear{grid-column:1/-1;align-self:center;justify-self:start}
  .sgs-overlay__panel{width:calc(100vw - 24px);padding:20px;max-height:calc(100dvh - 32px)}
  .sgs-grid{grid-template-columns:1fr;gap:20px}
  .sgs-sec + .sgs-sec{border-left:0;border-top:1px solid #edf0f3;padding:16px 0 0}
  .sgs-overlay__title{font-size:18px}
  .sgs-overlay__intro{font-size:11px}
}

/* Card row alignment: JS measures natural term-row heights for each CSS-grid line.
   CSS handles the first paint; no fixed limit on the number of category/tag chips. */
.sgsc-cats,.wpts-tags{align-content:flex-start}
.sgsc-card-actions{margin-top:18px;min-height:38px}
@media (prefers-reduced-motion:reduce){.sg-card{transition:none}}
