/* WeaponsCollector.com - Responsive Redesign */
:root {
  --color-bg: #faf8f2; --color-surface: #ffffff; --color-primary: #5c1a0e;
  --color-primary-light: #8b3a2a; --color-accent: #982f20; --color-accent-hover: #300405;
  --color-text: #2c2416; --color-text-light: #5c4a3a; --color-border: #d4c5a0;
  --color-sidebar-bg: #e1d3a6; --color-sidebar-text: #5c1910; --color-heading: #5c1a0e;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1200px; --sidebar-width: 280px; --header-height: 70px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); font-size: 16px; line-height: 1.7; color: var(--color-text); background: var(--color-bg); }
.site-header { background: var(--color-surface); border-bottom: 3px solid var(--color-border); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.header-inner { max-width: var(--max-width); width: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; height: var(--header-height); }
.site-logo { display: flex; align-items: center; text-decoration: none; color: var(--color-primary); }
.site-logo img { height: 50px; width: auto; }
.site-logo-text { font-family: var(--font-serif); font-size: 1.4rem; font-weight: bold; color: var(--color-primary); margin-left: 12px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.search-form { display: flex; }
.search-form input[type="text"] { padding: 8px 12px; border: 2px solid var(--color-border); border-right: none; border-radius: 4px 0 0 4px; font-size: 14px; width: 200px; outline: none; transition: border-color .2s; }
.search-form input[type="text"]:focus { border-color: var(--color-accent); }
.search-form button { padding: 8px 16px; background: var(--color-primary); color: #fff; border: 2px solid var(--color-primary); border-radius: 0 4px 4px 0; cursor: pointer; font-size: 14px; transition: background .2s; }
.search-form button:hover { background: var(--color-accent); border-color: var(--color-accent); }
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; z-index: 200; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--color-primary); transition: all .3s; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }
.site-layout { width: 100%; display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: calc(100vh - var(--header-height) - 3px - 80px); background: var(--color-surface); }
.site-layout > * { max-width: calc((var(--max-width) - var(--sidebar-width)) / 1 + var(--sidebar-width)); margin: 0 auto; width: 100%; }
.site-main { max-width: calc(var(--max-width) - var(--sidebar-width)); }
.site-nav { background: var(--color-sidebar-bg); padding: 24px 0; border-right: 2px solid var(--color-border); overflow-y: auto; }
.nav-list { list-style: none; }
.nav-category { border-bottom: 1px solid rgba(92,25,16,.15); }
.nav-category > a { display: block; padding: 10px 20px; color: var(--color-sidebar-text); text-decoration: none; font-weight: 600; font-size: 15px; transition: background .2s, color .2s; border-left: 3px solid transparent; }
.nav-category > a:hover, .nav-category > a.active { background: rgba(92,25,16,.1); border-left-color: var(--color-accent); color: var(--color-accent-hover); }
.nav-sublist { list-style: none; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.nav-sublist.expanded { max-height: 1000px; }
.nav-sublist li a { display: block; padding: 6px 20px 6px 32px; color: var(--color-sidebar-text); text-decoration: none; font-size: 13px; transition: background .2s, color .2s; border-left: 3px solid transparent; }
.nav-sublist li a:hover, .nav-sublist li a.active { background: rgba(92,25,16,.08); color: var(--color-accent-hover); border-left-color: var(--color-accent); }
.site-main { padding: 32px 40px; background: var(--color-surface); }
.page-title { font-family: var(--font-serif); font-size: 2rem; color: var(--color-heading); margin-bottom: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--color-border); }
.content-section { margin-bottom: 32px; }
.content-section::after { content: ""; display: table; clear: both; }
.content-section.full .text-column { max-width: 100%; }

.image-column { width: 300px; flex-shrink: 0; }
.image-column.float-right { float: right; margin: 0 0 16px 24px; }
.image-column.float-left { float: left; margin: 0 24px 16px 0; }
.image-column img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.1); display: block; }
.image-column.full-width { float: none; margin: 0 auto; width: 100%; text-align: center; }
.image-column.full-width img { max-width: 100%; }

figure { margin: 0; }
figcaption { font-size: 14px; color: var(--color-text-light); font-style: italic; margin-top: 8px; text-align: center; }

.text-column { overflow: hidden; }
.text-column h2 { font-family: var(--font-serif); font-size: 1.4rem; color: var(--color-heading); margin-bottom: 12px; text-align: center; }
.text-column p { text-align: justify; color: var(--color-text); margin-bottom: 12px; }
.content-section h2 { font-family: var(--font-serif); font-size: 1.4rem; color: var(--color-heading); margin-bottom: 12px; text-align: center; }
.content-section p { text-align: justify; color: var(--color-text); }
.specs-table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
.specs-table caption { font-family: var(--font-serif); font-size: 1.2rem; color: var(--color-heading); text-align: left; margin-bottom: 12px; font-weight: bold; }
.specs-table tr { border-bottom: 1px solid var(--color-border); }
.specs-table tr:last-child { border-bottom: none; }
.specs-table td { padding: 8px 12px; }
.specs-table td:first-child { font-weight: 600; color: var(--color-heading); white-space: nowrap; width: 40%; }
.specs-table td:last-child { color: var(--color-text); }
.item-header { display: grid; grid-template-columns: 1fr 320px; gap: 32px; margin-bottom: 32px; align-items: start; }
.item-description { text-align: justify; }
.image-gallery { margin: 32px 0; }
.gallery-main { position: relative; background: #f0ebe0; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.gallery-main img { width: 100%; height: auto; display: block; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.5); color: #fff; border: none; padding: 12px 16px; cursor: pointer; font-size: 18px; transition: background .2s; border-radius: 4px; }
.gallery-nav:hover { background: rgba(0,0,0,.7); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-counter { position: absolute; bottom: 12px; right: 12px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 13px; }
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
.gallery-thumbs img { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color .2s, opacity .2s; opacity: .6; }
.gallery-thumbs img:hover, .gallery-thumbs img.active { border-color: var(--color-accent); opacity: 1; }
.references { margin: 32px 0; padding: 24px; background: var(--color-bg); border-radius: 8px; border-left: 4px solid var(--color-border); }
.references h3 { font-family: var(--font-serif); font-size: 1.2rem; color: var(--color-heading); margin-bottom: 16px; }
.references ol { list-style: none; counter-reset: ref; }
.references ol li { counter-increment: ref; margin-bottom: 12px; padding-left: 28px; position: relative; }
.references ol li::before { content: "(" counter(ref) ")"; position: absolute; left: 0; font-weight: 600; color: var(--color-accent); }
.references a { color: var(--color-accent); text-decoration: none; font-weight: 500; overflow-wrap: break-word; word-break: break-all; }
.references a:hover { text-decoration: underline; color: var(--color-accent-hover); }
.text-column a[href^="#ref"] { font-weight: 600; }
.page-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 24px; border-top: 2px solid var(--color-border); }
.page-nav a { display: inline-flex; align-items: center; gap: 8px; color: var(--color-accent); text-decoration: none; font-weight: 500; padding: 8px 16px; border-radius: 4px; transition: background .2s, color .2s; }
.page-nav a:hover { background: var(--color-bg); color: var(--color-accent-hover); }
.page-nav .nav-prev::before { content: "\2190"; }
.page-nav .nav-next::after { content: "\2192"; }
.back-to-top { color: var(--color-text-light); text-decoration: none; font-size: 14px; padding: 8px 16px; border-radius: 4px; transition: color .2s; }
.back-to-top:hover { color: var(--color-accent); }
.site-footer { background: var(--color-primary); color: rgba(255,255,255,.8); text-align: center; padding: 20px 24px; font-size: 14px; }
.site-footer a { color: rgba(255,255,255,.9); text-decoration: none; }
.site-footer a:hover { color: #fff; }
a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); }
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .site-layout { display: block !important; grid-template-columns: none !important; }
  .site-layout > * { max-width: 100% !important; }
  .site-nav { position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; z-index: 50; transition: left .3s ease; padding-top: calc(var(--header-height) + 3px); box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .site-nav.open { left: 0; }
  .nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .nav-overlay.open { display: block; }
  .site-main { padding: 24px 20px; max-width: 100%; width: 100%; }
  .page-title { font-size: 1.6rem; }
  .image-column.float-right, .image-column.float-left { float: none; margin: 0 0 16px 0; width: 100%; }
  .item-header { grid-template-columns: 1fr; }
  .search-form input[type="text"] { width: 140px; }
  .site-logo-text { display: none; }
}
@media (max-width: 600px) {
  .header-inner { padding: 10px 16px; overflow: hidden; }
  .site-logo img { height: 36px; }
  .search-form input[type="text"] { width: 100px; font-size: 13px; padding: 6px 8px; }
  .search-form button { padding: 6px 10px; font-size: 13px; }
  .site-main { padding: 16px 12px; max-width: 100%; width: 100%; }
  .page-title { font-size: 1.3rem; }
  .content-section h2 { font-size: 1.2rem; }
  .gallery-thumbs img { width: 60px; height: 45px; scroll-snap-align: start; flex-shrink: 0; }
  .gallery-thumbs { padding: 4px 0 8px; overflow-x: auto; overflow-y: hidden; max-width: 100%; width: 100%; box-sizing: border-box; }
  .gallery-main { max-width: 100%; width: 100%; }
  .page-nav { flex-direction: column; gap: 8px; }
  /* Allow specs table labels to wrap */
  .specs-table td:first-child { white-space: normal; width: auto; }
  .specs-table td { padding: 6px 8px; font-size: 13px; }
  /* Prevent text clipping */
  .text-column { overflow: visible; }
  .text-column p, .content-section p { overflow-wrap: break-word; word-break: break-word; hyphens: auto; }
  /* Make item header stack */
  .item-header { gap: 20px; }
  /* Ensure images don't overflow */
  .image-column img, .gallery-main img { max-width: 100%; }
  /* Ensure content sections don't cause horizontal scroll */
  .content-section { max-width: 100%; }
  /* Ensure all images are constrained */
  img { max-width: 100%; height: auto; }
}
@media print {
  .site-header, .site-nav, .site-footer, .gallery-nav, .gallery-thumbs, .page-nav { display: none !important; }
  .site-layout { grid-template-columns: 1fr; }
  .site-main { padding: 0; }
}
