/* ============================================================
   Public site — Artebottega portfolio
   Etap 3: replace Codex draft. Layout, typography, masonry,
   mobile sidebar. PhotoSwipe lightbox lands in Etap 4.
   ============================================================ */

:root {
    --bg: #ffffff;
    --ink: #111111;
    --ink-soft: #8d8d8d;
    --line: #e2e2e2;
    --soft: #f7f7f8;
    --accent: #e23b3b;
    --danger: #a51e22;
    --gap: 17px;
    --sidebar-w: 270px;
    --sidebar-gutter: 16px;
    --sidebar-top: 14px;
    --max-content: 1700px;
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-feature-settings: "ss01", "cv11";
    line-height: 1.3;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

/* ------------------------------------------------------------
   Layout shell
   ------------------------------------------------------------ */

.site-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: var(--gap);
    padding: var(--sidebar-top) var(--sidebar-gutter) 0 var(--sidebar-gutter);
    min-height: 100vh;
    max-width: var(--max-content);
    margin: 0 auto;
}

main {
    min-width: 0;
    padding-bottom: 80px;
}

/* ------------------------------------------------------------
   Sidebar (.brand)
   ------------------------------------------------------------ */

.brand {
    position: sticky;
    top: var(--sidebar-top);
    align-self: start;
    height: calc(100vh - var(--sidebar-top));
    padding: 12px 0 14px;
    border-top: 4px solid var(--ink);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand__name {
    display: block;
    margin: 0 0 18px;
    font-size: 46px;
    line-height: 0.95;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--ink);
}
.brand__name:hover { text-decoration: none; }

.brand__meta {
    margin-bottom: 26px;
}
.brand__meta strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
    line-height: 1.15;
    font-weight: 700;
}
.brand__meta p {
    margin: 0;
    max-width: none;
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.45;
}

.brand__nav {
    border-top: 1px solid var(--line);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    overflow-y: auto;
    flex: 0 1 auto;
    margin-bottom: 16px;
}
.brand__nav a {
    display: block;
    padding: 7px 0 6px;
    border-bottom: 1px solid var(--line);
    transition: color 0.15s;
}
.brand__nav a:hover { color: var(--accent); text-decoration: none; }
.brand__nav a.is-active { color: var(--accent); }

.brand__footer {
    margin-top: auto;
    padding-top: 16px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.45;
    display: grid;
    gap: 8px;
}
.brand__footer a { color: var(--ink); }
.brand__footer a:hover { color: var(--accent); text-decoration: none; }

.brand__contact-link {
    color: var(--ink);
    cursor: pointer;
}
.brand__contact-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.brand__social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.brand__social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 14px;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.brand__social a:hover {
    background: var(--ink);
    color: #ffffff;
    border-color: var(--ink);
    text-decoration: none;
}

/* ------------------------------------------------------------
   Mobile top bar — hidden on desktop, sticky header on phones
   ------------------------------------------------------------ */

.mobile-topbar { display: none; }

.brand__close { display: none; }

/* ------------------------------------------------------------
   Work grid (masonry via CSS multicol)
   ------------------------------------------------------------ */

.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;
}

[x-cloak] { display: none !important; }

.work-grid {
    position: relative;
    line-height: 0;
}
/* JS masonry positions cards absolutely; the CSS below is a no-JS fallback */
.work-grid .work-card { display: block; margin-bottom: var(--gap); }

.work-card {
    position: relative;
    display: block;
    break-inside: avoid;
    margin: 0 0 var(--gap);
}
.work-card:hover { text-decoration: none; }

.work-card picture,
.work-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Green blinking dot — only on cards that link to a project page */
.work-card__pin {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.28);
    pointer-events: none;
    animation: card-pin-blink 1.8s ease-in-out infinite;
}
@keyframes card-pin-blink {
    0%, 100% { box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.28); }
    50%      { box-shadow: 0 0 0 7px rgba(46, 204, 113, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .work-card__pin { animation: none; }
}

.work-card__title {
    margin: 8px 12px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.work-empty {
    padding: 14px 0;
    color: var(--ink-soft);
    font-size: 13px;
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */

.pager {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 30px;
    line-height: 1.4;
}
.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--bg);
}
.pager a:hover { background: var(--ink); color: #ffffff; border-color: var(--ink); text-decoration: none; }
.pager .is-active { background: var(--ink); color: #ffffff; border-color: var(--ink); }
.pager .is-disabled { opacity: 0.35; pointer-events: none; }

/* ------------------------------------------------------------
   Project page
   ------------------------------------------------------------ */

.project { max-width: 1200px; }

.project__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}
.project__back:hover { color: var(--ink); text-decoration: none; }
.project__back::before { content: "←"; }

.project__header { margin-bottom: 30px; }

.project__title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4.6vw, 56px);
    line-height: 1.04;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.project__meta {
    color: var(--ink-soft);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.project__description {
    margin-top: 14px;
    max-width: 760px;
    color: #444;
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-line;
}

.project__gallery {
    display: grid;
    gap: var(--gap);
}
.project__gallery picture,
.project__gallery img {
    width: 100%;
    height: auto;
    display: block;
    background: var(--soft);
}

/* ------------------------------------------------------------
   Unlock panel (locked projects)
   ------------------------------------------------------------ */

.unlock-panel {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    line-height: 1.4;
}

.unlock-card {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    background: #ffffff;
    padding: 28px;
}
.unlock-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
}
.unlock-card p {
    margin: 0 0 20px;
    color: var(--ink-soft);
    font-size: 13px;
}

.unlock-card label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    margin-bottom: 6px;
    font-weight: 700;
}

.unlock-card input[type="password"] {
    width: 100%;
    border: 1px solid var(--line);
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
    color: var(--ink);
}
.unlock-card input[type="password"]:focus { outline: 0; border-color: var(--ink); }

.unlock-card .actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.unlock-card button,
.unlock-card .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #ffffff;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}
.unlock-card .button--secondary { background: #ffffff; color: var(--ink); }

.unlock-card .error {
    margin-top: 12px;
    color: var(--danger);
    font-size: 13px;
}

/* ------------------------------------------------------------
   Contact form modal
   ------------------------------------------------------------ */

.contact-panel {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow-y: auto;
}

.contact-card {
    position: relative;
    width: min(480px, 100%);
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 36px 32px 28px;
    line-height: 1.4;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.contact-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.contact-card__lead {
    margin: 0 0 22px;
    color: var(--ink-soft);
    font-size: 13px;
}

.contact-card__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--ink-soft);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.contact-card__close:hover { color: var(--ink); }

.contact-card .form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}
.contact-card label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    font-weight: 700;
}
.contact-card .form-row__hint {
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink-soft);
    font-weight: 400;
}
.contact-card input,
.contact-card textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    padding: 9px 12px;
    font: inherit;
    color: var(--ink);
    border-radius: 0;
    line-height: 1.4;
}
.contact-card input:focus,
.contact-card textarea:focus {
    outline: 0;
    border-color: var(--ink);
}
.contact-card textarea {
    resize: vertical;
    min-height: 110px;
    font-family: inherit;
}

.contact-card .form-row.is-error input,
.contact-card .form-row.is-error textarea {
    border-color: var(--danger);
}
.contact-card .form-row .error {
    color: var(--danger);
    font-size: 12px;
}

.contact-card__error {
    margin: 8px 0 12px;
    color: var(--danger);
    font-size: 13px;
}

.contact-card .actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.contact-card button[type="submit"],
.contact-card__sent button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 22px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.contact-card button[type="submit"]:disabled {
    opacity: 0.55;
    cursor: wait;
}
.contact-card__sent { text-align: left; }
.contact-card__sent p {
    margin: 0 0 18px;
    color: var(--ink-soft);
    font-size: 14px;
}

/* ------------------------------------------------------------
   404
   ------------------------------------------------------------ */

.notfound {
    padding: 80px 0;
    text-align: center;
    color: var(--ink-soft);
}
.notfound h1 {
    margin: 0 0 8px;
    font-size: 64px;
    font-weight: 800;
    color: var(--ink);
}
.notfound p { font-size: 14px; }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

/* Column counts are now driven by JS (assets/js/site.js, COLS_BY_VW) */

/* mobile: sticky topbar + full-screen menu overlay */
@media (max-width: 900px) {
    .site-shell {
        grid-template-columns: minmax(0, 1fr);
        padding: 8px 18px 0;
        gap: 0;
    }

    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 50;
        align-items: center;
        gap: 14px;
        background: var(--bg);
        padding: 14px 18px 12px;
        border-bottom: 1px solid var(--line);
    }
    .mobile-topbar__menu {
        background: none;
        border: 0;
        padding: 0;
        font-size: 32px;
        line-height: 1;
        cursor: pointer;
        color: var(--ink);
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .mobile-topbar__name {
        flex: 1;
        text-align: center;
        font-size: 36px;
        font-weight: 800;
        letter-spacing: -0.025em;
        color: var(--ink);
        line-height: 1;
        padding-right: 36px; /* offset hamburger to keep title visually centered */
    }
    .mobile-topbar__name:hover { text-decoration: none; }

    .brand {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: auto;
        padding: 22px 28px 28px;
        background: var(--bg);
        border-top: 0;
        border-right: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 110;
        box-shadow: none;
        overflow-y: auto;
        align-items: stretch;
    }
    .brand.is-open { transform: translateX(0); }

    .brand__close {
        display: flex;
        position: absolute;
        top: 22px;
        left: 22px;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        background: none;
        border: 0;
        font-size: 32px;
        line-height: 1;
        cursor: pointer;
        color: var(--ink);
        z-index: 1;
    }

    .brand__name {
        text-align: center;
        font-size: 56px;
        margin: 0 0 26px;
        padding: 6px 36px 0;  /* mirror close-button width on each side */
    }

    .brand__meta {
        margin-bottom: 26px;
    }
    .brand__meta strong { font-size: 18px; }
    .brand__meta p { font-size: 15px; max-width: none; line-height: 1.45; }

    .brand__nav { font-size: 16px; }
    .brand__nav a { padding: 12px 0; }

    .brand__footer { font-size: 14px; padding-top: 24px; }

    .brand__overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 105;
    }
    .brand__overlay.is-open { display: block; }

    body.is-locked { overflow: hidden; }
}

@media (max-width: 560px) {
    .brand__name { font-size: 46px; }
}
