/* ============================================
   HOMEPAGE STYLES
   Used only by index.html: achievements cards, selected projects showcase,
   project timeline and the What we build service cards.
============================================ */

/* ===== Achievements: 3 x 2 cards on desktop, 2 columns on tablet, 1 on phones ===== */
.achievements {
    background: #ededf0;
    border-block: 1px solid var(--line);
}

.achievements h2 {
    margin-bottom: 2rem;
}

.ach-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(3, 1fr);
}

.ach-card {
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    min-height: 140px;
    padding: 1.5rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 3px solid var(--brand-red);
    border-radius: var(--radius);
    transition: transform .2s, box-shadow .2s;
}

.ach-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.ach-icon {
    flex: none;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-dark);
}

.ach-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: #ff8f94;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ach-value {
    font: 600 2rem/1.1 var(--font-head);
    color: var(--brand-dark);
    overflow-wrap: anywhere;
}

.ach-label {
    font-weight: 600;
}

.ach-note {
    margin: .3rem 0 0;
    font-size: .92rem;
    color: var(--stone);
}

@media (max-width: 900px) {
    .ach-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .ach-grid {
        grid-template-columns: 1fr;
    }

    .ach-card {
        min-height: 0;
    }
}

/* ===== Selected projects: equal cards, picture frame on top and text underneath =====
   3 columns on desktop, 2 on tablet, 1 on phones. Every picture sits in the same 4:3 frame;
   js/projects.js decides per picture whether it fills the frame (cover) or is shown whole (contain). */
.showcase {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr; /* same card height in every row */
}

.show-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}

.show-card:hover {
    border-color: #c9c9d0;
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.show-card:active {
    transform: translateY(-1px);
}

/* Neutral picture frame: shows behind a picture that is displayed whole (contain) */
.show-pic {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e9e9ed;
}

.show-pic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--img-pos, center);
    transition: transform .5s var(--ease);
}

.show-card:hover .show-pic img {
    transform: scale(1.05);
}

.show-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.2rem 1.3rem 1.4rem;
}

.show-card h3 {
    margin: .7rem 0 .2rem;
    font-size: 1.35rem;
    transition: color .2s var(--ease);
}

.show-card:hover h3 {
    color: var(--brand-red);
}

.show-card .where {
    margin: 0;
    color: var(--stone);
    font-size: .88rem;
    font-weight: 500;
    letter-spacing: .02em;
}

.show-card .sum {
    flex: 1; /* pushes "View project" to the bottom so all cards line up */
    margin: .6rem 0 1rem;
    font-size: .98rem;
}

.show-link {
    align-self: flex-start;
    border-bottom: 2px solid var(--brand-red);
    font-weight: 600;
}

@media (max-width: 960px) {
    .showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Phones: the project cards sit in one swipeable row (instead of nine cards stacked on top of each other).
   The next card peeks in from the right so visitors see that they can swipe. */
@media (max-width: 640px) {
    .showcase {
        display: flex;
        gap: 1rem;
        padding-bottom: .9rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
    }

    .show-card {
        flex: 0 0 82%;
        scroll-snap-align: start;
    }
}

/* ===== What we build: 3 x 2 cards of equal height ===== */
.svc-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(3, 1fr);
}

.svc-card {
    display: flex;
    flex-direction: column;
    padding: 1.8rem;
    background: var(--paper);
    color: var(--charcoal);
    border-radius: var(--radius);
    border-top: 3px solid var(--brand-red);
}

.svc-card h3 {
    color: var(--brand-dark);
}

.svc-card p {
    margin-bottom: .8rem;
}

.svc-card ul {
    margin: 0 0 1.2rem;
    padding-left: 1.1rem;
    font-size: .93rem;
    color: var(--stone);
}

.svc-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-dark);
}

.svc-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #ff8f94;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.svc-link {
    margin-top: auto;
    color: var(--brand-dark);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid var(--brand-red);
    align-self: flex-start;
}

@media (max-width: 960px) {
    .svc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .svc-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Timeline: central line, alternating cards, year beside the marker ===== */
.timeline {
    position: relative;
    list-style: none;
    margin: 2.5rem 0 0;
    padding: 0;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--line);
}

.t-item {
    position: relative;
    width: 50%;
    padding: 0 3rem 3rem 0;
}

.t-item:nth-child(even) {
    margin-left: 50%;
    padding: 0 0 3rem 3rem;
}

.t-item::before {
    content: "";
    position: absolute;
    top: 1.2rem;
    right: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand-red);
    border: 3px solid var(--ivory);
}

.t-item:nth-child(even)::before {
    right: auto;
    left: -8px;
}

.t-year {
    position: absolute;
    top: .8rem;
    left: calc(100% + 1.6rem);
    font: 600 1.4rem var(--font-head);
    color: var(--brand-red);
}

.t-item:nth-child(even) .t-year {
    left: auto;
    right: calc(100% + 1.6rem);
}

.t-card {
    display: block;
    background: var(--paper);
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s;
}

.t-card:hover {
    box-shadow: 0 8px 24px rgba(22, 22, 26, .15);
}

.t-card img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.t-body {
    padding: 1.1rem 1.3rem 1.4rem;
}

.t-body p {
    margin-bottom: .6rem;
}

.t-link {
    color: var(--brand-dark);
    font-weight: 600;
    border-bottom: 2px solid var(--brand-red);
}

/* Scroll reveal (home.js adds .in) */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .6s ease, transform .6s ease;
}

.reveal.in {
    opacity: 1;
    transform: none;
}

@media (max-width: 768px) {
    .timeline::before {
        left: 8px;
        margin-left: 0;
    }

    .t-item,
    .t-item:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding: 0 0 2.2rem 2.4rem;
    }

    .t-item::before,
    .t-item:nth-child(even)::before {
        left: 0;
        right: auto;
    }

    .t-year,
    .t-item:nth-child(even) .t-year {
        position: static;
        display: block;
        margin-bottom: .4rem;
    }
}

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