:root {
    --paper: #f4efe8;
    --ink: #342a25;
    --muted: #756761;
    --faint: #9b8c84;
    --line: #d8ccc2;
    --olive: #765f50;
    --chip: #e9ded2;
    --surface: #faf7f3;
    --sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    --accent-line: var(--accent-line);
    --selection: #e9d8ca;
    --shadow: rgba(52, 42, 37, 0.17);
    --backdrop: rgba(52, 42, 37, 0.20);
    --width: 1030px;
}

/* Dark theme: follows the system unless the visitor picked one (data-theme) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #1d1816;
        --ink: #efe6dc;
        --muted: #b3a59b;
        --faint: #8a7d74;
        --line: #3b312b;
        --olive: #d2b8a3;
        --chip: #342b25;
        --surface: #26201c;
        --accent-line: #8c7463;
        --selection: #5a4638;
        --shadow: rgba(0, 0, 0, 0.5);
        --backdrop: rgba(0, 0, 0, 0.6);
    }
}

:root[data-theme="dark"] {
    --paper: #1d1816;
    --ink: #efe6dc;
    --muted: #b3a59b;
    --faint: #8a7d74;
    --line: #3b312b;
    --olive: #d2b8a3;
    --chip: #342b25;
    --surface: #26201c;
    --accent-line: #8c7463;
    --selection: #5a4638;
    --shadow: rgba(0, 0, 0, 0.5);
    --backdrop: rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.48;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection); }
a { color: inherit; }

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--olive);
    outline-offset: 4px;
}

.site {
    width: min(var(--width), calc(100% - 3rem));
    margin: 0 auto;
}

.masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
    gap: 3rem;
    align-items: start;
    padding: clamp(4rem, 9vw, 6.5rem) 0 clamp(3.8rem, 8vw, 5.8rem);
}

.name-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-photo {
    width: 4.75rem;
    height: 4.75rem;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 50%;
    object-fit: cover;
    object-position: center 38%;
}

.name-block h1 {
    max-width: 10ch;
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 600;
    letter-spacing: -0.075em;
    line-height: 0.92;
}

.personal-info {
    padding-top: 0.3rem;
    color: var(--muted);
    font-size: 0.98rem;
}

.personal-info > p { margin: 0 0 0.52rem; }
.personal-info > p:nth-child(2) { color: var(--ink); font-weight: 600; }

.identity-line,
.contact-line {
    font-family: var(--mono);
    font-size: 0.67rem;
    line-height: 1.8;
}

.identity-line { margin-top: 1rem !important; }
.identity-line span { color: var(--olive); }

.contact-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.9rem !important;
}

.contact-line a,
.links-list a,
.plain-link {
    color: var(--ink);
    text-decoration-color: var(--accent-line);
    text-underline-offset: 0.22em;
}

.contact-line a:hover,
.links-list a:hover,
.plain-link:hover { text-decoration-color: var(--ink); }

.section {
    display: grid;
    grid-template-columns: 165px minmax(0, 1fr);
    gap: 2.6rem;
    padding: clamp(3.9rem, 7vw, 5.2rem) 0;
    border-top: 1px solid var(--line);
}

.section > h2 {
    margin: 0;
    color: var(--olive);
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.075em;
    line-height: 1.15;
    text-transform: uppercase;
}

.section-body { min-width: 0; }

.timeline {
    position: relative;
    border-left: 1px solid var(--line);
}

.timeline-entry {
    position: relative;
    display: grid;
    grid-template-columns: minmax(145px, 0.75fr) minmax(0, 1.25fr);
    gap: 1.6rem;
    padding: 0 0 2.35rem 1.55rem;
}

.timeline-entry:last-child { padding-bottom: 0; }

.timeline-entry::before {
    position: absolute;
    top: 0.12rem;
    left: -0.39rem;
    width: 0.7rem;
    height: 0.7rem;
    border: 1px solid var(--olive);
    border-radius: 50%;
    background: var(--paper);
    content: "";
}

.timeline-meta p,
.timeline-content p { margin: 0; }

.timeline-meta {
    color: var(--muted);
    font-size: 0.89rem;
    line-height: 1.6;
}

.timeline-meta p + p { color: var(--faint); }

.timeline-content { text-align: right; }

.timeline-content h3 {
    margin: -0.2rem 0 0.45rem;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.25;
}

.timeline-content p {
    color: var(--muted);
    font-size: 0.94rem;
}

.badges,
.project-trigger em {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.badges span,
.project-trigger i {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    background: var(--chip);
    color: var(--muted);
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 400;
    line-height: 1.2;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 6vw, 5.8rem);
    row-gap: 2.25rem;
}

.project-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.project-trigger strong {
    display: block;
    font-size: 1.16rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.25;
}

.project-trigger > span {
    display: block;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.94rem;
}

.project-trigger em {
    justify-content: flex-start;
}

.project-trigger:hover strong { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 0.18em; }

.simple-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.simple-list li {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1rem;
}

.simple-list span {
    color: var(--muted);
    font-size: 0.88rem;
}

.simple-list a {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 0.18em;
}

.simple-list small {
    color: var(--faint);
    font-family: var(--mono);
    font-size: 0.63rem;
    font-weight: 400;
    white-space: nowrap;
}

.links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.1rem;
}

.links-list a {
    font-family: var(--mono);
    font-size: 0.7rem;
}

.project-modal {
    width: min(520px, calc(100% - 2.4rem));
    margin: auto;
    padding: 1.7rem 1.8rem 1.55rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 22px 60px var(--shadow);
}

.project-modal::backdrop { background: var(--backdrop); }

.modal-close {
    float: right;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: 1.5rem/1 var(--sans);
}

.modal-kicker {
    margin: 0 0 0.55rem;
    color: var(--olive);
    font-family: var(--mono);
    font-size: 0.67rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.project-modal h2 {
    max-width: 21ch;
    margin: 0 0 0.9rem;
    font-size: clamp(1.55rem, 4vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1.05;
}

.project-modal p:not(.modal-kicker) {
    margin: 0 0 0.8rem;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.58;
}

.project-modal h3 {
    margin: 1rem 0 0.42rem;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.modal-list {
    margin: 0 0 0.8rem;
    padding-left: 1.15rem;
    color: var(--muted);
    font-size: 0.89rem;
    line-height: 1.5;
}

.modal-list li + li { margin-top: 0.34rem; }

.project-sample {
    margin: 1rem 0 0.95rem;
}

.project-sample img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    background: var(--paper);
}

.project-sample figcaption {
    margin-top: 0.42rem;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 0.62rem;
    line-height: 1.45;
}

.modal-link {
    display: inline-block;
    margin-top: 0.55rem;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 0.22em;
}

/* Playlist page */
.playlist-page {
    background: var(--paper);
    color: var(--ink);
}

.site-shell {
    width: min(var(--width), calc(100% - 3rem));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    border-bottom: 1px solid var(--line);
}

.wordmark {
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.07em;
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1rem;
}

.site-nav a {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    text-decoration: none;
}

.site-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.24em; }

.playlist-main {
    max-width: 700px;
    padding: clamp(4rem, 9vw, 6rem) 0;
}

.kicker {
    margin: 0 0 0.9rem;
    color: var(--olive);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.playlist-main h1 {
    margin: 0;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 600;
    letter-spacing: -0.075em;
    line-height: 0.9;
}

.playlist-intro {
    margin: 1.4rem 0 2.5rem;
    color: var(--muted);
}

.track-list {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.track {
    display: grid;
    grid-template-columns: 2.8rem 1fr auto;
    gap: 1rem;
    align-items: baseline;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.track-number,
.track a {
    color: var(--faint);
    font-family: var(--mono);
    font-size: 0.67rem;
}

.track-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.track-artist { color: var(--muted); font-size: 0.88rem; }
.track a { text-decoration: none; }
.track a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.22em; }

@media (max-width: 720px) {
    .site,
    .site-shell { width: min(100% - 2rem, var(--width)); }
    .masthead { grid-template-columns: 1fr; gap: 1.7rem; padding: 4.2rem 0; }
    .section { grid-template-columns: 1fr; gap: 1.6rem; padding: 3.7rem 0; }
    .timeline-entry { grid-template-columns: 1fr; gap: 0.55rem; padding-left: 1.3rem; }
    .timeline-content { text-align: left; }
    .badges { justify-content: flex-start; }
    .project-grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 480px) {
    .name-block { gap: 0.8rem; }
    .profile-photo { width: 4rem; height: 4rem; }
    .name-block h1 { font-size: clamp(2.25rem, 11vw, 3.1rem); }
    .identity-line { font-size: 0.61rem; }
    .simple-list li { grid-template-columns: 1fr; gap: 0.35rem; }
    .track { grid-template-columns: 2.2rem 1fr; }
    .track a { grid-column: 2; }
    .site-nav { gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Priority 1 polish: project cards advertise their details window */
.project-trigger {
    padding: 0.75rem;
    margin: -0.75rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.project-trigger:hover { background: var(--surface); }

.project-trigger::after {
    content: "détails →";
    display: block;
    margin-top: 0.75rem;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 0.72rem;
}

.copy-email {
    margin-left: 0.35rem;
    padding: 0 0.4rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    cursor: pointer;
}

.copy-email:hover { color: var(--ink); border-color: var(--olive); }

.modal-link-detail { margin-right: 1.25rem; color: var(--muted); }

/* Priority 2: sticky section navigation and theme toggle */
section[id] { scroll-margin-top: 3.5rem; }

.jump-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.jump-inner {
    width: min(var(--width), calc(100% - 3rem));
    height: 3rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.jump-brand {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
}

.jump-links {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 1.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    font-family: var(--mono);
    font-size: 0.68rem;
}

.jump-links::-webkit-scrollbar { display: none; }

.jump-links a {
    padding: 0.3rem 0;
    border-bottom: 1px solid transparent;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.jump-links a:hover { color: var(--ink); }

.jump-links a[aria-current="true"] {
    color: var(--ink);
    border-bottom-color: var(--olive);
}

.theme-toggle {
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    white-space: nowrap;
    cursor: pointer;
}

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

/* Priority 2: filter projects by skill */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.8rem;
}

.filter-bar button {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    cursor: pointer;
}

.filter-bar button:hover { color: var(--ink); border-color: var(--olive); }

.filter-bar button[aria-pressed="true"] {
    border-color: var(--olive);
    background: var(--chip);
    color: var(--ink);
}

[hidden] { display: none !important; }

/* Priority 2: previous / next inside a project window */
.modal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.4rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-family: var(--mono);
    font-size: 0.68rem;
}

.modal-nav button {
    padding: 0.2rem 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}

.modal-nav button:hover { text-decoration: underline; }

/* Priority 2: narrow screens */
@media (max-width: 720px) {
    .jump-inner { gap: 0.9rem; }
    .jump-brand { display: none; }
    .contact-line { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
    .contact-line > span:not(.contact-item) { display: none; }
    .contact-item { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
    .timeline-meta { display: flex; flex-wrap: wrap; column-gap: 0.6rem; }
    .timeline-meta p + p::before { content: "·"; margin-right: 0.6rem; color: var(--faint); }
}

/* Priority 3: soft reveal of sections as they scroll into view (only when JS runs) */
.js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .js .reveal,
    .js .reveal.is-visible { opacity: 1; transform: none; }
}

/* Priority 3: Kanagawa wave as a faint watermark in the masthead */
.masthead {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.masthead::before {
    content: "";
    position: absolute;
    top: 0;
    right: -2rem;
    z-index: -1;
    width: 17rem;
    height: 17rem;
    background: url("assets/kanagawa-wave.png") center / contain no-repeat;
    -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent 100%);
    mask-image: radial-gradient(closest-side, #000 40%, transparent 100%);
    filter: grayscale(1);
    opacity: 0.09;
    pointer-events: none;
}

@media (max-width: 720px) {
    .masthead::before { top: 0; right: -1rem; width: 10rem; height: 10rem; opacity: 0.07; }
}
