/**
 * Wikipedia-style CSS
 * Mimics the classic Wikipedia desktop and mobile layout
 */

/* ==========================================================================
   CSS Variables - Wikipedia Color Scheme
   ========================================================================== */
:root {
    /* Wikipedia colors */
    --wiki-blue: #0645ad;
    --wiki-blue-visited: #0b0080;
    --wiki-blue-hover: #0645ad;
    --wiki-red-link: #ba0000;
    --wiki-text: #202122;
    --wiki-text-light: #54595d;
    --wiki-background: #f8f9fa;
    --wiki-content-bg: #ffffff;
    --wiki-border: #a2a9b1;
    --wiki-border-light: #c8ccd1;
    --wiki-heading-border: #a2a9b1;
    --wiki-sidebar-bg: #f8f9fa;
    --wiki-header-bg: #ffffff;
    --wiki-infobox-bg: #f8f9fa;
    --wiki-infobox-header: #b0c4de;
    --wiki-toc-bg: #f8f9fa;
    --wiki-toc-border: #a2a9b1;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Liberation Sans', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--wiki-text);
    background-color: var(--wiki-background);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography - Wikipedia Style
   ========================================================================== */
a {
    color: var(--wiki-blue);
    text-decoration: none;
    background: none;
}

a:visited {
    color: var(--wiki-blue-visited);
}

a:hover {
    text-decoration: underline;
}

a:active {
    color: var(--wiki-blue);
}

p {
    margin: 0.5em 0;
    line-height: 1.6;
}

b, strong {
    font-weight: 700;
}

abbr[title] {
    border-bottom: 1px dotted;
    cursor: help;
}

/* ==========================================================================
   Wikipedia Header
   ========================================================================== */
.wiki-header {
    background-color: var(--wiki-header-bg);
    border-bottom: 1px solid var(--wiki-border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.wiki-header-inner {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    max-width: 1600px;
    margin: 0 auto;
    gap: 20px;
}

.wiki-logo {
    flex-shrink: 0;
}

.wiki-logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.wiki-logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border: 1px solid var(--wiki-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--wiki-text);
    font-family: 'Linux Libertine', 'Times New Roman', serif;
}

.wiki-logo-text {
    display: flex;
    flex-direction: column;
}

.wiki-logo-title {
    font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
    font-size: 18px;
    font-weight: normal;
    color: var(--wiki-text);
    line-height: 1.2;
}

.wiki-logo-tagline {
    font-size: 11px;
    color: var(--wiki-text-light);
    font-style: italic;
}

.wiki-search {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 4px;
}

.wiki-search input {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--wiki-border);
    border-radius: 2px;
    font-size: 14px;
    font-family: inherit;
}

.wiki-search input:focus {
    outline: none;
    border-color: var(--wiki-blue);
}

.wiki-search button {
    padding: 6px 12px;
    background-color: var(--wiki-background);
    border: 1px solid var(--wiki-border);
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
}

.wiki-search button:hover {
    background-color: #e9e9e9;
}

.wiki-personal-tools {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.wiki-personal-tools a {
    color: var(--wiki-blue);
    text-decoration: none;
    white-space: nowrap;
}

.wiki-personal-tools a:hover {
    text-decoration: underline;
}

/* Mobile menu toggle */
.wiki-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.wiki-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--wiki-text);
    margin: 4px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wiki-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.wiki-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.wiki-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */
.wiki-mobile-menu {
    display: none;
    position: fixed;
    top: 67px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--wiki-content-bg);
    z-index: 99;
    overflow-y: auto;
}

.wiki-mobile-menu.active {
    display: block;
}

.wiki-mobile-nav {
    padding: 16px;
}

.wiki-mobile-nav-section {
    margin-bottom: 20px;
}

.wiki-mobile-nav-title {
    font-weight: bold;
    color: var(--wiki-text-light);
    font-size: 12px;
    text-transform: uppercase;
    padding: 8px 0;
    border-bottom: 1px solid var(--wiki-border-light);
    margin-bottom: 8px;
}

.wiki-mobile-nav a {
    display: block;
    padding: 10px 0;
    color: var(--wiki-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--wiki-border-light);
}

.wiki-mobile-nav a:last-child {
    border-bottom: none;
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.wiki-container {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 67px - 60px);
}

/* ==========================================================================
   Wikipedia Sidebar
   ========================================================================== */
.wiki-sidebar {
    width: 160px;
    flex-shrink: 0;
    background-color: var(--wiki-sidebar-bg);
    border-right: 1px solid var(--wiki-border-light);
    padding: 16px 0;
    font-size: 13px;
}

.wiki-sidebar-section {
    margin-bottom: 16px;
}

.wiki-sidebar-heading {
    padding: 4px 12px;
    font-weight: bold;
    color: var(--wiki-text-light);
    font-size: 12px;
    text-transform: uppercase;
}

.wiki-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wiki-sidebar li {
    margin: 0;
}

.wiki-sidebar a {
    display: block;
    padding: 4px 12px;
    color: var(--wiki-blue);
    text-decoration: none;
    font-size: 13px;
}

.wiki-sidebar a:hover {
    background-color: rgba(0, 0, 0, 0.03);
    text-decoration: underline;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.wiki-content {
    flex: 1;
    background-color: var(--wiki-content-bg);
    min-width: 0;
}

.wiki-article {
    padding: 0 20px 40px 20px;
}

/* ==========================================================================
   Page Title - Wikipedia Style
   ========================================================================== */
.wiki-page-title {
    font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
    font-size: 28px;
    font-weight: normal;
    line-height: 1.3;
    margin: 0;
    padding: 20px 0 0 0;
    border-bottom: 1px solid var(--wiki-heading-border);
    margin-bottom: 16px;
}

/* ==========================================================================
   Article Body
   ========================================================================== */
.wiki-article-body {
    line-height: 1.6;
}

.wiki-article-body p {
    margin: 0.5em 0;
}

/* ==========================================================================
   Section Headings - Wikipedia Style
   ========================================================================== */
.wiki-article-body h2 {
    font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
    font-size: 22px;
    font-weight: normal;
    border-bottom: 1px solid var(--wiki-heading-border);
    margin: 1em 0 0.25em 0;
    padding: 0 0 2px 0;
    line-height: 1.3;
    overflow: hidden;
}

.wiki-article-body h2 .mw-headline {
    font-weight: normal;
}

.wiki-article-body h3 {
    font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
    font-size: 18px;
    font-weight: bold;
    margin: 1em 0 0.25em 0;
    line-height: 1.3;
}

.wiki-article-body h4 {
    font-size: 14px;
    font-weight: bold;
    margin: 1em 0 0.25em 0;
}

/* ==========================================================================
   Wikipedia Infobox
   ========================================================================== */
.wiki-infobox {
    float: right;
    clear: right;
    margin: 0 0 16px 20px;
    padding: 0;
    width: 260px;
    font-size: 13px;
    border: 1px solid var(--wiki-border);
    border-collapse: collapse;
    background-color: var(--wiki-infobox-bg);
}

.wiki-infobox td,
.wiki-infobox th {
    padding: 4px 8px;
    vertical-align: top;
    border: none;
    text-align: left;
}

.wiki-infobox th {
    background-color: transparent;
    font-weight: normal;
    width: 80px;
    color: var(--wiki-text);
}

.wiki-infobox-image {
    text-align: center;
    padding: 8px !important;
}

.wiki-infobox-image img {
    width: 200px;
    height: auto;
    border: 1px solid var(--wiki-border-light);
}

.wiki-infobox-header {
    background-color: var(--wiki-infobox-header);
}

.wiki-infobox-header th {
    text-align: center;
    font-weight: bold;
    padding: 6px 8px !important;
}

.wiki-infobox tr {
    border-bottom: 1px solid var(--wiki-border-light);
}

.wiki-infobox tr:last-child {
    border-bottom: none;
}

.wiki-infobox a {
    color: var(--wiki-blue);
}

/* ==========================================================================
   Table of Contents
   ========================================================================== */
.wiki-toc {
    display: table;
    background-color: var(--wiki-toc-bg);
    border: 1px solid var(--wiki-toc-border);
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
}

.wiki-toc-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.wiki-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wiki-toc li {
    margin: 4px 0;
}

.wiki-toc a {
    color: var(--wiki-blue);
    text-decoration: none;
}

.wiki-toc a:hover {
    text-decoration: underline;
}

.wiki-toc .tocnumber {
    color: var(--wiki-text);
    margin-right: 4px;
}

.wiki-toc .toctext {
    color: var(--wiki-blue);
}

/* ==========================================================================
   Wikipedia Lists
   ========================================================================== */
.wiki-list {
    margin: 0.3em 0 0 1.6em;
    padding: 0;
}

.wiki-list li {
    margin: 0.2em 0;
    line-height: 1.6;
}

/* Publications list - Wikipedia style */
.wiki-pub-list {
    list-style: disc;
    margin: 0.3em 0 0 1.6em;
    padding: 0;
}

.wiki-pub-list li {
    margin: 0.5em 0;
    line-height: 1.6;
}

.wiki-pub-list .pub-title {
    font-weight: bold;
}

.wiki-pub-list .pub-authors {
    color: var(--wiki-text-light);
    font-size: 13px;
}

.wiki-pub-list .pub-venue {
    font-style: italic;
    color: var(--wiki-text);
}

.wiki-pub-list .pub-links {
    font-size: 13px;
}

.wiki-pub-list .pub-links a {
    margin-right: 8px;
}

.me-highlight {
    font-weight: bold;
    color: var(--wiki-text);
}

/* Loading state */
.wiki-loading {
    list-style: none;
    text-align: center;
    padding: 20px;
    color: var(--wiki-text-light);
}

.wiki-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wiki-border);
    border-top-color: var(--wiki-blue);
    border-radius: 50%;
    animation: wiki-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes wiki-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Wikipedia Footer
   ========================================================================== */
.wiki-footer {
    background-color: var(--wiki-background);
    border-top: 1px solid var(--wiki-border-light);
    padding: 12px 0;
    font-size: 12px;
    color: var(--wiki-text-light);
}

.wiki-footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.wiki-footer p {
    margin: 4px 0;
}

/* ==========================================================================
   Page Header (for sub-pages)
   ========================================================================== */
.wiki-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.wiki-back-link {
    font-size: 13px;
    color: var(--wiki-blue);
}

/* ==========================================================================
   Project Cards (for community page) - Wikipedia Style
   ========================================================================== */
.wiki-project-list {
    margin: 0.3em 0 0 1.6em;
    padding: 0;
    list-style: disc;
}

.wiki-project-item {
    margin: 1em 0;
    line-height: 1.6;
}

.wiki-project-title {
    font-weight: bold;
}

.wiki-project-stars {
    font-size: 13px;
    color: var(--wiki-text-light);
    font-weight: normal;
}

.wiki-project-summary {
    margin: 0.3em 0;
}

.wiki-project-details {
    margin: 0.5em 0 0.5em 1.6em;
    font-size: 13px;
}

.wiki-project-details li {
    margin: 0.2em 0;
}

.wiki-project-links {
    font-size: 13px;
}

.wiki-project-links a {
    margin-right: 12px;
}

/* ==========================================================================
   Publications Page - Simple List Style
   ========================================================================== */
.wiki-publications-full-list {
    list-style: disc;
    margin: 0.3em 0 0 1.6em;
    padding: 0;
}

.wiki-publications-full-list li {
    margin: 0.8em 0;
    line-height: 1.6;
}

.wiki-pub-title-text {
    font-weight: bold;
}

.wiki-pub-authors-text {
    color: var(--wiki-text-light);
    font-size: 13px;
}

.wiki-pub-venue-text {
    font-style: italic;
}

/* Year section headers */
.wiki-year-section {
    margin-top: 1.5em;
}

.wiki-year-section:first-child {
    margin-top: 0;
}

/* ==========================================================================
   Mobile Responsive - Wikipedia Style
   ========================================================================== */
@media (max-width: 1000px) {
    .wiki-sidebar {
        display: none;
    }
    
    .wiki-container {
        display: block;
    }
    
    .wiki-content {
        width: 100%;
    }
    
    .wiki-infobox {
        float: none;
        margin: 0 auto 16px auto;
        width: 100%;
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .wiki-header-inner {
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
    }
    
    .wiki-logo-text {
        display: none;
    }
    
    .wiki-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .wiki-search {
        order: 3;
        width: 100%;
        max-width: none;
    }
    
    .wiki-personal-tools {
        display: none;
    }
    
    .wiki-menu-toggle {
        display: block;
        margin-left: auto;
    }
    
    .wiki-page-title {
        font-size: 24px;
        padding-top: 12px;
    }
    
    .wiki-article {
        padding: 0 12px 24px 12px;
    }
    
    .wiki-article-body h2 {
        font-size: 20px;
    }
    
    .wiki-infobox {
        max-width: 100%;
    }
    
    .wiki-infobox-image img {
        width: 150px;
    }
    
    .wiki-toc {
        width: 100%;
    }
    
    .wiki-footer-inner {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    
    .wiki-page-title {
        font-size: 22px;
    }
    
    .wiki-article-body h2 {
        font-size: 18px;
    }
    
    .wiki-infobox {
        font-size: 14px;
    }
    
    .wiki-infobox th {
        width: 70px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .wiki-header,
    .wiki-sidebar,
    .wiki-footer,
    .wiki-toc,
    .wiki-mobile-menu,
    .wiki-menu-toggle {
        display: none !important;
    }
    
    body {
        background: white;
        font-size: 12pt;
    }
    
    .wiki-container {
        display: block;
    }
    
    .wiki-content {
        width: 100%;
    }
    
    .wiki-article {
        padding: 0;
    }
    
    .wiki-infobox {
        width: 200px;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
}

/* ==========================================================================
   Simple Layout (no header/sidebar) - Personal Resume Style
   ========================================================================== */
body.wiki-simple {
    background-color: var(--wiki-content-bg);
}

.wiki-simple-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 40px;
    background-color: var(--wiki-content-bg);
    min-height: calc(100vh - 60px);
}

.wiki-simple .wiki-article {
    padding: 0;
}

.wiki-simple .wiki-page-title {
    margin-bottom: 20px;
    padding-top: 0;
}

.wiki-simple .wiki-infobox {
    margin-top: 0;
}

/* ==========================================================================
   Apple-style Navigation
   ========================================================================== */
.apple-nav {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.apple-nav-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 22px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.apple-nav-logo {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    text-decoration: none;
    letter-spacing: -0.022em;
}

.apple-nav-logo:hover {
    color: var(--wiki-blue);
    text-decoration: none;
}

.apple-nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 28px;
}

.apple-nav-links li {
    margin: 0;
}

.apple-nav-links a {
    font-size: 14px;
    color: #1d1d1f;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.apple-nav-links a:hover {
    opacity: 1;
    text-decoration: none;
}

/* Mobile menu toggle button */
.apple-nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    position: relative;
}

.apple-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background-color: #1d1d1f;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.apple-nav-toggle span:nth-child(1) {
    top: 14px;
}

.apple-nav-toggle span:nth-child(2) {
    top: 50%;
    transform: translate(-50%, -50%);
}

.apple-nav-toggle span:nth-child(3) {
    bottom: 14px;
}

.apple-nav-toggle.active span:nth-child(1) {
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.apple-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.apple-nav-toggle.active span:nth-child(3) {
    bottom: 50%;
    transform: translate(-50%, 50%) rotate(-45deg);
}

/* Mobile menu */
.apple-mobile-menu {
    display: none;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 999;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.apple-mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.apple-mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.apple-mobile-menu li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.apple-mobile-menu a {
    display: block;
    padding: 16px 0;
    font-size: 17px;
    color: #1d1d1f;
    text-decoration: none;
    font-weight: 500;
}

.apple-mobile-menu a:hover {
    color: var(--wiki-blue);
    text-decoration: none;
}

/* Mobile responsive for navigation */
@media (max-width: 768px) {
    .apple-nav-links {
        display: none;
    }
    
    .apple-nav-toggle {
        display: block;
    }
    
    .apple-mobile-menu {
        display: block;
    }
    
    .apple-nav-inner {
        padding: 0 16px;
    }
}

/* Adjust container for nav */
body.wiki-simple .wiki-simple-container {
    padding-top: 20px;
}

/* Mobile responsive for simple layout */
@media (max-width: 768px) {
    .wiki-simple-container {
        padding: 16px 20px;
    }
    
    .wiki-simple .wiki-infobox {
        float: none;
        margin: 0 auto 20px auto;
        width: 100%;
        max-width: 300px;
    }
    
    .wiki-simple .wiki-page-title {
        font-size: 24px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .wiki-simple-container {
        padding: 12px 16px;
    }
    
    .wiki-simple .wiki-page-title {
        font-size: 22px;
    }
}

/* Print styles for simple layout */
@media print {
    .wiki-simple-container {
        max-width: none;
        padding: 0;
    }
}
