:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    --canvas: #09090b;
    --surface: #0f0f12;
    --surface-raised: #141417;
    --surface-hover: #19191d;
    --line: #27272a;
    --line-strong: #3f3f46;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #ededed;
    --accent-ink: #09090b;
    --positive: #4ade80;
    --positive-surface: #102117;
    --warning: #facc15;
    --warning-surface: #211d0e;
    --danger: #f87171;
    --danger-surface: #241313;
    --radius: 8px;
    --radius-large: 12px;
    --content-width: 1180px;
}

.field-label {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e4e4e7;
    font-size: 13px;
    font-weight: 500;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% -40%, rgba(255, 255, 255, .055), transparent 58%),
        var(--canvas);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

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

button {
    color: inherit;
}

button:disabled {
    cursor: not-allowed;
}

img,
svg {
    display: block;
}

::selection {
    color: var(--text);
    background: #3f3f46;
}

:focus-visible {
    outline: 2px solid #f4f4f5;
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 20;
    top: 8px;
    left: 8px;
    padding: 10px 14px;
    transform: translateY(-150%);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-raised);
}

.skip-link:focus {
    transform: translateY(0);
}

.topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(9, 9, 11, .88);
    backdrop-filter: blur(16px);
}

.topbar__inner {
    width: min(100% - 48px, var(--content-width));
    height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.brand__mark {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    color: #f4f4f5;
}

.brand__mark svg {
    width: 21px;
    height: 21px;
}

.main-nav {
    height: 100%;
    margin-left: 42px;
    display: flex;
    align-items: center;
    gap: 26px;
}

.main-nav a {
    position: relative;
    height: 100%;
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    transition: color .15s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
    color: var(--text);
}

.main-nav a[aria-current="page"]::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--text);
    content: "";
}

.topbar__action {
    margin-left: auto;
}

.page-shell {
    width: min(100% - 48px, var(--content-width));
    flex: 1;
    margin: 0 auto;
    padding: 54px 0 88px;
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: var(--text-muted);
    font-size: 12px;
}

.site-footer__inner {
    width: min(100% - 48px, var(--content-width));
    min-height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading {
    min-height: 114px;
    margin-bottom: 32px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.page-heading--compact {
    min-height: 0;
    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .105em;
    line-height: 1.4;
}

.status-indicator {
    width: 7px;
    height: 7px;
    margin-right: 7px;
    display: inline-block;
    border-radius: 50%;
    background: var(--positive);
    box-shadow: 0 0 8px rgba(74, 222, 128, .35);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 600;
    letter-spacing: -.045em;
    line-height: 1.12;
}

h2 {
    font-size: 16px;
    font-weight: 550;
    letter-spacing: -.02em;
}

.page-heading__description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.button {
    min-height: 40px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 550;
    line-height: 1;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button--small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.button--primary {
    border-color: #f4f4f5;
    background: #f4f4f5;
    color: #09090b;
}

.button--primary:hover:not(:disabled) {
    border-color: #d4d4d8;
    background: #d4d4d8;
}

.button--secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.button--secondary:hover:not(:disabled) {
    background: var(--surface-hover);
}

.button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.button--full {
    width: 100%;
}

.library-summary {
    min-height: 56px;
    margin-bottom: 25px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 17px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(15, 15, 18, .72);
}

.library-summary > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.summary-value {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.summary-label {
    color: var(--text-secondary);
    font-size: 12px;
}

.summary-divider {
    width: 1px;
    height: 19px;
    background: var(--line);
}

.category-filter {
    min-height: 46px;
    margin-bottom: 35px;
    padding: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.filter-chip {
    min-height: 32px;
    padding: 0 11px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.filter-chip span {
    color: var(--text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.filter-chip:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.filter-chip[aria-current="page"] {
    border-color: var(--line-strong);
    background: var(--surface-raised);
    color: var(--text);
}

.filter-chip[aria-current="page"] span {
    color: var(--text-secondary);
}

.filter-manage {
    margin-left: auto;
    padding: 6px 0 6px 10px;
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 12px;
}

.filter-manage:hover {
    color: var(--text);
}

.filter-manage span {
    margin-left: 5px;
}

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

.section-heading h2 {
    margin: 0;
    font-size: 14px;
}

.section-heading > span {
    color: var(--text-muted);
    font-size: 12px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.image-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: rgba(15, 15, 18, .78);
    transition: border-color .18s ease, transform .18s ease, background-color .18s ease;
}

.image-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    background: var(--surface);
}

.image-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    display: block;
    background: #18181b;
}

.image-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

.image-card:hover .image-card__media img {
    transform: scale(1.025);
}

.image-card__open {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 7px;
    background: rgba(9, 9, 11, .76);
    color: white;
    opacity: 0;
    transition: opacity .15s ease;
}

.image-card:hover .image-card__open,
.image-card__media:focus-visible .image-card__open {
    opacity: 1;
}

.image-card__body {
    padding: 14px 15px 15px;
}

.image-card__title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.image-card__title-row h2,
.image-card__title-row h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 550;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-card__title-row h2 a:hover,
.image-card__title-row h3 a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.icon-button {
    width: 30px;
    height: 30px;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.icon-button svg {
    width: 17px;
    height: 17px;
}

.icon-button:hover {
    border-color: var(--line);
    background: var(--surface-hover);
    color: var(--text);
}

.image-card__meta {
    min-height: 23px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-muted);
    font-size: 11px;
}

.image-card__meta time {
    white-space: nowrap;
}

.category-label {
    width: fit-content;
    max-width: 100%;
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color .15s ease, text-decoration-color .15s ease;
}

.category-label:hover {
    color: var(--text);
    text-decoration-color: var(--text-muted);
}

.image-card__description {
    margin: 8px 0 0;
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.empty-state {
    min-height: 330px;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-large);
    background: rgba(15, 15, 18, .48);
    text-align: center;
}

.empty-state__icon {
    width: 52px;
    height: 52px;
    margin-bottom: 20px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-raised);
    color: var(--text-secondary);
    font-size: 25px;
}

.empty-state__icon svg {
    width: 30px;
    height: 30px;
}

.empty-state h2 {
    margin: 0 0 7px;
    font-size: 16px;
}

.empty-state p {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.breadcrumbs {
    margin: 0 0 27px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    color: var(--text-muted);
    font-size: 12px;
}

.breadcrumbs a:hover {
    color: var(--text);
}

.breadcrumbs [aria-current="page"] {
    max-width: min(50vw, 380px);
    overflow: hidden;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.4;
}

.narrow-page {
    width: min(100%, 680px);
    margin: 0 auto;
}

.narrow-page > .page-heading {
    margin-bottom: 26px;
}

.notice {
    margin: 0 0 20px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
}

.notice p {
    margin: 0;
}

.notice a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.notice--success {
    border-color: rgba(74, 222, 128, .28);
    background: var(--positive-surface);
}

.notice--success .notice__dot {
    background: var(--positive);
}

.notice--error {
    border-color: rgba(248, 113, 113, .3);
    background: var(--danger-surface);
}

.notice--error .notice__dot {
    background: var(--danger);
}

.notice--warning {
    border-color: rgba(250, 204, 21, .26);
    background: var(--warning-surface);
}

.notice--warning .notice__dot {
    background: var(--warning);
}

.notice__dot {
    width: 7px;
    height: 7px;
    margin-top: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-secondary);
}

.form-panel,
.category-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: rgba(15, 15, 18, .8);
}

.form-panel {
    padding: 24px;
}

.form-field {
    min-width: 0;
}

.form-field + .form-field,
.form-stack .form-field + .form-field {
    margin-top: 21px;
}

.form-field > label {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e4e4e7;
    font-size: 13px;
    font-weight: 500;
}

.required-mark,
.optional-mark {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

.form-field input:not([type="file"]),
.form-field select,
.form-field textarea,
.url-field input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #09090b;
    color: var(--text);
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.form-field textarea {
    min-height: 92px;
    resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #62626b;
}

.form-field input:not([type="file"]):focus,
.form-field select:focus,
.form-field textarea:focus,
.url-field input:focus {
    border-color: #a1a1aa;
    box-shadow: 0 0 0 3px rgba(161, 161, 170, .13);
}

.form-field :disabled {
    opacity: .5;
}

.field-hint {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 11px;
}

.dropzone {
    min-height: 180px;
    padding: 23px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: #0b0b0e;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
    border-color: #a1a1aa;
    background: #111114;
}

.dropzone:focus-within {
    outline: 2px solid #f4f4f5;
    outline-offset: 3px;
}

.dropzone input[type="file"] {
    width: 1px;
    height: 1px;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.dropzone__icon {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text-secondary);
}

.dropzone__icon svg {
    width: 21px;
    height: 21px;
}

.dropzone__title {
    font-size: 13px;
    font-weight: 500;
}

.dropzone__hint {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.dropzone__preview {
    max-width: 100%;
    margin-top: 16px;
}

.dropzone__preview img {
    max-width: 100%;
    max-height: 210px;
    border-radius: 6px;
    object-fit: contain;
}

.hidden {
    display: none !important;
}

.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    border-top: 1px solid var(--line);
}

.category-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr);
    align-items: start;
    gap: 20px;
}

.category-panel {
    overflow: hidden;
}

.panel-heading {
    min-height: 78px;
    padding: 17px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin: 0 0 3px;
}

.panel-heading p,
.form-intro {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.count-badge {
    min-width: 27px;
    height: 27px;
    padding: 0 7px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

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

.category-list li + li {
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.category-row {
    min-height: 74px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color .15s ease;
}

.category-row:hover {
    background: var(--surface-hover);
}

.category-row__icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text-secondary);
}

.category-row__icon svg {
    width: 19px;
    height: 19px;
}

.category-row__text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.category-row__text strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-row__text > span {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-row__count {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 11px;
}

.category-row__arrow {
    flex: 0 0 auto;
    color: var(--text-muted);
    transition: transform .15s ease, color .15s ease;
}

.category-row:hover .category-row__arrow {
    transform: translateX(2px);
    color: var(--text);
}

.panel-empty {
    padding: 25px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.panel-empty p {
    margin: 0;
}

.category-create {
    padding: 20px;
}

.category-create .eyebrow {
    margin-bottom: 7px;
}

.category-create h2 {
    margin: 0 0 5px;
}

.category-create .form-intro {
    margin-bottom: 22px;
}

.form-stack .button {
    margin-top: 22px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 26px;
}

.detail-preview {
    position: sticky;
    top: 88px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
}

.detail-preview > img {
    width: 100%;
    max-height: calc(100vh - 160px);
    max-height: calc(100dvh - 160px);
    border-radius: 6px;
    background: #09090b;
    object-fit: contain;
}

.preview-open {
    width: fit-content;
    margin: 11px 0 1px auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.preview-open:hover {
    color: var(--text);
}

.detail-sidebar {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
}

.detail-sidebar .eyebrow {
    margin-bottom: 9px;
}

.detail-title {
    overflow-wrap: anywhere;
    font-size: 20px;
    letter-spacing: -.035em;
}

.detail-date {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
}

.detail-metadata {
    margin: 20px 0 0;
    border-top: 1px solid var(--line);
}

.detail-metadata > div {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.detail-metadata dt {
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 11px;
}

.detail-metadata dd {
    margin: 0;
    color: #e4e4e7;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.detail-metadata .tag-list {
    display: flex;
}

.detail-metadata .url-field {
    border-bottom: 0;
}

.url-field__control {
    display: flex;
    gap: 8px;
}

.url-field input {
    min-width: 0;
    height: 38px;
    min-height: 38px;
    padding: 8px 10px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 11px;
    text-overflow: ellipsis;
}

.button--copy {
    min-height: 38px;
    padding: 0 10px;
    flex: 0 0 auto;
    gap: 6px;
    font-size: 11px;
}

.button--copy svg {
    width: 15px;
    height: 15px;
}

.detail-actions {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.delete-disclosure {
    margin-top: 15px;
}

.delete-disclosure summary {
    width: fit-content;
    margin: 0 auto;
    padding: 6px 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    list-style: none;
    text-align: center;
}

.delete-disclosure summary::-webkit-details-marker {
    display: none;
}

.delete-disclosure summary:hover {
    color: var(--danger);
}

.delete-panel {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid rgba(248, 113, 113, .22);
    border-radius: var(--radius);
    background: var(--danger-surface);
}

.delete-panel > p {
    margin: 0 0 13px;
    color: #d4a2a2;
    font-size: 11px;
}

.button--danger {
    border-color: #7f1d1d;
    background: #7f1d1d;
    color: #fff;
}

.button--danger:hover {
    border-color: #991b1b;
    background: #991b1b;
}

.sr-only {
    width: 1px;
    height: 1px;
    padding: 0;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

@media (max-width: 900px) {
    .image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 16px;
    }

    .category-layout {
        grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
        gap: 14px;
    }
}

@media (max-width: 680px) {
    .topbar__inner,
    .page-shell,
    .site-footer__inner {
        width: min(100% - 32px, var(--content-width));
    }

    .topbar__inner {
        height: 60px;
    }

    .main-nav {
        margin-left: auto;
        gap: 17px;
    }

    .topbar__action {
        margin-left: 16px;
    }

    .page-shell {
        padding: 38px 0 60px;
    }

    .page-heading {
        min-height: 0;
        align-items: flex-start;
    }

    .page-heading:not(.page-heading--compact) {
        flex-direction: column;
        gap: 18px;
    }

    .page-heading:not(.page-heading--compact) > .button {
        align-self: flex-start;
    }

    .page-heading--compact {
        align-items: flex-end;
    }

    .category-filter {
        margin-right: -16px;
        padding-right: 16px;
    }

    .filter-manage {
        margin-left: 0;
    }

    .image-grid {
        gap: 12px;
    }

    .image-card__body {
        padding: 11px;
    }

    .image-card__meta {
        flex-wrap: wrap;
        gap: 4px;
    }

    .image-card__description {
        font-size: 11px;
    }

    .category-layout {
        grid-template-columns: 1fr;
    }

    .category-create {
        order: -1;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-preview {
        position: static;
    }

    .detail-preview > img {
        max-height: 65vh;
        max-height: 65dvh;
    }

    .detail-sidebar {
        padding: 17px;
    }

    .site-footer__inner {
        min-height: 64px;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 2px 12px;
    }

    .site-footer__inner span:nth-child(2) {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 390px) {
    .topbar__inner,
    .page-shell,
    .site-footer__inner {
        width: calc(100% - 24px);
    }

    .brand {
        gap: 7px;
        font-size: 12px;
    }

    .brand__mark {
        width: 19px;
        height: 19px;
    }

    .brand__mark svg {
        width: 19px;
        height: 19px;
    }

    .main-nav {
        gap: 10px;
    }

    .main-nav a {
        font-size: 11px;
    }

    .topbar__action {
        min-height: 32px;
        margin-left: 10px;
        padding: 0 9px;
        gap: 5px;
        font-size: 11px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }

    .image-card__body {
        padding: 13px;
    }
}

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

@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid Highlight;
    }

    .status-indicator,
    .notice__dot {
        border: 1px solid currentColor;
    }
}
