* {
    box-sizing: border-box;
}

/* Dark mode */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.theme-toggle img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

html.dark .theme-toggle img {
    filter: invert(1);
}

.theme-toggle {
    position: absolute;
}

.readable-toggle {
    top: 68px;
}

@media (max-width: 768px) {
    .theme-toggle {
        top: calc(64vw - 22px);
        right: auto;
        left: 4vw;
    }

    .readable-toggle {
        left: calc(4vw + 52px);
    }
}

.theme-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

html.dark body,
html.dark .content {
    background: #000;
    color: #fff;
}

html.dark .menu-svg,
html.dark .social-links img,
html.dark .mobile-section-label img,
html.dark .illustration-label,
html.dark .laptop-frame,
html.dark .mobile-phone-frame,
html.dark .laptop-controls img,
html.dark .visit-link img,
html.dark .site-switch-toggle img,
html.dark .pdf-heading-crop img,
html.dark .pdf-controls img,
html.dark .pdf-number img,
html.dark #canvas-container canvas {
    filter: invert(1);
}

:root {
    --sidebar-width: 320px;
    --content-padding: 40px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    background: #fff;
    color: #000;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    padding: 40px 20px;
}

.social-links {
    position: fixed;
    top: 50vh;
    left: 28px;
    z-index: 20;
    display: flex;
    gap: 7px;
}

.social-links a,
.social-links img {
    display: block;
    width: 48px;
    height: 48px;
}

.social-links img {
    object-fit: contain;
}

.social-icon--instagram {
    transform: scale(1.2);
}

.menu-svg {
    display: block;
    width: 100%;
    height: auto;
}

.desktop-only {
    width: 140%;
    margin-left: -35px;
}

.mobile-only {
    display: none;
}

.content {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    padding: 0 var(--content-padding) 40px;
    background: #fff;
}

#canvas-container {
    width: 100%;
    overflow: visible;
}

#canvas-container canvas {
    display: block;
}

section {
    width: 100%;
    min-height: 100vh;
    scroll-margin-top: 20px;
}

.content > section:not(:last-of-type) {
    margin-bottom: 200px;
}

.mobile-section-label {
    display: none;
}

section h2 {
    display: none;
}

/* Illustration gallery */
#illustration {
    width: 100%;
}

.illustration-gallery {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 32px);
    width: 100%;
    margin: 0;
    padding: 0;
}

.illustration-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.illustration-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(12px, 2vw, 32px);
    min-width: 0;
}

.illustration-stack > .illustration-card {
    width: 100%;
}

.illustration-label {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 460 / 160;
    object-fit: contain;
}

.illustration-image {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
}

/* Image overlay */
.image-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgb(0 0 0 / 85%);
}

.image-overlay.is-open {
    display: flex;
}

.overlay-image {
    display: block;
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transform-origin: center center;
    will-change: transform;
}

.overlay-description {
    position: absolute;
    top: 50%;
    left: 1vw;
    z-index: 1;
    display: none;
    width: min(44vw, 600px);
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    object-position: left center;
    pointer-events: none;
    transform: translateY(-50%);
    user-select: none;
}

.image-overlay.has-description .overlay-description {
    display: block;
}

.image-overlay.has-description .overlay-image {
    max-width: calc(100vw - min(44vw, 600px) - 4.5vw);
    margin-left: calc(min(44vw, 600px) + 2.5vw);
}

.image-overlay.has-description {
    justify-content: flex-start;
}

.overlay-image.is-dragging {
    cursor: grabbing;
}

.close-overlay {
    position: absolute;
    top: 15px;
    right: 25px;
    z-index: 3;
    border: 0;
    background: none;
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
}

.overlay-narrate-slot {
    position: absolute;
    top: 8vh;
    left: 15vw;
    z-index: 1;
    display: grid;
    place-items: center;
    width: min(11vw, 160px);
    aspect-ratio: 1;
}

.overlay-narrate {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 160ms ease;
}

.overlay-narrate[aria-pressed="true"] {
    opacity: 1;
}

.overlay-narrate img {
    display: block;
    width: 100%;
    height: 100%;
}

.overlay-narrate:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.overlay-audio {
    display: none;
}

/* Readable descriptions */
:root {
    --text-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html[data-lang="ja"] {
    --text-font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans JP", "Helvetica Neue", sans-serif;
}

html[data-lang="zh"] {
    --text-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", sans-serif;
}

html[data-lang="ar"] {
    --text-font: "Geeza Pro", "Segoe UI", "Noto Sans Arabic", Tahoma, "Helvetica Neue", sans-serif;
}

html[data-lang="ar"] .menu-text a,
html[data-lang="ar"] .readable-label,
html[data-lang="ar"] .overlay-description-text {
    direction: rtl;
}

.language-list {
    position: absolute;
    top: 120px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.language-list[hidden] {
    display: none;
}

.language-list button {
    display: block;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.language-list button[aria-pressed="true"] {
    text-decoration: underline;
}

.language-list button {
    height: auto;
}

.language-list img {
    display: block;
    width: 120px;
    height: auto;
    pointer-events: none;
}

.zoom-hint {
    position: absolute;
    z-index: 150;
    width: 64px;
    height: auto;
    transform: translate(-50%, -50%);
    display: none;
    pointer-events: none;
}

.zoom-hint.is-visible {
    display: block;
}

html.dark .zoom-hint {
    filter: invert(1);
}

html.dark .language-list img {
    filter: invert(1);
}

@media (max-width: 768px) {
    .language-list {
        top: calc(64vw + 36px);
        right: auto;
        left: 4vw;
        display: grid;
        grid-template-columns: repeat(3, 28vw);
        align-items: center;
        justify-items: center;
        gap: 8px 2vw;
    }

    .language-list img {
        width: 24vw;
    }
}

.menu-text {
    display: none;
}

html.readable .menu-svg {
    display: none;
}

html.readable .menu-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-top: 14px;
    font: 400 20px/1.2 var(--text-font);
}

.readable-label {
    display: none;
    font-family: var(--text-font);
}

html.readable img.has-readable {
    display: none;
}

html.readable .readable-label {
    display: block;
}

html.readable .illustration-card > .readable-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 460 / 160;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
}

html.readable .mobile-section-label .readable-label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
    opacity: 0.56;
}

@media (max-width: 768px) {
    html.readable .illustration-card > .readable-label {
        font-size: 20px;
    }
}

html.readable .pdf-heading-crop {
    aspect-ratio: auto;
    overflow: visible;
}

html.readable .pdf-heading-crop .readable-label {
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
}

html.readable .laptop-controls .readable-label {
    color: inherit;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
}

html.readable .visit-link,
html.readable .site-switch-toggle {
    color: inherit;
    text-decoration: none;
}

html.readable .pdf-number {
    font-size: 16px;
}

html.readable .pdf-number .readable-label {
    min-width: 0.6em;
    text-align: center;
}

.menu-text a {
    color: inherit;
    text-decoration: none;
}

.menu-text a:hover,
.menu-text a[aria-current] {
    text-decoration: underline;
    text-underline-offset: 5px;
}

@media (max-width: 768px) {
    html.readable .menu-text {
        min-height: 62.3vw;
        padding: 14px 70px 0 4vw;
    }
}

.overlay-description-text {
    position: absolute;
    top: 50%;
    left: 1vw;
    z-index: 1;
    display: none;
    width: min(44vw, 600px);
    max-height: 80vh;
    margin: 0;
    overflow-y: auto;
    color: #fff;
    font: 400 clamp(16px, 1.5vw, 22px)/1.45 var(--text-font);
    transform: translateY(-50%);
}

html.readable .image-overlay.has-description .overlay-description {
    display: none;
}

html.readable .image-overlay.has-description .overlay-description-text {
    display: block;
}

@media (max-width: 768px) {
    .overlay-description-text {
        top: auto;
        bottom: 2vh;
        left: 5vw;
        width: 90vw;
        max-height: 24vh;
        font-size: 15px;
        transform: none;
    }
}

/* Desktop sketch */
@media (min-width: 769px) {
    #canvas-container {
        position: relative;
        left: calc(-1 * (var(--sidebar-width) + var(--content-padding)));
        width: 100vw;
        height: 100vh;
        margin-bottom: 0;
    }

    #canvas-container canvas {
        width: 100vw !important;
        height: 400px !important;
    }
}

/* Windowed desktop */
@media (min-width: 769px) and (max-width: 1200px) {
    :root {
        --sidebar-width: 250px;
    }

    .illustration-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        order: 1;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 5px 0 20px;
    }

    .social-links {
        position: absolute;
        top: 30px;
        right: 7px;
        left: auto;
        flex-direction: column;
        gap: 7px;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
        width: 100%;
    }

    .content {
        order: 2;
        width: 100%;
        padding: 20px 0 0;
    }

    #canvas-container {
        width: 100vw;
        min-height: max(400px, calc(100svh - 62.3vw - 36px));
        margin: 0 0 100px;
    }

    #canvas-container canvas {
        width: 100vw !important;
        height: 400px !important;
    }

    .illustration-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .illustration-stack {
        display: contents;
    }

    section {
        position: relative;
        min-height: 100vh;
        padding: 40px 20px;
    }

    .mobile-section-label {
        position: absolute;
        top: -100px;
        left: 50%;
        display: block;
        width: min(270px, 80vw);
        height: 100px;
        overflow: hidden;
        transform: translateX(-50%);
    }

    .mobile-section-label img {
        position: absolute;
        top: 0;
        left: 0;
        display: block;
        width: 100%;
        height: auto;
        opacity: 0.56;
        transform: translateY(-25%);
    }

    .content > section:not(:last-of-type) {
        margin-bottom: 100px;
    }
}

.site-portal {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 40px 0;
}

.laptop-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 661 / 633;
}

.laptop-controls {
    display: none;
}

.laptop-frame {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mobile-phone-frame {
    display: none;
}

.site-preview {
    position: absolute;
    top: 4.2%;
    left: 12.7%;
    z-index: 1;
    width: 71.7%;
    height: 50%;
    border-radius: 2% 2% 0 0;
    background: #fff;
    overflow: hidden;
}

.site-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

@media (min-width: 769px) {
    .site-preview-frame {
        width: 142.86%;
        height: 142.86%;
        transform: scale(0.7);
        transform-origin: top left;
    }
}

.trackpad-switch {
    position: absolute;
    top: 78%;
    left: 35%;
    z-index: 3;
    width: 35%;
    height: 17%;
    padding: 0;
    border: 0;
    border-radius: 45%;
    background: transparent;
    cursor: pointer;
}

.trackpad-switch:focus-visible {
    outline: 2px solid #000;
    outline-offset: 4px;
}

@media (min-width: 769px) {
    .laptop-controls {
        position: absolute;
        top: 40px;
        right: 0;
        bottom: 40px;
        left: 0;
        z-index: 4;
        display: block;
        pointer-events: none;
    }

    .visit-link,
    .site-switch-toggle {
        position: absolute;
        left: 95%;
        display: block;
        width: clamp(60px, 13.5%, 128px);
        padding: 0;
        border: 0;
        background: transparent;
        cursor: pointer;
        transform: translateX(-50%);
        pointer-events: auto;
    }

    .visit-link {
        top: 3.6%;
    }

    .site-switch-toggle {
        top: 54.8%;
        transform: translate(-50%, -100%);
    }

    .laptop-controls img {
        display: block;
        width: 100%;
        height: auto;
    }

    .visit-link:focus-visible,
    .site-switch-toggle:focus-visible {
        outline: 2px solid #000;
        outline-offset: 3px;
    }
}

.site-card iframe {
    display: block;
    width: 100%;
    height: 600px;
    border: 1px solid #000;
    background: #fff;
}

@media (max-width: 768px) {
    .site-portal {
        flex-direction: column;
        align-items: center;
        gap: 7px;
        width: calc(100vw - 10px);
        margin-left: -15px;
        padding: 20px 0;
    }

    .laptop-controls {
        display: contents;
    }

    .visit-link,
    .site-switch-toggle {
        position: static;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 38%;
        min-width: 0;
        min-height: 44px;
        width: 38%;
        padding: 0;
        border: 0;
        background: transparent;
        cursor: pointer;
        transform: none;
    }

    .visit-link {
        order: 0;
    }

    .laptop-stage {
        order: 1;
    }

    .site-switch-toggle {
        order: 2;
    }

    .visit-link img,
    .site-switch-toggle img {
        display: block;
        height: auto;
    }

    .visit-link img,
    .site-switch-toggle img {
        width: 100%;
    }

    .laptop-stage {
        aspect-ratio: 633 / 1265;
    }

    .laptop-frame {
        display: none;
    }

    .trackpad-switch {
        display: none;
    }

    .mobile-phone-frame {
        position: absolute;
        inset: 0;
        z-index: 2;
        display: block;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .site-preview {
        top: 3%;
        left: 5.4%;
        width: 89.6%;
        height: 95.6%;
        border-radius: 15% / 8%;
        border-bottom-right-radius: 22% 11%;
    }

    .site-preview-frame {
        width: 100%;
        height: 100%;
        transform: none;
    }
}

.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px 0 12px;
}

.pdf-heading-crop {
    position: relative;
    width: min(460px, 100%);
    aspect-ratio: 460 / 38;
    margin: 0 auto 12px;
    overflow: hidden;
}

.pdf-heading-crop img {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    transform: translateY(-33.04%);
}

.pdf-heading-crop--typographic-terms {
    aspect-ratio: 460 / 56;
}

.pdf-heading-crop--typographic-terms img {
    transform: translateY(-30%);
}

.pdf-heading-crop--fedder-webflyer {
    width: min(368px, 80%);
    aspect-ratio: 460 / 82;
}

.pdf-heading-crop--fedder-webflyer img {
    transform: translateY(-24%);
}

.pdf-heading-crop--greenspark {
    aspect-ratio: 460 / 80;
    overflow: visible;
}

.pdf-heading-crop--greenspark img {
    transform: translateY(-20%);
}

.pdf-heading-crop--resume {
    width: min(115px, 100%);
    aspect-ratio: 271.685 / 69.517;
    overflow: visible;
}

.pdf-heading-crop--resume img {
    position: static;
    transform: none;
}

.pdf-document + .pdf-document {
    margin-top: 36px;
}

.illustration-gallery + .pdf-document {
    margin-top: 36px;
}

.pdf-controls button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.pdf-controls button img {
    display: block;
    width: 38px;
    height: auto;
}

.pdf-controls button:disabled {
    opacity: 0.3;
    cursor: default;
}

.pdf-page-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 92px;
    min-height: 44px;
}

.pdf-number {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.pdf-number img {
    display: block;
    width: 21px;
    height: auto;
}

.pdf-number-separator {
    display: inline-block;
    font-size: 14px;
}

.pdf-viewer {
    display: flex;
    width: 100%;
    overflow: hidden;
}

.pdf-viewer:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.pdf-slide {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pdf-slide[hidden] {
    display: none;
}

canvas.pdf-page {
    display: block;
    flex: 0 0 auto;
    max-width: none;
    background: #fff;
    cursor: zoom-in;
    touch-action: pan-x;
}

@media (max-width: 768px) {
    .pdf-heading-crop--typographic-terms {
        aspect-ratio: 460 / 84;
    }

    .image-overlay.has-description .overlay-image {
        max-height: 62vh;
        max-width: 90vw;
        margin-left: 0;
    }

    .image-overlay.has-description {
        justify-content: flex-start;
        flex-direction: column;
        align-items: center;
        padding-top: 0;
    }

    .overlay-narrate-slot {
        position: relative;
        top: auto;
        left: auto;
        flex: 0 0 auto;
        width: 100%;
        height: 28vh;
        margin: 10vh auto 0;
        aspect-ratio: auto;
    }

    .overlay-narrate {
        width: min(37vw, 16vh, 220px);
        height: auto;
        aspect-ratio: 1;
        margin: 0;
    }

    .image-overlay.has-description .overlay-image {
        max-height: 40vh;
    }

    .overlay-description {
        top: auto;
        bottom: 2vh;
        left: 5vw;
        width: 90vw;
        max-height: 18vh;
        transform: none;
    }

    .pdf-heading-crop--typographic-terms img {
        transform: translateY(-25%);
    }

    .pdf-controls {
        display: none;
    }

    .pdf-viewer {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        touch-action: pan-x;
    }

    .pdf-viewer::-webkit-scrollbar {
        display: none;
    }

    .pdf-slide {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}