/* ===================================================================
   Sarah Mei Li Piano — Custom Stylesheet
   Design tokens defined as CSS custom properties at :root.
   =================================================================== */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* Color Palette */
    --color-ivory:        #f8f5f0;
    --color-ivory-dark:   #ebe5db;
    --color-cream:        #faf7f2;
    --color-gold:         #c9a84c;
    --color-gold-hover:   #b8933a;
    --color-gold-light:   rgba(201, 168, 76, 0.12);
    --color-burgundy:     #8b3a3a;
    --color-burgundy-dark:#6e2d2d;
    --color-dark:         #1a1a1a;
    --color-dark-soft:    #2a2a2a;
    --color-text:         #2c2416;
    --color-text-light:   #6b5e4a;
    --color-text-muted:   #9c8e7a;
    --color-white:        #ffffff;

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-zh:      'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;

    /* Spacing Scale (based on 8px) */
    --space-xs:  0.25rem;  /* 4px  */
    --space-sm:  0.5rem;   /* 8px  */
    --space-md:  1rem;     /* 16px */
    --space-lg:  2rem;     /* 32px */
    --space-xl:  3rem;     /* 48px */
    --space-2xl: 5rem;     /* 80px */
    --space-3xl: 8rem;     /* 128px */

    /* Borders & Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg:  0 8px 30px rgba(0, 0, 0, 0.10);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-smooth: 300ms ease;
    --transition-slow:   500ms ease;
}

/* ── Base Reset & Global Styles ─────────────────────────────── */
*,
*::before,
*::after {
    transition: var(--transition-fast);
}

body {
    font-family: var(--font-body);
    background-color: var(--color-ivory);
    color: var(--color-text);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-dark);
}

h1, .h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2, .h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3, .h3 { font-size: clamp(1.35rem, 3vw, 1.75rem); }

a {
    color: var(--color-gold);
    text-decoration: none;
}

a:hover {
    color: var(--color-gold-hover);
}

/* Chinese font stack: body text follows lang attribute */
html[lang="zh"] body {
    font-family: var(--font-zh), var(--font-body);
}

html[lang="zh"] h1,
html[lang="zh"] h2,
html[lang="zh"] h3,
html[lang="zh"] h4,
html[lang="zh"] h5,
html[lang="zh"] h6 {
    font-family: var(--font-zh), var(--font-heading);
}

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar.bg-dark {
    background-color: var(--color-dark) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
}

.navbar-dark .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.15);
}

.navbar-dark .navbar-toggler:focus {
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.4);
}

/* Logo */
.site-logo {
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: 0.02em;
    color: var(--color-gold) !important;
    transition: color var(--transition-smooth);
}

.site-logo:hover {
    color: var(--color-white) !important;
}

/* Nav Links */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    padding: var(--space-sm) var(--space-md) !important;
    position: relative;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: var(--color-gold);
}

/* Active nav link — gold underline */
.navbar-dark .navbar-nav .nav-link.active {
    color: var(--color-gold) !important;
    background: none !important;
}

.navbar-dark .navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-md);
    right: var(--space-md);
    height: 2px;
    background-color: var(--color-gold);
    border-radius: 1px;
}

/* Language switcher */
.lang-switch {
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-md) !important;
    margin-top: 2px;
    transition: border-color var(--transition-smooth), color var(--transition-smooth);
}

.lang-switch:hover {
    border-color: var(--color-gold);
    color: var(--color-gold) !important;
}

/* ── Hero Section ────────────────────────────────────────────── */
/* Usage: <section class="hero" style="--hero-bg: url('/assets/images/sarah.jpg')"> */
.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-image: var(--hero-bg, none);
    background-size: cover;
    background-position: center 30%;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Dark gradient overlay */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(26, 26, 26, 0.55) 0%,
        rgba(0, 0, 0, 0.45) 50%,
        rgba(26, 26, 26, 0.65) 100%
    );
    z-index: 1;
}

.hero > * {
    position: relative;
    z-index: 2;
}

.hero h1,
.hero .hero-name {
    font-family: var(--font-heading);
    font-size: clamp(2.75rem, 6vw, 5rem);
    font-weight: 600;
    color: var(--color-white);
    letter-spacing: 0.03em;
    margin-bottom: var(--space-md);
}

.hero .hero-tagline {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Section Spacing ─────────────────────────────────────────── */
.section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
}

.section-sm {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
}

.section-lg {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
}

/* ── Piano-Key Divider ───────────────────────────────────────── */
/* Elegant thin decorative border — subtle repeating gradient like piano keys */
.piano-divider {
    height: 5px;
    background: repeating-linear-gradient(
        to right,
        var(--color-dark) 0px,
        var(--color-dark) 14px,
        var(--color-ivory) 14px,
        var(--color-ivory) 28px
    );
    opacity: 0.1;
    border: none;
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
}

/* Thinner variant for tighter spaces */
.piano-divider-sm {
    height: 3px;
    background: repeating-linear-gradient(
        to right,
        var(--color-dark) 0px,
        var(--color-dark) 10px,
        var(--color-ivory) 10px,
        var(--color-ivory) 20px
    );
    opacity: 0.08;
    border: none;
    margin: var(--space-lg) 0;
}

/* ── Card Styles (Awards, Bio highlights) ────────────────────── */
.card-custom {
    background-color: var(--color-cream);
    border: none;
    border-left: 3px solid var(--color-gold);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-custom .card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: var(--space-xs);
}

.card-custom .card-subtitle {
    color: var(--color-gold);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card-custom .card-text {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

.card-custom .card-year {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
}

/* ── Gallery Grid ────────────────────────────────────────────── */
.gallery-item {
    margin-bottom: var(--space-lg);
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.gallery-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.gallery-item:hover img {
    transform: scale(1.06);
}

.gallery-item .gallery-caption {
    background-color: var(--color-cream);
    padding: var(--space-md);
    font-size: 0.9rem;
    color: var(--color-text-light);
    border-top: 1px solid var(--color-ivory-dark);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-gold {
    background-color: var(--color-gold);
    color: var(--color-white);
    border: none;
    padding: var(--space-sm) var(--space-lg);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-block;
    text-align: center;
    transition: background-color var(--transition-smooth), transform var(--transition-fast);
}

.btn-gold:hover {
    background-color: var(--color-gold-hover);
    color: var(--color-white);
    transform: translateY(-1px);
}

.btn-gold:active {
    transform: translateY(0);
}

.btn-gold:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-gold-light);
}

/* Outline variant */
.btn-gold-outline {
    background-color: transparent;
    color: var(--color-gold);
    border: 2px solid var(--color-gold);
    padding: calc(var(--space-sm) - 2px) calc(var(--space-lg) - 2px);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

.btn-gold-outline:hover {
    background-color: var(--color-gold);
    color: var(--color-white);
}

/* ── Contact Form ────────────────────────────────────────────── */
.form-control-custom {
    display: block;
    width: 100%;
    padding: var(--space-md);
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-white);
    border: 1px solid var(--color-ivory-dark);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.form-control-custom:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px var(--color-gold-light);
}

textarea.form-control-custom {
    min-height: 140px;
    resize: vertical;
}

/* ── YouTube Embed ───────────────────────────────────────────── */
.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-lg);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background-color: var(--color-dark);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.25rem;
    text-decoration: none;
    transition: background-color var(--transition-smooth), color var(--transition-smooth),
        transform var(--transition-fast);
}

.social-link:hover {
    background-color: var(--color-gold);
    color: var(--color-white);
    transform: translateY(-3px);
}

.social-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.35);
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* ── Utility: Section Heading ────────────────────────────────── */
.section-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-xs);
}

.section-subheading {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.05rem;
    margin-bottom: var(--space-xl);
}

/* ── Media Queries ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* Navbar mobile — spread nav links */
    .navbar-collapse {
        padding-top: var(--space-md);
        padding-bottom: var(--space-sm);
    }

    .navbar-nav .nav-item {
        padding: var(--space-xs) 0;
    }

    .lang-switch {
        display: inline-block;
        margin-top: var(--space-sm);
    }

    /* Adjust section spacing on tablets */
    .section {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
    }

    .section-lg {
        padding-top: var(--space-2xl);
        padding-bottom: var(--space-2xl);
    }
}

@media (max-width: 767.98px) {
    /* Hero shorter on phones */
    .hero {
        min-height: 55vh;
    }

    .hero h1,
    .hero .hero-name {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .hero .hero-tagline {
        font-size: 0.9rem;
        letter-spacing: 0.06em;
    }

    /* Section spacing tighter */
    .section {
        padding-top: var(--space-lg);
        padding-bottom: var(--space-lg);
    }

    .section-lg {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
    }

    /* Cards full-width */
    .card-custom {
        padding: var(--space-md);
    }

    /* Gallery images shorter height */
    .gallery-item img {
        height: 220px;
    }

    /* Footer social icons smaller */
    .footer-social {
        gap: var(--space-md);
    }

    .social-link {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

@media (max-width: 575.98px) {
    /* Hero even shorter on small phones */
    .hero {
        min-height: 50vh;
    }

    .hero h1,
    .hero .hero-name {
        font-size: 1.75rem;
    }

    /* Further reduce spacing */
    .section {
        padding-top: var(--space-md);
        padding-bottom: var(--space-md);
    }

    /* Gallery images shorter still */
    .gallery-item img {
        height: 200px;
    }
}

/* ── Accessibility: Reduced Motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Print Styles ────────────────────────────────────────────── */
@media print {
    .navbar,
    .site-footer,
    .piano-divider,
    .hero {
        display: none;
    }

    body {
        background: var(--color-white);
        color: #000;
    }

    main {
        padding: 0;
    }
}
