/* ==========================================================================
   I LINK INTERNATIONAL - 3D Scroll Layer (3d-scroll.css)
   Progressive enhancement: every rule is scoped under .has-3d, which
   3d-scroll.js only adds when motion is allowed. Animates transform/opacity only.
   ========================================================================== */

:root {
    --d3-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Scroll progress bar --- */
.d3-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 2000;
    pointer-events: none;
    transform-origin: 0 50%;
    transform: scaleX(var(--prog, 0));
    background: linear-gradient(90deg, var(--primary-dark), var(--accent));
}

/* --- Hero: depth on scroll + mouse parallax --- */
.has-3d .hero {
    perspective: 1200px;
}

.has-3d .hero-content {
    transform:
        translate3d(calc(var(--mx, 0) * -10px), calc(var(--hp, 0) * 50px), calc(var(--hp, 0) * -90px))
        rotateX(calc(var(--hp, 0) * -8deg + var(--my, 0) * 2deg))
        rotateY(calc(var(--mx, 0) * 2.5deg));
    opacity: calc(1 - var(--hp, 0) * 1.1);
    will-change: transform, opacity;
}

.has-3d .hero-video {
    transform: translate(-50%, -50%) scale(calc(1 + var(--hp, 0) * 0.1));
}

/* Floating gold 3D shapes (created by JS, purely decorative) */
.d3-shapes {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
    transform-style: preserve-3d;
}

.d3-shape {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--s);
    height: var(--s);
    transform-style: preserve-3d;
    transform:
        translate3d(calc(var(--mx, 0) * var(--k) * 46px), calc(var(--hp, 0) * var(--k) * -190px + var(--my, 0) * var(--k) * 30px), 0);
    will-change: transform;
}

.d3-cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: d3-spin var(--t, 22s) linear infinite;
}

.d3-cube i {
    position: absolute;
    inset: 0;
    border: 1.5px solid rgba(199, 174, 106, 0.32);
    background: rgba(199, 174, 106, 0.04);
}

.d3-cube i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.d3-cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.d3-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.d3-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.d3-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.d3-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }

.d3-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(229, 195, 101, 0.28);
    box-shadow: 0 0 40px rgba(199, 174, 106, 0.18), inset 0 0 30px rgba(199, 174, 106, 0.1);
    animation: d3-tumble var(--t, 16s) ease-in-out infinite alternate;
}

.d3-panel {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    border: 1.5px solid rgba(199, 174, 106, 0.28);
    background: linear-gradient(135deg, rgba(199, 174, 106, 0.1), rgba(199, 174, 106, 0.02));
    animation: d3-tumble var(--t, 18s) ease-in-out infinite alternate-reverse;
}

.d3-shape.s1 { --x: 7%;  --y: 16%; --s: 84px;  --k: 0.9;  --t: 24s; }
.d3-shape.s2 { --x: 86%; --y: 60%; --s: 48px;  --k: 1.4;  --t: 18s; }
.d3-shape.s3 { --x: 80%; --y: 12%; --s: 150px; --k: 0.5;  --t: 14s; }
.d3-shape.s4 { --x: 12%; --y: 70%; --s: 110px; --k: 0.7;  --t: 20s; }
.d3-shape.s5 { --x: 48%; --y: 6%;  --s: 30px;  --k: 1.7;  --t: 16s; }

.hero.hero-off .d3-cube,
.hero.hero-off .d3-ring,
.hero.hero-off .d3-panel {
    animation-play-state: paused;
}

@keyframes d3-spin {
    from { transform: rotateX(0deg) rotateY(0deg); }
    to   { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes d3-tumble {
    from { transform: rotateX(62deg) rotateZ(0deg); }
    to   { transform: rotateX(78deg) rotateZ(160deg); }
}

/* --- 3D scroll reveal for everything below the hero --- */
.has-3d .d3r:not(.revealed) {
    opacity: 0;
    transform:
        perspective(1100px)
        translate3d(calc(var(--side, 0) * 18px), 34px, -50px)
        rotateX(12deg)
        rotateY(calc(var(--side, 0) * 6deg));
    transform-origin: 50% 100%;
}

.has-3d .d3r.revealed:not(.settled) {
    opacity: 1;
    transform: perspective(1100px) translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg);
}

.has-3d .d3r:not(.settled) {
    transition:
        opacity 700ms var(--d3-ease),
        transform 900ms var(--d3-ease),
        box-shadow 250ms ease,
        border-color 250ms ease;
    transition-delay: calc(var(--i, 0) * 90ms);
}

/* --- Pointer tilt on cards --- */
.has-3d .tilting,
.has-3d .d3r.tilting.tilting {
    transform:
        perspective(900px)
        translateY(-4px)
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg));
    box-shadow: var(--sx, 0px) 22px 36px -10px rgba(23, 23, 23, 0.18), var(--shadow-gold);
    border-color: var(--primary-light);
    transition: transform 120ms ease-out, box-shadow 250ms ease, border-color 250ms ease;
    will-change: transform;
}

/* --- Inner-page headers: content drifts back as you scroll --- */
.has-3d .d3-pagehead > :not([class*="background"]):not([class*="floating"]):not(.d3-shapes) {
    transform: perspective(1000px) translate3d(0, calc(var(--hp, 0) * 24px), calc(var(--hp, 0) * -50px));
    opacity: calc(1 - var(--hp, 0) * 0.85);
    will-change: transform, opacity;
}

/* --- Stats band: tilts flat as it crosses the viewport --- */
.has-3d .stats-band {
    overflow: hidden;
}

.has-3d .stats-grid {
    transform: perspective(1100px) rotateX(calc((0.5 - var(--sp, 0.5)) * 10deg));
    will-change: transform;
}

/* --- Responsive: lighter effects on small screens --- */
@media (max-width: 768px) {
    .has-3d .d3r:not(.revealed) {
        transform: perspective(900px) translate3d(0, 24px, -30px) rotateX(8deg);
    }
    .d3-shape.s3,
    .d3-shape.s5 {
        display: none;
    }
    .has-3d .hero-content {
        transform: translate3d(0, calc(var(--hp, 0) * 36px), calc(var(--hp, 0) * -60px)) rotateX(calc(var(--hp, 0) * -6deg));
    }
}

@media (prefers-reduced-motion: reduce) {
    .d3-shapes,
    .d3-progress {
        display: none;
    }
}

/* ==========================================================================
   3D Showcase sections (3d-showcase.js)
   ========================================================================== */

.d3-showcase {
    background: var(--surface-muted);
    overflow: hidden;
}

.d3-stage {
    position: relative;
    height: clamp(380px, 46vw, 440px);
    perspective: 1300px;
    outline-offset: 6px;
    touch-action: pan-y;
    user-select: none;
}

.d3-track {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.d3-card {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(220px, 28vw, 300px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 700ms var(--d3-ease), opacity 500ms ease, box-shadow 300ms ease, border-color 300ms ease;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.d3-card.is-active {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl), var(--shadow-gold);
}

.d3-card-img {
    aspect-ratio: 4 / 3;
    background: var(--surface-muted);
    overflow: hidden;
}

.d3-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.d3-card-body {
    padding: var(--space-3) var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.d3-card-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.d3-card-rating {
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.d3-card-cta {
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 600;
}

.d3-nav {
    position: absolute;
    top: 50%;
    z-index: 20;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background var(--transition-normal), color var(--transition-normal), transform var(--transition-normal);
}

.d3-nav:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.08);
}

.d3-nav .icon {
    width: 20px;
    height: 20px;
}

.d3-prev { left: 4px; }
.d3-next { right: 4px; }

/* Tilted category marquee */
.d3-marquee {
    background: linear-gradient(135deg, #1A1D24 0%, #111317 100%);
    border-top: 1px solid rgba(199, 174, 106, 0.25);
    border-bottom: 1px solid rgba(199, 174, 106, 0.25);
    padding: 18px 0;
    overflow: hidden;
    transform: perspective(1200px) rotateX(calc((0.5 - var(--sp, 0.5)) * 6deg));
}

.d3-marquee-track {
    display: flex;
    width: max-content;
    animation: d3-marquee 38s linear infinite;
}

.d3-marquee:hover .d3-marquee-track,
.d3-marquee.d3-paused .d3-marquee-track {
    animation-play-state: paused;
}

.d3-marquee-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.d3-marquee-item {
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-light);
    white-space: nowrap;
}

.d3-marquee-dot {
    color: var(--primary-dark);
    margin: 0 28px;
    font-size: 0.7rem;
}

@keyframes d3-marquee {
    to { transform: translateX(-50%); }
}

@media (max-width: 640px) {
    .d3-nav { width: 40px; height: 40px; margin-top: -20px; }
}

/* ==========================================================================
   Inner pages: shared 3D polish
   ========================================================================== */

/* Old fadeInUp animations hold a transform and would override the 3D reveal */
.has-3d .d3r {
    animation: none;
}

.has-3d .d3-pagehead {
    position: relative;
}

.has-3d .d3-pagehead > :not([class*="background"]):not([class*="floating"]):not(.d3-shapes) {
    position: relative;
    z-index: 3;
}

/* Mini floating shapes for page headers */
.d3-shapes--mini .d3-shape.s1 { --x: 6%;  --y: 14%; --s: 46px; }
.d3-shapes--mini .d3-shape.s2 { --x: 90%; --y: 52%; --s: 30px; }
.d3-shapes--mini .d3-shape.s4 { --x: 82%; --y: 8%;  --s: 70px; }

/* Scroll-linked depth (progressive: only where scroll-driven animations exist) */
@supports (animation-timeline: view()) {
    .has-3d .section-title {
        animation: d3-title linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 85%;
        transform-origin: 50% 100%;
    }

    .has-3d .feature-icon-box,
    .has-3d .info-icon,
    .has-3d .trust-icon-box {
        animation: d3-icon linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 100%;
    }

    .has-3d .pc-img,
    .has-3d .collection-image {
        animation: d3-turn linear both;
        animation-timeline: view();
        animation-range: cover 0% cover 100%;
    }
}

@keyframes d3-title {
    from { transform: perspective(700px) rotateX(55deg) translateY(20px); opacity: 0.15; }
    to   { transform: perspective(700px) rotateX(0deg) translateY(0); opacity: 1; }
}

@keyframes d3-icon {
    from { transform: perspective(500px) rotateY(-160deg) scale(0.6); }
    to   { transform: perspective(500px) rotateY(0deg) scale(1); }
}

@keyframes d3-turn {
    0%   { transform: perspective(800px) rotateY(-24deg) rotateX(8deg) scale(0.92); }
    50%  { transform: perspective(800px) rotateY(0deg) rotateX(0deg) scale(1); }
    100% { transform: perspective(800px) rotateY(24deg) rotateX(-8deg) scale(0.92); }
}

/* Cursor glare on tilting cards */
.pc-media::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.6), transparent 55%);
    opacity: 0;
    transition: opacity 250ms ease;
}

.tilting .pc-media::after {
    opacity: 1;
}

/* ==========================================================================
   Products page: product cards
   ========================================================================== */
.product-card.pc {
    display: flex;
    flex-direction: column;
    overflow: visible;
    cursor: default;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    animation: none;
}

.product-card.pc:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl), var(--shadow-gold);
    border-color: var(--primary-light);
}

.pc-media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    perspective: 700px;
    border-radius: 18px 18px 0 0;
    background:
        radial-gradient(circle at 50% 42%, #ffffff 0%, var(--primary-subtle) 58%, var(--surface-muted) 100%);
    text-decoration: none;
}

.pc-media::before {
    content: '';
    position: absolute;
    left: 20%;
    right: 20%;
    bottom: 8%;
    height: 9%;
    background: radial-gradient(ellipse at center, rgba(23, 23, 23, 0.22), transparent 70%);
    filter: blur(4px);
}

.pc-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 9%;
    object-fit: contain;
    filter: drop-shadow(0 16px 12px rgba(23, 23, 23, 0.22));
    transform: translateZ(40px);
    transition: transform 500ms var(--d3-ease), filter 300ms ease;
    pointer-events: none;
}

.product-card.pc:hover .pc-img {
    filter: drop-shadow(0 26px 18px rgba(23, 23, 23, 0.28));
}

.pc-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px 20px;
    border-top: 1px solid var(--border-light);
}

.pc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.pc-stars {
    color: #F59E0B;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.pc-rating {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
}

.pc-title {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 4px 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pc-title a {
    color: var(--text);
    text-decoration: none;
}

.pc-title a:hover {
    color: var(--primary-dark);
}

.pc-desc {
    flex: 1;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pc-actions {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.pc-wa {
    flex: 1;
    min-width: 0;
    background: #25D366;
    border-color: #25D366;
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(37, 211, 102, 0.7);
}

.pc-wa:hover {
    background: #1ebe5b;
    border-color: #1ebe5b;
    box-shadow: 0 12px 22px -8px rgba(37, 211, 102, 0.8);
}

.pc-details {
    flex-shrink: 0;
}

/* ==========================================================================
   Product detail page
   ========================================================================== */
@media (min-width: 900px) {
    .product-gallery {
        position: sticky;
        top: 100px;
    }
}

.product-info,
.product-gallery {
    min-width: 0;
}

.main-image {
    perspective: 900px;
    overflow: visible;
    border-radius: 22px;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, var(--primary-subtle) 60%, var(--surface-muted) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

/* Floating gold ring behind the product */
.main-image::before {
    content: '';
    position: absolute;
    left: 14%;
    right: 14%;
    top: 14%;
    bottom: 14%;
    border-radius: 50%;
    border: 2px solid rgba(199, 174, 106, 0.35);
    box-shadow: 0 0 50px rgba(199, 174, 106, 0.2), inset 0 0 40px rgba(199, 174, 106, 0.12);
    animation: d3-tumble 14s ease-in-out infinite alternate;
    pointer-events: none;
}

/* Contact shadow */
.main-image::after {
    content: '';
    position: absolute;
    left: 24%;
    right: 24%;
    bottom: 5%;
    height: 7%;
    background: radial-gradient(ellipse at center, rgba(23, 23, 23, 0.28), transparent 70%);
    filter: blur(5px);
    pointer-events: none;
}

.main-image img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: clamp(300px, 42vw, 520px);
    padding: 7%;
    object-fit: contain;
    filter: drop-shadow(0 22px 18px rgba(23, 23, 23, 0.25));
    transform: rotateX(var(--irx, 0deg)) rotateY(var(--iry, 0deg));
    transition: transform 150ms ease-out;
    will-change: transform;
}

.main-image:hover img {
    transform: rotateX(var(--irx, 0deg)) rotateY(var(--iry, 0deg)) scale(1.05);
}

.thumbnail {
    background: #fff;
    transition: transform 250ms var(--d3-ease), box-shadow 250ms ease, border-color 250ms ease;
}

.thumbnail img {
    object-fit: contain !important;
    background: #fff;
}

.thumbnail:hover,
.thumbnail.active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-gold);
}

/* Enquire / Bulk buttons: always fully visible */
.product-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 12px;
    margin: 24px 0;
}

.product-actions .btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
    text-decoration: none;
}

.pd-wa {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
    box-shadow: 0 12px 24px -10px rgba(37, 211, 102, 0.75);
}

.pd-wa:hover {
    background: #1ebe5b;
    border-color: #1ebe5b;
    transform: translateY(-3px) perspective(600px) rotateX(6deg);
    box-shadow: 0 18px 30px -10px rgba(37, 211, 102, 0.8);
}

.pd-bulk:hover {
    transform: translateY(-3px) perspective(600px) rotateX(6deg);
}

@media (max-width: 480px) {
    .pc-actions {
        flex-wrap: wrap;
    }
    .pc-details {
        flex: 1;
    }
}

/* Products grid: comfortable card size; photos blend into the card background */
.products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.75rem;
}

.pc-img,
.main-image img {
    mix-blend-mode: multiply;
}

.pc-media {
    background: radial-gradient(circle at 50% 45%, #ffffff 0%, #ffffff 66%, var(--primary-subtle) 100%);
}

.main-image {
    background: radial-gradient(circle at 50% 42%, #ffffff 0%, #ffffff 68%, var(--primary-subtle) 100%);
}

.product-title,
.specs-title,
.features-title {
    font-family: var(--font-heading);
}

/* ==========================================================================
   Plain white picture backgrounds: no rings, glows or box shadows, so photos
   of any size or crop blend into the page and never look cut out.
   ========================================================================== */
.main-image,
.pc-media,
.d3-card-img,
.thumbnail,
.thumbnail img {
    background: #ffffff;
}

.main-image::before,
.main-image::after,
.pc-media::before {
    content: none;
}

.pc-img,
.main-image img {
    filter: none;
}

.product-card.pc:hover .pc-img {
    filter: none;
}

/* Reserve the marquee's height so the page does not jump when its data loads */
.d3-marquee {
    min-height: 64px;
}
