/* ==========================================================================
   A Life in Photographs — the personal album told as a photo-book.
   Paper ground, one red accent, big chapter numerals, justified photo bands.
   Lightbox styles mirror album.css so album.js works unchanged.
   ========================================================================== */

.life {
    --life-paper: #ffffff;
    --life-paper-deep: #ececec;
    --life-ink: #161616;
    --life-red: #c2261f;
    --life-red-deep: #9d1c17;
    --life-muted: #6f6a61;
    --life-rule: #dcdcdc;
    --life-nav-h: 46px;

    background: var(--life-paper);
    color: var(--life-ink);
    overflow-x: clip;
}

.life a {
    color: inherit;
}

.life .sk-mono {
    font-family: var(--sk-font-mono);
}

/* --- Buttons --- */

.life-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-family: var(--sk-font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.life-btn:hover {
    background: var(--life-ink);
    color: var(--life-paper);
    border-color: var(--life-ink);
    transform: translateY(-1px);
}

.life-btn--red {
    background: var(--life-red);
    border-color: var(--life-red);
    color: #fff;
}

.life-btn--red::after {
    content: '↓';
    font-family: var(--sk-font-body);
    font-size: 14px;
    line-height: 1;
}

.life-btn--red:hover {
    background: var(--life-red-deep);
    border-color: var(--life-red-deep);
    color: #fff;
}

/* --- Opening --- */

.life-hero {
    display: grid;
    grid-template-columns: 5fr 7fr;
    min-height: calc(100vh - var(--sk-navbar-height));
    background: #121212;
    color: var(--life-paper);
}

.life-hero__text {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 22px;
    padding: 64px 5vw 56px;
    position: relative;
}

.life-hero__text::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--life-red);
}

.life-hero__overline {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
    margin: 0;
}

.life-hero__back {
    text-decoration: none;
    color: var(--life-paper);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.life-hero__back:hover {
    border-bottom-color: var(--life-red);
}

.life-hero__sep {
    margin: 0 8px;
    color: var(--life-red);
}

.life-hero__title {
    font-family: var(--sk-font-body);
    font-weight: 800;
    font-size: clamp(46px, 7vw, 108px);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0;
    color: var(--life-paper);
    text-wrap: balance;
}

.life-hero__epigraph {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
}

.life-hero__epigraph-text {
    font-size: clamp(17px, 1.5vw, 22px);
    font-weight: 500;
    color: var(--life-red);
    letter-spacing: -0.01em;
}

.life-hero__epigraph-note {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.life-hero__lede {
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.6;
    max-width: 44ch;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.life-hero__actions {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.life-hero__stats {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.life-hero__stats span {
    margin: 0 6px;
    color: var(--life-red);
}

.life-hero__media {
    position: relative;
    min-height: 60vh;
    overflow: hidden;
    background: #1a1a1a;
}

.life-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    filter: grayscale(1) contrast(1.06);
    transform: scale(1.02);
    transition: filter 1.2s ease, transform 8s ease, opacity 1s ease;
}

.life-hero:hover .life-hero__img {
    filter: grayscale(0.75) contrast(1.04);
    transform: scale(1);
}

.life-hero__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(18, 18, 18, 0.55) 0%, rgba(18, 18, 18, 0) 32%);
    pointer-events: none;
}

[dir="rtl"] .life-hero__media::after {
    background: linear-gradient(270deg, rgba(18, 18, 18, 0.55) 0%, rgba(18, 18, 18, 0) 32%);
}

.life-hero__credit {
    position: absolute;
    bottom: 16px;
    inset-inline-end: 20px;
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(18, 18, 18, 0.55);
    padding: 5px 9px;
    z-index: 1;
}

/* --- Chapter strip --- */

.life-nav {
    position: sticky;
    top: var(--sk-navbar-height);
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--life-ink);
}

.life-nav__list {
    list-style: none;
    margin: 0;
    padding: 0 5vw;
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    height: var(--life-nav-h);
    align-items: stretch;
}

.life-nav__list::-webkit-scrollbar {
    display: none;
}

.life-nav__item {
    flex: none;
}

.life-nav__item a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 18px 0 0;
    margin-inline-end: 18px;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.life-nav__num {
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--life-red);
}

.life-nav__item a:hover {
    color: var(--life-red);
}

.life-nav__item a[aria-current="true"] {
    border-bottom-color: var(--life-red);
    font-weight: 600;
}

/* --- Chapters --- */

.life-chapter {
    scroll-margin-top: calc(var(--sk-navbar-height) + var(--life-nav-h));
    padding: clamp(56px, 8vw, 120px) 5vw clamp(48px, 6vw, 96px);
    border-bottom: 1px solid var(--life-ink);
}

.life-chapter--dark {
    --life-paper: #141414;
    --life-paper-deep: #262626;
    --life-ink: #ffffff;
    --life-muted: #a39d92;
    --life-rule: #333;
    background: #141414;
    color: #ffffff;
}

.life-chapter__head {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: 0 clamp(20px, 3vw, 48px);
    margin-bottom: clamp(32px, 4vw, 56px);
}

.life-chapter__num {
    font-size: clamp(72px, 11vw, 160px);
    line-height: 0.8;
    color: var(--life-red);
    letter-spacing: -0.04em;
    font-weight: 400;
}

.life-chapter__heading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 6px;
}

.life-chapter__kicker {
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--life-muted);
}

.life-chapter__title {
    font-family: var(--sk-font-body);
    font-weight: 800;
    font-size: clamp(34px, 5vw, 76px);
    line-height: 1;
    letter-spacing: -0.03em;
    margin: 0;
    text-wrap: balance;
}

.life-chapter__era {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--life-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.life-chapter__era::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--life-red);
    flex: none;
}

.life-chapter__body {
    display: grid;
    /* Photographs take 71% of the row; the text column gets the rest minus the gap. */
    grid-template-columns: minmax(0, 1fr) 71%;
    gap: clamp(28px, 4vw, 64px);
    align-items: start;
}

.life-chapter:nth-child(even) .life-chapter__body {
    grid-template-columns: 71% minmax(0, 1fr);
}

.life-chapter:nth-child(even) .life-chapter__intro {
    order: 2;
}

.life-chapter__intro {
    position: sticky;
    top: calc(var(--sk-navbar-height) + var(--life-nav-h) + 28px);
}

.life-chapter__intro-inner {
    border-top: 3px solid var(--life-red);
    padding-top: 18px;
    max-width: 40ch;
}

/* The sticky column repeats the chapter title once the chapter head has
   scrolled away; until then it stays invisible so the title is not doubled. */
/* The red rule stays; only the words fade in and out. */
.life--js .life-chapter__sticky > * {
    opacity: 0;
    transform: translateY(6px);
    transition: none; /* hidden instantly, so the initial state never animates */
}

.life--js .life-chapter.is-scrolled .life-chapter__sticky > * {
    opacity: 1;
    transform: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.life-chapter__sticky-num {
    margin: 0 0 6px;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--life-red);
}

.life-chapter__sticky-title {
    margin: 0;
    font-family: var(--sk-font-body);
    font-weight: 700;
    font-size: clamp(20px, 1.9vw, 28px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.life-chapter__sticky-era {
    margin: 10px 0 0;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--life-muted);
}

/* --- Photo bands --- */

.life-chapter__photos {
    min-width: 0;
}

.life-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 26px;
}

.life-row:last-child {
    margin-bottom: 0;
}

.life-photo {
    flex: var(--ratio, 1.333) 1 0%;
    min-width: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.life--js .life-photo {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.life--js .life-photo.is-in {
    opacity: 1;
    transform: none;
}

.life-photo__trigger {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--ratio, 1.333);
    padding: 0;
    border: 0;
    background: var(--life-paper-deep);
    cursor: zoom-in;
    overflow: hidden;
}

.life-photo__trigger:focus-visible {
    outline: 3px solid var(--life-red);
    outline-offset: 3px;
}

.life-photo__img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.7s ease;
}

.life-photo:hover .life-photo__img {
    transform: scale(1.025);
}

/* --- Blur-up loading: a tiny preview paints at once, the real photo fades in over it --- */

.life-photo__lqip,
.life-hero__lqip {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(14px) saturate(1.05);
    transform: scale(1.06);
    transition: opacity 0.6s ease 0.2s;
    pointer-events: none;
}

.life-hero__lqip {
    object-position: center 35%;
    filter: blur(18px) grayscale(1);
    transform: scale(1.1);
}

/* Hidden instantly until loaded; only the reveal is animated. */
.life--blur .life-photo__img {
    opacity: 0;
    transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0s;
}

.life--blur .life-hero__img {
    opacity: 0;
    transition: filter 1.2s ease, transform 8s ease, opacity 0s;
}

.life--blur .life-photo.is-loaded .life-photo__img {
    opacity: 1;
    transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.7s ease;
}

.life--blur .life-hero.is-loaded .life-hero__img {
    opacity: 1;
    transition: filter 1.2s ease, transform 8s ease, opacity 1s ease;
}

.life--blur .life-photo.is-loaded .life-photo__lqip,
.life--blur .life-hero.is-loaded .life-hero__lqip {
    opacity: 0;
}

/* A slow sheen sweeps the frame while the photo is still on its way. */
.life--blur .life-photo__trigger::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0) 65%);
    background-size: 220% 100%;
    animation: life-sheen 1.8s ease-in-out infinite;
    transition: opacity 0.4s ease;
}

.life--blur .life-photo.is-loaded .life-photo__trigger::after {
    opacity: 0;
    animation: none;
}

@keyframes life-sheen {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

.life-photo__year {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: var(--life-red);
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.12em;
    padding: 4px 8px;
    line-height: 1;
}

.life-photo__caption {
    padding: 10px 0 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.life-photo__title {
    font-size: 14px;
    line-height: 1.4;
}

.life-photo__meta {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--life-muted);
}

/* --- Closing --- */

.life-end {
    padding: clamp(56px, 8vw, 110px) 5vw;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
}

.life-end__note {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--life-muted);
}

.life-end__links {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.life-end__top {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 1px solid var(--life-ink);
}

.life-end__top:hover {
    color: var(--life-red);
    border-bottom-color: var(--life-red);
}

/* --- Lightbox (same classes as album.css, so album.js works) --- */

.sk-album-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(18, 18, 18, 0.94);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 56px 72px 28px;
    backdrop-filter: blur(4px);
}

.sk-album-lightbox.is-open {
    display: flex;
}

.sk-album-lightbox__close,
.sk-album-lightbox__nav {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sk-album-lightbox__close {
    top: 18px;
    right: 22px;
    padding-bottom: 4px;
}

.sk-album-lightbox__close:hover {
    background: var(--life-red, #c2261f);
    border-color: var(--life-red, #c2261f);
    transform: rotate(90deg);
}

.sk-album-lightbox__nav {
    top: 50%;
    margin-top: -22px;
    font-size: 30px;
    padding-bottom: 4px;
}

.sk-album-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sk-album-lightbox__nav--prev {
    left: 18px;
}

.sk-album-lightbox__nav--next {
    right: 18px;
}

.sk-album-lightbox__frame {
    max-width: min(1200px, 92vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sk-album-lightbox__img {
    max-width: 100%;
    max-height: calc(92vh - 110px);
    object-fit: contain;
    background: #fff;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
    margin: 0 auto;
}

.sk-album-lightbox__caption {
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sk-album-lightbox__title {
    font-size: 15px;
    line-height: 1.45;
}

.sk-album-lightbox__meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.62);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sk-album-lightbox__meta:empty {
    display: none;
}

.sk-album-lightbox__counter {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

/* --- RTL --- */

[dir="rtl"] .life-hero__title,
[dir="rtl"] .life-chapter__title,
[dir="rtl"] .life-hero__lede,
[dir="rtl"] .life-chapter__sticky-title,
[dir="rtl"] .life-photo__title,
[dir="rtl"] .life-nav__label {
    font-family: var(--sk-font-arabic);
    letter-spacing: 0;
}

[dir="rtl"] .life-hero__title {
    line-height: 1.15;
}

[dir="rtl"] .life-chapter__title {
    line-height: 1.2;
}

[dir="rtl"] .life-btn--red::after {
    content: '↓';
}

[dir="rtl"] .sk-album-lightbox__close {
    right: auto;
    left: 22px;
}

[dir="rtl"] .sk-album-lightbox__nav--prev {
    left: auto;
    right: 18px;
}

[dir="rtl"] .sk-album-lightbox__nav--next {
    right: auto;
    left: 18px;
}

/* --- Motion --- */

@media (prefers-reduced-motion: reduce) {
    .life--js .life-photo {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .life--blur .life-photo__trigger::after {
        animation: none;
        opacity: 0;
    }

    .life-hero__img,
    .life-photo__img,
    .life-btn {
        transition: none;
    }

    .life-hero:hover .life-hero__img,
    .life-photo:hover .life-photo__img {
        transform: none;
    }
}

/* --- Responsive --- */

@media (max-width: 1100px) {
    .life-chapter__body {
        grid-template-columns: minmax(0, 1fr) 72%;
    }

    .life-chapter:nth-child(even) .life-chapter__body {
        grid-template-columns: 72% minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .life-hero {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .life-hero__media {
        order: -1;
        min-height: 52vh;
    }

    .life-hero__text {
        padding: 40px 20px 44px;
    }

    .life-hero__text::before {
        width: 4px;
    }

    .life-nav__list {
        padding: 0 20px;
    }

    .life-chapter {
        padding-left: 20px;
        padding-right: 20px;
    }

    .life-chapter__body,
    .life-chapter:nth-child(even) .life-chapter__body {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .life-chapter:nth-child(even) .life-chapter__intro {
        order: 0;
    }

    .life-chapter__intro {
        display: none;
    }

    .life-end {
        padding-left: 20px;
        padding-right: 20px;
    }

    .sk-album-lightbox {
        padding: 56px 16px 20px;
    }

    .sk-album-lightbox__nav {
        top: auto;
        bottom: 16px;
        margin-top: 0;
    }

    .sk-album-lightbox__nav--prev {
        left: 16px;
    }

    .sk-album-lightbox__nav--next {
        right: 16px;
    }

    [dir="rtl"] .sk-album-lightbox__nav--prev {
        left: auto;
        right: 16px;
    }

    [dir="rtl"] .sk-album-lightbox__nav--next {
        right: auto;
        left: 16px;
    }
}

@media (max-width: 600px) {
    .life-row {
        flex-wrap: wrap;
        gap: 14px;
        margin-bottom: 14px;
    }

    .life-row[data-n="3"] .life-photo {
        flex: 1 1 calc(50% - 7px);
    }

    .life-row[data-n="3"] .life-photo:first-child {
        flex-basis: 100%;
    }

    .life-chapter__head {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .life-chapter__num {
        font-size: 64px;
    }
}

/* Failed requests leave the small preview in place and stop the loading sheen. */
.life--blur .life-photo.is-error .life-photo__trigger::after {
    opacity: 0;
    animation: none;
}

/* --- Whole-photo opener ---------------------------------------------------
   The opening print is shown uncropped and in its own colours on the dark
   block, with its blurred preview as a soft wash behind it. Nobody at the
   edge of the frame gets cut. Toggled by ft_album_life_hero_whole(). */

.life-hero--whole .life-hero__media {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: clamp(16px, 2vw, 32px);
}

.life-hero--whole .life-hero__img {
    position: relative;
    inset: auto;
    z-index: 1;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - var(--sk-navbar-height) - 2 * clamp(16px, 2vw, 32px) - 34px);
    object-fit: contain;
    filter: none;
    transform: none;
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
}

.life-hero--whole:hover .life-hero__img {
    filter: none;
    transform: none;
}

.life-hero--whole .life-hero__media::after {
    display: none;
}

.life-hero--whole .life-hero__lqip {
    filter: blur(40px) saturate(1.15);
    transform: scale(1.3);
    opacity: 0.5;
}

.life--blur .life-hero--whole.is-loaded .life-hero__lqip {
    opacity: 0.35;
}

/* The caption sits under the print, not over it. */
.life-hero--whole .life-hero__credit {
    position: static;
    z-index: 2;
    align-self: flex-end;
    background: none;
    padding: 0;
}

@media (max-width: 900px) {
    .life-hero--whole .life-hero__media {
        min-height: 0;
        padding: 16px;
    }

    .life-hero--whole .life-hero__img {
        max-height: 70vh;
    }
}

/* Selected portrait cover, edge to edge without a caption or matte. */
.life-hero--flush {
    min-height: 0;
}
.life-hero--flush .life-hero__media {
    min-height: 0;
    aspect-ratio: 3 / 4;
    padding: 0;
    margin: 0;
}
.life-hero--flush .life-hero__img,
.life-hero--flush:hover .life-hero__img {
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
    filter: none;
    transform: none;
    box-shadow: none;
}
.life-hero--flush .life-hero__media::after {
    display: none;
}
.life-hero--flush .life-hero__lqip {
    object-position: center;
    filter: blur(18px);
}
