/*
 * petrmareska.online – public pages (landing, client galleries). The look of petrmareska.cz: the night from behind
 * the decks, cut like a film. Photographs fill the frame, names sit on the frame's lower edge, the accent marks the
 * primary action only.
 *
 * Taken from the portfolio's site.css (tokens, base, button, header, hero, forms, error page, footer, motion); the
 * design values the portfolio generates per page (App\Design\CssVariables, font pair "poster") are fixed here.
 * Gallery-specific parts (tiles, lightbox chrome, favourites bar) live in gallery.css.
 */

/* ---------- Fonts (Chivo, self-hosted, latin + latin-ext) ---------- */

@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/chivo-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/chivo-latin-ext-400.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/chivo-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/chivo-latin-ext-700.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 900; font-display: swap; src: url(/assets/fonts/chivo-latin-900.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Chivo'; font-style: normal; font-weight: 900; font-display: swap; src: url(/assets/fonts/chivo-latin-ext-900.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Tokens ---------- */

:root {
    --accent: #e6007e;
    --accent-ink: #ffffff;
    --font-heading: 'Chivo', system-ui, sans-serif;
    --font-body: 'Chivo', system-ui, sans-serif;
    --heading-weight: 900;
    --heading-transform: uppercase;
    --heading-tracking: -0.045em;
    --hero-overlay: 0.4;
    --hero-h: 100svh;
}

:root,
[data-theme=dark] {
    color-scheme: dark;
    --bg: #07080c;
    --bg-solid: #07080c;
    --ink: #edeef3;
    --muted: #9ba1b4;
    --line: rgb(237 238 243 / 0.14);
    --line-strong: rgb(237 238 243 / 0.32);
    --surface: color-mix(in srgb, var(--bg-solid) 88%, #ffffff);
    --danger: #ff8589;
}

[data-theme=light] {
    color-scheme: light;
    --bg: #e2e2e2;
    --bg-solid: #e2e2e2;
    --ink: #0b0d14;
    --muted: #474c59;
    --line: rgb(11 13 20 / 0.14);
    --line-strong: rgb(11 13 20 / 0.34);
    --surface: color-mix(in srgb, var(--bg-solid) 93%, #000000);
    --danger: #b3141b;
}

:root {
    --on-photo: #ffffff;
    --on-photo-muted: rgb(255 255 255 / 0.78);
    --gutter: clamp(16px, 3.2vw, 48px);
    --header-h: 76px;
    --gap: clamp(72px, 9vw, 144px);
    --measure: 60ch;

    --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
    --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
    --step-lead: clamp(1.25rem, 1.08rem + 0.75vw, 1.75rem);
    --step-sub: clamp(1.75rem, 1.2rem + 2.2vw, 3.25rem);
    --step-head: clamp(2.75rem, 1.3rem + 5.6vw, 7rem);

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
    --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
}

/* ---------- Base ---------- */

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

html {
    background-color: var(--bg-solid);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    background-color: var(--bg-solid);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--step-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

/* The stage light: the ground takes the tone of the photograph in view (site.js). */
html.has-live-ground body {
    background: var(--live-ground);
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: var(--heading-weight, 700);
    text-transform: var(--heading-transform, none);
    letter-spacing: var(--heading-tracking, -0.02em);
    word-spacing: 0.06em;
    line-height: 1;
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

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

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

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: transparent;
    text-underline-offset: 0.24em;
}

a:hover {
    text-decoration-color: currentColor;
}

button {
    font: inherit;
    color: inherit;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
}

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

.site-main {
    flex: 1 0 auto;
}

.site-main:focus {
    outline: none;
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -200px;
    z-index: 100;
    padding: 0.6em 1em;
    background: var(--ink);
    color: var(--bg-solid);
    text-decoration: none;
}

.skip-link:focus {
    top: 8px;
}

.section-title {
    font-size: var(--step-head);
}

.empty-note {
    max-width: var(--measure);
    color: var(--muted);
    font-size: var(--step-lead);
    line-height: 1.4;
}

/* ---------- Buttons: a flat accent field; the ink wipes across on hover ---------- */

.button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    min-height: 54px;
    padding: 0.75em 1.6em;
    border: 0;
    border-radius: 2px;
    overflow: hidden;
    isolation: isolate;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.button::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--accent-ink);
    transform: scaleX(0);
    transform-origin: right center;
}

.button:hover {
    color: var(--accent);
}

.button:hover::before {
    transform: scaleX(1);
    transform-origin: left center;
}

.button:active {
    transform: scale(0.97);
}

.button[disabled],
.button[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.button__note {
    font-weight: 400;
    opacity: 0.82;
    font-variant-numeric: tabular-nums;
}

/* Secondary: an outlined pill, the share links of the portfolio. */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: none;
    color: inherit;
    font: inherit;
    font-size: var(--step-small);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.pill:hover,
.pill[aria-pressed="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--bg-solid);
}

.pill .icon {
    width: 18px;
    height: 18px;
}

.pill__count {
    font-variant-numeric: tabular-nums;
}

/* ---------- Header ---------- */

.site-header {
    position: absolute;
    inset: 0 0 auto;
    z-index: 30;
    color: var(--ink);
}

/* Over a photograph the header reads white until it gets its own ground. */
.site:has(.hero--photo) .site-header:not(.is-solid) {
    color: var(--on-photo);
}

.js .site-header {
    position: fixed;
}

.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-solid) 82%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}

.site:has(.hero--photo) .site-header:not(.is-solid)::after {
    content: "";
    position: absolute;
    inset: 0 0 -40px;
    z-index: -2;
    background: linear-gradient(rgb(0 0 0 / 0.45), rgb(0 0 0 / 0));
    pointer-events: none;
}

.site-header.is-solid::before {
    opacity: 1;
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

.site-header__bar {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2.4vw, 40px);
    min-height: var(--header-h);
    padding: 0 var(--gutter);
}

.wordmark {
    margin-right: auto;
    font-family: var(--font-heading);
    font-weight: var(--heading-weight, 700);
    text-transform: var(--heading-transform, none);
    letter-spacing: var(--heading-tracking, -0.02em);
    font-size: 1.25rem;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.site-tools {
    display: flex;
    align-items: center;
    gap: 2px;
}

.lang-switch,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: var(--step-small);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

/* The toggle needs JavaScript; theme.js marks <html> with .js. */
.theme-toggle {
    display: none;
}

.js .theme-toggle {
    display: inline-flex;
}

[data-theme=light] .theme-toggle__icon {
    transform: rotate(180deg);
}

@media (max-width: 760px) {
    :root {
        --header-h: 62px;
    }
}

/* ---------- Hero: the photograph as a film frame, the name on its lower edge ---------- */

.hero {
    --t: clamp(3.5rem, 12vw, 13rem);
    position: relative;
}

.hero--m {
    --t: clamp(2.75rem, 7.4vw, 8.5rem);
}

.hero--l {
    --t: clamp(2.25rem, 5vw, 5.75rem);
}

.hero__stage {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: end;
    min-height: var(--hero-h);
    padding: calc(var(--header-h) + 48px) var(--gutter) clamp(28px, 4vw, 56px);
    overflow: hidden;
}

.hero--photo .hero__stage {
    min-height: max(var(--hero-h), 440px);
    color: var(--on-photo);
    background: #000;
}

.hero--plain .hero__stage {
    min-height: auto;
    padding-top: calc(var(--header-h) + clamp(72px, 12vw, 180px));
    padding-bottom: clamp(40px, 6vw, 80px);
    border-bottom: 1px solid var(--line);
}

.hero__media {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgb(0 0 0 / 0.78) 0%, rgb(0 0 0 / 0.35) 38%, rgb(0 0 0 / 0) 62%),
        rgb(0 0 0 / var(--hero-overlay, 0.3));
}

.hero__content {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.hero__subtitle {
    max-width: 40ch;
    font-size: var(--step-small);
    font-weight: 700;
    line-height: 1.35;
}

.hero--photo .hero__subtitle {
    color: var(--on-photo-muted);
}

.hero--plain .hero__subtitle {
    color: var(--muted);
}

/* The mask lets the title rise from under a line; its padding keeps diacritics and descenders. */
.hero__mask {
    min-width: 0;
    overflow-x: clip;
    clip-path: inset(-100vh 0 -0.08em 0);
    margin-bottom: -0.08em;
    padding-bottom: 0.08em;
}

.hero__title {
    font-size: var(--t);
    line-height: 0.98;
    overflow-wrap: break-word;
    hyphens: auto;
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 28px;
    /* The separator dot of the first item on a wrapped line falls outside the box and is clipped. */
    overflow: hidden;
    font-size: var(--step-lead);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.hero__meta li:not(:first-child) {
    position: relative;
}

.hero__meta li:not(:first-child)::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    width: 4px;
    height: 4px;
    background: currentColor;
    transform: translateY(-50%);
}

.hero__text p + p {
    margin-top: 0.9em;
}

@media (max-width: 640px) {
    .hero {
        --t: clamp(2.75rem, 15vw, 5rem);
    }

    .hero--m {
        --t: clamp(2.25rem, 11vw, 4rem);
    }

    .hero--l {
        --t: clamp(1.875rem, 8.5vw, 3rem);
    }

    .hero__meta {
        font-size: var(--step-body);
        gap: 4px 24px;
    }

    .hero__meta li:not(:first-child)::before {
        left: -14px;
    }
}

/* ---------- Forms ---------- */

.form {
    display: grid;
    gap: 28px;
}

.form__row {
    display: grid;
    gap: 28px;
}

@media (min-width: 600px) {
    .form__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.form__field {
    display: grid;
    gap: 6px;
}

.form label {
    color: var(--muted);
    font-size: var(--step-small);
    font-weight: 700;
}

.form__optional {
    font-weight: 400;
}

.form input,
.form textarea {
    width: 100%;
    min-height: 52px;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--step-lead);
    line-height: 1.3;
    box-shadow: inset 0 -2px 0 0 transparent;
}

.form textarea {
    min-height: 140px;
    resize: vertical;
}

.form input:focus,
.form textarea:focus {
    outline: none;
    border-bottom-color: var(--accent);
    box-shadow: inset 0 -2px 0 0 var(--accent);
}

.form [aria-invalid="true"] {
    border-bottom-color: var(--danger);
    box-shadow: inset 0 -2px 0 0 var(--danger);
}

.form-error {
    color: var(--danger);
    font-size: var(--step-small);
}

.form button.button {
    justify-self: start;
    margin-top: 8px;
}

.form-notice {
    padding: 18px 22px;
    border-left: 3px solid var(--accent);
    background: var(--surface);
}

.form-notice--error {
    border-left-color: var(--danger);
}

.hp-field {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Error page ---------- */

.error-page {
    display: grid;
    gap: 32px;
    padding: calc(var(--header-h) + clamp(64px, 10vw, 140px)) var(--gutter) 0;
}

.error-page__code {
    font-family: var(--font-heading);
    font-weight: var(--heading-weight, 700);
    letter-spacing: var(--heading-tracking, -0.02em);
    font-size: clamp(7rem, 30vw, 28rem);
    line-height: 0.78;
    font-variant-numeric: tabular-nums;
    color: transparent;
    -webkit-text-stroke: 2px var(--ink);
}

.error-page__icon {
    width: clamp(88px, 16vw, 180px);
    height: auto;
    color: var(--accent);
}

.error-page__text {
    display: grid;
    justify-items: start;
    gap: 20px;
    max-width: 38rem;
}

.error-page__title {
    font-size: var(--step-sub);
}

.error-page__lead {
    color: var(--muted);
    font-size: var(--step-lead);
    line-height: 1.4;
}

.error-page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* ---------- Footer: a single quiet line ---------- */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 32px;
    margin-top: var(--gap);
    padding: 28px var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: var(--step-small);
}

.site-footer__what {
    margin-right: auto;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
}

.site-footer__links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    font-weight: 700;
}

@media (max-width: 760px) {
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ---------- Motion (only when the visitor allows it) ---------- */

@media (prefers-reduced-motion: no-preference) {
    html.has-live-ground body {
        transition: background-color 1200ms ease;
    }

    a,
    .pill {
        transition: text-decoration-color 200ms ease, color 200ms ease, background-color 200ms ease, border-color 200ms ease;
    }

    .button {
        transition: color 420ms var(--ease-out), transform 140ms var(--ease-out);
    }

    .button::before {
        transition: transform 520ms var(--ease-expo);
    }

    .theme-toggle__icon {
        transition: transform 500ms var(--ease-out);
    }

    .js .site-header {
        transition: transform 520ms var(--ease-expo), color 300ms ease;
    }

    .site-header::before {
        transition: opacity 300ms ease;
    }

    /* Hero load: the frame settles, the title rises from under its line, the notes follow. */
    .js .hero__img {
        animation: drift 9s var(--ease-soft) both;
    }

    .js .hero__title {
        animation: rise-mask 1100ms var(--ease-expo) 120ms both;
    }

    .js .hero__subtitle,
    .js .hero__meta {
        animation: rise 800ms var(--ease-out) 380ms both;
    }

    .js .hero__after {
        animation: rise 800ms var(--ease-out) 520ms both;
    }

    .js .error-page__code,
    .js .error-page__icon {
        animation: rise 1000ms var(--ease-expo) 80ms both;
    }

    .js .error-page__text > * {
        animation: rise 800ms var(--ease-out) 260ms both;
    }

    @keyframes rise {
        from { opacity: 0; transform: translateY(28px); }
        to { opacity: 1; transform: none; }
    }

    @keyframes rise-mask {
        from { transform: translateY(105%); }
        to { transform: none; }
    }

    @keyframes fade {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes drift {
        from { transform: scale(1.08); }
        to { transform: scale(1); }
    }
}
