/* 137.is - PaperMod Theme */

:root {
    --gap: 24px;
    --content-gap: 20px;
    --nav-width: 1024px;
    --main-width: 720px;
    --header-height: 60px;
    --footer-height: 60px;
    --radius: 8px;

    --theme: #fff;
    --entry: #fff;
    --primary: rgb(30, 30, 30);
    --secondary: rgb(108, 108, 108);
    --tertiary: rgb(214, 214, 214);
    --content: rgb(31, 31, 31);
    --code-block-bg: rgb(28, 29, 33);
    --code-bg: rgb(245, 245, 245);
    --border: rgb(238, 238, 238);
}

[data-theme="dark"] {
    --theme: rgb(29, 30, 32);
    --entry: rgb(46, 46, 51);
    --primary: rgb(218, 218, 219);
    --secondary: rgb(155, 156, 157);
    --tertiary: rgb(65, 66, 68);
    --content: rgb(196, 196, 197);
    --code-block-bg: rgb(46, 46, 51);
    --code-bg: rgb(55, 56, 62);
    --border: rgb(51, 51, 51);
}

*, ::after, ::before {
    box-sizing: border-box;
}

html {
    -webkit-tap-highlight-color: transparent;
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 18px;
    line-height: 1.6;
    word-break: break-word;
    background: var(--theme);
    color: var(--primary);
    margin: 0;
}

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

h1, h2, h3, h4, h5, h6 {
    color: var(--primary);
    line-height: 1.2;
    margin: 0;
}

p, ul, ol { margin: 0; }
ul { padding: 0; list-style: none; }

/* === Header === */
header {
    background: var(--theme);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    max-width: calc(var(--nav-width) + var(--gap) * 2);
    margin: 0 auto;
    padding: 0 var(--gap);
    height: var(--header-height);
}

.logo a {
    font-size: 24px;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 8px;
    color: var(--primary);
    line-height: 1;
}

#menu {
    display: flex;
    list-style: none;
    gap: var(--gap);
    margin: 0;
    padding: 0;
}

#menu a {
    font-size: 16px;
    color: var(--primary);
}

#menu a:hover {
    color: var(--secondary);
}

/* === Main === */
.main {
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    max-width: calc(var(--main-width) + var(--gap) * 2);
    margin: 0 auto;
    padding: var(--gap);
}

/* === Home Profile === */
.home-profile {
    margin: var(--gap) 0 calc(var(--gap) * 2);
}

.home-profile h1 {
    font-size: 44px;
    margin-bottom: 10px;
}

.home-profile .intro {
    color: var(--secondary);
    font-size: 16px;
    line-height: 1.6;
}

.home-profile .intro li {
    margin: 4px 0;
    list-style: disc;
    margin-left: 20px;
}

.social-icons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.social-icons a {
    color: var(--primary);
    font-size: 20px;
}

.social-icons a:hover {
    color: var(--secondary);
}

/* === Post Entry (Card) === */
.post-entry {
    position: relative;
    margin-bottom: var(--gap);
    padding: var(--gap);
    background: var(--entry);
    border-radius: var(--radius);
    transition: transform 0.1s;
    border: 1px solid var(--border);
}

[data-theme="dark"] .post-entry {
    background: var(--entry);
    border: none;
}

.post-entry:hover {
    transform: translateY(-2px);
}

.post-entry:active {
    transform: scale(0.98);
}

.entry-header h2 {
    font-size: 24px;
    line-height: 1.3;
    margin-bottom: 8px;
}

.entry-content {
    color: var(--secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.entry-footer {
    color: var(--secondary);
    font-size: 13px;
}

.entry-footer span + span::before {
    content: " · ";
}

.entry-link {
    position: absolute;
    inset: 0;
}

/* === Post Single === */
.post-header {
    margin: 24px 0 var(--content-gap);
}

.post-title {
    font-size: 40px;
    margin-bottom: 10px;
}

.post-meta {
    color: var(--secondary);
    font-size: 14px;
}

.post-meta span + span::before {
    content: " · ";
}

/* === Post Content === */
.post-content {
    color: var(--content);
}

.post-content h1 {
    margin: 40px 0 32px;
    font-size: 32px;
}

.post-content h2 {
    margin: 32px 0 24px;
    font-size: 28px;
}

.post-content h3 {
    margin: 24px 0 16px;
    font-size: 22px;
}

.post-content p {
    margin-bottom: var(--content-gap);
}

.post-content ul,
.post-content ol {
    margin-bottom: var(--content-gap);
    padding-left: 20px;
}

.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }

.post-content li {
    margin-top: 5px;
}

.post-content a {
    box-shadow: 0 1px 0 var(--primary);
}

.post-content a:hover {
    box-shadow: none;
}

.post-content blockquote {
    margin: 20px 0;
    padding: 0 14px;
    border-left: 3px solid var(--primary);
}

.post-content code {
    padding: 4px 6px;
    font-size: 0.78em;
    background: var(--code-bg);
    border-radius: 2px;
}

.post-content pre {
    margin: 20px 0;
    padding: 16px;
    background: var(--code-block-bg);
    border-radius: var(--radius);
    overflow-x: auto;
}

.post-content pre code {
    padding: 0;
    background: none;
    color: rgb(213, 213, 214);
}

.post-content hr {
    margin: 30px 0;
    height: 2px;
    background: var(--tertiary);
    border: 0;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* === Post Footer === */
.post-footer {
    margin-top: 40px;
    padding-top: var(--gap);
    border-top: 1px solid var(--border);
}

.post-nav {
    display: flex;
    justify-content: space-between;
}

.post-nav a {
    color: var(--secondary);
    font-size: 14px;
}

.post-nav a:hover {
    color: var(--primary);
}

/* === Footer === */
footer {
    max-width: calc(var(--main-width) + var(--gap) * 2);
    margin: 0 auto;
    padding: var(--gap);
    text-align: center;
    font-size: 12px;
    color: var(--secondary);
}

footer a {
    color: inherit;
}

/* === Archive === */
.archive-year {
    margin-top: 40px;
}

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

.archive-year h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.archive-year h2 sup {
    font-size: 14px;
    color: var(--secondary);
    font-weight: normal;
    margin-left: 4px;
}

.archive-month {
    margin: 20px 0;
}

.archive-month h3 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 8px;
}

.archive-month h3 sup {
    font-size: 12px;
    color: var(--secondary);
    font-weight: normal;
    margin-left: 4px;
}

.archive-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-entry {
    padding: 8px 0;
}

.archive-entry-title {
    font-size: 16px;
    color: var(--primary);
}

.archive-entry-title:hover {
    text-decoration: underline;
}

.archive-meta {
    color: var(--secondary);
    font-size: 13px;
    margin-top: 2px;
}

/* === Tags === */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: var(--gap);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--entry);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--primary);
}

[data-theme="dark"] .tag {
    background: var(--code-bg);
}

.tag:hover {
    background: var(--tertiary);
}

.tag sup {
    font-size: 11px;
    color: var(--secondary);
    margin-left: 4px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .nav {
        height: auto;
        padding: 16px var(--gap);
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .nav-right {
        width: 100%;
        justify-content: space-between;
    }

    .home-profile h1 {
        font-size: 32px;
    }

    .post-title {
        font-size: 28px;
    }

    .entry-header h2 {
        font-size: 20px;
    }
}

/* === Theme Toggle === */
[data-theme="dark"] .sun { display: inline; }
[data-theme="dark"] .moon { display: none; }
[data-theme="light"] .sun,
:root:not([data-theme]) .sun { display: none; }
[data-theme="light"] .moon,
:root:not([data-theme]) .moon { display: inline; }
