/* ============================================
   Clarity Theme for Typecho
   A minimal portfolio theme
   ============================================ */

/* --- CSS Variables --- */
:root {
    --brand: #fec824;
    --brand-hover: #ffd147;
    --bg: #ffffff;
    --bg-alt: #f7f7f9;
    --text: #181818;
    --text-secondary: #767676;
    --heading: #181818;
    --link: #181818;
    --border: #ededf1;
    --card-shadow: 0 2px 16px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --nav-bg: rgba(255,255,255,0.92);
    --code-bg: #f3f3f3;
    --radius: 8px;
}

[data-theme="dark"] {
    --brand: #fec824;
    --brand-hover: #ffd147;
    --bg: #111116;
    --bg-alt: #1a1a1f;
    --text: #a0a0a0;
    --text-secondary: #707070;
    --heading: #e0e0e0;
    --link: #e0e0e0;
    --border: #252529;
    --card-shadow: 0 2px 16px rgba(0,0,0,0.2);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.35);
    --nav-bg: rgba(17,17,22,0.92);
    --code-bg: #1e1e24;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background 0.3s, color 0.3s;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s;
}

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

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

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    font-weight: 700;
    line-height: 1.3;
}

/* --- Container --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.container--narrow {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Navigation --- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav__logo {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading);
}

.nav__logo:hover {
    color: var(--heading);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav__links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.nav__links a:hover,
.nav__links a.active {
    color: var(--heading);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--heading);
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* --- Hero Section --- */
.hero {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    padding: 60px 0;
}

.hero__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    width: 100%;
}

.hero__inner--no-image {
    grid-template-columns: 1fr;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.hero__image img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    border-radius: var(--radius);
}

.hero__inner--no-image .hero__social {
    justify-content: center;
}

.hero__name {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.hero__quote {
    font-style: italic;
    color: var(--text-secondary);
    border-left: none;
    padding: 0;
    margin: 0 0 16px 0;
    font-size: 0.95rem;
}

.hero__tags {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    letter-spacing: 0.01em;
}

.hero__social {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.hero__social a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.hero__social a:hover {
    color: var(--heading);
}

.hero__cta {
    display: inline-block;
    padding: 10px 28px;
    background: var(--brand);
    color: #181818 !important;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 50px;
    transition: background 0.2s, transform 0.2s;
}

.hero__cta:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
}

/* --- Section Title --- */
.section-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 48px;
}

/* --- Portfolio Grid --- */
.portfolio {
    padding: 60px 0;
    background: var(--bg-alt);
    transition: background 0.3s;
}

.portfolio__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.portfolio__card {
    display: block;
    text-align: center;
    transition: transform 0.3s;
}

.portfolio__card:hover {
    transform: translateY(-4px);
}

.portfolio__card-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--border);
    margin-bottom: 16px;
}

.portfolio__card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.portfolio__card:hover .portfolio__card-image img {
    transform: scale(1.05);
}

.portfolio__card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--heading);
}

.portfolio__card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Blog Posts Section --- */
.posts-section {
    padding: 80px 0;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 48px;
}

.post-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.post-card__image {
    display: block;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-card__image img {
    transform: scale(1.05);
}

.post-card__content {
    padding: 20px;
}

.post-card__content a[rel="category"] {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
    font-weight: 600;
}

.post-card__title {
    font-size: 1.1rem;
    margin: 8px 0;
    line-height: 1.4;
}

.post-card__title a {
    color: var(--heading);
    background-image: linear-gradient(var(--brand), var(--brand));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s;
}

.post-card__title a:hover {
    background-size: 100% 2px;
    color: var(--heading);
}

.post-card__meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-card__meta span::after {
    content: " \00b7 ";
}

.post-card__excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.6;
}

/* --- Post Card List Variant --- */
.post-card--list {
    display: grid;
    grid-template-columns: 200px 1fr;
    box-shadow: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 24px 0;
}

.post-card--list:hover {
    transform: none;
    box-shadow: none;
}

.post-card__image--small {
    aspect-ratio: 3/2;
    border-radius: var(--radius);
    overflow: hidden;
}

/* --- Article (Single Post/Page) --- */
.article {
    padding: 60px 0 80px;
}

.article__header {
    margin-bottom: 40px;
}

.article__meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.article__meta a {
    color: var(--brand);
    font-weight: 600;
}

.article__title {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.25rem;
    line-height: 1.3;
}

.article__cover {
    margin-bottom: 40px;
    border-radius: var(--radius);
    overflow: hidden;
}

.article__cover img {
    width: 100%;
}

/* --- Article Content --- */
.article__content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.article__content p {
    margin-bottom: 1.5em;
}

.article__content h2 {
    font-size: 1.5rem;
    margin: 2em 0 0.8em;
}

.article__content h3 {
    font-size: 1.25rem;
    margin: 1.5em 0 0.6em;
}

.article__content blockquote {
    border-left: 3px solid var(--brand);
    padding: 0.5em 1.5em;
    margin: 1.5em 0;
    color: var(--text-secondary);
    background: var(--bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.article__content pre {
    background: var(--code-bg);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.article__content code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.article__content p code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.article__content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}

.article__content a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article__content ul, .article__content ol {
    padding-left: 1.5em;
    margin-bottom: 1.5em;
}

.article__content li {
    margin-bottom: 0.5em;
}

.article__content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.article__content th, .article__content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.article__content th {
    background: var(--bg-alt);
    font-weight: 600;
}

/* --- Article Footer --- */
.article__footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.article__tags a {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-alt);
    padding: 4px 12px;
    border-radius: 50px;
    margin-right: 8px;
    margin-bottom: 8px;
}

.article__tags a:hover {
    background: var(--brand);
    color: #181818;
}

.article__nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

.article__nav a {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.article__nav a:hover {
    color: var(--heading);
}

/* --- Archive --- */
.archive {
    padding: 60px 0;
}

.archive__title {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    margin-bottom: 40px;
}

.posts-list {
    margin-bottom: 40px;
}

/* --- Comments --- */
.comments {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.comments__title {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

.comment-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: border-color 0.2s;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--brand);
}

.comment-form__fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.comment-form__fields input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.comment-form__fields input:focus {
    outline: none;
    border-color: var(--brand);
}

/* --- Button --- */
.btn {
    display: inline-block;
    padding: 10px 24px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn--primary {
    background: var(--brand);
    color: #181818;
}

.btn--primary:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
}

/* --- Page Navigation --- */
.page-navigator {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    padding: 0;
}

.page-navigator a,
.page-navigator .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 500;
}

.page-navigator a {
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.page-navigator a:hover {
    background: var(--bg-alt);
    color: var(--heading);
}

.page-navigator .current {
    background: var(--brand);
    color: #181818;
    font-weight: 700;
}

/* --- Footer --- */
.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero {
        min-height: auto;
        padding: 48px 0;
    }

    .hero__inner {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }

    .hero__image img {
        height: 300px;
    }

    .hero__social {
        justify-content: center;
    }

    .hero__name {
        font-size: 1.75rem;
    }

    .portfolio__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .post-card--list {
        grid-template-columns: 1fr;
    }

    .post-card__image--small {
        margin-bottom: 12px;
    }

    .comment-form__fields {
        grid-template-columns: 1fr;
    }

    .article__title {
        font-size: 1.75rem;
    }

    .nav__links {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .portfolio__grid {
        grid-template-columns: 1fr;
    }

    .nav__links a {
        font-size: 0.8rem;
    }

    .hero {
        padding: 40px 0;
    }
}
