@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=DM+Sans:wght@400;500;600&display=swap");

:root {
    --chalkboard: #183f3a;
    --chalkboard-deep: #10332f;
    --chalk: #f5f0df;
    --chalk-muted: #bdcfc5;
    --sun: #f3cf62;
    --coral: #ee9b87;
    --ink: #102d2a;
    --paper: #f4efdf;
    --line: rgba(245, 240, 223, 0.23);
    --shadow: 0 28px 80px rgba(4, 24, 21, 0.32);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--chalkboard-deep);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--chalk);
    font-family: "DM Sans", Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.05), transparent 22%),
        radial-gradient(circle at 82% 6%, rgba(243, 207, 98, 0.08), transparent 19%),
        linear-gradient(120deg, var(--chalkboard-deep), var(--chalkboard));
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.portfolio-shell {
    display: grid;
    grid-template-columns: minmax(310px, 30%) minmax(0, 70%);
    min-height: 100vh;
}

.profile-panel,
.document-panel {
    position: relative;
}

.profile-panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: clamp(28px, 3.2vw, 58px);
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        var(--chalkboard);
    background-size: 44px 44px;
    border-right: 1px solid var(--line);
}

.profile-panel::after {
    position: absolute;
    right: -28px;
    bottom: 11%;
    width: 105px;
    height: 105px;
    border: 3px solid rgba(245, 240, 223, 0.08);
    border-radius: 50%;
    content: "";
}

.portrait-frame {
    position: relative;
    width: min(100%, 310px);
    margin-bottom: 28px;
    padding: 9px;
    transform: rotate(-1.2deg);
    background: var(--paper);
    box-shadow: 9px 12px 0 rgba(5, 24, 21, 0.24);
}

.portrait-frame img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center 45%;
    filter: saturate(0.86) contrast(1.04);
    opacity: 1;
    transition: opacity 240ms ease;
}

.portrait-frame img.is-changing {
    opacity: 0;
}

.chalk-corner {
    position: absolute;
    width: 37px;
    height: 37px;
    border-color: var(--sun);
    border-style: solid;
    pointer-events: none;
}

.chalk-corner--top {
    top: -10px;
    left: -10px;
    border-width: 3px 0 0 3px;
}

.chalk-corner--bottom {
    right: -10px;
    bottom: -10px;
    border-width: 0 3px 3px 0;
}

.eyebrow,
.section-label {
    margin: 0 0 8px;
    color: var(--sun);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.profile h1 {
    margin: 0;
    max-width: 390px;
    font-family: "Caveat", "Segoe Print", cursive;
    font-size: clamp(3.3rem, 5vw, 5.4rem);
    font-weight: 600;
    line-height: 0.9;
}

.profile h1 span {
    position: relative;
    color: var(--sun);
    white-space: nowrap;
}

.profile h1 span::after {
    position: absolute;
    right: -2px;
    bottom: -5px;
    left: -3px;
    height: 7px;
    border-top: 2px solid var(--coral);
    border-radius: 50%;
    content: "";
    transform: rotate(-2deg);
}

.profile-copy {
    max-width: 390px;
    margin: 22px 0 42px;
    color: var(--chalk-muted);
    font-size: 0.93rem;
    line-height: 1.7;
}

.work-list {
    display: grid;
    gap: 14px;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}

.section-heading span {
    color: var(--chalk-muted);
    font-size: 0.66rem;
}

.section-heading .section-label {
    margin-bottom: 0;
    color: var(--chalk-muted);
}

.work-item {
    position: relative;
    width: 100%;
    color: var(--chalk);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
    transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.work-item:hover,
.work-item:focus-within {
    color: var(--sun);
    background: rgba(255, 255, 255, 0.035);
    transform: translateX(4px);
}

.work-item.is-active {
    color: var(--ink);
    background: var(--sun);
    border-color: var(--sun);
    box-shadow: 5px 5px 0 rgba(6, 28, 25, 0.25);
    transform: rotate(-0.4deg);
}

.paper-preview {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    padding: 16px 14px 12px;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.paper-preview:focus-visible,
.paper-link:focus-visible,
.cite-button:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

.work-number {
    color: currentColor;
    font-family: "Caveat", "Segoe Print", cursive;
    font-size: 1.42rem;
    line-height: 1;
}

.paper-content,
.paper-content strong,
.paper-authors,
.paper-venue {
    display: block;
}

.paper-content strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.42;
    white-space: normal;
}

.paper-authors {
    margin-top: 8px;
    font-size: 0.77rem;
    line-height: 1.45;
    opacity: 0.9;
}

.paper-venue {
    margin-top: 3px;
    color: currentColor;
    font-size: 0.77rem;
    opacity: 0.7;
}

.paper-actions {
    display: flex;
    gap: 8px;
    margin: 0 14px 14px 56px;
    padding-top: 11px;
    border-top: 1px solid currentColor;
    border-top-color: rgba(245, 240, 223, 0.18);
}

.is-active .paper-actions {
    border-top-color: rgba(16, 45, 42, 0.18);
}

.paper-link,
.cite-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 11px;
    color: inherit;
    font: inherit;
    font-size: 0.77rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 2px;
    cursor: pointer;
}

.paper-link {
    gap: 7px;
}

.paper-link:hover,
.cite-button:hover {
    color: var(--ink);
    background: var(--chalk);
}

.is-active .paper-link:hover,
.is-active .cite-button:hover {
    color: var(--chalk);
    background: var(--chalkboard);
}

.profile-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 34px;
    color: var(--chalk-muted);
    font-size: 0.85rem;
}

.profile-footer a {
    color: inherit;
    text-decoration-color: var(--coral);
    text-underline-offset: 4px;
}

.document-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    padding: clamp(26px, 3.3vw, 58px);
    background:
        radial-gradient(rgba(16, 45, 42, 0.075) 0.8px, transparent 0.8px),
        var(--paper);
    background-size: 8px 8px;
    color: var(--ink);
}

.document-header {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    align-items: flex-end;
    margin-bottom: 25px;
}

.document-header .eyebrow {
    color: #8b5d2d;
}

.eyebrow a {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-decoration: none;
}

.eyebrow a:hover {
    text-decoration: underline;
}

.document-header h2 {
    margin: 0;
    overflow-wrap: anywhere;
    font-family: "Caveat", "Segoe Print", cursive;
    font-size: clamp(2.4rem, 4vw, 4.2rem);
    font-weight: 700;
    line-height: 0.95;
}

.open-document {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    flex: 0 0 auto;
    padding: 11px 16px;
    color: var(--chalk);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--chalkboard);
    border-radius: 2px;
    box-shadow: 4px 4px 0 rgba(16, 45, 42, 0.15);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.open-document:hover,
.open-document:focus-visible {
    box-shadow: 2px 2px 0 rgba(16, 45, 42, 0.15);
    outline: 2px solid var(--coral);
    outline-offset: 3px;
    transform: translate(2px, 2px);
}

.viewer-wrap {
    position: relative;
    flex: 1;
    min-height: 600px;
    padding: 12px;
    background: #fffdf7;
    border: 1px solid rgba(16, 45, 42, 0.14);
    box-shadow: var(--shadow);
}

.viewer-wrap iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 574px;
    background: #dad7cf;
    border: 0;
}

.tape {
    position: absolute;
    z-index: 2;
    top: -13px;
    width: 78px;
    height: 28px;
    background: rgba(238, 155, 135, 0.72);
    box-shadow: 0 1px 3px rgba(16, 45, 42, 0.1);
    pointer-events: none;
}

.tape--left {
    left: 10%;
    transform: rotate(-4deg);
}

.tape--right {
    right: 10%;
    transform: rotate(4deg);
}

.viewer-note {
    margin: 18px 0 0;
    color: rgba(16, 45, 42, 0.64);
    /*font-family: "Caveat", "Segoe Print", cursive;*/
    font-size: 1rem;
    text-align: center;
}

.copy-toast {
    position: fixed;
    z-index: 20;
    right: 34px;
    bottom: 34px;
    max-width: calc(100vw - 48px);
    padding: 42px 46px;
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--sun);
    border: 1px solid var(--ink);
    box-shadow: 5px 5px 0 rgba(4, 24, 21, 0.28);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.copy-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.copy-toast.is-error {
    background: var(--coral);
}

@media (max-width: 960px) {
    .portfolio-shell {
        grid-template-columns: minmax(280px, 35%) minmax(0, 65%);
    }

    .profile-panel {
        padding: 30px 24px;
    }

    .profile h1 {
        font-size: 3.5rem;
    }

    .profile-copy {
        margin-bottom: 28px;
    }

    .document-panel {
        padding: 32px 28px;
    }
}

@media (max-width: 760px) {
    .portfolio-shell {
        display: block;
    }

    .profile-panel,
    .document-panel {
        min-height: auto;
    }

    .profile-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .portrait-frame {
        width: min(100%, 420px);
    }

    .profile-copy {
        max-width: 540px;
    }

    .profile-footer {
        margin-top: 18px;
    }

    .document-panel {
        min-height: 800px;
    }
}

@media (max-width: 520px) {
    .profile-panel,
    .document-panel {
        padding: 24px 18px;
    }

    .profile-footer,
    .document-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .document-header {
        gap: 17px;
    }

    .viewer-wrap {
        min-height: 520px;
        padding: 7px;
    }

    .viewer-wrap iframe {
        min-height: 504px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .paper-actions {
        margin-left: 14px;
    }

    .copy-toast {
        right: 18px;
        bottom: 18px;
        max-width: calc(100vw - 36px);
    }
}

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