/**
 * Budgeted SaaS chrome — sticky header, mobile drawer, search, footer.
 */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1200;
    min-height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.app-header-inner {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: var(--header-height);
    padding: 0.4rem max(0.75rem, env(safe-area-inset-right)) 0.4rem max(0.75rem, env(safe-area-inset-left));
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
    min-height: 44px;
}

.brand img,
.brand-logo {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    object-fit: contain;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.header-cta,
a.header-cta.btn-primary {
    color: var(--on-cta);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    line-height: 1.2;
    min-width: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.12rem;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}

.brand-tag {
    display: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.brand:hover,
.brand:hover .brand-name {
    color: var(--text);
    text-decoration: none;
}

.header-search {
    position: relative;
    flex: 0 1 240px;
    max-width: 260px;
    margin: 0;
}

.header-search-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 0.3rem 0 0.95rem;
    min-height: 42px;
}

.header-search-form input,
.header-search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.header-search-form button {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    cursor: pointer;
}

.header-search.is-open .header-search-form,
.header-search-form:focus-within {
    background: var(--input-bg-focus);
    border-color: var(--primary);
}

.header-nav {
    display: none;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
}

.header-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 0.7rem;
    border-radius: 8px;
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
    color: var(--primary);
    background: transparent;
    text-decoration: none;
}

.editorial-home .header-search,
.editorial-home .header-search-toggle {
    display: none;
}

.editorial-home .header-nav {
    margin-left: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.1rem;
    margin-left: auto;
    flex-shrink: 0;
}

.header-cta {
    display: none;
    min-height: 40px;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    letter-spacing: -0.01em;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--surface-2);
}

.menu-toggle {
    flex-direction: column;
    gap: 4px;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@media (min-width: 1024px) {
    .header-search-toggle { display: none; }
    .brand-tag { display: block; }
    .menu-toggle { display: none; }
    .header-nav { display: flex; flex: 1; justify-content: flex-end; }
    .header-cta { display: inline-flex; }
    .app-header-inner {
        gap: 1rem;
        padding: 0.55rem 1.25rem;
    }
}

@media (min-width: 1024px) and (max-width: 1199px) {
    .header-search { max-width: 200px; flex-basis: 180px; }
    .header-nav a { padding: 0 0.5rem; font-size: 0.86rem; }
}

@media (max-width: 1023px) {
    .header-search {
        display: none;
        position: absolute;
        left: 0.5rem;
        right: 0.5rem;
        top: calc(100% + 6px);
        max-width: none;
        flex: none;
        margin: 0;
        z-index: 1210;
    }
    .header-search.is-open {
        display: block;
        background: var(--surface);
        padding: 0.45rem;
        border-radius: 14px;
        box-shadow: var(--shadow);
        border: 1px solid var(--border);
    }
}

.main-footer {
    background: var(--ink);
    border-top: 0;
    color: var(--on-ink-muted);
    padding: 1.5rem 0 max(1rem, env(safe-area-inset-bottom));
    margin-top: 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.15rem 1.5rem;
    margin-bottom: 1.15rem;
}

.footer-section h4 {
    margin: 0 0 0.4rem;
    color: var(--cta);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-section p {
    color: var(--on-ink-muted);
    max-width: 26rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: 0.28rem; }
.footer-section a {
    color: var(--on-ink);
    text-decoration: none;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}
.footer-section a:hover { color: var(--cta); }

.footer-social { display: flex; gap: 0.35rem; margin-top: 0.7rem; }
.footer-social a {
    width: 44px;
    height: 44px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid rgba(248, 244, 236, 0.2);
    color: var(--on-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-social a:hover {
    border-color: var(--cta);
    color: var(--cta);
}

.footer-disclaimers {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin: 0 0 1rem;
}

.footer-disclaimer {
    padding: 0.7rem 0.8rem;
    background: rgba(248, 244, 236, 0.06);
    border: 1px solid rgba(248, 244, 236, 0.14);
    border-radius: 8px;
}

.footer-disclaimer-title {
    margin: 0 0 0.28rem;
    font-family: var(--font);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cta);
}

.footer-disclaimer-text {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--on-ink-muted);
}

.footer-disclaimer-text a {
    color: var(--cta);
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.footer-disclaimer-text a:hover { color: var(--on-ink); }

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(248, 244, 236, 0.14);
    color: var(--on-ink-muted);
    font-size: 0.82rem;
}

@media (min-width: 768px) {
    .footer-content { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
    .footer-disclaimers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
