:root {
    --primary-color: #0b1f3f;
    --accent-color: #1d6fd8;
    --accent-soft: #eaf2fc;
    --text-main: #1e293b;
    --text-sub: #475569;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --gold-tag: #854d0e;
    --gold-bg: #fef9c3;
    --green-tag: #166534;
    --green-bg: #dcfce7;
    --blue-tag: #1e40af;
    --blue-bg: #dbeafe;
}

* {
    box-sizing: border-box;
}

/* Language visibility */
html[data-lang="zh"] .lang-en {
    display: none !important;
}

html[data-lang="en"] .lang-zh {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", Helvetica, Arial, sans-serif;
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Header & language switcher */
.header-banner {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, #051329 0%, #0e2954 60%, #174276 100%);
    color: #ffffff;
    padding: 72px 20px 85px 20px;
    text-align: center;
    border-bottom: 4px solid var(--accent-color);
}

.lang-switcher {
    position: absolute;
    top: 18px;
    right: 22px;
    display: inline-flex;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    padding: 3px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.lang-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
    color: #ffffff;
}

.lang-btn[aria-pressed="true"] {
    background: #ffffff;
    color: var(--primary-color);
}

.header-banner h1 {
    margin: 0;
    font-size: 2.3em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-wrap: balance;
}

.header-banner p {
    margin: 14px auto 0 auto;
    font-size: 1.12em;
    color: #cbd5e1;
    max-width: 780px;
    font-weight: 300;
}

.header-banner .header-creds {
    font-size: 0.94em;
    color: #93c5fd;
    margin-top: 8px;
}

/* Main layout & cards */
.container {
    position: relative;
    z-index: 2;
    max-width: 920px;
    margin: -50px auto 60px auto;
    padding: 0 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 36px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    margin-bottom: 28px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: 0 14px 22px -4px rgba(0, 0, 0, 0.08);
}

h2 {
    color: var(--primary-color);
    font-size: 1.38em;
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
    text-wrap: balance;
}

.section-intro {
    color: var(--text-sub);
    margin: 0 0 16px 0;
}

/* Philosophy */
.statement-box {
    background-color: #f8fafc;
    border-left: 4px solid var(--accent-color);
    padding: 18px 20px;
    margin: 16px 0 15px 0;
    color: #334155;
    border-radius: 0 8px 8px 0;
}

.statement-zh {
    margin: 0;
    font-weight: 500;
}

.statement-en {
    margin: 0;
    font-style: italic;
}

.philosophy-pillars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.philosophy-item {
    background: #f4f7fb;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 13px 16px;
    font-weight: 700;
    font-size: 1em;
    color: var(--primary-color);
    text-align: center;
    letter-spacing: 0.4px;
}

html[data-lang="zh"] .philosophy-item {
    letter-spacing: 1.5px;
}

/* Native collapsible panels */
.collapsible-panel {
    margin-top: 12px;
}

.collapsible-trigger {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.94em;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.collapsible-trigger::-webkit-details-marker {
    display: none;
}

.collapsible-trigger::after {
    content: "▾";
    font-size: 1.15em;
    line-height: 1;
    color: var(--accent-color);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.collapsible-trigger:hover {
    background: var(--accent-soft);
    border-color: #bfdbfe;
    color: var(--accent-color);
}

.collapsible-panel[open] > .collapsible-trigger {
    background: var(--accent-soft);
    border-color: #bfdbfe;
    color: var(--primary-color);
}

.collapsible-panel[open] > .collapsible-trigger::after {
    transform: rotate(180deg);
}

.collapsible-body {
    margin-top: 16px;
}

.collapsible-body > .badge-group,
.collapsible-body > .featured-list {
    margin-top: 0;
}

/* Credential badges */
.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.badge {
    background: var(--accent-soft);
    color: var(--accent-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid #bfdbfe;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

a.badge {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.badge.gold {
    background: var(--gold-bg);
    color: var(--gold-tag);
    border-color: #fef08a;
}

.badge.green {
    background: var(--green-bg);
    color: var(--green-tag);
    border-color: #bbf7d0;
}

.badge.blue {
    background: var(--blue-bg);
    color: var(--blue-tag);
    border-color: #93c5fd;
}

/* M365 solutions */
.value-callout {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 0.94em;
    color: #1e3a8a;
}

.featured-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
}

.featured-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px 20px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.featured-item:hover {
    background: #ffffff;
    border-left-color: var(--accent-color);
}

.featured-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.featured-title {
    font-size: 1.04em;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.featured-title:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.featured-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.std-tag {
    font-size: 11px;
    font-weight: 600;
    background: #e2e8f0;
    color: #334155;
    padding: 2px 8px;
    border-radius: 4px;
}

.std-tag.accent {
    background: #dbeafe;
    color: #1e40af;
}

.featured-desc {
    margin: 0;
    font-size: 0.93em;
    color: var(--text-sub);
    line-height: 1.6;
}

.archive-note {
    margin-top: 18px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 0.9em;
    color: #475569;
    line-height: 1.65;
}

.archive-note a {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.archive-note a:hover {
    text-decoration: underline;
}

/* Publications */
ul.styled-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

ul.styled-list li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 12px;
    color: var(--text-sub);
    font-size: 0.95em;
}

ul.styled-list li:last-child {
    margin-bottom: 0;
}

ul.styled-list li::before {
    content: "▪";
    position: absolute;
    left: 4px;
    color: var(--accent-color);
    font-size: 1.15em;
    line-height: 1.45;
}

a.proj-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

a.proj-link:hover {
    text-decoration: underline;
}

.tag-pill {
    font-size: 11px;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* Action buttons & footer */
.links-container {
    text-align: center;
    margin: 36px 0 20px 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin: 6px 4px;
    font-size: 0.95em;
}

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

.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(29, 111, 216, 0.25);
}

.btn-primary:hover {
    background-color: #1555a6;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #334155;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(51, 65, 85, 0.2);
}

.btn-secondary:hover {
    background-color: #1e293b;
    transform: translateY(-2px);
}

.btn-academic {
    background-color: #0f766e;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.2);
}

.btn-academic:hover {
    background-color: #115e59;
    transform: translateY(-2px);
}

.btn-keybase {
    background-color: #0284c7;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
}

.btn-keybase:hover {
    background-color: #0369a1;
    transform: translateY(-2px);
}

.footer-note {
    text-align: center;
    font-size: 0.9em;
    color: #94a3b8;
    margin-top: 32px;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile responsive */
@media (max-width: 680px) {
    .header-banner {
        padding: 68px 20px 72px 20px;
    }

    .lang-switcher {
        top: 14px;
        right: 14px;
    }

    .header-banner h1 {
        font-size: 1.8em;
    }

    .header-banner p {
        font-size: 1.02em;
    }

    .container {
        margin: -42px auto 48px auto;
        padding: 0 16px;
    }

    .card {
        padding: 22px 20px;
        margin-bottom: 20px;
    }

    .collapsible-trigger {
        padding: 11px 14px;
        font-size: 0.9em;
    }

    .featured-item {
        padding: 14px 16px;
    }

    .btn {
        display: flex;
        margin: 10px auto;
        width: 100%;
        max-width: 320px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
