/* Home page styles. Tokens come from main.css; the hero frame from hero-banner.css;
   tiles, mocks and kickers from main.css. */

/* ============================================
   HERO: what we do for the reader, and the team at work
   ============================================ */

.hero-home {
    background: var(--paper);
}

.hero-home .hero-container {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.hero-home .kicker {
    margin-bottom: 20px;
}

.hero-home .hero-title {
    margin-bottom: 26px;
    /* two even lines at every width, as on the law-firm and retail pages; set lines broke into three */
    text-wrap: balance;
}

.hero-home .hero-subtitle {
    max-width: 54ch;
}

/* One orchestrated entrance on load; the rest of the page stays still. */
.hero-home .hero-text > * {
    animation: riseIn 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-home .hero-text > :nth-child(2) { animation-delay: 0.06s; }
.hero-home .hero-text > :nth-child(3) { animation-delay: 0.12s; }
.hero-home .hero-text > :nth-child(4) { animation-delay: 0.18s; }

.hero-home .hero-image {
    animation: riseIn 0.9s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-home .hero-image-inner {
    max-width: 540px;
}

.hero-home .hero-image-img {
    object-position: 38% 50%;
}

/* ============================================
   HOW AN ENGAGEMENT RUNS: four tiles
   ============================================ */

.method-section {
    background: var(--paper);
    padding: var(--section-y) 0;
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.method-grid .tile-body {
    margin-top: auto;
}

.method-grid .tile-body h3 {
    font-size: 1.375rem;
}

/* The research tile holds the audit card on a mist ground */
.tile-audit .tile-media {
    aspect-ratio: auto;
    padding: 28px 28px 0;
    background: var(--mist);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.tile-forest .tile-media {
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(169, 201, 140, 0.22), transparent 60%),
        var(--forest);
}

.tile-forest .figure-big {
    font-size: clamp(4rem, 7.5vw, 6rem);
}

/* The growth line under the figure. An illustration, so no values: the flat stretch before
   go-live is dimmed, the growth after it is the one bright line (ivory on forest, about 8.5:1).
   Strokes keep their width at any size; the dot (r 6.5 in a 480 box) stays at least 8px across. */
.growth svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.growth path,
.growth circle {
    vector-effect: non-scaling-stroke;
}

.growth-grid {
    fill: none;
    stroke: rgba(247, 245, 240, 0.1);
    stroke-width: 1;
}

.growth-mark {
    fill: none;
    stroke: rgba(247, 245, 240, 0.24);
    stroke-width: 1;
}

.growth-base {
    fill: none;
    stroke: rgba(247, 245, 240, 0.32);
    stroke-width: 1;
}

.growth-wash-before {
    fill: rgba(247, 245, 240, 0.05);
}

.growth-wash {
    fill: rgba(247, 245, 240, 0.12);
}

.growth-before,
.growth-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.growth-before {
    stroke: rgba(247, 245, 240, 0.45);
}

.growth-line {
    stroke: var(--ivory);
}

.growth-dot {
    fill: var(--ivory);
    stroke: var(--forest);
    stroke-width: 2;
}

.growth-axis {
    position: relative;
    height: 18px;
    margin-top: 8px;
    font-size: 0.8125rem;
    line-height: 18px;
    color: rgba(247, 245, 240, 0.72);
}

.growth-axis span {
    position: absolute;
    top: 0;
    left: var(--x, 0);
    transform: translateX(-50%);
    white-space: nowrap;
}

.growth-axis span:first-child {
    transform: none;
}

/* The growth draws itself once, when the reveal marks the tile .animated; without the
   script, or with reduced motion, it is simply there. */
html.js .tile-forest .growth-reveal {
    transform: scaleX(0);
    transform-box: fill-box;
    transform-origin: 0 0;
    transition: transform 1.6s cubic-bezier(0.5, 0, 0.2, 1) 0.35s;
}

html.js .tile-forest.animated .growth-reveal {
    transform: scaleX(1);
}

html.js .tile-forest .growth-dot {
    opacity: 0;
    transition: opacity 0.4s ease 1.85s;
}

html.js .tile-forest.animated .growth-dot {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    html.js .tile-forest .growth-reveal {
        transform: none;
        transition: none;
    }

    html.js .tile-forest .growth-dot {
        opacity: 1;
        transition: none;
    }
}

.tile-forest .figure-label {
    display: block;
    margin-top: 8px;
    font-size: 1rem;
    color: rgba(247, 245, 240, 0.78);
}

/* The audit card */
.audit-switch {
    position: relative;
    z-index: 1;
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    background: var(--mist-2);
    border-radius: var(--radius-full);
}

.audit-switch button {
    border: 0;
    background: transparent;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.audit-switch button:hover {
    color: var(--ink);
}

.audit-switch button.is-active {
    background: var(--ink);
    color: var(--ivory);
}

.audit-stack {
    position: relative;
    z-index: 1;
    width: 100%;
}

.audit-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    padding: 26px 28px 20px;
    box-shadow: 0 32px 64px -40px rgba(14, 31, 20, 0.4);
}

.audit-card[hidden] {
    display: none;
}

.audit-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.audit-kicker {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--signal);
    margin: 0 0 4px;
}

.audit-title {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--ink);
    margin: 0;
}

.audit-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.audit-line {
    position: relative;
    padding: 12px 0 12px 32px;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line);
}

.audit-line:last-child {
    border-bottom: 0;
}

/* The box, then the tick that lands in it */
.audit-line::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--line-strong);
    background: var(--paper);
}

.audit-line::after {
    content: '';
    position: absolute;
    left: 6.5px;
    top: 16px;
    width: 5px;
    height: 9px;
    border: solid var(--forest);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.audit-foot {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--mist);
    border-radius: 12px;
}

.audit-foot-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--forest);
    margin: 0 0 4px;
}

.audit-foot p:last-child {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink-2);
}

/* The lines tick in once the tile has scrolled into view, and again on each tab switch */
html.js .animated .audit-card.is-active .audit-line {
    animation: riseIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(0.3s + var(--i) * 0.16s);
}

html.js .animated .audit-card.is-active .audit-line::before {
    animation: auditBox 0.25s ease-out both;
    animation-delay: calc(0.6s + var(--i) * 0.16s);
}

html.js .animated .audit-card.is-active .audit-line::after {
    animation: auditTick 0.25s ease-out both;
    animation-delay: calc(0.6s + var(--i) * 0.16s);
}

html.js .animated .audit-card.is-active .audit-foot {
    animation: riseIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: 1.2s;
}

/* Ticked state for the lines that are not animating */
html:not(.js) .audit-line::before,
.animated .audit-card:not(.is-active) .audit-line::before {
    border-color: var(--forest);
    background: #E6F1DC;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes auditTick {
    from { opacity: 0; transform: rotate(45deg) scale(0.5); }
    to { opacity: 1; transform: rotate(45deg) scale(1); }
}

@keyframes auditBox {
    from { border-color: var(--line-strong); background: var(--paper); }
    to { border-color: var(--forest); background: #E6F1DC; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-home .hero-text > *,
    .hero-home .hero-image,
    html.js .animated .audit-card.is-active .audit-line,
    html.js .animated .audit-card.is-active .audit-line::before,
    html.js .animated .audit-card.is-active .audit-line::after,
    html.js .animated .audit-card.is-active .audit-foot {
        animation: none;
    }

    .audit-line::before {
        border-color: var(--forest);
        background: #E6F1DC;
    }
}

/* ============================================
   PRODUCTS
   ============================================ */

.products-section {
    background: var(--ivory);
    padding: var(--section-y) 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: 40px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--paper);
}

.product-phronesis {
    background: #07332F;
    border-color: #07332F;
    color: var(--ivory);
}

.product-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

/* The real logos, as the product's heading */
.product-logo {
    margin: 0;
    line-height: 0;
}

.product-logo img {
    display: block;
    height: 112px;
    width: auto;
}

.product-phronesis .product-logo img {
    height: 124px;
}

.product-for {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-3);
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.product-phronesis .product-for {
    color: rgba(247, 245, 240, 0.8);
    border-color: var(--line-dark);
}

.product-desc {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink-3);
    margin: 0 0 24px;
}

.product-phronesis .product-desc {
    color: rgba(247, 245, 240, 0.78);
}

/* Keeps a hyphenated name such as M-Pesa on one line. */
.nowrap {
    white-space: nowrap;
}

.product-list {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    border-top: 1px solid var(--line);
}

.product-list li {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink-2);
    /* no single word left alone on a point's last line */
    text-wrap: pretty;
}

.product-list li::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    margin-top: 9px;
    border-radius: 50%;
    background: var(--signal);
}

.product-phronesis .product-list,
.product-phronesis .product-list li {
    border-color: var(--line-dark);
}

.product-phronesis .product-list li {
    color: rgba(247, 245, 240, 0.88);
}

.product-phronesis .product-list li::before {
    background: #B4762A;
}

.product-price {
    margin: auto 0 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.product-phronesis .product-price {
    color: var(--ivory);
}

.product-card .btn {
    align-self: flex-start;
}

.product-phronesis .btn:focus-visible {
    outline-color: #6FCFC2;
}

/* ============================================
   VALUES
   ============================================ */

.culture-section {
    background: var(--paper);
    padding: var(--section-y) 0;
}

.culture-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
}

.culture-values .section-title {
    margin-bottom: 16px;
}

.culture-intro {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--ink-3);
    margin: 0 0 32px;
    max-width: 54ch;
}

.culture-accordion {
    border-top: 1px solid var(--line-strong);
}

.culture-item {
    border-bottom: 1px solid var(--line);
}

.culture-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 20px 0;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: var(--ink);
}

.culture-title {
    display: flex;
    align-items: baseline;
    gap: 16px;
    font-size: 1.1875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.culture-title .num {
    display: inline-block;
    font-size: 0.9375rem;
    margin: 0;
    min-width: 1.6em;
}

.culture-toggle {
    position: relative;
    flex: none;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink);
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.culture-toggle::before,
.culture-toggle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 1.5px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.culture-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.culture-item.active .culture-toggle {
    transform: rotate(45deg);
    background: var(--ink);
    border-color: var(--ink);
    color: var(--ivory);
}

/* Collapses to nothing: the grid item carries no padding, so the 0fr row is truly 0 */
.culture-content {
    display: grid;
    grid-template-rows: 0fr;
    margin-bottom: 0;
    transition: grid-template-rows 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), margin-bottom 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.culture-item.active .culture-content {
    grid-template-rows: 1fr;
    margin-bottom: 22px;
}

.culture-text {
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 48px 0 calc(1.6em + 16px);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink-3);
    max-width: 60ch;
}

/* A square photo cropped wide (4:3 on desktop, 16:9 on phones): start the crop at the top so
   the engineer's head stays in frame. */
.tile-photo-top {
    object-position: 50% 0%;
}

.culture-image {
    margin: 0;
}

.culture-image img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 72% 50%;
    border-radius: var(--radius-xl);
}

.culture-image figcaption {
    margin-top: 12px;
    font-size: 0.9375rem;
    color: var(--ink-4);
}

/* ============================================
   BLOG PREVIEW (card styles live in blog-card.css)
   ============================================ */

.blog-preview-section {
    background: var(--mist);
    padding: var(--section-y) 0;
}

.blog-preview-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
}

.blog-preview-head .section-head {
    margin-bottom: 0;
}

.blog-preview-all {
    flex: none;
    margin-bottom: 6px;
}

.blog-carousel {
    position: relative;
}

.blog-nav-btn {
    display: none;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* ============================================
   CLOSING
   ============================================ */

.cta-section {
    background: var(--ink);
    color: var(--ivory);
    padding: var(--section-y) 0 calc(var(--section-y) * 0.85);
}

.cta-inner {
    max-width: 840px;
}

.cta-title {
    color: var(--ivory);
    font-size: clamp(2.25rem, 4.4vw, 3.5rem);
    letter-spacing: -0.03em;
    line-height: 1.04;
    margin: 0 0 36px;
}

.cta-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cta-link {
    color: rgba(247, 245, 240, 0.75);
    font-size: 1.0625rem;
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-color: rgba(247, 245, 240, 0.3);
}

.cta-link:hover {
    color: var(--ivory);
    text-decoration-color: var(--ivory);
}

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

@media (max-width: 992px) {
    .hero-home .hero-container {
        grid-template-columns: 1fr;
    }

    .hero-home .hero-image-img {
        object-position: 50% 40%;
    }

    .culture-layout {
        grid-template-columns: 1fr;
    }

    .culture-image {
        max-width: 520px;
    }

    .culture-image img {
        aspect-ratio: 4 / 3;
    }

    .product-card {
        padding: 32px;
    }
}

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

    .product-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tile-audit .tile-media {
        padding: 20px 16px 0;
    }

    .audit-card {
        padding: 22px 20px 16px;
    }

    .audit-head {
        flex-direction: column;
        gap: 10px;
    }

    .product-card {
        padding: 28px 24px;
    }

    .product-logo img {
        height: 96px;
    }

    .product-phronesis .product-logo img {
        height: 108px;
    }

    .blog-preview-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .blog-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 16px;
        padding: 4px 44px;
        margin: 0 -16px;
        scroll-padding: 44px;
    }

    .blog-grid::-webkit-scrollbar {
        display: none;
    }

    .blog-card {
        flex: 0 0 calc(100vw - 104px);
        scroll-snap-align: center;
    }

    .blog-nav-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid var(--line-strong);
        background: var(--paper);
        color: var(--ink);
        font-size: 0.8125rem;
        cursor: pointer;
        z-index: 2;
    }

    .blog-prev { left: -8px; }
    .blog-next { right: -8px; }

    .cta-title {
        margin-bottom: 28px;
    }

    .cta-buttons .btn {
        width: 100%;
    }
}
