/* ==========================================================================
   Rnice Casing · Apple Design System (100% Self-Contained & Resilient CSS)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --apple-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Plus Jakarta Sans", "Noto Sans SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --apple-bg: #F5F5F7;
  --apple-card: #FFFFFF;
  --apple-text: #1D1D1F;
  --apple-subtext: #86868B;
  --apple-blue: #0071E3;
  --apple-blue-hover: #0077ED;
  --apple-border: rgba(0, 0, 0, 0.08);
  --apple-border-strong: #D2D2D7;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--apple-font);
  background-color: var(--apple-bg);
  color: var(--apple-text);
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Strict Global Image Constraints (Prevent Giant Overflow) */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Apple Frosted Glass Top Nav (48px) */
.apple-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 48px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--apple-border);
}

/* Apple Cards (Bento Style) */
.apple-card {
  background-color: var(--apple-card);
  border-radius: 24px;
  border: 1px solid var(--apple-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 540px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.apple-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.07);
}

/* Product Card Image Container (Guaranteed Fixed Framing) */
.apple-img-wrap {
  width: 100%;
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #F5F5F7;
  border-radius: 18px;
  overflow: hidden;
  padding: 16px;
  margin: 12px 0;
  position: relative;
}

.apple-img-wrap img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 10px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-card:hover .apple-img-wrap img {
  transform: scale(1.04);
}

/* Product Grid Layout */
#products-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
}

@media (min-width: 640px) {
  #products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  #products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Apple Buttons */
.apple-btn-primary {
  background-color: var(--apple-blue);
  color: #FFFFFF !important;
  font-weight: 500;
  border-radius: 980px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.apple-btn-primary:hover {
  background-color: var(--apple-blue-hover);
  transform: scale(1.02);
}

.apple-btn-secondary {
  background-color: #E8E8ED;
  color: var(--apple-text) !important;
  font-weight: 500;
  border-radius: 980px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.apple-btn-secondary:hover {
  background-color: #DCDCE2;
  transform: scale(1.02);
}

/* Apple Link with Arrow */
.apple-link {
  color: var(--apple-blue);
  font-size: 14px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, gap 0.15s ease;
}

.apple-link:hover {
  color: var(--apple-blue-hover);
  gap: 6px;
  text-decoration: underline;
}

/* Filter Buttons */
.category-filter-btn {
  border: 1px solid var(--apple-border);
  cursor: pointer;
  font-family: inherit;
}

/* Modals & Backdrop */
.modal-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

/* Smooth Focus Rings */
input:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.3);
}

/* Text Selection */
::selection {
  background-color: rgba(0, 113, 227, 0.2);
  color: #1D1D1F;
}

/* Hero Image Container */
#hero-section img {
  max-height: 340px;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto;
}

/* Bento & Packaging Grids */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.packaging-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 768px) {
  .packaging-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.specs-bar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 640px) {
  .specs-bar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Excel Spec Matrix Table */
#modal-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

#modal-spec-table th {
  background-color: #F5F5F7;
  color: var(--apple-text);
  font-weight: 600;
  text-align: left;
}

#modal-spec-table td {
  color: var(--apple-text);
}

/* 3D & Video Viewport Controls */
.ui-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(40, 45, 55, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.ui-btn:hover {
  background: rgba(0, 113, 227, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.08);
}

.ui-btn:active {
  transform: scale(0.92);
}

/* Pure Borderless Scroll-Driven Video Stage */
#hero-video-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  user-select: none;
}

#hero-video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 20px;
  overflow: hidden;
}

#hero-scroll-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
  display: block;
}

