:root {
    --desk:       #323723;
    --sheet:      #faf1e2;
    --panel:      #f0e1d2;
    --edge:       #e4d1bc;
    --titlebar:   #b16349;
    --ink:        #542718;
    --link:       #cf7c58;
    --link-hi:    #e79e76;
    --shadow:     #5c6555;
    --grid:       #7b876c;
    --muted:      #a5b08e;
    --white:      #ffffff;

    --font: "Courier New", Courier, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 28px 12px 60px;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--desk);
}

img {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.thumb img,
.lightbox img {
    image-rendering: auto;
}

/* --------------------------------------------------- общий лист */

.sheet {
    max-width: 880px;
    margin: 0 auto;
    padding: 36px 40px 28px;

    background-color: var(--sheet);
    background-image:
        linear-gradient(rgba(123, 135, 108, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 135, 108, 0.16) 1px, transparent 1px);
    background-size: 16px 16px;

    border: 2px solid var(--ink);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------- шапка */

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    margin: 0;
    font-size: 52px;
    line-height: 1;
    letter-spacing: 4px;
    font-weight: 900;
}

h1 a {
    color: var(--ink);
    text-decoration: none;
}

.logo {
    width: 480px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.subtitle {
    margin: 8px 0 22px;
    color: var(--shadow);
    letter-spacing: 1px;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 26px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 92px;
    padding: 6px 4px;
    color: var(--ink);
    text-decoration: none;
    border: 2px solid transparent;
}

.nav-item img {
    width: 64px;
    height: 64px;
    display: block;
    transition: transform 0.08s;
}

.nav-item span {
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-item:hover img {
    transform: translateY(-3px);
}

.nav-item:hover span {
    color: var(--link);
}

.nav-item.active {
    border-color: var(--edge);
    background: rgba(255, 255, 255, 0.45);
}

.nav-item.active span {
    color: var(--titlebar);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------------------------------------------------------- окно */

.window {
    margin: 0 0 26px;
    background: var(--sheet);
    border-top: 2px solid var(--white);
    border-left: 2px solid var(--white);
    border-right: 2px solid var(--shadow);
    border-bottom: 2px solid var(--shadow);
    box-shadow: 4px 4px 0 var(--shadow);
}

.titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 3px 6px;
    background: var(--titlebar);
    color: var(--sheet);
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--ink);
}

.titlebar-name {
    grid-column: 2;
    text-align: center;
}

.titlebar-buttons {
    grid-column: 3;
    justify-self: end;
    display: flex;
    gap: 3px;
}

.titlebar-buttons span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0;
    color: var(--ink);
    background: var(--panel);
    border-top: 1px solid var(--white);
    border-left: 1px solid var(--white);
    border-right: 1px solid var(--shadow);
    border-bottom: 1px solid var(--shadow);
}

.window-body {
    padding: 16px 20px;
}

.window-body::after {
    content: "";
    display: block;
    clear: both;
}

.window-body > *:first-child { margin-top: 0; }
.window-body > *:last-child  { margin-bottom: 0; }

h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 17px; margin: 20px 0 8px; color: var(--titlebar); }
p  { margin: 0 0 12px; }

a        { color: var(--link); }
a:hover  { color: var(--link-hi); }

.more    { margin-top: 16px; }
.muted   { color: var(--muted); }

ul { padding-left: 22px; }

/* ------------------------------------------------ галерея в углу */
/* ------------------------------------------------------- галерея */

.gallery {
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), 120px);
    gap: 8px;
}

/* 1–4 фото: в правом углу, текст обтекает */
.gallery-side {
    float: right;
    margin: 2px 0 12px 20px;
}

/* 5+ фото: полоса под текстом */
.gallery-strip {
    clear: both;
    justify-content: center;
    margin: 16px 0 4px;
}

.thumb {
    display: block;
    width: 120px;
    height: 120px;
    overflow: hidden;
    padding: 3px;
    background: var(--edge);
    border-top: 2px solid var(--white);
    border-left: 2px solid var(--white);
    border-right: 2px solid var(--shadow);
    border-bottom: 2px solid var(--shadow);
}

.thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb:hover img { opacity: 0.85; }

/* ------------------------------------------------------- лайтбокс */

.lightbox { display: none; }

.lightbox:target {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 24px;
    background: rgba(50, 55, 35, 0.93);
    cursor: zoom-out;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 4px solid var(--sheet);
}

/* -------------------------------------------------- пагинация */

.pagebar {
    position: relative;
    margin-top: 30px;
    padding: 10px 16px;
    text-align: center;
    background: var(--panel);
    border-top: 2px solid var(--white);
    border-left: 2px solid var(--white);
    border-right: 2px solid var(--shadow);
    border-bottom: 2px solid var(--shadow);
    box-shadow: 3px 3px 0 var(--shadow);
}

.pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 12px;
    font-size: 16px;
    font-weight: bold;
}

.pages a {
    color: var(--shadow);
    text-decoration: none;
    padding: 0 2px;
}

.pages a:hover { color: var(--link); }

.pages .current {
    color: var(--titlebar);
    border-bottom: 3px solid var(--titlebar);
}

.pages .dead { color: var(--edge); }
.pages .dots { color: var(--muted); }

.archive-tag {
    position: absolute;
    top: -16px;
    right: -10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px 3px 8px;
    color: var(--ink);
    font-weight: bold;
    letter-spacing: 1px;
    text-decoration: none;
    background: var(--edge);
    border: 1px solid var(--grid);
    box-shadow: 2px 2px 0 var(--shadow);
    transform: rotate(9deg);
}

.archive-tag img {
    width: 24px;
    height: 24px;
}

.archive-tag:hover {
    transform: rotate(6deg) translateY(-2px);
    color: var(--titlebar);
}

/* ---------------------------------------------------------- архив */

.archive-list {
    margin: 0 0 8px;
    padding-left: 22px;
    columns: 3;
}

/* -------------------------------------------------- мелочи */

.spoiler {
    background: var(--ink);
    color: transparent;
    cursor: help;
}

.spoiler:hover {
    background: transparent;
    color: inherit;
}

code {
    background: var(--panel);
    padding: 0 4px;
}

s  { color: var(--muted); }

hr {
    border: none;
    border-top: 1px solid var(--edge);
    margin: 20px 0;
}

/* ---------------------------------------------------------- подвал */

footer {
    margin-top: 40px;
    padding-top: 12px;
    border-top: 1px solid var(--edge);
    text-align: center;
    font-size: 12px;
    color: var(--shadow);
}

/* ---------------------------------------------------------- телефон */

@media (max-width: 600px) {
    body  { padding: 12px 6px 40px; }
    .sheet { padding: 22px 14px 20px; }

    h1 { font-size: 34px; letter-spacing: 2px; }

    .menu { gap: 4px 8px; }
    .nav-item { width: 72px; }
    .nav-item img { width: 48px; height: 48px; }

        .gallery,
    .gallery-side {
        float: none;
        margin: 14px 0;
        grid-template-columns: repeat(auto-fill, 88px);
        justify-content: start;
    }

    .thumb { width: 88px; height: 88px; }


    .archive-list { columns: 2; }

    .archive-tag { top: -14px; right: -4px; }
}
/* ----------------------------------------------------- стартовая */

.sheet-home {
    max-width: 640px;
    text-align: center;
    padding: 44px 30px 24px;
}

.sheet-home h1 {
    margin: 0;
}

.logo-big {
    width: 320px;
    height: 320px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.launcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 20px;
    margin: 30px 0 16px;
}

.launch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 150px;
    padding: 10px 6px;
    color: var(--ink);
    text-decoration: none;
    border: 2px solid transparent;
}

.launch img {
    width: 128px;
    height: 128px;
    display: block;
    transition: transform 0.08s;
}

.launch span {
    font-weight: bold;
    letter-spacing: 2px;
}

.launch:hover {
    border-color: var(--edge);
    background: rgba(255, 255, 255, 0.45);
}

.launch:hover img  { transform: translateY(-4px); }
.launch:hover span { color: var(--link); }

@media (max-width: 600px) {
    .sheet-home { padding: 24px 14px 20px; }
    .launch { width: 96px; padding: 6px 2px; }
    .launch img { width: 64px; height: 64px; }
}
