/* ============================================================
   hoshinoshiroya.uk — Main Stylesheet
   极简日式风格 · 响应式 · CSS变量驱动
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #777777;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f2f2f2;
    --accent: #7b6b8a;
    --accent-hover: #5e4f6e;
    --accent-light: #f0ecf5;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans', 'Noto Sans CJK SC', sans-serif;
    --font-serif: 'Georgia', 'Noto Serif CJK SC', 'STSong', serif;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    --header-height-ratio: 0.22; /* 上约1/5 */
    --max-width: 960px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   BACKGROUND CAROUSEL (fixed fullscreen)
   ============================================================ */
#bg-carousel {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}
.bg-layer {
    position: absolute;
    inset: 0;
    transition: opacity 1.2s ease;
}
/* Fill layer: subtle cover behind main (no blur) */
.bg-fill {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    transform: scale(1);
}
/* Main layer: contain, centered */
.bg-main {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
}
/* Dark overlay for readability */
.bg-overlay {
    background: rgba(0, 0, 0, 0.45);
    opacity: 1 !important;
}

/* Body transparency for bg visibility */
body {
    background: transparent !important;
}

/* Clean panels — fully transparent, no white overlay */
.site-header,
.site-nav,
.site-main,
.site-footer {
    background: transparent !important;
}

/* --- Avatar glow ring --- */
.header-avatar {
    box-shadow:
        0 0 0 3px rgba(123, 107, 138, 0.12),
        0 4px 20px rgba(123, 107, 138, 0.18),
        0 8px 40px rgba(0, 0, 0, 0.06);
}

/* --- Language Switcher --- */
.lang-switcher {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 4px;
}
.lang-switcher .lang-icon {
    font-size: 1.2rem;
    cursor: pointer;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    line-height: 1;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    user-select: none;
}
.lang-switcher .lang-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}
.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    overflow: hidden;
    z-index: 1001;
}
.lang-dropdown.open {
    display: block;
}
.lang-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: background var(--transition-fast);
}
.lang-dropdown button:hover {
    background: var(--accent-light);
}
.lang-dropdown button.active {
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
}

/* --- Header (top ~1/5) --- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 40px 24px 24px;
    min-height: 22vh;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}
.header-avatar {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal);
}
.header-avatar:hover {
    transform: scale(1.04);
}
.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.header-names {
    display: flex;
    flex-direction: column;
}
.name-zh {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: 0.04em;
}
.name-sub {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-top: 2px;
}
.name-sub .sep {
    margin: 0 6px;
    color: var(--text-muted);
}

/* --- Navigation (Tab Bar) --- */
.site-nav {
    display: flex;
    justify-content: center;
    gap: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.92);
}
.nav-tab {
    position: relative;
    padding: 14px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #dddddd;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-sans);
    transition: color var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.nav-tab:hover {
    color: #ffffff;
}
.nav-tab.active {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}
.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
}
.nav-tab-external {
    /* 第4标签：跳转链接样式 */
    cursor: pointer;
}
.nav-tab-external::before {
    content: '↗ ';
    font-size: 0.8rem;
}

/* --- Main Content Area --- */
.site-main {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* --- Welcome Message (default state) --- */
.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 30vh;
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease;
}
.welcome-section.hidden {
    display: none;
}
.welcome-greeting {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.9;
    max-width: 560px;
    font-family: var(--font-serif);
}
.welcome-contact {
    margin-top: 18px;
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-sans);
}
.welcome-contact a {
    color: var(--accent);
    text-decoration: none;
}
.welcome-contact a:hover {
    text-decoration: underline;
}

/* --- Content Panels --- */
.content-panel {
    display: none;
    animation: fadeIn 0.35s ease;
}
.content-panel.visible {
    display: block;
}

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

/* --- Sub-Tabs (OC & Software) --- */
.subtabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 28px;
}
.subtab-btn {
    padding: 8px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #dddddd;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}
.subtab-btn:hover {
    color: #ffffff;
    border-color: #ffffff;
    background: rgba(0,0,0,0.35);
}
.subtab-btn.active {
    color: #ffffff;
    background: rgba(0,0,0,0.5);
    border-color: #ffffff;
    font-weight: 700;
}

/* --- OC Display --- */
.oc-profile {
    text-align: center;
}
.oc-name-main {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.oc-name-sub {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.oc-meta {
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.8;
}
.oc-meta strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Image Carousel --- */
.carousel {
    position: relative;
    max-width: 480px;
    margin: 20px auto 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-tertiary);
    aspect-ratio: 3/4;
}
.carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    height: 100%;
}
.carousel-slide {
    min-width: 100%;
    height: 100%;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-tertiary);
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.85);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    z-index: 10;
    backdrop-filter: blur(4px);
}
.carousel-btn:hover {
    background: #fff;
    border-color: var(--accent);
    color: var(--accent);
}
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
}
.carousel-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

/* --- Software Display --- */
.software-card {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.software-card .sw-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.software-card .sw-desc {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: left;
}
.software-card .sw-image {
    max-width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 0 auto 20px;
}
.software-card .sw-image img {
    border-radius: var(--radius-md);
}
.sw-download {
    display: inline-block;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    margin: 8px;
    font-family: var(--font-sans);
}
.sw-download:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.sw-github {
    display: inline-block;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    margin: 8px;
    font-family: var(--font-sans);
}
.sw-github:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Novel Display --- */
.novel-card {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.novel-card .novel-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-family: var(--font-serif);
}
.novel-card .novel-desc {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 2;
    text-align: left;
    white-space: pre-line;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
}
.site-footer a {
    color: var(--text-muted);
}
.site-footer a:hover {
    color: var(--accent);
}

/* --- Empty State (Reverie) --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Links placeholder --- */
.links-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    line-height: 2;
}
.links-placeholder .links-cta {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}
.links-placeholder .links-cta:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* ============================================================
   RESPONSIVE — Mobile (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 16px;
        padding: 28px 20px 20px;
        min-height: auto;
    }
    .header-avatar {
        width: 80px;
        height: 80px;
    }
    .header-names {
        align-items: center;
        text-align: center;
    }
    .name-zh {
        font-size: 1.6rem;
    }
    .name-sub {
        font-size: 1.2rem;
    }

    .lang-switcher {
        top: 10px;
        right: 12px;
    }
    .lang-switcher .lang-icon {
        padding: 5px 7px;
        font-size: 1.05rem;
    }

    .site-nav {
        gap: 0;
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tab {
        padding: 12px 18px;
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    .site-main {
        padding: 20px 16px 36px;
    }

    .welcome-greeting {
        font-size: 1.1rem;
        padding: 0 8px;
    }

    .subtabs {
        gap: 4px;
    }
    .subtab-btn {
        padding: 6px 14px;
        font-size: 0.82rem;
    }

    .oc-name-main {
        font-size: 1.4rem;
    }
    .carousel {
        max-width: 100%;
    }
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .software-card .sw-name {
        font-size: 1.25rem;
    }
    .sw-download, .sw-github {
        display: block;
        margin: 8px auto;
        max-width: 240px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .name-zh {
        font-size: 1.4rem;
    }
    .carousel {
        aspect-ratio: 3/4;
    }
}

/* ============================================================
   DARK MODE — prefers-color-scheme
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e8e8e8;
        --text-secondary: #aaaaaa;
        --text-muted: #777777;
        --bg-primary: #1a1a1e;
        --bg-secondary: #222228;
        --bg-tertiary: #2a2a30;
        --accent: #b09cc4;
        --accent-hover: #c8b8d8;
        --accent-light: #2a2432;
        --border: #333338;
        --border-light: #2a2a30;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
        --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    }

    .site-header,
    .site-nav,
    .site-main,
    .site-footer {
        background: transparent !important;
    }

    /* Darker overlay for better readability */
    .bg-overlay {
        background: rgba(0, 0, 0, 0.55);
    }

    .carousel-btn {
        background: rgba(40,40,48,0.9);
        border-color: var(--border);
        color: var(--text-primary);
    }

    .subtab-btn {
        background: var(--bg-tertiary);
    }

    img {
        opacity: 0.92;
    }
    img:hover {
        opacity: 1;
    }
}
