:root{
  --bg:#f5f6fa;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --brand:#2563eb;
  --soft:#f1f5f9;
  --shadow: 0 12px 30px rgba(17,24,39,.06);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:var(--bg);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
img{display:block}

.container{max-width:1040px;margin:0 auto;padding:16px}
@media (min-width:768px){ .container{padding:24px} }

.breadcrumb{font-size:13px;color:var(--muted);margin:6px 0 14px}
.breadcrumb a{color:var(--brand)}

.layout{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}
@media (min-width:980px){
  .layout{grid-template-columns: 1.35fr .65fr}
}

.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: var(--shadow);
}
@media (min-width:768px){ .panel{padding:16px} }

/* header */
.head{display:flex;gap:12px;align-items:center}
.icon{
  width:72px;height:72px;border-radius:16px;
  object-fit:cover;background:var(--soft);border:1px solid var(--line);
  flex:0 0 auto;
}
.title{margin:0;font-size:20px;font-weight:900;line-height:1.2}
.slug{
  margin-top:6px;color:var(--muted);font-size:13px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  max-width:72vw;
}
@media (min-width:980px){ .slug{max-width:560px} }

.badges{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.badge{
  font-size:12px;color:var(--muted);
  border:1px solid var(--line);
  background:#fafafa;
  padding:6px 10px;border-radius:999px;
}

.desc{margin-top:12px;line-height:1.6;white-space:pre-wrap;color:#1f2937}

/* ===== Preview carousel (auto height theo tỉ lệ ảnh) ===== */
.preview-block{margin-top:16px}
.preview-title{margin:0 0 10px 0;font-size:14px;font-weight:900}

.preview-shell{
  position:relative;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
  transition: height .18s ease;
}

/* track paging */
.preview-track{
  display:flex;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: thin;
}
.preview-track::-webkit-scrollbar{height:8px}
.preview-track::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:999px}

.preview-slide{
  flex:0 0 100%;
  scroll-snap-align:start;
  padding:10px;
}

/* card: KHÔNG set height cứng nữa, JS sẽ set height */
.preview-card{
  width:100%;
  border-radius:14px;
  background:#ffffff;          /* đổi sang trắng */
  overflow:hidden;
  cursor:zoom-in;
  border:1px solid var(--line);
  transition: height .18s ease;
}

.preview-img{
  width:100%;
  height:100%;
  object-fit:contain;       /* vẫn trọn ảnh */
  background:#ffffff;          /* nền trắng */
  display:block;
}

/* arrows: chỉ mũi tên */
.pnav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  border:none;
  background:transparent;
  padding:0 10px;
  font-size:28px;
  line-height:1;
  color:rgba(17,24,39,.65);
  cursor:pointer;
  user-select:none;
}
.pnav:hover{color:rgba(37,99,235,.95)}
.pnav:active{transform:translateY(-50%) scale(.98)}
.pnav.left{left:6px}
.pnav.right{right:6px}

/* dots */
.dots{
  display:flex;
  gap:6px;
  justify-content:center;
  padding:10px 10px 12px;
  background:#fff;
  border-top:1px solid var(--line);
}
.dot{width:8px;height:8px;border-radius:999px;background:#d1d5db}
.dot.active{background:var(--brand)}

/* ===== Actions ===== */
.side-title{margin:0 0 10px 0;font-size:14px;font-weight:900}
.actions{display:flex;flex-direction:column;gap:10px}

.action{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  transition:.12s;
}
.action:hover{border-color:rgba(37,99,235,.35)}
.action:active{transform:scale(.99)}

.action .left{min-width:0}
.action .k{
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.pill{
  flex:0 0 auto;
  font-size:12px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid rgba(37,99,235,.18);
  background:rgba(37,99,235,.08);
  color:var(--brand);
  font-weight:900;
}

.note{margin-top:8px;font-size:12px;color:var(--muted);line-height:1.45}

/* ===== Lightbox ===== */
.lightbox{
  position:fixed;
  inset:0;
  display:none;
  background:rgba(0,0,0,.82);
  z-index:9999;
  padding:16px;
}
.lightbox.show{display:flex;align-items:center;justify-content:center}
.lightbox img{
  max-width:96vw;
  max-height:90vh;
  border-radius:14px;
  background:#000;
  box-shadow:0 20px 80px rgba(0,0,0,.45);
}
.lightbox .close{
  position:absolute;
  top:12px; right:12px;
  width:40px;height:40px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background:rgba(255,255,255,.12);
  color:#fff;
  font-size:20px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
}
