/* =========================================================
   FULL SHEET VIEW — category pages (masonry sheet gallery)
   Loaded AFTER style.css, which supplies the tokens, the type
   and the base reset. This file adds only what the galleries need.
   ========================================================= */

html:has(.page-gallery){ scroll-padding-top:76px; }

.page-gallery{
  --gap: clamp(10px, 1.1vw, 18px);
  --gpad: clamp(16px, 3.4vw, 60px);
  --r-sheet: 14px;
}

/* ---------- top bar ----------------------------------------------------- */
.gnav{
  position:sticky; top:0; z-index:60;
  display:flex; align-items:center; justify-content:space-between; gap:18px;
  padding:14px var(--gpad);
  background:rgba(245,240,232,.82);
  backdrop-filter:saturate(1.4) blur(14px);
  -webkit-backdrop-filter:saturate(1.4) blur(14px);
  border-bottom:1px solid var(--line-soft);
}
.gnav__home{
  display:inline-flex; align-items:center; gap:10px; flex:none;
  font-size:.74rem; font-weight:500; letter-spacing:.14em; text-transform:uppercase;
  color:var(--ink);
}
.gnav__home svg{ width:15px; height:15px; display:block; transition:transform .45s var(--e-out); }
.gnav__home:hover svg{ transform:translateX(-4px); }
.gnav__brand{
  font-family:var(--f-display); font-weight:400;
  font-size:.92rem; letter-spacing:.22em; text-transform:uppercase;
  color:var(--ink);
}
.gnav__cats{
  display:flex; align-items:center; gap:4px;
  overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
  margin:-6px -4px; padding:6px 4px;
}
.gnav__cats::-webkit-scrollbar{ display:none; }
.gnav__cats a{
  flex:none; padding:7px 14px; border-radius:99px; white-space:nowrap;
  font-size:.76rem; font-weight:400; letter-spacing:.03em; color:var(--ink-mute);
  border:1px solid transparent;
  transition:color .35s, background .35s, border-color .35s;
}
.gnav__cats a:hover{ color:var(--ink); border-color:var(--line); }
.gnav__cats a.is-current{ color:var(--ink); background:var(--ivory-lift); border-color:var(--line); }

/* ---------- page head -------------------------------------------------- */
.gpage{ padding:clamp(34px,6vw,86px) var(--gpad) clamp(50px,7vw,96px); }

.ghead-row{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:clamp(18px,3vw,48px); flex-wrap:wrap;
  margin:0 0 clamp(26px,4vw,52px);
}
.ghead{ max-width:760px; margin:0; flex:1 1 340px; }

/* search: filters the dealt cards by code or name, live */
.gsearch{
  position:relative; display:flex; align-items:center; flex:0 1 320px;
  margin-top:6px;
}
.gsearch__ico{
  position:absolute; left:15px; width:16px; height:16px;
  color:var(--ink-mute); pointer-events:none;
}
.gsearch__in{
  width:100%; font:inherit; font-size:.9rem; color:var(--ink);
  padding:11px 16px 11px 40px;
  background:var(--ivory-lift); border:1px solid var(--line);
  border-radius:99px; outline:none;
  transition:border-color .35s, box-shadow .35s;
}
.gsearch__in::placeholder{ color:var(--ink-mute); }
.gsearch__in:focus{
  border-color:var(--accent-ink);
  box-shadow:0 0 0 3px rgba(108,127,100,.14);
  /* forced-colors mode drops the box-shadow; a transparent outline is the only
     thing left for it to paint over. */
  outline:2px solid transparent; outline-offset:2px;
}
.gsearch__in::-webkit-search-cancel-button{ cursor:pointer; }
.ghead .eyebrow{ margin:0 0 14px; }
.ghead__title{
  font-size:clamp(2.5rem,7.4vw,4.6rem); line-height:.99; letter-spacing:-.02em;
  margin:0 0 16px;
}
.ghead__title .italic{ font-style:italic; color:var(--accent-ink); padding-right:.06em; }
.ghead__sub{
  margin:0; max-width:52ch; color:var(--ink-soft);
  font-size:clamp(.95rem,1.05vw,1.06rem);
}

/* ---------- masonry ----------------------------------------------------
   Real column masonry: gallery.js deals the cards into N equal columns,
   always into whichever column is currently shortest. The grid version this
   replaces (auto-rows + row spans) could not backfill — CSS auto-placement
   never moves backwards, so every tall tile left an ivory hole beside it.
   Columns cannot hole by construction.
   Before JS runs, `.masonry` is a plain responsive grid.                 */
.masonry{
  display:grid; align-items:start;
  grid-template-columns:repeat(auto-fill, minmax(min(230px, 46%), 1fr));
  gap:var(--gap);
}
.masonry.is-cols{ display:flex; align-items:flex-start; gap:var(--gap); }
.masonry__col{
  flex:1 1 0; min-width:0;
  display:flex; flex-direction:column; gap:var(--gap);
}

.sheet{
  margin:0; display:flex; flex-direction:column; gap:9px;
  opacity:0; transform:translateY(26px);
  transition:opacity .8s var(--e-out), transform .9s var(--e-out);
  transition-delay:calc(var(--i,0) * 55ms);
}
.sheet.is-in{ opacity:1; transform:none; }

/* The 360 link cannot live inside .sheet__hit — an <a> inside a <button> is
   invalid — so the two are siblings inside a positioned frame, and the frame
   is what lifts on hover so the pill rides with the image. */
.sheet__frame{
  position:relative; border-radius:var(--r-sheet);
  transition:transform .55s var(--e-out), box-shadow .55s var(--e-out);
  box-shadow:0 1px 0 rgba(27,33,28,.05), 0 18px 40px -34px rgba(27,33,28,.75);
}
.sheet__frame:hover{
  transform:translateY(-3px);
  box-shadow:0 1px 0 rgba(27,33,28,.05), 0 30px 54px -34px rgba(27,33,28,.62);
}
.sheet__hit{
  display:block; width:100%; padding:0; border:0; cursor:zoom-in;
  position:relative; overflow:hidden; isolation:isolate;
  border-radius:var(--r-sheet);
  background:var(--ivory-lift);
}
.sheet__hit::after{
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  box-shadow:inset 0 0 0 1px var(--line-soft);
}
.sheet__hit img{
  width:100%; height:auto; aspect-ratio:var(--ar, .5); object-fit:cover;
  transition:transform .8s var(--e-out);
}
.sheet__frame:hover .sheet__hit img{ transform:scale(1.035); }
.sheet__hit:focus-visible{ outline:2px solid var(--accent-ink); outline-offset:3px; }

/* one hover affordance per card: open the immersive tour */
.sheet__frame::after{
  content:""; position:absolute; inset:0; z-index:1; pointer-events:none;
  border-radius:var(--r-sheet); background:rgba(18,16,13,.28);
  opacity:0; transition:opacity .4s var(--e-out);
}
.sheet__frame--tour:hover::after, .sheet__frame--tour:focus-within::after{ opacity:1; }

.sheet__360{
  position:absolute; z-index:2; left:50%; top:50%;
  transform:translate(-50%,-50%) scale(.9);
  display:inline-flex; align-items:center; gap:8px; white-space:nowrap;
  padding:10px 18px; border-radius:99px;
  background:rgba(251,248,242,.96); color:var(--ink);
  font-size:.72rem; font-weight:500; letter-spacing:.1em; text-transform:uppercase;
  box-shadow:0 14px 30px -18px rgba(27,33,28,.8);
  opacity:0; pointer-events:none;
  transition:opacity .4s var(--e-out), transform .4s var(--e-out), background .3s;
}
.sheet__360 svg{ width:16px; height:16px; display:block; flex:none; }
.sheet__frame:hover .sheet__360, .sheet__frame:focus-within .sheet__360{
  opacity:1; transform:translate(-50%,-50%); pointer-events:auto;
}
.sheet__360:hover{ background:var(--ivory-lift); }
.sheet__360:focus-visible{ outline:2px solid var(--accent-ink); outline-offset:3px; }

.sheet__cap{
  display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
  padding:0 3px; line-height:1.3;
}
.sheet__cap b{
  font-weight:500; font-size:.76rem; letter-spacing:.1em; text-transform:uppercase; color:var(--ink);
}
.sheet__cap span{ font-size:.78rem; color:var(--ink-mute); }

/* Placeholder when no fullsheet is uploaded */
.sheet__na {
  width: 100%;
  aspect-ratio: var(--ar, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #141311;
  border-radius: var(--r-sheet);
  color: rgba(247, 244, 236, 0.55);
  padding: 24px 16px;
  text-align: center;
  user-select: none;
  box-sizing: border-box;
  transition: background .35s var(--e-out), color .35s var(--e-out);
}
.sheet__frame:hover .sheet__na {
  background: #1d1b18;
  color: rgba(247, 244, 236, 0.85);
}
.sheet__na-icon svg {
  stroke: rgba(247, 244, 236, 0.35);
  transition: stroke .35s var(--e-out), transform .35s var(--e-out);
}
.sheet__frame:hover .sheet__na-icon svg {
  stroke: rgba(247, 244, 236, 0.7);
  transform: scale(1.08);
}
.sheet__na-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(247, 244, 236, 0.08);
  color: #cfc8be;
  border: 1px solid rgba(247, 244, 236, 0.15);
}
.sheet__na-text {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 244, 236, 0.55);
}

/* Lightbox N/A state */
.lb__na {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 280px;
}
.lb__na-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 28px;
  max-width: 360px;
  background: rgba(24, 22, 19, 0.92);
  border: 1px solid rgba(247, 244, 236, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}
.lb__na-box svg {
  stroke: rgba(247, 244, 236, 0.35);
  margin-bottom: 14px;
}
.lb__na-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(247, 244, 236, 0.08);
  color: #cfc8be;
  border: 1px solid rgba(247, 244, 236, 0.15);
  margin-bottom: 12px;
}
.lb__na-title {
  font-family: 'Asar', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: #f7f4ec;
  margin: 0 0 6px 0;
  letter-spacing: 0.02em;
}
.lb__na-sub {
  font-size: 0.82rem;
  color: rgba(247, 244, 236, 0.55);
  margin: 0 0 20px 0;
  line-height: 1.45;
}
.lb__na-tour {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 99px;
  background: #f7f4ec;
  color: #12100d;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease;
}
.lb__na-tour:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

/* ---------- lightbox ---------------------------------------------------- */
.lb{
  position:fixed; inset:0; z-index:200;
  display:grid; grid-template-rows:auto 1fr auto;
  background:rgba(18,16,13,.93);
  backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
  color:var(--on-dark);
  opacity:0; visibility:hidden; pointer-events:none;
  /* visibility flips instantly on open and only after the fade on close.
     Transitioning it in both directions left the dialog unfocusable on the
     frame it opened, so focus() landed on <body>. */
  transition:opacity .35s ease, visibility 0s linear .35s;
}
.lb.is-open{ opacity:1; visibility:visible; pointer-events:auto; transition:opacity .35s ease, visibility 0s; }

.lb__bar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px clamp(14px,3vw,30px);
}
.lb__code{ font-size:.78rem; letter-spacing:.12em; text-transform:uppercase; }
.lb__code em{ font-style:normal; color:var(--on-dark-mute); letter-spacing:.04em; text-transform:none; margin-left:10px; }
.lb__count{ font-size:.74rem; letter-spacing:.1em; color:var(--on-dark-mute); }
.lb__x{ width:38px; height:38px; border-radius:50%; display:grid; place-items:center; border:1px solid rgba(247,244,236,.22); }
.lb__x:hover{ background:rgba(247,244,236,.1); }
.lb__x svg{ width:16px; height:16px; }

/* A full sheet is usually far taller than the screen. Shrinking it to fit made the
   grain unreadable, and the old max-height never applied anyway (it resolved against
   an indefinite grid row), so tall sheets ran off the bottom with no way to scroll.
   The stage scrolls instead; margin:auto centres sheets that do fit. */
.lb__stage{
  position:relative; display:grid;
  padding:0 clamp(8px,6vw,84px); min-height:0;
  overflow-y:auto; overscroll-behavior:contain;
  scrollbar-width:thin; scrollbar-color:rgba(247,244,236,.28) transparent;
}
.lb__stage img{
  margin:auto; max-width:min(100%, 820px); width:auto; height:auto;
  border-radius:10px; background:#1b1a17;
  opacity:0; transition:opacity .35s ease;
}
.lb__stage img.is-ready{ opacity:1; }

.lb__nav{
  /* Fixed, so the arrows stay put while a tall sheet scrolls under them. The
     lightbox's backdrop-filter makes it their containing block, and it covers
     the viewport, so this is the same place absolute used to put them. */
  position:fixed; top:50%; transform:translateY(-50%); z-index:2;
  width:clamp(38px,4vw,50px); height:clamp(38px,4vw,50px); border-radius:50%;
  display:grid; place-items:center;
  background:rgba(247,244,236,.1); border:1px solid rgba(247,244,236,.2);
  transition:background .3s, transform .3s;
}
.lb__nav:hover{ background:rgba(247,244,236,.2); }
.lb__nav svg{ width:18px; height:18px; }
.lb__nav--prev{ left:clamp(6px,2vw,26px); }
.lb__nav--next{ right:clamp(6px,2vw,26px); }

.lb__foot{
  padding:14px clamp(14px,3vw,30px) 20px; text-align:center;
  font-size:.72rem; letter-spacing:.1em; text-transform:uppercase; color:var(--on-dark-mute);
}
body.lb-open{ overflow:hidden; }

/* ---------- foot -------------------------------------------------------- */
.gfoot__credit a{ text-decoration:underline; text-decoration-color:transparent; text-underline-offset:3px;
  transition:color .3s, text-decoration-color .3s; }
.gfoot__credit a:hover{ color:var(--ink); text-decoration-color:currentColor; }

.gfoot{
  border-top:1px solid var(--line-soft);
  padding:clamp(26px,4vw,44px) var(--gpad);
  display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap;
  font-size:.76rem; color:var(--ink-mute);
}
.gfoot a:hover{ color:var(--ink); }
.gfoot__mid{ display:flex; gap:16px; flex-wrap:wrap; }

/* ---------- narrow ------------------------------------------------------ */
@media (max-width:680px){
  .gnav{ flex-direction:column; align-items:stretch; gap:10px; padding:12px var(--gpad); }
  .gnav__cats{ margin:0 calc(-1 * var(--gpad)); padding:0 var(--gpad) 2px; }
  .gnav__brand{ font-size:.82rem; letter-spacing:.18em; }
  /* Stacked, the row's main axis is vertical, so the flex-basis meant for the
     column width would become a 340px minimum HEIGHT. Reset both items. */
  .ghead-row{ flex-direction:column; }
  .ghead{ flex:0 0 auto; }
  .gsearch{ flex:0 0 auto; width:100%; margin-top:2px; }
  .sheet__cap b{ font-size:.7rem; }
  .sheet__cap span{ font-size:.72rem; }
  .lb__stage{ padding:0 6px; }
}

/* A touch screen never hovers, so the tour would be unreachable there. Dock
   the pill into the corner of the sheet permanently instead, and drop the
   scrim — a dimmed card with no way to undim reads as broken. */
@media (hover:none){
  .sheet__360{
    left:10px; top:auto; bottom:10px;
    opacity:1; pointer-events:auto; transform:none;
    padding:8px 13px; font-size:.66rem; gap:6px;
  }
  .sheet__frame:hover .sheet__360,
  .sheet__frame:focus-within .sheet__360{ transform:none; }
  .sheet__360 svg{ width:14px; height:14px; }
  .sheet__frame--tour:hover::after,
  .sheet__frame--tour:focus-within::after{ opacity:0; }
}

@media (prefers-reduced-motion:reduce){
  .sheet{ opacity:1; transform:none; transition:none; }
  .sheet__frame, .sheet__hit img, .sheet__360{ transition:none; }
}

/* ---------- empty state & tour enhancements ---------- */
.gallery-empty{
  grid-column: 1 / -1;
  width: 100%;
  padding: clamp(60px, 10vw, 120px) 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--ivory-lift);
  border: 1px dashed var(--line);
  border-radius: var(--r-sheet);
  margin: 20px 0;
}
.gallery-empty__icon{
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(20, 17, 15, 0.05);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.gallery-empty__title{
  font-size: clamp(1.2rem, 1.8vw, 1.6rem);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.gallery-empty__sub{
  font-size: clamp(0.85rem, 0.95vw, 0.95rem);
  color: var(--ink-soft);
  max-width: 42ch;
  line-height: 1.5;
}
.lb__tour-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(247,244,236,.12);
  border: 1px solid rgba(247,244,236,.25);
  color: var(--on-dark);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  margin-left: 12px;
  transition: all 0.25s;
}
.lb__tour-btn:hover{
  background: rgba(247,244,236,.25);
  border-color: rgba(247,244,236,.5);
}

/* ---- Sheets are not clickable -------------------------------------------
   Clicking a sheet used to open it full size. Browsing the range is what a
   category page is for; the 360 tour, reached by its own link on the card, is
   where a sheet gets examined. The image still lifts on hover because the card
   as a whole is still a live thing - the tour link sits on top of it - but the
   sheet itself must not look or behave like a button. */
.sheet__hit[disabled]{
  cursor:default;
  /* A disabled button swallows pointer events, which would block the 360 link
     layered above it from receiving hover. */
  pointer-events:none;
  opacity:1;
}

.sheet__hit[disabled]:focus-visible{ outline:none; }
