/* cyrillic */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-italic-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-italic-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-normal-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

[data-certificate-theme] {
  --cert-base: #0a111f;
  --cert-paper: #eee8d9;
  --cert-sky-top: #1b2e47;
  --cert-sky-base: #0c1526;
}
[data-certificate-theme="burgundy"] {
  --cert-base: #200e18;
  --cert-paper: #f0e1d8;
  --cert-sky-top: #532638;
  --cert-sky-base: #26121e;
}
[data-certificate-theme="emerald"] {
  --cert-base: #0b1c1b;
  --cert-paper: #e8eadf;
  --cert-sky-top: #214b40;
  --cert-sky-base: #112723;
}
[data-certificate-theme="graphite"] {
  --cert-base: #14151b;
  --cert-paper: #e7e5de;
  --cert-sky-top: #3a3e4a;
  --cert-sky-base: #1c1e26;
}
[data-certificate-theme="rose"] {
  --cert-base: #231622;
  --cert-paper: #f2e4e2;
  --cert-sky-top: #634155;
  --cert-sky-base: #331f32;
}
[data-certificate-font] {
  --cert-heading: Prata, Georgia, serif;
  --cert-heading-weight: 400;
  --cert-heading-scale: 1;
  --cert-dedication: Georgia, serif;
  --cert-dedication-style: italic;
  --cert-dedication-weight: 400;
  --cert-dedication-scale: 1;
}
[data-certificate-font="romantic"] {
  --cert-heading: "Cormorant Garamond", Georgia, serif;
  --cert-heading-weight: 500;
  --cert-heading-scale: 1.15;
  --cert-dedication: "Cormorant Garamond", Georgia, serif;
  --cert-dedication-weight: 500;
  --cert-dedication-scale: 1.14;
}
[data-certificate-font="modern"] {
  --cert-heading: "Golos Text", Arial, sans-serif;
  --cert-heading-weight: 500;
  --cert-heading-scale: .92;
  --cert-dedication: "Golos Text", Arial, sans-serif;
  --cert-dedication-style: normal;
  --cert-dedication-scale: .92;
}

.certificate-landscape.scene-certificate,
.certificate-view .certificate-landscape.scene-certificate {
  --cert-fit: 1;
  grid-template-columns: 38% 62%;
  grid-template-rows: minmax(0, 1fr);
  color: #efece2;
  background: var(--cert-base);
  border: 0;
  border-radius: 0;
  isolation: isolate;
}
.scene-certificate .cert-story {
  min-width: 0;
  padding: 3.55cqw 2.85cqw 2.65cqw 3.45cqw;
  background: var(--cert-paper);
  color: #232925;
  border: 0;
}
.scene-certificate .cert-label {
  margin: 0 0 3.9cqw;
  padding: 0 0 .9cqw;
  border-bottom: 1px solid #8a806a;
  color: #4c5149;
  font: 500 1.12cqw/1.3 var(--sans);
  letter-spacing: .024em;
}
.scene-certificate h3,
.certificate-view .scene-certificate h3 {
  color: #202822;
  font: var(--cert-heading-weight) calc(4.55cqw * var(--cert-heading-scale) * var(--cert-fit))/1.1 var(--cert-heading);
  letter-spacing: -.04em;
  margin: 0 0 1.8cqw;
  text-wrap: balance;
}
.scene-certificate h3[data-title-size="medium"],
.certificate-view .scene-certificate h3[data-title-size="medium"] { font-size: calc(3.65cqw * var(--cert-heading-scale) * var(--cert-fit)); }
.scene-certificate h3[data-title-size="long"],
.certificate-view .scene-certificate h3[data-title-size="long"] { font-size: calc(2.95cqw * var(--cert-heading-scale) * var(--cert-fit)); }
.scene-certificate .cert-text,
.certificate-view .scene-certificate .cert-text {
  color: #3d443d;
  font: var(--cert-dedication-style) var(--cert-dedication-weight) calc(1.88cqw * var(--cert-dedication-scale) * var(--cert-fit))/1.42 var(--cert-dedication);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.scene-certificate .cert-text.long-dedication,
.certificate-view .scene-certificate .cert-text.long-dedication {
  font-size: calc(1.4cqw * var(--cert-dedication-scale) * var(--cert-fit));
  line-height: 1.38;
  white-space: pre-line;
}
.scene-certificate .cert-text:empty, .scene-certificate .cert-date:empty { display: none; }
.scene-certificate .cert-date { margin: 1.3cqw 0 0; color: #565a50; font: 1.17cqw/1.4 var(--sans); }
.scene-certificate .cert-parties {
  display: grid; grid-template-columns: 1fr; gap: .35cqw; margin: 1.5cqw 0 0;
}
.scene-certificate .cert-parties > div { display: grid; grid-template-columns: 5cqw minmax(0,1fr); gap: .4cqw; align-items: baseline; }
.scene-certificate .cert-parties[hidden], .scene-certificate .cert-parties [hidden] { display: none; }
.scene-certificate .cert-parties dt { color: #565a50; font: 1.12cqw/1.4 var(--sans); }
.scene-certificate .cert-parties dd { color: #242d27; font: 500 calc(1.38cqw * var(--cert-fit))/1.3 var(--sans); margin: 0; }
.scene-certificate .cert-qr-row { margin-top: auto; padding-top: 1.4cqw; gap: 1.5cqw; }
.scene-certificate .cert-qr-frame { flex: none; display: block; padding: .25cqw; border: 1px solid #a29675; background: #f4e4c2; }
.scene-certificate .cert-qr { width: 8.2cqw; height: 8.2cqw; display: block; border: 0; }
.scene-certificate .cert-qr-row strong { color: #28312a; font: 500 1.3cqw/1.38 var(--sans); }
.scene-certificate .cert-qr-row span { color: #555c51; font: 1.17cqw/1.4 var(--sans); margin-top: .24cqw; }
.scene-certificate .cert-footer {
  color: #454d44; border-color: #aba796; margin-top: 1.25cqw; padding-top: .65cqw; font: 500 .96cqw/1.4 var(--sans);
}
.scene-certificate .cert-footer span { color: #565c52; display: block; font-weight: 400; }
.scene-certificate .cert-sky {
  min-width: 0; padding: 3.4cqw 3.15cqw 2.6cqw;
  background: var(--cert-sky-base); display: flex; flex-direction: column;
}
.cert-atlas-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1cqw; }
.scene-certificate .cert-star {
  color: #f3ecdd; font: 3.65cqw/1.15 Prata, Georgia, serif; letter-spacing: -.035em;
  min-width: 0; overflow-wrap: anywhere;
}
.scene-certificate .cert-brand { flex: none; }
.scene-certificate .cert-brand img { width: 11.5cqw; height: auto; display: block; filter: none; }
.scene-certificate .cert-constellation { color: #c9d3df; font: 1.22cqw/1.4 var(--sans); margin: .5cqw 0 0; }
.scene-certificate .cert-constellation strong { color: #f4e7c8; font-weight: 500; }
.scene-certificate .cert-membership { color: #c5d0db; font: .98cqw/1.3 var(--sans); margin: .22cqw 0 0; }
.scene-certificate .cert-membership small { font: inherit; }
.scene-certificate .cert-map,
.certificate-view .scene-certificate .cert-map {
  width: 100%; aspect-ratio: 4 / 3; margin: 1.15cqw 0 0;
  border: 1px solid #7e91a452; background: #111e30;
}
.scene-certificate .cert-target-dot {
  width: .87cqw; height: .87cqw; background: #fff7dd;
  box-shadow: 0 0 .55cqw .18cqw #ffdf99, 0 0 1.8cqw .45cqw #ce9c4fba;
}
.scene-certificate .cert-target-dot::after { inset: -.8cqw; border-color: #f1cc85; }
.scene-certificate .cert-target-label {
  top: -.7cqw; left: 2.1cqw; color: #ffdda0; font: 1.72cqw/1.15 Georgia, serif; text-shadow: 0 1px 5px #03060b;
}
.scene-certificate .cert-target-label-left .cert-target-label { left: auto; right: 2.1cqw; }
.scene-certificate .cert-target-label-left .cert-target-label::before { left: auto; right: -1.3cqw; }
.cert-map-caption {
  display: flex; justify-content: space-between; gap: .7cqw; padding-top: .55cqw;
  color: #c4ccce; font: 1.01cqw/1.35 var(--sans); font-variant-numeric: tabular-nums;
}
.scene-certificate .cert-coords { margin: auto 0 0; padding: 1cqw 0 .65cqw; border-block: 0; border-bottom: 1px solid #697683; gap: 1.8cqw; }
.scene-certificate .cert-coords span,
.certificate-view .scene-certificate .cert-coords span { color: #c8d1db; margin-bottom: .32cqw; font-size: 1.12cqw; }
.scene-certificate .cert-coords strong,
.certificate-view .scene-certificate .cert-coords strong { color: #f1e8d5; font: 2.02cqw/1.28 Georgia,serif; font-variant-numeric: tabular-nums; }
.scene-certificate .cert-science-note { color: #b6c2cd; font: .98cqw/1.4 var(--sans); margin: .58cqw 0 0; }
.scene-certificate .cert-image-credit { color: #acb8c3; font: .86cqw/1.4 var(--sans); margin: .06cqw 0 0; }

.scene-certificate[data-compact], .certificate-view .scene-certificate[data-compact] { grid-template-columns: 43% 57%; }
.scene-certificate[data-compact] .cert-label { margin-bottom: 1.5cqw; }
.scene-certificate[data-compact] .cert-date, .scene-certificate[data-compact] .cert-parties { margin-top: .65cqw; }
.scene-certificate[data-compact] .cert-parties { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1cqw; }
.scene-certificate[data-compact] .cert-parties > div { display: block; }
.scene-certificate[data-compact] .cert-parties [hidden] { display: none; }
.scene-certificate[data-compact] h3 { margin-bottom: .9cqw; }
.scene-certificate[data-flow="continuous"] .cert-text { white-space: normal; }

.certificate-export {
  position: fixed;
  top: 0;
  left: -320mm;
  width: 297mm;
  height: 210mm;
  container-type: inline-size;
  pointer-events: none;
}
.certificate-export > .scene-certificate {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  box-shadow: none;
}

@media print {
  .scene-certificate { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .certificate-appearance-controls { display: none !important; }
}

@media screen and (min-width: 761px) {
  dialog.certificate-dialog {
    width: min(1230px, calc(100% - 24px), calc((86dvh - 130px) * 1.415 + 68px));
  }
  .certificate-view { margin-inline: auto; }
}

@media screen {
  .gift-editor .gift-preview-side { gap: 14px; }

  .certificate-appearance-controls {
    width: 100%;
    display: grid;
    gap: 12px;
  }
  .certificate-options {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .certificate-options legend {
    margin-bottom: 6px;
    color: #cad5e4;
    font-size: .87rem;
  }
  .certificate-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .certificate-choices label { position: relative; cursor: pointer; }
  .certificate-choices input {
    position: absolute;
    inset: 0 auto auto 0;
    width: 1px;
    height: 1px;
    opacity: 0;
  }
  .certificate-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 5px 8px;
    border: 1px solid #8094b060;
    border-radius: 6px;
    background: #0b1422;
    color: #e7edf7;
    font-size: .79rem;
  }
  .certificate-choice[data-certificate-theme]::before {
    content: '';
    width: 15px;
    height: 15px;
    border: 1px solid #fff6;
    border-radius: 50%;
    background: linear-gradient(135deg,var(--cert-sky-top),var(--cert-base));
  }
  .certificate-choice[data-certificate-font] {
    font-family: var(--cert-heading);
    font-weight: var(--cert-heading-weight);
  }
  .certificate-choice[data-certificate-font="romantic"] { font-size: 1.04rem; }
  .certificate-choices input:checked + .certificate-choice {
    color: #ffe5b5;
    border-color: #edcd94;
    background: #2a292b;
    box-shadow: inset 0 0 0 1px #edcd94;
  }
  .certificate-choices input:focus-visible + .certificate-choice {
    outline: 2px solid #f7d69b;
    outline-offset: 3px;
  }
}

@media screen {
  .gift-editor { --editor-padding: clamp(18px, 3.1vw, 42px); }
  .gift-editor .editor-heading { padding: 26px var(--editor-padding) 18px; border-bottom: 1px solid #39444d; }
  .gift-editor .editor-heading .modal-title { margin: 0; padding-right: 32px; line-height: 1.18; font-size: clamp(28px,3.1vw,41px); }
  .gift-editor .editor-heading > p { margin: 6px 0 0; font-size: 14px; color: #bac4cd; }
  .gift-editor .editor-switch { display: none; }
  .gift-editor .gift-form { padding: 22px var(--editor-padding) 30px; }
  .gift-editor .gift-form > .form-field:first-child { margin-top: 0; }
  .gift-editor .gift-preview-side {
    min-width: 0; align-items: stretch; justify-content: flex-start; gap: 18px;
    padding: 22px var(--editor-padding) 26px; border: 0; background: #17222c;
  }
  .gift-editor .certificate-appearance-controls { gap: 11px; }
  .gift-editor .certificate-choice { border-radius: 4px; color: #d3dbe1; background: transparent; }
  .gift-editor .certificate-choices input:checked + .certificate-choice { box-shadow: none; background: #303439; }
  .gift-editor .certificate-options legend { margin-bottom: 5px; }
  .gift-editor .gift-form .purchase-mode { padding-top: 4px; }
  .gift-editor .purchase-mode legend { font-size: 14px; }
  .gift-editor .purchase-mode label { font-size: 14px; min-height: 44px; }
  .gift-editor .gift-form .prototype-note { color: #b9c4cb; }
}
@media screen and (min-width:1001px) {
  .gift-editor { display: grid; grid-template-columns: minmax(320px,.82fr) minmax(0,1.38fr); align-items: start; }
  .gift-editor .editor-heading { grid-column: 1/-1; }
  .gift-editor .gift-form { grid-column: 1; grid-row: 2; }
  .gift-editor .gift-preview-side { grid-column: 2; grid-row: 2; position: sticky; top: 0; }
}
@media screen and (max-width:1000px) {
  dialog.gift-dialog { width: min(690px, calc(100% - 16px)); padding: 0; }
  .gift-dialog:has(.gift-editor) #modal-body { padding: 0; }
  .gift-editor { display: flex; flex-direction: column; gap: 0; }
  .gift-editor .editor-heading { padding: 23px 20px 0; }
  .gift-editor .editor-heading .modal-title { font-size: 29px; }
  .gift-editor .editor-heading > p { margin: 6px 0 12px; }
  .gift-editor .editor-switch { display: flex; gap: 20px; }
  .editor-switch button { min-height: 44px; padding: 4px 1px; color: #bdc9d3; border-bottom: 2px solid transparent; font-size: 15px; }
  .editor-switch button[aria-pressed="true"] { color: #f0d7a6; border-color: currentColor; }
  .gift-editor[data-section="form"] .gift-preview-side, .gift-editor[data-section="preview"] .gift-form { display: none; }
  .gift-editor .gift-form, .gift-editor .gift-preview-side { padding: 20px; }
  .gift-editor[data-section="appearance"] .gift-preview-side { order: 1; }
  .gift-editor[data-section="appearance"] .gift-form { order: 2; }
  .gift-editor .gift-form .form-field { margin-bottom: 16px; }
}

.paper-view { width: 100%; min-width: 0; }
.paper-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.paper-view .certificate-paper, .certificate-view .paper-view .certificate-paper { width: 100%; }
.paper-zoom { display: none; }
@media screen and (max-width:760px) {
  .paper-view.enlarged .certificate-paper, .certificate-view .paper-view.enlarged .certificate-paper { width: max(100%,760px); }
  .paper-zoom { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; min-height: 44px; color: #eed7ad; font-size: 14px; }
}
@media print { .paper-zoom { display: none !important; } }
