/* ==========================================================================
   OVEN FRESH — Kilang Roti & Kek Kuala Terengganu
   Global Stylesheet (Multi-File Structure)
   ========================================================================== */

:root {
  --brand-red: #D9252A;
  --brand-red-dark: #B3191E;
  --brand-red-hover: #BF1E23;
  --brand-red-light: #FEF2F2;
  --brand-dark: #181515;
  --brand-dark-soft: #241E1F;
  --brand-cream: #FAF7F2;
  --brand-surface: #FFFFFF;
  --brand-amber: #D97706;
  --brand-amber-light: #FEF3C7;
  --brand-muted: #78716C;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

section[id] {
  scroll-margin-top: 5rem;
}

body {
  background-color: var(--brand-cream);
  color: var(--brand-dark);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #F5EFEB;
}
::-webkit-scrollbar-thumb {
  background: #D9252A;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #B3191E;
}

/* Hero Carousel Transitions */
.hero-slide {
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Glassmorphism & Frosted Surfaces */
.glass-nav {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

html.dark .glass-nav {
  background: rgba(20, 17, 17, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

html.dark .glass-panel {
  background: rgba(28, 24, 23, 0.75) !important;
}

.hero-glass-btn {
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-glass-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

/* Product Card Interactive Elevation & Artisan Warmth */
.product-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  will-change: transform, box-shadow;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(24, 21, 21, 0.08), 0 4px 12px -2px rgba(217, 37, 42, 0.06);
  border-color: rgba(217, 37, 42, 0.28);
}

/* 45-Degree 3D Corner Ribbon with Fold-Behind Effect */
.corner-ribbon-container {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 104px;
  height: 104px;
  overflow: hidden;
  pointer-events: none;
  z-index: 25;
}

.corner-ribbon-container .ribbon-fold-top {
  position: absolute;
  top: 0;
  left: 70px;
  width: 0;
  height: 0;
  border-bottom: 4px solid var(--ribbon-fold-color, #78350f);
  border-left: 4px solid transparent;
}

.corner-ribbon-container .ribbon-fold-left {
  position: absolute;
  top: 70px;
  left: 0;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-right: 4px solid var(--ribbon-fold-color, #78350f);
}

.corner-ribbon-banner {
  position: absolute;
  top: 27px;
  left: -34px;
  width: 146px;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* Product Image Zoom on Hover */
.product-image-container img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-image-container img {
  transform: scale(1.05);
}

/* Category Filter Active Pill */
.cat-btn {
  transition: all 0.2s ease;
}

/* Language Selection Overlay Backdrop */
#languageOverlay {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* App Wrapper Blur State */
#pageApp.app-blurred {
  filter: blur(12px);
  -webkit-filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

/* ==========================================================================
   Dark Mode Global Styles & Components
   ========================================================================== */
html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #141111;
  color: #F5EFEB;
}

html.dark nav {
  background-color: rgba(24, 21, 21, 0.95) !important;
  border-color: #2E2827 !important;
}

html.dark #mobileMenu {
  background-color: #181515 !important;
  border-color: #2E2827 !important;
}

html.dark .product-card {
  background-color: #1C1817 !important;
  border-color: #2E2827 !important;
  color: #F5EFEB !important;
}

html.dark .product-card:hover {
  border-color: rgba(217, 37, 42, 0.45) !important;
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.65), 0 4px 14px -2px rgba(217, 37, 42, 0.2) !important;
}

.carousel-dot {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: width, background-color;
}

html.dark .product-card h3,
html.dark .product-card h4 {
  color: #FFFFFF !important;
}

html.dark .product-card p {
  color: #A8A29E !important;
}

html.dark .product-card .border-t {
  border-color: #2E2827 !important;
}

html.dark #catSearchInput {
  background-color: #1C1817 !important;
  border-color: #2E2827 !important;
  color: #F5EFEB !important;
}

html.dark #catSearchInput::placeholder {
  color: #78716C !important;
}

html.dark #outlet {
  background-color: #1C1817 !important;
  border-color: #2E2827 !important;
}

html.dark #outlet h2 {
  color: #FFFFFF !important;
}

html.dark #outlet p {
  color: #A8A29E !important;
}

html.dark #outlet .bg-brand-cream {
  background-color: #241F1E !important;
  border-color: #2E2827 !important;
}

html.dark #outlet .bg-brand-cream h4 {
  color: #FFFFFF !important;
}

html.dark #about h2 {
  color: #FFFFFF !important;
}

html.dark #about p {
  color: #D6D3D1 !important;
}

html.dark #about .border-t {
  border-color: #2E2827 !important;
}

html.dark #about .text-stone-600 {
  color: #A8A29E !important;
}

html.dark #catalogue h2 {
  color: #FFFFFF !important;
}

html.dark #catalogue p {
  color: #A8A29E !important;
}

html.dark .cat-btn:not(.bg-brand-red) {
  background-color: #1C1817 !important;
  border-color: #2E2827 !important;
  color: #D6D3D1 !important;
}

html.dark .cat-btn:not(.bg-brand-red):hover {
  border-color: #D9252A !important;
  color: #FFFFFF !important;
}

/* Secondary Badges in Dark Mode */
html.dark .product-card .bg-gradient-to-r.from-amber-50 {
  background-image: linear-gradient(to right, rgba(120, 53, 15, 0.35), rgba(180, 83, 9, 0.45), rgba(120, 53, 15, 0.35)) !important;
  border-color: rgba(217, 119, 6, 0.5) !important;
  color: #FCD34D !important;
}


/* Prevent saved-language flash while the selected dictionary is applied. */
html.language-pending body { visibility: hidden; }


/* Homepage catalogue preview: responsive 3-row limit across all viewports */
/* Mobile (< 640px): 1 column -> 3 rows (3 cards) */
@media (max-width: 639px) {
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(n + 4) {
    display: none !important;
  }

  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(3) {
    opacity: 0.62;
    filter: blur(1.2px);
    transform: scale(0.99);
    pointer-events: none;
    user-select: none;
  }

  .home-catalogue-preview > .absolute {
    height: 20rem;
    padding-bottom: 1.5rem;
  }

  .home-catalogue-preview > .absolute > div {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .home-catalogue-preview > .absolute a[href="/catalogue"] {
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }
}

/* Tablet (640px - 1023px): 2 columns -> exactly 3 rows (6 cards) */
@media (min-width: 640px) and (max-width: 1023px) {
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(n + 7) {
    display: none !important;
  }

  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(5),
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(6) {
    opacity: 0.65;
    filter: blur(1px);
    transform: scale(0.99);
    pointer-events: none;
    user-select: none;
  }

  .home-catalogue-preview > .absolute {
    height: 22rem;
    padding-bottom: 2rem;
  }
}

/* Large Tablet / Medium Desktop (1024px - 1279px): 3 columns -> exactly 3 rows (9 cards) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(n + 10) {
    display: none !important;
  }

  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(7),
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(8),
  .home-catalogue-preview #productGrid[data-preview="true"] > .prod-item:nth-child(9) {
    opacity: 0.7;
    filter: blur(1px);
    transform: scale(0.99);
    pointer-events: none;
    user-select: none;
  }

  .home-catalogue-preview > .absolute {
    height: 24rem;
    padding-bottom: 2.5rem;
  }
}


