/* ===========================================
   Aichi Sangyo Products — Guided Theme
   Step-by-step drill-down product browser

   IMPORTANT: All styles are scoped to #product-app
   to avoid conflicts with the parent Aichi Sangyo site.
   =========================================== */

:root {
  --primary: #0A1F5C;
  --primary-hover: #081846;
  --accent: #1E40AF;
  --accent-light: #E7EEFE;

  --bg: #FFFFFF;
  --bg-alt: #F4F5F7;
  --card-muted: #E5E7EB;
  --card-bg: #FFFFFF;

  --text: #111827;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --border: #D1D5DB;
  --border-light: #E5E7EB;

  --error: #DC2626;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.18);

  --transition: 0.18s ease;
}

/* Scoped reset - only affects #product-app */
#product-app *,
#product-app *::before,
#product-app *::after {
  box-sizing: border-box;
}

#product-app {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#product-app a { color: var(--accent); text-decoration: none; }
#product-app a:hover { text-decoration: underline; }
#product-app button { font-family: inherit; }

#product-app .container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

#product-app .hidden { display: none !important; }

/* Hide the internal footer when embedded in Aichi Sangyo site
   (the parent page already has a footer) */
#tab_contents #product-app .site-footer,
body#MKproducts #product-app .site-footer {
  display: none;
}

/* ---------- Top bar ---------- */
#product-app .topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

#product-app .breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
#product-app .breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
#product-app .breadcrumb a:hover { color: var(--primary); }
#product-app .breadcrumb-sep { color: var(--text-faint); font-weight: 400; }
#product-app .breadcrumb-current { color: var(--primary); }

#product-app .topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ---------- Favorites: top-bar entry point ---------- */
#product-app .favorites-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
#product-app .favorites-toggle:hover { border-color: var(--primary); color: var(--primary); }
#product-app .favorites-toggle svg {
  width: 15px;
  height: 15px;
  transition: fill var(--transition);
}
/* Open view, or any saved item: the heart fills in. */
#product-app .favorites-toggle.is-active {
  border-color: var(--primary);
  background: var(--accent-light);
  color: var(--primary);
}
#product-app .favorites-toggle.is-active svg { fill: currentColor; }
#product-app .favorites-toggle-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

#product-app .lang-toggle {
  /* Hidden for now; markup is kept so we can flip the display back on later. */
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}
#product-app .lang-toggle:hover { border-color: var(--primary); }
#product-app .lang-option { opacity: 0.5; transition: var(--transition); }
#product-app .lang-option.active { opacity: 1; font-weight: 600; color: var(--primary); }
#product-app .lang-divider { opacity: 0.4; }

/* ---------- Search bar ---------- */
#product-app .search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
#product-app .search-input-wrap { flex: 1; position: relative; }
#product-app .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}
#product-app .search-input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
}
#product-app .search-input::placeholder { color: var(--text-faint); }
/* Room on the right for the × so long queries don't run under it. */
#product-app .search-input-wrap .search-input { padding-right: 44px; }
#product-app .search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: var(--transition);
}
#product-app .search-clear svg { width: 16px; height: 16px; }
#product-app .search-clear:hover,
#product-app .search-clear:focus-visible {
  color: var(--text);
  background: var(--border-light);
  outline: none;
}
#product-app .search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(10, 31, 92, 0.08);
}
#product-app .search-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
#product-app .search-button:hover { background: var(--primary-hover); }
#product-app .search-button svg { width: 16px; height: 16px; }

/* ---------- Tag filter (dropdown, next to search) ---------- */
#product-app .tag-filter { position: relative; flex-shrink: 0; }
#product-app .tag-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
#product-app .tag-filter-toggle:hover { border-color: var(--primary); }
#product-app .tag-filter-toggle svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-faint); }
#product-app .tag-filter-toggle .tag-filter-chevron { transition: transform var(--transition); }
#product-app .tag-filter.open .tag-filter-toggle {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(10, 31, 92, 0.08);
}
#product-app .tag-filter.open .tag-filter-chevron { transform: rotate(180deg); }
#product-app .tag-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

#product-app .tag-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: 340px;
  max-width: min(340px, 88vw);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#product-app .tag-filter-search-wrap { position: relative; }
#product-app .tag-filter-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}
#product-app .tag-filter-search {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  font-size: 13px;
  color: var(--text);
}
#product-app .tag-filter-search:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

/* Match-all / match-any — a plain two-button segmented control. Considered
   dropping this to cut a decision from the panel, but AND-only silently
   narrows results as tags pile up with no way back to a broader view except
   deselecting one at a time; the toggle costs one glance, not a workflow. */
#product-app .tag-filter-mode {
  display: flex;
  padding: 3px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  gap: 3px;
}
#product-app .tag-filter-mode-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
#product-app .tag-filter-mode-btn.active { background: var(--bg); color: var(--primary); box-shadow: var(--shadow-sm); }

#product-app .tag-filter-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#product-app .tag-filter-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
#product-app .tag-filter-option:hover { background: var(--bg-alt); }
#product-app .tag-filter-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
#product-app .tag-filter-option-count { margin-left: auto; font-size: 11px; color: var(--text-faint); }
#product-app .tag-filter-empty { padding: 12px 4px; font-size: 13px; color: var(--text-faint); text-align: center; }

#product-app .tag-filter-actions { border-top: 1px solid var(--border-light); padding-top: 10px; }
#product-app .tag-filter-clear {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
#product-app .tag-filter-clear:hover { border-color: var(--primary); color: var(--primary); }
#product-app .tag-filter-clear:disabled { opacity: 0.5; cursor: not-allowed; }

/* Selected-tag chips echoed above the results grid so the active filter
   stays visible without reopening the panel. */
#product-app .tag-filter-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}
#product-app .tag-filter-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text);
}
#product-app .tag-filter-active-chip button {
  display: inline-flex;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
}
#product-app .tag-filter-active-chip button:hover { color: var(--primary); }
#product-app .tag-filter-active-chip button svg { width: 12px; height: 12px; }

/* ---------- Popular keywords ---------- */
#product-app .popular-keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}
#product-app .popular-keywords-label { font-size: 12px; color: var(--text-muted); }
#product-app .popular-keywords-list { display: flex; flex-wrap: wrap; gap: 6px; }
#product-app .keyword-chip {
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 6px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
#product-app .keyword-chip:hover { color: var(--primary); }

/* ---------- Headline ---------- */
/* Matches the existing aichi-sangyo h3.LPW pattern: smaller navy
   heading with a gold underline, then a paragraph subtitle below. */
#product-app .page-headline { margin: 16px 0 24px; }
#product-app .page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin: 0;
  padding: 3px 0;
  border-bottom: 2px solid #FC0;
}
#product-app .page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ---------- Steps ---------- */
#product-app .step-section {
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
}
#product-app .step-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 18px;
}
/* Guidance line drops to its own row below the badge + title. */
#product-app .step-hint {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-break: strict;
  word-break: keep-all;
  overflow-wrap: break-word;
}
#product-app .step-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: -apple-system, "Segoe UI", sans-serif;
}
#product-app .step-title { font-size: 15px; font-weight: 700; color: var(--text); }

#product-app .step-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

#product-app .step-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background: var(--card-muted);
  border-left: 4px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  font-family: inherit;
  color: inherit;
  border-top: none;
  border-right: none;
  border-bottom: none;
}
#product-app .step-card:hover { background: #DCDFE4; }
#product-app .step-card.active {
  background: var(--card-bg);
  border-left-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
#product-app .step-card-image {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#product-app .step-card.active .step-card-image { background: var(--bg-alt); }
#product-app .step-card-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
#product-app .step-card-image.empty {
  flex: 0 0 0;
  width: 0;
  height: 0;
  border: none;
}
#product-app .step-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#product-app .step-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
  /* Japanese typography: respect kinsoku, keep small kana / 長音符 off line start */
  line-break: strict;
  word-break: keep-all;
  overflow-wrap: break-word;
}
#product-app .step-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-break: strict;
  word-break: keep-all;
  overflow-wrap: break-word;
}
#product-app .step-card-selected {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: var(--accent-light);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
#product-app .step-card-selected::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
}
#product-app .step-card:not(.active) .step-card-selected { display: none; }

/* ---------- Results sections ---------- */
#product-app .results-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
#product-app .results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
#product-app .results-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
#product-app .results-count { font-size: 13px; font-weight: 500; color: var(--text-muted); }
#product-app .reset-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-bottom: 1px solid var(--accent);
  border-radius: 0;
  transition: var(--transition);
  font-family: inherit;
}
#product-app .reset-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
#product-app .reset-link svg { width: 14px; height: 14px; }
#product-app .reset-link--danger { color: var(--error); border-bottom-color: var(--error); }
#product-app .reset-link--danger:hover { color: var(--error); border-bottom-color: var(--error); opacity: 0.75; }

/* Header holds several actions in the favorites view; keep .results-header at
   two flex children so `space-between` still pins the title left. */
#product-app .results-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Inline confirmation — replaces the "clear all" link rather than opening a
   modal, so the destructive step stays where the user's eyes already are. */
#product-app .clear-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
#product-app .clear-confirm__text { font-size: 13px; color: var(--text); }
#product-app .clear-confirm__yes,
#product-app .clear-confirm__no {
  background: transparent;
  border: none;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
#product-app .clear-confirm__yes { color: var(--error); }
#product-app .clear-confirm__yes:hover { background: var(--error); color: #fff; }
#product-app .clear-confirm__no { color: var(--text-muted); }
#product-app .clear-confirm__no:hover { color: var(--text); }

/* ---------- Product grid + cards ---------- */
#product-app .product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

#product-app .product-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}
#product-app .product-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

#product-app .product-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 0;
  gap: 8px;
}
#product-app .product-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  font-family: -apple-system, "Segoe UI", monospace, sans-serif;
  letter-spacing: 0.02em;
}
#product-app .product-card-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
#product-app .product-card-tag.new { color: #fff; background: var(--primary); border-color: var(--primary); }
#product-app .product-card-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Favorites: heart toggle ---------- */
#product-app .favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: var(--transition);
  font-family: inherit;
  flex-shrink: 0;
  /* The heart sits on a card that opens the drawer, so a mis-tap costs the
     visitor a modal. Pad out to a ~34px touch target, then pull the margin
     back in so the row height and right edge stay where they were. */
  padding: 8px;
  margin: -8px -8px -8px 0;
}
#product-app .favorite-btn svg {
  width: 18px;
  height: 18px;
  transition: fill var(--transition), transform var(--transition);
}
#product-app .favorite-btn:hover { color: var(--primary); }
#product-app .favorite-btn:hover svg { transform: scale(1.12); }
#product-app .favorite-btn.is-active { color: var(--primary); }
#product-app .favorite-btn.is-active svg { fill: currentColor; }
#product-app .favorite-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* The drawer variant (.favorite-btn--inline) is declared further down, after
   .cta-btn — it has to win the properties they both set. */
#product-app .product-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  padding: 12px 18px 16px;
  line-break: strict;
  word-break: keep-all;
  overflow-wrap: break-word;
  /* Reserve 2 lines' worth of vertical space so cards with 1-line and
     2-line titles keep the same image position and card structure. */
  min-height: calc(2 * 1.4em + 12px + 16px);
}
#product-app .product-card-image {
  position: relative;
  margin: 0 18px;
  width: calc(100% - 36px);
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  border-radius: var(--radius-sm);
}
#product-app .product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
#product-app .product-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 11px;
  background: var(--bg-alt);
}
/* Firefox ESR <89 doesn't know `aspect-ratio`, so the container above
   collapses to 0 height and the 100%-height children collapse with it.
   Emulate the square the old way (padding-bottom sized off the container's
   own width) and pin the children over it. Modern browsers never see this. */
@supports not (aspect-ratio: 1 / 1) {
  #product-app .product-card-image {
    height: 0;
    padding-bottom: 100%;
  }
  #product-app .product-card-image img,
  #product-app .product-card-image-placeholder {
    position: absolute;
    inset: 0;
  }
}
#product-app .product-card-cta {
  display: block;
  margin-top: auto;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
  font-family: inherit;
}
#product-app .product-card-cta:hover { background: var(--primary-hover); }

/* ---------- State blocks ---------- */
#product-app .state-block {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
#product-app .state-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-faint);
}
#product-app .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
#product-app .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
#product-app .btn-primary { background: var(--primary); color: #fff; }
#product-app .btn-primary:hover { background: var(--primary-hover); }
#product-app .btn-block { width: 100%; }
#product-app .btn svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
#product-app .site-footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
#product-app .footer-copy { text-transform: uppercase; }
#product-app .footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
  flex-wrap: wrap;
}
#product-app .footer-links a {
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
}
#product-app .footer-links a:hover { color: var(--primary); }

/* ---------- Modal ---------- */
#product-app .modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#product-app .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
#product-app .modal-content {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
#product-app .modal-content--large {
  max-width: 880px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Drawer (product detail) — bottom sheet ---------- */
#product-app .modal--drawer {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
#product-app .modal--drawer .modal-backdrop {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: none;
}
#product-app .drawer {
  position: relative;
  width: 100%;
  height: 90vh;
  max-height: 90vh;
  background: var(--bg);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  animation: drawerIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 20px 20px 0 0;
}
@keyframes drawerIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
#product-app .drawer .modal-close {
  position: sticky;
  top: 12px;
  align-self: flex-end;
  margin: 12px 12px 0;
  z-index: 2;
  flex-shrink: 0;
}
#product-app #product-detail-content {
  padding: 0 32px 40px;
  flex: 1;
}
@media (max-width: 640px) {
  #product-app .drawer {
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  #product-app #product-detail-content { padding: 0 16px 24px; }
}
#product-app .modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  z-index: 2;
  transition: var(--transition);
}
#product-app .modal-close:hover { background: var(--card-muted); color: var(--text); }
#product-app .modal-close svg { width: 18px; height: 18px; }
#product-app .modal-header { text-align: center; margin-bottom: 24px; }
#product-app .modal-icon { font-size: 36px; margin-bottom: 12px; }
#product-app .modal-header h2 { font-size: 18px; color: var(--text); }

#product-app .download-form .form-field { margin-bottom: 14px; }
#product-app .download-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
#product-app .download-form input,
#product-app .download-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}
#product-app .download-form input:focus,
#product-app .download-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 31, 92, 0.1);
}

/* ---------- Product Detail Modal ---------- */
#product-app .product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
#product-app .product-detail__image {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
#product-app .product-detail__image > img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 480px;
  object-fit: contain;
  cursor: zoom-in;
}
#product-app .product-detail__info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 768px) {
  #product-app .product-detail {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
#product-app .product-detail__category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}
#product-app .product-detail__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
#product-app .product-detail__id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}
#product-app .product-detail__tags { display: flex; flex-wrap: wrap; gap: 6px; }
#product-app .product-detail__tags .product-tag {
  font: inherit;
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
/* Clicking a tag here jumps to the flat, filtered product list for that tag
   (same view free-text search produces) — see data-action="filter-tag". */
#product-app .product-detail__tags .product-tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
#product-app .product-detail__description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}
#product-app .product-detail__features h4,
#product-app .product-detail__specs h4,
#product-app .product-detail__variants h4,
#product-app .product-detail__dimensions h4,
#product-app .product-detail__docs h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 8px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
#product-app .product-detail__features ul {
  list-style: disc;
  padding-left: 20px;
  color: var(--text);
}
#product-app .product-detail__features li { margin-bottom: 4px; }
#product-app .specs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#product-app .specs-table th,
#product-app .specs-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
/* CTA buttons under the spec table (catalog download / contact) */
.product-detail__cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 4px;
}
/* Scoped to #product-app: host pages (aichi-sangyo common.css) style bare
   `a:link/:visited/:hover`, which outranks a plain `.cta-btn` class and would
   repaint these as blue underlined links. */
#product-app .cta-btn {
  flex: 1 1 180px;
  display: inline-block;
  padding: 13px 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
  line-break: strict;
  word-break: keep-all;
}
#product-app .cta-btn--solid {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
#product-app .cta-btn--solid:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
#product-app .cta-btn--outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}
#product-app .cta-btn--outline:hover { background: var(--bg-alt); }

/* Favorites: drawer variant. Declared after .cta-btn so it wins the properties
   they both set (display, padding, radius) without inflating specificity. */
#product-app .favorite-btn--inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  /* Cancel the card variant's negative margin. .product-detail__cta stretches
     its items, so a -8px block margin would size this border box 16px taller
     than the buttons beside it. */
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#product-app .favorite-btn--inline svg { width: 16px; height: 16px; }
#product-app .favorite-btn--inline:hover { background: var(--bg-alt); border-color: var(--primary); }
#product-app .favorite-btn--inline.is-active {
  border-color: var(--primary);
  background: var(--accent-light);
  color: var(--primary);
}

.specs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs-table th,
.specs-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.specs-table th { width: 40%; color: var(--text-muted); font-weight: 500; }
.specs-table td { color: var(--text); }
/* 追加工オプションの注記。表の行ではなく表の下に置く（2026-08 営業確認） */
.product-detail__variants p.variant-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-alt);
  line-height: 1.6;
  border-radius: 4px;
}
#product-app .specs-table th { width: 40%; color: var(--text-muted); font-weight: 500; }
#product-app .specs-table td { color: var(--text); }
#product-app .docs-list { display: flex; flex-direction: column; gap: 8px; }
#product-app .doc-btn--full {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--accent-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: var(--transition);
}
#product-app .doc-btn--full:hover { background: var(--primary); color: #fff; }
#product-app .doc-btn--full svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Drawer sections (related products, recently viewed) ---------- */
#product-app .drawer-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
#product-app .drawer-section__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

#product-app .mini-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
#product-app .mini-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
#product-app .mini-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
#product-app .mini-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
#product-app .mini-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
#product-app .mini-card-image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-alt);
}
@supports not (aspect-ratio: 1 / 1) {
  #product-app .mini-card-image {
    position: relative;
    height: 0;
    padding-bottom: 100%;
  }
  #product-app .mini-card-image img,
  #product-app .mini-card-image-placeholder {
    position: absolute;
    inset: 0;
  }
}
/* The product-number row doubles as the heart's row. The heart sits here
   rather than over the image on purpose: the whole mini card opens the
   drawer, and a heart floating on the image is the easiest thing to hit by
   accident on a phone. Keeping it out of the image area makes "save" and
   "open" two clearly separate targets. */
#product-app .mini-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
  margin-bottom: 2px;
}
#product-app .mini-card-id {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  font-family: -apple-system, "Segoe UI", monospace, sans-serif;
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Smaller than the grid-card heart to suit the 200px card, but the padding
   still buys a ~27px touch target and the negative margin keeps the row
   height and right edge unchanged. */
#product-app .favorite-btn--mini {
  padding: 6px;
  margin: -6px -6px -6px 0;
}
#product-app .favorite-btn--mini svg { width: 15px; height: 15px; }
#product-app .mini-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  line-break: strict;
  word-break: keep-all;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image Carousel */
#product-app .image-carousel { position: relative; }
#product-app .carousel-slides {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 480px;
  margin: auto;
  overflow: hidden;
}
@supports not (aspect-ratio: 1 / 1) {
  #product-app .carousel-slides {
    height: 0;
    padding-bottom: 100%;
  }
}
#product-app .carousel-slides .carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  cursor: zoom-in;
}
#product-app .carousel-slides .carousel-slide.active { display: block; }
#product-app .carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px 12px;
  z-index: 1;
  line-height: 1;
}
#product-app .carousel-btn:hover { background: rgba(0, 0, 0, 0.6); }
#product-app .carousel-prev { left: 0; }
#product-app .carousel-next { right: 0; }
#product-app .carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  background: var(--bg);
  border-top: 1px solid var(--border-light);
}
#product-app .carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
#product-app .carousel-dot:hover { background: var(--text-muted); }
#product-app .carousel-dot.active { background: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #product-app .container { padding: 16px 16px 60px; }
  #product-app .topbar { flex-wrap: wrap; }
  #product-app .modal-content--large { max-height: 95vh; }
}

@media (max-width: 640px) {
  #product-app .search-bar { flex-direction: column; }
  #product-app .search-button { width: 100%; padding: 14px; }
  #product-app .tag-filter-toggle { width: 100%; justify-content: space-between; padding: 12px 16px; }
  #product-app .tag-filter-panel { width: 100%; max-width: 100%; left: 0; right: 0; }
  #product-app .step-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  #product-app .step-card { flex-direction: column; align-items: flex-start; padding: 12px 14px; gap: 10px; }
  #product-app .step-card-image { flex: none; }
  #product-app .product-grid { grid-template-columns: 1fr; gap: 16px; }
  #product-app .results-header { flex-direction: column; align-items: flex-start; }
  #product-app .site-footer { flex-direction: column; align-items: flex-start; }
  #product-app .footer-links { gap: 12px; }
}

/* ---------- Lightbox (image zoom) ---------- */
#product-app .lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: lightboxIn 0.18s ease;
}
@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#product-app .lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}
#product-app .lightbox-image {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - 64px);
  object-fit: contain;
  z-index: 1;
  cursor: zoom-out;
  user-select: none;
  -webkit-user-drag: none;
}
#product-app .lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  z-index: 2;
  transition: var(--transition);
}
#product-app .lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
#product-app .lightbox-close svg { width: 20px; height: 20px; }
@media (max-width: 640px) {
  #product-app .lightbox { padding: 16px; }
  #product-app .lightbox-image { max-height: calc(100vh - 32px); }
}
