:root {
  --j1-blue: #003a70;
  --j1-blue-dark: #002953;
  --j1-bg: #f5f7fb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--j1-bg);
  color: #111827;
}

/* Header */

.header {
  background: var(--j1-blue);
  color: #fff;
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

.brand-logo {
  height: 56px;
  width: auto;
  max-width: 220px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.logo-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.tagline-main {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.tagline-sub {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Main shell + tabs */

.main-shell {
  max-width: 1200px;
  margin: 1.5rem auto 1.5rem;
  padding: 0 1.5rem;
}

.tab-bar {
  display: inline-flex;
  border-radius: 999px;
  background: #e5edf6;
  padding: 3px;
  margin-bottom: 0.75rem;
}

.tab-button {
  border: none;
  background: transparent;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  color: #374151;
}

.tab-button--active {
  background: #ffffff;
  color: var(--j1-blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
}

/* HOME PAGE */

.home-layout {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-copy h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.home-copy p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: #374151;
}

.home-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}

/* two big cards side by side */
.home-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.home-card {
  background: #ffffff;
  border-radius: 0.9rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.home-card-image-wrap {
  width: 100%;
  padding-top: 60%;
  position: relative;
  background: #f3f4f6;
}

.home-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-card-body {
  padding: 0.8rem 1rem 1rem;
}

.home-card-body h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.home-card-body p {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.home-card-btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--j1-blue);
  color: #fff;
}

.home-card-btn:hover {
  background: var(--j1-blue-dark);
}

/* Shared layout for selector/industry/poster */

.layout {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.5rem;
}

/* Filters */

.filters {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.filters h2 {
  margin-top: 0;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.filter-group {
  margin-bottom: 0.75rem;
}

.filter-group h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

/* chip-style filters */
.filter-options--chips .filter-option {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.2rem 0.65rem;
  background: #f9fafb;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.filter-options--chips .filter-option input[type="checkbox"] {
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.filter-options--chips .filter-option span {
  white-space: nowrap;
}

.filter-option--active {
  background: #e5edf6;
  border-color: var(--j1-blue);
  color: var(--j1-blue);
  box-shadow: 0 0 0 1px rgba(0, 58, 112, 0.25);
}

.filter-subtitle {
  margin: 0.5rem 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}

.filter-help {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.filter-help code {
  background: #f3f4f6;
  padding: 0 0.2rem;
  border-radius: 0.2rem;
}

.clear-btn {
  margin-top: 0.25rem;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  background: #e5edf6;
  color: var(--j1-blue);
  font-weight: 500;
  width: 100%;
}

.clear-btn:hover {
  background: #d4e1f2;
}

/* Results */

.results {
  min-width: 0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.results-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

#results-count,
#results-count-industry {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.glove-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 0.8rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 320px;
}

.glove-card::before {
  content: "";
  display: block;
  height: 3px;
  border-radius: 999px;
  background: var(--j1-blue);
  margin: -0.8rem -0.8rem 0.5rem;
}

.glove-image-wrapper {
  width: 100%;
  padding-top: 70%;
  position: relative;
  border-radius: 0.6rem;
  overflow: hidden;
  background: #f3f4f6;
}

.glove-image-wrapper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* magnifying glass overlay - vector icon */
.magnify-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}

.magnify-btn:hover {
  background: rgba(0,0,0,0.75);
}

.magnify-btn::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* white outline magnifying glass */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16' y1='16' x2='21' y2='21'/%3E%3C/svg%3E");
}

.glove-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.glove-code {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--j1-blue);
}

.glove-name {
  font-size: 0.85rem;
  color: #6b7280;
}

.glove-specs {
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.3;
}

.glove-specs span {
  display: inline-block;
  margin-right: 0.5rem;
}

/* actions at bottom of card */
.glove-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.datasheet-btn {
  margin-top: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: none;
  background: var(--j1-blue);
  color: #ffffff;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.datasheet-btn:hover {
  background: var(--j1-blue-dark);
}

/* Poster add button */

.poster-btn {
  margin-top: 0.2rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  background: #fff;
  cursor: pointer;
}

.poster-btn:hover {
  background: #f3f4f6;
}

.poster-btn--active {
  border-color: var(--j1-blue);
  background: #e5edf6;
  color: var(--j1-blue);
}

.poster-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Poster section */

.poster-section {
  margin-top: 0.75rem;
}

.poster-inner {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.poster-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.poster-header h2 {
  margin: 0;
}

.poster-header p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.poster-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.poster-count-label {
  font-size: 0.85rem;
}

.upload-label {
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.upload-label input[type="file"] {
  font-size: 0.75rem;
}

.primary-btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--j1-blue);
  color: #ffffff;
  font-weight: 500;
}

.primary-btn:hover {
  background: var(--j1-blue-dark);
}

.clear-btn-small {
  margin-top: 0;
  padding-inline: 0.75rem;
}

.poster-a4-wrapper {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

/* A4 landscape aspect */
.poster-a4 {
  background: #ffffff;
  width: 100%;
  max-width: 1123px;
  aspect-ratio: 297 / 210;
  border: 1px solid #d1d5db;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.poster-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--j1-blue);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.poster-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.poster-j1-logo {
  height: 40px;
  width: auto;
}

.poster-title-block h3 {
  margin: 0;
  font-size: 1.1rem;
}

.poster-title-block p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #4b5563;
}

.poster-customer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  max-width: 220px;
}

#customer-logo {
  max-height: 42px;
  max-width: 220px;
  object-fit: contain;
}

.poster-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
  padding-top: 4px;
  box-sizing: border-box;
}

.poster-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.poster-item-image {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.poster-item-caption {
  margin-top: 4px;
  font-size: 0.75rem;
  text-align: center;
}

.poster-print-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Lightbox */

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
}

.image-lightbox.active {
  display: flex;
}

/* Footer */

.footer {
  text-align: center;
  padding: 0 1.5rem 1.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Responsive */

@media (max-width: 768px) {
  .home-layout {
    flex-direction: column;
  }

  .home-options {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    max-height: none;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-logo {
    height: 48px;
  }

  .poster-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .poster-controls {
    justify-content: flex-start;
  }

  .poster-a4 {
    max-width: 100%;
  }
}

/* Print – force single A4 landscape page with poster only */

@media print {
  body {
    background: #ffffff;
  }

  .header,
  .tab-bar,
  #tab-home,
  #tab-features,
  #tab-industry,
  .poster-header,
  .poster-print-hint,
  .footer {
    display: none !important;
  }

  .main-shell {
    margin: 0 !important;
    padding: 0 !important;
  }

  #tab-poster,
  .poster-section,
  .poster-inner,
  .poster-a4-wrapper,
  .poster-a4 {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: none !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }

  .poster-a4 {
    aspect-ratio: auto;
  }

  @page {
    size: A4 landscape;
    margin: 0;
  }
}
