:root {
    --bg-color: #ffffff;
    --text-color: rgb(51, 51, 51);
    --link-color: #4183C4;
    --border-color: #eee;
    --code-bg: #f3f4f4;
    --blockquote-color: #777777;
    --table-stripe: #f8f8f8;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --link-color: #6ab0f3;
        --border-color: #333;
        --code-bg: #2a2a2a;
        --blockquote-color: #aaa;
        --table-stripe: #252525;
    }
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: rgb(51, 51, 51);
    --link-color: #4183C4;
    --border-color: #eee;
    --code-bg: #f3f4f4;
    --blockquote-color: #777777;
    --table-stripe: #f8f8f8;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --link-color: #6ab0f3;
    --border-color: #333;
    --code-bg: #2a2a2a;
    --blockquote-color: #aaa;
    --table-stripe: #252525;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.875rem 1.875rem;
}

@media only screen and (min-width: 1400px) {
    main { max-width: 1024px; }
}

@media only screen and (min-width: 1800px) {
    main { max-width: 1200px; }
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1.875rem;
    margin-bottom: 2rem;
    background: #000;
    border-bottom: 2px solid #000;
    text-decoration: none;
    cursor: pointer;
}

.site-header:hover {
    background: #111;
}

.site-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.theme-toggle {
    background: none;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    color: #fff;
    text-decoration: none;
}

.theme-toggle:hover {
    background: #222;
    text-decoration: none;
}

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

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

h1, h2, h3, h4, h5, h6 {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
}

h1 {
    font-size: 2.25em;
    line-height: 1.2;
}

h2 {
    font-size: 1.5em;
    line-height: 1.225;
    margin-top: calc(1rem + 0.25rem);
}

h3 { font-size: 1.3em; }
h4 { font-size: 1.25em; }
h5, h6 { font-size: 1em; }
h6 { color: #777; }

p, blockquote, ul, ol, table { margin: 0.8em 0; }

ul, ol {
    padding-left: 1.875rem;
    line-height: 1.4;
}

blockquote {
    border-left: 0.25rem solid var(--border-color);
    padding: 0 0.9375rem;
    color: var(--blockquote-color);
}

code {
    font-family: "SF Mono", Menlo, Monaco, "Courier New", monospace;
    background-color: var(--code-bg);
    padding: 0 0.125rem;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    margin: 0.9375rem 0;
    padding: 2.125rem 0.625rem 0.875rem;
    background-color: #282c34;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

pre::before {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    content: "";
    width: 0.8125rem;
    height: 0.8125rem;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 1.375rem 0 #ffbd2e, 2.75rem 0 #27c93f;
}

.highlight {
    border-radius: 10px;
}

.highlight pre {
    margin: 0;
}

pre code {
    background: none;
    color: #eaeaea;
    padding: 0;
}

table {
    padding: 0;
    word-break: initial;
    border-collapse: collapse;
    border-top: 2px solid var(--text-color);
    border-bottom: 2px solid var(--text-color);
    font-size: 0.9em;
    width: 100%;
}

table tr {
    margin: 0;
    padding: 0;
    cursor: pointer;
}

table tr:nth-child(6n+4),
table tr:nth-child(6n+5),
table tr:nth-child(6n+6) {
    background-color: var(--table-stripe);
}

table tr:hover {
    background-color: var(--table-stripe);
}

thead {
    border-bottom: 1px solid var(--text-color);
}

table th {
    font-weight: bold;
    border-left: none;
    border-right: none;
    text-align: center !important;
    font-size: 1.11em;
    margin: 0;
    padding: 0.375rem 0.8125rem;
}

table td {
    margin: 0;
    padding: 0.375rem 0.8125rem;
    box-shadow: -1px 0 0 var(--border-color);
}

table td:first-child {
    margin-top: 0;
    box-shadow: none;
}

table td:last-child {
    margin-bottom: 0;
}

hr {
    height: 2px;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0;
}

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