/* CR-04 (brief 3.7.7): the /portfolio/ gallery and its lightbox. Page-scoped; uses the main.css tokens only.
   Tiles keep a fixed 4:5 frame with width and height on every <img>, so nothing shifts as images load. */
.ss-gal { scroll-margin-top: 96px; }
.ss-gal__nav { margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.ss-gal__tabs, .ss-gal__chips, .ss-gal__pages ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ss-gal__tab, .ss-gal__chip, .ss-gal__pg { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; color: var(--green-900); text-decoration: none; }
.ss-gal__tab[aria-current], .ss-gal__pg[aria-current] { background: var(--green-900); color: var(--cream-50); }
.ss-gal__chips { margin-top: 14px; }
.ss-gal__chip { border: 1px solid var(--line); letter-spacing: .08em; text-transform: none; font-size: 14px; }
.ss-gal__chip[aria-current] { border-color: var(--green-900); background: var(--green-900); color: var(--cream-50); }
.ss-gal__intro { margin: 18px 0 4px; max-width: 760px; }
.ss-gal__status { margin: 0 0 18px; }
.ss-gal__status:focus { outline: none; }
.ss-gal__status:focus-visible { outline: 2px solid var(--green-900); outline-offset: 4px; }
.ss-gal__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 20px); }
@media (min-width: 820px) { .ss-gal__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .ss-gal__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ss-gal__link { position: relative; display: block; }
.ss-gal__link:hover { opacity: 1; }
.ss-gal__frame { aspect-ratio: 4 / 5; }
.ss-gal__marks { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.ss-gal__mark { background: var(--cream-50); color: var(--green-900); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; font-weight: 600; }
.ss-gal__empty { padding: 24px 0; }
.ss-gal__pages { margin-top: 28px; }
.ss-gal__more { margin-top: 28px; }
.ss-gal__more[hidden], .ss-gal__pages[hidden] { display: none; }

/* Lightbox: the drawer pattern (main.css .ss-drawer), written for the gallery and sharing no state with it. */
.ss-lb { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.ss-lb[hidden] { display: none; }
.ss-lb__backdrop { position: absolute; inset: 0; background: rgba(35, 50, 41, .92); }
.ss-lb__panel { position: relative; width: min(1180px, 100%); max-height: 100%; overflow: auto; background: var(--cream-50); padding: clamp(16px, 3vw, 36px); display: grid; gap: 16px; }
.ss-lb__panel:focus { outline: none; }
.ss-lb__close { justify-self: end; width: auto; padding: 0 16px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.ss-lb__fig { margin: 0; display: grid; gap: 12px; }
.ss-lb__img { display: flex; justify-content: center; background: var(--stone-200); }
.ss-lb__img img { max-width: 100%; max-height: 70vh; width: auto; height: auto; object-fit: contain; }
.ss-lb__cap { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.15; margin: 0; }
.ss-lb__pos { margin: 4px 0 0; }
.ss-lb__nav { display: flex; gap: 24px; }
.ss-lb__nav [hidden], .ss-lb__project[hidden], .ss-lb__sim[hidden] { display: none; }
.ss-lb__nav .ss-link { min-height: 44px; background: none; border: 0; cursor: pointer; font: inherit; }
.ss-lb__sim ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .ss-lb__sim ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ss-lb__sim button { display: block; width: 100%; padding: 0; border: 0; background: var(--stone-200); cursor: pointer; aspect-ratio: 1 / 1; overflow: hidden; }
.ss-lb__sim img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (prefers-reduced-motion: no-preference) { .ss-gal__link .ss-frame__img { transition: transform 1s var(--ease); } .ss-gal__link:hover .ss-frame__img { transform: scale(1.04); } }
