/* ═══════════════════════════════════════
   Krasnova Patterns — Public stylesheet
   Fonts: Playfair Display + DM Sans (Google Fonts, loaded in layout.php)
   ═══════════════════════════════════════ */

:root {
    --bg:           #faf9f7;
    --bg-card:      #ffffff;
    --bg-soft:      #f0ece6;
    --text:         #714B42;
    --muted:        #9A7A72;
    --accent:       #714B42;
    --accent-dk:    #5a3a32;
    --border:       #e8e4df;
    --header-bg:    #FFBBBA;
    --white:        #fff;
    --error:        #b42318;
    --success:      #1a6b3a;
    --radius:       6px;
    --radius-pill:  100px;
    --shadow-sm:    0 1px 4px rgba(113,75,66,.07);
    --shadow:       0 4px 20px rgba(113,75,66,.11);
    --shadow-lg:    0 12px 40px rgba(113,75,66,.16);
    --ease:         cubic-bezier(.4,0,.2,1);
    --t:            0.22s;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
    height: 100%;
}

body {
    margin: 0;
    font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container { flex: 1; }

a { color: inherit; text-decoration: none; }
a:hover { opacity: .75; }

h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1.15;
}

.container { width: min(1160px, 93vw); margin: 0 auto; }

/* ── Scroll-reveal (added by JS only — no-JS: elements stay visible) ── */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal.visible { opacity: 1; transform: none; transition: none; }
}

/* ── Header ── */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid rgba(113,75,66,.12);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 0;
    gap: 1.5rem;
}
.logo { display: flex; align-items: center; line-height: 0; }
.logo-img { height: 46px; width: auto; display: block; }

.nav {
    display: flex;
    gap: 1.75rem;
    align-items: center;
    font-size: .9rem;
    font-weight: 500;
}
.nav a {
    position: relative;
    padding-bottom: 2px;
    color: var(--accent);
}
.nav a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    width: 0; height: 1.5px;
    background: var(--accent-dk);
    transition: width var(--t) var(--ease);
}
.nav a:hover { opacity: 1; }
.nav a:hover::after { width: 100%; }

.cart-link { position: relative; }
.cart-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--white);
    font-size: .65rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: var(--radius-pill);
    vertical-align: top;
    margin-left: 2px;
}

main.container { padding: 2.5rem 0 6rem; flex: 1; }

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--white);
    padding: 2.25rem 0;
    color: var(--muted);
    font-size: .875rem;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.social-links { display: flex; align-items: center; gap: 1.25rem; }
.social-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--muted);
    transition: color var(--t) var(--ease);
}
.social-link:hover { color: var(--accent); opacity: 1; }

/* ── Hero ── */
@keyframes heroIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
.hero {
    padding: 5rem 0 3.5rem;
    max-width: 700px;
    animation: heroIn .7s var(--ease) both;
}
@media (prefers-reduced-motion: reduce) { .hero { animation: none; } }

.hero-eyebrow {
    display: inline-block;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.25rem;
}
.hero h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 700;
    line-height: 1.05;
    margin: 0 0 1.25rem;
    letter-spacing: -.02em;
}
.hero h1 em {
    font-style: italic;
    color: var(--accent);
}
.lead {
    color: var(--muted);
    margin: 0 0 2.25rem;
    font-size: 1.05rem;
    max-width: 500px;
    line-height: 1.72;
}

/* How it works */
.how-it-works {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.25rem;
    margin-top: 3rem;
    box-shadow: var(--shadow-sm);
}
.how-it-works h2 { margin: 0 0 1.25rem; font-size: 1.3rem; }
.steps { padding-left: 1.4rem; margin: 0; }
.steps li { margin-bottom: .6rem; color: var(--muted); line-height: 1.6; }

/* ── Section ── */
.section { margin-top: 3rem; }
.section.narrow { max-width: 640px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.section-head h1,
.section-head h2 { margin: 0; }
.section-head a {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: .875rem;
    font-weight: 500;
    color: var(--accent);
    white-space: nowrap;
}
.section-head a:hover { opacity: .75; }

/* ── Category nav ── */
.cat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 2rem;
}
.cat-tab {
    padding: .4rem 1.1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-size: .875rem;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 500;
    background: transparent;
    cursor: pointer;
    transition: all var(--t) var(--ease);
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.cat-tab.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* ── Product grid ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.75rem;
}

.product-card-link { display: block; }
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
    box-shadow: var(--shadow-sm);
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    aspect-ratio: 4/5;
    background: var(--bg-soft);
    overflow: hidden;
    position: relative;
}
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--ease);
}
.product-card:hover .product-image img { transform: scale(1.06); }
.product-image.large { aspect-ratio: unset; min-height: 380px; }
.placeholder-image {
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(145deg, #ede8e1, #f7f4ef);
}
.placeholder-image.large { min-height: 380px; }

.product-card-body { padding: 1rem 1.1rem 1.25rem; }
.product-card-body h3 {
    font-family: 'Playfair Display', Georgia, serif;
    margin: 0 0 .4rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}
.price { font-weight: 600; margin: 0; font-size: .95rem; }
.price-lg {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin: .5rem 0 1.25rem;
}

/* ── Product detail ── */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    margin-top: 2rem;
}
@media (max-width: 780px) {
    .product-detail-grid { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* Gallery: thumbs left, main right */
.product-gallery {
    display: flex;
    gap: .75rem;
    align-items: start;
    min-width: 0;
}

/* Thumbs column — comes after main in HTML but appears on the left */
.gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex-shrink: 0;
    width: 72px;
    order: -1;
}
.gallery-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius);
    opacity: .55;
    display: block;
    max-width: 100%;
    transition: opacity var(--t) var(--ease), border-color var(--t) var(--ease);
    flex-shrink: 0;
}
.gallery-thumb:hover { opacity: .85; }
.gallery-thumb.active { border-color: var(--accent); opacity: 1; }

/* Main image — fixed aspect ratio, no layout shift */
.gallery-main {
    flex: 1;
    min-width: 0;
    aspect-ratio: 3/4;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-soft);
    position: relative;
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
    transition: opacity .22s ease, transform .45s var(--ease);
}
.gallery-main img.fading { opacity: 0; }
.gallery-main:hover img { transform: scale(1.02); }

@media (max-width: 780px) {
    .product-gallery {
        flex-direction: column;
        overflow: hidden;
    }
    .gallery-thumbs {
        order: 0;
        flex-direction: row;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 3px;
    }
    .gallery-thumbs::-webkit-scrollbar { display: none; }
    .gallery-thumb { width: 60px; height: 60px; flex-shrink: 0; }
    .gallery-main { aspect-ratio: 4/5; width: 100%; }
}

.product-info h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin: 0 0 .25rem;
}

.description {
    color: var(--muted);
    margin: 1rem 0;
    line-height: 1.78;
    font-size: .95rem;
}

/* ── Size selector ── */
.size-label-text {
    font-weight: 600;
    display: block;
    margin-bottom: .6rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}
.size-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.size-option { cursor: pointer; }
.size-option input { display: none; }
.size-tag {
    display: inline-block;
    padding: .45rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    cursor: pointer;
    user-select: none;
    transition: all var(--t) var(--ease);
    font-family: 'DM Sans', system-ui, sans-serif;
}
.size-tag:hover { border-color: var(--accent); }
.size-option input:checked + .size-tag {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--white);
}
.size-tag.no-pdf { opacity: .4; cursor: not-allowed; }
.size-tag small { font-size: .7rem; opacity: .7; }
.add-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1rem; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: .65rem 1.4rem;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: .9rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    transition: background var(--t) var(--ease),
                color var(--t) var(--ease),
                border-color var(--t) var(--ease),
                transform var(--t) var(--ease),
                box-shadow var(--t) var(--ease);
    white-space: nowrap;
}
.btn:hover {
    background: var(--accent);
    color: var(--white);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(113,75,66,.25);
}
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

.btn-sm { padding: .3rem .8rem; font-size: .8rem; }

.btn-danger { border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); border-color: var(--error); color: var(--white); }

.btn-secondary { background: var(--white); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--border); color: var(--text); box-shadow: none; }

/* ── Forms ── */
.form label { display: block; margin-bottom: 1rem; font-size: .9rem; font-weight: 500; }
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="number"],
.form input[type="password"],
.form input[type="file"],
.form textarea,
.form select {
    display: block;
    width: 100%;
    margin-top: .3rem;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
    outline: none;
}
.form input:focus,
.form textarea:focus,
.form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(113,75,66,.1);
}
.form .checkbox { display: flex; align-items: center; gap: .5rem; }
.form .checkbox input { width: auto; display: inline; margin: 0; }
.qty-input { width: 72px; }

/* ── Table ── */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: .9rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table th, .table td {
    border: 1px solid var(--border);
    padding: .7rem .85rem;
    text-align: left;
}
.table th {
    background: var(--bg-soft);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

/* ── Cart ── */
.cart-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.promo-block {
    margin-top: 1.75rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.promo-block h2 { margin: 0 0 .75rem; font-size: 1rem; }
.promo-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.promo-input {
    min-width: 220px;
    padding: .6rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    color: var(--text);
    transition: border-color var(--t) var(--ease);
    outline: none;
}
.promo-input:focus { border-color: var(--accent); }
.promo-applied { margin: 0 0 .75rem; }
.cart-summary {
    margin-top: 1.75rem;
    padding: 1.5rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
    box-shadow: var(--shadow-sm);
}
.discount-line { color: var(--success); margin: 0; }
.radio-group { border: none; padding: 0; margin: 0 0 1rem; }
.radio-group legend { margin-bottom: .5rem; font-size: .9rem; }
.radio-label { display: block; margin-bottom: .5rem; }
.total { font-size: 1.05rem; margin: 0; }

/* ── Checkout ── */
.checkout-summary {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    font-size: .95rem;
    box-shadow: var(--shadow-sm);
}
.checkout-summary h2 { margin: 0 0 .75rem; font-size: 1.1rem; }
.checkout-summary ul { padding-left: 1.2rem; margin: .5rem 0 .75rem; }

/* ── Alerts ── */
.alert {
    padding: .8rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    border: 1px solid #c8e6c9;
    background: #eef6ee;
}
.alert-error { background: #fef3f2; border-color: #fecdca; color: var(--error); }
.alert-success { background: #f0f9f0; border-color: #a3d9a5; color: var(--success); }

/* ── Misc ── */
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; }
.mt { margin-top: 1rem; }
.small-code {
    font-family: 'Courier New', monospace;
    font-size: .8rem;
    word-break: break-all;
    color: var(--muted);
    background: var(--bg-soft);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ── Status badges ── */
.status-badge { font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: #eee; }
.status-paid { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-cancelled { background: #f8d7da; color: var(--error); }
.status-refunded { background: #d1ecf1; color: #0c5460; }
.badge-ok { color: var(--success); font-size: .85rem; }

/* ── Download list ── */
.download-list { list-style: none; padding: 0; margin: 0; }
.download-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.dl-name { flex: 1; min-width: 200px; }
.download-item { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.download-item-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .35rem; }
.download-sub-files { padding-left: 1rem; display: flex; flex-direction: column; gap: .3rem; }
.download-sub-files a { font-size: .85rem; display: inline-flex; align-items: center; gap: .3rem; }

/* ── Account ── */
.order-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t) var(--ease);
}
.order-card:hover { box-shadow: var(--shadow); }
.order-card-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; font-size: .9rem; }

/* ── Mobile ── */
@media (max-width: 600px) {
    .logo-img { height: 36px; }
    .nav { gap: 1rem; font-size: .82rem; }
    .hero { padding: 3rem 0 2.5rem; }
    .hero h1 { font-size: clamp(1.45rem, 6.5vw, 2.2rem); overflow-wrap: break-word; word-break: break-word; }
    main.container { padding: 2rem 0 4rem; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    .product-card-body h3 { font-size: .9rem; }
    .section-head { flex-direction: column; gap: .4rem; align-items: flex-start; }
    .how-it-works { padding: 1.5rem; }
}

/* ════════════════════════════════════════
   Admin — scoped to .admin-body
   ════════════════════════════════════════ */
.admin-body { background: #f3f2ef; }
.admin-header { background: var(--accent); color: var(--white); }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; }
.admin-header .logo { color: var(--white); font-size: 1rem; }
.admin-header nav { display: flex; gap: 1.25rem; }
.admin-header nav a { color: rgba(255,255,255,.85); font-size: .9rem; }
.admin-header nav a:hover { color: var(--white); opacity: 1; }
.admin-main { padding-top: 1.75rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1.25rem 0 2rem; }
.stat-card { background: var(--white); border: 1px solid var(--border); padding: 1rem 1.25rem; border-radius: var(--radius); }
.stat-card span { display: block; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { font-size: 1.75rem; }

.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--error); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; font-size: .85rem; }
.link-btn-neutral { color: var(--muted); font-size: .85rem; text-decoration: underline; background: none; border: none; cursor: pointer; font: inherit; }
.link-btn-danger { color: var(--error); background: none; border: none; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; font-size: .85rem; }
.inline-upload { display: inline-flex; align-items: center; gap: .4rem; }
.mini-file { font-size: .75rem; }
.order-meta p { margin: .3rem 0; font-size: .95rem; }
.inline-status { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin: 1.5rem 0; }
.inline-status select { width: auto; min-width: 180px; }

.edit-sections { display: flex; flex-direction: column; gap: 2rem; }
.edit-section { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.edit-section h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.edit-section h3 { margin: 1.5rem 0 .75rem; font-size: .95rem; }

.image-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.image-item { position: relative; }
.image-item img { width: 110px; height: 110px; object-fit: cover; display: block; border: 1px solid var(--border); border-radius: 2px; }
.image-item .link-btn { display: block; font-size: .7rem; text-align: center; margin-top: 2px; }

.upload-form { margin-top: .75rem; display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.add-size-form { border-top: 1px solid var(--border); padding-top: 1.25rem; margin-top: 1rem; }

.danger-zone { border-color: #f8d7da; }
.danger-zone h2 { color: var(--error); }

.size-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: #fafaf9; }
.size-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.size-label { font-size: 1rem; }
.size-files { font-size: .9rem; }
.field-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: .4rem; }
.file-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.file-item { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-upload-multi { display: inline-flex; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
