/* =========================================================================
   Asia Pallet Pool Ltd — pallets.com.tw
   Hand-written, framework-free. Target: ~280 lines, <10KB gzipped.
   Design language: established-industrial, density over whitespace.
   Optimised for the LINE-screenshot test: company card + one spec + phone
   must all be visible above the fold at 375px width.
   ========================================================================= */

:root {
  /* Colors — warm off-white bg, navy primary (brand continuity since 2001).
     Red reserved for NEW/SALE tags only. Borders warm grey (cool = fintech). */
  --c-bg:        #F7F5F1;
  --c-surface:   #FFFFFF;
  --c-panel:     #EDEAE4;
  --c-border:    #C8C4BC;
  --c-border-strong: #9A9283;
  --c-ink:       #1A1A18;     /* warm near-black, softer than #000 on F7F5F1 */
  --c-ink-soft:  #5A5750;
  --c-muted:     #7A766D;
  --c-link:      #000080;     /* 20-year brand anchor */
  --c-link-hover:#0000CC;
  --c-link-visited: #4A4A8A;
  --c-accent:    #C0392B;     /* 特惠 / NEW tag ONLY */
  --c-success:   #2E7D32;

  /* Type — system CJK. Serif for headings at weight 400 (bold sans CJK = flyer). */
  --f-cjk-sans:  "Microsoft JhengHei", "Heiti TC", "PingFang TC", "Noto Sans TC", "Noto Sans SC", sans-serif;
  --f-cjk-serif: "PingFang TC", "Source Han Serif TC", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --f-latin-serif: Georgia, "Times New Roman", "Book Antiqua", serif;
  --f-latin-mono:  ui-monospace, "SF Mono", "Courier New", monospace;
  --f-brand:     "Century Gothic", "Avenir Next", "URW Gothic L", sans-serif;

  /* Type scale — mobile first. Restrained sizes: TW buyers distrust big display type. */
  --fs-xs:  12px;
  --fs-sm:  13px;
  --fs-base:15px;
  --fs-md:  16px;
  --fs-lg:  18px;
  --fs-xl:  22px;
  --fs-xxl: 22px;

  /* Rhythm — CJK wants 1.85, Latin wants 1.5 */
  --lh-cjk:    1.85;
  --lh-latin:  1.55;
  --lh-tight:  1.3;

  --sp-0: 0;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  --max-w: 1100px;
  --radius: 2px;
}

@media (min-width: 768px) {
  :root {
    --fs-base:16px;
    --fs-md:  17px;
    --fs-lg:  19px;
    --fs-xl:  24px;
    --fs-xxl: 28px;
  }
}

/* ---------- Reset-lite ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-cjk-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-cjk);
  text-rendering: optimizeLegibility;
}
:lang(en) { line-height: var(--lh-latin); }
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--c-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:visited { color: var(--c-link-visited); }
a:hover   { color: var(--c-link-hover); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--f-cjk-serif);
  font-weight: 400;
  color: var(--c-ink);
  line-height: var(--lh-tight);
  margin: var(--sp-5) 0 var(--sp-3);
}
:lang(en) h1, :lang(en) h2, :lang(en) h3, :lang(en) h4 { font-family: var(--f-latin-serif); }
h1 { font-size: var(--fs-xxl); }
h2 { font-size: var(--fs-xl);  }
h3 { font-size: var(--fs-lg);  }
h4 { font-size: var(--fs-md);  }
p { margin: 0 0 var(--sp-4); }
small, .small { font-size: var(--fs-sm); color: var(--c-ink-soft); }
.lead { font-size: var(--fs-md); color: var(--c-ink-soft); margin-bottom: var(--sp-5); }

/* ---------- Layout primitives ---------- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--sp-4); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 2fr 1fr; gap: var(--sp-6); }
  .grid-2--even { grid-template-columns: 1fr 1fr; }
}

/* ---------- Skip link (keyboard-only users) ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-ink);
  color: #fff;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  z-index: 100;
}
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); }

/* ---------- Trust bar (always-visible credentials strip) ---------- */
.trust-bar {
  background: var(--c-ink);
  color: #E8E5DC;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.trust-bar__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6px var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: center;
}
.trust-bar a { color: #FFFFFF; text-decoration: none; }
.trust-bar a:hover { text-decoration: underline; }
.trust-bar__lang { margin-left: auto; }
.trust-bar__lang a {
  display: inline-block;
  margin: 0 2px;
  padding: 6px 10px;
  min-height: 32px;
  line-height: 20px;
}
.trust-bar__lang a[aria-current="true"] { color: #F7F5F1; font-weight: 700; }
.trust-bar__tel a,
.trust-bar__mobile a {
  padding: 6px 4px;
  display: inline-block;
  min-height: 32px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.trust-bar__mobile { color: #B8B3A5; }
.trust-bar__line   { color: #B8B3A5; }
.trust-bar__addr   { color: #B8B3A5; }
@media (max-width: 767px) {
  /* Mobile: drop long street address; keep phone + Patty + LINE + lang. */
  .trust-bar__addr { display: none; }
  .trust-bar__inner { gap: var(--sp-3); padding-top: 6px; padding-bottom: 6px; }
}

/* ---------- Header (brand + phones + tel CTA) ---------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border-strong);
  position: sticky; top: 0; z-index: 10;
}
.site-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
}
.site-header__brand {
  display: flex; align-items: baseline; gap: var(--sp-2);
  color: var(--c-link); text-decoration: none;
  font-weight: 400; font-size: var(--fs-lg); line-height: 1.15;
}
.site-header__brand:hover { color: var(--c-link-hover); }
.site-header__brand b { font-family: var(--f-brand); letter-spacing: 0.02em; }
.site-header__brand small { font-family: var(--f-brand); color: var(--c-ink-soft); font-size: var(--fs-xs); }

/* ---------- Nav bar ---------- */
.site-nav { background: var(--c-bg); border-bottom: 1px solid var(--c-border); }
.site-nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex; flex-wrap: wrap; gap: var(--sp-5); font-size: var(--fs-sm);
}
.site-nav__inner a {
  text-decoration: none; color: var(--c-ink);
  padding: 10px 4px;
  min-height: 44px;
  display: inline-flex; align-items: center;
  border-bottom: 2px solid transparent;
}
.site-nav__inner a:hover { color: var(--c-link-hover); border-bottom-color: var(--c-link-hover); }
.site-nav__inner a[aria-current="page"] { border-bottom-color: var(--c-link); color: var(--c-link); }

/* ---------- Hero — compact, dense, left-aligned, NOT 100vh ---------- */
.hero { padding: var(--sp-5) 0 var(--sp-4); }
.hero h1 { margin: 0 0 var(--sp-3); }
.hero__sub { font-size: var(--fs-md); color: var(--c-ink-soft); max-width: 38em; margin: 0 0 var(--sp-3); }
.hero__meta { font-size: var(--fs-sm); color: var(--c-muted); }
.hero__meta span + span::before { content: "·"; margin: 0 var(--sp-2); color: var(--c-border-strong); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin: var(--sp-4) 0;
  padding: 0;
  background: var(--c-border-strong);
  border: 1px solid var(--c-border-strong);
}
@media (min-width: 640px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat-strip > div {
  background: var(--c-surface);
  padding: var(--sp-3) var(--sp-4);
  margin: 0;
}
.stat-strip dt {
  font-size: var(--fs-xs);
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 2px;
  font-family: var(--f-cjk-sans);
}
.stat-strip dd {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-link);
  font-variant-numeric: tabular-nums;
  font-family: var(--f-cjk-sans);
  line-height: 1.2;
}

/* ---------- Product category list ---------- */
.cat-list { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); padding: 0; list-style: none; margin: 0; }
@media (min-width: 640px) { .cat-list { grid-template-columns: 1fr 1fr; } }
.cat-list li {
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  padding: 0;                       /* padding moved to the <a> so the tap target fills the card */
  position: relative;
}
.cat-list h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-family: var(--f-cjk-sans);
  line-height: 1.3;
}
.cat-list h3 a {
  text-decoration: none;
  color: var(--c-link);
  display: block;
  padding: var(--sp-3) var(--sp-4) var(--sp-1);
  min-height: 44px;
}
.cat-list h3 a:hover { text-decoration: underline; }
.cat-list p {
  margin: 0;
  padding: 0 var(--sp-4) var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--c-ink-soft);
}
.tag {
  display: inline-block; font-size: var(--fs-xs);
  background: var(--c-accent); color: #fff; padding: 1px 6px;
  margin-left: var(--sp-2); vertical-align: middle;
  font-family: var(--f-brand); letter-spacing: 0.04em;
}

/* ---------- Spec table ---------- */
.spec-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--sp-4) 0;
  border: 1px solid var(--c-border-strong);
}
.spec-table-wrap .spec-table { margin: 0; border: 0; }
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin: var(--sp-4) 0;
  background: var(--c-surface);
  font-variant-numeric: tabular-nums;
}
.spec-table caption {
  caption-side: top; text-align: left; font-weight: 700;
  padding: var(--sp-2) 0; color: var(--c-ink-soft); font-size: var(--fs-sm);
}
.spec-table th, .spec-table td {
  border: 1px solid var(--c-border-strong);
  padding: var(--sp-2) var(--sp-3);
  text-align: left; vertical-align: top;
}
.spec-table th { background: var(--c-panel); font-weight: 700; color: var(--c-ink); }
.spec-table tbody tr:nth-child(even) td { background: #FBF9F4; }

/* ---------- Photo figure ---------- */
figure { margin: 0 0 var(--sp-4); }
figure img { border: 1px solid var(--c-border); background: #EDEAE4; }
figcaption {
  font-size: var(--fs-xs); color: var(--c-muted);
  padding: var(--sp-1) 0 0; font-variant-numeric: tabular-nums;
}

/* Photo grid for gallery pages (plastic.htm, EUR01.htm) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-grid figure { margin: 0; }
.photo-grid figure img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Sidebar (photo gallery + contact card on product pages) ---------- */
.sidebar { display: flex; flex-direction: column; gap: var(--sp-4); }
.sidebar .panel { background: var(--c-panel); border: 1px solid var(--c-border); padding: var(--sp-4); }
.sidebar .panel h3 { margin-top: 0; font-size: var(--fs-md); font-family: var(--f-cjk-sans); }

/* ---------- Contact block ---------- */
.contact-block {
  border-top: 3px solid var(--c-link);
  padding: var(--sp-5) 0;
  margin-top: var(--sp-7);
  background: var(--c-surface);
}
.contact-block h2 { margin-top: 0; }
.contact-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 768px) { .contact-grid { grid-template-columns: 1fr 1fr; } }
.contact-grid dl { margin: 0; }
.contact-grid dt {
  font-size: var(--fs-xs); color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: var(--sp-2);
}
.contact-grid dd { margin: 0 0 var(--sp-1); font-size: var(--fs-sm); }
.contact-grid a { font-variant-numeric: tabular-nums; }

.contact-people { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); margin-top: var(--sp-4); }
@media (min-width: 640px) { .contact-people { grid-template-columns: 1fr 1fr; } }
.contact-person {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3); border: 1px solid var(--c-border); background: var(--c-panel);
}
.contact-person img, .contact-person__photo {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 0; flex-shrink: 0; border: 1px solid var(--c-border-strong);
}
.contact-person h4 { margin: 0 0 var(--sp-1); font-size: var(--fs-md); font-family: var(--f-cjk-sans); }
.contact-person p { margin: 0; font-size: var(--fs-sm); color: var(--c-ink-soft); }
.contact-person a { font-weight: 700; }

/* ---------- LINE block ---------- */
.line-block { display: flex; gap: var(--sp-4); align-items: center; border: 1px solid var(--c-border); background: var(--c-panel); padding: var(--sp-3); }
.line-block img.qr { width: 96px; height: 96px; }
.line-block__text { font-size: var(--fs-sm); }
.line-block__text b { font-family: var(--f-brand); }

/* ---------- Footer ---------- */
.site-footer {
  background: #2E2C27; color: #C4BFAF;
  font-size: var(--fs-sm); padding: var(--sp-6) 0 var(--sp-5); margin-top: var(--sp-7);
}
.site-footer a { color: #E8E2CE; }
.site-footer a:hover { color: #FFFFFF; }
.site-footer__cols {
  max-width: var(--max-w); margin: 0 auto; padding: 0 var(--sp-4);
  display: grid; grid-template-columns: 1fr; gap: var(--sp-5);
}
@media (min-width: 768px) { .site-footer__cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer__col h4 {
  margin: 0 0 var(--sp-2); color: #FFFFFF; font-size: var(--fs-sm);
  font-family: var(--f-cjk-sans); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 4px; }
.site-footer__bottom {
  max-width: var(--max-w); margin: var(--sp-5) auto 0;
  padding: var(--sp-3) var(--sp-4) 0;
  border-top: 1px solid #4A4740; font-size: var(--fs-xs); color: #8B8575;
  font-variant-numeric: tabular-nums;
}

/* ---------- Mobile tap-target safety ---------- */
@media (max-width: 767px) {
  a[href^="tel:"],
  a[href^="mailto:"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 4px 2px;
  }
}

/* ---------- Utility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.no-underline { text-decoration: none; }
.mono-tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--c-ink-soft); }
