/* Study314 Header - Floating Capsule Navigation */
:root {
    --s3-header-bg: #FDFDFD;
    --s3-header-surface: #FFFFFF;
    --s3-header-text: #2C2A29;
    --s3-header-muted: #8A8683;
    --s3-header-accent: #1A365D;
    --s3-header-accent-hover: #2A4A7F;
    --s3-header-border: #EAE8E3;
}

.study314-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 9999;
    padding: 2rem 1rem 0;
    display: flex;
    justify-content: center;
    transition: padding 0.5s ease-in-out;
}

.study314-header.is-scrolled {
    padding-top: 1rem;
}

.study314-header-inner {
    width: 100%;
    max-width: 80rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.5s ease;
    padding: 1rem 2rem;
}

.study314-header.is-scrolled .study314-header-inner {
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(234, 232, 227, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-radius: 9999px;
    padding: 0.5rem 1.25rem;
}

/* Logo */
.study314-header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.study314-header-logo-img {
    height: 2.5rem;
    width: auto;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .study314-header-logo-img {
        height: 3rem;
    }
}

.study314-header.is-scrolled .study314-header-logo-img {
    transform: scale(0.9);
}

/* Desktop Nav */
.study314-header-nav {
    display: none;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .study314-header-nav {
        display: flex;
    }
}

.study314-header-nav-link {
    position: relative;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--s3-header-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    padding-bottom: 4px;
}

.study314-header-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--s3-header-accent);
    border-radius: 9999px;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.study314-header-nav-link:hover {
    color: var(--s3-header-accent);
}

.study314-header-nav-link:hover::after {
    opacity: 1;
    width: 100%;
    height: 2px;
    border-radius: 1px;
}

/* CTA Button - Default (not scrolled): outline style */
.study314-header-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 2rem;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--s3-header-text);
    border: 1px solid var(--s3-header-border);
}

.study314-header-cta-btn:hover {
    border-color: var(--s3-header-accent);
    color: var(--s3-header-accent);
}

/* CTA Button - Scrolled: primary style */
.study314-header.is-scrolled .study314-header-cta-btn {
    background: var(--s3-header-accent);
    color: #ffffff;
    border-color: var(--s3-header-accent);
}

.study314-header.is-scrolled .study314-header-cta-btn:hover {
    background: var(--s3-header-accent-hover);
    border-color: var(--s3-header-accent-hover);
}

/* Mobile Toggle */
.study314-header-mobile-toggle {
    display: flex;
    padding: 0.5rem;
    border-radius: 9999px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--s3-header-text);
    transition: all 0.3s ease;
}

.study314-header-mobile-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .study314-header-mobile-toggle {
        display: none;
    }
}

/* Hamburger Icon */
.study314-header-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    height: 24px;
    justify-content: center;
}

.study314-header-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.study314-header-mobile-toggle[aria-expanded="true"] .study314-header-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.study314-header-mobile-toggle[aria-expanded="true"] .study314-header-hamburger span:nth-child(2) {
    opacity: 0;
}

.study314-header-mobile-toggle[aria-expanded="true"] .study314-header-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.study314-header-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: var(--s3-header-bg);
    padding-top: 6rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.study314-header-mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 768px) {
    .study314-header-mobile-menu {
        display: none !important;
    }
}

.study314-header-mobile-menu-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.study314-header-mobile-link {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.25rem;
    font-weight: 300;
    color: var(--s3-header-text);
    text-decoration: none;
    transition: color 0.3s ease;
}

.study314-header-mobile-link:hover {
    color: var(--s3-header-accent);
}

.study314-header-mobile-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 20rem;
    margin-top: 1rem;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
    background: var(--s3-header-accent);
    transition: all 0.3s ease;
}

.study314-header-mobile-cta:hover {
    background: var(--s3-header-accent-hover);
    color: #ffffff;
}

/* Visually hidden site title (accessible to screen readers and SEO) */
.study314-header-site-title.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    word-wrap: normal !important;
    border: 0;
    font-size: 0;
}

/* Body adjustment */
body.has-study314-header {
    padding-top: 0;
}

/* Admin bar adjustments */
.admin-bar .study314-header {
    top: 32px;
}

.admin-bar .study314-header.is-scrolled {
    padding-top: 1rem;
}

@media (max-width: 782px) {
    .admin-bar .study314-header {
        top: 46px;
    }
    .admin-bar .study314-header-mobile-menu {
        top: 46px;
    }
}
