/* ------------------------------------------------------------------
   Daniel Shafer, personal site
   One stylesheet for every page. Vanilla CSS, no framework.
   ------------------------------------------------------------------ */

:root {
    --bg: #0a0a0d;
    --bg-2: #121217;
    --bg-3: #1a1a21;
    --ink: #f3efe6;
    --ink-2: #c9c4b8;
    --muted: #8d8a97;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.16);
    --card: rgba(255, 255, 255, 0.035);
    --card-hover: rgba(255, 255, 255, 0.06);
    --amber: #f7931a;
    --amber-2: #ffb547;
    --rose: #ff6b8f;
    --violet: #8b7bff;
    --mint: #5fe3b0;
    --on-amber: #1a1206;
    --radius: 24px;
    --radius-s: 14px;
    --display: "Fraunces", Georgia, serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --node: 255, 255, 255;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f6f2ea;
    --bg-2: #ede7db;
    --bg-3: #e3dccd;
    --ink: #16141b;
    --ink-2: #3b3843;
    --muted: #6e6a78;
    --line: rgba(20, 16, 30, 0.1);
    --line-2: rgba(20, 16, 30, 0.2);
    --card: rgba(20, 16, 30, 0.035);
    --card-hover: rgba(20, 16, 30, 0.06);
    --node: 20, 16, 30;
    color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.5s, color 0.5s;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--amber); color: var(--on-amber); }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

/* ---------- ambient layers ---------- */
#field {
    position: fixed;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
}
.glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(700px circle at var(--mx, 75%) var(--my, 15%), rgba(247, 147, 26, 0.13), transparent 60%),
        radial-gradient(900px circle at 8% 95%, rgba(139, 123, 255, 0.12), transparent 60%);
}
.progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    z-index: 30;
    transform-origin: 0 50%;
    transform: scaleX(var(--p, 0));
    background: linear-gradient(90deg, var(--amber), var(--rose), var(--violet));
}

/* ---------- cursor ---------- */
.cursor, .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 40;
    border-radius: 50%;
    mix-blend-mode: difference;
}
.cursor { width: 8px; height: 8px; background: #fff; }
.cursor-ring {
    width: 36px;
    height: 36px;
    border: 1.5px solid #fff;
    opacity: 0.6;
    transition: width 0.25s var(--ease), height 0.25s var(--ease), opacity 0.25s;
}
body.is-hovering .cursor-ring { width: 64px; height: 64px; opacity: 0.9; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-ring { display: none; } }

/* ---------- nav ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    background: color-mix(in srgb, var(--bg) 65%, transparent);
    border-bottom: 1px solid var(--line);
}
.nav .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 66px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    font-family: var(--display);
    font-variation-settings: "opsz" 48, "wght" 600, "SOFT" 60, "WONK" 1;
    font-size: 1.2rem;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.logo .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 0 rgba(247, 147, 26, 0.7);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 12px rgba(247, 147, 26, 0); }
    100% { box-shadow: 0 0 0 0 rgba(247, 147, 26, 0); }
}
.nav ul { display: flex; align-items: center; gap: 26px; list-style: none; min-width: 0; flex-shrink: 1; }
.nav a.link {
    position: relative;
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.nav a.link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 100%;
    height: 1px;
    background: var(--amber);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s var(--ease);
}
.nav a.link:hover { color: var(--ink); }
.nav a.link:hover::after { transform: scaleX(1); transform-origin: left; }
.clock {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    display: none;
}
@media (min-width: 700px) { .clock { display: inline; } }
.theme {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.3s var(--ease), background 0.2s;
}
.theme:hover { transform: rotate(25deg); background: var(--card-hover); }
.theme svg { width: 16px; height: 16px; }
.theme .sun { display: none; }
:root[data-theme="light"] .theme .sun { display: block; }
:root[data-theme="light"] .theme .moon { display: none; }

/* ---------- hero ---------- */
.hero {
    min-height: calc(100svh - 66px);
    display: grid;
    align-content: center;
    padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 8vw, 96px);
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--amber);
}
.name {
    font-family: var(--display);
    font-size: clamp(3.4rem, 13vw, 11rem);
    line-height: 0.92;
    letter-spacing: -0.045em;
    margin: 22px 0 30px;
    font-variation-settings: "opsz" 144, "wght" 400, "SOFT" 30, "WONK" 0;
}
.name .w { display: inline-block; white-space: nowrap; }
.name .c {
    display: inline-block;
    transition: font-variation-settings 0.5s var(--ease), color 0.3s;
    font-variation-settings: "opsz" 144, "wght" var(--wg, 400), "SOFT" var(--sf, 30), "WONK" 0;
}
.name .c.on { color: var(--amber); }
.roles {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 14px;
    font-family: var(--display);
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-variation-settings: "opsz" 48, "wght" 300, "SOFT" 100, "WONK" 1;
    color: var(--ink-2);
}
.roles .role {
    position: relative;
    color: var(--ink);
    font-style: italic;
    min-width: 7ch;
}
.roles .role::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 0.9em;
    margin-left: 4px;
    background: var(--amber);
    vertical-align: -0.12em;
    animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.lede {
    max-width: 40rem;
    margin-top: 28px;
    font-size: clamp(1.02rem, 1.8vw, 1.2rem);
    color: var(--muted);
}
.lede strong { color: var(--ink); font-weight: 500; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; }

/* buttons */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--line-2);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
    will-change: transform;
}
.btn > span { position: relative; z-index: 1; }
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--amber);
    transform: translateY(102%);
    transition: transform 0.4s var(--ease);
}
.btn:hover { border-color: var(--amber); color: var(--on-amber); }
.btn:hover::before { transform: translateY(0); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--on-amber); font-weight: 600; }
.btn.primary::before { background: var(--amber-2); }
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translate(3px, -3px); }

/* ---------- scroll hint ---------- */
.hint {
    margin-top: clamp(40px, 8vw, 80px);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.hint i {
    width: 1px;
    height: 48px;
    background: linear-gradient(var(--amber), transparent);
    animation: drip 1.8s var(--ease) infinite;
    transform-origin: top;
}
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- marquee ---------- */
.marquee {
    border-block: 1px solid var(--line);
    overflow: hidden;
    width: 100%;
    contain: inline-size;
    padding: 16px 0;
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.track {
    display: flex;
    gap: 48px;
    width: max-content;
    animation: scroll 32s linear infinite;
    font-family: var(--display);
    font-variation-settings: "opsz" 48, "wght" 400, "SOFT" 100, "WONK" 1;
    font-size: 1.35rem;
    color: var(--ink-2);
}
.marquee:hover .track { animation-play-state: paused; }
.track span { display: inline-block; white-space: nowrap; }
.track span::after { content: "\2726"; color: var(--amber); font-size: 0.8em; margin-left: 48px; vertical-align: middle; }
.track em { font-style: italic; color: var(--amber); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
section { padding: clamp(64px, 9vw, 120px) 0; }
.sec-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
}
h2.title, h1.title {
    font-family: var(--display);
    font-variation-settings: "opsz" 96, "wght" 400, "SOFT" 40, "WONK" 1;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.02;
    letter-spacing: -0.03em;
    max-width: 20ch;
    margin-top: 14px;
}
h2.title em, h1.title em { font-style: italic; color: var(--amber); }
.sec-head .idx {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ---------- bento ---------- */
.bento {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 16px;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
    padding: 24px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.3s, background 0.3s, transform 0.5s var(--ease);
    transform-style: preserve-3d;
}
.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(420px circle at var(--cx, 50%) var(--cy, 50%), rgba(247, 147, 26, 0.14), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.tile:hover { border-color: var(--line-2); background: var(--card-hover); }
.tile:hover::after { opacity: 1; }
.tile > * { position: relative; z-index: 1; }
.tile .k {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: auto;
}
.tile h3 {
    font-family: var(--display);
    font-variation-settings: "opsz" 48, "wght" 500, "SOFT" 40, "WONK" 1;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-top: 18px;
}
.tile p { color: var(--muted); font-size: 0.95rem; margin-top: 10px; line-height: 1.5; }
.tile .go {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    display: grid;
    place-items: center;
    color: var(--ink);
    transition: background 0.3s, color 0.3s, transform 0.4s var(--ease);
    z-index: 2;
}
.tile:hover .go { background: var(--amber); color: var(--on-amber); transform: rotate(45deg); }
.tile .big {
    font-family: var(--display);
    font-variation-settings: "opsz" 144, "wght" 300, "SOFT" 0, "WONK" 0;
    font-size: clamp(3rem, 7vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin-top: 16px;
    background: linear-gradient(110deg, var(--amber), var(--rose) 60%, var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.tile .big small { font-size: 0.4em; letter-spacing: 0; }

/* tile spans */
.s-12 { grid-column: span 12; }
.s-8 { grid-column: span 8; }
.s-7 { grid-column: span 7; }
.s-6 { grid-column: span 6; }
.s-5 { grid-column: span 5; }
.s-4 { grid-column: span 4; }
.s-3 { grid-column: span 3; }
.r-2 { grid-row: span 2; }
@media (max-width: 980px) {
    .s-8, .s-7, .s-6, .s-5 { grid-column: span 12; }
    .s-4, .s-3 { grid-column: span 6; }
}
@media (max-width: 560px) {
    .nav ul { gap: 14px; }
    .nav .wrap { height: 60px; }
    .nav a.link { font-size: 0.84rem; }
    .nav li.optional { display: none; }
    .logo { font-size: 1.05rem; }
    .bento { gap: 12px; }
    .s-4, .s-3 { grid-column: span 12; }
}

/* project tiles with image */
.tile.proj { padding: 0; min-height: 300px; }
.tile.proj .shot {
    flex: 1;
    min-height: 180px;
    background: var(--bg-2);
    overflow: hidden;
}
.tile.proj .shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transform: scale(1.02);
    filter: saturate(0.9);
    transition: transform 0.8s var(--ease), filter 0.5s;
}
.tile.proj:hover .shot img { transform: scale(1.07); filter: saturate(1.05); }
.tile.proj .body { padding: 20px 24px 24px; }
.tile.proj .body .k { margin-bottom: 8px; }
.tile.proj h3 { margin-top: 0; }

/* about tile */
.tile.about { padding: 28px; }
.tile.about p { font-size: 1.02rem; color: var(--ink-2); }
.tile.about p + p { margin-top: 12px; }
.tile.about a { color: var(--ink); text-decoration-color: var(--amber); text-underline-offset: 4px; }
.tile.about .portrait {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 18px;
}
.tile.about .portrait::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--amber), var(--rose), var(--violet), var(--mint), var(--amber));
    animation: spin 10s linear infinite;
}
.tile.about .portrait::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--bg);
}
.tile.about .portrait img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* stack chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
    font-family: var(--mono);
    font-size: 0.74rem;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--ease);
}
.chip:hover { background: var(--amber); color: var(--on-amber); border-color: var(--amber); transform: translateY(-2px); }

/* github tile */
.tile.gh .big { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.heat {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr);
    gap: 3px;
    margin-top: auto;
    padding-top: 18px;
    opacity: 0;
    transition: opacity 0.6s var(--ease);
}
.heat.ready { opacity: 1; }
.heat i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--line); }
.heat .l1 { background: rgba(247, 147, 26, 0.3); }
.heat .l2 { background: rgba(247, 147, 26, 0.55); }
.heat .l3 { background: rgba(247, 147, 26, 0.8); }
.heat .l4 { background: var(--amber); }

/* now tile list */
.now { list-style: none; margin-top: 14px; }
.now li {
    position: relative;
    padding: 10px 0 10px 28px;
    border-top: 1px solid var(--line);
    font-size: 0.95rem;
    color: var(--ink-2);
}
.now li::before { content: "\2192"; color: var(--amber); position: absolute; left: 0; top: 10px; }
.now li a { color: var(--ink); text-decoration-color: var(--amber); text-underline-offset: 4px; }

/* contact tile */
.tile.contact { align-items: flex-start; justify-content: flex-end; min-height: 260px; }
.tile.contact h3 {
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-variation-settings: "opsz" 96, "wght" 400, "SOFT" 60, "WONK" 1;
    letter-spacing: -0.03em;
}
.tile.contact .cta { margin-top: 24px; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 0.88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
footer .links { display: flex; gap: 22px; }
footer a { text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--amber); }
footer .mono { font-family: var(--mono); font-size: 0.76rem; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: 0.08s; }
.reveal[data-d="2"] { transition-delay: 0.16s; }
.reveal[data-d="3"] { transition-delay: 0.24s; }
.reveal[data-d="4"] { transition-delay: 0.32s; }

/* ---------- sub pages ---------- */
.prose { max-width: 42rem; color: var(--muted); font-size: 1.12rem; }
.prose h3 {
    font-family: var(--display);
    font-variation-settings: "opsz" 48, "wght" 500, "SOFT" 40, "WONK" 1;
    font-size: 1.7rem;
    color: var(--ink);
    margin-bottom: 12px;
}
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.member { text-align: center; padding: 30px 20px; }
.member img { width: 118px; height: 118px; object-fit: cover; border-radius: 50%; margin: 0 auto 18px; border: 3px solid var(--line-2); }
.member b { display: block; font-family: var(--display); font-variation-settings: "opsz" 48, "wght" 500; font-size: 1.2rem; }
.member span { color: var(--muted); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
    #field { display: none; }
}

/* vesper tile */
.tile.vesper {
    padding: 28px;
    background: linear-gradient(160deg, rgba(247, 147, 26, 0.12), var(--card) 55%);
}
.tile.vesper h3 {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    font-variation-settings: "opsz" 72, "wght" 500, "SOFT" 60, "WONK" 1;
    margin-top: 16px;
    max-width: 22ch;
}
.tile.vesper p { font-size: 1rem; color: var(--ink-2); margin-top: 14px; max-width: 58ch; }
.tile.vesper .chips { margin-top: auto; padding-top: 20px; }
.tile.vesper .k { margin-bottom: 0; }
.tile.vesper .facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: auto;
    padding-top: 28px;
}
.tile.vesper .facts div {
    padding: 14px 16px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--card) 40%, transparent);
    border: 1px solid var(--line);
}
.tile.vesper .facts b { display: block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); font-weight: 500; }
.tile.vesper .facts span { display: block; margin-top: 8px; font-size: 0.9rem; line-height: 1.4; color: var(--ink-2); }
.tile.vesper .chips { margin-top: 0; padding-top: 18px; }
@media (max-width: 720px) { .tile.vesper .facts { grid-template-columns: 1fr; } }

/* a11y + sub-pages */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.idx.corner { position: absolute; top: 24px; right: 24px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.tile.contact h3 em { color: var(--amber); }
.page-title { font-size: clamp(3rem, 9vw, 7rem); max-width: none; }
.bento.stats { margin-bottom: 48px; }
.chip[href] { text-decoration: none; }
.tile .more { margin-top: 16px; font-size: 0.85rem; }
.tile .more a { color: var(--ink); text-decoration-color: var(--amber); text-underline-offset: 4px; }
