:root {
    color-scheme: light;
    font-family: Arial, Helvetica, sans-serif;
    color: #262725;
    background: #fff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
}

button {
    border-radius: 0;
}

a:focus-visible,
summary:focus-visible {
    outline: 2px solid #555b53;
    outline-offset: 3px;
}

.page-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: clamp(264px, 26.4vw, 348px) minmax(0, 1fr);
    gap: 24px;
    padding: 16px;
}

.drawing-mode .page-layout {
    z-index: 4;
    pointer-events: none;
}

.drawing-mode #workspace {
    z-index: 3;
}

.drawing-mode .page-layout a,
.drawing-mode .page-layout button,
.drawing-mode .page-layout summary,
.drawing-mode .pencil-popover {
    pointer-events: auto;
}

.navigation-column {
    min-width: 0;
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    overflow-y: auto;
    padding-right: 12px;
}

.navigation-column,
#sketchbook {
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
}

.navigation-column a {
    color: #0000ee;
    text-decoration: underline;
}

.navigation-column a:visited {
    color: #551a8b;
}

.navigation-column .section-title,
#sketchbook .section-title {
    font-family: inherit;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: normal;
}

.navigation-column section {
    border-top: 1px solid #aaa;
    margin-top: 24px;
    padding-top: 12px;
}

.navigation-column section h2 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
}

.navigation-column ul {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

#project-list > li,
#archive-list > li {
    border-top: 1px solid #e6e7e3;
    padding: 10px 0;
}

#project-list summary,
#archive-list summary {
    cursor: pointer;
}

.navigation-column section > p {
    margin: 0;
}

#project-list details > :not(summary),
#archive-list details > :not(summary) {
    margin-left: 1.25em;
}

.project-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 10px;
}

#project-list .project-detail {
    display: grid;
    grid-template-columns: 5.5em minmax(0, 1fr);
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.project-detail-label {
    font-weight: 400;
}

.project-previews {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.project-previews img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

#sketchbook {
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-header {
    display: grid;
    grid-template-rows: auto var(--subtitle-row-height, auto) auto;
    align-items: start;
    row-gap: 12px;
    padding-top: 8px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.section-header > h1,
.section-header > h2,
.section-header > p {
    margin: 0;
}

.section-title {
    font-family: inherit;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.section-header > p {
    line-height: 1.45;
}

.pencil-control {
    position: relative;
    display: inline-block;
}

.pencil-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 8px 10px;
    border: 1px solid #c6c9c2;
    text-align: left;
}

.pencil-popover[hidden] {
    display: none;
}

.pencil-field {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pencil-option-label {
    color: #262725;
    font-size: 12px;
    white-space: nowrap;
}

.pencil-popover select,
.pencil-ink-button {
    min-height: 26px;
    border: 1px solid #9fa39c;
    background-color: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
}

.pencil-popover select {
    padding: 2px 20px 2px 5px;
    cursor: pointer;
}

.pencil-ink-control {
    position: relative;
    display: inline-block;
}

.pencil-ink-button {
    position: relative;
    display: block;
    width: 42px;
    padding: 3px;
    cursor: pointer;
}

.pencil-ink-button::before {
    content: '';
    display: block;
    width: 100%;
    height: 18px;
    background: var(--current-ink);
}

.pencil-colors {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px;
    border: 1px solid #c6c9c2;
}

.pencil-colors[hidden] {
    display: none;
}

.section-header .pencil-swatch {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #fafaf8;
    border-radius: 0;
    background: var(--swatch-color);
}

.section-header .pencil-swatch:hover {
    background: var(--swatch-color);
}

.pencil-swatch[aria-pressed='true'] {
    outline: 1px solid #262725;
}

#sketchbook > p {
    margin: 9px 0 0;
}

#sketchbook > p:last-child {
    margin-top: auto;
}

#workspace {
    position: fixed;
    inset: 0;
    z-index: 0;
}

#project-panels {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

#drawing {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#drawing.drawing-enabled {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}

.project-panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    width: min(520px, 100%);
    max-height: 90%;
    cursor: grab;
    pointer-events: auto;
}

.project-panel.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.media-column {
    width: min(460px, 100%);
    height: min(760px, 84%);
    max-height: 84%;
}

.media-column-header {
    flex-shrink: 0;
    margin-bottom: 12px;
    padding-right: 32px;
    color: #000;
    font-family: "Times New Roman", Times, serif;
}

.media-column-header h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.media-column-header p {
    margin: 4px 0 0;
    font-size: 16px;
    line-height: 1.35;
}

.panel-content {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #b8bcb5 transparent;
    cursor: inherit;
}

.media-column .panel-content {
    flex: 1;
    overscroll-behavior: contain;
}

.panel-content figure {
    margin: 0;
}

.panel-content img {
    display: block;
    width: 100%;
    height: auto;
}

.panel-content svg {
    touch-action: none;
    cursor: move;
}

.asset-launcher {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.asset-launcher img {
    transition: opacity 150ms ease;
}

.asset-launcher:hover img {
    opacity: 0.85;
}

.asset-launcher:last-child {
    margin-bottom: 0;
}

.asset-viewer {
    width: min(800px, 100%);
    height: min(665px, 90%);
    max-width: 100%;
    max-height: 100%;
}

.asset-viewer .panel-close {
    right: 28px;
}

.asset-resize-handle {
    position: absolute;
    z-index: 3;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: nwse-resize;
    touch-action: none;
}

.asset-resize-handle:focus-visible {
    outline: 2px solid #262725;
    outline-offset: 2px;
}

.asset-resize-handle[data-corner='nw'] {
    top: 0;
    left: 0;
}

.asset-resize-handle[data-corner='ne'] {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.asset-resize-handle[data-corner='sw'] {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.asset-resize-handle[data-corner='se'] {
    bottom: 0;
    right: 0;
}

.panel-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #262725;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 150ms ease;
}

.project-panel:hover .panel-close,
.panel-close:focus-visible {
    opacity: 1;
}

.image-viewer .panel-content {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.image-viewer .panel-content img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.drawing-viewer .panel-content {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.drawing-viewer .panel-content > section {
    height: 100%;
}

.drawing-viewer .panel-content > section > p {
    margin: 0;
}

.drawing-viewer [data-dxf='viewport'] {
    display: block;
    height: 100%;
}

.drawing-viewer [data-dxf='metadata'] {
    display: none;
}

.drawing-viewer [data-dxf='status'] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.drawing-viewer [data-dxf='fit'] {
    position: absolute;
    top: 4px;
    left: 28px;
    z-index: 1;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0;
    opacity: 0;
    transition: opacity 150ms ease;
}

.drawing-viewer [data-dxf='fit']::after {
    content: '⤢';
    font-size: 18px;
}

.drawing-viewer:hover [data-dxf='fit'],
.drawing-viewer [data-dxf='fit']:focus-visible {
    opacity: 1;
}

.drawing-viewer .panel-content > section > p {
    margin: 0;
}

@media (hover: none) {
    .project-panel .panel-close,
    .drawing-viewer [data-dxf='fit'] {
        opacity: 1;
    }
}

@media (max-width: 700px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 12px;
    }

    .navigation-column {
        height: auto;
        overflow: visible;
        padding-right: 0;
    }

    .section-header {
        grid-template-rows: auto auto auto;
    }

    #sketchbook {
        height: 75vh;
        height: 75dvh;
        min-height: 420px;
    }
}
