@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400;1,700&family=Montserrat:wght@400;700&display=swap');

html {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

:root {
    --bg-color: #f8f8f7;
    --text-color: #333;
    --header-color: #333;
    --link-color: #333;
    --link-hover-color: #000;
    --code-bg-color: #e8e8e8;
    --background-color: #ffffff;
    --text-secondary-color: #555555;
    --border-color: #e0e0e0;
    --table-zebra-color: #f9f9f9;
    --code-background-color: #f8f8f8;
}

html.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --header-color: #e0e0e0;
    --link-color: #e0e0e0;
    --link-hover-color: #fff;
    --code-bg-color: #2a2a2a;
    --background-color: #1a1a1a;
    --text-secondary-color: #bbbbbb;
    --border-color: #444444;
    --table-zebra-color: #2c2c2c;
    --code-background-color: #2d2d2d;
}

body {
    font-family: 'Lora', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 2rem;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-content {
    flex: 1 0 auto;
}

.container {
    max-width: 960px;
    margin: 0 auto;
}

.container.container-wide {
    max-width: 95%;
}

.abstract {
    margin-left: 2em;
}

.article-date {
    text-align: right;
    font-style: italic;
    margin-top: 0;
    margin-bottom: 1em;
}

header {
    margin-bottom: 4rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 2rem;
}

nav a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--header-color);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 0;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--header-color);
}

a {
    color: var(--link-color);
    text-decoration: underline;
}

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

footer {
    padding: 2rem 0;
    text-align: center;
    flex-shrink: 0;
}

.footer-links a {
    display: none;
}

.blog-list li {
    list-style: none;
    margin-bottom: 2rem;
}

.blog-list h2 {
    margin-bottom: 0.5rem;
}

.blog-list h2 a {
    text-decoration: none;
}

.blog-list p {
    color: #666;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    margin-top: 0;
}

html.dark-mode .blog-list p {
    color: #999;
}

pre {
    background-color: var(--code-bg-color);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', Courier, monospace;
}

#theme-toggle {
    cursor: pointer;
}

.dark-mode #sun-icon {
    display: block;
}

.dark-mode #moon-icon {
    display: none;
}

#sun-icon {
    display: none;
}

#moon-icon {
    display: block;
}

main>h1:first-child {
    margin-top: 0;
}

/* Styles for the toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2196F3;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Table Styles */
article table {
    border-collapse: collapse;
    margin: 1.5em 0;
    width: 100%;
    border-spacing: 0;
    border: 1px solid var(--border-color);
}

article th,
article td {
    border: 1px solid var(--border-color);
    padding: 0.75em 1em;
}

article tr {
    background-color: var(--background-color);
}

article tr:nth-child(2n) {
    background-color: var(--table-zebra-color);
}

article th {
    font-weight: 600;
}

article ul,
article ol {
    padding-left: 2em;
    margin: 1em 0;
}

article li {
    margin: 0.5em 0;
}

article blockquote {
    font-style: italic;
    color: var(--text-secondary-color);
    margin: 1.5em 0;
    padding: 0 1.5em;
    border-left: 4px solid var(--border-color);
}

article blockquote blockquote {
    margin-left: 1em;
}

/* --- Syntax Highlighting Integration --- */
pre[class*="language-"] {
    padding: 1.2em;
    margin: 1.5em 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* By default, load light theme and hide dark theme */
link[href*="prism-okaidia.min.css"] {
    display: none !important;
}

/* When dark mode is active, load dark theme and hide light theme */
.dark-mode link[href*="prism.min.css"] {
    display: none !important;
}

.dark-mode link[href*="prism-okaidia.min.css"] {
    display: block !important;
}

/* In case the media query loads the dark theme initially, hide it if not in dark mode */
html:not(.dark-mode) link[href*="prism-okaidia.min.css"] {
    display: none !important;
}

#deleteModal .login-form {
    border: none;
    padding: 0;
    margin: 0;
}

main pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    position: relative;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    font-size: 0.9em;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

main pre:hover .copy-button {
    opacity: 1;
}

.dark-mode .copy-button {
    background-color: #333;
    color: #f1f1f1;
    border-color: #555;
}

/* Social Links */
.social-links {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 1rem 0;
}

.social-links li {
    margin: 0 0.75rem;
}

.social-links a {
    color: var(--link-color);
    font-size: 2rem;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--link-hover-color);
}

/* Layout for intro page and sidebar */
.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .content-wrapper {
        flex-direction: row;
    }

    .intro {
        flex: 1;
    }

    .social-aside {
        flex: 0 0 200px;
        margin-left: 2rem;
    }
}

/* Profile picture styling */
.profile-pic {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    margin: 1rem auto;
}

/* Tab count card styling */
.tab-count-card {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.tab-count-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark-mode .tab-count-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.tab-count-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-count-header i {
    color: var(--link-color);
    font-size: 1.2rem;
}

.tab-count-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--header-color);
}

.tab-count-number {
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--header-color);
    margin: 0.5rem 0;
    line-height: 1;
}

.tab-count-updated {
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    margin-top: 0.5rem;
    font-style: italic;
}

@media (max-width: 767px) {
    .tab-count-card {
        margin-top: 1.5rem;
    }

    .tab-count-number {
        font-size: 2.5rem;
    }
}