:root {
    --cream: #000000;
    --bg: #000000;
    --cream-deep: #161616;
    --card-h: clamp(560px, 82vh, 940px);
    --card-w: clamp(300px, 80vw, 1180px);
    --card-w-slim: clamp(280px, 30vw, 480px);
    --ink: #f5f0ea;
    --ink-soft: #a39e96;
    --accent: #eef08a;
    --accent-deep: #e4e76b;
    --card: #1c1c1c;
    --line: rgba(255, 255, 255, 0.14);
    --social-bg: rgba(255, 255, 255, 0.08);
    --avatar-ring: #2a2a2a;
    --serif: "Fraunces", Georgia, serif;
    --mono: "Space Mono", ui-monospace, monospace;
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root {
        --cream: #faf3ea;
        --bg: #faf3ea;
        --cream-deep: #f3e9da;
        --ink: #282322;
        --ink-soft: #6b635c;
        --card: #ffffff;
        --line: rgba(40, 35, 34, 0.12);
        --social-bg: rgba(255, 255, 255, 0.5);
        --avatar-ring: #ffffff;
        color-scheme: light;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--serif);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.7s ease;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 32px;
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: var(--bg);
    transition: background-color 0.7s ease, opacity 0.5s ease;
}

/* Hide the top bar while a card takes over the window */
body.work-focus .topbar {
    opacity: 0;
    pointer-events: none;
}

.brand {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-style: italic;
    letter-spacing: 0.3px;
    color: var(--ink);
    text-decoration: none;
}

.nav-pill {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.25s ease, transform 0.25s ease;
}

.nav-pill:hover {
    background: var(--cream-deep);
    transform: translateY(-1px);
}

/* ---------- Profile ---------- */
.profile {
    max-width: 720px;
    margin: 0 auto;
    padding: 54px 24px 70px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile > * {
    opacity: 0;
    transform: translateY(14px);
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.profile__avatar { animation-delay: 0.05s; }
.profile__name   { animation-delay: 0.15s; }
.profile__handle { animation-delay: 0.22s; }
.profile__bio    { animation-delay: 0.30s; }
.profile__socials{ animation-delay: 0.40s; }

@keyframes rise {
    to { opacity: 1; transform: none; }
}

.profile__avatar {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--avatar-ring);
    box-shadow: 0 14px 34px rgba(40, 35, 34, 0.14);
    margin-bottom: 22px;
}

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

.profile__name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile__name h1 {
    font-size: clamp(2.2rem, 5vw, 3.1rem);
    font-weight: 500;
    letter-spacing: -0.5px;
    line-height: 1;
    color: var(--ink);
}

.verified {
    color: #2aa3ef;
    flex-shrink: 0;
}

.profile__handle {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-top: 10px;
}

.profile__bio {
    font-size: clamp(1.15rem, 2.4vw, 1.55rem);
    line-height: 1.55;
    color: var(--ink);
    margin-top: 26px;
    max-width: 540px;
}

.profile__bio em {
    font-style: italic;
}

.profile__socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.social {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: lowercase;
    letter-spacing: 0.3px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 15px;
    background: var(--social-bg);
    transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.social svg { opacity: 0.85; }

.social:hover {
    background: var(--card);
    border-color: var(--ink);
    transform: translateY(-2px);
}

/* ---------- Work / story scroller ---------- */
.work {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    position: relative;
}

.work__head {
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    z-index: 10;
    transition: opacity 0.5s ease;
}

/* In the takeover view, the header gets out of the way */
body.work-focus .work__head {
    opacity: 0;
    pointer-events: none;
}

.story-bar {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
}

body.work-focus .story-bar {
    opacity: 1;
    pointer-events: auto;
}

.story-bar__seg {
    flex: 1;
    height: 2px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.story-bar__seg::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s ease;
}

.story-bar__seg.is-active::after {
    transform: scaleX(1);
}

.work__head h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 500;
    font-style: italic;
}

.work__hint {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-soft);
    text-transform: lowercase;
}

.scroller-wrap {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.scroller {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    scroll-snap-type: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    transition: gap 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.scroller::-webkit-scrollbar {
    display: none;
}

/* Takeover view: no gaps between the full-bleed columns, snap each card */
body.work-focus .scroller {
    gap: 0;
    scroll-snap-type: x mandatory;
}

.proj {
    flex: 0 0 auto;
    width: var(--card-w-slim);
    height: var(--card-h);
    scroll-snap-align: center;
    position: relative;
    border-radius: 7px;
    overflow: hidden;
    cursor: pointer;
    transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1),
                height 0.6s cubic-bezier(0.2, 0.7, 0.2, 1),
                border-radius 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Takeover view: cards grow to full size, square corners */
body.work-focus .proj {
    width: var(--card-w);
    height: 100vh;
    border-radius: 0;
}

.proj:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
}

.proj__media {
    position: absolute;
    inset: 0;
    background-color: #1b1917;
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 0.5px, transparent 0.5px);
    background-size: 6px 6px;
    background-position: 0 0;
    background-repeat: repeat;
}

.proj[data-key="neuralnotes"] .proj__media {
    background-image:
        url("resources/nnotes-logo.svg"),
        radial-gradient(rgba(255, 255, 255, 0.06) 0.5px, transparent 0.5px);
    background-size: min(52%, 220px) auto, 6px 6px;
    background-position: center, 0 0;
    background-repeat: no-repeat, repeat;
}

.proj[data-key="calyst"] .proj__media::after,
.proj[data-key="coming-soon"] .proj__media::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68px;
    height: 10px;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle, #cccbb5 5px, transparent 5px),
        radial-gradient(circle, #cccbb5 5px, transparent 5px),
        radial-gradient(circle, #cccbb5 5px, transparent 5px);
    background-size: 10px 10px;
    background-position: 0 center, 29px center, 58px center;
    background-repeat: no-repeat;
}

.proj__overlay {
    position: absolute;
    inset: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.5s ease;
}

.proj.is-selected .proj__overlay {
    background: transparent;
}

.proj__info {
    position: absolute;
    left: 26px;
    right: 86px;
    bottom: 28px;
}

.proj__info h3 {
    font-family: var(--serif);
    font-size: clamp(1.7rem, 3.6vw, 2.4rem);
    font-weight: 500;
    line-height: 1;
}

.proj__info p {
    font-size: 1rem;
    line-height: 1.4;
    margin-top: 8px;
    opacity: 0.95;
}

.proj__users {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 6px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.proj__users svg { opacity: 0.9; }

/* ---- Reels-style side rail ---- */
.proj__rail {
    position: absolute;
    right: 16px;
    bottom: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #fff;
    text-decoration: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.proj.is-selected .rail-btn { opacity: 1; transform: none; }
.proj.is-selected .rail-btn--site { transition-delay: 0.08s; }

.rail-btn .ico {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.25s ease, background 0.25s ease;
}

.rail-btn--insta .ico::after {
    content: "";
    position: absolute;
    top: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3b30;
}

.rail-btn .lbl {
    font-family: var(--mono);
    font-size: 0.58rem;
    text-transform: lowercase;
    letter-spacing: 0.3px;
}

.rail-btn:hover .ico {
    transform: translateY(-2px) scale(1.06);
    background: rgba(255, 255, 255, 0.32);
}

.rail-btn--site .ico {
    background: #fff;
    border-color: rgba(255, 255, 255, 0.85);
    color: #000;
}

.rail-btn--site:hover .ico {
    background: rgba(255, 255, 255, 0.9);
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .topbar { padding: 18px; }
    .profile { padding: 36px 18px 50px; }
    .work__head { padding-left: 22px; padding-right: 22px; top: 18px; }
}

