/* ============================================================================
   Royal photo frame  -  used on essay_view.php (public) and the admin photo preview.
   Markup:
     <div class="royal-frame royal-frame--banner">
       <span class="rf-crown"></span>
       <span class="rf-corner tl"></span><span class="rf-corner tr"></span>
       <span class="rf-corner bl"></span><span class="rf-corner br"></span>
       <div class="rf-inner">
         <span class="rf-initial">A</span>          <!-- shown when there is no photo -->
         <img src="..." alt="...">                  <!-- covers the initial -->
       </div>
     </div>
   Change the size with the --rf-w variable (width in px; the height is always 5/4 of it).
   ========================================================================== */

.royal-frame {
  --rf-w: 120px;
  position: relative;
  box-sizing: border-box;
  width: var(--rf-w);
  height: calc(var(--rf-w) * 1.25); /* 4:5 portrait. Explicit height: older mobile browsers do not support aspect-ratio */
  margin-top: 20px;                 /* room for the crown */
  border-radius: 10px;
  /* polished gold */
  background: linear-gradient(135deg, #fff3b0 0%, #e6c34a 22%, #a67c00 48%, #f5dc7a 70%, #b8860b 100%);
  box-shadow:
    0 0 0 1px #6b4e00,
    0 12px 30px rgba(0, 0, 0, .45),
    0 0 22px rgba(230, 195, 74, .35),
    inset 0 0 0 1px rgba(255, 255, 255, .55);
  flex-shrink: 0;
}
/* fine engraved line just inside the gold */
.royal-frame::before {
  content: "";
  position: absolute;
  top: 3px; right: 3px; bottom: 3px; left: 3px;
  border-radius: 7px;
  border: 1px solid rgba(107, 78, 0, .65);
  pointer-events: none;
  z-index: 1;
}

.rf-inner {
  position: absolute;               /* 7px gold border all round */
  top: 7px; right: 7px; bottom: 7px; left: 7px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 4px;
  border: 3px solid #0f2e1e;        /* deep green mat */
  background: #0b1d3a;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .65);
}
.rf-inner img {
  position: absolute;
  top: 0; left: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;                  /* beats Tailwind's img { max-width: 100% } */
  object-fit: cover;                /* the photo is cropped to fill the frame */
  object-position: center 25%;      /* keeps faces in view */
}
.rf-inner img[hidden] { display: none; }

.rf-initial {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: calc(var(--rf-w) * .4);
  color: #f3d98b;
  background: radial-gradient(circle at 50% 30%, #1d5b37, #0f2e1e 70%);
}

/* diamond studs on the four corners */
.rf-corner {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: radial-gradient(circle at 35% 35%, #fff6c8, #d4af37 60%, #8a6a00);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.rf-corner.tl { top: -5px;    left: -5px; }
.rf-corner.tr { top: -5px;    right: -5px; }
.rf-corner.bl { bottom: -5px; left: -5px; }
.rf-corner.br { bottom: -5px; right: -5px; }

/* crown on top */
.rf-crown {
  position: absolute;
  z-index: 3;
  top: -22px;
  left: 50%;
  width: 38px;
  height: 24px;
  transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath d='M6 36 L10 10 L24 24 L32 6 L40 24 L54 10 L58 36 Z' fill='%23e6c34a' stroke='%236b4e00' stroke-width='2' stroke-linejoin='round'/%3E%3Crect x='6' y='33' width='52' height='6' rx='2' fill='%23c79a1e' stroke='%236b4e00' stroke-width='1.5'/%3E%3Ccircle cx='10' cy='9' r='3' fill='%23c0392b'/%3E%3Ccircle cx='32' cy='5' r='3.2' fill='%231f6feb'/%3E%3Ccircle cx='54' cy='9' r='3' fill='%23c0392b'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5));
}

/* sizes */
.royal-frame--banner { --rf-w: 104px; }
@media (min-width: 768px) {
  .royal-frame--banner { --rf-w: 128px; }
}
.royal-frame--preview { --rf-w: 112px; }
