/* ============================================================================
   GILT PICTURE FRAMES
   The carved picture frames, ring frames, brass nameplates and the justified hang
   used by the Family Album, and by the home page's "From the Family Album" row.
   Carving: assets/ornament/*.svg (generated, see scratch/fable/make_ornament.mjs).
   ========================================================================= */
.hang {
  --brass: linear-gradient(180deg, #F6E2B8 0%, #E0C193 20%, #C49A6C 58%, #A9835C 100%);
  --brass-ink: #0C1338;
  --ease-spring: cubic-bezier(.16, 1, .3, 1);
}

/* ---- The hang -------------------------------------------------------------------
   A justified hang: every picture in a row shares one height. --a is each
   picture's width / height; flex-grow and flex-basis both follow it, so free
   space is shared in proportion and the heights stay equal. */
.hang {
  --row: clamp(150px, 16.4vw, 222px);
  --fm: clamp(12px, 1.7vw, 22px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(22px, 3vw, 40px) clamp(14px, 2.2vw, 30px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.piece {
  flex: var(--a) 1 calc(var(--a) * var(--row) + 2 * var(--fm));
  /* never blow a picture up past 1.45x the base hang, or past what its file can carry */
  max-width: min(calc(var(--a) * var(--row) * 1.45 + 2 * var(--fm)), var(--native, 100vw));
  min-width: 0;
}
.piece figure { margin: 0; }
/* A ring frame has no border box of its own: its carved ring is part of the
   picture area, so it takes the moulding allowance inside its proportions. */
.piece--round, .piece--oval {
  flex-basis: calc(var(--a) * (var(--row) + 2 * var(--fm)));
  max-width: min(calc(var(--a) * (var(--row) * 1.45 + 2 * var(--fm))), var(--native, 100vw));
}

.piece__frame {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: var(--fm) solid var(--gold);
  border-image: url("../assets/ornament/frame-gilt.svg") 100 / var(--fm) round;
  border-radius: 1px;
  background: var(--navy-deep);
  color: inherit;
  font: inherit;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .1), 0 16px 30px rgba(0, 0, 0, .5), 0 5px 10px rgba(0, 0, 0, .42);
  -webkit-tap-highlight-color: transparent;
  transition: transform 320ms var(--ease-spring), box-shadow 320ms var(--ease-spring);
}
.piece--ebony .piece__frame { border-color: var(--navy-deep); border-image-source: url("../assets/ornament/frame-ebony.svg"); }
.piece__picture { position: relative; display: block; aspect-ratio: var(--a); overflow: hidden; background: var(--navy-deep); }
.piece__picture img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-spring), filter 320ms var(--ease); }
/* the rebate's shadow across the top of the picture, and a whisper of glass */
.piece__picture::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, 0) 26%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55), inset 0 4px 9px rgba(0, 0, 0, .5), inset 3px 0 7px rgba(0, 0, 0, .28);
  pointer-events: none;
}

/* Round and oval: the picture sits inside a carved ring drawn over it. */
.piece--round .piece__frame, .piece--oval .piece__frame { border: 0; border-image: none; border-radius: 50%; background: none; aspect-ratio: var(--a); }
.piece--round .piece__picture, .piece--oval .piece__picture { position: absolute; border-radius: 50%; aspect-ratio: auto; }
.piece--round .piece__picture { inset: 8.4%; }
.piece--oval .piece__picture { inset: 6.72% 8.4%; }
.piece--round .piece__frame::after, .piece--oval .piece__frame::after { content: ""; position: absolute; inset: 0; background: center / 100% 100% no-repeat; pointer-events: none; }
.piece--round .piece__frame::after { background-image: url("../assets/ornament/frame-round.svg"); }
.piece--oval .piece__frame::after { background-image: url("../assets/ornament/frame-oval.svg"); }

.piece__frame:hover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255, 255, 255, .14), 0 26px 44px rgba(0, 0, 0, .55), 0 8px 14px rgba(0, 0, 0, .45); }
.piece__frame:hover .piece__picture img { transform: scale(1.035); filter: brightness(1.05); }
.piece__frame:active { transform: translateY(-1px) scale(.992); transition-duration: 90ms; }
.piece__frame:focus-visible { outline: 3px solid var(--gold-lt); outline-offset: 5px; }
.piece--round .piece__frame:focus-visible, .piece--oval .piece__frame:focus-visible { border-radius: 50%; }

/* Engraved brass nameplate. */
.piece__plaque {
  display: table;
  max-width: 100%;
  margin: clamp(11px, 1.5vw, 17px) auto 0;
  padding: 5px 17px 6px;
  border-radius: 2px;
  background:
    radial-gradient(circle at 7px 50%, #4A3420 0 1.5px, rgba(74, 52, 32, 0) 2.2px),
    radial-gradient(circle at calc(100% - 7px) 50%, #4A3420 0 1.5px, rgba(74, 52, 32, 0) 2.2px),
    var(--brass);
  color: var(--brass-ink);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 8;
  font-size: clamp(.69rem, .62rem + .22vw, .8rem);
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 1.2;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -1px 0 rgba(0, 0, 0, .38), 0 0 0 1px rgba(46, 31, 14, .85), 0 4px 9px rgba(0, 0, 0, .5);
}

@media (max-width: 600px) {
  .hang { --row: 196px; }
  .piece--round { max-width: 268px; }
}
@media (hover: none) {
  .piece__frame:hover { transform: none; }
  .piece__frame:hover .piece__picture img { transform: none; filter: none; }
}

/* ---- Home page: a few portraits from the album ------------------------------ */
.album-teaser { background: radial-gradient(90% 26rem at 50% 0%, rgba(74, 98, 184, .42) 0%, rgba(74, 98, 184, 0) 72%), url("../assets/ornament/wall-damask.svg") 50% 0 / 64px 64px, var(--navy); color: var(--white); text-align: center; }
.album-teaser .eyebrow { color: var(--gold); }
.album-teaser .section-head h2 { color: var(--white); }
.album-teaser .btn--reverse { border-color: var(--gold); color: var(--gold-lt); }
.album-teaser .btn--reverse:hover { background: var(--gold); color: var(--navy-deep); }
.album-teaser .section-head p:not(.eyebrow) { color: var(--cream-deep); }
.album-teaser .hang { --row: clamp(150px, 15vw, 208px); max-width: 1080px; margin: var(--s-7) auto var(--s-7); }
.album-teaser a.piece__frame { text-decoration: none; cursor: pointer; }
.album-teaser .button-row { justify-content: center; }
@media (max-width: 600px) {
  .album-teaser .hang { --row: 150px; }
  .album-teaser .piece { max-width: 46%; }
}
