:root {
    --bg: #f5fbfb;
    --bg-soft: #eaf3f2;
    --card: #ffffff;
    --text: #0f1f23;
    --muted: #4b6a6f;

    --primary: #0f766e;   /* teal 700 */
    --primary-2: #14b8a6; 
    --accent-from: #0f766e; /* teal */
    --accent-to: #0284c7;   /* sky */

    --ring: 0 10px 28px rgba(2, 132, 199, .18);
    --radius: 14px;
    --border: 1px solid rgba(15, 31, 35, .10);
    --nav-offset: 68px;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: radial-gradient(1200px 700px at top right, rgba(2, 132, 199, .10), transparent), var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    padding-top: var(--nav-offset); /* avoid content under fixed header */
}

a {
    color: inherit;
    text-decoration: none
}

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

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

.section {
    margin: 48px 0
}

.section-hd h2 {
    margin: 0 0 6px 0
}

.section-hd .muted {
    color: var(--muted);
    margin: 10px 0;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
    /* max-width: 1200px; */
    padding: 16px 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    background: linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .66));
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.brand {
    font-weight: 700;
    letter-spacing: .2px
}

.spacer {
    flex: 1
}

.readBox {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.readBox .btn {
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    background: #f0f3fa;
    border: var(--border);
    color: var(--text);
    transition: all .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--ring)
}

.btn.primary {
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    border-color: transparent;
}

.btn.primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 10px 30px rgba(14, 165, 233, .25);
}

.btn.ghost {
    background: transparent
}

.site-header {
    position: relative;
    border-bottom: var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent);
}

.hero {
    padding: 64px 24px 40px;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 16px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    margin: 0;
    color: var(--muted);
    max-width: 720px
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ring);
    border-color: rgba(255, 255, 255, .12)
}

.card .title {
    font-weight: 600
}

.card .caption {
    color: var(--muted);
    font-size: 14px
}

.card .meta {
    display: flex;
    gap: 8px;
    color: var(--muted);
    font-size: 12px
}

.kbd {
    font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--muted)
}

.badge {
    border: var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    color: var(--muted)
}

.site-footer {
    border-top: var(--border);
    padding: 24px;
    text-align: center;
    color: var(--muted)
}

/* sort.html */
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px
}

.input {
    background: #f3f6fc;
    border: var(--border);
    border-radius: 10px;
    color: var(--text);
    height: 40px;
    padding: 0 12px;
    outline: none;
    min-width: 220px;
}

.input::placeholder {
    color: #6b7687
}

/* posts.html */
.post-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px
}

.post-hero {
    padding: 8px 0 0
}

.breadcrumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px
}

.prose {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    padding: 22px;
    line-height: 1.75;
    color: var(--text);
}

.prose h1,
.prose h2,
.prose h3 {
    margin-top: 1.4em
}

.prose pre {
    background: var(--bg-soft);
    border: var(--border);
    padding: 16px;
    border-radius: 10px;
    overflow: auto
}

.prose code {
    background: var(--bg-soft);
    border: var(--border);
    padding: 2px 6px;
    border-radius: 6px
}

.prose .fig {
    max-width: 600px;
    max-height: 300px;
    margin: 16px auto
}

.prose .fig img {
    width: 100%;
    height: auto;
    max-width: 600px;
    max-height: 300px;
    display: block;
    object-fit: contain;
}

.fig {
    border: var(--border);
    border-radius: 12px;
}

/* mbti.html */
.scale {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.scale .option {
    flex: 1;
    min-width: 90px;
    background: var(--bg-soft);
    border: var(--border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    transition: all .2s ease;
}

.scale input {
    display: none
}

.scale input:checked+.option {
    background: linear-gradient(180deg, #e8eafc, #e4f7ff);
    color: #1d2433;
    border-color: rgba(14, 165, 233, .45);
    box-shadow: var(--ring)
}

.q {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    padding: 18px
}

.q h4 {
    margin: 0 0 8px 0
}

.progress {
    height: 8px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
    border: var(--border)
}

.progress>b {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-to));
    width: 0%
}

.result {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: none
}

.bars {
    display: grid;
    gap: 8px
}

.bar {
    height: 10px;
    background: #eef2fd;
    border-radius: 999px;
    overflow: hidden;
    border: var(--border)
}

.bar>span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-to), var(--primary));
    width: 50%
}

/* small screens */
@media (max-width:640px) {
    .hero {
        padding: 40px 16px
    }

    .container {
        padding: 16px
    }

    .home-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* mini-grid */
.mini-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-top: 8px;
}

.mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f3f6fc;
    border: var(--border);
    border-radius: 10px;
    padding: 10px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--ring)
}

.mini .thumb {
    border-radius: 8px;
    overflow: hidden;
    background: #f3f6fc;
    aspect-ratio: 16/9;
    display: block;
}

.mini .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.mini .mini-title {
    font-size: 13px;
    line-height: 1.35;
    color: var(--text);
    opacity: .9
}

/* Subtle glassy nav on large screens */
@media (min-width: 768px) {
    .nav {
        background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .80));
        backdrop-filter: saturate(140%) blur(6px);
        -webkit-backdrop-filter: saturate(140%) blur(6px);
        border-bottom: 1px solid rgba(0, 0, 0, .06);
    }
}

/* Home grid tuning */
.home-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    align-items: stretch;
}

/* Card reveal animation */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card.reveal {
    opacity: 0;
    transform: translateY(10px) scale(.98);
    animation: fadeUp .5s cubic-bezier(.22, .61, .36, 1) var(--delay, 0ms) forwards;
    will-change: transform, opacity;
}

/* Skeleton loading */
.skeleton-card {
    position: relative;
    overflow: hidden
}

.skeleton-card .sk-title,
.skeleton-card .sk-line,
.skeleton-card .sk-badge {
    border-radius: 8px;
    background: var(--bg-soft);
    position: relative;
    overflow: hidden;
}

.skeleton-card .sk-title {
    height: 18px;
    width: 70%
}

.skeleton-card .sk-line {
    height: 12px;
    width: 100%;
    margin-top: 10px;
    opacity: .9
}

.skeleton-card .sk-badge {
    height: 22px;
    width: 90px;
    margin-top: 14px;
    border-radius: 999px
}

.skeleton-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .06), rgba(255, 255, 255, 0));
    animation: shimmer 1.2s linear infinite;
    transform: translateX(-100%);
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-card::after {
        animation: none;
    }
}

/* Text clamp utilities */
.clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Featured card */
.featured-card {
    height: 100%;
    display: grid;
    gap: 16px;
    grid-template-columns: 1.3fr 1fr;
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.featured-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ring);
    border-color: rgba(255, 255, 255, .12);
}

.featured-media {
    position: relative;
    background: #f3f6fc;
    min-height: 220px
}

.featured-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 16/9
}

.featured-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.featured-body .title {
    font-weight: 700;
    font-size: clamp(18px, 2.2vw, 22px)
}

.featured-body .caption {
    color: var(--muted)
}

.featured-badge {
    display: inline-block;
    font-size: 12px;
    border-radius: 999px;
    padding: 2px 10px;
    border: var(--border);
    color: var(--muted)
}

/* Mobile stack for featured */
@media (max-width: 860px) {
    .featured-card {
        grid-template-columns: 1fr;
    }

    .featured-media {
        min-height: 180px
    }
}

/* Make category captions and mini titles tidy with clamp */
.card .caption.clamp-3 {
    /* no extra styles, just ensure class exists */
}

.mini .mini-title.clamp-3 {
    /* same as above */
}

/* top-right action */
.action {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: var(--border);
    color: var(--text);
    background: rgba(255, 255, 255, .02);
    backdrop-filter: saturate(140%) blur(6px);
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    transition: all .2s ease;
}

.action:hover {
    transform: translateY(-1px);
    box-shadow: var(--ring);
    border-color: rgba(255, 255, 255, .12);
}

/* Featured split layout */
.featured-split {
    display: grid;
    gap: 16px;
    align-items: stretch;
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 1024px) {
    .featured-split {
        grid-template-columns: 1fr;
    }
}

/* MBTI side card */
.mbti-card {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.mbti-title {
    margin: 0;
    font-size: clamp(16px, 2.2vw, 20px)
}

.mbti-points {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6
}

.mbti-points li {
    margin: 2px 0
}

/* Keep featured left column visuals tidy if no image */
#featured:empty {
    min-height: 220px;
    border: var(--border);
    border-radius: var(--radius);
    background: #f3f6fc;
}

/* Smooth scroll globally */
html {
    scroll-behavior: smooth;
}

/* Offset to avoid tight top edge after scroll */
#categories {
    scroll-margin-top: 80px;
}

/* Landing highlight */
#categories.jump-highlight {
    background: linear-gradient(180deg, rgba(91, 140, 255, .07), transparent);
    transition: background .6s ease;
}

/* Also highlight when hash target is reached directly */
#categories:target {
    background: linear-gradient(180deg, rgba(91, 140, 255, .07), transparent);
    animation: fadeUp .5s cubic-bezier(.22, .61, .36, 1);
    scroll-margin-top: var(--nav-offset); /* avoid content under fixed header */
}

/* posts.html */
.post-hero h1{
	font-size: clamp(22px, 4.5vw, 34px);
	line-height: 1.25;
	word-break: break-word;
}

.prose h1{ font-size: clamp(22px, 5.2vw, 30px); line-height: 1.35; }
.prose h2{ font-size: clamp(20px, 4.8vw, 26px); line-height: 1.4; }
.prose h3{ font-size: clamp(18px, 4.2vw, 22px); line-height: 1.45; }

@media (max-width: 640px){
	.post-hero{ padding-top: 4px; }
	.post-hero h1{ margin-top: 2px; }
}

/* Responsive header: toggle + menu */
.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.nav-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: var(--border);
    color: var(--text);
    background: rgba(255, 255, 255, .02);
    backdrop-filter: saturate(140%) blur(6px);
    -webkit-backdrop-filter: saturate(140%) blur(6px);
    cursor: pointer;
    transition: all .2s ease;
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--ring);
    border-color: rgba(255, 255, 255, .12);
}

.nav-btn i {
    position: relative;
    width: 18px;
    height: 2px;
    background: currentColor;
    display: block;
}

.nav-btn i::before,
.nav-btn i::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-btn i::before { top: -6px; }
.nav-btn i::after  { top:  6px; }

#nav-toggle:checked ~ label.nav-btn i {
    background: transparent;
}
#nav-toggle:checked ~ label.nav-btn i::before {
    transform: translateY(6px) rotate(45deg);
}
#nav-toggle:checked ~ label.nav-btn i::after {
    transform: translateY(-6px) rotate(-45deg);
}

/* Desktop keeps inline links */
@media (min-width: 769px) {
    .nav-links { display: flex; }
}

/* Mobile: compact header + overlay menu */
@media (max-width: 768px) {
    :root { --nav-offset: 56px; }

    .nav { padding: 12px 16px; }

    .brand {
        max-width: 50vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-btn { display: inline-flex; }

    .nav-links { display: none; }

    #nav-toggle:checked ~ .nav-links {
        display: flex;
        position: fixed;
        top: var(--nav-offset);
        left: 0;
        right: 0;
        height: calc(100vh - var(--nav-offset));
        background: linear-gradient(180deg, rgba(11, 13, 16, .96), rgba(11, 13, 16, .88));
        backdrop-filter: saturate(140%) blur(10px);
        -webkit-backdrop-filter: saturate(140%) blur(10px);
        border-top: 1px solid rgba(255, 255, 255, .06);
        padding: 16px;
        flex-direction: column;
        gap: 10px;
        z-index: 999; /* below the header (1000) */
    }

    .nav-links .btn {
        width: 100%;
        height: 44px;
    }

    /* Prevent background scroll when menu open (modern browsers) */
    body:has(#nav-toggle:checked) { overflow: hidden; }
}

.adBox {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    position: relative;
    display: none;
}

.adBox::before {
    content: 'Advertisement';
    color: #888;
    font-size: 12px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}
