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

/* Dark mode (default) */
:root {
    --bg: #2a2a2a;
    --surface: #333333;
    --border: #3e3e3e;
    --border-hover: #555555;
    --blue: #5b9bd5;
    --blue-light: #7ab3e0;
    --blue-muted: #9dcaeb;
    --badge-bg: #3a3a3a;
    --badge-text: #6baed6;
    --bubble-color: 91, 155, 213;
}

/* Light mode */
:root[data-theme="light"] {
    --bg: #f4f1ec;
    --surface: #ebe7e0;
    --border: #d5d0c8;
    --border-hover: #b8b2a8;
    --blue: #1a3a5c;
    --blue-light: #2a5a8c;
    --blue-muted: #6a8aaa;
    --badge-bg: #ddd8d0;
    --badge-text: #4a6a8a;
    --bubble-color: 26, 58, 92;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--blue);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    min-height: 100dvh;
    transition: background 0.5s ease, color 0.5s ease;
}

header,
.card,
.card-badge,
.card-title,
.card-date,
.card-arrow,
.description p,
.join-section h2,
.join-section p,
.thesis,
.logo,
.nav-link,
.timeline-line,
.timeline-dot,
.inline-link,
.bubble {
    transition: all 0.5s ease;
}

/* Texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Bubbles */
.bubbles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
        rgba(var(--bubble-color), 0.15),
        rgba(var(--bubble-color), 0.06) 60%,
        transparent 100%);
    border: 1px solid rgba(var(--bubble-color), 0.12);
    animation: rise linear infinite;
}

.bubble:nth-child(1)  { width: 60px;  height: 60px;  left: 8%;  animation-duration: 14s; animation-delay: 0s; }
.bubble:nth-child(2)  { width: 36px;  height: 36px;  left: 18%; animation-duration: 18s; animation-delay: 3s; }
.bubble:nth-child(3)  { width: 82px;  height: 82px;  left: 30%; animation-duration: 22s; animation-delay: 1s; }
.bubble:nth-child(4)  { width: 45px;  height: 45px;  left: 42%; animation-duration: 16s; animation-delay: 5s; }
.bubble:nth-child(5)  { width: 30px;  height: 30px;  left: 55%; animation-duration: 20s; animation-delay: 2s; }
.bubble:nth-child(6)  { width: 72px;  height: 72px;  left: 65%; animation-duration: 24s; animation-delay: 7s; }
.bubble:nth-child(7)  { width: 27px;  height: 27px;  left: 75%; animation-duration: 15s; animation-delay: 4s; }
.bubble:nth-child(8)  { width: 52px;  height: 52px;  left: 85%; animation-duration: 19s; animation-delay: 6s; }
.bubble:nth-child(9)  { width: 42px;  height: 42px;  left: 22%; animation-duration: 21s; animation-delay: 9s; }
.bubble:nth-child(10) { width: 57px;  height: 57px;  left: 50%; animation-duration: 17s; animation-delay: 11s; }
.bubble:nth-child(11) { width: 33px;  height: 33px;  left: 70%; animation-duration: 23s; animation-delay: 8s; }
.bubble:nth-child(12) { width: 68px;  height: 68px;  left: 38%; animation-duration: 26s; animation-delay: 13s; }

@keyframes rise {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    5%   { opacity: 1; }
    50%  { transform: translateY(-50dvh) translateX(20px); }
    90%  { opacity: 0.6; }
    100% { transform: translateY(-110dvh) translateX(-10px); opacity: 0; }
}

/* Layout */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.75rem 1rem;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    gap: 1.25rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.875rem;
    color: var(--blue-muted);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s;
}

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

main {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    font-size: 0.875rem;
}

/* Hero */
.hero h1 {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--blue);
    animation: fadeUp 0.6s ease forwards;
}

.description {
    animation: fadeUp 0.6s 0.1s ease forwards;
    opacity: 0;
}

.description p {
    color: var(--blue-light);
    line-height: 1.7;
}

/* Timeline */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeUp 0.6s 0.2s ease forwards;
    opacity: 0;
}

.timeline-line {
    position: absolute;
    left: 2.5px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border);
}

.timeline-item {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.timeline-dot-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 1.25rem;
}

.timeline-dot {
    width: 6px;
    height: 6px;
    background: var(--blue-muted);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.timeline-content {
    flex: 1;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    text-decoration: none;
    color: var(--blue);
    transition: border-color 0.2s;
    cursor: pointer;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-badge {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 2px 4px;
}

.card-date {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--blue-muted);
}

.card-arrow {
    color: var(--blue-muted);
    transition: transform 0.2s;
}

.card:hover .card-arrow {
    transform: translate(2px, -2px);
}

.card-title {
    font-size: 1.125rem;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

/* Join */
.join-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: fadeUp 0.6s 0.3s ease forwards;
    opacity: 0;
}

.join-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--blue);
}

.join-section p {
    color: var(--blue-light);
    line-height: 1.7;
}

.thesis {
    color: var(--blue-muted);
}

.inline-link-wrap {
    display: inline-block;
    position: relative;
}

.inline-link {
    display: inline;
    color: var(--blue-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.inline-link:hover {
    color: var(--blue);
}

.arrow-wrap {
    white-space: nowrap;
}

.arrow-wrap svg {
    display: inline;
    vertical-align: middle;
}

.inline-link-wrap::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: calc(100% - 20px);
    height: 1px;
    background: var(--blue-muted);
    opacity: 0.4;
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--blue-muted);
    transition: color 0.2s, border-color 0.2s;
}

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

/* Dark: show sun, hide moon */
.icon-sun { display: block; }
.icon-moon { display: none; }

/* Light: show moon, hide sun */
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* Footer */
footer {
    display: flex;
    gap: 1.25rem;
    padding-top: 1rem;
    animation: fadeUp 0.6s 0.4s ease forwards;
    opacity: 0;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile */
@media (max-width: 600px) {
    header {
        padding: 1rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .card-date {
        display: none;
    }
}
