/* Matthieu Greiner, portfolio design system
   Paper + ink, one orange accent, serif / sans / mono, thin hairlines.
   Light by default, dark on demand. Motion follows "Designing Fluid Interfaces". */

:root {
    color-scheme: light;
    --bg: #fbfaf6;
    --bg-2: #f2f0e8;
    --ink: #12110f;
    --ink-2: #3a3934;
    --muted: #6a685f;
    --faint: #9b988d;
    --line: rgba(18, 17, 15, 0.12);
    --line-strong: rgba(18, 17, 15, 0.3);
    --tint: rgba(255, 90, 31, 0.07);
    --accent: #ff5a1f;
    --accent-ink: #c2410c;
    --on-accent: #12110f;
    --selection: #ffd7c4;
    --shadow: 0 1px 0 rgba(18, 17, 15, 0.04), 0 30px 70px -34px rgba(18, 17, 15, 0.35);
    --serif: 'Instrument Serif', 'Iowan Old Style', 'Times New Roman', serif;
    --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --gutter: clamp(1.125rem, 4.5vw, 2.25rem);
    --shell: 80rem;
    --rail-w: 13.5rem;
    --bar-h: 3.75rem;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --fs-name: clamp(3.6rem, 1rem + 11vw, 9.5rem);
    --fs-h2: clamp(2.25rem, 1.4rem + 3.4vw, 4.25rem);
    --fs-h3: clamp(1.4rem, 1.2rem + 0.7vw, 1.85rem);
    --fs-lead: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
}

:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #0e0e0c;
    --bg-2: #171714;
    --ink: #f1eee6;
    --ink-2: #cfcbc0;
    --muted: #9a968b;
    --faint: #6a675e;
    --line: rgba(241, 238, 230, 0.12);
    --line-strong: rgba(241, 238, 230, 0.3);
    --tint: rgba(255, 122, 61, 0.09);
    --accent: #ff7a3d;
    --accent-ink: #ff9461;
    --on-accent: #12110f;
    --selection: #6a3115;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 30px 70px -30px rgba(0, 0, 0, 0.85);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--bar-h) + 1.5rem);
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.65 var(--sans);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, fill 0.45s ease, stroke 0.45s ease !important;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--selection); color: var(--ink); }
a, button, [role='button'], [role='switch'] { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0.25rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    background: var(--ink);
    color: var(--bg);
    font: 500 0.85rem/1 var(--sans);
    transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ───────── Type primitives ───────── */

.mono {
    font: 500 0.78rem/1.4 var(--mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.serif { font-family: var(--serif); font-weight: 400; }
h2, .h2 { font: 400 var(--fs-h2)/1 var(--serif); letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
h3, .h3 { font: 400 var(--fs-h3)/1.1 var(--serif); letter-spacing: -0.02em; color: var(--ink); }
em { font-style: italic; }
h1 em, h2 em, h3 em, .hero-sub em { color: var(--accent-ink); }
.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ───────── Atoms ───────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 2.9rem;
    padding: 0.7rem 1.3rem;
    border: 1px solid var(--ink);
    border-radius: 0.55rem;
    background: transparent;
    color: var(--ink);
    font: 500 0.88rem/1 var(--sans);
    letter-spacing: 0.005em;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.16s var(--ease-out), background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn:active { transform: scale(0.97); transition-duration: 0.06s; }
.btn-sm { min-height: 2.3rem; padding: 0.5rem 0.95rem; font-size: 0.8rem; }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.55rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.35rem;
    color: var(--ink-2);
    font: 500 0.74rem/1.2 var(--mono);
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.tag-accent { border-color: var(--accent); color: var(--accent-ink); background: var(--tint); }

.dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0.22rem var(--tint); }
.dot-quiet { background: var(--faint); box-shadow: none; }

.live { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--accent-ink); font: 500 0.76rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid var(--line-strong);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink);
    transition: border-color 0.25s ease, gap 0.4s var(--ease-out), color 0.25s ease;
}
.link-arrow:hover { border-color: var(--accent); color: var(--accent-ink); gap: 0.8rem; }
.link-arrow i { font-size: 0.72rem; }
.text-link { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: color 0.2s ease; }
.text-link:hover { color: var(--accent-ink); }

/* ───────── Top bar ───────── */

.bar { position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--bar-h); view-transition-name: bar; }
.bar::before {
    content: '';
    position: absolute;
    inset: 0 0 -1rem;
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1rem), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 1rem), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.bar.scrolled::before { opacity: 1; }

.bar-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--shell);
    height: 100%;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.mark { display: inline-flex; align-items: center; gap: 0.7rem; min-width: 0; font: 400 1.35rem/1 var(--serif); letter-spacing: -0.015em; color: var(--ink); }
.mark .sq { flex: none; width: 0.6rem; height: 0.6rem; background: var(--accent); transition: transform 0.6s var(--ease-out); }
.mark:hover .sq { transform: rotate(90deg); }
.mark-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark-short { display: none; }

.bar-actions { display: flex; align-items: center; gap: 0.5rem; }
.bar-actions .bar-wide, .bar-actions .bar-mid { display: none; }

.lang {
    position: relative;
    display: inline-flex;
    padding: 0.18rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font: 500 0.76rem/1 var(--mono);
    letter-spacing: 0.08em;
}
.lang button {
    position: relative;
    z-index: 1;
    min-width: 2.2rem;
    padding: 0.5rem 0.55rem;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    letter-spacing: inherit;
    transition: color 0.25s ease;
    touch-action: manipulation;
}
.lang button[aria-pressed='true'] { color: var(--bg); }
.lang-thumb {
    position: absolute;
    top: 0.18rem;
    bottom: 0.18rem;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: var(--ink);
    will-change: transform, width;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    justify-content: center;
    align-items: center;
    width: 2.45rem;
    height: 2.45rem;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    font: 500 0.74rem/1 var(--mono);
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.16s var(--ease-out);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn:active { transform: scale(0.93); transition-duration: 0.06s; }

.theme-btn svg { grid-area: 1 / 1; width: 1.05rem; height: 1.05rem; transition: transform 0.7s var(--ease-out), opacity 0.35s ease; }
.theme-btn .moon { opacity: 0; transform: rotate(-70deg) scale(0.6); }
:root[data-theme='dark'] .theme-btn .sun { opacity: 0; transform: rotate(70deg) scale(0.6); }
:root[data-theme='dark'] .theme-btn .moon { opacity: 1; transform: none; }

.index-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.45rem;
    padding: 0 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    font: 500 0.76rem/1 var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.25s ease, transform 0.16s var(--ease-out);
}
.index-btn:hover { border-color: var(--ink); }
.index-btn:active { transform: scale(0.96); transition-duration: 0.06s; }
.index-btn i { font-size: 0.55rem; transition: transform 0.45s var(--ease-out); }
.index-btn[aria-expanded='true'] i { transform: rotate(180deg); }

/* ───────── Index menu (small screens) ───────── */

.menu {
    position: fixed;
    top: calc(var(--bar-h) - 0.25rem);
    right: var(--gutter);
    z-index: 70;
    width: min(21rem, calc(100vw - 2 * var(--gutter)));
    max-height: calc(100dvh - var(--bar-h) - 1rem);
    overflow-y: auto;
    padding: 1.25rem 1rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(26px) saturate(160%);
    backdrop-filter: blur(26px) saturate(160%);
    box-shadow: var(--shadow);
    transform-origin: top right;
    visibility: hidden;
    opacity: 0;
    transform: scale(0.94) translateY(-0.4rem);
    filter: blur(8px);
    transition: opacity 0.26s ease, transform 0.45s var(--ease-out), filter 0.3s ease, visibility 0s linear 0.45s;
}
.menu.open { visibility: visible; opacity: 1; transform: none; filter: none; transition-delay: 0s; }
.menu-foot { display: grid; gap: 0.6rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.menu-foot .btn { width: 100%; }

/* ───────── Shell: rail + main ───────── */

.shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 clamp(2rem, 4vw, 4rem); max-width: var(--shell); margin-inline: auto; padding-inline: var(--gutter); }
.rail { display: none; }

@media (min-width: 68rem) {
    .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); align-items: start; }
    .rail {
        display: block;
        position: sticky;
        top: calc(var(--bar-h) + 2.25rem);
        max-height: calc(100dvh - var(--bar-h) - 3.5rem);
        overflow-y: auto;
        padding-bottom: 1rem;
        scrollbar-width: thin;
    }
    .menu, .index-btn { display: none; }
    .bar-actions .bar-wide { display: inline-flex; }
}

@media (min-width: 48rem) { .bar-actions .bar-mid { display: inline-flex; } }

/* ───────── Tree ───────── */

.tree { font: 400 0.84rem/1.2 var(--mono); }
.tree-root { margin-bottom: 0.9rem; color: var(--faint); letter-spacing: 0.02em; }
.tree-root b { color: var(--ink); font-weight: 500; }
.tree ul { list-style: none; }
.tree li { position: relative; }
.tree .trow { display: flex; align-items: center; min-height: 1.95rem; }
.tree .caret, .tree .spacer { flex: none; width: 1.1rem; height: 1.1rem; }
.tree .caret {
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s ease;
}
.tree .caret:hover { color: var(--ink); }
.tree .caret svg { width: 0.5rem; height: 0.5rem; transition: transform 0.45s var(--ease-out); }
.tree .caret[aria-expanded='true'] svg { transform: rotate(90deg); }
.tree a {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.38rem 0.5rem;
    border-radius: 0.35rem;
    color: var(--muted);
    transition: color 0.2s ease, background-color 0.2s ease;
}
.tree a::before {
    content: '';
    flex: none;
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 1px;
    background: var(--accent);
    transform: scale(0);
    transition: transform 0.45s var(--ease-out);
}
.tree a:hover { color: var(--ink); background: var(--tint); }
.tree a:active { transform: scale(0.98); }
.tree a[aria-current] { color: var(--ink); }
.tree a[aria-current]::before { transform: none; }
.tree .children { margin-left: 0.55rem; padding-left: 0.85rem; border-left: 1px solid var(--line); overflow: hidden; }
.js .tree .children { height: 0; visibility: hidden; }
.tree .children li::before { content: ''; position: absolute; left: -0.85rem; top: 0.97rem; width: 0.55rem; border-top: 1px solid var(--line); }

/* ───────── Main column ───────── */

main { min-width: 0; }

.hero { position: relative; padding: calc(var(--bar-h) + clamp(2rem, 6vw, 5rem)) 0 clamp(3.5rem, 8vw, 6.5rem); }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; margin-bottom: clamp(2rem, 6vw, 4.5rem); color: var(--muted); }
.status-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.8rem 0.45rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink);
    transition: border-color 0.25s ease, transform 0.16s var(--ease-out), background-color 0.25s ease;
}
.status-link:hover { border-color: var(--accent); background: var(--tint); }
.status-link:active { transform: scale(0.97); transition-duration: 0.06s; }
.status-link i { font-size: 0.6rem; color: var(--muted); }

.hero-name { font: 400 var(--fs-name)/0.9 var(--serif); letter-spacing: -0.04em; color: var(--ink); }
.hero-name .line { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.hero-name .line:nth-child(2) { padding-left: 0.55em; }
.hero-name .line > span { display: block; }
.hero-sub { max-width: 30ch; margin-top: clamp(1.5rem, 4vw, 2.5rem); font: 400 clamp(1.55rem, 1rem + 2.2vw, 2.7rem)/1.12 var(--serif); letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.hero-lead { max-width: 36rem; margin-top: 1.75rem; font-size: var(--fs-lead); line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.hero-lead strong { color: var(--ink); font-weight: 500; }
.open-to { display: inline-flex; align-items: center; gap: 0.7rem; margin-top: 1.9rem; padding: 0.6rem 1rem; border: 1px solid var(--accent); border-radius: 0.55rem; background: var(--tint); color: var(--ink); font-size: 0.95rem; font-weight: 500; line-height: 1.4; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2.25rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 2.25rem; color: var(--muted); }
.hero-links a { transition: color 0.2s ease; }
.hero-links a:hover { color: var(--accent-ink); }

@keyframes rise { from { transform: translateY(108%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hero-name .line > span { animation: rise 1.15s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 110ms + 100ms); }
[data-enter] { animation: fade-up 0.9s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 90ms + 350ms); }

/* Reveals */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.8s var(--ease-out), transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 60ms); }
.js .reveal.in { opacity: 1; transform: none; }
.rule { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line-strong); transform-origin: left; }
.js .rule { transform: scaleX(0); transition: transform 1.3s var(--ease-out); }
.js .rule.in { transform: none; }

/* Folder sections */
.folder { position: relative; padding-block: clamp(3.5rem, 8vw, 6rem); scroll-margin-top: calc(var(--bar-h) + 1rem); }
.folder-head { display: grid; gap: 1rem; margin-bottom: clamp(1.75rem, 4vw, 3rem); }
.folder-tag { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); }
.folder-tag b { color: var(--accent-ink); font-weight: 500; }
.folder-head h2 { max-width: 16ch; }
.folder-head .lead { max-width: 36rem; margin-top: 0; }

/* About */
.about { display: grid; gap: clamp(2rem, 5vw, 3.5rem); }
.about-copy { display: grid; gap: 1.1rem; max-width: 38rem; color: var(--ink-2); font-size: 1.08rem; text-wrap: pretty; }
.about-copy strong { color: var(--ink); font-weight: 500; }
.portrait { max-width: 17rem; }
.portrait .frame { aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 0.35rem; background: var(--bg-2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; filter: grayscale(1) contrast(1.02); transition: filter 0.8s ease, transform 1.2s var(--ease-out); }
.portrait:hover img { filter: none; transform: scale(1.03); }
.portrait figcaption { margin-top: 0.7rem; color: var(--faint); }
.facts-strip { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.facts-strip div { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.facts-strip div:nth-child(odd) { padding-right: 1rem; }
.facts-strip dt { margin-bottom: 0.4rem; color: var(--faint); }
.facts-strip dd { font: 400 1.35rem/1.15 var(--serif); letter-spacing: -0.01em; }
.facts-strip.big dd { font-size: clamp(2.4rem, 1.6rem + 3vw, 3.8rem); line-height: 1; letter-spacing: -0.03em; }
.facts-strip.big dt { order: 2; margin: 0.6rem 0 0; }
.facts-strip.big div { display: flex; flex-direction: column; }
.facts-strip dd small { display: block; margin-top: 0.35rem; color: var(--faint); font: 500 0.72rem/1.3 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
@media (min-width: 48rem) {
    .about { grid-template-columns: 1fr 17rem; align-items: start; }
    .about .portrait { grid-column: 2; grid-row: 1 / span 2; }
    .facts-strip { grid-template-columns: repeat(4, 1fr); grid-column: 1 / -1; }
    .facts-strip div { padding-right: 1rem; }
}

/* Rows (experience, hobbies, lists) */
.rows { border-bottom: 1px solid var(--line); }
.row { display: grid; gap: 0.7rem 2rem; padding: 1.6rem 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 1rem); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; color: var(--muted); align-content: start; }
.row-meta .date { color: var(--ink); }
.row-main { transition: transform 0.7s var(--ease-out); }
.row h3 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2.15rem); }
.row .org { margin-top: 0.4rem; color: var(--ink-2); font-size: 0.98rem; }
.row .desc { max-width: 40rem; margin-top: 0.8rem; color: var(--muted); text-wrap: pretty; }
.row .desc strong { color: var(--ink); font-weight: 500; }
.row .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.2rem; }
@media (min-width: 48rem) { .row { grid-template-columns: 11rem minmax(0, 1fr); } }
@media (hover: hover) and (pointer: fine) {
    .row:hover .row-main { transform: translateX(6px); }
}
.row.featured { background: linear-gradient(90deg, var(--tint), transparent 70%); }
.row-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--accent);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--accent-ink);
    font: 500 0.76rem/1 var(--mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.16s var(--ease-out);
}
.row-btn:hover { background: var(--tint); }
.row-btn:active { transform: scale(0.96); transition-duration: 0.06s; }
.row-btn i { font-size: 0.6rem; }

/* Directory (skills summary) */
.dir { border-bottom: 1px solid var(--line); }
.dir-row { display: grid; gap: 0.7rem 2rem; padding: 1.35rem 0; border-top: 1px solid var(--line); }
.dir-name { font: 500 0.85rem/1.3 var(--mono); color: var(--ink); }
.dir-name span { color: var(--faint); }
.dir-body { display: grid; gap: 0.9rem; }
.dir-body p { max-width: 38rem; color: var(--muted); font-size: 0.95rem; text-wrap: pretty; }
@media (min-width: 48rem) { .dir-row { grid-template-columns: 13rem minmax(0, 1fr); } }
.dir-more { margin-top: 1.75rem; }

/* Cells (certifications) */
.cells { display: grid; border: 1px solid var(--line-strong); border-radius: 0.6rem; overflow: hidden; }
.cell { display: grid; align-content: start; gap: 0.6rem; padding: 1.5rem; border-top: 1px solid var(--line); }
.cell:first-child { border-top: 0; }
.cell h3 { font-size: 1.7rem; }
.cell .pos { color: var(--ink-2); font-weight: 500; font-size: 0.95rem; }
.cell .desc { color: var(--muted); font-size: 0.88rem; text-wrap: pretty; }
@media (min-width: 56rem) {
    .cells { grid-template-columns: repeat(3, 1fr); }
    .cell { border-top: 0; border-left: 1px solid var(--line); }
    .cell:first-child { border-left: 0; }
}

/* Projects */
.projects { border-bottom: 1px solid var(--line); }
.proj { display: grid; gap: 1rem 2rem; padding: 2rem 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 1rem); }
.proj-num { color: var(--faint); }
.proj-main h3 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem); line-height: 1; }
.proj-main p { max-width: 36rem; margin-top: 0.9rem; color: var(--muted); text-wrap: pretty; }
.proj-main .link-arrow { margin-top: 1.4rem; }
.proj-side { display: grid; align-content: start; gap: 0.9rem; }
.proj-side .kicker { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--muted); }
.proj-side .label { color: var(--faint); margin-bottom: -0.3rem; }
@media (min-width: 48rem) { .proj { grid-template-columns: 4.5rem minmax(0, 1fr) 14rem; } }
.proj-title { transition: transform 0.7s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .proj:hover .proj-title { transform: translateX(6px); } }

/* Life */
.life .row h3 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem); }
.life .row .desc { margin-top: 0; }
.life .row .tags { margin-top: 0.9rem; }

/* Contact */
.contact { padding-block: clamp(4.5rem, 10vw, 8rem); }
.contact h2 { max-width: 14ch; font-size: clamp(2.6rem, 1.4rem + 5vw, 5.5rem); line-height: 0.98; }
.contact .loc { display: flex; align-items: center; gap: 0.6rem; margin: 1.75rem 0 2rem; color: var(--muted); }
.contact .hero-cta { margin-top: 0; }

.footer { padding: 2rem var(--gutter) 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font: 500 0.76rem/1.9 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; max-width: var(--shell); margin-inline: auto; }
.footer a { border-bottom: 1px solid var(--line-strong); transition: color 0.2s ease, border-color 0.2s ease; }
.footer a:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ───────── Sub pages ───────── */

.page-head { padding: calc(var(--bar-h) + clamp(2rem, 6vw, 4.5rem)) 0 clamp(2.5rem, 6vw, 4.5rem); }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-bottom: 2rem; color: var(--muted); }
.crumb a { color: var(--ink); border-bottom: 1px solid var(--line-strong); transition: color 0.2s ease, border-color 0.2s ease; }
.crumb a:hover { color: var(--accent-ink); border-color: var(--accent); }
.page-title { font: 400 clamp(3rem, 1.2rem + 7vw, 7rem)/0.92 var(--serif); letter-spacing: -0.04em; color: var(--ink); text-wrap: balance; }
.page-head .lead { max-width: 38rem; margin-top: 1.75rem; }
.jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; }
.jump a { padding: 0.45rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); font: 500 0.76rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.16s var(--ease-out); }
.jump a:hover { border-color: var(--accent); background: var(--tint); }
.jump a:active { transform: scale(0.96); transition-duration: 0.06s; }

/* Skills page table */
.skill-section { position: relative; padding-block: clamp(2.5rem, 6vw, 4.5rem); scroll-margin-top: calc(var(--bar-h) + 1rem); }
.skill-list { border-bottom: 1px solid var(--line); }
.srow { display: grid; gap: 0.35rem 1.5rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.srow h3 { font-size: 1.55rem; }
.srow .stype, .srow .sctx { color: var(--muted); }
.srow .sctx { color: var(--accent-ink); }
.srow .sdesc { color: var(--muted); font-size: 0.93rem; text-wrap: pretty; }
@media (min-width: 56rem) {
    .srow { grid-template-columns: 12rem 7.5rem 9.5rem minmax(0, 1fr); align-items: baseline; }
    .srow .stype, .srow .sctx { align-self: baseline; }
}

/* Org block (projects / intuitem pages) */
.org-block { display: grid; gap: 1rem 2rem; padding: 2rem 0; border-block: 1px solid var(--line-strong); }
.org-block h2 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.8rem); }
.org-block p { max-width: 40rem; color: var(--ink-2); text-wrap: pretty; }
.org-block .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.2rem; color: var(--muted); }
@media (min-width: 48rem) { .org-block { grid-template-columns: 11rem minmax(0, 1fr); } }

.acad { display: grid; gap: 0.6rem 2rem; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.acad h3 { font-size: 1.7rem; }
.acad .sub { color: var(--accent-ink); }
.acad p { max-width: 42rem; color: var(--muted); font-size: 0.95rem; text-wrap: pretty; }
.acad .link-arrow { margin-top: 0.4rem; justify-self: start; }
@media (min-width: 48rem) { .acad { grid-template-columns: 11rem minmax(0, 1fr); } }
.acad-list { border-bottom: 1px solid var(--line); }

/* Now page */
.now-block { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.now-block .status { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.25rem; color: var(--muted); }
.now-item { display: grid; gap: 0.5rem 2rem; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.now-item h3 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2.1rem); }
.now-item p { max-width: 40rem; color: var(--muted); text-wrap: pretty; }
.now-list { border-bottom: 1px solid var(--line); }
@media (min-width: 48rem) { .now-item { grid-template-columns: 11rem minmax(0, 1fr); } }
.now-links { display: grid; gap: 1rem; margin-top: 2rem; }
.now-link { display: grid; gap: 0.5rem; padding: 1.4rem; border: 1px solid var(--line-strong); border-radius: 0.6rem; transition: border-color 0.25s ease, transform 0.6s var(--ease-out), background-color 0.25s ease; }
.now-link:hover { border-color: var(--accent); background: var(--tint); }
.now-link:active { transform: scale(0.985); transition-duration: 0.08s; }
.now-link h3 { font-size: 1.5rem; }
.now-link p { color: var(--muted); font-size: 0.9rem; }
.now-link i { color: var(--accent-ink); }
@media (min-width: 40rem) { .now-links { grid-template-columns: repeat(2, 1fr); } }

/* ───────── Research sheet ───────── */

.scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: color-mix(in srgb, var(--ink) 34%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
}
.scrim.open { pointer-events: auto; }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -6rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    width: min(44rem, 100%);
    max-height: min(calc(90dvh + 6rem), 54rem);
    margin-inline: auto;
    padding-bottom: 6rem;
    border: 1px solid var(--line-strong);
    border-bottom: 0;
    border-radius: 1.25rem 1.25rem 0 0;
    background: var(--bg);
    box-shadow: var(--shadow);
    transform: translate3d(0, 110%, 0);
    visibility: hidden;
    will-change: transform;
}
.sheet.visible { visibility: visible; }

.sheet-head { position: relative; flex: none; padding: 0.7rem 4.5rem 1.2rem 1.75rem; border-bottom: 1px solid var(--line); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.sheet-head.dragging { cursor: grabbing; }
.grabber { width: 2.5rem; height: 0.28rem; margin: 0 auto 1.2rem; border-radius: 999px; background: var(--line-strong); }
.sheet-head .path { margin-bottom: 0.7rem; color: var(--accent-ink); }
.sheet-head h2 { font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.5rem); }
.sheet-close { position: absolute; top: 1.35rem; right: 1.25rem; }
.sheet-body { flex: 1; min-height: 0; padding: 1.5rem 1.75rem 2rem; overflow-y: auto; overscroll-behavior: contain; }
.sheet-body .sub { font: 400 1.35rem/1.25 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.sheet-body .brief { margin-top: 1rem; color: var(--muted); text-wrap: pretty; }
.sheet-body .tags { margin-top: 1.5rem; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); margin-top: 1.75rem; border-top: 1px solid var(--line); }
.facts div { padding: 0.9rem 1rem 0.9rem 0; border-bottom: 1px solid var(--line); }
.facts dt { margin-bottom: 0.4rem; color: var(--faint); font: 500 0.74rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.facts dd { font-size: 0.95rem; line-height: 1.4; }

.flow { margin-top: 1.75rem; border-top: 1px solid var(--line); counter-reset: step; }
.flow-step { display: flex; align-items: baseline; gap: 1.1rem; padding: 0.95rem 0; border-bottom: 1px solid var(--line); counter-increment: step; }
.flow-step::before { content: counter(step, decimal-leading-zero); flex: none; color: var(--accent-ink); font: 500 0.78rem/1 var(--mono); letter-spacing: 0.06em; }
.flow-step strong { display: block; font: 400 1.25rem/1.15 var(--serif); letter-spacing: -0.01em; }
.flow-step span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.85rem; }

/* ───────── Transitions & preferences ───────── */

@view-transition { navigation: auto; }
::view-transition-group(bar) { animation: none; }
html.fr-pending body { visibility: hidden; animation: unhide 0s linear 1.2s forwards; }
@keyframes unhide { to { visibility: visible; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    [data-enter], .hero-name .line > span { animation: none; }
    .js .reveal { transform: none; transition: opacity 0.5s ease; transition-delay: 0s; }
    .js .rule { transform: none; transition: opacity 0.5s ease; opacity: 0; }
    .js .rule.in { opacity: 1; }
    .row:hover .row-main, .proj:hover .proj-title { transform: none; }
    .btn:active, .icon-btn:active, .row-btn:active, .status-link:active, .index-btn:active, .jump a:active, .now-link:active { transform: none; opacity: 0.8; }
    .menu { transform: none; filter: none; transition: opacity 0.2s ease, visibility 0s linear 0.2s; }
    .menu.open { transition-delay: 0s; }
    .sheet { transform: none !important; opacity: 0; transition: opacity 0.22s ease, visibility 0s linear 0.22s; }
    .sheet.visible.open { opacity: 1; transition-delay: 0s; }
    .scrim { transition: opacity 0.22s ease; }
    .portrait:hover img { transform: none; }
    @view-transition { navigation: none; }
}

@media (prefers-reduced-transparency: reduce) {
    .bar::before, .menu, .scrim { -webkit-backdrop-filter: none; backdrop-filter: none; }
    .bar::before { background: var(--bg); opacity: 1; }
    .menu { background: var(--bg); }
    .scrim { background: color-mix(in srgb, var(--ink) 55%, transparent); }
}

@media (prefers-contrast: more) {
    :root { --line: rgba(18, 17, 15, 0.4); --line-strong: rgba(18, 17, 15, 0.7); --muted: #4a4841; --faint: #5d5a52; }
    :root[data-theme='dark'] { --line: rgba(241, 238, 230, 0.4); --line-strong: rgba(241, 238, 230, 0.7); --muted: #cbc7bb; --faint: #a8a498; }
}

@media (max-width: 40rem) {
    .sheet { border-radius: 1rem 1rem 0 0; }
    .sheet-head { padding-inline: 1.25rem 4rem; }
    .sheet-body { padding-inline: 1.25rem; }
    .facts { grid-template-columns: 1fr; }
}

@media (max-width: 30rem) { .mark-name { display: none; } .mark-short { display: inline; } }
