/* Homepage chapters: the sections between the statement and contact, each under a centered header. */

/* ---------- INTRO: the statement keeps its original type and is lit word by word as it scrolls into view ---------- */
/* The script sets --lit from 0 to 1 on each word; without it every word shows fully lit. */
.lit-word { opacity: calc(.18 + .82 * var(--lit, 1)); }

/* ---------- CHAPTER FRAME ---------- */
/* Sections are separated by space alone, no divider lines. */
.chapter {
    max-width: 1100px;
    padding-top: var(--section-gap);
    padding-bottom: 0;
    scroll-margin-top: 120px;
}
.chapter-label { margin-bottom: var(--heading-gap); text-align: center; }
.chapter-title {
    margin: 0;
    font-size: clamp(1.7rem, 3.8vw, 2.3rem);
    font-weight: 500;
    letter-spacing: -.02em;
    line-height: 1.15;
    text-wrap: balance;
    scroll-margin-top: 150px;
}
.chapter-sub { margin: .75rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.chapter-body { min-width: 0; }

/* ---------- 01 SCOPE: two banks joined by a span ---------- */
/* A faint hairline under the Scope heading, running from Business to Technology (the width of .banks).
   A half-pixel border draws as the thinnest crisp line each screen can show. It sits nearer the banks
   than the heading; the heading-to-banks distance is unchanged. */
#areas .chapter-label { margin-bottom: 20px; }
#areas .chapter-title::after {
    content: '';
    display: block;
    width: min(760px, 100%);
    height: 0;
    margin: calc(var(--heading-gap) - 4px) auto 0;
    border-top: .5px solid rgba(245,247,250,.3);
}
.banks {
    --bank-h: clamp(1.5rem, 2.6vw, 1.9rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(64px, 12%, 100px) minmax(0, 1fr);
    gap: 0 1.5rem;
    align-items: start;
    max-width: 760px;
    margin: 0 auto;
}
.bank h3 { margin: 0 0 1rem; font-size: var(--bank-h); font-weight: 500; letter-spacing: -.025em; line-height: 1.2; }
.bank p { max-width: 360px; margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.75; }
.bank ul { margin: 1.6rem 0 0; padding: 0; list-style: none; display: grid; gap: .6rem; font-size: .8rem; color: var(--text); }
.bank--far { text-align: right; }
.bank--far p { margin-left: auto; }
.bank-span { display: flex; align-items: center; height: calc(var(--bank-h) * 1.2); }
.bank-span::before,
.bank-span::after { content: ''; flex: 1; height: 0; border-top: .5px solid rgba(245,247,250,.5); }

/* ---------- 02 PROCESS: one span from vision to implementation ---------- */
.span {
    --span-gap: 1.5rem;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--span-gap);
}
.span-half { position: relative; min-width: 0; }
/* The tick where design hands over to development. */
.span-half + .span-half::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--span-gap) / -2);
    width: 1px;
    height: calc(2.4rem + 14px);
    background: rgba(245,247,250,.4);
}
.span-phase {
    margin: 0 0 1.4rem;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1rem;
    letter-spacing: .26em;
    text-transform: uppercase;
}
.span-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem var(--span-gap);
}
.span-step { position: relative; padding-top: 1.6rem; }
.span-step h3 { margin: 0 0 .45rem; font-size: .9rem; font-weight: 500; line-height: 1.3; }
.span-step p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.6; }
.span-node {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 9px;
    height: 9px;
    border: 1px solid var(--muted);
    border-radius: 50%;
    background: var(--bg);
    transition: background .45s ease, border-color .45s ease, box-shadow .45s ease;
}
.span-node.is-lit { border-color: var(--text); background: var(--text); box-shadow: 0 0 0 4px rgba(245,247,250,.08); }
.span-line { display: none; position: absolute; width: 1px; height: 1px; background: var(--hairline); pointer-events: none; }
.span--ready .span-line { display: block; }
.span-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--text);
    transform-origin: left;
    transform: scaleX(var(--span-progress, 1));
}
.span--vertical .span-line::after { transform-origin: top; transform: scaleY(var(--span-progress, 1)); }

.studio-notes {
    margin: clamp(3rem, 6vw, 4.5rem) 0 0;
    padding: 1.75rem 0 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem var(--span-gap, 1.5rem);
    border-top: 1px solid var(--hairline);
}
.studio-notes h3 { margin: 0 0 .45rem; font-size: .9rem; font-weight: 500; line-height: 1.3; }
.studio-notes p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.6; }

/* ---------- 03 PROJECTS: separate cards, staggered left and right ---------- */
#work .projects-grid { max-width: 760px; gap: 1.75rem; margin-top: 0; }
#work .project-card {
    position: relative;
    width: min(100%, 560px);
    justify-self: start;
    border: 0;
    border-radius: 2px;
    background: rgba(2,4,8,.6);
    text-align: center;
}
#work .project-card:last-child { border-bottom: 0; }
/* Millennium Towers is Defender's card scaled down as a whole, so text and spacing shrink together.
   The standalone `scale` property leaves the scroll reveal's transform free. */
#work .project-card.project-card--mirror {
    justify-self: end;
    margin-top: 14px;
    scale: .82;
    transform-origin: top right;
}
/* Its title and description also run a size smaller inside the card. */
#work .project-card--mirror .product-name { font-size: clamp(1.45rem, 2.9vw, 2.1rem); }
#work .project-card--mirror .project-preview { font-size: .9rem; }
/* A faint frame with brighter corner marks, which reach further on hover and while open. */
#work .project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(208,222,244,.12);
    border-radius: inherit;
    pointer-events: none;
    transition: border-color .4s ease;
}
#work .project-card::before {
    --mark: 14px;
    --ink: rgba(245,247,250,.6);
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(var(--ink), var(--ink)) left top / var(--mark) 1px,
        linear-gradient(var(--ink), var(--ink)) left top / 1px var(--mark),
        linear-gradient(var(--ink), var(--ink)) right top / var(--mark) 1px,
        linear-gradient(var(--ink), var(--ink)) right top / 1px var(--mark),
        linear-gradient(var(--ink), var(--ink)) left bottom / var(--mark) 1px,
        linear-gradient(var(--ink), var(--ink)) left bottom / 1px var(--mark),
        linear-gradient(var(--ink), var(--ink)) right bottom / var(--mark) 1px,
        linear-gradient(var(--ink), var(--ink)) right bottom / 1px var(--mark);
    background-repeat: no-repeat;
    transition: background-size .55s cubic-bezier(.215,.61,.355,1);
}
#work .project-card:hover::before,
#work .project-card.open::before { --mark: 30px; }
#work .project-card:hover::after,
#work .project-card.open::after { border-color: rgba(208,222,244,.24); }
/* Centered stack: kind, name, tag, a short rule, then the description. */
#work .product-summary { padding: 34px 64px 30px; }
#work .project-heading { flex: 1; justify-items: center; gap: 8px; text-align: center; }
#work .product-name { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
#work .project-preview { margin-top: 4px; font-size: .95rem; }
#work .project-preview::before {
    content: '';
    display: block;
    width: 28px;
    height: 1px;
    margin: 0 auto 12px;
    background: rgba(245,247,250,.35);
}
#work .product-panel { padding: 0 64px 32px; text-align: center; }
#work .product-panel > :first-child { margin-top: 0; }
#work .product-actions { justify-content: center; }
/* Each arrow sits on the side that faces the other card, a set distance from the centered text. */
#work .product-chevron { right: auto; left: calc(50% + 205px); }
#work .project-card--mirror .product-chevron { left: auto; right: calc(50% + 205px); }
/* ---------- CLOSING: a moving row of client logos, then the contact link ---------- */
.closing {
    position: relative;
    z-index: 10;
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--section-gap) 2.5rem calc(var(--group-gap) + clamp(2.5rem, 6vw, 4.5rem));
    text-align: center;
    scroll-margin-top: 120px;
}
/* A lighter, smaller heading than the chapters above. */
.closing .chapter-title { font-size: clamp(.95rem, 1.8vw, 1.18rem); font-weight: 400; }

/* Without script, or with reduced motion, the logos sit still in a plain row above the contact link. */
.field { --logo-scale: 1; position: relative; max-width: 1000px; margin: 0 auto; }
.field-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .5rem 1rem;
}
.field-item { --logo-h: 80px; --logo-y: 0px; }
.field-item--land { --logo-h: 66px; }
.field-item--innovatio { --logo-h: 92px; }
.field-item--eos { --logo-h: 82px; }
.field-item--optical { --logo-h: 134px; --logo-y: -12px; }
.field-link {
    display: grid;
    place-items: center;
    width: 100%;
    height: 144px;
    border-radius: 2px;
}
.field-link img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(var(--logo-h) * var(--logo-scale));
    transform: translateY(calc(var(--logo-y) * var(--logo-scale)));
    opacity: .94;
    transition: opacity var(--transition);
}
.field-link:hover img,
.field-link:focus-visible img { opacity: 1; }
.field-link:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.closing-contact { position: relative; z-index: 1; margin-top: calc(clamp(7.5rem, 15vw, 11rem) - 7px); font-size: .9rem; }

/* Live: the script glides the logos along one row and fades them out at its edges. */
.closing--live .field { height: 162px; overflow: hidden; touch-action: pan-y; }
.closing--live .field-list { display: block; position: absolute; inset: 0; }
.closing--live .field-item { position: absolute; top: 50%; left: 50%; width: 192px; will-change: transform; }

/* ---------- MOTION ---------- */
@media (prefers-reduced-motion: no-preference) {
    /* Both Scope lines draw out from their centers in the same way: the hairline under the heading,
       and the span between the banks (its two halves grow outward from the middle). */
    .reveal-ready #areas .chapter-title::after,
    .reveal-ready .bank-span::before,
    .reveal-ready .bank-span::after {
        transform: scaleX(0);
        transition: transform 1.3s cubic-bezier(.215,.61,.355,1) .5s;
    }
    .reveal-ready .bank-span::before { transform-origin: right; }
    .reveal-ready .bank-span::after { transform-origin: left; }
    .reveal-ready #areas .chapter-title.in::after,
    .reveal-ready .bank-span.in::before,
    .reveal-ready .bank-span.in::after { transform: none; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .span { grid-template-columns: minmax(0, 1fr); row-gap: 2.5rem; }
    .span-half + .span-half::before { display: none; }
    .span-phase { margin-bottom: 1.25rem; padding-left: 2rem; }
    .span-steps { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
    .span-step { padding: 0 0 0 2rem; }
    .span-node { top: calc(.585rem - 4.5px); }
}
@media (max-width: 760px) {
    .banks { grid-template-columns: minmax(0, 1fr); }
    /* Stacked on phones, both banks center under the heading. */
    .bank, .bank--far { text-align: center; }
    .bank p { margin-left: auto; margin-right: auto; }
    .bank-span { height: auto; margin: 2.5rem 0; }
    .studio-notes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
    #work .project-card { width: 100%; }
    #work .project-card.project-card--mirror { width: 100%; margin-top: 0; scale: none; }
}
@media (max-width: 700px) {
    /* Keep the stack in source order over work-sample.css's phone rows. */
    #work .project-card .product-beta,
    #work .project-card .project-preview { grid-row: auto; }
    #work .project-card .product-summary { padding: 28px 48px 24px; }
    #work .project-card .product-panel { padding: 0 24px 26px; }
    #work .project-card .product-chevron { left: auto; right: 14px; }
    #work .project-card--mirror .product-chevron { right: auto; left: 14px; }
    /* On phones Millennium Towers scales down a little less, centered under Defender. */
    #work .project-card.project-card--mirror { scale: .94; transform-origin: top center; }
    /* Smaller logos on phones; the plain row becomes rows of three and two. */
    .field { --logo-scale: .75; }
    .field-list { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .25rem .5rem; }
    .field-item { grid-column: span 2; }
    .field-item:nth-child(n+4) { grid-column: span 3; }
    .field-link { height: 108px; }
    .closing--live .field { height: 124px; }
    .closing--live .field-item { width: 146px; }
}
@media (max-width: 520px) {
    .chapter,
    .closing { padding-left: 1.5rem; padding-right: 1.5rem; }
}
