/* sites/gallery.css — gallery.billubnb.in: three-arch collage hero, filter chips, the masonry columns grid (blur placeholders come
   from the photo macro), films, the lightbox and the "photo diary" band (deep sage). Phone-first: 2 columns at 390 px. */
@layer sections {
  /* the next .sheet slides up over the hero by --sheet-r: give the hero that much extra bottom padding (core sites.css fix pending) */
  .site-hero { padding-bottom: calc(var(--space-6) + var(--sheet-r)); overflow-x: clip; }   /* WebKit counts the tilted art card's corners as page overflow */
  @media (min-width: 900px) { .site-hero { padding-bottom: calc(var(--space-7) + var(--sheet-r)); } }

  /* ---- hero collage --------------------------------------------------------------------------------------------- */
  .gal-collage { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: var(--space-3); padding-top: var(--space-3); }
  .gal-collage .arch { box-shadow: 0 0 0 5px var(--paper-3), var(--shadow-2); border-radius: 50% 50% var(--arch-r) var(--arch-r) / 36% 36% var(--arch-r) var(--arch-r); }
  .gal-collage__1 { grid-column: 1 / span 3; grid-row: 1; transform: rotate(-4deg); z-index: 1; }
  .gal-collage__2 { grid-column: 3 / span 3; grid-row: 1; transform: translateY(-34px) rotate(3deg); z-index: 2; }
  .gal-collage__3 { grid-column: 4 / span 3; grid-row: 1; transform: translateY(20px) rotate(-1deg); z-index: 3; }
  @media (max-width: 899px) { .site-hero--gallery .site-hero__art { display: none; } .site-hero--gallery { padding-bottom: calc(var(--space-5) + var(--sheet-r)); } }

  /* ---- head + chips ----------------------------------------------------------------------------------------------- */
  .gal-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-5); }
  .gal-head h2 { margin: 0; font-size: var(--step-2); }
  .gal-chips { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding: 4px var(--gutter);
    overscroll-behavior-x: contain; position: relative; }
  .gal-chips::-webkit-scrollbar { display: none; }
  .gal-chip { flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .35rem 1rem; border-radius: var(--r-pill);
    border: 1.5px solid var(--line-strong); background: var(--paper-3); color: var(--ink); font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
    transition: background-color var(--dur-2), transform var(--dur-1) var(--ease); }
  .gal-chip span { font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
  .gal-chip:hover { background: var(--sun-soft); }
  .gal-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
  .gal-chip[aria-pressed="true"] span { color: var(--paper); }
  .gal-chip:active { transform: scale(.96); }
  /* one row at every width (sideways scroll if needed): a wrapping row changes height when the web font swaps in */
  @media (min-width: 720px) { .gal-chips { margin: 0; padding-inline: 2px; } }

  /* ---- masonry grid (CSS columns: every photo keeps its own shape) ------------------------------------------------- */
  .gal { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: var(--space-3); }
  .gal__item { break-inside: avoid; margin: 0 0 var(--space-3); }
  .gal__a { position: relative; display: block; border-radius: var(--r-md); overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow-1);
    transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2); }
  .gal__a:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
  .gal__a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
  .gal__img { display: block; width: 100%; height: auto; background-size: cover; background-position: center; }
  .gal__a::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; opacity: 0;
    background: var(--paper-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233A2A22' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M15 4h5v5M9 20H4v-5M20 4l-6 6M4 20l6-6'/%3E%3C/svg%3E") no-repeat center / 15px;
    transition: opacity var(--dur-2); }
  .gal__a:hover::after, .gal__a:focus-visible::after { opacity: 1; }
  @media (min-width: 600px) { .gal { columns: 3; column-gap: var(--space-4); } .gal__item { margin-bottom: var(--space-4); } }
  @media (min-width: 1100px) { .gal { columns: 4; } }
  @media (prefers-reduced-motion: reduce) { .gal__a, .gal__a:hover { transition: none; transform: none; } }

  .gal-empty { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-6); border-radius: var(--r-lg); background: var(--paper-3); }
  .gal-empty h2 { margin: 0; font-size: var(--step-2); }
  .gal-empty p { margin: .3rem 0 0; color: var(--ink-2); }

  /* ---- films --------------------------------------------------------------------------------------------------------- */
  .gal-films { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
  .gal-films figure { margin: 0; }
  .gal-films video { display: block; width: 100%; height: auto; max-height: 70vh; border-radius: var(--r-md); background: var(--ink); }
  .gal-films figcaption { margin-top: .5rem; font-size: .95rem; color: var(--ink-2); }

  /* ---- lightbox -------------------------------------------------------------------------------------------------------- */
  html.lb-open { overflow: hidden; }
  .lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: rgba(29, 21, 17, .94); color: var(--paper); overscroll-behavior: contain; }
  .lb::backdrop { background: rgba(29, 21, 17, .6); }
  .lb[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
  .lb__stage { display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden;
    padding: calc(64px + env(safe-area-inset-top)) var(--space-3) var(--space-3); touch-action: pan-y pinch-zoom; }
  .lb__img { flex: none; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: var(--r-sm); transition: transform .2s var(--ease-out);
    background: rgba(255, 248, 238, .06); }
  .lb__bar { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-5) calc(var(--space-4) + env(safe-area-inset-bottom)); }
  .lb__cap { flex: 1; max-width: none; margin: 0; font-size: 1rem; line-height: 1.4; color: var(--paper); }
  .lb__n { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--on-deep-2); }
  .lb__btn { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid rgba(255, 248, 238, .35);
    background: rgba(29, 21, 17, .55); color: var(--paper); cursor: pointer; transition: background-color var(--dur-2), transform var(--dur-1) var(--ease); }
  .lb__btn:hover { background: rgba(255, 248, 238, .16); }
  .lb__btn:active { transform: scale(.94); }
  .lb__btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
  .lb__btn .i { width: 24px; height: 24px; stroke-width: 2.2; }
  .lb__close { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  .lb__nav { top: 50%; transform: translateY(-50%); }
  .lb__nav:active { transform: translateY(-50%) scale(.94); }
  .lb__nav--prev { left: calc(10px + env(safe-area-inset-left)); } .lb__nav--prev .i { transform: rotate(180deg); }
  .lb__nav--next { right: calc(10px + env(safe-area-inset-right)); }
  .lb--single .lb__nav { display: none; }
  @media (min-width: 720px) { .lb__stage { padding-inline: 76px; } }      /* the photo never slides under the ‹ › buttons */
  @media (max-width: 719px) { .lb__nav { top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); transform: none; } .lb__nav:active { transform: scale(.94); }
    .lb__stage { padding-bottom: 76px; } }
  @media (prefers-reduced-motion: reduce) { .lb__img { transition: none; } }

  /* ---- the photo-diary band ------------------------------------------------------------------------------------------ */
  .diary__inner { display: grid; gap: var(--space-6); align-items: center; }
  .diary .eyebrow { display: inline-flex; align-items: center; gap: .4rem; }
  .diary .eyebrow .i { width: 18px; height: 18px; }
  .diary h2 { margin: var(--space-2) 0 0; font-size: var(--step-3); line-height: 1.05; color: var(--on-deep); }
  .diary .lead { margin: var(--space-4) 0 0; max-width: 34rem; }
  .diary__ctas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-top: var(--space-5); }
  .diary__phone { justify-self: center; width: min(100%, 290px); padding: 12px; border-radius: 38px; background: var(--deep-2); box-shadow: 0 0 0 1px var(--deep-line), var(--shadow-2);
    transform: rotate(3deg); }
  .diary__screen { display: grid; gap: .55rem; padding: var(--space-4) var(--space-3); border-radius: 28px; background: var(--paper); color: var(--ink); }
  .diary__label { margin: 0 0 .2rem; text-align: center; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
  .diary__msg { justify-self: start; max-width: 88%; margin: 0; padding: .5rem .75rem; border-radius: 16px 16px 16px 4px; background: var(--sage-tint);
    font-size: .92rem; font-weight: 650; line-height: 1.35; }
  .diary__msg span { display: block; font-size: .74rem; font-weight: 800; color: var(--ink-2); }
  .diary__pic { width: 78%; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 5; position: relative; }
  .diary__pic .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  @media (min-width: 900px) { .diary__inner { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: var(--space-8); } }
}
