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

@font-face {
    font-family: Geist;
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-sans.woff2") format("woff2");
}

@font-face {
    font-family: "Geist Fallback";
    src: local("Arial");
    ascent-override: 95.94%;
    descent-override: 28.16%;
    line-gap-override: 0%;
    size-adjust: 104.76%;
}

@font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-mono.woff2") format("woff2");
}

@font-face {
    font-family: "Geist Mono Fallback";
    src: local("Arial");
    ascent-override: 74.67%;
    descent-override: 21.92%;
    line-gap-override: 0%;
    size-adjust: 134.59%;
}

:root {
    --background: #ffffff;
    --foreground: #171717;
    --color-text: #000000;
    --color-text-secondary: #525252;
    --color-text-muted: #737373;
    --color-border: #e5e5e5;
    --color-nav: #f5f5f5;
    --color-nav-active: #e5e5e5;
    --color-nav-hover: #d4d4d4;
    --color-link: #3b82f6;
    --color-link-accent: #22c55e;
    --font-sans: "Geist", "Geist Fallback", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "Geist Mono", "Geist Mono Fallback", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --max-width: 56rem;
    --content-width: 48rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0a0a0a;
        --foreground: #ededed;
        --color-text: #ffffff;
        --color-text-secondary: #d4d4d4;
        --color-text-muted: #a3a3a3;
        --color-border: #262626;
        --color-nav: #171717;
        --color-nav-active: #262626;
        --color-nav-hover: #262626;
    }
}

html {
    color-scheme: light dark;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--background);
    min-height: 100vh;
    display: grid;
    grid-template-rows: 1fr auto;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: none;
}

a:focus-visible {
    outline: 2px solid var(--color-text-muted);
    outline-offset: 2px;
}

.page-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    padding: 0.75rem 0;
    margin-bottom: 2rem;
    background: color-mix(in srgb, var(--background) 80%, transparent);
    backdrop-filter: blur(4px);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
}

@media (min-width: 640px) {
    .nav {
        gap: 1.25rem;
        font-size: 1.125rem;
    }

    .page-nav {
        margin-bottom: 2rem;
    }
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: var(--color-nav);
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--color-nav-hover);
}

.nav-link.is-active {
    background: var(--color-nav-active);
    font-weight: 700;
}

body:has(.page-blog) .nav-link[href="/blog"],
body:has(.page-post) .nav-link[href="/blog"],
body:has(.page-about) .nav-link[href="/about"],
body:has(.page-ask) .nav-link[href="/ask"],
body:has(.page-schedule) .nav-link[href="/schedule"],
body:has(.page-home) .nav-link[href="/"] {
    background: var(--color-nav-active);
    font-weight: 700;
}

.nav-link svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Home */
.page-home {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem;
    gap: 2rem;
}

@media (min-width: 640px) {
    .page-home {
        flex-direction: row;
        gap: 3rem;
        padding: 1rem;
    }
}

.home-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 640px) {
    .home-copy {
        align-items: flex-start;
        text-align: left;
        gap: 1.5rem;
        order: 2;
    }
}

.home-portrait {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .home-portrait {
        margin-bottom: 0;
        order: 1;
    }
}

.profile-image {
    display: block;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    border-radius: 9999px;
    object-fit: cover;
    border: 4px solid var(--color-border);
}

@media (prefers-color-scheme: dark) {
    .profile-image {
        filter: grayscale(1);
    }
}

.home-name {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text);
    margin: 0;
}

@media (min-width: 640px) {
    .home-name {
        font-size: 3.75rem;
    }
}

.home-role {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text-secondary);
    margin: 0;
}

@media (min-width: 640px) {
    .home-role {
        font-size: 1.5rem;
    }
}

.home-role a,
.home-bio a {
    font-weight: 600;
    color: var(--color-text);
}

.home-bio {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

@media (min-width: 640px) {
    .home-bio {
        font-size: 1.25rem;
    }
}

/* Inner pages (blog, about, post) */
.page-inner {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

@media (min-width: 640px) {
    .page-inner {
        padding: 5rem 1rem 4rem;
    }
}

.page-inner-content {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

/* About */
.about-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-size: 1.125rem;
    color: var(--color-text-secondary);
}

.about-content p {
    margin: 0;
}

.about-content a {
    color: var(--color-link-accent);
    text-decoration: underline;
    white-space: nowrap;
}

.about-content a:hover {
    opacity: 0.85;
}

/* Blog list */
.blog-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.blog-item {
    display: block;
}

.blog-item-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    margin: 0 0 0.5rem;
    transition: color 0.15s ease;
}

.blog-item:hover .blog-item-title {
    color: var(--color-text-secondary);
}

.blog-item-brief {
    color: var(--color-text-secondary);
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Post detail */
.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: color 0.15s ease;
}

.back-to-blog:hover {
    color: var(--color-text);
}

.back-to-blog svg {
    width: 1rem;
    height: 1rem;
}

.post-title {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
    margin: 0 0 1rem;
}

.post-cover {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.post-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin: 0 0 1rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.post-header {
    margin-bottom: 0.75rem;
}

/* Post prose */
.post-content {
    max-width: 65ch;
    color: var(--foreground);
    line-height: 1.75;
    overflow-x: hidden;
}

.post-content > * + * {
    margin-top: 1.25em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--color-text);
    line-height: 1.3;
    margin-top: 1.75em;
    margin-bottom: 0.75em;
}

.post-content h1 {
    font-size: 2.25em;
    font-weight: 700;
}

.post-content h2 {
    font-size: 1.5em;
    font-weight: 700;
}

.post-content h3 {
    font-size: 1.25em;
    font-weight: 600;
}

.post-content h4 {
    font-size: 1.125em;
    font-weight: 600;
}

.post-content p {
    margin: 1.25em 0;
}

.post-content a {
    color: var(--color-link);
    text-decoration: underline;
    font-weight: 500;
}

.post-content a:hover {
    color: #2563eb;
}

.post-content strong {
    color: var(--color-text);
    font-weight: 600;
}

.post-content ul,
.post-content ol {
    margin: 1.25em 0;
    padding-left: 1.625em;
}

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

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

.post-content li {
    margin: 0.5em 0;
    color: var(--foreground);
}

.post-content blockquote {
    font-weight: 500;
    font-style: italic;
    border-left: 0.25rem solid var(--color-border);
    margin: 1.6em 0;
    padding-left: 1em;
}

.post-content pre {
    background: #1f2937;
    color: #e5e7eb;
    overflow-x: auto;
    font-size: 0.875em;
    line-height: 1.7;
    margin: 1.7em 0;
    border-radius: 0.375rem;
    padding: 0.85em 1.15em;
    font-family: var(--font-mono);
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.post-content :not(pre) > code {
    background: color-mix(in srgb, var(--color-nav) 80%, transparent);
    padding: 0.15em 0.35em;
    border-radius: 0.25rem;
}

.post-content img,
.post-content .image--center,
.post-content .mx-auto {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2em auto;
    border-radius: 0.375rem;
}

.post-content hr {
    border: none;
    border-top: 1.5px solid color-mix(in srgb, var(--color-text) 10%, transparent);
    margin: 3em 0;
}

.post-content .video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 2rem 0;
    overflow: hidden;
    border-radius: 0.5rem;
}

.post-content .video-embed iframe,
.post-content iframe.video-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.post-content iframe.video-embed {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    height: auto;
}

/* Footer */
.site-footer {
    position: sticky;
    bottom: 0;
    z-index: 55;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border);
    background: var(--background);
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .site-footer {
        position: static;
        padding: 1.5rem 2rem;
    }
}

.site-footer .copyright {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 640px) {
    .site-footer .copyright {
        font-size: 0.875rem;
    }
}

.social-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .social-links {
        gap: 1rem;
    }
}

.social-links a {
    color: var(--color-text-secondary);
    display: inline-flex;
    transition: color 0.15s ease;
}

.social-links a:hover {
    color: var(--color-text);
}

.social-links svg {
    width: 1rem;
    height: 1rem;
}

@media (min-width: 640px) {
    .social-links svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(136, 136, 136, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 102, 102, 0.8);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(136, 136, 136, 0.5) transparent;
}

/* Schedule */
.schedule-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.schedule-intro {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin: 0;
}

.calendar-embed {
    position: relative;
    width: 100%;
    height: calc(100vh - 13rem);
    overflow: hidden;
    background: var(--background);
}

.calendar-embed iframe {
    display: block;
    width: 100%;
    height: calc(100vh - 13rem + 46px);
    margin-top: -46px;
    border: 0;
}

@media (prefers-color-scheme: dark) {
    .calendar-embed iframe {
        filter: invert(0.96) hue-rotate(180deg);
    }
}

/* Ask */
.ask-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ask-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.ask-intro {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.ask-flash {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.ask-flash-success {
    background: color-mix(in srgb, #22c55e 12%, transparent);
    color: #166534;
    border: 1px solid color-mix(in srgb, #22c55e 30%, transparent);
}

@media (prefers-color-scheme: dark) {
    .ask-flash-success {
        color: #bbf7d0;
        background: color-mix(in srgb, #22c55e 18%, transparent);
    }
}

.ask-form-card {
    width: 100%;
    border: 1px solid color-mix(in srgb, #3b82f6 35%, var(--color-border));
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.ask-answering {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--color-border);
    background: var(--color-nav);
}

.ask-answering-label {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.ask-answering-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text);
}

.ask-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ask-textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--color-border);
    background: var(--background);
    color: var(--color-text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.ask-textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

.ask-form-actions {
    display: flex;
    justify-content: flex-end;
}

.ask-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    min-width: 7rem;
    padding: 0 1rem;
    border-radius: 0.375rem;
    border: 1px solid color-mix(in srgb, #3b82f6 25%, var(--color-border));
    background: var(--background);
    color: var(--color-text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ask-submit:hover {
    background: var(--color-nav);
}

.ask-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ask-list-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.ask-item {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.ask-item-new {
    border-color: #facc15;
    background: color-mix(in srgb, #facc15 10%, transparent);
}

.ask-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ask-badge-seen {
    background: #dcfce7;
    color: #166534;
}

.ask-badge-unseen {
    background: #fef9c3;
    color: #854d0e;
}

@media (prefers-color-scheme: dark) {
    .ask-badge-seen {
        background: color-mix(in srgb, #22c55e 25%, transparent);
        color: #bbf7d0;
    }

    .ask-badge-unseen {
        background: color-mix(in srgb, #eab308 25%, transparent);
        color: #fef08a;
    }
}

.ask-item-question {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text);
}

.ask-item-meta {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.ask-item-answer {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background: var(--color-nav);
}

.ask-item-answer-label {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.ask-item-answer-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.ask-item-admin {
    margin-top: 0.5rem;
}

.ask-item-visitor {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.ask-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.ask-action-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: #2563eb;
}

.ask-action-link:hover {
    color: #1d4ed8;
}

.ask-inline-form {
    display: inline;
    margin: 0;
}

.ask-action-delete {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: #dc2626;
    cursor: pointer;
}

.ask-action-delete:hover {
    color: #991b1b;
}
