/* Конструктор памятника (designer.html / designerLV.html). Общие стили сайта — в site.css */

/* ===== Шрифты для надписей (у всех есть латышские и русские буквы) ===== */
@font-face {
    font-family: 'PT Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/pt-serif-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'PT Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/pt-serif-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'PT Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/pt-serif-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;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-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;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/playfair-display-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/playfair-display-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/playfair-display-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;
}

@font-face {
    font-family: 'Great Vibes';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/great-vibes-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Great Vibes';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/great-vibes-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Great Vibes';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/great-vibes-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;
}

@font-face {
    font-family: 'Marck Script';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/marck-script-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Marck Script';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/marck-script-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Marck Script';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/marck-script-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;
}

/* Times New Roman: у кого он есть в системе — берётся он; на остальных устройствах (Android и др.) — Tinos, его бесплатный двойник с теми же размерами букв */
@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'), url('fonts/tinos-400-italic-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'), url('fonts/tinos-400-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'), url('fonts/tinos-400-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;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold Italic'), local('TimesNewRomanPS-BoldItalicMT'), url('fonts/tinos-700-italic-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold Italic'), local('TimesNewRomanPS-BoldItalicMT'), url('fonts/tinos-700-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold Italic'), local('TimesNewRomanPS-BoldItalicMT'), url('fonts/tinos-700-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;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman'), local('TimesNewRomanPSMT'), url('fonts/tinos-400-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman'), local('TimesNewRomanPSMT'), url('fonts/tinos-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Times New Roman'), local('TimesNewRomanPSMT'), url('fonts/tinos-400-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;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold'), local('TimesNewRomanPS-BoldMT'), url('fonts/tinos-700-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold'), local('TimesNewRomanPS-BoldMT'), url('fonts/tinos-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Times New Roman';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Times New Roman Bold'), local('TimesNewRomanPS-BoldMT'), url('fonts/tinos-700-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;
}


/* ===== Раскладка: макет слева, панель справа ===== */
.designer {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    gap: 32px;
    align-items: start;
}

/* На этой странице шапка ниже, чтобы макет было видно сразу */
.page-hero {
    padding: clamp(28px, 4vw, 48px) 0;
}

/* Макет держится посередине экрана (под липкой шапкой ~80px), пока прокручиваете панель справа.
   --stage-h (высоту макета с подписью) ставит designer.js */
.designer-stage {
    position: sticky;
    top: max(92px, calc(50vh + 40px - var(--stage-h, 0px) / 2));
}

.stage-frame {
    /* картинка не выше экрана: 150 × 136 см, место под шапку и подсказку */
    max-width: calc((100vh - 200px) * 150 / 136);
    margin: 0 auto;
    border: 1px solid var(--line);
    background: var(--stone);
    overflow: hidden;
}

.stage-frame canvas {
    display: block;
}

/* Увеличение макета: кнопки в правом верхнем углу */
.stage-frame {
    position: relative;
}

.zoom-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    gap: 6px;
}

.zoom-controls button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
}

.zoom-controls button:hover:not(:disabled) {
    border-color: var(--gold);
}

.zoom-controls button:disabled {
    opacity: 0.4;
    cursor: default;
}

.zoom-controls svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.designer.is-loading .zoom-controls {
    display: none;
}

.designer.is-loading .stage-frame {
    min-height: 320px;
    background: linear-gradient(90deg, var(--stone), #e9e3d9, var(--stone));
    background-size: 200% 100%;
    animation: designer-loading 1.2s linear infinite;
}

@keyframes designer-loading {
    to {
        background-position: -200% 0;
    }
}

.stage-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.designer-error {
    margin: 12px 0 0;
    color: #8a1f1f;
}

/* ===== Панель: три шага ===== */
.panel-step {
    margin-bottom: 20px;
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--line);
}

.panel-step h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 1.7rem;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--white);
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 600;
}

.panel-note {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 16px;
}

/* Список камней: миниатюры в одном масштабе, стоят «на земле» */
.stone-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stone-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    height: 100%;
    padding: 10px 4px 8px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.stone-btn:hover {
    border-color: var(--gold);
}

.stone-btn[aria-pressed="true"] {
    background: var(--white);
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--gold);
}

.stone-thumb {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 78px;
    margin-bottom: 6px;
    border-bottom: 2px solid #cdc4b6;
}

.stone-thumb img {
    max-width: none;      /* размер задаёт масштаб, а не ширина кнопки */
    height: auto;
}

.stone-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

.stone-size {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.3;
}

/* Кнопки «+ Имя» и т. д. */
/* Рисунки: прокручиваемая сетка, чтобы 75 картинок не растягивали панель */
.pic-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-height: 340px;
    margin: 0 0 18px;
    padding: 0 4px 0 0;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}

.pic-btn {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    background: #000;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
}

.pic-btn:hover,
.pic-btn:focus-visible {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--gold);
}

.pic-btn img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: contain;
}

.pic-btn span {
    position: absolute;
    left: 4px;
    bottom: 4px;
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    color: #fff;
    font-size: 16px;
    line-height: 1.3;
}

.add-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.btn-outline {
    min-height: 44px;
    border-color: var(--ink);
    background: transparent;
    color: var(--ink);
}

.btn-outline:hover {
    background: var(--ink);
    color: var(--white);
}

/* Настройки выбранной надписи */
.text-editor label,
.text-editor legend {
    display: block;
    margin: 0 0 6px;
    padding: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 500;
}

.text-editor textarea,
.text-editor select {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0 0 16px;
    padding: 10px 12px;
    background: var(--white);
    border: 1px solid #d5cdc1;
    border-radius: var(--radius);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
}

.text-editor textarea {
    height: 76px;
    resize: vertical;
}

.text-editor textarea:focus,
.text-editor select:focus {
    border-color: var(--gold);
    outline: 2px solid rgba(179, 145, 88, 0.3);
    outline-offset: 0;
}

.text-editor input[type="range"] {
    display: block;
    width: 100%;
    height: 44px;
    margin: 0 0 12px;
    accent-color: var(--gold);
}

.color-choice {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.text-editor .color-opt {
    margin: 0;
    font-weight: 400;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px 0 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 16px;
    cursor: pointer;
}

.text-editor .style-opt {
    padding: 0 20px;
}

.style-opt b {
    font-weight: 700;
}

.color-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-opt:has(input:checked) {
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}

.color-opt:has(input:focus-visible) {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.swatch {
    flex-shrink: 0;
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.swatch-gold {
    background: linear-gradient(180deg, #f7e6a6, #d6b04a 45%, #8c6a22);
}

.swatch-white {
    background: #f4f1ea;
}

.swatch-engraved {
    background: #1c1b19;
    box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.9), inset -1px -1px 0 #a9a49c;
}

.editor-empty {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

/* Отправка */
.send-step .btn-outline {
    width: 100%;
    margin-bottom: 22px;
}

/* ===== Планшеты ===== */
@media (max-width: 1000px) {
    .designer {
        grid-template-columns: minmax(0, 1fr);   /* колонка не растягивается под холст */
    }

    .designer-stage {
        position: static;
    }

    .stone-list {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    }
}

/* ===== Телефоны: макет прилипает к верху экрана, пока настраиваете надписи ===== */
@media (max-width: 767px) {
    .designer-section {
        padding-top: 0;
    }

    .designer {
        gap: 16px;
    }

    .designer-stage {
        position: sticky;
        top: 0;
        z-index: 50;
        margin: 0 calc(-1 * var(--gutter));
        padding: 8px var(--gutter) 6px;
        background: var(--paper);
        box-shadow: 0 6px 12px -10px rgba(0, 0, 0, 0.4);
    }

    .stage-hint {
        margin-top: 6px;
        line-height: 1.4;
    }

    .panel-step {
        padding: 20px 16px;
    }

    .stone-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
