.scroll { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent; }
.window-body, .window-body input, .window-body textarea, .prose, .viewer, .term-out { user-select: text; -webkit-user-select: text; }

.button { height: 30px; padding: 0 14px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; }
.button:hover { filter: brightness(1.1); }
.button-quiet { background: var(--fill-2); color: var(--fg); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--fill-2); border-top-color: var(--fg-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Viewer: a borrowed content node, typeset. */
.viewer { flex: 1; padding: clamp(14px, 3cqw, 36px) clamp(20px, 4cqw, 44px) clamp(20px, 4cqw, 44px); font-family: var(--serif); font-size: 15.5px; line-height: 1.7; }
.viewer .item, .viewer-mark { max-width: 680px; margin: 0 auto; }
.viewer-mark { margin-bottom: 18px; }
.viewer-mark .app-icon, .viewer-mark .file-icon { width: 64px !important; height: 64px !important; }
.viewer h3 { font-family: var(--display); font-size: clamp(30px, 6cqw, 44px); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; margin-top: 6px; }
.viewer .item-sub { font-size: 17px; margin-top: 8px; }
.viewer .item-meta { font-size: 13px; margin-top: 6px; }
.viewer a { color: var(--accent); text-decoration: none; }
.viewer a:hover { text-decoration: underline; }
.viewer .item-links a { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 9px; background: var(--fill-2); color: var(--fg); font-weight: 500; }
.viewer .item-links a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.viewer .item-figures img { cursor: zoom-in; }
.viewer .backed a { color: var(--fg); }
.viewer .item:has(.item-cover) { display: flex; flex-wrap: wrap; align-items: center; gap: 26px clamp(26px, 6cqw, 48px); }
.viewer .item-cover { flex: 0 1 clamp(190px, 38cqw, 270px); margin: 0; }
.viewer .item-cover img { width: 100%; }
.viewer .item-body { flex: 1 1 240px; min-width: 0; }
/* A write-up with a live piece beside it: the raptor session, TK1 walking. */
.viewer .item-split, .viewer:has(.item-split) .viewer-mark { max-width: 1040px; }
.viewer .item-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 36px; }
@container (min-width: 820px) {
    .viewer .item-split { grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); align-items: start; }
    .viewer .item-split > * { grid-column: 1; }
    .viewer .item-split > .item-stage { grid-column: 2; grid-row: 1 / span 6; margin-top: 0; align-self: center; }
}
.viewer[data-item='competitions'] .only-doc-hidden { display: block; margin-bottom: 14px; }

/* Frames: demos, live sites, the résumé. */
.frame { flex: 1; min-height: 0; display: flex; position: relative; }
.frame-stage { flex: 1; min-height: 0; position: relative; display: flex; background: #fff; }
.frame-stage iframe { flex: 1; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.frame-about { display: none; }
.frame[data-view='about'] .frame-stage { display: none; }
.frame[data-view='about'] .frame-about { display: block; }
.frame-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--window); color: var(--fg-2); font-size: 13px; }
.preview-stage { background: #ececea; }

/* Finder */
.finder { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.finder-side { background: var(--sidebar); padding: calc(var(--bar) + 2px) 10px 10px; }
.finder-side h3 { font-size: 11.500px; font-weight: 700; color: var(--fg-3); padding: 12px 10px 5px; }
.finder-side-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 10px; border-radius: 9px; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; }
.finder-side-item .glyph { color: var(--accent); }
.finder-side-item:hover { background: var(--fill); }
.finder-side-item.is-current { background: var(--fill-2); }
.finder-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-top: var(--bar); }
.finder-files { flex: 1; outline: none; padding: 14px; }
.finder-files[data-view='icons'] { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); grid-auto-rows: min-content; gap: 6px; align-content: start; }
.finder-files[data-view='icons'] .file { display: grid; justify-items: center; align-content: start; gap: 7px; padding: 10px 4px 8px; border-radius: 10px; text-align: center; }
.finder-files[data-view='icons'] .file .file-icon-folder { width: 62px; height: 52px; }
.finder-files[data-view='icons'] .file .app-icon { width: 54px; height: 54px; }
.finder-files[data-view='icons'] .file .file-icon-logo { width: 54px !important; height: 54px !important; }
.finder-files[data-view='icons'] .file-name { font-size: 12.5px; line-height: 1.25; padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.finder-files[data-view='icons'] .file.is-selected { background: var(--fill); }
.finder-files[data-view='icons'] .file.is-selected .file-name { background: var(--accent); color: #fff; }
.finder-files[data-view='list'] { padding: 0 8px 8px; }
.finder-files[data-view='list'] .file, .file-head { display: grid; grid-template-columns: 26px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .9fr); align-items: center; gap: 10px; height: 30px; padding: 0 10px; border-radius: 7px; font-size: 13.500px; }
.file-head { position: sticky; top: 0; z-index: 1; height: 30px; font-size: 12px; font-weight: 500; color: var(--fg-2); background: var(--window); border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; }
.file-head span + span { border-left: 1px solid var(--line); padding-left: 10px; margin-left: -10px; }
.finder-files[data-view='list'] .file:nth-child(odd) { background: var(--fill); }
.finder-files[data-view='list'] .file.is-selected { background: var(--accent); color: #fff; }
.finder-files[data-view='list'] .file > :first-child { width: 22px !important; height: 22px !important; }
.finder-files[data-view='list'] .file .file-icon-folder { height: 19px !important; }
.finder-files[data-view='list'] .file .file-icon-doc { width: 17px !important; }
.finder-files[data-view='list'] .file .file-icon-doc::before, .finder-files[data-view='list'] .file .file-icon-tag { display: none; }
.finder-files[data-view='list'] .file .file-icon-photo img { border-width: 1px; }
.finder-files[data-view='list'] .file .file-icon-cover { width: fit-content !important; margin-inline: auto; }
.file-name, .file-kind, .file-when { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-kind, .file-when { color: var(--fg-2); }
.finder-files[data-view='list'] .file.is-selected .file-kind, .finder-files[data-view='list'] .file.is-selected .file-when { color: rgb(255 255 255 / 80%); }
.finder-files[data-view='icons'] .file-name { white-space: normal; }
.finder-empty { grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: var(--fg-3); }
.finder-path { flex: none; display: flex; align-items: center; gap: 2px; height: 28px; padding: 0 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-2); overflow: hidden; white-space: nowrap; }
.finder-path button { padding: 2px 5px; border-radius: 5px; cursor: pointer; }
.finder-path button:hover { background: var(--fill-2); color: var(--fg); }
.finder-path-sep { color: var(--fg-3); }
.finder-count { margin-left: auto; color: var(--fg-3); }
.quicklook { position: absolute; inset: auto 14px 40px 14px; z-index: 2; display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow); animation: menu-in .18s var(--ease); }
.quicklook-icon { width: 84px; flex: none; display: grid; place-items: center; }
.quicklook-icon .file-icon-folder { width: 78px; height: 66px; }
.quicklook-icon .app-icon { width: 68px; }
.quicklook-photo { width: min(46%, 300px); border-radius: 8px; display: block; }
.quicklook-text { min-width: 0; display: grid; gap: 3px; }
.quicklook-text strong { font-size: 16px; }
.quicklook-text span { font-size: 12.5px; color: var(--fg-2); }
.quicklook-text p { font-size: 13.5px; color: var(--fg-2); margin-top: 4px; }
.quicklook-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Media */
.media { flex: 1; min-height: 0; display: flex; }
.media-list { flex: 1; padding: 4px clamp(14px, 4cqw, 34px) 28px; }
.media-row { position: relative; display: grid; gap: 5px; width: 100%; padding: 16px 40px 16px 14px; border-radius: 12px; text-align: left; text-decoration: none; color: inherit; cursor: pointer; }
.media-row + .media-row { margin-top: 2px; }
.media-row + .media-row::before { content: ''; position: absolute; left: 14px; right: 14px; top: -1px; height: 1px; background: var(--line); }
.media-row:hover { background: var(--fill); }
.media-row strong { font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.3; letter-spacing: -.01em; }
.media-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.500px; color: var(--fg-2); }
.media-meta b { font-weight: 600; color: var(--fg); }
.media-meta i { font-style: normal; padding: 1px 8px; border-radius: 999px; background: var(--fill-2); font-size: 11.500px; font-weight: 600; }
.media-summary { font-size: 14px; line-height: 1.45; color: var(--fg-2); }
.media-out { position: absolute; right: 14px; top: 18px; color: var(--fg-3); }
.media-row:hover .media-out { color: var(--accent); }
.media-reader { flex: 1; padding: clamp(8px, 3cqw, 30px) clamp(20px, 6cqw, 64px) 64px; outline: none; }
.media-empty { color: var(--fg-3); text-align: center; padding: 60px 0; }
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.75; }
.prose > * { max-width: 660px; margin-inline: auto; }
.prose h1 { font-size: clamp(30px, 6cqw, 42px); font-weight: 500; letter-spacing: -.03em; line-height: 1.12; }
.prose .post-meta { font-family: var(--sans); font-size: 13px; color: var(--fg-3); margin-top: 12px; margin-bottom: 34px; }
.prose h2 { font-size: 24px; font-weight: 500; letter-spacing: -.02em; margin-top: 44px; }
.prose h3 { font-size: 19px; font-weight: 600; margin-top: 32px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure { margin-top: 20px; margin-bottom: 0; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose blockquote { padding-left: 18px; border-left: 3px solid var(--line-strong); color: var(--fg-2); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .86em; padding: 2px 5px; border-radius: 5px; background: var(--fill-2); }
.prose pre { padding: 16px; border-radius: 10px; background: var(--fill); overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.prose pre code { padding: 0; background: none; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.prose hr { border: 0; height: 1px; background: var(--line-strong); margin: 40px auto; }
.prose li { margin-top: 6px; }

/* Photos */
.photos { flex: 1; min-height: 0; display: flex; background: var(--window); }
.photos-library { flex: 1; padding: clamp(16px, 3cqw, 28px); }
.photos-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.photos-cell { position: relative; flex: none; border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--fill); }
.photos-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.photos-cell:hover img, .photos-cell:focus-visible img { transform: scale(1.04); }
.photos-stage { flex: 1; min-width: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; background: #000; outline: none; }
.photos-stage figure { height: 100%; min-height: 0; display: grid; place-items: center; padding: 16px 0; }
.photos-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; min-height: 0; }
.photos-step { height: 100%; display: grid; place-items: center; color: rgb(255 255 255 / 55%); cursor: pointer; }
.photos-step:hover { color: #fff; }
.photos-count { font-size: 12.5px; color: var(--fg-3); padding-right: 6px; font-variant-numeric: tabular-nums; }

/* Mail */
.mail { flex: 1; display: flex; flex-direction: column; }
.mail-form { display: flex; flex-direction: column; flex: 1; min-height: 220px; }
.mail-field { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mail-field > span { color: var(--fg-3); flex: none; }
.mail-field input { flex: 1; min-width: 0; height: 40px; background: none; border: 0; outline: 0; font: inherit; color: var(--fg); }
.mail-chip { padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); text-decoration: none; font-size: 13.5px; }
.mail-form textarea { flex: 1; resize: none; padding: 16px 18px; background: none; border: 0; outline: 0; font: 15px/1.6 var(--sans); color: var(--fg); }
.mail-others { border-top: 1px solid var(--line); padding: 14px 18px 18px; background: var(--sidebar); font-size: 13.5px; }
.mail-others p { color: var(--fg-2); margin-bottom: 8px; }
.mail-others a { color: var(--accent); text-decoration: none; }
.mail-others .contact-list { margin: 0; }
.mail-others .contact-list li { padding: 6px 0; grid-template-columns: 90px 1fr; }

/* Terminal */
.terminal { flex: 1; padding: 12px 14px; background: #0c0c0e; color: #e8e8ea; font: 13px/1.55 var(--mono); cursor: text; }
.term-row { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-err { color: #ff6b63; }
.term-dim { color: var(--fg-3); margin-bottom: 6px; }
.term-line { display: flex; }
.term-prompt { white-space: pre; color: #5dff8f; }
.term-echo { color: inherit; }
.term-input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font: inherit; color: inherit; caret-color: currentColor; padding: 0; }

/* Settings */
.settings { flex: 1; padding: 20px clamp(16px, 4cqw, 36px) 32px; display: grid; gap: 22px; align-content: start; }
.set-group h3 { font-size: 13px; font-weight: 600; color: var(--fg-2); margin: 0 0 8px 4px; }
.set-card { border-radius: 12px; background: var(--fill); box-shadow: inset 0 0 0 1px var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 52px; padding: 8px 14px; }
.set-row + .set-row, .set-note { border-top: 1px solid var(--line); }
.set-row strong { display: block; font-size: 14px; font-weight: 500; }
.set-row small { display: block; font-size: 12px; color: var(--fg-3); }
.set-row .seg { min-width: 200px; }
.set-slider { width: min(240px, 46%); }
.set-note { padding: 12px 14px; font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
.set-reset { justify-self: start; }

/* About */
.about { flex: 1; padding: clamp(22px, 5cqw, 40px); }
.about-hero { display: flex; align-items: center; gap: clamp(18px, 4cqw, 34px); }
.about-mark { flex: none; width: clamp(92px, 20cqw, 132px); aspect-ratio: 1; border-radius: 26%; display: grid; place-items: center; grid-auto-flow: column; font-family: var(--serif); font-size: clamp(40px, 9cqw, 60px); font-weight: 600; letter-spacing: -.08em; background: radial-gradient(circle at 30% 20%, rgb(255 255 255 / 20%), transparent 60%), var(--fill-2); box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px var(--line), var(--shadow-soft); }
.about-mark i { font-style: normal; color: var(--fg-3); }
.about h2 { font-family: var(--display); font-size: clamp(26px, 5.5cqw, 36px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.about-role { font-size: 15px; margin-top: 4px; }
.about-role-2, .about-where { color: var(--fg-2); margin-top: 0; }
.about-where { font-size: 13px; margin-top: 2px; }
.about-actions { display: flex; gap: 8px; margin-top: 14px; }
.about-details { margin-top: 26px; font-size: 14.5px; }
.about-details .about-notes { padding-left: 1.1em; margin: 0; color: var(--fg-2); }
.about-details li { margin: 5px 0; }

@container (max-width: 620px) {
    .window-lead, .window-lead:empty { margin-left: 0; }
    .finder { grid-template-columns: minmax(0, 1fr); }
    .finder-side { display: none; }
    .photos-stage { grid-template-columns: 34px minmax(0, 1fr) 34px; }
    .set-row { flex-wrap: wrap; }
    .set-row .seg, .set-slider { width: 100%; }
    .about-hero { flex-direction: column; align-items: flex-start; }
    .quicklook { flex-direction: column; align-items: flex-start; }
}

/* iPhone Mirroring */
/* Like the real one: only the phone shows. The title bar slides in when the pointer reaches the top. */
.window[data-app='mirror'] { background: #000; --bar: 0px; border-radius: 30px; }
.window[data-app='mirror'] .window-bar { height: 38px; padding-left: 20px; background: linear-gradient(180deg, rgb(0 0 0 / 88%), rgb(0 0 0 / 55%) 70%, transparent); opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .25s var(--ease); }
.window[data-app='mirror'] .window-bar:hover, .window[data-app='mirror'] .window-bar:focus-within { opacity: 1; transform: none; }
.window[data-app='mirror'] .window-title { font-size: 12.500px; font-weight: 600; color: rgb(255 255 255 / 70%); }
.window[data-app='mirror'] .window-shield { inset: 38px 0 0; }
.mirror { position: relative; flex: 1; min-height: 0; margin: 6px; background: #000; }
.mirror-phone { position: absolute; left: 50%; top: 50%; width: 390px; height: 844px; display: flex; flex-direction: column; border-radius: 48px; overflow: hidden; background: #111113; transform: translate(-50%, -50%) scale(var(--k, .8)); color: #fff; }
.mirror-island { position: absolute; left: 50%; top: 9px; z-index: 2; width: 104px; height: 28px; border-radius: 14px; background: #000; transform: translateX(-50%); pointer-events: none; }
.mirror-phone iframe { flex: 1; width: 100%; border: 0; display: block; background: #000; }

/* Split demo: write-up on the left, the app at phone size on the right. */
.frame[data-layout='split'] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); }
.frame[data-layout='split'] .frame-about { display: block; order: 1; }
.frame[data-layout='split'] .frame-stage { display: block; order: 2; position: relative; background: none; margin: 4px 14px 18px 0; }
.frame-device { position: absolute; left: 50%; top: 50%; width: 390px; height: 840px; padding: 0; border-radius: 52px; overflow: hidden; background: #000; box-shadow: 0 0 0 10px #0b0b0d, 0 0 0 11.500px #3a3a40, 0 30px 60px rgb(0 0 0 / 45%); transform: translate(-50%, -50%) scale(var(--k, .7)); }
.frame-device iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.frame[data-layout='split'] .frame-loading { background: none; }
.window:has(.frame[data-layout='split']) .window-tools .tool-round { display: none; }
@container (max-width: 760px) {
    .frame[data-layout='split'] { display: flex; }
    .frame[data-layout='split'] .frame-stage { flex: 1; margin: 4px 10px 14px; }
    .frame[data-layout='split'][data-view='demo'] .frame-about, .frame[data-layout='split'][data-view='about'] .frame-stage { display: none; }
    .window:has(.frame[data-layout='split']) .window-tools .tool-round { display: inline-flex; }
}

.tool-video .glyph { margin-left: -2px; }
