/* ============================================
   RINGCHEN - Home Aesthetics Brand Website
   ============================================ */

/* --- Custom Fonts --- */
@font-face {
    font-family: 'Raleway';
    src: url('/assets/fonts/Raleway-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --- CSS Variables --- */
:root {
    --color-primary: #000000;
    --color-secondary: #333333;
    --color-text: #000000;
    --color-text-light: rgba(0, 0, 0, 0.65);
    --color-bg: #ffffff;
    --color-bg-light: rgba(0, 0, 0, 0.05);
    --color-accent: #8b7355;
    --color-white: #ffffff;

    --font-heading: 'Playfair Display', 'Georgia', serif;
    --font-body: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    --nav-height: 60px;
    --page-padding: 80px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--page-padding);
}

/* --- Loading Screen --- */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 4px;
    margin-bottom: 24px;
    color: var(--color-primary);
}

.loader-bar {
    width: 120px;
    height: 2px;
    background: var(--color-bg-light);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    border-radius: 2px;
    animation: loaderProgress 1.8s var(--ease-out) forwards;
}

@keyframes loaderProgress {
    0% { width: 0; }
    60% { width: 70%; }
    100% { width: 100%; }
}

/* --- Navigation --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1000;
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.navbar.nav-hidden {
    transform: translateY(-100%);
}

.navbar.scrolled {
    background-color: #ffffff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.nav-container {
    margin: 0 auto;
    padding: 0 var(--page-padding);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #ffffff;
    transition: color 0.3s;
    z-index: 1001;
    position: relative;
}

.navbar.scrolled .nav-logo {
    color: #000000;
}

.nav-links {
    display: none;
}

.nav-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: color 0.3s, background-color 0.2s;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-icon-btn img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1); /* white icons */
    transition: filter 0.3s;
}

.navbar.scrolled .nav-icon-btn img {
    filter: brightness(0); /* black icons on scrolled navbar */
}

.nav-icon-btn:hover {
    background-color: rgba(128, 128, 128, 0.2);
}

.navbar.scrolled .nav-icon-btn {
    color: #000000;
}

.navbar.scrolled .nav-icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.mobile-only {
    display: block;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    transition: color 0.3s, background-color 0.2s;
    border-radius: 50%;
}

.nav-icon-btn img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
    transition: filter 0.3s;
}

.navbar.scrolled .nav-icon-btn img {
    filter: brightness(0);
}

.nav-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.navbar.scrolled .nav-icon-btn {
    color: var(--color-primary);
}

.navbar.scrolled .nav-icon-btn:hover {
    background-color: var(--color-bg-light);
}

/* --- Mobile Menu --- */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease-out);
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-content {
    height: 100%;
    padding: 24px var(--page-padding);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mobile-menu-content::-webkit-scrollbar {
    display: none;
}

.mobile-menu-close {
    align-self: flex-end;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    z-index: 2001;
}

.mobile-menu-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    width: 100%;
    padding-top: 16px;
    padding-bottom: 40px;
}

.menu-group {
    margin-bottom: 8px;
    text-align: center;
}

.mobile-menu-link {
    font-family: var(--font-body);
    font-size: 42px;
    font-weight: 700;
    color: #ffffff;
    transition: opacity 0.3s;
    opacity: 0;
    transform: translateY(20px);
    display: block;
    letter-spacing: 1px;
    text-align: center;
}

.mobile-menu.active .mobile-menu-link {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), color 0.3s;
}

.mobile-menu.active .mobile-menu-links > :nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.active .mobile-menu-links > :nth-child(2) { transition-delay: 0.1s; }
.mobile-menu.active .mobile-menu-links > :nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.active .mobile-menu-links > :nth-child(4) { transition-delay: 0.2s; }
.mobile-menu.active .mobile-menu-links > :nth-child(5) { transition-delay: 0.25s; }

.mobile-menu-link:hover {
    opacity: 0.5;
}

.menu-sub-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 12px;
    margin-bottom: 16px;
    padding-left: 0;
}

.menu-sub-link {
    font-family: var(--font-body);
    font-size: 30px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    transition: color 0.3s;
    opacity: 0;
    transform: translateY(10px);
    text-align: center;
}

.mobile-menu.active .menu-sub-link {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), color 0.3s;
}

.menu-sub-link:hover {
    color: #ffffff;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.15) 40%,
        rgba(0, 0, 0, 0.35) 100%
    );
}

/* --- Philosophy Section --- */
.philosophy {
    padding: 100px 0;
    background: var(--color-bg);
}

.philosophy-inner {
    padding: 0 var(--page-padding);
}

.section-header {
    margin-bottom: 40px;
}

.section-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.section-link {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--color-text-light);
    white-space: nowrap;
    transition: color 0.3s;
}

.section-link:hover {
    color: var(--color-primary);
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-primary);
}

.philosophy-text p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-text-light);
}

/* --- Products Section --- */
.products {
    padding: 80px 0 100px;
    background: var(--color-bg);
}

.product-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 24px;
}

.product-tab {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--color-text-light);
    transition: all 0.3s var(--ease-smooth);
    border-radius: 4px;
    white-space: nowrap;
    text-decoration: none;
}

.product-tab:hover {
    color: var(--color-primary);
    background: var(--color-bg-light);
}

.product-tab.active {
    color: var(--color-primary);
    background: var(--color-bg-light);
    font-weight: 500;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.product-card {
    cursor: pointer;
}

.product-card:hover .product-img-wrapper img {
    filter: brightness(0.85);
    transition: filter 0.4s var(--ease-out);
}

.product-card.hidden {
    display: none;
}

.product-img-wrapper {
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 8px;
    background: var(--color-bg-light);
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.4s var(--ease-out);
}

.product-name {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--color-primary);
    text-align: center;
}

/* --- Service Section --- */
.service {
    padding: 100px 0;
    background: var(--color-bg);
}

.service .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.service-content .section-title {
    margin-bottom: 24px;
}

.service-desc {
    font-size: 15px;
    line-height: 1.8;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.service-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.service-image-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.service-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.4s var(--ease-out);
}

.service-image-wrapper:hover img {
    filter: brightness(0.85);
}

.service-btn {
    display: inline-block;
    padding: 12px 32px;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-white);
    transition: all 0.3s var(--ease-smooth);
}

.service-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

/* --- Factory Section --- */
.factory {
    padding: 100px 0;
    background: var(--color-bg);
}

.factory .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.factory-content .section-title {
    margin-bottom: 24px;
}

.factory-desc {
    font-size: 15px;
    line-height: 1.8;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.factory-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.factory-image-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.factory-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.4s var(--ease-out);
}

.factory-image-wrapper:hover img {
    filter: brightness(0.85);
}

.factory-btn {
    display: inline-block;
    padding: 12px 32px;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-white);
    transition: all 0.3s var(--ease-smooth);
}

.factory-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

/* --- Inspiration Section --- */
.inspiration {
    padding: 100px 0;
    background: var(--color-bg);
}

.inspiration-header {
    margin-bottom: 48px;
}

.inspiration-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

.inspiration-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.inspiration-card-large {
    grid-row: 1 / 3;
}

.inspiration-card-content {
    padding: 16px 0;
}

.inspiration-date {
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.inspiration-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 500;
    margin-top: 8px;
    line-height: 1.4;
    color: var(--color-primary);
}

.inspiration-card-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.inspiration-card-large .inspiration-card-image {
    aspect-ratio: auto;
    flex: 1;
    min-height: 300px;
}

.inspiration-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.4s var(--ease-out);
}

.inspiration-card:hover .inspiration-card-image img {
    filter: brightness(0.85);
}

/* --- Footer --- */
.footer {
    padding: 32px 0 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: #000000;
}

.footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-social {
    display: flex;
    gap: 16px;
}

.footer-social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border-radius: 50%;
}

.footer-bottom {
    display: flex;
    align-items: center;
    gap: 24px;
}

.footer-copy {
    font-size: 13px;
    color: #ffffff;
}

.footer-privacy {
    font-size: 13px;
    color: #ffffff;
    cursor: pointer;
}

/* --- Animations --- */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .service .container,
    .factory .container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .inspiration-grid {
        grid-template-columns: 1fr;
    }

    .inspiration-card-large {
        grid-row: auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
        --page-padding: 20px;
    }

    .philosophy {
        padding: 60px 0;
    }

    .products {
        padding: 60px 0 80px;
    }

    .product-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }

    .product-tabs::-webkit-scrollbar {
        display: none;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-tab {
        font-size: 13px;
        padding: 6px 12px;
        flex-shrink: 0;
    }

    .service,
    .factory {
        padding: 60px 0;
    }

    .inspiration {
        padding: 60px 0;
    }

    .inspiration-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: clamp(24px, 6vw, 36px);
    }

    .footer .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-name {
        font-size: 14px;
    }

    .service .container,
    .factory .container {
        gap: 24px;
    }

    .service-btn,
    .factory-btn {
        width: 100%;
        text-align: center;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 400px;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    [data-animate] {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   Fullscreen Image Viewer
   ============================================ */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-viewer.active {
    opacity: 1;
    visibility: visible;
}

.image-viewer-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.image-viewer-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.25);
}
