/* ------------------------------------------------------------------ *\
   Jurriaanr Photography — design system (brief §8)
   Dark by default, warm, restrained. One accent. Serif display + grotesk body.
\* ------------------------------------------------------------------ */

/* --- Fonts (self-hosted, latin, weight-variable) --------------------- */
@font-face {
    font-family: 'Inter';
    src: url("../fonts/inter-Gz7AlRl.woff2") format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Fraunces';
    src: url("../fonts/fraunces-cHejlgP.woff2") format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* --- Tokens: dark is the default (no data-theme = dark) -------------- */
:root {
    --bg: #0a0a0b;
    --surface: #131315;
    --surface-2: #1b1b1f;
    --text: #f6f3ee;
    --text-muted: #948d85;
    --border: rgba(246, 243, 238, 0.11);
    --border-strong: rgba(246, 243, 238, 0.24);
    --accent: #d17a52;
    --accent-hover: #e08e67;
    --accent-contrast: #0a0a0b;
    --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.65);

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --measure: 66ch;
    --container: 74rem;
    --gap: clamp(1rem, 3vw, 2rem);
    --radius: 4px;

    color-scheme: dark;
}

:root[data-theme='light'] {
    --bg: #f5f2ec;
    --surface: #fffefb;
    --surface-2: #ebe7de;
    --text: #1a1815;
    --text-muted: #6a645b;
    --border: rgba(26, 24, 20, 0.15);
    --border-strong: rgba(26, 24, 20, 0.28);
    --accent: #9c4a2f;
    --accent-hover: #7c3820;
    --accent-contrast: #fffefb;
    --shadow: 0 10px 34px -16px rgba(60, 45, 30, 0.35);

    color-scheme: light;
}

/* --- Reset / base ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 440;
    line-height: 1.04;
    letter-spacing: -0.02em;
}

/* Editorial eyebrow label. */
.eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 1.25rem;
}

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

/* --- Fine grain overlay (subtle; brief §8) --------------------------- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Layout ---------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.site-main { flex: 1; width: 100%; }

/* --- Header ---------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--border);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
}
/* Semantic h1 wrapper around the wordmark — carries no styling of its own. */
.site-title {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}
.wordmark {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.nav {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

/* Hamburger: hidden on desktop; only meaningful on mobile with JS. */
.nav-toggle { display: none; }
.nav-toggle .close-icon { display: none; }

/* Mobile ------------------------------------------------------------- */
@media (max-width: 640px) {
    /* No-JS fallback: the nav wraps onto its own row — never overflows. */
    .nav { flex-wrap: wrap; justify-content: flex-end; }

    /* With JS, collapse the nav behind a hamburger. */
    .js .nav-toggle {
        display: inline-grid;
        place-items: center;
        width: 2.4rem;
        height: 2.4rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: transparent;
        color: var(--text);
        cursor: pointer;
    }
    .js .nav-toggle svg { width: 1.3rem; height: 1.3rem; }
    .js .nav-toggle[aria-expanded='true'] .menu-icon { display: none; }
    .js .nav-toggle[aria-expanded='true'] .close-icon { display: block; }

    .js .nav {
        display: none;
        position: absolute;
        right: clamp(1rem, 4vw, 2.5rem);
        top: calc(100% + 0.6rem);
        flex-direction: column;
        align-items: flex-end;
        gap: 1.2rem;
        min-width: 11rem;
        padding: 1.2rem 1.35rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        z-index: 60;
    }
    .js .site-header[data-nav-open] .nav { display: flex; }
    .nav__link { font-size: 1rem; }
}
.nav__link {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.nav__link:hover, .nav__link[aria-current='page'] { color: var(--text); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }

/* Theme toggle shows the "switch to" icon: sun in dark, moon in light. */
.theme-toggle .moon { display: none; }
:root[data-theme='light'] .theme-toggle .sun { display: none; }
:root[data-theme='light'] .theme-toggle .moon { display: block; }

.lang {
    display: flex;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.lang a[aria-current='true'] { color: var(--accent); }

/* --- Footer ---------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: clamp(3rem, 8vw, 6rem);
    padding-block: 2rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

/* Platform icons: muted until hovered, like the rest of the footer. */
.social {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.social__link {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.social__link:hover { color: var(--accent); }
.social__link svg { width: 1.15rem; height: 1.15rem; }

/* --- Prose (About etc.) --------------------------------------------- */
.prose { max-width: var(--measure); }
.prose p { margin-block: 1em; }
.prose a { color: var(--accent); text-underline-offset: 3px; text-decoration: underline; }
.prose a:hover { color: var(--accent-hover); }
.prose h2 { font-size: 1.5rem; margin-block: 1.6em 0.5em; }

/* --- Hero / page heading -------------------------------------------- */
.page-head { padding-block: clamp(3rem, 9vw, 6rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-head__title { font-size: clamp(2.9rem, 9vw, 6rem); }
.page-head__sub { color: var(--text-muted); margin-top: 1rem; font-size: 1.1rem; max-width: var(--measure); }

/* --- Buttons / links ------------------------------------------------- */
.link-accent { color: var(--accent); }
.link-accent:hover { color: var(--accent-hover); }

/* --- Portfolio grid (justified rows, zero layout shift) ------------- */
.portfolio { padding-top: clamp(1.5rem, 4vw, 3rem); }
.grid {
    --row-h: 320px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
}
.grid::after { content: ''; flex-grow: 999999; } /* stop the last row stretching */
.grid__item {
    flex-grow: var(--ar);
    flex-basis: calc(var(--ar) * var(--row-h));
    aspect-ratio: var(--ar);
    min-width: 0;
}
@media (max-width: 900px) { .grid { --row-h: 240px; } }
@media (max-width: 560px) {
    .grid { display: block; }
    .grid__item { width: 100%; margin-bottom: var(--gap); }
}

.tile {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    user-select: none;
    -webkit-user-select: none;
}
.tile__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
    transition: transform 0.45s ease, filter 0.45s ease;
}
.js .tile__img { opacity: 0; transition: opacity 0.4s ease, transform 0.45s ease, filter 0.45s ease; }
.js .tile__img.is-loaded { opacity: 1; }
/* Subtle interaction cue: zoom the image within the (clipped) tile — no reflow. */
.tile:hover .tile__img,
.tile:focus-visible .tile__img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) {
    .tile:hover .tile__img,
    .tile:focus-visible .tile__img { transform: none; filter: brightness(1.07); }
}

.load-more { text-align: center; padding-block: clamp(2rem, 5vw, 3.5rem); }
.load-more__link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1.4rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.load-more__link:hover { color: var(--text); border-color: var(--border-strong); }
/* Loading: the click is already a no-op while a request is in flight, so say so
   rather than letting it look unresponsive. */
.load-more__link.is-loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: default;
}

/* --- Photo detail + variant carousel (Phase 6) --------------------- */
.photo { padding-block: clamp(1.5rem, 4vw, 3rem); display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 900px) {
    .photo { grid-template-columns: minmax(0, 3fr) minmax(14rem, 1fr); align-items: start; }
    .photo__meta { position: sticky; top: 5rem; }
}
.photo__stage { min-width: 0; }
.photo__img { width: 100%; height: auto; -webkit-user-drag: none; }
.js .photo__img { opacity: 0; transition: opacity 0.4s ease; }
.js .photo__img.is-loaded { opacity: 1; }
.photo__title { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 0.75rem; }
.photo__admin { margin-top: 0.75rem; font-size: 0.85rem; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin-top: 1.5rem; font-size: 0.9rem; }
.meta-list dt { color: var(--text-muted); }
.meta-list dd { margin: 0; }

.carousel { position: relative; }
.carousel__viewport { border-radius: var(--radius); overflow: hidden; }
/* No-JS fallback: slides stack vertically, all reachable. */
.carousel__track { display: flex; flex-direction: column; gap: var(--gap); }
.js .carousel__track {
    flex-direction: row; gap: 0; transition: transform 0.4s ease;
    touch-action: pan-y; /* keep vertical scroll; deliver horizontal swipes to JS */
    user-select: none;
}
.carousel__slide { position: relative; margin: 0; }
.js .carousel__slide { flex: 0 0 100%; }
.carousel__label {
    position: absolute; left: 0.75rem; bottom: 0.75rem;
    padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem;
    background: color-mix(in srgb, var(--bg) 65%, transparent);
    backdrop-filter: blur(6px); color: var(--text);
}

/* Controls only make sense with JS. */
.carousel__arrow, .carousel__dots, .carousel__status { display: none; }
.js .carousel__arrow {
    display: grid; place-items: center; position: absolute; top: 50%; transform: translateY(-50%);
    width: 2.75rem; height: 2.75rem; border-radius: 999px; cursor: pointer;
    color: var(--text); border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px);
}
.js .carousel__arrow svg { width: 1.4rem; height: 1.4rem; }
.carousel__arrow--prev { left: 0.75rem; }
.carousel__arrow--next { right: 0.75rem; }
.carousel__arrow:hover { border-color: var(--border-strong); }
.carousel__arrow:disabled { opacity: 0.35; cursor: default; }
.js .carousel__dots { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.9rem; }
.carousel__dot {
    width: 0.5rem; height: 0.5rem; border-radius: 999px; cursor: pointer;
    border: 0; padding: 0; background: var(--border-strong); opacity: 0.5; transition: opacity 0.2s ease;
}
.carousel__dot.is-active { opacity: 1; background: var(--accent); }

.photo__nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.photo__nav-link { color: var(--text-muted); }
.photo__nav-link:hover { color: var(--text); }
.photo__nav-link--next { margin-left: auto; }

.photo__back { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.model-block { margin-top: 1.25rem; font-size: 0.9rem; }
.model-block__name { display: block; color: var(--text-muted); margin-bottom: 0.25rem; }
.model-contact { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }

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

/* --- NSFW opt-in (Phase 7) ------------------------------------------ */
.nsfw-pref { display: inline-flex; align-items: center; }
.nsfw-pref form { margin: 0; }
.nsfw-pref__btn {
    font: inherit; font-size: 0.85rem; color: var(--text-muted);
    background: none; border: 0; padding: 0; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px;
}
.nsfw-pref__btn:hover { color: var(--text); }
.nsfw-pref__btn.is-on { color: var(--accent); }

.nsfw-modal {
    max-width: 34rem; width: calc(100% - 2rem);
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow);
    padding: clamp(1.25rem, 4vw, 2rem);
}
.nsfw-modal[open] { animation: nsfw-in 0.2s ease; }
.nsfw-modal::backdrop { background: rgba(0, 0, 0, 0.6); }
@keyframes nsfw-in { from { opacity: 0; transform: translateY(6px); } }

.nsfw-modal__actions, .nsfw-gate__actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }
.nsfw-gate { padding-block: clamp(3rem, 9vw, 6rem); max-width: var(--measure); }
.nsfw-gate__title { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 1rem; }
.nsfw-gate__text { color: var(--text-muted); margin-block: 0.5rem; }
.nsfw-gate__confirm {
    font: inherit; cursor: pointer; padding: 0.6rem 1.1rem; border: 0; border-radius: 999px;
    background: var(--accent); color: var(--accent-contrast);
}
.nsfw-gate__confirm:hover { background: var(--accent-hover); }

/* --- Motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Forms / Contact (Phase 8) -------------------------------------- */
.contact { padding-bottom: clamp(2rem, 6vw, 4rem); }
.contact__form { max-width: 42rem; display: grid; gap: 1.1rem; }
.form__row { display: grid; gap: 0.35rem; }
.form__row label { font-size: 0.85rem; color: var(--text-muted); }
.contact__form input, .contact__form textarea {
    width: 100%; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.75rem;
}
.contact__form input:focus, .contact__form textarea:focus { outline: none; border-color: var(--accent); }
.contact__form textarea { resize: vertical; min-height: 8rem; }
.contact__form ul { list-style: none; margin: 0.25rem 0 0; padding: 0; color: #e06c6c; font-size: 0.85rem; }
/* Honeypot: off-screen, never shown to humans. */
.contact__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact__success {
    max-width: 42rem; margin-bottom: 1.5rem; padding: 0.9rem 1.1rem; border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid var(--border);
}
.btn {
    font: inherit; cursor: pointer; justify-self: start; padding: 0.65rem 1.3rem;
    border: 1px solid var(--border-strong); border-radius: 999px; background: none; color: var(--text);
}
.btn--accent { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }
.btn--accent:hover { background: var(--accent-hover); }

/* --- Contact: external links (Phase 8) ------------------------------ */
.contact__links { margin-top: clamp(2rem, 5vw, 3rem); }
.contact__links-title { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.contact__links-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

/* --- Error pages (Phase 9) ------------------------------------------ */
.error-page { padding-block: clamp(3rem, 9vw, 6rem); max-width: var(--measure); }
.error-page .page-head__sub { margin-block: 1rem 1.5rem; }
