/*
 * Conservative production refinements.
 * Preserves the existing content and component structure while correcting
 * responsive layout collisions found in the July 10 visual audit.
 */

@media (min-width: 901px) {
    .hero-copy h1 {
        font-size: clamp(3.9rem, 5.8vw, 5.3rem);
        line-height: 0.94;
    }
}

/* Refine hierarchy without replacing the established site language. */
.mobile-rail-link,
.rail-nav-label {
    display: none;
}

.hero-text-action {
    align-self: center;
    color: var(--ink-2);
    font-size: 0.92rem;
    font-weight: 900;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
}

.hero-text-action:hover,
.hero-text-action:focus-visible {
    color: var(--orange);
}

.command-pipeline {
    display: none;
}

.work-card.is-live {
    background:
        linear-gradient(135deg, rgba(211, 255, 80, 0.48), rgba(255, 248, 232, 0.94) 45%, rgba(189, 239, 255, 0.72)),
        #fff8e8;
    outline: 3px solid var(--line);
    outline-offset: 3px;
}

.work-card.is-live .work-image-link {
    background:
        linear-gradient(135deg, rgba(211, 255, 80, 0.62), rgba(189, 239, 255, 0.86)),
        var(--paper);
}

.work-card.is-live .status span {
    background: var(--mint);
    box-shadow: 0 0 0 2px rgba(18, 16, 13, 0.12);
}

.work-card.is-live .card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brief-details {
    border: 2px dashed rgba(18, 16, 13, 0.23);
    border-radius: 10px 7px 9px 8px;
    background: rgba(255, 255, 255, 0.68);
    padding: 0.15rem 0.8rem;
}

.brief-details summary {
    cursor: pointer;
    color: var(--ink-2);
    font-size: 0.9rem;
    font-weight: 900;
    padding: 0.78rem 0;
}

.brief-details-body {
    display: grid;
    gap: 0.85rem;
    border-top: 2px solid rgba(18, 16, 13, 0.12);
    padding: 0.85rem 0 0.7rem;
}

@media (max-width: 900px) {
    body {
        padding-bottom: 92px;
    }

    .site-header:not(.product-site-header) .site-nav {
        display: none;
    }

    .side-rail {
        height: 88px;
        justify-content: space-evenly;
        gap: 0.2rem;
        overflow: hidden;
        padding: 0.45rem 0.55rem 0.35rem;
    }

    .side-rail .rail-app-icon,
    .side-rail .rail-context-link {
        display: none;
    }

    .side-rail .mobile-rail-link,
    .side-rail .rail-primary-link {
        display: flex;
        flex: 1 1 25%;
        flex-direction: column;
        gap: 0.18rem;
        width: auto;
        height: 64px;
        min-width: 0;
        border-radius: 9px 7px 8px 7px;
        box-shadow: 0 3px 0 var(--line);
    }

    .side-rail .rail-nav-label {
        display: block;
        max-width: 100%;
        font-size: 0.62rem;
        font-weight: 900;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
    }

    .side-rail .rail-primary-link svg,
    .side-rail .mobile-rail-link svg {
        width: 19px;
        height: 19px;
    }
}

@media (max-width: 560px) {
    .hero-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-text-action {
        align-self: center;
        justify-self: center;
        grid-column: 1 / -1;
        padding: 0.25rem;
    }

    .work-card.is-live .card-actions {
        grid-template-columns: 1fr;
    }
}

.home-route-grid a:nth-child(5n + 1) {
    background: var(--paper);
}

.home-route-grid a:nth-child(5n + 2),
.home-route-grid a:nth-child(5n) {
    background: var(--mint);
}

.home-route-grid a:nth-child(5n + 3) {
    background: var(--sky);
}

.home-route-grid a:nth-child(5n + 4) {
    background: var(--cream);
}

.portfolio-division + .portfolio-division {
    margin-top: 3.2rem;
    border-top: 3px solid var(--line);
    padding-top: 3.2rem;
}

.portfolio-division-heading {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.portfolio-division-heading h2 {
    margin: 0;
    font-family: "Space Grotesk", Inter, sans-serif;
    font-size: clamp(2rem, 3.8vw, 3.25rem);
    line-height: 0.96;
}

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

@media (max-width: 560px) {
    .site-nav {
        justify-content: space-between;
        gap: 0;
        overflow-x: visible;
    }

    .site-nav a {
        padding-inline: 0.55rem;
        font-size: 0.86rem;
    }

    .side-rail {
        justify-content: space-between;
        gap: 0;
        padding-inline: 0.4rem;
    }

    .side-rail a {
        flex-basis: 40px;
    }
}

/* A restrained maker finish: tactile, not decorative. */
.atlas-hero {
    position: relative;
    isolation: isolate;
}

.atlas-hero::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 14% 24%, rgba(143, 67, 28, 0.16) 0 1px, transparent 1.4px),
        radial-gradient(circle at 88% 72%, rgba(18, 16, 13, 0.1) 0 0.7px, transparent 1.2px);
    background-size: 17px 19px, 13px 17px;
    mix-blend-mode: multiply;
    opacity: 0.28;
}

.atlas-hero > * {
    position: relative;
    z-index: 1;
}

.command-topline {
    border-radius: 12px 8px 12px 7px;
    box-shadow: 0 6px 0 var(--line), 4px 5px 0 rgba(143, 67, 28, 0.12);
}

.command-card {
    border-radius: 10px 7px 12px 8px;
    box-shadow: 0 14px 0 var(--line), 5px 9px 0 rgba(143, 67, 28, 0.1), var(--soft-shadow);
}

.home-route-grid a,
.portfolio-system,
.work-card {
    border-radius: 11px 7px 10px 8px;
    box-shadow: 0 7px 0 var(--line), 4px 7px 0 rgba(143, 67, 28, 0.1);
}

@media (min-width: 901px) {
    .home-route-grid a:nth-child(odd),
    .work-card:nth-child(odd) {
        transform: rotate(-0.28deg);
    }

    .home-route-grid a:nth-child(even),
    .work-card:nth-child(even) {
        transform: rotate(0.24deg);
    }

    .home-route-grid a:nth-child(odd):hover,
    .home-route-grid a:nth-child(odd):focus-visible,
    .work-card:nth-child(odd):hover {
        transform: translateY(-2px) rotate(-0.28deg);
    }

    .home-route-grid a:nth-child(even):hover,
    .home-route-grid a:nth-child(even):focus-visible,
    .work-card:nth-child(even):hover {
        transform: translateY(-2px) rotate(0.24deg);
    }
}

@media (max-width: 560px) {
    .side-rail {
        height: 88px;
        justify-content: space-evenly;
        gap: 0.2rem;
        padding: 0.45rem 0.55rem 0.35rem;
    }

    .side-rail .mobile-rail-link,
    .side-rail .rail-primary-link {
        flex-basis: 25%;
        width: auto;
        height: 64px;
    }
}

/* Homepage: one focused product chooser instead of a second navigation stack. */
.atlas-hero {
    min-height: auto;
}

@media (min-width: 901px) {
    .atlas-hero .hero-copy h1 {
        font-size: clamp(3.5rem, 4.7vw, 4.6rem);
        line-height: 0.96;
    }
}

.atlas-hero .signal-board {
    min-height: 33rem;
}

.atlas-hero .command-console {
    grid-template-columns: minmax(8.5rem, 0.54fr) minmax(17rem, 1fr);
    grid-template-rows: auto minmax(18rem, auto);
    width: min(36rem, 100%);
}

.atlas-hero .command-deck {
    grid-column: 2;
}

.atlas-hero .capability-panel,
.atlas-hero .command-pipeline {
    display: none;
}

.atlas-hero .command-console::before {
    inset: 3.8rem 2rem 3.25rem;
}

.atlas-hero .command-card-actions {
    grid-template-columns: 1fr;
}

.atlas-hero .command-facts {
    display: none;
}

.atlas-hero .command-mini-link:nth-of-type(n + 3) {
    display: none;
}

.home-route-section {
    grid-template-columns: minmax(0, 0.56fr) minmax(0, 1fr);
    gap: 1.7rem;
    padding-block: clamp(3rem, 5vw, 4.25rem);
}

.home-route-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-route-grid .home-route-card {
    position: relative;
    min-height: 12.5rem;
    align-content: stretch;
    gap: 0;
    overflow: hidden;
    padding: 0;
}

.home-route-index {
    position: absolute;
    z-index: 2;
    top: 0.85rem;
    left: 0.9rem;
    color: var(--orange);
    font-family: "Space Grotesk", Inter, sans-serif;
    font-size: 0.76rem;
    font-weight: 900;
}

.home-route-art {
    display: grid;
    min-height: 7.75rem;
    place-items: center;
    border-bottom: 2px solid rgba(18, 16, 13, 0.14);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0)),
        rgba(255, 255, 255, 0.22);
    padding: 1.25rem 1rem 0.75rem;
}

.home-route-art img {
    width: 4.6rem;
    height: 4.6rem;
    border: 2px solid var(--line);
    border-radius: 13px 10px 12px 9px;
    background: var(--paper);
    box-shadow: 0 5px 0 var(--line);
    object-fit: cover;
}

.home-route-title {
    display: grid;
    gap: 0.28rem;
    padding: 0.85rem 2.75rem 0.95rem 0.95rem;
}

.home-route-title strong {
    font-family: "Space Grotesk", Inter, sans-serif;
    font-size: 1.18rem;
    line-height: 1;
}

.home-route-title small {
    color: var(--muted);
    font-size: 0.63rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    line-height: 1.16;
    text-transform: uppercase;
}

.home-route-arrow {
    position: absolute;
    right: 0.8rem;
    bottom: 0.8rem;
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--yellow);
    font-size: 1rem;
    font-weight: 900;
}

.home-resource-links {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: -0.65rem;
}

.home-resource-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 2px solid rgba(18, 16, 13, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink-2);
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 900;
    text-decoration: none;
}

.home-resource-links a:hover,
.home-resource-links a:focus-visible {
    border-color: var(--line);
    background: var(--yellow);
}

/* Homepage: keep the app chooser in the hero and move future scale to Work. */
.home-directory {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: clamp(1.25rem, 4vw, 4rem);
    border-top: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
    padding-inline: max(1rem, calc((100vw - var(--max)) / 2));
    padding-block: clamp(2.35rem, 4vw, 3.5rem);
}

.home-directory h2 {
    max-width: 14ch;
    margin: 0.3rem 0 0.7rem;
}

.home-directory p {
    max-width: 58ch;
    margin: 0;
}

.home-directory .button {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .atlas-hero .command-console {
        grid-template-columns: minmax(8.5rem, 0.54fr) minmax(17rem, 1fr);
        width: min(40rem, 100%);
    }

    .home-route-section {
        grid-template-columns: 1fr;
    }

    .home-resource-links {
        grid-column: auto;
        margin-top: 0;
    }

    .home-directory {
        grid-template-columns: 1fr;
        align-items: start;
        padding-inline: 1rem;
    }

    .home-directory .button {
        justify-self: start;
    }
}

@media (max-width: 560px) {
    .atlas-hero .command-console {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .atlas-hero .command-deck {
        grid-column: auto;
    }

    .atlas-hero .command-console::before {
        inset: 4.25rem 1rem 2rem;
    }

    .atlas-hero .signal-board {
        min-height: 30rem;
    }

    .atlas-hero .app-deck-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .atlas-hero .app-tab {
        grid-template-columns: 1fr;
        min-height: 4.45rem;
        gap: 0.22rem;
        place-items: center;
        padding: 0.45rem 0.3rem;
        text-align: center;
    }

    .atlas-hero .app-tab img {
        width: 1.95rem;
        height: 1.95rem;
    }

    .atlas-hero .app-tab b {
        font-size: 0.72rem;
    }

    .atlas-hero .app-tab small {
        display: none;
    }

    .atlas-hero .command-deck {
        min-height: 12.9rem;
    }

    .atlas-hero .command-icon-shell {
        width: 3.65rem;
        height: 3.65rem;
    }

    .atlas-hero .command-card strong {
        font-size: 1.4rem;
    }

    .home-route-grid {
        grid-template-columns: 1fr;
    }

    .home-route-grid .home-route-card {
        min-height: 7.4rem;
        grid-template-columns: 5.7rem minmax(0, 1fr);
    }

    .home-route-art {
        min-height: 0;
        border-right: 2px solid rgba(18, 16, 13, 0.14);
        border-bottom: 0;
        padding: 1.15rem 0.55rem 0.65rem;
    }

    .home-route-art img {
        width: 3.45rem;
        height: 3.45rem;
    }

    .home-route-title {
        align-content: end;
        padding: 1.15rem 3rem 0.95rem 0.9rem;
    }
}

/* July 20 polish: keep mobile navigation out of the content and make Work scan lighter. */
@media (max-width: 900px) {
    body {
        padding-bottom: 0;
    }

    .side-rail {
        position: sticky;
        top: var(--header-height);
        left: auto;
        bottom: auto;
        width: 100%;
        height: auto;
        min-height: 70px;
        flex-direction: row;
        border-right: 0;
        border-bottom: 3px solid var(--line);
        padding: 0.42rem 0.55rem 0.5rem;
    }
}

.filtered-grid {
    align-items: start;
    gap: 1.05rem;
}

.filtered-grid .work-card {
    gap: 0.75rem;
    padding: 0.85rem;
}

.filtered-grid .work-image-link {
    aspect-ratio: 1 / 0.6;
}

.filtered-grid .work-image-link img {
    width: min(54%, 9rem);
}

.filtered-grid .card-body {
    gap: 0.5rem;
}

.filtered-grid .work-card h3 {
    font-size: 1.48rem;
}

.filtered-grid .work-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.filtered-grid .tags {
    gap: 0.35rem;
}

.filtered-grid .tags span {
    padding: 0.24rem 0.45rem;
    font-size: 0.74rem;
}

@media (min-width: 901px) {
    .filtered-grid .app-card-facts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filtered-grid .app-card-facts div {
        grid-template-columns: 1fr;
        gap: 0.16rem;
        padding: 0.46rem 0.5rem;
    }

    .filtered-grid .card-actions .button {
        min-height: 2.65rem;
        padding: 0.7rem 0.78rem;
    }
}

@media (max-width: 560px) {
    .side-rail {
        min-height: 66px;
        padding-inline: 0.45rem;
    }

    .side-rail .mobile-rail-link,
    .side-rail .rail-primary-link {
        height: 52px;
        box-shadow: 0 3px 0 var(--line);
    }

    .filtered-grid .work-image-link {
        aspect-ratio: 1 / 0.64;
    }

    .filtered-grid .work-card p {
        -webkit-line-clamp: 4;
    }
}
