/* ============================================ */
/* CSS Variables for theming */
/* ============================================ */
:root {
    /* Light mode colors */
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-primary: #B8860B;
    --border-color: #E5E5E5;
    --shadow-light: rgba(0, 0, 0, 0.04);
    --shadow-medium: rgba(0, 0, 0, 0.08);
    --link-hover: #1A1A1A;
    --price-color: #1A1A1A;
    --toggle-bg: rgba(255, 255, 255, 0.95);
    --toggle-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #0A0A0A;
    --bg-secondary: #141414;
    --text-primary: #E5E5E5;
    --text-secondary: #A0A0A0;
    --text-muted: #707070;
    --accent-primary: #D4AF37;
    --border-color: #2A2A2A;
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --link-hover: #FFFFFF;
    --price-color: #E5E5E5;
    --toggle-bg: rgba(40, 40, 40, 0.95);
    --toggle-border: rgba(255, 255, 255, 0.1);
}

/* ============================================ */
/* Base Styles */
/* ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================ */
/* Layout & Container */
/* ============================================ */
.menu {
    min-height: 100vh;
    padding: 4rem 0 8rem;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.menuContainer {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 2rem;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* Typography */
/* ============================================ */
h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 200;
    letter-spacing: 0.15em;
    text-align: center;
    margin: 4rem 0 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
}

h2 {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    margin: 5rem 0 2.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

h2:first-of-type {
    margin-top: 0;
}

/* Contact Link */
.contact {
    text-align: center;
    margin-bottom: 6rem;
}

.contact a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    text-transform: uppercase;
    font-weight: 500;
}

.contact a:hover {
    color: var(--text-primary);
}

/* ============================================ */
/* Lists & Items */
/* ============================================ */
ul {
    list-style: none;
    padding: 0;
    margin: 0 0 3rem 0;
}

.listHeader {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 2.5rem 0 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.itemList {
    /* Default styling for inner pages - cards */
    background: rgba(255, 255, 255, 0.5);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

[data-theme="dark"] .itemList {
    background: rgba(255, 255, 255, 0.03);
}

.itemList:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--shadow-medium);
}

.itemList li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.itemList li:last-child {
    border-bottom: none;
}

.itemList li:hover {
    padding-left: 0.5rem;
}

.itemList a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    flex-grow: 1;
    letter-spacing: 0.01em;
}

.itemList a:hover {
    color: var(--accent-primary);
}

.itemList p {
    margin: 1.5rem 0;
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.itemList p:last-child {
    margin-bottom: 0;
}

.itemList b {
    font-weight: 600;
    color: var(--text-primary);
}

.price {
    font-weight: 400;
    color: var(--price-color);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    margin-left: 2rem;
    font-variant-numeric: tabular-nums;
}

/* ============================================ */
/* Inner Page Specific Elements */
/* ============================================ */
.region {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 4rem;
    font-weight: 500;
}

.product-content {
    margin: 3rem 0;
}

.product-content p {
    margin: 1.5rem 0;
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.product-content p:first-child {
    margin-top: 0;
}

.product-content p b {
    font-weight: 600;
    color: var(--text-primary);
}

.specs {
    margin-top: 3rem !important;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================ */
/* Floating Buttons */
/* ============================================ */

/* Back Button (Inner Pages) */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px var(--shadow-light);
    text-decoration: none;
    z-index: 1000;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.back-button svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
    transition: fill 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Theme toggle on inner pages - bottom position */
.back-button ~ .theme-toggle {
    top: auto;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.theme-toggle:hover {
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.theme-icon,
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-primary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    opacity: 0;
    visibility: hidden;
    display: none;
}

.theme-toggle .sun-icon.show,
.theme-toggle .moon-icon.show {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--shadow-light);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateY(10px);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.back-to-top.show,
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}

/* Adjust positioning when both buttons are present */
.back-button ~ .theme-toggle ~ .back-to-top {
    right: 90px;
}

/* ============================================ */
/* INDEX PAGE OVERRIDES */
/* ============================================ */
.index-page .itemList {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    backdrop-filter: none !important;
    margin-bottom: 0 !important;
}

.index-page .itemList:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================ */
/* Mobile Responsive */
/* ============================================ */
@media (max-width: 768px) {
    .menu {
        padding: 70px 15px 30px;
    }
    
    .menuContainer {
        padding: 0 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
        margin: 3rem 0 1rem;
    }
    
    h2 {
        font-size: 1rem;
        margin: 4rem 0 2rem;
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .back-button {
        width: 45px;
        height: 45px;
        top: 15px;
        left: 15px;
    }
    
    .back-button ~ .theme-toggle {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
    
    .itemList {
        padding: 1.5rem;
    }
    
    .index-page .itemList {
        padding: 0 !important;
    }
    
    .itemList li {
        padding: 0.8rem 0;
    }
    
    .price {
        margin-left: 1rem;
    }
    
    .contact {
        margin-bottom: 4rem;
    }
    
    .region {
        margin-bottom: 3rem;
    }
    
    .product-content p {
        font-size: 0.9rem;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
    
    .back-button ~ .theme-toggle ~ .back-to-top {
        right: 75px;
    }
}

@media (min-width: 769px) {
    .itemList li {
        padding: 1rem 0;
    }
}

/* ============================================ */
/* Print Styles */
/* ============================================ */
@media print {
    .theme-toggle,
    .back-to-top,
    .back-button {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    h1, h2 {
        color: black;
    }
    
    .itemList li {
        border-bottom: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* Remove old h4 back link styles if present */
.menuContainer h4 {
    display: none;
}
/* ============================================ */
/* Navigation Menu Styles */
/* ============================================ */

/* Navigation Toggle Button */
.nav-toggle {
    position: fixed;
    top: 2rem;
    left: 2rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

.nav-toggle:hover {
    border-color: var(--text-primary);
}

/* Hide toggle when menu is active */
.nav-toggle.active {
    opacity: 0;
    pointer-events: none;
}

/* Navigation Icon */
.nav-icon {
    width: 18px;
    height: 14px;
    position: relative;
}

.nav-icon path {
    fill: var(--text-primary);
    transition: all 0.3s ease;
}

/* Navigation Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
    backdrop-filter: blur(2px);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    background: var(--bg-secondary);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.nav-menu.active {
    transform: translateX(0);
}

/* Navigation Header */
.nav-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 88px;
}

.nav-header h3 {
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0;
}

/* Close button inside menu */
.nav-close {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-close:hover {
    border-color: var(--text-primary);
    transform: rotate(90deg);
}

.nav-close svg {
    width: 18px;
    height: 18px;
}

.nav-close svg path {
    fill: var(--text-primary);
}

/* Navigation Links */
.nav-links {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-links li {
    margin: 0;
    border: none;
    padding: 0;
}

.nav-link {
    display: block;
    padding: 1rem 2rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    position: relative;
    text-transform: uppercase;
    font-weight: 400;
}

.nav-link:hover {
    color: var(--accent-primary);
    background: var(--bg-primary);
    padding-left: 2.5rem;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-primary);
    transition: height 0.2s ease;
}

.nav-link:hover::before,
.nav-link.active::before {
    height: 60%;
}

/* Active section indicator */
.nav-link.active {
    color: var(--accent-primary);
}

/* Dark mode specific styles for nav */
[data-theme="dark"] .nav-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .nav-menu {
    background: var(--bg-secondary);
    border-right-color: var(--border-color);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .nav-toggle {
        top: 1rem;
        left: 1rem;
        width: 40px;
        height: 40px;
    }
    
    /* Full screen menu on mobile */
    .nav-menu {
        width: 100%;
        border-right: none;
    }
    
    /* Hide overlay on mobile since menu is full-screen */
    .nav-overlay {
        display: none;
    }
    
    .nav-header {
        padding: 1.5rem;
        min-height: 72px;
    }
    
    /* Smaller close button on mobile to avoid overlap */
    .nav-close {
        width: 40px;
        height: 40px;
    }
    
    .nav-links {
        padding: 2rem 0;
    }
    
    .nav-link {
        padding: 1.2rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .nav-link:hover {
        padding-left: 2rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-menu {
        width: 320px;
    }
}

/* Adjust main content when nav is open */
body.nav-open {
    overflow: hidden;
}

/* Only show nav toggle on index page */
body:not(.index-page) .nav-toggle {
    display: none;
}

/* Smooth transitions for menu items appearing */
.nav-menu.active .nav-link {
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

.nav-menu.active .nav-link:nth-child(1) { animation-delay: 0.1s; }
.nav-menu.active .nav-link:nth-child(2) { animation-delay: 0.15s; }
.nav-menu.active .nav-link:nth-child(3) { animation-delay: 0.2s; }
.nav-menu.active .nav-link:nth-child(4) { animation-delay: 0.25s; }
.nav-menu.active .nav-link:nth-child(5) { animation-delay: 0.3s; }
.nav-menu.active .nav-link:nth-child(6) { animation-delay: 0.35s; }
.nav-menu.active .nav-link:nth-child(7) { animation-delay: 0.4s; }

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ensure theme toggle stays on top and doesn't conflict */
.theme-toggle {
    z-index: 997; /* Below nav menu but still accessible */
}

/* On mobile, adjust theme toggle position when nav is open */
@media (max-width: 768px) {
    body.nav-open .theme-toggle {
        opacity: 0.3; /* Slightly fade it to show it's not interactive */
        pointer-events: none;
    }
}

/* Language Toggle Button */
.lang-toggle {
    position: fixed;
    top: 2rem;
    right: 5rem; /* Position it next to theme toggle */
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 0 16px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 997;
    transition: all 0.3s ease;
    min-width: 44px;
}

.lang-toggle:hover {
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.lang-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    text-transform: uppercase;
}

/* Adjust positioning on mobile */
@media (max-width: 768px) {
    .lang-toggle {
        top: 1rem;
        right: 4rem;
        height: 40px;
        padding: 0 14px;
    }
}

/* Adjust when nav is open */
body.nav-open .lang-toggle {
    opacity: 0.3;
    pointer-events: none;
}

/* Font stack with CJK support */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 
                 'Noto Sans CJK TC', 'Microsoft YaHei', 'Hiragino Sans', 
                 'Meiryo', sans-serif;
}

/* Adjust font weights for CJK languages */
[data-lang="zh"] body,
[data-lang="ja"] body {
    font-weight: 400;
}

[data-lang="zh"] h1,
[data-lang="ja"] h1 {
    font-weight: 300;
}
/* Adjust line height for CJK languages */
[data-lang="zh"] .itemList li,
[data-lang="ja"] .itemList li {
    line-height: 1.8;
}

/* Slightly smaller font size for longer Japanese text */
[data-lang="ja"] .itemList a {
    font-size: 0.9rem;
}

/* Ensure proper spacing for mixed English/CJK text */
[data-lang="zh"] .itemList a,
[data-lang="ja"] .itemList a {
    word-spacing: 0.1em;
}