/* RU(ghalt|nako) — one structure, two palettes */
:root,
:root[data-palette="rughalt"] {
    --gh-font-heading: Georgia, "Times New Roman", serif;
    --gh-font-body: Verdana, Geneva, Tahoma, sans-serif;
    --bg: #08101f;
    --bg-grid: rgba(122, 145, 226, 0.08);
    --paper: #111c35;
    --paper-2: #172449;
    --paper-3: #0c162b;
    --ink: #eaf0ff;
    --muted: #aebcdc;
    --accent: #91aaff;
    --accent-2: #c7b6ff;
    --line: #40558f;
    --line-bright: #7187d4;
    --shadow: #02050c;
    --glow: rgba(111, 137, 232, 0.27);
    --good: #7fe2c4;
    --link: #a9bcff;
    --visited: #d2b7ff;
    --selection: #4c5fa7;
    --noise: 0.15;
}

:root[data-palette="runako"] {
    --bg: #f6eaf4;
    --bg-grid: rgba(150, 82, 139, 0.09);
    --paper: #fff8fd;
    --paper-2: #f7ddeb;
    --paper-3: #f1e7f7;
    --ink: #3d2941;
    --muted: #755d79;
    --accent: #a2437e;
    --accent-2: #7551a1;
    --line: #bd81ab;
    --line-bright: #934b82;
    --shadow: #d5bad1;
    --glow: rgba(191, 94, 154, 0.18);
    --good: #357f6b;
    --link: #92346f;
    --visited: #6f4a91;
    --selection: #efb9d9;
    --noise: 0.08;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
        radial-gradient(circle at 18% 0%, var(--glow), transparent 34rem);
    background-size: 24px 24px, 24px 24px, auto;
    font-family: var(--gh-font-body);
    font-size: 15px;
    line-height: 1.65;
    transition: color 160ms ease, background-color 160ms ease;
}

::selection { background: var(--selection); color: var(--ink); }
a { color: var(--link); text-underline-offset: 0.18em; }
a:visited { color: var(--visited); }
a:hover { text-decoration-style: wavy; }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; height: auto; }

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

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.6rem 0.8rem;
    transform: translateY(-180%);
    color: var(--paper);
    background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-shell {
    width: min(1080px, calc(100% - 28px));
    margin: 24px auto;
    border: 1px solid var(--line-bright);
    outline: 3px double var(--line);
    background: var(--paper-3);
    box-shadow: 8px 8px 0 var(--shadow), 0 0 34px var(--glow);
}

.site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.site-header__topline {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.22rem 0.7rem;
    color: var(--muted);
    background: var(--paper-3);
    border-bottom: 1px dotted var(--line);
    font: 10px/1.5 "Courier New", monospace;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.site-header__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 1.35rem 1rem;
    background:
        linear-gradient(135deg, transparent 75%, var(--bg-grid) 75%) 0 0 / 12px 12px,
        var(--paper);
}

.site-brand {
    display: inline-flex;
    align-items: baseline;
    color: var(--ink);
    text-decoration: none;
    text-shadow: 2px 2px 0 var(--glow);
}
.site-brand:visited { color: var(--ink); }
.site-brand:hover { text-decoration: none; }
.site-brand__mark {
    display: inline-grid;
    place-items: center;
    width: 2.7rem;
    height: 2.7rem;
    margin-right: 0.32rem;
    border: 1px solid var(--line-bright);
    outline: 1px solid var(--paper);
    background: var(--accent);
    color: var(--paper-3);
    font: 700 1.15rem/1 Georgia, serif;
    transform: rotate(-2deg);
    box-shadow: 3px 3px 0 var(--shadow);
}
.site-brand__name {
    font: 700 clamp(1.6rem, 4vw, 2.45rem)/1 Georgia, "Times New Roman", serif;
    letter-spacing: -0.055em;
}

.palette-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px;
    border: 1px solid var(--line);
    background: var(--paper-3);
    box-shadow: inset 1px 1px 0 var(--shadow);
}
.palette-switch__button {
    min-width: 7.2rem;
    padding: 0.4rem 0.55rem;
    border: 0;
    color: var(--muted);
    background: transparent;
    font: 700 0.7rem/1.2 "Courier New", monospace;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}
.palette-switch__button:hover { color: var(--ink); }
.palette-switch__button[aria-pressed="true"] {
    color: var(--paper-3);
    background: var(--accent);
    box-shadow: 1px 1px 0 var(--line-bright);
}

.site-nav {
    padding: 0.4rem 1rem;
    background: var(--paper-2);
    border-top: 1px solid var(--line);
}
.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.nav-list__item a {
    color: var(--ink);
    font: 700 0.72rem/1.8 "Courier New", monospace;
    text-transform: lowercase;
}
.nav-list__item a::before { content: "[ "; color: var(--accent); }
.nav-list__item a::after { content: " ]"; color: var(--accent); }
.nav-list__item.is-current a { text-decoration-thickness: 2px; }

.marquee {
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    color: var(--paper-3);
    background: var(--accent);
    white-space: nowrap;
}
.marquee__track {
    display: inline-block;
    min-width: 100%;
    padding: 0.26rem 0;
    font: 700 0.68rem/1.2 "Courier New", monospace;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.site-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 244px;
    gap: 1px;
    background: var(--line);
}
.site-main, .sidebar { background: var(--paper-3); }
.site-main { min-width: 0; padding: clamp(1rem, 3vw, 2rem); }
.sidebar { padding: 1rem; }

.intro-panel,
.archive-header,
.article,
.error-page,
.comments-panel {
    margin-bottom: 1.5rem;
    padding: clamp(1rem, 3vw, 1.6rem);
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--shadow);
}

.eyebrow {
    margin: 0 0 0.55rem;
    color: var(--accent);
    font: 700 0.7rem/1.4 "Courier New", monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.intro-panel h1,
.archive-header h1,
.article__header h1,
.error-page h1 {
    margin: 0;
    font: 700 clamp(2rem, 7vw, 3.5rem)/1.05 Georgia, "Times New Roman", serif;
    letter-spacing: -0.045em;
}
.intro-panel__lede,
.article__excerpt {
    max-width: 46rem;
    margin: 0.8rem 0;
    color: var(--ink);
    font: 1.05rem/1.65 Georgia, serif;
}
.intro-panel__note {
    margin: 1.1rem 0 0;
    padding: 0.7rem 0.8rem;
    border-left: 4px solid var(--accent);
    color: var(--muted);
    background: var(--paper-3);
    font-size: 0.82rem;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.8rem;
    padding-bottom: 0.35rem;
    border-bottom: 3px double var(--line-bright);
}
.section-heading h2 {
    margin: 0;
    font: 700 1rem/1.4 "Courier New", monospace;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.section-heading > span { color: var(--muted); font-size: 0.7rem; }

.post-list { display: grid; gap: 0.8rem; }
.post-card {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    min-width: 0;
    border: 1px solid var(--line);
    background: var(--paper);
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.post-card:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--shadow); }
.post-card__date {
    padding: 0.8rem 0.55rem;
    border-right: 1px dotted var(--line);
    color: var(--muted);
    background: var(--paper-2);
    font: 700 0.62rem/1.3 "Courier New", monospace;
    text-align: center;
    text-transform: uppercase;
}
.post-card__date span {
    display: block;
    color: var(--accent);
    font: 700 1.75rem/1 Georgia, serif;
}
.post-card__body { min-width: 0; padding: 0.85rem 1rem 1rem; }
.post-card__meta { display: flex; flex-wrap: wrap; gap: 0.55rem; color: var(--muted); font: 0.68rem/1.4 "Courier New", monospace; }
.post-card__meta a { color: var(--accent); }
.tiny-label { padding: 0 0.25rem; color: var(--paper-3); background: var(--accent); text-transform: uppercase; }
.post-card h3 { margin: 0.3rem 0; font: 700 1.35rem/1.25 Georgia, serif; }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { color: var(--accent); text-decoration: underline; }
.post-card p { margin: 0.35rem 0; color: var(--muted); font-size: 0.86rem; }
.read-more { font: 700 0.7rem/1.3 "Courier New", monospace; text-transform: uppercase; }

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line);
    background: var(--paper);
    font: 700 0.68rem/1.4 "Courier New", monospace;
    text-transform: uppercase;
}
.pagination > :last-child { text-align: right; }

.widget {
    margin-bottom: 0.9rem;
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 3px 3px 0 var(--shadow);
}
.widget__title {
    padding: 0.28rem 0.5rem;
    color: var(--paper-3);
    background: var(--accent);
    font: 700 0.68rem/1.3 "Courier New", monospace;
    letter-spacing: 0.03em;
}
.widget > p,
.widget > dl,
.widget > .web-ring,
.widget > .retro-button { margin: 0.65rem; }
.portrait {
    display: block;
    aspect-ratio: 1;
    width: calc(100% - 1.3rem);
    margin: 0.65rem;
    border: 1px solid var(--line);
    object-fit: cover;
    background: var(--paper-2);
    image-rendering: auto;
}
:root[data-palette="rughalt"] .portrait--runako,
:root[data-palette="runako"] .portrait--rughalt { display: none; }
.portrait-widget__caption { color: var(--muted); font: italic 0.68rem/1.4 Georgia, serif; text-align: center; }
.status-line { font-size: 0.76rem; line-height: 1.45; }
.status-dot {
    display: inline-block;
    width: 0.58rem;
    height: 0.58rem;
    margin-right: 0.4rem;
    border: 1px solid var(--good);
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 6px var(--good);
}
.mini-list { font: 0.7rem/1.4 "Courier New", monospace; }
.mini-list > div { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.18rem 0; border-top: 1px dotted var(--line); }
.mini-list dt { color: var(--muted); }
.mini-list dd { margin: 0; color: var(--accent); text-align: right; }
.now-playing { color: var(--muted); font-size: 0.75rem; }
.now-playing span { color: var(--accent); }
.web-ring { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font: 700 0.64rem/1.3 "Courier New", monospace; text-transform: uppercase; }
.web-ring a { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 1px solid var(--line); background: var(--paper-2); text-decoration: none; }
.retro-button {
    display: inline-block;
    padding: 0.38rem 0.62rem;
    border: 1px solid var(--line-bright);
    outline: 1px solid var(--paper-3);
    color: var(--paper-3);
    background: var(--accent);
    box-shadow: 2px 2px 0 var(--shadow);
    font: 700 0.68rem/1.3 "Courier New", monospace;
    text-decoration: none;
    text-transform: uppercase;
}
.retro-button:visited { color: var(--paper-3); }
.retro-button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
.badge-rack { display: grid; grid-template-columns: repeat(2, 88px); justify-content: center; gap: 0.35rem; margin-top: 1.2rem; }
.pixel-badge { display: grid; place-items: center; overflow: hidden; width: 88px; height: 31px; padding: 2px 4px; border: 1px solid var(--line-bright); color: var(--ink); background: repeating-linear-gradient(135deg, var(--paper-2) 0 4px, var(--paper) 4px 8px); font: 700 9px/0.95 "Courier New", monospace; letter-spacing: 0.04em; text-align: center; text-decoration: none; text-shadow: 1px 1px 0 var(--paper-3); overflow-wrap: anywhere; }
.pixel-badge:visited { color: var(--ink); }
.pixel-badge:hover { color: var(--paper-3); background: var(--accent); text-decoration: none; }

.article__meta { margin: 0 0 0.6rem; color: var(--muted); font: 0.72rem/1.4 "Courier New", monospace; }
.article__feature { margin: 1.2rem 0 0; }
.article__feature img { display: block; width: 100%; border: 1px solid var(--line); }
.article__feature figcaption { padding-top: 0.35rem; color: var(--muted); font-size: 0.72rem; }
.article__footer { margin-top: 2rem; padding-top: 1rem; border-top: 3px double var(--line); }
.tag-list { font: 0.7rem/1.6 "Courier New", monospace; }

.gh-content { margin-top: 1.7rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; line-height: 1.8; }
.gh-content > * { min-width: 100%; max-width: 100%; }
.gh-content h2, .gh-content h3, .gh-content h4 { margin: 1.7em 0 0.55em; line-height: 1.25; }
.gh-content h2 { padding-bottom: 0.2rem; border-bottom: 1px dotted var(--line); font-size: 1.6rem; }
.gh-content h3 { font-size: 1.3rem; }
.gh-content p, .gh-content ul, .gh-content ol { margin: 0 0 1.15em; }
.gh-content blockquote { margin: 1.4rem 0; padding: 0.6rem 1rem; border-left: 5px solid var(--accent); color: var(--muted); background: var(--paper-3); }
.gh-content blockquote p:last-child { margin-bottom: 0; }
.gh-content code { padding: 0.1em 0.25em; border: 1px solid var(--line); background: var(--paper-3); font: 0.86em/1.4 "Courier New", monospace; }
.gh-content pre { overflow-x: auto; padding: 1rem; border: 1px solid var(--line); background: var(--paper-3); }
.gh-content pre code { padding: 0; border: 0; }
.gh-content hr { margin: 2rem auto; border: 0; border-top: 3px double var(--line-bright); }
.gh-content table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.88rem; }
.gh-content th, .gh-content td { padding: 0.45rem 0.65rem; border: 1px solid var(--line); }
.gh-content th { background: var(--paper-2); }
.gh-content img { border: 1px solid var(--line); }
.kg-width-wide, .kg-width-full { position: relative; width: 100%; }
.kg-gallery-container, .kg-gallery-row { display: flex; gap: 0.5rem; }
.kg-gallery-row:not(:first-of-type) { margin-top: 0.5rem; }
.kg-gallery-image { flex: 1 1 0; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.kg-bookmark-card a { text-decoration: none; }
.kg-bookmark-container { display: flex; overflow: hidden; border: 1px solid var(--line); color: var(--ink); background: var(--paper-3); }
.kg-bookmark-content { flex: 1; padding: 1rem; }
.kg-bookmark-thumbnail { width: 34%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; border: 0; object-fit: cover; }
.kg-bookmark-title { font-weight: 700; }
.kg-bookmark-description, .kg-bookmark-metadata { color: var(--muted); font: 0.75rem/1.4 Verdana, sans-serif; }
.kg-callout-card { padding: 1rem; border: 1px solid var(--line); background: var(--paper-2); }
.kg-button-card .kg-btn { color: var(--paper-3); background: var(--accent); }

.error-page { text-align: center; }
.error-page__code { margin: 0; color: var(--accent); font: 700 5rem/1 "Courier New", monospace; }
.empty-state { padding: 1.4rem; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.empty-state h3 { margin: 0; color: var(--ink); }

/* Portfolio custom page: add Product cards in the Ghost editor. */
.portfolio-page { min-width: 0; }
.portfolio-header {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    padding: clamp(1rem, 3vw, 1.6rem);
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--shadow);
}
.portfolio-header::after {
    content: "PORTFOLIO.EXE";
    position: absolute;
    top: 0.55rem;
    right: 0.7rem;
    color: var(--line);
    font: 700 0.62rem/1 "Courier New", monospace;
    letter-spacing: 0.08em;
}
.portfolio-header h1 {
    margin: 0;
    font: 700 clamp(2rem, 7vw, 3.5rem)/1.05 var(--gh-font-heading);
    letter-spacing: -0.045em;
}
.portfolio-header__lede {
    max-width: 42rem;
    margin: 0.75rem 0 0;
    color: var(--muted);
    font: 1rem/1.65 var(--gh-font-heading);
}
.portfolio-header__image {
    display: block;
    width: 100%;
    max-height: 18rem;
    margin-top: 1rem;
    border: 1px solid var(--line);
    object-fit: cover;
}
.portfolio-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0;
}
.portfolio-content > :not(.kg-product-card) { grid-column: 1 / -1; }
.portfolio-content > .kg-product-card { min-width: 0; margin: 0; }
.portfolio-content .kg-product-card-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.7rem;
    border: 1px solid var(--line-bright);
    border-radius: 0;
    color: var(--ink);
    background:
        linear-gradient(135deg, transparent 82%, var(--bg-grid) 82%) 0 0 / 10px 10px,
        var(--paper);
    box-shadow: 4px 4px 0 var(--shadow);
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.portfolio-content .kg-product-card-container:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--shadow);
}
.portfolio-content .kg-product-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    background: var(--paper-3);
    object-fit: contain;
}
.portfolio-content .kg-product-card-title-container { margin-top: 0.7rem; }
.portfolio-content .kg-product-card-title {
    margin: 0;
    color: var(--ink);
    font: 700 1.25rem/1.2 var(--gh-font-heading);
}
.portfolio-content .kg-product-card-title::before {
    content: "[project] ";
    color: var(--accent);
    font: 700 0.62rem/1 "Courier New", monospace;
    text-transform: uppercase;
}
.portfolio-content .kg-product-card-description {
    flex: 1;
    margin: 0.55rem 0 0.8rem;
    color: var(--muted);
    font: 0.8rem/1.55 var(--gh-font-body);
}
.portfolio-content .kg-product-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 2rem;
    padding: 0.38rem 0.65rem;
    border: 1px solid var(--line-bright);
    border-radius: 0;
    color: var(--paper-3);
    background: var(--accent);
    box-shadow: 2px 2px 0 var(--shadow);
    font: 700 0.66rem/1.2 "Courier New", monospace;
    text-decoration: none;
    text-transform: uppercase;
}
.portfolio-content .kg-product-card-button:hover { text-decoration: underline; }
.portfolio-content .kg-product-card-rating { color: var(--accent); }

@media (max-width: 620px) {
    .portfolio-content { grid-template-columns: 1fr; }
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: var(--paper);
    font: 0.65rem/1.5 "Courier New", monospace;
}
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 760px) {
    .site-shell { width: calc(100% - 18px); margin: 12px auto; box-shadow: 4px 4px 0 var(--shadow); }
    .site-header__main { align-items: stretch; flex-direction: column; }
    .palette-switch__button { min-width: 0; }
    .site-grid { grid-template-columns: 1fr; }
    .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; border-top: 1px solid var(--line); }
    .widget { margin: 0; }
    .portrait-widget { grid-row: span 2; }
    .badge-rack { align-content: start; margin: 0; }
}

@media (max-width: 500px) {
    body { font-size: 14px; }
    .site-header__topline span:last-child { display: none; }
    .site-header__main { padding: 1rem; }
    .site-brand__name { font-size: 1.75rem; }
    .site-main { padding: 0.8rem; }
    .sidebar { display: block; }
    .sidebar > * { margin-bottom: 0.8rem; }
    .post-card { grid-template-columns: 55px minmax(0, 1fr); }
    .post-card__body { padding: 0.75rem; }
    .site-footer { flex-direction: column; }
}
