/* Document view: deliberately independent of the photo galleries. */
.cnc-certificate > a { display: block; padding: 10px 10px 0; border: 1px solid #d5daeb; background: #fff; box-shadow: 0 18px 38px #1422521a; text-decoration: none; cursor: zoom-in; transition: transform .2s ease; }
.cnc-certificate > a:hover { transform: translateY(-4px); }
.cnc-certificate > a > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 50px; color: var(--brand); font-size: .72rem; font-weight: 700; }
html.certificate-open { overflow: hidden; }
html.certificate-open body { position: fixed; top: var(--certificate-scroll); width: 100%; overflow: hidden; }
.certificate-viewer { width: min(1240px, calc(100% - 48px)); max-width: none; height: calc(100dvh - 48px); max-height: none; padding: 0; margin: auto; border: 1px solid #ffffff40; border-radius: 12px; overflow: hidden; color: #202638; background: #fff; box-shadow: 0 24px 90px #070d2855; }
.certificate-viewer[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.certificate-viewer::backdrop { background: #0b1234d9; backdrop-filter: blur(6px); }
.certificate-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; }
.certificate-header h2 { margin: 0; color: var(--brand-deep); font: 700 1.15rem/1.3 "Century Gothic", "Trebuchet MS", sans-serif; letter-spacing: -.02em; text-wrap: initial; }
.certificate-header p { margin: 5px 0 0; font-size: .75rem; line-height: 1.4; color: #616777; }
.certificate-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-block: 1px solid #dce0e8; background: #f8f9fc; }
.certificate-zoom { display: flex; align-items: center; border: 1px solid #d4d9e5; border-radius: 7px; background: #fff; }
.certificate-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 9px; min-width: 44px; height: 44px; padding: 0 12px; border: 1px solid #d4d9e5; border-radius: 6px; color: var(--brand); background: #fff; font-size: .78rem; font-weight: 700; line-height: 1; text-decoration: none; cursor: pointer; touch-action: manipulation; transition: color .15s ease, background-color .15s ease; }
.certificate-button svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.certificate-button:hover:not(:disabled) { color: #fff; background: var(--brand); border-color: var(--brand); }
.certificate-button:disabled { color: #8c93a4; background: #f7f8fa; cursor: default; }
.certificate-button:focus-visible, .certificate-viewport:focus-visible, .cnc-certificate > a:focus-visible { outline: 3px solid #5a75d4; outline-offset: 3px; }
.certificate-close { color: #fff; border-color: var(--brand); background: var(--brand); }
.certificate-close:hover:not(:disabled) { background: var(--brand-deep); }
.certificate-zoom .certificate-button { padding: 0; border: 0; }
.certificate-scale { min-width: 54px; text-align: center; font-size: .78rem; font-variant-numeric: tabular-nums; }
.certificate-download { margin-left: auto; }
.certificate-viewport { position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: none; background: #e5e8ee; scrollbar-color: #9ca7bc #e5e8ee; scrollbar-width: thin; }
.certificate-viewport:focus-visible { outline-offset: -4px; }
.certificate-canvas { display: grid; place-items: center; min-width: 100%; min-height: 100%; }
.certificate-image { max-width: none; height: auto; box-shadow: 0 2px 8px #17213c20, 0 12px 36px #17213c1c; user-select: none; -webkit-user-select: none; }
.certificate-viewport.is-zoomed { cursor: grab; }
.certificate-viewport.is-dragging { cursor: grabbing; }
.certificate-message { position: absolute; top: 50%; left: 50%; width: min(300px, calc(100% - 32px)); margin: 0; padding: 20px; transform: translate(-50%, -50%); border-radius: 8px; color: #424b61; background: #fff; text-align: center; font-size: .9rem; }
.certificate-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 24px; border-top: 1px solid #dce0e8; font-size: .72rem; line-height: 1.5; color: #616777; }
.certificate-footer p { margin: 0; font-size: inherit; color: inherit; }
.certificate-footer > span { white-space: nowrap; }
@media (max-width: 600px), (max-height: 540px) {
  .certificate-viewer { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .certificate-header { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .certificate-header h2 { font-size: 1rem; }
  .certificate-header p { font-size: .67rem; }
  .certificate-toolbar { gap: 8px; padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .certificate-scale { min-width: 48px; }
  .certificate-fit { padding-inline: 10px; font-size: .72rem; }
  .certificate-download { padding: 0; }
  .certificate-download span, .certificate-footer > span { display: none; }
  .certificate-footer { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); font-size: .67rem; }
}
@media (max-height: 540px) and (min-width: 601px) {
  .certificate-viewer[open] { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 56px minmax(0, 1fr) 28px; }
  .certificate-header { grid-column: 1 / -1; grid-row: 1; padding-block: 6px; }
  .certificate-close { position: relative; z-index: 2; }
  .certificate-toolbar { grid-column: 2; grid-row: 1; z-index: 1; padding: 0 68px 0 12px; border: 0; background: #fff; }
  .certificate-viewport { grid-column: 1 / -1; grid-row: 2; }
  .certificate-footer { grid-column: 1 / -1; grid-row: 3; padding-block: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .cnc-certificate > a, .certificate-button { transition: none; }
}
