/* latin */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/plusJakartaSans.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: 'Plus Jakarta Sans';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/plusJakartaSansItalic.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;
}

/* Temporary: DejaVu Sans arrow glyphs only — subsetted to U+2190/U+2192
   so the browser never fetches more than the ~2KB these two chars need. */
@font-face {
  font-family: 'DejaVu Sans Arrows';
  font-display: swap;
  src: url(../fonts/dejavusans-arrows.woff2) format('woff2');
  unicode-range: U+2190, U+2192;
}


/* ─── Variables ─────────────────────────────────────────── */
:root {
    --colormain:    #0e9e3b;
    --colorsecondary:   #dedd23;   /* gradient end for vertical separator */
    --sw:       clamp(325px, 26vw, 500px);     /* sidebar width */
    --rsw:      clamp(213px, 17vw, 327px);     /* right separator position */
    --hh:        52px;     /* header height */
    --ch:        40px;     /* caption bar height */
    --pad:       24px;     /* sidebar horizontal padding */
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --mainfontsize: clamp(18px, 1.25vw, 26px);
    --h1: clamp(22px, 1.46vw, 34px);
    --sepwidth: 5px;  /* width of vertical separator */
    --edge-gap: 2vw;  /* shared gap between a v-sep and its nearest UI element (caption, arrows, header role) */
    --bottom-gap: 8vh;  /* shared gap from the viewport bottom for the sidebar footer and caption */
    --slide-vpad: 8vh;  /* vertical gap between the slide image and the header above / caption below */
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ─── Body ──────────────────────────────────────────────── */
body {
    font-family: var(--font);
    font-size: var(--mainfontsize, 18px);
    font-weight: 400;
    line-height: 1.2;
    color: var(--colormain);
    background: #fff;
    height: 100vh;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.6s ease;
}

body.is-loaded {
    opacity: 1;
}

/* ─── Grid ──────────────────────────────────────────────── */
/*
 * Grid rows:  [header] [slider] [caption]
 * Grid cols:  [sidebar] [main]
 *
 * .slider-wrap spans both columns so wide images can bleed under the sidebar.
 * .sidebar overlaps the left column of .slider-wrap with a higher z-index + white bg.
 * .v-sep is absolutely positioned to draw the gradient vertical line across all rows.
 */
.layout {
    display: grid;
    grid-template-columns: var(--sw) 1fr;
    grid-template-rows: var(--hh) 1fr auto;
    height: 100vh;
    position: relative;  /* containing block for .v-sep */
}

/* ─── Vertical separator (gradient line) ────────────────── */
/*
 * Absolutely positioned so it sits on top of the horizontal rule in the header
 * (z-index higher than .site-header). The rule visually passes under it.
 */
.v-sep {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--sepwidth, 5px);
    background: linear-gradient(to right, var(--colorsecondary) 25%, var(--colormain));
    z-index: 50;
    pointer-events: none;
}
.v-sep.left { 
    left: calc(var(--sw) - 5px);  
}
.v-sep.right {
    right: calc(var(--rsw) - 5px);
}

/* ─── Header ─────────────────────────────────────────────── */
/*
 * Spans both columns so the .rule starts immediately after the name text
 * (within the left column) and crosses the vertical separator into the right column.
 * z-index below .v-sep so the gradient line appears on top of the rule.
 */
.site-header {
    grid-column: 1 / 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    padding: 0 var(--pad);
    gap: 14px;
    position: relative;
    z-index: 10;
}

/* Confines name + rule to a fixed width so the rule's right edge always lands
   at --sw + --edge-gap — the same x as the caption and left slider arrow. */
.hd-fill {
    display: flex;
    align-items: center;
    gap: 14px;
    width: calc(var(--sw) + var(--edge-gap) - var(--pad));
    flex-shrink: 0;
}

.hd-name,
.hd-role {
    color: var(--colormain);
    font-size: var(--h1, 22px);
    font-weight:600;
    white-space: nowrap;
}

.hd-name {
    flex-shrink: 0;
}

/* Horizontal rule: fills remaining space within .hd-fill, ending at the fixed boundary */
.rule {
    flex: 1;
    height: 1px;
    background: var(--colormain);
    margin-top: 0.25em;
}

/* ─── Sidebar ───────────────────────────────────────────── */
/*
 * Overlaps the left column of .slider-wrap. White background hides the slider
 * behind it; z-index keeps it in front of slides.
 */
.sidebar {
    grid-area: 2 / 1 / 4 / 2;  /* rows 2–3, col 1 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px var(--pad) var(--bottom-gap);
    background: transparent;
    z-index: 30;
}

.sidebar__body p {
    line-height: 1.2;
}

.sidebar__body p + p { margin-top: 1em; }

.sidebar__body .link-arrow { display: inline-block; margin-top: 2em; }

.link-arrow {
    color: var(--colormain);
    transition: opacity 0.15s;
}

.link-arrow:hover { opacity: 0.6; }

.arr {
    display: inline-flex;
    width: 1.2em;
    vertical-align: top;
    margin-left: -0.2em;
}

.arr svg {
    display: block;
    width: 100%;
    height: auto;
    transform: rotate(-45deg);
}

/* ─── Slider wrapper ─────────────────────────────────────── */
/*
 * Spans the full width (both columns) so wide images can bleed into the
 * left-column area behind the sidebar.
 */
.slider-wrap {
    grid-area: 2 / 1 / 3 / 3;  /* row 2 only, cols 1–2 */
    position: relative;
    overflow: hidden;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.75s ease;
}

/* Hidden briefly while the window is actively being resized, to mask
   Slick's stale pixel-based track position until it recalculates. */
.slider-wrap.is-resizing {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.slider-wrap .slick-slider,
.slider-wrap .slick-list,
.slider-wrap .slick-track {
    height: 100%;
}

/* ─── Slides ─────────────────────────────────────────────── */
/*
 * .slide is the element Slick actually manages (adds slick-slide,
 * measures/assigns an inline width, positions via the track transform).
 * Slick's width measurement turned out to be sensitive to that element's
 * own padding, so .is-wide getting a different padding than other slides
 * made Slick bake in the wrong width for it. Padding/centering lives on
 * .slide-inner instead — a plain child Slick never touches — so .is-wide
 * can vary the padding freely without affecting Slick's own layout math.
 *
 * Left/right padding each protrude sw*0.5 past their nearest v-sep
 * (right inset = rsw - sw*0.5), so the box stays symmetric between
 * the two separators regardless of viewport size.
 */
.slide {
    height: 100%;
}

.slide-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--slide-vpad) calc(var(--rsw) - var(--sw) * 0.5) var(--slide-vpad) calc(var(--sw) * 0.5);
}

.slide-inner img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ─── Wide viewports ─────────────────────────────────────── */
/*
 * On a wide-but-short window, the centered slide image is height-
 * constrained and doesn't grow with viewport width, leaving a lot of
 * empty space beside it. Shrinking --slide-vpad here gives it more
 * vertical room to grow (and, via its own aspect ratio, more horizontal
 * reach), so it fills the slide area better at wide aspect ratios.
 */
@media (min-aspect-ratio: 16/9) {
    :root { --slide-vpad: 3vh; }
}

/* ─── Navigation arrows ──────────────────────────────────── */
.slick-prev,
.slick-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;  /* above sidebar */
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    line-height: 0;
    transition: opacity 0.15s;
}

.slick-prev svg,
.slick-next svg {
    display: block;
    width: clamp(24px, 2vw, 38px);
    height: auto;
}

.arrow-glyph {
    font-family: 'DejaVu Sans Arrows', sans-serif;
    font-size: clamp(24px, 2vw, 38px);
    line-height: 1;
    color: #000000;
}

.slick-prev:hover,
.slick-next:hover { opacity: 0.4; }

/* Position each arrow inward from its nearest v-sep by --edge-gap */
.slick-prev { left: calc(var(--sw) + var(--edge-gap)); }
.slick-next { right: calc(var(--rsw) + var(--edge-gap)); }

.slick-prev::before,
.slick-next::before { display: none; }  /* remove Slick default arrow content */

/* ─── Caption bar ────────────────────────────────────────── */
.caption {
    grid-area: 3 / 2;  /* row 3, right column only */
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 var(--edge-gap) var(--bottom-gap);
    z-index: 30;
}

.caption__counter { white-space: nowrap; }
.caption__label   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Tablet ─────────────────────────────────────────────── */
/*
 * --rsw sits flat at its 213px floor throughout this whole range already
 * (17vw only overtakes the floor above ~1253px), so it's safe to override
 * with a smaller fixed value here to reclaim that margin for the slider.
 */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --rsw: 100px;
        /* More vertical room so the height-constrained slide image renders
           larger, same reasoning as the min-aspect-ratio fix above. */
        --slide-vpad: 3vh;
    }

    /* The desktop bleed formula (rsw - sw*0.5) goes negative here since
       sw stays at its 325px floor while rsw shrinks — padding can't be
       negative, so it silently collapses to 0 and shifts the slide left.
       Center flush at each v-sep + edge-gap instead, same as the arrows. */
    .slide-inner {
        padding-left: calc(var(--sw) + var(--edge-gap));
        padding-right: calc(var(--rsw) + var(--edge-gap));
    }

    /* Wide images get extra room, bled an equal amount past each v-sep
       (rather than only reducing padding-left) so the box stays centered
       between the two separators instead of drifting off to one side. */
    .slide.is-wide .slide-inner {
        padding-left: calc(var(--sw) - 30px);
        padding-right: calc(var(--rsw) - 30px);
    }
}

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 767px) {
    :root {
        --sw: 0px;
        --mainfontsize: 20px;
        --h1: 24px;
    }

    body { overflow-y: auto; height: auto; }

    .layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        height: auto;
        min-height: 100dvh;
    }

    .v-sep { display: none; }

    .site-header {
        grid-column: 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 16px;
    }

    /* Same row layout as desktop (name, then rule filling the rest),
       just stretched to the full header width instead of a fixed column. */
    .hd-fill {
        width: 100%;
        gap: 14px;
    }

    .sidebar {
        grid-area: 4 / 1;
        padding: 0px 16px 20px;
        height: auto;
    }

    .slider-wrap {
        grid-area: 2 / 1;
        height: 65vw;
        min-height: 260px;
    }

    .slide-inner { padding: 12px 40px; }

    .slick-prev { left: 0; }
    .slick-next { right: 0; }

    .caption {
        grid-area: 3 / 1;
        align-items: flex-start;
        min-height: calc(var(--mainfontsize) * 1.2 * 3 + 20px);
        padding: 0 16px 20px;
    }

    .caption__label {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* ─── WordPress admin bar offset ─────────────────────────── */
/*
 * Logged-in WP pushes the whole document down by the admin bar's height
 * (html { margin-top }), which would otherwise overflow this fixed,
 * non-scrolling layout by that same amount and clip the bottom of the
 * slider/caption. Shrink body + .layout to match instead.
 */
body.admin-bar,
body.admin-bar .layout {
    height: calc(100vh - 32px);
}

/* WP switches the admin bar to its shorter, non-fixed mobile height here. */
@media screen and (max-width: 782px) {
    body.admin-bar,
    body.admin-bar .layout {
        height: calc(100vh - 46px);
    }
}

/* Our own mobile layout is already auto-height/scrollable — no offset needed. */
@media (max-width: 767px) {
    body.admin-bar,
    body.admin-bar .layout {
        height: auto;
    }
}
