/* =============================================================================
   vikibystra.com — static site
   ========================================================================== */

/* ----------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */
:root {
    --paper: #fbf8f3;
    --paper-deep: #f2ece3;
    --card: #ffffff;
    --ink: #1f1b18;
    --ink-soft: #5b534c;
    --ink-mute: #736a62;
    --line: #e6dfd4;
    --brand: #1bd2ff;                        /* cyan from the original logo */
    --brand-wash: rgba(27, 210, 255, 0.34);
    --accent: #087096;                       /* the same blue, dark enough for text */

    --radius: 16px;
    --shadow: 0 1px 2px rgba(31, 27, 24, 0.05), 0 12px 32px -16px rgba(31, 27, 24, 0.28);
    --shadow-lift: 0 2px 4px rgba(31, 27, 24, 0.06), 0 30px 60px -26px rgba(31, 27, 24, 0.45);

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", P052, "Book Antiqua", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

    --wrap: 1200px;
    --gutter: clamp(16px, 4vw, 40px);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1 0 auto;
}

img,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: inherit;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

p,
figure {
    margin: 0;
}

::selection {
    background: var(--brand-wash);
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

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

.skip-link {
    position: absolute;
    z-index: 100;
    top: 12px;
    left: 16px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.2s;
}

.skip-link:focus {
    transform: none;
}

/* Marker-pen highlight in the logo colour */
.hl {
    text-decoration-line: underline;
    text-decoration-color: var(--brand-wash);
    text-decoration-thickness: 0.3em;
    text-underline-offset: -0.3em;
    text-decoration-skip-ink: none;
}

/* ----------------------------------------------------------------------------
   Header & navigation
   ------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(251, 248, 243, 0.88);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
}

/* Logo: "BYSTRA" in the original logo cyan with "illustrator" underneath.
   On the home page it is wrapped in the page's h1. */
.brand-title {
    margin: 0;
    font: inherit;
    letter-spacing: normal;
}

.brand {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    font-family: var(--sans);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.brand-name {
    color: var(--brand);
    font-family: var(--serif);          /* same face as the card labels */
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand-sub {
    color: #5a534d;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-list a {
    display: block;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s, background-color 0.2s;
}

.nav-list a:hover {
    color: var(--ink);
    background: var(--paper-deep);
}

.nav-list a[aria-current="page"] {
    color: var(--ink);
    background: var(--brand-wash);
}

.nav-toggle {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.nav-toggle:hover {
    background: var(--paper-deep);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background-color: currentColor;
    transition: transform 0.3s var(--ease), background-color 0.2s;
}

.nav-toggle-bars {
    position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-toggle-bars::before {
    top: -7px;
}

.nav-toggle-bars::after {
    top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
    .header-bar {
        min-height: 64px;
    }

    .brand-name {
        font-size: 1.55rem;
    }

    .nav-toggle {
        display: grid;
    }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        padding: 8px var(--gutter) 20px;
        background: var(--paper);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 28px 40px -28px rgba(31, 27, 24, 0.35);
    }

    .site-nav.is-open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-list a {
        padding: 13px 16px;
        border-radius: 12px;
        font-size: 1.05rem;
    }

    /* Without JavaScript the menu simply stays visible under the logo */
    .no-js .nav-toggle {
        display: none;
    }

    .no-js .header-bar {
        flex-wrap: wrap;
        padding-block: 14px 8px;
    }

    .no-js .site-nav {
        position: static;
        display: block;
        width: 100%;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }

    .no-js .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .no-js .nav-list a {
        padding: 8px 12px;
        font-size: 0.95rem;
    }
}

/* ----------------------------------------------------------------------------
   Home
   ------------------------------------------------------------------------- */
.home {
    padding-top: clamp(28px, 5vw, 56px);
}

.cards {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(16px, 2.4vw, 28px);
    padding-bottom: clamp(56px, 8vw, 104px);
}

.card {
    grid-column: span 2;
}

/* Centre an incomplete last row (5 cards = 3 + 2) */
.card:nth-child(3n + 1):nth-last-child(2) {
    grid-column: 2 / span 2;
}

.card:nth-child(3n + 1):last-child {
    grid-column: 3 / span 2;
}

.card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.card-media {
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--paper-deep);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--ease);
}

.card-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 18px 22px;
    font-family: var(--serif);
    font-size: 1.35rem;
    line-height: 1.2;
}

.card-arrow {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    transition: background-color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}

.card-arrow svg {
    width: 16px;
    height: 16px;
}

.card-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}

.card-link:hover img {
    transform: scale(1.05);
}

.card-link:hover .card-arrow,
.card-link:focus-visible .card-arrow {
    background: var(--brand);
    border-color: var(--brand);
    transform: translateX(3px);
}

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

    .cards > .card:nth-child(n) {
        grid-column: span 2;
    }

    .cards > .card:nth-child(odd):last-child {
        grid-column: 2 / span 2;
    }
}

@media (max-width: 560px) {
    .cards {
        display: flex;
        flex-direction: column;
    }
}

/* ----------------------------------------------------------------------------
   Inner pages
   ------------------------------------------------------------------------- */
.page-head {
    padding-block: clamp(40px, 7vw, 80px) clamp(28px, 4vw, 44px);
}

.page-title {
    font-size: clamp(1.2rem, 3vw, 2rem);
}

/* Galleries: thumbnails open the full picture in the lightbox */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2.2vw, 26px);
    padding-bottom: clamp(56px, 8vw, 104px);
}

.gallery a {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--radius);
    background: var(--paper-deep);
    box-shadow: var(--shadow);
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--ease);
}

.gallery a::after {
    content: "";
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1b18' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 18px no-repeat;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(6px) scale(0.9);
    transition: opacity 0.3s, transform 0.3s var(--ease);
}

.gallery a:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}

.gallery a:hover img {
    transform: scale(1.05);
}

.gallery a:hover::after,
.gallery a:focus-visible::after {
    opacity: 1;
    transform: none;
}

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

@media (max-width: 560px) {
    .gallery {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Applications */
.apps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
    gap: 24px;
    padding-bottom: clamp(56px, 8vw, 104px);
}

.app-link {
    display: flex;
    align-items: center;
    gap: 22px;
    height: 100%;
    padding: 22px 26px 22px 22px;
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.app-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}

.app-icon {
    flex: none;
    width: 108px;
    height: 108px;
    filter: drop-shadow(0 10px 14px rgba(150, 80, 0, 0.22));
}

.app-name {
    font-size: 1.65rem;
}

.app-store {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px 6px 14px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.app-store svg {
    width: 14px;
    height: 14px;
}

.app-link:hover .app-store {
    background: var(--accent);
}

/* Two-column layout: contact & 404 */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: clamp(40px, 7vw, 96px);
    padding-block: clamp(40px, 7vw, 88px) clamp(64px, 9vw, 120px);
}

.postcard {
    padding: 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-lift);
    transform: rotate(2.5deg);
}

.postcard img {
    width: 100%;
    border-radius: 6px;
}

@media (max-width: 800px) {
    .split {
        grid-template-columns: minmax(0, 1fr);
    }

    .postcard {
        max-width: 440px;
        transform: rotate(1.5deg);
    }
}

/* Contact */
.email {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(1.15rem, 3.2vw, 2rem);
    line-height: 1.25;
    text-decoration: none;
}

.email-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand);
    color: #06313f;
    transition: transform 0.3s var(--ease);
}

.email-icon svg {
    width: 24px;
    height: 24px;
}

.email-text {
    overflow-wrap: anywhere;
    background: linear-gradient(var(--brand-wash), var(--brand-wash)) 0 100% / 100% 0.14em no-repeat;
    transition: background-size 0.35s var(--ease);
}

.email:hover .email-text,
.email:focus-visible .email-text {
    background-size: 100% 0.45em;
}

.email:hover .email-icon {
    transform: rotate(-8deg) scale(1.05);
}

@media (max-width: 560px) {
    .email {
        gap: 12px;
    }

    .email-icon {
        width: 46px;
        height: 46px;
    }

    .email-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* 404 */
.nf-code {
    font-family: var(--serif);
    font-size: clamp(4.5rem, 14vw, 9rem);
    line-height: 0.9;
    letter-spacing: -0.03em;
}

.nf-title {
    margin-top: 16px;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
}

.nf-text {
    max-width: 38ch;
    margin-top: 16px;
    color: var(--ink-soft);
    font-size: 1.1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 32px;
    padding: 14px 24px 14px 20px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s var(--ease);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

/* ----------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--line);
    color: var(--ink-mute);
    font-size: 0.9rem;
}

.footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 26px 32px;
}

.site-footer a {
    color: var(--ink-soft);
    text-decoration-color: var(--line);
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.site-footer a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

/* ----------------------------------------------------------------------------
   Lightbox (created by js/site.js)
   ------------------------------------------------------------------------- */
html.lb-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(20, 17, 15, 0.95);
    color: #fff;
    overscroll-behavior: contain;
}

.lightbox[open] {
    display: block;
    animation: lb-in 0.25s ease-out;
}

.lightbox::backdrop {
    background: transparent;
}

.lb-stage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.lb-img {
    width: auto;
    max-width: calc(100vw - 176px);
    height: auto;
    max-height: calc(100vh - 144px);
    border-radius: 4px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: scale(0.985);
    transition: opacity 0.35s ease, transform 0.35s var(--ease);
}

.lb-img.is-ready {
    opacity: 1;
    transform: none;
}

.lb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    animation: lb-spin 0.8s linear infinite;
}

.lightbox.is-loading .lb-spinner {
    opacity: 1;
}

.lb-count {
    position: absolute;
    top: 26px;
    left: 28px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
}

.lb-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lb-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lb-btn:focus-visible {
    outline-color: var(--brand);
}

.lb-btn svg {
    width: 22px;
    height: 22px;
}

.lb-close {
    top: 14px;
    right: 14px;
}

.lb-prev,
.lb-next {
    top: 50%;
    margin-top: -24px;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

.lightbox.is-single .lb-prev,
.lightbox.is-single .lb-next {
    display: none;
}

@supports (height: 100dvh) {
    .lb-img {
        max-height: calc(100dvh - 144px);
    }
}

@media (max-width: 640px) {
    .lightbox .lb-img {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 176px);
        max-height: calc(100dvh - 176px);
    }

    .lb-prev,
    .lb-next {
        top: auto;
        bottom: 24px;
        margin-top: 0;
    }

    .lb-prev {
        left: calc(50% - 64px);
    }

    .lb-next {
        right: calc(50% - 64px);
    }
}

@keyframes lb-in {
    from {
        opacity: 0;
    }
}

@keyframes lb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ----------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
