/* ==========================================================================
   Watch Showcase - Fully Responsive Mobile & Desktop Theme
   Zero Horizontal Overflow, Strict Grid / Table Layout & Touch-Ready Gallery
   ========================================================================== */

:root {
  --bg-primary: #0d0f12;
  --bg-surface: #14171d;
  --bg-elevated: #1a1e26;
  --bg-card-hover: #202530;
  
  --border-subtle: #242933;
  --border-active: #3c4454;
  --border-gold: rgba(212, 175, 55, 0.45);

  --text-primary: #f5f6f8;
  --text-secondary: #9ea5b2;
  --text-muted: #676e7d;

  --accent-gold: #c5a059;
  --accent-gold-light: #e6ca85;
  --accent-gold-glow: rgba(197, 160, 89, 0.2);

  --font-serif: "Playfair Display", "Cinzel", "Didot", "Bodoni MT", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8);

  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s ease;
  --max-width: 1200px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, .serif {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Header & Navigation */
.site-header {
  width: 100%;
  max-width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13, 15, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.brand-link {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.brand-title {
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  white-space: nowrap;
}

/* Breadcrumbs */
.breadcrumb-nav {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 1.25rem;
  box-sizing: border-box;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  overflow: hidden;
}

.breadcrumb-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.breadcrumb-inner::-webkit-scrollbar {
  display: none;
}

.breadcrumb-inner a {
  color: var(--text-secondary);
}

.breadcrumb-inner a:hover {
  color: var(--accent-gold);
}

.breadcrumb-separator {
  opacity: 0.4;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  color: var(--accent-gold-light);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

/* Filters & Search */
.controls-bar {
  max-width: var(--max-width);
  margin: 1.25rem auto 1.5rem;
  padding: 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.filter-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  scrollbar-width: none;
  padding-bottom: 0.2rem;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  white-space: nowrap;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
}

.filter-chip.active {
  background: var(--accent-gold);
  color: #0d0f12;
  font-weight: 600;
  border-color: var(--accent-gold);
}

.search-box {
  position: relative;
  width: 240px;
  max-width: 100%;
  min-width: 0;
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.search-input:focus {
  border-color: var(--accent-gold);
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

@media (max-width: 640px) {
  .controls-bar {
    margin: 1rem auto 1.25rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .search-box {
    width: 100%;
  }
}

/* Watch Catalog Grid */
.catalog-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  width: 100%;
  box-sizing: border-box;
}

.watch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
}

@media (min-width: 540px) {
  .watch-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 980px) {
  .watch-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

.watch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  min-width: 0;
  box-sizing: border-box;
}

.watch-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold);
  box-shadow: var(--shadow-md);
}

.card-image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 280px;
  background: #090a0c;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 980px) {
  .card-image-wrap {
    max-height: 240px;
  }
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.watch-card:hover .card-image {
  transform: scale(1.03);
}

.card-content {
  padding: 0.95rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.card-brand {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.15rem;
}

.card-model {
  font-size: 1.1rem;
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-footer {
  margin-top: auto;
}

/* ==========================================================================
   Watch Detail Page Layout (Responsive side-by-side on desktop, single column on phone)
   ========================================================================== */
.detail-main {
  max-width: var(--max-width);
  margin: 1.25rem auto 3rem;
  padding: 0 1.25rem;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.detail-grid {
  display: grid;
  grid-template-columns: 100%; /* Force 100% width on mobile to avoid 1fr expansion */
  gap: 1.5rem;
  align-items: start;
  width: 100%;
  min-width: 0; /* CRITICAL: prevents grid blowout by wide children */
  box-sizing: border-box;
}

.detail-grid > * {
  min-width: 0; /* CRITICAL: allows children to shrink and scroll horizontally */
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 920px) {
  .detail-grid {
    grid-template-columns: minmax(360px, 1.05fr) minmax(340px, 0.95fr);
    gap: 2.5rem;
  }

  .gallery-section {
    position: sticky;
    top: 65px;
  }
}

/* Gallery Section */
.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0; /* CRITICAL */
  box-sizing: border-box;
}

.gallery-main-frame {
  position: relative;
  background: #090a0c;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  max-height: min(46vh, 380px);
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 920px) {
  .gallery-main-frame {
    aspect-ratio: 1 / 1;
    max-height: min(52vh, 460px);
  }
}

.gallery-main-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity var(--transition-fast);
}

.gallery-counter {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  padding: 0.2rem 0.55rem;
  background: rgba(13, 15, 18, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  color: var(--text-primary);
  pointer-events: none;
  font-weight: 500;
}

.gallery-zoom-hint {
  position: absolute;
  bottom: 0.65rem;
  right: 0.65rem;
  padding: 0.22rem 0.55rem;
  background: rgba(13, 15, 18, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.gallery-thumbs-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0; /* CRITICAL */
  padding-bottom: 0.4rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-active) transparent;
}

.thumb-item {
  flex: 0 0 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: #090a0c;
  cursor: pointer;
  opacity: 0.65;
  transition: all var(--transition-fast);
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .thumb-item {
    flex: 0 0 50px;
    height: 50px;
  }
}

.thumb-item:hover {
  opacity: 0.9;
  border-color: var(--border-active);
}

.thumb-item.active {
  opacity: 1;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Detail Info Section */
.detail-info {
  display: flex;
  flex-direction: column;
  min-width: 0; /* CRITICAL */
  width: 100%;
  box-sizing: border-box;
}

.detail-brand {
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.15rem;
}

.detail-title {
  font-size: clamp(1.4rem, 5vw, 2.15rem);
  line-height: 1.15;
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.detail-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.detail-description {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  word-break: break-word;
}

/* Technical Specification Table */
.spec-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* CRITICAL: ensures table respects width and wraps text */
  font-size: 0.84rem;
}

.spec-table tr {
  border-bottom: 1px solid var(--border-subtle);
}

.spec-table tr:last-child {
  border-bottom: none;
}

.spec-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.spec-table th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  width: 35%;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.15);
  vertical-align: top;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
}

.spec-table td {
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  line-height: 1.45;
  width: 65%;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .detail-main {
    padding: 0 0.85rem;
    margin: 1rem auto 2.5rem;
  }
  .header-inner {
    padding: 0.65rem 0.85rem;
  }
  .breadcrumb-nav {
    padding: 0.4rem 0.85rem;
  }
  .spec-table th {
    width: 36%;
    padding: 0.55rem 0.6rem;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
  }
  .spec-table td {
    width: 64%;
    padding: 0.55rem 0.6rem;
    font-size: 0.8rem;
  }
}

/* Modern HTML5 Lightbox Dialog with light-dismiss */
dialog.lightbox-dialog {
  padding: 0;
  border: none;
  background: transparent;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: auto;
  outline: none;
  overflow: hidden;
  box-sizing: border-box;
}

dialog.lightbox-dialog::backdrop {
  background: rgba(5, 7, 10, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
  touch-action: pan-y pinch-zoom;
}

.lightbox-img {
  max-width: 94vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-caption {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-word;
}

.lightbox-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(20, 23, 29, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  backdrop-filter: blur(8px);
  z-index: 20;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 23, 29, 0.75);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(6px);
  z-index: 15;
}

.lightbox-nav-btn:hover {
  background: var(--accent-gold);
  color: #0d0f12;
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

@media (max-width: 600px) {
  .lightbox-nav-btn {
    width: 36px;
    height: 36px;
  }
  .lightbox-prev {
    left: 0.35rem;
  }
  .lightbox-next {
    right: 0.35rem;
  }
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 100%;
  box-sizing: border-box;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a:hover {
  color: var(--accent-gold);
}
