/* init6.pomorze.pl -- modern terminal theme.
   Palette and CRT treatment carried over from the earlier green-phosphor
   experiment; layout rewritten for the card grid. */

:root {
    --bg:          #060a06;
    --bg-raised:   #0c130c;
    --bg-inset:    #050805;
    --fg:          #33ff66;
    --fg-bright:   #c6ffd6;
    --fg-dim:      #46c46a;
    --fg-faint:    #2b7f45;
    --border:      #1f6b34;
    --border-soft: #133f20;
    --accent:      #7dfcff;
    --glow:        rgba(51, 255, 102, .45);
    --shadow:      0 0 0 1px var(--border-soft), 0 8px 24px rgba(0, 0, 0, .55);
    --radius:      3px;
    --mono: "Cascadia Mono", "JetBrains Mono", "Fira Mono", "Liberation Mono",
            "DejaVu Sans Mono", "Consolas", monospace;
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg:          #f4f6f2;
    --bg-raised:   #ffffff;
    --bg-inset:    #e9ece6;
    --fg:          #1d3d24;
    --fg-bright:   #07160c;
    --fg-dim:      #2f6b3d;
    --fg-faint:    #567a5e;
    --border:      #9db9a4;
    --border-soft: #c6d5c9;
    --accent:      #076b73;
    --glow:        transparent;
    --shadow:      0 0 0 1px var(--border-soft), 0 6px 18px rgba(20, 40, 25, .10);
    color-scheme: light;
}

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

/* Author `display` declarations beat the UA sheet's [hidden] rule, so a card
   that JS hides would otherwise stay on screen. This is what makes the search
   and the OS filter actually hide anything. */
[hidden] { display: none !important; }

body {
    margin: 0;
    padding: 0 1.25rem 4rem;
    background: var(--bg);
    color: var(--fg);
    font: 1rem/1.6 var(--mono);
    text-shadow: 0 0 6px var(--glow);
    overflow-x: hidden;
}

/* CRT scanlines -- decorative, dark theme only, never intercepts clicks. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(to bottom,
            rgba(0,0,0,0) 0px, rgba(0,0,0,0) 1px,
            rgba(0,0,0,.16) 2px, rgba(0,0,0,.16) 3px),
        radial-gradient(ellipse at center, rgba(0,0,0,0) 62%, rgba(0,0,0,.42) 100%);
    animation: flicker 7s infinite;
}
html[data-theme="light"] body::before { display: none; }

@keyframes flicker {
    0%, 91%, 100% { opacity: 1; }
    93% { opacity: .86; }
    95% { opacity: 1; }
    97% { opacity: .92; }
}

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    * { transition: none !important; }
}

::selection { background: var(--fg); color: var(--bg); text-shadow: none; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover, a:focus-visible { border-bottom-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 66rem; margin: 0 auto; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}

/* ---- top bar ---- */
.topbar {
    display: flex; flex-wrap: wrap; gap: .75rem 1.25rem;
    align-items: baseline; justify-content: space-between;
    padding: 1rem 0; margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}
.prompt { color: var(--fg-faint); white-space: nowrap; }
.prompt b { color: var(--fg-bright); font-weight: 600; }
.prompt .cursor {
    display: inline-block; width: .6em; height: 1.05em;
    background: var(--fg); vertical-align: -.18em; animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .prompt .cursor { animation: none; } }

.topnav { display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: center; margin: 0; padding: 0; list-style: none; }
.topnav a { color: var(--fg-dim); }
.topnav a[aria-current="page"] { color: var(--fg-bright); border-bottom-color: var(--fg-bright); }
.topnav .sep { color: var(--border); }

.lang a { color: var(--fg-faint); padding: 0 .15rem; }
.lang a[aria-current="true"] { color: var(--fg-bright); font-weight: 700; }

.theme-toggle {
    background: transparent; border: 1px solid var(--border);
    color: var(--fg-dim); font: inherit; font-size: .85rem;
    padding: .15rem .6rem; border-radius: var(--radius); cursor: pointer;
}
.theme-toggle:hover { color: var(--fg-bright); border-color: var(--fg-dim); }
.theme-toggle .dot {
    display: inline-block; width: .8em; height: .8em; border-radius: 50%;
    border: 1px solid currentColor; vertical-align: -.06em;
    background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* ---- headers ---- */
.ascii {
    margin: 0; color: var(--fg-bright);
    /* overflow-x alone would make overflow-y compute to `auto`, and
       line-height rounding then leaves a 1px vertical scrollbar. */
    overflow-x: auto; overflow-y: hidden;
    font-size: clamp(.42rem, 1.55vw, .8rem); line-height: 1.15;
    text-shadow: 0 0 8px var(--glow);
}
.lede { color: var(--fg-dim); margin: 1rem 0 0; max-width: 62ch; }
.lede strong { color: var(--fg-bright); }
.note { color: var(--fg-faint); font-size: .9rem; }

/* ---- controls ---- */
.controls {
    display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center;
    margin: 1.75rem 0 1.25rem; padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-soft);
}
.controls input[type="search"] {
    flex: 1 1 15rem; min-width: 0;
    background: var(--bg-inset); border: 1px solid var(--border);
    color: var(--fg); font: inherit; padding: .45rem .7rem; border-radius: var(--radius);
}
.controls input[type="search"]::placeholder { color: var(--fg-faint); }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.filters button {
    background: transparent; border: 1px solid var(--border);
    color: var(--fg-dim); font: inherit; font-size: .85rem;
    padding: .3rem .75rem; border-radius: var(--radius); cursor: pointer;
}
.filters button:hover { color: var(--fg-bright); }
.filters button[aria-pressed="true"] {
    background: var(--fg); color: var(--bg); border-color: var(--fg); text-shadow: none;
}

/* ---- card grid ---- */
.grid {
    display: grid; gap: 1rem; padding: 0; margin: 0; list-style: none;
    grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
}
.card {
    display: flex; flex-direction: column;
    background: var(--bg-raised); border: 1px solid var(--border-soft);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: var(--border); transform: translateY(-2px); }
.card-thumb {
    display: flex; align-items: center; justify-content: center;
    height: 10rem; flex: 0 0 auto; overflow: hidden;
    background: var(--bg-inset);
    border-bottom: 1px solid var(--border-soft);
}
/* Screenshots are native-size dialogs of wildly different shapes. Filling the
   card with a top-anchored crop keeps the UI readable and the rows even;
   `contain` left tall dialogs as an unreadable sliver between wide margins. */
.card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: top center;
}
.card-thumb .placeholder { color: var(--fg-faint); font-size: .8rem; }
.card-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card h2 { margin: 0; font-size: 1rem; color: var(--fg-bright); font-weight: 600; }
.card h2 a { color: inherit; }
.meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; color: var(--fg-faint); }
.badge { border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 0 .4rem; white-space: nowrap; }
.badge.version { color: var(--fg); border-color: var(--border); }
.card-desc { margin: 0; color: var(--fg-dim); font-size: .9rem; flex: 1; }
.card-actions { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .875rem; margin-top: .25rem; }
.no-results { color: var(--fg-faint); padding: 2rem 0; }

/* ---- detail page ---- */
.detail-head { margin-bottom: 1.5rem; }
.detail-head h1 { margin: 0 0 .35rem; font-size: 1.6rem; color: var(--fg-bright); }
.detail-head h1::after {
    content: "_"; color: var(--fg); animation: blink 1.2s steps(2) infinite;
}
@media (prefers-reduced-motion: reduce) { .detail-head h1::after { animation: none; } }
.downloads { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0; }
.btn {
    display: inline-block; border: 1px solid var(--border); border-radius: var(--radius);
    padding: .4rem .9rem; color: var(--fg-bright); background: var(--bg-raised);
}
.btn:hover { border-color: var(--fg-dim); background: var(--bg-inset); }
.btn.primary { background: var(--fg); border-color: var(--fg); color: var(--bg); text-shadow: none; }
.btn.primary:hover { filter: brightness(1.12); }

.section { margin: 2.5rem 0; }
.section > h2 {
    font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--fg-faint); font-weight: 600; margin: 0 0 .9rem;
    padding-bottom: .4rem; border-bottom: 1px solid var(--border-soft);
}
.prose { color: var(--fg-dim); max-width: 70ch; }
.prose em, .op { color: var(--fg-bright); font-style: normal; }
.prose pre { overflow-x: auto; background: var(--bg-inset); padding: .75rem; border-radius: var(--radius); }

.shots { display: flex; flex-direction: column; gap: 1rem; margin: 0; }
.shots img {
    max-width: 100%; height: auto; border: 1px solid var(--border-soft); border-radius: var(--radius);
}

.changelog { margin: 0; padding: 0; list-style: none; }
.release { border-left: 1px solid var(--border-soft); padding: 0 0 1.1rem 1.1rem; position: relative; }
.release:last-child { padding-bottom: 0; }
.release::before {
    content: ""; position: absolute; left: -3px; top: .55rem;
    width: 5px; height: 5px; background: var(--fg-dim); border-radius: 50%;
}
.release h3 { margin: 0; font-size: .95rem; color: var(--fg-bright); font-weight: 600; }
.release time { color: var(--fg-faint); font-size: .8rem; font-weight: 400; margin-left: .5rem; }
.release ul { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--fg-dim); font-size: .92rem; }
.release li { margin: .2rem 0; }

/* ---- projects / prose pages ---- */
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.media { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: flex-start; }
.media img { border: 1px solid var(--border-soft); border-radius: var(--radius); }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.contact-list .label { color: var(--fg-faint); display: inline-block; min-width: 6.5rem; }
.portrait { border: 1px solid var(--border-soft); border-radius: var(--radius); cursor: pointer; }

/* ---- footer ---- */
.site-footer {
    margin-top: 3.5rem; padding-top: 1.25rem;
    border-top: 1px solid var(--border-soft);
    color: var(--fg-faint); font-size: .85rem;
    display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
}

@media (max-width: 34rem) {
    body { padding-inline: .9rem; }
    .topbar { gap: .5rem; }
    .grid { grid-template-columns: 1fr; }
}
