@font-face {
    font-family: Golos;
    font-weight: 400 700;
    font-display: swap;
    src: url("media/golos-text-cyrillic.woff2") format("woff2");
    unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
    font-family: Golos;
    font-weight: 400 700;
    font-display: swap;
    src: url("media/golos-text-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+20AD-20C0,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
    --page: #f6f5f3;
    --paper: #fff;
    --ink: #26292e;
    --muted: #6b7178;
    --line: rgba(107, 113, 120, .27);
    --accent: #b3520c;
    --hover: #8f4009;
    --green: #1f5a41;
    --error: #a12b24;
    --placeholder: color-mix(in srgb, var(--page) 86%, var(--muted));
    --card-radius: 16px;
    --button-radius: 12px;
    --small-radius: 8px;
    color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--page);
    color: var(--ink);
    font: 400 1rem/1.5 Golos, system-ui, sans-serif;
}
h1, h2, h3, p, fieldset { margin: 0; }
h1, h2, h3 { line-height: 1.18; }
h1 { font-size: 2.5rem; letter-spacing: -.055em; }
h2 { font-size: 1.75rem; letter-spacing: -.04em; }
h3 { font-size: 1rem; letter-spacing: -.018em; }
fieldset { min-inline-size: 0; padding: 0; border: 0; }
legend { padding: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, .secondary, .primary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only, .skip:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 20; padding: 12px 20px; background: var(--paper); }
.wrap { width: min(calc(100% - 48px), 1040px); margin-inline: auto; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.bar-inner, .topbar nav, .brand, .nav-item, .place, .session-controls, .secondary, .primary, .photo-count, .list-title, .icon-button, .gallery-controls, .gallery-controls a {
    display: flex;
    align-items: center;
}
.bar-inner { justify-content: space-between; min-height: 68px; gap: 12px; }
.brand { gap: 4px; text-decoration: none; font-size: 1.75rem; font-weight: 700; letter-spacing: -.06em; }
.brand-mark {
    width: 36px;
    height: 40px;
    background: var(--accent);
    mask: url("media/oduvanchik.svg") center / contain no-repeat;
}
.topbar nav { gap: 8px; align-self: stretch; align-items: stretch; }
.nav-item {
    position: relative;
    gap: 8px;
    justify-content: center;
    padding: 0 16px;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
}
.nav-item[aria-current] { color: var(--accent); }
.nav-item[aria-current]::after { content: ''; background: var(--accent); position: absolute; bottom: 0; left: 16px; right: 16px; height: 3px; }
.nav-item:hover { color: var(--hover); }
.place { gap: 8px; color: var(--accent); font-size: .875rem; font-weight: 600; margin-bottom: 12px; }
.catalog-page, .admin-page { flex: 1; padding-bottom: 56px; }
.catalog-page { padding-top: 32px; }
.list-title { gap: 12px; margin-bottom: 20px; }
.list-title h1 { font-size: 1.75rem; letter-spacing: -.04em; }
.total { color: var(--muted); padding-inline: 8px; border: 1px solid var(--line); border-radius: var(--small-radius); font-size: .875rem; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; }
.product { display: block; min-width: 0; text-decoration: none; border-radius: var(--card-radius); }
.product-cover { position: relative; }
.product:hover h2 { color: var(--hover); text-decoration: underline; text-underline-offset: 3px; }
.product-photo, .main-photo {
    position: relative;
    display: grid;
    overflow: hidden;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: var(--placeholder);
    border-radius: var(--card-radius);
    border: 1px solid var(--line);
}
.product-photo > img, .main-photo > img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.placeholder { display: grid; place-content: center; justify-items: center; gap: 8px; color: color-mix(in srgb, var(--ink) 72%, var(--muted)); font-size: .75rem; }
.placeholder svg { color: color-mix(in srgb, var(--muted) 82%, var(--paper)); }
.price-tag {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 12px;
    border-radius: var(--small-radius);
    background: var(--paper);
    font-size: .875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.price-tag.free { background: var(--green); color: var(--paper); }
.photo-count { position: absolute; right: 8px; top: 8px; gap: 4px; border-radius: var(--small-radius); background: var(--ink); color: var(--paper); padding: 4px 8px; font-size: .75rem; }
.product h2, .preview-product h3 { margin: 12px 0 4px; font-size: 1rem; letter-spacing: -.018em; }
.product h2, .preview-product h3, .excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.excerpt, .hint, .selection-count, .field-count { font-size: .875rem; color: var(--muted); }
.detail { padding: 28px; width: min(880px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--paper); color: var(--ink); }
.dialog-backdrop { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; background: rgba(38,41,46,.55); }
.dialog-backdrop .detail { position: relative; margin: auto; }
.dialog-backdrop.native-dialog { display: contents; }
.dialog-backdrop .detail:modal { position: fixed; inset: 0; }
.detail::backdrop { background: rgba(38,41,46,.55); }
html:has(#product-detail[open]) { overflow: hidden; }
.mobile-back { display: none; }
.desktop-close { display: flex; }
.detail { overscroll-behavior-y: contain; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; }
.detail-copy { padding: 16px 20px 4px 0; overflow-wrap: anywhere; }
.detail-copy h2 { margin-bottom: 12px; }
.detail-price { font-size: 1.25rem; font-weight: 700; }
.free-text { color: var(--green); }
.description { white-space: pre-wrap; margin-top: 20px; }
.icon-button, .gallery-controls a { justify-content: center; width: 40px; height: 40px; border-radius: var(--button-radius); text-decoration: none; }
.close-detail { position: absolute; z-index: 1; top: 8px; right: 8px; background: var(--page); }
.icon-button:hover, .gallery-controls a:hover { background: var(--placeholder); }
.main-photo { aspect-ratio: 1; }
.photo-track {
    position: absolute;
    inset: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.photo-track::-webkit-scrollbar { display: none; }
.photo-track img {
    flex: 0 0 100%;
    min-width: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.gallery-controls { position: absolute; right: 8px; bottom: 8px; background: var(--paper); border-radius: var(--button-radius); font-size: .875rem; }
.thumbs, .selected-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumbs a, .selected-photo { position: relative; height: 56px; width: 56px; border: 1px solid var(--line); border-radius: var(--small-radius); }
.thumbs a[aria-current] { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumbs img, .selected-photo img { height: 100%; width: 100%; border-radius: inherit; object-fit: cover; }
.admin-page { padding-top: 40px; }
.login-page { flex: 1; display: grid; place-items: center; padding-block: 24px; }
.login-card, .panel { border: 1px solid var(--line); background: var(--paper); border-radius: var(--card-radius); padding: 28px; }
.login-card { width: min(100%, 392px); text-align: center; }
.login-card h1 { font-size: 1.75rem; }
.login-note { margin: 8px 0 24px; color: var(--muted); font-size: .875rem; }
.form-section legend, .form-section > label { font-weight: 600; line-height: 1.4; }
.hint { margin: 4px 0 12px; }
.primary, .secondary { justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: var(--button-radius); font-weight: 600; padding: 12px 20px; }
.primary { background: var(--accent); color: var(--paper); }
.primary:hover, .primary:active { background: var(--hover); }
.primary:disabled { opacity: .75; cursor: wait; }
.secondary { background: var(--paper); border-color: var(--line); font-size: .875rem; }
.secondary:hover, .secondary:active { border-color: var(--muted); }
.full { width: 100%; }
.alert, .success { padding: 12px 16px; border-left: 4px solid currentColor; border-radius: var(--small-radius); margin-block: 16px; }
.alert { background: color-mix(in srgb, var(--error) 8%, var(--paper)); color: var(--error); }
.success { background: color-mix(in srgb, var(--green) 8%, var(--paper)); color: var(--green); }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 24px; }
.manage-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.manage-link:hover, .manage-link:active { color: var(--hover); }
.manage-list { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.manage-row {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center;
    gap: 12px; padding-block: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
}
.manage-photo { display: grid; place-items: center; width: 64px; height: 64px; overflow: hidden; border-radius: var(--small-radius); background: var(--placeholder); color: var(--muted); }
.manage-photo img { width: 100%; height: 100%; object-fit: cover; }
.manage-row p { color: var(--muted); }
.delete-note { max-width: 560px; margin-block: 20px 16px; }
.delete-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.manage-row a, .admin-heading .secondary, .delete-actions a { text-decoration: none; }
.primary.danger { background: var(--error); }
.primary.danger:hover, .primary.danger:active { background: color-mix(in srgb, var(--error) 80%, var(--ink)); }
.session-controls { gap: 16px; }
.session-controls span { font-size: .875rem; color: var(--muted); }
.compact { padding: 8px 12px; }
.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    grid-template-areas: "fields preview" "actions preview";
    align-items: start;
    column-gap: 24px;
}
.editor { grid-area: fields; display: grid; gap: 24px; border-bottom: 0; border-radius: var(--card-radius) var(--card-radius) 0 0; }
.editor-actions { grid-area: actions; border: 1px solid var(--line); border-top: 0; background: var(--paper); border-radius: 0 0 var(--card-radius) var(--card-radius); padding: 0 28px 28px; }
.form-section .hint:last-child { margin-bottom: 0; }
.drop { display: flex; align-items: center; justify-content: center; position: relative; gap: 12px; min-height: 92px; padding: 16px; border: 1px dashed var(--muted); border-radius: var(--button-radius); background: var(--page); cursor: pointer; }
.drop:focus-within, .drop.is-over { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop:hover { border-color: var(--accent); }
.drop strong { color: var(--accent); font-size: .875rem; }
.drop small { display: block; font-size: .75rem; color: var(--muted); }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-icon { display: grid; place-items: center; width: 40px; height: 40px; background: var(--paper); border-radius: var(--small-radius); color: var(--accent); }
.selected-photos:empty { display: none; }
.selected-photo button { position: absolute; top: -4px; right: -4px; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: var(--small-radius); color: var(--ink); background: var(--paper); line-height: 1; }
.selection-count, .field-count { margin-top: 4px; font-size: .75rem; }
.field-count { text-align: right; }
.input-error, .field-count.invalid { color: var(--error); font-size: .875rem; }
.input-error { margin-top: 8px; }
textarea, .price-input input { width: 100%; padding: 12px; border-radius: var(--small-radius); border: 1px solid var(--muted); background: var(--paper); }
textarea { display: block; min-height: 112px; resize: vertical; }
textarea::placeholder, .price-input input::placeholder { color: var(--muted); }
.price-input { position: relative; margin: 8px 0; max-width: 240px; }
.price-input input { padding-right: 36px; }
.price-input span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.publish { justify-self: start; }
.preview { grid-area: preview; position: sticky; top: 20px; }
.preview summary { cursor: pointer; font-size: 1.25rem; font-weight: 600; }
.preview[open] > .preview-product { margin-top: 16px; }
.empty-results { margin-block: 20px; }
.phone-review { width: 100%; padding: 20px; }
.review-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; margin-bottom: 20px; }
.review-tools h1 { font-size: 1.25rem; }
.review-tools nav { display: flex; gap: 4px; }
.review-tools nav a { display: grid; place-items: center; min-height: 44px; padding-inline: 12px; border-radius: var(--small-radius); font-size: .875rem; text-decoration: none; }
.review-tools nav a[aria-current], #rotate[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.review-tools label { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.review-tools select { min-height: 44px; padding-inline: 8px; border: 1px solid var(--line); border-radius: var(--small-radius); background: var(--paper); color: var(--ink); font: inherit; }
.download-phone { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: .875rem; text-underline-offset: 3px; }
.review-screen { display: block; margin: 0 auto; border: 0; outline: 1px solid var(--line); max-width: 100%; max-height: max(480px, calc(100svh - 108px)); background: var(--paper); }
@media (max-width: 860px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .editor-layout { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); column-gap: 16px; }
    .login-card, .panel { padding: 20px; }
    .editor-actions { padding: 0 20px 20px; }
}
@media (max-width: 680px), (max-width: 920px) and (max-height: 500px) and (orientation: landscape) {
    :root {
        --mobile-left: max(16px, env(safe-area-inset-left, 0px));
        --mobile-right: max(16px, env(safe-area-inset-right, 0px));
        --mobile-bottom: env(safe-area-inset-bottom, 0px);
    }
    .wrap { width: auto; margin-left: var(--mobile-left); margin-right: var(--mobile-right); }
    .topbar { padding-top: env(safe-area-inset-top, 0px); }
    .bar-inner { min-height: 56px; flex-wrap: wrap; gap: 0 8px; }
    .brand { min-height: 48px; font-size: 1.25rem; }
    .brand-mark { width: 28px; height: 32px; }
    .topbar nav { gap: 8px; }
    .topbar a[aria-current][href="admin.php"] { display: none; }
    .nav-item { min-height: 48px; gap: 4px; padding-inline: 8px; }
    .nav-item[aria-current]::after { left: 8px; right: 8px; }
    .admin-heading h1 { font-size: 1.75rem; }
    .catalog-page { padding-top: 20px; }
    .list-title { gap: 8px; margin-bottom: 16px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
    .product h2, .preview-product h3 { margin: 4px 0; font-size: 1rem; line-height: 1.3; }
    .excerpt { line-height: 1.4; }
    .price-tag { position: static; display: block; padding: 0; margin-top: 8px; min-height: 0; font-size: 1.25rem; line-height: 1.2; letter-spacing: -.035em; background: none; overflow-wrap: anywhere; }
    .price-tag.free { color: var(--green); background: none; }
    .product:active h2 { color: var(--hover); }
    .product-photo .placeholder { font-size: .75rem; gap: 4px; }
    .product-photo .placeholder svg { width: 20px; height: 20px; }
    .product-photo { aspect-ratio: 1; }
    .catalog-page, .admin-page { padding-bottom: calc(24px + var(--mobile-bottom)); }
    .admin-page { padding-top: 20px; }
    .login-page { padding-top: max(24px, env(safe-area-inset-top, 0px)); padding-bottom: max(24px, var(--mobile-bottom)); }
    .editor-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "fields" "preview" "actions"; gap: 12px; }
    .editor, .login-card { padding: 16px; }
    .editor { border: 1px solid var(--line); border-radius: var(--card-radius); gap: 20px; }
    .editor-actions { background: transparent; border: 0; padding: 0; }
    .admin-heading { flex-wrap: wrap; align-items: flex-start; }
    .manage-row { grid-template-columns: 64px minmax(0, 1fr); }
    .manage-row .secondary { grid-column: 1 / -1; }
    .delete-actions { display: grid; }
    .session-controls span { display: none; }
    .session-controls { margin-top: 4px; }
    .price-input, .publish, .preview { width: 100%; max-width: none; }
    .primary, .secondary, .price-input input { min-height: 48px; }
    .drop { min-height: 80px; }
    .price-input input, textarea { font-size: max(16px, 1rem); }
    .selected-photos, .thumbs { flex-wrap: nowrap; min-width: 0; overflow-x: auto; gap: 8px; padding: 4px; }
    .selected-photo { width: 84px; height: 84px; flex: none; }
    .selected-photo button { top: 0; right: 0; width: 44px; height: 44px; font-size: 1.25rem; }
    .preview { position: static; padding: 0 16px; }
    .preview summary { padding-block: 12px; min-height: 48px; font-size: 1rem; }
    .preview[open] > .preview-product { margin: 0 auto 16px; width: calc((100vw - var(--mobile-left) - var(--mobile-right) - 12px) / 2); max-width: 100%; }
    .dialog-backdrop .detail {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
    }
    .detail-bar { position: sticky; z-index: 2; top: 0; padding: env(safe-area-inset-top, 0px) var(--mobile-right) 0 var(--mobile-left); background: var(--paper); border-bottom: 1px solid var(--line); }
    .close-detail { position: static; width: fit-content; height: 48px; padding-right: 12px; background: transparent; color: var(--accent); }
    .desktop-close { display: none; }
    .mobile-back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .875rem; }
    .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px var(--mobile-right) calc(24px + var(--mobile-bottom)) var(--mobile-left); }
    .gallery, .detail-copy { min-width: 0; }
    .detail-copy { padding: 0; }
    .detail-copy h2 { font-size: 1.75rem; margin-bottom: 8px; }
    .description { margin-top: 16px; line-height: 1.55; }
    .main-photo { width: 100%; height: auto; max-height: min(60svh, 480px); }
    .gallery-controls a { width: 44px; height: 44px; }
    .thumbs { margin-top: 8px; }
    .thumbs a { flex: 0 0 52px; height: 52px; }
    .close-detail:active, .gallery-controls a:active, .selected-photo button:active { background: var(--placeholder); }
}
@media (min-width: 600px) and (max-width: 920px) and (max-height: 500px) and (orientation: landscape) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .main-photo { max-height: 64svh; }
    .editor-layout { max-width: 640px; margin-inline: auto; }
    .preview[open] > .preview-product { width: calc((100vw - var(--mobile-left) - var(--mobile-right) - 24px) / 3); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
