/* ========================================
   PORTFOLIO FEED - Matching craigelve.co.uk
   ======================================== */

:root {
    --color-dark: #202020;
    --color-dark-secondary: #2D2D2D;
    --color-light: #FDFDFD;
    --color-accent: #14DAAB;
}

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

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

body {
    font-family: 'Archivo', sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    background: var(--color-dark);
    color: var(--color-light);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    height: 100vh;
    height: 100dvh;
}

/* Typography - exact match */
h1, h2, h3, h4, h5 {
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
}

h1 { font-size: 40px; line-height: 46px; }
h2 { font-size: 32px; line-height: 42px; }
h3 { font-size: 28px; line-height: 34px; }
h4 { font-size: 24px; line-height: 30px; }
h5 { font-size: 20px; line-height: 24px; }

p, a {
    font-weight: 400;
    font-size: 16px;
    line-height: 28px;
    letter-spacing: 0;
    margin: 0;
}

a {
    text-decoration: underline;
    color: inherit;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-accent);
}

@media (min-width: 1250px) {
    h1 { font-size: 55px; line-height: 60px; }
    h2 { font-size: 44px; line-height: 60px; }
    h3 { font-size: 38px; line-height: 46px; }
    h4 { font-size: 32px; line-height: 40px; }
    h5 { font-size: 24px; line-height: 30px; }
}

/* ========================================
   STORY PROGRESS BAR (Instagram-style)
   ======================================== */

.story-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 12px 28px;
    z-index: 200;
    background: linear-gradient(to bottom, rgba(32, 32, 32, 0.6) 0%, transparent 100%);
}

.story-segment {
    flex: 1;
    height: 3px;
    background: rgba(253, 253, 253, 0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.story-segment__fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--color-light);
    border-radius: 2px;
    transition: none;
}

.story-segment--complete .story-segment__fill {
    width: 100%;
}

.story-segment--active .story-segment__fill {
    animation: storyProgress 10s linear forwards;
}

.story-segment--paused .story-segment__fill {
    animation-play-state: paused;
}

@keyframes storyProgress {
    from { width: 0%; }
    to { width: 100%; }
}

@media (min-width: 768px) {
    .story-progress {
        padding: 16px 48px;
        gap: 6px;
    }

    .story-segment {
        height: 3px;
    }
}

@media (min-width: 1250px) {
    .story-progress {
        padding: 20px 80px;
        gap: 8px;
    }
}

/* ========================================
   SWIPE HINT
   ======================================== */

.swipe-hint {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.swipe-hint.hidden {
    opacity: 0;
}

.swipe-icon {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(253, 253, 253, 0.4);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
}

.swipe-icon svg {
    width: 16px;
    height: 16px;
    color: var(--color-light);
    opacity: 0.6;
}

.swipe-hint span {
    font-size: 12px;
    color: rgba(253, 253, 253, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ========================================
   FEED CONTAINER
   ======================================== */

.feed-container {
    height: 100vh;
    height: 100dvh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.feed-container::-webkit-scrollbar {
    display: none;
}

/* ========================================
   SLIDE BASE
   ======================================== */

.slide {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.slide__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--color-dark);
}

/* Image Gallery */
.slide__gallery {
    position: absolute;
    inset: 0;
}

.slide__image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.slide__image.active {
    opacity: 1;
}

.slide__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(32, 32, 32, 0.95) 0%,
        rgba(32, 32, 32, 0.5) 50%,
        rgba(32, 32, 32, 0.2) 100%
    );
}

/* Gallery Indicators */
.gallery-indicators {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

/* Hide indicators when only one image */
.gallery-indicators:has(.indicator:only-child) {
    display: none;
}

.indicator {
    width: 32px;
    height: 3px;
    background: rgba(253, 253, 253, 0.3);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.indicator.active {
    background: var(--color-light);
}

/* Slide Content */
.slide__content {
    position: relative;
    z-index: 1;
    padding: 28px;
    max-width: 600px;
    width: 100%;
}

.slide__content--bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px;
    padding-bottom: 100px;
}

/* ========================================
   PROJECT SLIDES
   ======================================== */

.slide__client {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.5);
    margin-bottom: 4px;
}

.slide__title {
    margin-bottom: 16px;
}

.slide__caption {
    position: relative;
}

.slide__description {
    color: rgba(253, 253, 253, 0.8);
    margin-bottom: 0;
}

.slide__details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
}

.slide.expanded .slide__details {
    max-height: 200px;
    opacity: 1;
    margin-top: 16px;
}

.slide__details p {
    color: rgba(253, 253, 253, 0.6);
    margin-bottom: 16px;
}

.slide__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.slide__meta span {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.4);
}

.slide__meta span:not(:last-child)::after {
    content: '·';
    margin-left: 8px;
}

/* Slide Actions */
.slide__actions {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 8px;
}

/* Show More Button */
.show-more-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(253, 253, 253, 0.5);
    font-family: 'Archivo', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.show-more-btn:hover {
    color: var(--color-light);
}

.show-more-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.slide.expanded .show-more-btn svg {
    transform: rotate(180deg);
}

.slide.expanded .show-more-text::before {
    content: 'less';
}

.slide.expanded .show-more-text {
    font-size: 0;
}

.slide.expanded .show-more-text::before {
    font-size: 14px;
}

/* Case Study Link */
.case-study-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-light);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.case-study-link:hover {
    color: var(--color-accent);
}

.case-study-link svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.case-study-link:hover svg {
    transform: translate(2px, -2px);
}

/* ========================================
   SPLIT LAYOUT (Desktop Left-Right)
   ======================================== */

.slide__content--split {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    gap: 0;
    max-width: none;
    position: relative;
    padding-top: 0;
    width: 100%;
}

.split__left,
.split__right {
    flex: 0 0 auto;
}

.split__divider {
    /* Draw the divider via ::before so it doesn't affect flex spacing. */
    display: none;
}

.split__inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: none;
}

.slide__content--split::before {
    display: none; /* divider moved to dedicated elements */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(253, 253, 253, 0.15);
}

@media (min-width: 768px) {
    .split__inner {
        flex-direction: row;
        align-items: center;
        gap: 48px;
    }

    .split__left {
        flex: 0 0 40%;
    }

    .split__right {
        flex: 1;
    }
}

@media (min-width: 1250px) {
    .split__inner {
        gap: 80px;
        margin: 0 auto;
    }

    .split__left {
        flex: 0 0 50%;
    }
}

/* ========================================
   INTRO SLIDE
   ======================================== */

.slide__top-brand {
    position: absolute;
    top: 48px; /* Below story progress bar */
    left: 28px;
    right: 28px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.slide__top-divider {
    margin-top: 18px;
    height: 1px;
    width: 100%;
    background: rgba(253, 253, 253, 0.15);
}

.slide--intro .slide__content {
    /* room for story progress bar + logo + divider */
    padding-top: 112px;
}

.slide--experience .slide__content {
    /* room for story progress bar + logo + divider */
    padding-top: 112px;
}

@media (min-width: 768px) {
    .slide__top-brand {
        top: 56px; /* Below story progress bar */
        left: 48px;
        right: 48px;
    }

    .slide--intro .slide__content {
        padding-top: 140px;
    }

    .slide--experience .slide__content {
        padding-top: 140px;
    }

    .slide--intro .slide__content--split,
    .slide--experience .slide__content--split {
        align-items: stretch;
    }
}

@media (min-width: 1250px) {
    .slide__top-brand {
        top: 72px; /* Below story progress bar */
        left: 80px;
        right: 80px;
    }

    .slide--intro .slide__content {
        padding-top: 160px;
    }

    .slide--experience .slide__content {
        padding-top: 160px;
    }
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.logo img {
    display: block;
    width: 24px;
    height: 24px;
}

.intro__identity {
    display: flex;
    align-items: center;
}

.intro__identity-text {
    display: flex;
    flex-direction: column;
}

.slide--intro .slide__content {
    text-align: left;
}

.intro__label {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.5);
    margin-bottom: 8px;
}

.intro__name {
    font-size: 16px;
    line-height: 24px;
    margin-bottom: 6px;
}

.intro__location {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.4);
}

.intro__sub {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.6);
}

.intro__pipe {
    margin: 0 8px;
    color: rgba(253, 253, 253, 0.35);
}

/* Match screenshot: large bold intro quote on the right */
.slide--intro .intro__philosophy {
    font-size: 36px;
    line-height: 44px;
    font-weight: 700;
    color: var(--color-light);
}

.intro__bio {
    color: rgba(253, 253, 253, 0.8);
    margin-bottom: 16px;
}

.intro__philosophy {
    color: rgba(253, 253, 253, 0.5);
}

/* ========================================
   EXPERIENCE SLIDE
   ======================================== */

.slide--experience {
    /* Stack content and footer */
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.slide--experience .slide__content {
    text-align: left;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 28px;
}

.slide--experience .slide__footer {
    position: relative;
    flex-shrink: 0;
}

.experience__label {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.5);
    margin-bottom: 8px;
}

.experience__heading {
    margin-bottom: 16px;
}

.experience__education {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.4);
}

.experience__list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.experience__item {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.experience__date {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.4);
    flex: 0 0 70px;
}

.experience__role {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.experience__title {
    font-size: 16px;
    line-height: 28px;
    color: var(--color-light);
}

.experience__company {
    font-size: 14px;
    line-height: 26px;
    color: rgba(253, 253, 253, 0.5);
}

/* ========================================
   FOOTER (pinned to bottom)
   ======================================== */

.slide__footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 28px 28px;
    z-index: 10;
    background: var(--color-dark);
}

.footer__divider {
    height: 1px;
    width: 100%;
    background: rgba(253, 253, 253, 0.15);
    margin-bottom: 24px;
}

.footer__content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer__heading {
    font-size: 24px;
    line-height: 30px;
    font-weight: 700;
    color: var(--color-light);
    margin: 0;
}

.footer__right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer__links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer__link {
    font-size: 14px;
    line-height: 24px;
    color: var(--color-light);
    text-decoration: underline;
    transition: color 0.3s ease;
}

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

.footer__copyright {
    font-size: 12px;
    line-height: 20px;
    color: rgba(253, 253, 253, 0.4);
    margin: 0;
}

@media (min-width: 768px) {
    .slide__footer {
        padding: 0 48px 48px;
    }

    .footer__content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .footer__heading {
        font-size: 32px;
        line-height: 40px;
    }

    .footer__links {
        flex-direction: row;
        gap: 24px;
    }
}

@media (min-width: 1250px) {
    .slide__footer {
        padding: 0 80px 60px;
    }

    .footer__heading {
        font-size: 44px;
        line-height: 52px;
    }
}

.slide--experience .split__right {
    display: flex;
    flex-direction: column;
}

.slide--experience .split__inner {
    height: 100%;
}

.slide--experience .experience__list {
    flex: 1;
    justify-content: start;
    padding-top: 40px;
}

@media (min-width: 768px) {
    .experience__list {
        gap: 16px;
    }

    .experience__item {
        gap: 32px;
    }

    .experience__date {
        flex: 0 0 80px;
    }
}


/* ========================================
   ANIMATIONS
   ======================================== */

.slide__content > *:not(.split__inner),
.split__left > *,
.split__right > *,
.experience__item,
.slide__footer {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.slide__content--split::before {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.slide.visible .slide__content > *:not(.split__inner),
.slide.visible .split__left > *,
.slide.visible .split__right > *,
.slide.visible .experience__item,
.slide.visible .slide__footer {
    opacity: 1;
    transform: translateY(0);
}

.slide.visible .slide__footer {
    transition-delay: 0.6s;
}

.slide.visible .slide__content--split::before {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.slide.visible .split__left > *:nth-child(1) { transition-delay: 0s; }
.slide.visible .split__left > *:nth-child(2) { transition-delay: 0.1s; }
.slide.visible .split__left > *:nth-child(3) { transition-delay: 0.2s; }

.slide.visible .split__divider { transition-delay: 0.2s; }

.slide.visible .split__right > *:nth-child(1) { transition-delay: 0.3s; }
.slide.visible .split__right > *:nth-child(2) { transition-delay: 0.4s; }

.slide.visible .experience__item:nth-child(1) { transition-delay: 0.3s; }
.slide.visible .experience__item:nth-child(2) { transition-delay: 0.35s; }
.slide.visible .experience__item:nth-child(3) { transition-delay: 0.4s; }
.slide.visible .experience__item:nth-child(4) { transition-delay: 0.45s; }
.slide.visible .experience__item:nth-child(5) { transition-delay: 0.5s; }
.slide.visible .experience__item:nth-child(6) { transition-delay: 0.55s; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (min-width: 768px) {
    .slide__content,
    .slide__content--bottom {
        padding: 48px;
    }

    .slide__content--bottom {
        padding-bottom: 80px;
    }
}

@media (min-width: 1250px) {
    .slide__content,
    .slide__content--bottom {
        padding: 80px;
    }

    .slide__content--bottom {
        max-width: 700px;
        padding-bottom: 100px;
    }
}

/* ========================================
   SAFE AREA (iOS)
   ======================================== */

@supports (padding-top: env(safe-area-inset-top)) {
    .story-progress {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .slide__content--bottom {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }

    .swipe-hint {
        bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .slide__footer {
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
}
