.documents {
  --folder-edge: #b98029;
  --folder-radius: 13px;
  --folder-tab-height: clamp(28px, 4vw, 42px);
  max-width: 860px;
}

.documents details {
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px rgba(108, 68, 15, .18));
}

/* The back sheet is visible through the lowered side of an open folder. */
.documents details[open]::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 5px;
  left: 34%;
  right: 2.1%;
  height: var(--folder-tab-height);
  border: 1px solid #e5d5b6;
  border-radius: 2px 3px 0 0;
  background: linear-gradient(170deg, #fffaf0, #f6ead4);
  box-shadow: 0 -1px 3px rgba(98, 67, 26, .1);
  transform: rotate(-.6deg);
  pointer-events: none;
}

.documents details > summary {
  position: relative;
  isolation: isolate;
  min-height: calc(var(--folder-tab-height) + 43px);
  padding: calc(var(--folder-tab-height) + 1px) 22px 15px;
  background: transparent;
  border-radius: var(--folder-radius);
}

.documents summary::before,
.documents summary::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  left: 0;
  pointer-events: none;
}

.documents summary::before {
  top: 0;
  height: var(--folder-tab-height);
  background: url("../images/documents/folder-tab.svg") center / 100% 100% no-repeat;
}

.documents summary::after {
  top: var(--folder-tab-height);
  bottom: 0;
  border: 1px solid var(--folder-edge);
  border-top: 0;
  border-radius: 0 0 var(--folder-radius) var(--folder-radius);
  background: linear-gradient(#f9e1b4, #fbe8c6);
}

.documents details[open] summary::after {
  border-bottom: 0;
  border-radius: 0;
}

.documents .detail-body,
.documents .document-tip {
  border-right: 1px solid var(--folder-edge);
  border-left: 1px solid var(--folder-edge);
}

.documents .detail-body { background: var(--ivory); }

.documents details[open] > :last-child {
  border-bottom: 1px solid var(--folder-edge);
  border-radius: 0 0 var(--folder-radius) var(--folder-radius);
}

[dir="rtl"] .documents summary::before { transform: scaleX(-1); }
[dir="rtl"] .documents details[open]::before {
  left: 2.1%;
  right: 34%;
  transform: rotate(.6deg);
}

.documents .document-tip {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  column-gap: 9px;
  margin: 0;
  padding: 12px 22px;
  background: #fff1c9;
  color: var(--umber);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.documents .document-tip > span { align-self: center; }

@keyframes document-bulb-glow {
  0%, 100% { opacity: .14; }
  50% { opacity: .72; }
}

@media screen and (prefers-reduced-motion: no-preference) {
  .documents details[open] .document-tip > img,
  .documents details[open] .document-tip::before { grid-area: 1 / 1; }

  /* The halo shares the icon cell and is centered on the glass above the brass base. */
  .documents details[open] .document-tip::before {
    content: "";
    justify-self: center;
    z-index: 1;
    width: 38px;
    height: 30px;
    margin-top: -5px;
    pointer-events: none;
    background:
      radial-gradient(ellipse 9px 10px at center, rgba(255, 249, 209, .82), transparent),
      radial-gradient(ellipse closest-side, rgba(255, 199, 57, .55) 25%, rgba(255, 196, 52, .32) 63%, transparent);
    animation: document-bulb-glow 4s ease-in-out infinite;
  }
}

.documents summary > span {
  transform: translateY(-7px);
}
