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

:root {
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-tertiary: #999;
    --bg: #fafafa;
    --link: #1a1a1a;
    --link-hover: #555;
    --border: #e5e5e5;
    --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-display: "Fraunces", Georgia, serif;
}

html {
    font-size: 16px;
    color-scheme: light dark;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--bg);
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    line-height: 1.7;
}

/* === Layout === */
main {
    max-width: 600px;
    margin: 0 auto;
    padding: 80px 24px 60px;
}

/* === Header === */
header {
    margin-bottom: 48px;
}

h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

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

.tagline a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
}

.tagline a:hover {
    color: var(--text);
    text-decoration-color: var(--text);
}

/* === Intro === */
.intro {
    margin-bottom: 40px;
}

.intro p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.intro p:last-child {
    margin-bottom: 0;
}

/* === Inline Logo === */
.inline-logo {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.1em;
    margin-right: 3px;
    border-radius: 3px;
    object-fit: contain;
}

.inline-logo-link {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    white-space: nowrap;
}

.inline-logo-link:hover {
    color: var(--text);
    text-decoration-color: var(--text);
}

/* === Tagline Row === */
.tagline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* === Meta (location + time) === */
.meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.meta-divider {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.meta-icon {
    width: 12px;
    height: 12px;
    color: var(--text-tertiary);
}

/* === Links === */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 56px;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--border);
}

.links a {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.links a:hover {
    color: var(--text);
    border-color: var(--text-tertiary);
    background-color: rgba(0, 0, 0, 0.02);
}

/* === Companies === */
.companies {
    margin-bottom: 56px;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--border);
}

.companies h2 {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.card-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
}

.card-icon svg,
.card-icon img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.card-text h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

/* === Writing === */
.notes {
    margin-bottom: 80px;
}

.notes h2 {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.notes ul {
    list-style: none;
}

.notes li {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
}

.notes .date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 36px;
}

.notes li a {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.notes li a:hover {
    color: var(--text-secondary);
}

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

footer p {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 300;
    font-style: italic;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    opacity: 0.6;
}

/* === Post Navigation === */
.post-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 48px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.back-link:hover {
    color: var(--text);
    background-color: rgba(0, 0, 0, 0.04);
}

.copy-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.copy-link:hover {
    color: var(--text);
    background-color: rgba(0, 0, 0, 0.04);
}

.copy-link .check-icon {
    display: none;
}

.copy-link.copied .copy-icon {
    display: none;
}

.copy-link.copied .check-icon {
    display: block;
    color: #22c55e;
}

/* === Post === */
.post-header {
    margin-bottom: 40px;
}

.post-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 8px;
}

.post-date {
    display: block;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.post-body {
    margin-bottom: 64px;
}

.post-body p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

.post-body p:last-child {
    margin-bottom: 0;
}

.post-body h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 36px;
    margin-bottom: 16px;
}

.post-body h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 28px;
    margin-bottom: 12px;
}

.post-body blockquote {
    border-left: 2px solid var(--border);
    padding-left: 20px;
    margin: 24px 0;
}

.post-body blockquote p {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--text-tertiary);
}

.post-body a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
}

.post-body a:hover {
    text-decoration-color: var(--text);
}

.post-body ul,
.post-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.post-body li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}

.post-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 24px 0;
}

/* === Post Pagination === */
.post-pagination {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 32px 0;
    margin-bottom: 40px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.pagination-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    max-width: 45%;
    transition: opacity 0.15s ease;
}

.pagination-link:hover {
    opacity: 0.6;
}

.pagination-prev {
    align-items: flex-start;
}

.pagination-next {
    align-items: flex-end;
    margin-left: auto;
}

.pagination-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.pagination-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text);
}

.pagination-placeholder {
    flex: 1;
}

/* === Responsive === */
@media (max-width: 480px) {
    main {
        padding: 48px 20px 40px;
    }

    .tagline-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .links {
        gap: 8px;
    }

    .links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .notes li {
        padding: 10px 0;
        min-height: 44px;
    }

    .post-pagination {
        flex-direction: column;
        gap: 24px;
    }

    .pagination-link {
        max-width: 100%;
        padding: 8px 0;
        min-height: 44px;
    }

    .pagination-next {
        align-items: flex-start;
    }
}

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e5e5e5;
        --text-secondary: #a0a0a0;
        --text-tertiary: #666;
        --bg: #141414;
        --link: #e5e5e5;
        --link-hover: #bbb;
        --border: #2a2a2a;
    }

    .card {
        background: #1c1c1c;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3);
    }

    .card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4);
    }

    body {
        background-image:
            linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    }

    .links a:hover {
        background-color: rgba(255, 255, 255, 0.04);
    }

    .back-link:hover,
    .copy-link:hover {
        background-color: rgba(255, 255, 255, 0.06);
    }
}
