/*
 * Modular layout overrides.
 * Keep broad responsive/layout fixes here so the main visual system can evolve separately.
 */

.header-bar,
.hero-stage,
.hero-column,
.hero-aside,
.hero-panel,
.portfolio-grid,
.portfolio-card {
    min-width: 0;
}

.header-bar {
    gap: clamp(16px, 2.5vw, 28px);
}

.site-nav {
    gap: clamp(14px, 2vw, 24px);
}

.hero {
    padding-top: clamp(32px, 5vw, 56px);
}

.hero-stage {
    grid-template-columns: minmax(0, 1fr) minmax(300px, clamp(320px, 33vw, 440px));
    gap: clamp(34px, 5vw, 72px);
    align-items: center;
}

.hero-column {
    max-width: 100%;
}

.hero-title {
    max-width: min(12ch, 100%);
    font-size: clamp(3.25rem, 5.7vw, 5.8rem);
    line-height: 0.94;
    overflow-wrap: break-word;
    hyphens: auto;
}

.hero-title span {
    max-width: min(24ch, 100%);
}

.hero-summary {
    max-width: min(58ch, 100%);
}

.hero-aside {
    justify-self: end;
    width: min(100%, 440px);
    max-width: 100%;
}

.hero-panel {
    width: 100%;
}

.hero-scrub-copy {
    min-height: auto;
}

.hero-scrub-base,
.hero-scrub-active {
    max-width: min(10ch, 100%);
    font-size: clamp(2rem, 3.25vw, 3.35rem);
    overflow-wrap: break-word;
}

.hero-panel-text,
.hero-metric-value,
.hero-note {
    overflow-wrap: break-word;
}

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

@media (max-width: 1180px) {
    :root {
        --header-height: 132px;
    }

    .header-bar {
        grid-template-columns: 1fr auto;
        align-items: start;
        border-radius: 28px;
        padding: 16px 18px;
    }

    .site-nav {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .hero-stage {
        grid-template-columns: 1fr;
        min-height: auto;
        align-items: start;
    }

    .hero-column {
        padding-top: clamp(30px, 5vw, 58px);
        padding-bottom: 0;
    }

    .hero-title {
        max-width: min(12.5ch, 100%);
        font-size: clamp(3.15rem, 8vw, 5.8rem);
    }

    .hero-aside {
        justify-self: start;
        width: min(100%, 760px);
        padding-top: 0;
    }

    .hero-panel-text {
        max-width: 48ch;
    }

    .hero-scrub-base,
    .hero-scrub-active {
        max-width: min(13ch, 100%);
    }
}

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

@media (max-width: 720px) {
    :root {
        --header-height: 156px;
    }

    .header-bar {
        grid-template-columns: 1fr;
    }

    .header-cta {
        display: none;
    }

    .hero-title {
        max-width: 100%;
        font-size: clamp(2.55rem, 12vw, 4.3rem);
    }

    .hero-title span {
        max-width: 100%;
    }

    .hero-panel {
        border-radius: 24px;
    }

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

@media (max-width: 420px) {
    .site-nav {
        gap: 10px 14px;
    }

    .site-nav a {
        font-size: 0.7rem;
        letter-spacing: 0.07em;
    }

    .hero-title {
        letter-spacing: -0.045em;
    }
}

/*
 * Display typography cleanup.
 * The smaller body/card text works well, so these overrides only target the
 * oversized hero/display copy that was feeling cramped and inconsistent.
 */
.hero-title,
.section-title,
.contact-title,
.hero-scrub-base {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-feature-settings: "kern";
}

.hero-title {
    max-width: min(980px, 100%);
    font-size: clamp(2.85rem, 6.8vw, 5.65rem);
    line-height: 1.04;
    letter-spacing: -0.038em;
    text-wrap: balance;
    overflow-wrap: normal;
    hyphens: none;
}

.hero-title span {
    max-width: min(760px, 100%);
    margin-top: 18px;
    font-size: clamp(1.04rem, 1.35vw, 1.22rem);
    line-height: 1.48;
    letter-spacing: -0.012em;
    font-weight: 500;
}

.section-title,
.contact-title {
    max-width: min(820px, 100%);
    font-size: clamp(2rem, 3.55vw, 3.45rem);
    line-height: 1.08;
    letter-spacing: -0.032em;
    text-wrap: balance;
}

.contact-title {
    max-width: min(720px, 100%);
}

.hero-stage {
    align-items: center;
}

.hero-column {
    padding-top: clamp(34px, 5vw, 64px);
}

.hero-scrub-copy {
    display: block;
    margin-bottom: 24px;
    min-height: 0;
}

.hero-scrub-base {
    max-width: min(15ch, 100%);
    color: var(--text);
    font-size: clamp(1.95rem, 2.75vw, 2.85rem);
    line-height: 1.08;
    letter-spacing: -0.032em;
}

.hero-scrub-active,
.hero-scrub-beam,
.hero-scrub-glow {
    display: none;
}

.hero-panel {
    transform: none;
}

.hero-column,
.hero-orbit,
.hero-stage::before,
.hero-stage::after {
    transform: none;
}

@media (max-width: 1180px) {
    .hero-title {
        max-width: min(900px, 100%);
        font-size: clamp(2.85rem, 7.4vw, 5.3rem);
    }

    .hero-title span {
        max-width: min(680px, 100%);
    }

    .hero-scrub-base {
        max-width: min(18ch, 100%);
    }
}

@media (max-width: 720px) {
    .hero-title {
        max-width: 100%;
        font-size: clamp(2.35rem, 10vw, 3.8rem);
        line-height: 1.06;
        letter-spacing: -0.032em;
    }

    .hero-title span {
        margin-top: 14px;
        font-size: 1rem;
        line-height: 1.5;
    }

    .section-title,
    .contact-title {
        font-size: clamp(1.9rem, 8vw, 2.75rem);
        line-height: 1.1;
    }

    .hero-scrub-base {
        font-size: clamp(1.75rem, 8vw, 2.35rem);
    }
}

/*
 * iOS/mobile portfolio card clipping fix.
 * Mobile Safari can be touchy when grid children combine overflow clipping,
 * reveal transforms, pseudo-elements, and ancestor overflow rules. These
 * overrides keep the card content in normal document flow on narrow screens.
 */
@media (max-width: 720px) {
    main,
    .section-dark,
    #portfolio,
    #portfolio .section-shell,
    #portfolio .portfolio-grid,
    #portfolio .portfolio-card {
        overflow: visible;
    }

    #portfolio .section-shell {
        gap: 34px;
    }

    #portfolio .portfolio-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 18px;
    }

    #portfolio .portfolio-card {
        display: block;
        width: 100%;
        min-height: auto;
        height: auto;
        padding: 24px;
        contain: none;
        transform: none;
        isolation: isolate;
    }

    #portfolio .portfolio-card > * {
        position: relative;
        z-index: 1;
    }

    #portfolio .portfolio-card p {
        overflow: visible;
    }

    #portfolio .project-tags {
        margin-top: 20px;
        padding-top: 0;
    }

    #portfolio .project-link {
        margin-top: 18px;
    }

    #portfolio .reveal,
    #portfolio .reveal-up,
    #portfolio .reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
