:root{
  --bg:#0f0f12;
  --fg:#f4f4f7;
  --muted:#b8b8c4;
  --card:#17171d;
  --line:rgba(255,255,255,.12);
  --accent:#ff7a00;
  --radius:18px;
  --shadow: 0 14px 30px rgba(0,0,0,.35);
  --max:1080px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
*{box-sizing:border-box}
html,body{height:100%}
html.lang-loading body{opacity:0}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 900px at 20% -10%, rgba(255,122,0,.18), transparent 55%),
              radial-gradient(1200px 900px at 90% 10%, rgba(0,190,255,.14), transparent 52%),
              var(--bg);
  color:var(--fg);
}
a{color:inherit; text-decoration:none}
img{max-width:100%; display:block; image-orientation: from-image;}
.container{max-width:var(--max); margin:0 auto; padding:18px}
header{
  position:sticky; top:0; z-index:40;
  backdrop-filter: blur(10px);
  background: rgba(15,15,18,.62);
  border-bottom:1px solid var(--line);
}
.nav{display:flex; align-items:center; gap:12px; justify-content:space-between;}
.brand{font-weight:800; letter-spacing:.06em; display:flex; align-items:baseline; gap:10px;}
.brand .dot{width:8px; height:8px; border-radius:99px; background:var(--accent); box-shadow:0 0 0 6px rgba(255,122,0,.15)}
.menu{display:flex; gap:14px; align-items:center; flex-wrap:wrap}
.menu a{opacity:.88; padding:10px 10px; border-radius:12px;}
.menu a:hover{background:rgba(255,255,255,.06); opacity:1}
.actions{display:flex; gap:10px; align-items:center}

/* --- Language buttons (stable RU/EN text, not emoji flags) --- */
.langText{
  min-width:44px;
  height:40px;
  padding:0 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:var(--fg);
  font-weight:900;
  letter-spacing:.06em;
  cursor:pointer;
}
.langText:hover{background:rgba(255,255,255,.10)}
.langText:active{transform: translateY(1px)}
.iconbtn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 12px; border-radius:14px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}
.iconbtn:hover{background:rgba(255,255,255,.09)}
.icon{width:18px; height:18px; display:block; opacity:.95}
.badge{
  min-width:18px; height:18px; padding:0 6px;
  border-radius:999px; background:rgba(255,122,0,.22);
  border:1px solid rgba(255,122,0,.45);
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700;
}
.hero{padding:22px 0 6px;}
.h1{font-size:32px; font-weight:850; margin:0 0 8px}
.p{margin:0; color:var(--muted); line-height:1.5}
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
}
.section{margin:18px 0}
.grid{display:grid; grid-template-columns: repeat(12, 1fr); gap:14px;}
.col-12{grid-column: span 12}
.col-6{grid-column: span 6}
.col-4{grid-column: span 4}
@media (max-width: 860px){
  .menu{display:none}
  .col-6,.col-4{grid-column: span 12}
  .h1{font-size:28px}
}
.cardpad{padding:16px}
.small{font-size:13px; color:var(--muted)}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px; padding:12px 14px; border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--fg); cursor:pointer; user-select:none; font-weight:700;
}
.btn:hover{background:rgba(255,255,255,.10)}
.btn.primary{border-color:rgba(255,122,0,.55); background:rgba(255,122,0,.16);}
.btn.primary:hover{background:rgba(255,122,0,.22)}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
hr.sep{border:none; border-top:1px solid var(--line); margin:14px 0}
.input, textarea{
  width:100%; padding:12px 12px; border-radius:14px;
  border:1px solid rgba(255,255,255,.14); background:rgba(0,0,0,.24);
  color:var(--fg); outline:none;
}
textarea{min-height:120px; resize:vertical}
.label{font-size:13px; color:var(--muted); margin:10px 0 6px}
.gallery{display:grid; grid-template-columns: repeat(12, 1fr); gap:14px;}
.gitem{grid-column: span 4}
/* Responsive gallery columns */
@media (max-width: 1100px){ .gitem{grid-column: span 6;} } /* 2 columns */
@media (max-width: 700px){ .gitem{grid-column: span 12;} } /* 1 column */

/* Adaptive image frame (keeps same "frame" size on any screen) */
.tile .thumb{height:260px; overflow:hidden; border-radius:18px; border:1px solid var(--line); background:rgba(255,255,255,.03);}
.tile .thumb img{width:100%; height:100%; object-fit:cover; object-position:50% 15%; touch-action:none; cursor:grab;}
/* Backward compatibility if a tile still has img directly */
.tile > img{width:100%;height:auto;display:block;border-radius:14px;}
@media (max-width: 860px){ .gitem{grid-column: span 12} }
.tile{overflow:hidden; border-radius:18px; border:1px solid var(--line); background:rgba(255,255,255,.03);}
.tile img{width:100%;display:block;}
.tile .tpad{padding:12px}
.tag{display:inline-flex; padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.04); font-size:12px; color:var(--muted)}
.modal{position:fixed; inset:0; display:flex; z-index:80; background:rgba(0,0,0,.62); align-items:center; justify-content:center; padding:18px;
  opacity:0; visibility:hidden; pointer-events:none;
  transition: opacity .22s ease;
}
.modal.open{opacity:1; visibility:visible; pointer-events:auto;}
.modalbox{max-width:980px; width:100%; max-height:92vh; border-radius:22px; border:1px solid rgba(255,255,255,.16); background:rgba(20,20,26,.96); box-shadow: 0 30px 80px rgba(0,0,0,.65); overflow:hidden;}

/* "Magic" fly-in hero image */
[data-modal-hero]{
  will-change: transform, opacity;
  transition: transform .55s cubic-bezier(.2,.8,.2,1), opacity .55s ease;
}

/* Small, subtle buttons inside image modal */
.mActions{display:flex; gap:10px; justify-content:center; align-items:center; padding:12px 14px 16px;}
.mBtnGhost{font-size:12px; padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.08); color:rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  opacity:.65;
}
.mBtnGhost:hover{opacity:.95}
.modalbox .mhead{display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--line)}
.close{cursor:pointer; opacity:.8}
.close:hover{opacity:1}
.mcontent{padding:16px}
.mimgwrap{
  max-height: 78vh;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.mimg{width:100%; height:auto; display:block;}
.mgrid{display:grid; grid-template-columns: 1.2fr .8fr; gap:14px}
@media (max-width: 860px){ .mgrid{grid-template-columns:1fr} }

/* ---- Gallery tiles: always fit image INSIDE the frame (no cropping) ---- */
.tile .thumb img{
  object-fit: contain; /* вместо cover — помещаем целиком */
  background: rgba(0,0,0,.25);
}

/* ---- Modal: allow scrolling if image is larger than the viewport ---- */
.modalbox{
  max-height: 92vh;
}
.modalbox .mcontent{
  overflow: auto;
  max-height: calc(92vh - 58px); /* минус высота шапки модалки */
}
.mimgwrap{
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  overflow: auto;
  max-height: 78vh;
}
.mimg{
  width: 100%;
  height: auto;
  display: block;
}
/* (dup cleanup) */


/* --- Adaptive image frames (catalog/shop) --- */
.thumb{
  width:100%;
  aspect-ratio: 4 / 3;
  max-height: 320px;
  border-radius:18px;
  overflow:hidden;
  background:rgba(255,255,255,.03);
  border:1px solid var(--line);
}
@media (max-width: 1200px){
  .thumb{max-height: 280px;}
}
@media (max-width: 860px){
  .thumb{
    aspect-ratio: 16 / 10;
    max-height: 260px;
  }
}
.thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  /* показываем верх чуть чаще (как просил) */
  object-position: 50% 18%;
  display:block;
}

/* --- Modal image: fit screen + allow vertical scroll/pan --- */
.mcontent{
  max-height: calc(100vh - 140px);
  overflow:auto;
}
.mimgwrap{
  width:100%;
  max-height: 72vh;
  overflow:auto;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
  -webkit-overflow-scrolling: touch;
}
.mimgwrap img{
  width:100%;
  height:auto;
  display:block;
}

/* --- Cart list --- */
.cartlist{display:flex; flex-direction:column; gap:12px;}
.cartrow{
  display:grid;
  grid-template-columns: 110px 1fr auto;
  gap:12px;
  padding:10px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  background:rgba(255,255,255,.03);
}
@media (max-width: 860px){
  .cartrow{grid-template-columns: 90px 1fr; }
  .cartsum{grid-column: 1 / -1; display:flex; justify-content:flex-end}
}
.cartimg{
  width:110px; height:84px;
  border-radius:14px; overflow:hidden;
  background:rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.10);
}
@media (max-width: 860px){
  .cartimg{width:90px; height:70px;}
}
.cartimg img{width:100%; height:100%; object-fit:cover; object-position: 50% 20%;}
.carttitle{font-weight:800; margin-bottom:4px}
.cartqty{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px}
.qtybtn{
  padding:8px 10px; border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--fg); cursor:pointer; font-weight:800;
}
.qtybtn:hover{background:rgba(255,255,255,.10)}
.qtybtn.danger{border-color:rgba(255,80,80,.35); background:rgba(255,80,80,.08)}
.qtybtn.danger:hover{background:rgba(255,80,80,.12)}
.qtynum{min-width:24px; text-align:center; font-weight:800}
.cartprice{font-weight:900; font-size:18px}
.disabled{opacity:.55; pointer-events:none}


.imgwrap{max-height:72vh; overflow:auto; border-radius:18px; border:1px solid var(--line); background:rgba(255,255,255,.03);}
.imgwrap img{width:100%; height:auto; display:block;}
/* --- Shop cards (one-of-one) --- */
.shop-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  gap:16px;
  align-items:start;
}
@media (max-width: 860px){
  .shop-grid{grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));}
}

.product-card{
  position:relative;
  border:1px solid rgba(255,255,255,.12);
  border-radius:18px;
  background:rgba(255,255,255,.03);
  padding:10px;
}

/* --- Shop: click image to expand/collapse (NO modal) --- */
.product-image{
  position:relative;
  overflow:hidden;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  height:220px; /* компактный режим */
  transition:height .35s ease, max-height .35s ease;
}
.product-image img{width:100%; height:100%; object-fit:contain; display:block; cursor: zoom-in; background:rgba(0,0,0,.18)}
.product-card.is-zoom .product-image{height:auto; max-height:72vh; overflow:auto;}
.product-card.is-zoom .product-image img{height:auto;}
.product-card.is-zoom .product-image img{cursor: zoom-out;}

/* --- Details overlay: slides up over ~half of the photo --- */
.detail-overlay{
  position:absolute;
  left:0; right:0; bottom:0;
  height:50%;
  padding:14px 14px 16px;
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  transform: translateY(110%);
  opacity:0;
  transition: transform .35s ease, opacity .35s ease;
  pointer-events:none;
}
.product-card.show-details .detail-overlay{
  transform: translateY(0);
  opacity:1;
  pointer-events:auto;
}
.detail-overlay .detail-text{
  font-size:13px;
  line-height:1.45;
  color:rgba(255,255,255,.92);
  white-space:pre-wrap;
  overflow:auto;
  max-height:100%;
}
.product-card .thumb{max-height: 220px;}
.product-title{font-weight:800; margin:10px 0 6px}
.price-row{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.price-tag{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.04);
  cursor:pointer;
  user-select:none;
  font-weight:800;
}
.price-tag:active{transform: translateY(1px)}
.price-tag.sold{
  border-color: rgba(128, 32, 48, .55);
  background: rgba(128, 32, 48, .12);
}

.sold-stamp{
  position:absolute;
  top:12px;
  right:12px;
  padding:8px 12px;
  border:2px solid rgba(128, 32, 48, .85);
  color:rgba(255,255,255,.95);
  background:rgba(128, 32, 48, .18);
  border-radius:12px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  transform: rotate(-10deg);
  backdrop-filter: blur(6px);
}

.product-actions{margin-top:10px;}
.product-actions .btn{width:100%;}

/* ===== v15 layout tweaks (Shop + Cart) ===== */

/* Bigger product cards + photos */
.products-grid{
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.product-card{
  max-width: 340px;
}
.product-thumb{
  max-height: 220px;
}
.product-meta{
  gap: 10px;
}

/* Smaller "Add to cart" button (not full width) */
.btn.btn-sm{
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 14px;
}
.product-actions{
  justify-content: center;
}
.product-actions .btn{
  width: auto;
  min-width: 110px;
}

/* Sold stamp: darker burgundy, not too bright */
.price-tag.sold{
  background: #5d1a22;
  border-color: #8f3a45;
}

/* Cart as a grid of cards with bigger photos */
.cart-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.cart-card{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
}
.cart-card-media{
  position: relative;
}
.cart-card-thumb{
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
}
.cart-qty{
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.10);
  font-weight: 700;
  font-size: 12px;
}
.cart-card-body{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cart-name{
  font-weight: 800;
  font-size: 16px;
  line-height: 1.15;
}
.cart-card-actions{
  display: flex;
  justify-content: flex-end;
}


/* Darker burgundy for SOLD */
.price-tag.sold{
  background: #5d1a22;
  border-color: #8f3a45;
}
/* cart badge */
.cart-btn{ position:relative; }
.cart-badge{
  position:absolute;
  top:-6px; right:-6px;
  min-width:20px; height:20px;
  padding:0 6px;
  border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:800;
  background:#c57a1b;
  color:#111;
}
.cart-badge.is-hidden{ display:none; }

/* product id */
.pid, .cid{
  margin-top:6px;
  font-size:12px;
  opacity:.75;
  letter-spacing:.3px;
}

/* kill catalog counters everywhere */
.catalog-count, .photos-count, #photoCount, .photo-count{ display:none !important; }
.photo-meta, .photo-label, .photo-number{ display:none !important; }


/* --- Fullscreen "Details" overlay (no scrollbar visible) --- */
body.details-open{overflow:hidden;}

.details-fullscreen{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}
.details-fullscreen.open{
  opacity:1;
  pointer-events:auto;
}
.details-panel{
  width:min(900px, 100%);
  max-height:min(86vh, 900px);
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(12,12,16,.86);
  box-shadow: 0 18px 70px rgba(0,0,0,.45);
  transform: translateY(10px) scale(.98);
  transition:transform .18s ease;
  overflow:hidden;
}
.details-fullscreen.open .details-panel{
  transform: translateY(0) scale(1);
}
.details-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.details-title{
  font-weight:900;
  letter-spacing:.2px;
}
.details-close{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:inherit;
  cursor:pointer;
}
.details-close:hover{ background:rgba(255,255,255,.10); }
.details-body{
  padding:16px 16px 18px;
  line-height:1.45;
  white-space:pre-wrap;
  overflow:auto; /* scroll allowed, but scrollbar hidden */
  max-height: calc(min(86vh, 900px) - 60px);
  scrollbar-width:none; /* Firefox */
}
.details-body::-webkit-scrollbar{ width:0; height:0; } /* Chrome/Safari */


/* ===== MOBILE FIXES (center buttons + faster first paint) ===== */

/* Center action buttons in product cards (Shop) */
.product-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
}
.product-actions .btn{
  width:auto;
}

/* Center qty/buttons in Cart on narrow screens */
@media (max-width: 520px){
  .cartqty{
    justify-content:center;
  }
}
