/* ==========================================================================
   TOYSKUB — Design tokens
   Theme: "Parts runner / Instruction manual" — เส้นบล็อกปรินท์, มุมตัดกระดาษ,
   ตารางสเปกแบบคู่มือประกอบ, ตัวเลขชิ้นส่วนแบบ mono
   ========================================================================== */
:root {
  --paper: #EDEEF0;
  --paper-card: #F8F9FA;
  --ink: #14181F;
  --ink-soft: #4A515C;
  --line: #B8BEC7;
  --line-soft: #D8DCE1;
  --blue: #2B4C7E;
  --blue-soft: #E3EAF3;
  --red: #C1392B;
  --yellow: #E8B23D;

  --font-display: 'Chakra Petch', sans-serif;
  --font-body: 'IBM Plex Sans Thai', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  position: relative;
}

a { color: inherit; text-decoration: none; }

/* Blueprint grid background */
.blueprint-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
}

/* ---------------- Header ---------------- */
.site-header {
  position: relative;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: white;
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  line-height: 1.1;
}
.logo-text small {
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.2em;
}
.header-nav {
  display: none;
}
.header-nav.contact-ready {
  display: flex;
  align-items: center;
}
.header-line-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--ink);
  background: var(--paper-card);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}
.header-line-contact:hover {
  background: #06c755;
  color: #fff;
}
.header-line-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: #06c755;
}
.header-line-contact:hover .header-line-logo {
  color: #fff;
}
@media (max-width: 520px) {
  .header-inner {
    padding: 14px 16px;
  }
  .header-line-contact {
    padding-right: 8px;
  }
  .header-line-contact span {
    font-size: 12px;
  }
}
.nav-count {
  font-size: 18px;
  color: var(--ink);
  font-weight: 700;
}

.corner-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 2;
}
.corner-mark::before, .corner-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.corner-mark::before { width: 100%; height: 1px; top: 50%; }
.corner-mark::after { width: 1px; height: 100%; left: 50%; }
.corner-mark.tl { top: 6px; left: 6px; }
.corner-mark.tr { top: 6px; right: 6px; }

/* ---------------- Layout ---------------- */
main { max-width: 1100px; margin: 0 auto; padding: 40px 28px 80px; min-height: 60vh; }

/* ---------------- Home / Grid ---------------- */
.hero {
  margin-bottom: 48px;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--blue);
  text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  margin: 8px 0 12px;
  letter-spacing: -0.01em;
}
.hero-sub {
  color: var(--ink-soft);
  max-width: 560px;
  font-size: 15px;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  margin-top: 24px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  background: var(--paper-card);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
}
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 15px var(--font-body);
}

.catalog-breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -20px 0 18px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink-soft);
  font: 11px var(--font-mono);
}
.catalog-breadcrumb strong { color: var(--blue); }
.catalog-step { margin-bottom: 18px; }
.catalog-step-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 13px;
}
.catalog-step-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  background: var(--ink);
  color: white;
  font: 10px var(--font-mono);
}
.catalog-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.catalog-choice,
.grade-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.catalog-choice { flex: 1 1 220px; max-width: 330px; }
.grade-choice { min-width: 90px; }
.catalog-choice strong,
.grade-choice strong {
  font-family: var(--font-display);
  font-size: 14px;
}
.catalog-choice small,
.grade-choice small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10px;
}
.catalog-choice:hover,
.catalog-choice.active,
.grade-choice:hover,
.grade-choice.active {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}
.catalog-choice:hover small,
.catalog-choice.active small,
.grade-choice:hover small,
.grade-choice.active small { color: #fff; }
.catalog-step:last-of-type {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  background: var(--paper-card);
  color: var(--ink-soft);
  text-align: center;
}

@media (max-width: 700px) {
  .catalog-choice { max-width: none; flex-basis: 100%; }
  .catalog-breadcrumb { overflow-x: auto; white-space: nowrap; }
}

.product-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 4px 4px 0 var(--ink);
}
.card-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
  letter-spacing: 0.05em;
  z-index: 2;
}
.card-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  letter-spacing: 0.05em;
  z-index: 2;
}
.card-stock.in { background: var(--blue-soft); color: var(--blue); }
.card-stock.out { background: #F3D9D9; color: var(--red); }

.card-image {
  aspect-ratio: 1;
  background: var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.card-image img { width: 100%; height: 100%; object-fit: contain; }
.card-image .placeholder {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.card-body { padding: 14px 16px 18px; }
.card-sku { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.card-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: 4px 0 8px; line-height: 1.3; }
.card-meta { font-size: 12px; color: var(--ink-soft); }

/* ---------------- Product Detail ---------------- */
.back-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
}

.spec-plate {
  border: 2px solid var(--ink);
  background: var(--paper-card);
  padding: 24px;
  margin-bottom: 8px;
  position: relative;
}
.spec-plate::before {
  content: attr(data-sku);
  position: absolute;
  top: -11px;
  left: 20px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 10px;
  letter-spacing: 0.05em;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  margin-top: 8px;
}
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.gallery-main {
  aspect-ratio: 1;
  background: var(--line-soft);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-thumbs img {
  width: 64px; height: 64px; object-fit: cover;
  border: 1px solid var(--line); cursor: pointer;
}
.gallery-thumbs img.active { border-color: var(--blue); border-width: 2px; }

.manual-note {
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.manual-gallery-main {
  max-width: 820px;
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.manual-gallery-main img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 1100px;
  object-fit: contain;
}
.manual-thumbs {
  justify-content: center;
}
.manual-thumbs img {
  width: 72px;
  height: 96px;
  object-fit: contain;
  background: #fff;
}

.video-embed {
  margin-top: 16px;
  aspect-ratio: 16/9;
  border: 1px solid var(--line);
  background: var(--ink);
}
.video-embed iframe { width: 100%; height: 100%; border: 0; }

.product-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.25;
}
.share-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  margin: 4px 0 14px;
  padding: 7px 13px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.share-button:hover {
  background: var(--ink);
  color: var(--paper);
}
.share-button.share-success {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}
.share-icon {
  font-size: 16px;
  line-height: 1;
}

.product-grade-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--blue);
  color: white;
  padding: 3px 10px;
  margin-bottom: 12px;
}
.product-summary { color: var(--ink-soft); margin-bottom: 20px; }

/* ---------------- Shop & sponsor ---------------- */
.sponsor-section {
  margin: 0 0 54px;
  padding: 0 0 30px;
  border-bottom: 2px solid var(--ink);
}
.sponsor-heading {
  margin-bottom: 22px;
}
.sponsor-eyebrow {
  display: block;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
}
.sponsor-heading h2 {
  margin: 3px 0 2px;
  font-family: var(--font-display);
  font-size: 25px;
}
.sponsor-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.sponsor-card {
  position: relative;
  min-height: 190px;
  padding: 24px 18px 18px;
  border: 1px solid var(--ink);
  background: var(--paper-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sponsor-card:hover {
  transform: translateY(-3px);
  box-shadow: 5px 5px 0 rgba(20, 24, 31, 0.16);
}
.sponsor-slot {
  position: absolute;
  top: 8px;
  left: 10px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.sponsor-logo,
.sponsor-placeholder-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sponsor-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sponsor-logo span {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}
.sponsor-placeholder-logo {
  border-style: dashed;
  color: var(--line);
  font-family: var(--font-mono);
  font-size: 30px;
}
.sponsor-card strong {
  font-family: var(--font-display);
  font-size: 15px;
}
.sponsor-card > span:last-child {
  color: var(--ink-soft);
  font-size: 12px;
}
.sponsor-empty:hover {
  border-color: #06c755;
}
.sponsor-ad-gif {
  display: block;
  width: 100%;
  height: auto;
  max-width: 300px;
  border: 1px solid var(--line);
}
@media (max-width: 760px) {
  .sponsor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .sponsor-grid {
    grid-template-columns: 1fr;
  }
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.spec-table tr { border-bottom: 1px solid var(--line-soft); }
.spec-table td { padding: 8px 4px; }
.spec-table td:first-child {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  width: 40%;
}
.spec-table td:last-child { font-weight: 600; }

/* ---------------- Affiliate / Buy links ---------------- */
.buy-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.buy-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px;
  border: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  transition: all 0.15s ease;
  background: var(--paper);
}
.buy-link:hover { background: var(--ink); color: var(--paper); }
.buy-link .platform-name { font-weight: 700; font-size: 12px; letter-spacing: 0.03em; }
.buy-link .platform-hint { color: var(--ink-soft); font-size: 10px; }
.buy-link:hover .platform-hint { color: var(--line-soft); }
.buy-link.disabled {
  opacity: 0.35;
  pointer-events: none;
  border-style: dashed;
}
.buy-link.shopee { border-left: 3px solid #EE4D2D; }
.buy-link.lazada { border-left: 3px solid #0F146D; }
.buy-link.tiktok { border-left: 3px solid #000000; }
.buy-link.page { border-left: 3px solid var(--blue); }
@media (max-width: 520px) {
  .buy-links { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Manual sections (numbered) ---------------- */
.manual-section { margin-top: 56px; }
.manual-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
}
.manual-number {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 8px;
}
.manual-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.highlight-list, .pro-con-list { list-style: none; padding: 0; margin: 0; }
.highlight-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}
.highlight-list li::before {
  content: "▸";
  position: absolute; left: 0; color: var(--blue); font-weight: 700;
}

.diff-item {
  border-left: 3px solid var(--blue);
  padding: 4px 0 4px 16px;
  margin-bottom: 16px;
}
.diff-item h4 { font-family: var(--font-display); font-size: 14px; margin: 0 0 4px; }
.diff-item p { margin: 0; color: var(--ink-soft); font-size: 13px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.pro-con-list li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: 13px;
  border-bottom: 1px dashed var(--line-soft);
}
.pros-col li::before { content: "＋"; position: absolute; left: 0; color: var(--blue); font-family: var(--font-mono); }
.cons-col li::before { content: "－"; position: absolute; left: 0; color: var(--red); font-family: var(--font-mono); }

.box-tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.box-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--ink);
  padding: 5px 12px;
}
.box-tag.not-included { border-style: dashed; color: var(--ink-soft); text-decoration: line-through; }

.faq-item { border-bottom: 1px solid var(--line-soft); }
.faq-q {
  padding: 14px 4px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.faq-q::after { content: "+"; font-family: var(--font-mono); font-size: 18px; color: var(--blue); }
.faq-item.open .faq-q::after { content: "−"; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  transition: max-height 0.2s ease;
}
.faq-item.open .faq-a { max-height: 300px; padding-bottom: 14px; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 2px solid var(--ink);
  padding: 24px 28px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-plate { font-family: var(--font-display); font-weight: 600; font-size: 13px; margin: 0 0 4px; }
.footer-note { font-size: 12px; color: var(--ink-soft); margin: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
