/* =========================================================
   KINGG CATALOG — PUBLIC VIEWER
   Design language: Apple Store catalog — single system type
   family across all weights, generous white space, off-white
   (#F5F5F7) card surfaces, near-black ink text, one accent
   color (Kingg red) doing the job Apple reserves for blue.
   ========================================================= */

:root {
  --white: #FFFFFF;
  --smoke: #F5F5F7;
  --smoke-dark: #E8E8ED;
  --ink: #1D1D1F;
  --gray: #86868B;
  --gray-light: #AEAEB2;
  --hairline: #D2D2D7;
  --red: #CB202D;
  --red-dark: #A0181F;
  --red-soft: #FBEAEA;
  --green: #1E8E3E;
  --green-soft: #E6F5EA;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--white); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.47059;
  -webkit-font-smoothing: antialiased; font-weight: 400;
  opacity: 0; animation: bodyIn .5s ease forwards;
}
@keyframes bodyIn { to { opacity: 1; } }
h1, h2, h3 { font-family: var(--font); font-weight: 600; letter-spacing: -0.022em; margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
::selection { background: var(--red-soft); color: var(--red-dark); }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.8); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline); padding: 0 22px; height: 52px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; transition: height .25s var(--ease), box-shadow .25s var(--ease);
}
.nav.scrolled { height: 44px; box-shadow: 0 1px 0 rgba(0,0,0,0.03); }
.nav-brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.nav-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.nav-mark img { width: 100%; height: 100%; object-fit: contain; }
.nav-search { flex: 1; max-width: 420px; position: relative; }
.nav-search input {
  width: 100%; padding: 8px 14px 8px 34px; border-radius: 980px; border: none;
  font-size: 13.5px; outline: none; transition: background .15s, box-shadow .15s; background: var(--smoke); font-family: inherit;
}
.nav-search input:focus { background: var(--white); box-shadow: 0 0 0 3px rgba(203,32,45,0.12), inset 0 0 0 1px var(--hairline); }
.nav-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 13px; pointer-events: none; }
.nav-tag { font-size: 12px; color: var(--gray); display: none; white-space: nowrap; }
@media (min-width: 900px) { .nav-tag { display: block; } }

.nav-cart-btn {
  position: relative; display: flex; align-items: center; gap: 6px; color: var(--ink);
  font-weight: 500; font-size: 13.5px; flex-shrink: 0; padding: 6px 4px; transition: opacity .15s;
}
.nav-cart-btn:hover { opacity: .6; }
.nav-cart-badge {
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 999px; display: none; align-items: center; justify-content: center; padding: 0 4px;
  position: absolute; top: -4px; right: -8px;
}
.nav-cart-badge.show { display: flex; animation: bump .3s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ---------- Hero ---------- */
.hero {
  padding: 96px 22px 56px; text-align: center; background: var(--white);
}
.hero-eyebrow {
  font-size: 13px; font-weight: 600; color: var(--red); letter-spacing: -0.01em; margin-bottom: 14px;
  opacity: 0; animation: fadeUp .6s .05s var(--ease) forwards;
}
.hero h1 {
  font-size: clamp(34px, 5.6vw, 64px); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 16px;
  opacity: 0; animation: fadeUp .6s .12s var(--ease) forwards;
}
.hero h1 span { color: var(--red); }
.hero p {
  color: var(--gray); font-size: clamp(17px, 2.2vw, 21px); max-width: 560px; margin: 0 auto 36px; line-height: 1.4; font-weight: 400;
  opacity: 0; animation: fadeUp .6s .18s var(--ease) forwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.hero-search {
  max-width: 480px; margin: 0 auto; position: relative;
  opacity: 0; animation: fadeUp .6s .24s var(--ease) forwards;
}
.hero-search input {
  width: 100%; padding: 15px 20px 15px 46px; border-radius: 980px; border: 1px solid var(--hairline);
  font-size: 16px; outline: none; background: var(--smoke); font-family: inherit;
  transition: background .2s, box-shadow .2s;
}
.hero-search input:focus { background: var(--white); box-shadow: 0 0 0 4px rgba(203,32,45,0.10); }
.hero-search .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 16px; }

/* ---------- Category tabs (Apple Store style — text tabs, not filled pills) ---------- */
.pills-wrap { padding: 0 22px 32px; border-bottom: 1px solid var(--hairline); }
.pills {
  display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; max-width: 1100px; margin: 0 auto;
  padding-bottom: 14px;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0; padding: 0 0 6px; background: none; border: none; border-bottom: 2px solid transparent;
  font-size: 14.5px; font-weight: 500; color: var(--gray); cursor: pointer; transition: color .15s var(--ease), border-color .15s var(--ease);
  white-space: nowrap; font-family: inherit;
}
.pill:hover { color: var(--ink); }
.pill.active { color: var(--ink); border-bottom-color: var(--red); font-weight: 600; }

/* ---------- Product grid ---------- */
.grid-section { padding: 40px 22px 120px; max-width: 1200px; margin: 0 auto; }
.grid-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.grid-meta .count { color: var(--gray); font-size: 13.5px; font-weight: 500; }
#productGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px;
}
.p-card {
  background: var(--smoke); border-radius: var(--radius); overflow: hidden; border: none;
  cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  opacity: 0; animation: cardIn .5s var(--ease) forwards; display: block; position: relative;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.p-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(0,0,0,0.08); }
.p-card .img-box { position: relative; aspect-ratio: 1/0.92; background: var(--smoke); overflow: hidden; padding: 22px; }
.p-card .img-box img {
  position: absolute; inset: 0; margin: 22px; width: calc(100% - 44px); height: calc(100% - 44px);
  object-fit: contain; transition: opacity .5s ease, transform .5s var(--ease);
}
.p-card .img-box img.img-b { opacity: 0; }
.p-card:hover .img-box img.img-a { opacity: 0; }
.p-card:hover .img-box img.img-b { opacity: 1; }
.p-card:hover .img-box img { transform: scale(1.03); }
.p-card .img-box .no-img { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--gray-light); font-size: 12.5px; }
.p-card .img-count {
  position: absolute; bottom: 10px; right: 10px; background: rgba(29,29,31,0.75); color: #fff; font-size: 10.5px;
  font-weight: 600; padding: 3px 8px; border-radius: 6px; backdrop-filter: blur(4px);
}
.p-card .cat-tag {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,0.9); color: var(--ink); font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px;
}
.p-card .info { padding: 4px 18px 20px; background: var(--white); }
.p-card .name { font-weight: 590; font-size: 15px; line-height: 1.35; letter-spacing: -0.01em; margin-bottom: 3px; padding-top: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-card .item-no { font-size: 12px; color: var(--gray); margin-bottom: 12px; }
.p-card .price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-card .price { font-weight: 590; color: var(--ink); font-size: 15px; }
.p-card .price .unit { font-size: 11.5px; color: var(--gray); font-weight: 400; }
.add-cart-btn {
  border: none; background: var(--ink); color: #fff; width: 30px; height: 30px; border-radius: 50%;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s, transform .12s var(--ease); line-height: 1;
}
.add-cart-btn:hover { background: var(--red); }
.add-cart-btn:active { transform: scale(.88); }
.add-cart-btn.added { background: var(--green); }

/* skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--smoke) 25%, var(--smoke-dark) 37%, var(--smoke) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.empty-state { text-align: center; padding: 90px 20px; color: var(--gray); }
.empty-state .icon { font-size: 40px; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { margin-bottom: 8px; color: var(--ink); font-size: 21px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--smoke); color: var(--gray); padding: 44px 22px; text-align: center; font-size: 12.5px; border-top: 1px solid var(--hairline); line-height: 1.7; }
.site-footer strong { color: var(--ink); font-weight: 600; }

/* ---------- Toast ---------- */
.toast-pop {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 980px; font-size: 13.5px; font-weight: 500; z-index: 500; box-shadow: 0 20px 40px rgba(0,0,0,0.18);
  opacity: 0; transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast-pop.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Sticky cart bar ---------- */
.cart-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(140%);
  background: var(--ink); color: #fff; border-radius: 980px; padding: 10px 10px 10px 22px;
  display: flex; align-items: center; gap: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.22); z-index: 200;
  transition: transform .5s cubic-bezier(.34,1.4,.44,1); max-width: 92vw;
}
.cart-bar.show { transform: translateX(-50%) translateY(0); }
.cart-bar .cart-bar-info { font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.cart-bar .cart-bar-info strong { color: #fff; font-weight: 600; }
.cart-bar a.cart-bar-btn {
  background: var(--red); color: #fff; padding: 10px 20px; border-radius: 980px; font-weight: 500; font-size: 13.5px;
  white-space: nowrap; transition: background .15s;
}
.cart-bar a.cart-bar-btn:hover { background: var(--red-dark); }

/* ---------- Product detail page ---------- */
.pd-wrap { max-width: 1100px; margin: 0 auto; padding: 32px 22px 110px; }
.breadcrumb { font-size: 12.5px; color: var(--gray); margin-bottom: 28px; }
.breadcrumb a:hover { color: var(--ink); }
.pd-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; }
@media (max-width: 860px) { .pd-grid { grid-template-columns: 1fr; gap: 32px; } }

.pd-gallery-main {
  aspect-ratio: 1; background: var(--smoke); border-radius: var(--radius-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
  cursor: zoom-in; padding: 40px;
}
.pd-gallery-main img { width: 100%; height: 100%; object-fit: contain; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.pd-gallery-main .no-img { color: var(--gray-light); font-size: 14px; }
.pd-thumbs { display: flex; gap: 10px; margin-top: 16px; overflow-x: auto; padding-bottom: 4px; }
.pd-thumb {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; flex-shrink: 0;
  cursor: pointer; opacity: .5; transition: opacity .15s, border-color .15s; background: var(--smoke); padding: 8px;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { opacity: .85; }
.pd-thumb.active { opacity: 1; border-color: var(--red); }

.pd-cat { color: var(--red); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.pd-title { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -0.025em; margin-bottom: 8px; }
.pd-itemno { color: var(--gray); font-size: 13.5px; margin-bottom: 28px; }
.pd-price { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 24px; }
.pd-price .unit { font-size: 13px; color: var(--gray); font-weight: 400; }

/* Signature element: Apple-style "Tech Specs" hairline spec sheet, applied to stationery data */
.pd-specs { border-top: 1px solid var(--hairline); margin-top: 4px; }
.pd-spec { display: flex; justify-content: space-between; align-items: baseline; padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.pd-spec .label { font-size: 13.5px; color: var(--gray); }
.pd-spec .value { font-size: 14.5px; font-weight: 500; color: var(--ink); text-align: right; }

.qty-stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--hairline); border-radius: 980px; overflow: hidden; width: fit-content; background: var(--smoke); }
.qty-stepper button { width: 38px; height: 38px; border: none; background: none; font-size: 16px; cursor: pointer; transition: background .15s; color: var(--ink); }
.qty-stepper button:hover { background: var(--smoke-dark); }
.qty-stepper input { width: 42px; text-align: center; border: none; background: none; font-size: 14.5px; font-weight: 600; outline: none; font-family: inherit; }

.pd-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn-cta {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 26px; border-radius: 980px; border: none; cursor: pointer;
  font-weight: 500; font-size: 15px; font-family: inherit; transition: transform .15s var(--ease), background .15s, box-shadow .15s;
}
.btn-cta:active { transform: scale(.97); }
.btn-add-cart { background: var(--red); color: #fff; }
.btn-add-cart:hover { background: var(--red-dark); }
.btn-whatsapp { background: var(--ink); color: #fff; }
.btn-whatsapp:hover { background: #000; }
.btn-back { background: none; border: 1px solid var(--hairline); color: var(--ink); }
.btn-back:hover { background: var(--smoke); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.94); z-index: 1000; display: flex; align-items: center;
  justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 88vw; max-height: 82vh; border-radius: 12px; animation: zoomIn .35s var(--ease); }
@keyframes zoomIn { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-close {
  position: absolute; top: 26px; right: 26px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.1);
  color: #fff; border: none; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ---------- Cart page ---------- */
.cart-wrap { max-width: 760px; margin: 0 auto; padding: 40px 22px 120px; }
.cart-title { font-size: clamp(28px, 4vw, 36px); letter-spacing: -0.025em; margin-bottom: 6px; }
.cart-sub { color: var(--gray); font-size: 14.5px; margin-bottom: 36px; }
.cart-item {
  display: flex; gap: 18px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--hairline);
  opacity: 0; animation: cardIn .4s var(--ease) forwards;
}
.cart-item .thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; background: var(--smoke); padding: 8px; flex-shrink: 0; }
.cart-item .thumb-empty { width: 64px; height: 64px; border-radius: 12px; background: var(--smoke); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--gray-light); font-size: 10.5px; }
.cart-item .meta { flex: 1; min-width: 0; }
.cart-item .name { font-weight: 590; font-size: 15px; letter-spacing: -0.01em; }
.cart-item .itemno { font-size: 12.5px; color: var(--gray); margin-top: 1px; }
.cart-item .rate { font-size: 12.5px; color: var(--gray); margin-top: 3px; }
.cart-item .line-total { font-weight: 590; color: var(--ink); font-size: 15px; width: 88px; text-align: right; flex-shrink: 0; }
.cart-item .remove-btn { color: var(--gray-light); background: none; border: none; cursor: pointer; font-size: 17px; flex-shrink: 0; transition: color .15s; }
.cart-item .remove-btn:hover { color: var(--red); }

.cart-summary { background: var(--smoke); border-radius: var(--radius); padding: 24px; margin-top: 28px; }
.cart-summary-row { display: flex; justify-content: space-between; font-size: 14.5px; margin-bottom: 8px; color: var(--gray); }
.cart-summary-row.grand { font-size: 20px; font-weight: 600; color: var(--ink); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); letter-spacing: -0.02em; }
.cart-summary-row.grand .amt { color: var(--ink); }

.cart-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

@media (max-width: 640px) {
  .nav { padding: 0 16px; }
  .nav-brand span.txt { display: none; }
  .nav-cart-btn span.txt { display: none; }
  .hero { padding: 64px 16px 40px; }
  .pills-wrap { padding: 0 16px 28px; }
  .grid-section { padding: 32px 16px 100px; }
  #productGrid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
  .p-card .info { padding: 4px 14px 16px; }
  .cart-item .line-total { width: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}
