/*
 * Template composition layer
 *
 * Owns responsive behavior and composition for post, page, and video templates.
 * Keep generic primitives out of here; they belong in main.css.
 */

.article-post--standard .article-post__hero--standard {
    align-items: center;
    gap: clamp(1.75rem, 4vw, 4rem);
}

.article-post--standard .article-post__hero-content {
    align-self: center;
}

.article-post--standard .article-post__hero-copy {
    gap: clamp(0.85rem, 1.5vw, 1.35rem);
    max-width: 40rem;
}

.article-post--standard .article-post__hero-copy h1 {
    max-inline-size: 11ch;
}

.article-post--standard .article-post__lead {
    margin-top: 0.1rem;
    max-inline-size: 38ch;
}

.article-post--standard .article-share {
    display: grid;
    gap: 0.65rem;
    justify-items: start;
}

.article-post--standard .article-share__label,
.video-post .article-share__label {
    color: var(--color-text-tertiary);
    font-family: var(--font-label);
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: calc(var(--ls-label) * 0.8);
    text-transform: uppercase;
}

.article-post--standard .article-share__actions,
.video-post .article-share__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.article-post--standard .article-share__button,
.video-post .article-share__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border: 1px solid var(--color-outline-variant);
    border-radius: 999px;
    background: var(--color-surface-100);
    color: var(--color-text-secondary);
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.article-post--standard .article-share__button:hover,
.article-post--standard .article-share__button:focus-visible,
.video-post .article-share__button:hover,
.video-post .article-share__button:focus-visible {
    border-color: var(--color-text-70);
    background: var(--color-surface-container-low);
    color: var(--color-text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-elevation-1);
}

.article-post--standard .article-share__button:focus-visible,
.video-post .article-share__button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
    outline-offset: 2px;
}

.article-post--standard .article-share__text,
.video-post .article-share__text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.article-post--standard .article-share__icon,
.video-post .article-share__icon {
    width: 1.1rem;
    height: 1.1rem;
    min-width: 1.1rem;
    flex: 0 0 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    fill: currentColor;
    line-height: 1;
}

.article-post--standard img.article-share__icon,
.video-post img.article-share__icon {
    width: 1.1rem;
    height: 1.1rem;
    max-width: none;
    border-radius: 0;
    object-fit: contain;
}

.article-post--standard .article-share__status,
.video-post .article-share__status {
    min-height: 1rem;
    color: var(--color-text-tertiary);
    font-size: var(--text-2xs);
    line-height: 1.25;
}

.article-post--standard .article-post__body-layout {
    align-items: start;
}

.article-post--standard .article-post__share-rail {
    position: sticky;
    top: calc(var(--space-xl) + 1rem);
    align-self: start;
    height: fit-content;
    min-width: 0;
    width: 100%;
    max-width: 5.5rem;
    justify-self: end;
}

.article-post--standard .article-post__share-rail-inner {
    display: grid;
    gap: 0.85rem;
    justify-items: start;
}

.article-post--standard .article-post__share-rail .article-share__actions {
    flex-direction: column;
}

.article-post--standard .article-post__content--standard {
    min-width: 0;
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}

.article-post--standard .article-post__content--standard h2,
.article-post--standard .article-post__content--standard h3 {
    scroll-margin-top: calc(var(--space-xxl) + 4rem);
}

.article-post--standard .article-post__toc-rail {
    display: none;
    min-width: 0;
    width: 100%;
    align-self: start;
}

.article-post--standard .article-post__toc-card {
    position: sticky;
    top: calc(var(--space-xl) + 1rem);
    display: grid;
    gap: 1rem;
    align-content: start;
    max-height: calc(100svh - (var(--space-xl) * 2));
    overflow-x: hidden;
    overflow-y: auto;
}

.article-post--standard .article-post__toc-title {
    color: var(--color-text-primary);
    font-family: var(--font-display);
    font-size: var(--step-1);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
}

.article-post--standard .article-post__toc-list {
    display: grid;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-post--standard .article-post__toc-link {
    display: block;
    padding: 0.35rem 0 0.35rem 1rem;
    border-left: 1px solid var(--color-outline-variant);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.4;
    text-decoration: none;
    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.article-post--standard .article-post__toc-item--level-3 .article-post__toc-link {
    padding-left: 1.65rem;
    font-size: var(--text-xs);
}

.article-post--standard .article-post__toc-link:hover,
.article-post--standard .article-post__toc-link:focus-visible {
    color: var(--color-text-primary);
    border-left-color: var(--color-text-70);
}

.article-post--standard .article-post__toc-link.is-active,
.article-post--standard .article-post__toc-link[aria-current="location"] {
    color: var(--color-accent-strong);
    border-left-color: var(--color-accent);
    font-weight: var(--weight-semibold);
}

.article-post--standard .article-post__footer-spacer {
    display: none;
}

.article-post--standard .article-post__footer-inner {
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}

.article-post--standard .article-post__footer-endcap {
    display: none;
}

.article-post--standard .article-post__footer-actions--standard {
    align-items: flex-start;
}

.article-post--page .article-post__content--page {
    min-width: 0;
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}

.video-post {
    display: grid;
    gap: clamp(2.5rem, 4vw, 4rem);
}

.video-post__hero {
    padding-block-start: clamp(0.5rem, 1vw, 1.25rem);
}

.video-post__hero-inner {
    display: grid;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.video-post__hero-copy {
    gap: clamp(0.75rem, 1.5vw, 1.2rem);
    max-width: 52rem;
}

.video-post__hero-copy h1 {
    max-inline-size: 12ch;
}

.video-post__guest {
    color: var(--color-text-secondary);
    font-size: var(--step-1);
    line-height: 1.3;
}

.video-post__lead {
    margin-top: 0.15rem;
    max-inline-size: 44ch;
}

.video-post__meta {
    align-items: center;
    gap: 0.55rem 1rem;
}

.video-post__meta a {
    color: inherit;
    text-decoration: none;
}

.video-post__meta a:hover {
    color: var(--color-accent);
}

.video-post__player-shell {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--color-surface-container-low);
    border-radius: clamp(1.25rem, 2vw, 1.75rem);
    box-shadow: var(--shadow-elevation-1);
}

.video-post__player-shell iframe,
.video-post__poster {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-post__player-shell--placeholder {
    border: 1px solid var(--color-outline-variant);
}

.video-post__player-empty {
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--color-accent-95) 70%, white 30%), transparent 65%),
        var(--color-surface-container);
}

.video-post__player-fallback {
    position: absolute;
    inset: auto 1rem 1rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface-0) 84%, transparent);
    color: var(--color-surface-100);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 1.25;
    width: fit-content;
    max-width: calc(100% - 2rem);
}

.video-post__content-shell {
    padding-block: clamp(2rem, 4vw, 4rem);
}

.video-post__body-layout {
    display: grid;
    grid-template-columns: minmax(15rem, 0.34fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}

.video-post__aside {
    min-width: 0;
}

.video-post__aside-card {
    position: sticky;
    top: calc(var(--space-xl) + 1rem);
    display: grid;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--color-outline-variant);
    border-radius: 1.35rem;
    background: var(--color-surface-100);
    box-shadow: var(--shadow-elevation-1);
}

.video-post__aside-label {
    color: var(--color-text-tertiary);
    font-family: var(--font-label);
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: calc(var(--ls-label) * 0.8);
    text-transform: uppercase;
}

.video-post__overview {
    display: grid;
    gap: 0.95rem;
}

.video-post__overview-item {
    display: grid;
    gap: 0.18rem;
}

.video-post__overview-item > span:first-child {
    color: var(--color-text-tertiary);
    font-family: var(--font-label);
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: calc(var(--ls-label) * 0.75);
    text-transform: uppercase;
}

.video-post__overview-item a {
    color: inherit;
    text-decoration: none;
}

.video-post__overview-item a:hover {
    color: var(--color-accent);
}

.video-post__share .article-share {
    display: grid;
    gap: 0.65rem;
}

.video-post__share .article-share__button {
    flex: 0 0 auto;
}

.video-post__nav {
    display: grid;
    gap: 0.65rem;
}

.video-post__nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.video-post__nav-links a {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--color-outline-variant);
    border-radius: var(--radius-pill);
    background: var(--color-surface-container-low);
    color: var(--color-text-secondary);
    font-family: var(--font-label);
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: calc(var(--ls-label) * 0.75);
    text-decoration: none;
    text-transform: uppercase;
    line-height: 1;
}

.video-post__nav-links a:hover {
    color: var(--color-text-primary);
    border-color: var(--color-text-70);
}

.video-post__main {
    min-width: 0;
}

.video-post__hook {
    margin: 0 0 clamp(1.25rem, 2vw, 2rem);
    color: var(--color-text-primary);
    font-size: clamp(1.35rem, 1.12rem + 1vw, 2rem);
    font-weight: var(--weight-medium);
    line-height: 1.2;
    max-inline-size: 32ch;
}

.video-post__content {
    max-width: 46rem;
}

.video-post__content > * + * {
    margin-top: 1rem;
}

.video-post__content > h2,
.video-post__content > h3 {
    margin-top: clamp(2.25rem, 4vw, 3rem);
    padding-top: 1.2rem;
    border-top: 1px solid var(--color-outline-variant);
    max-inline-size: none;
}

.video-post__content > h2 {
    font-size: clamp(1.55rem, 1.28rem + 1vw, 2.25rem);
}

.video-post__content > h3 {
    font-size: clamp(1.2rem, 1.08rem + 0.55vw, 1.55rem);
}

.video-post__content ul,
.video-post__content ol {
    padding-left: 1.3rem;
}

.video-post__content li {
    width: auto;
    max-width: none;
}

.video-post__content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-container-low);
    border-radius: 0 1rem 1rem 0;
}

.video-post__related {
    padding-top: 0;
}

.video-post__related-header {
    margin-bottom: clamp(1.25rem, 2vw, 1.75rem);
}

.video-post__related-title {
    max-inline-size: none;
}

.video-post__browse-link {
    color: var(--color-text-secondary);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: calc(var(--ls-label) * 0.75);
    text-decoration: none;
    text-transform: uppercase;
}

.video-post__browse-link:hover {
    color: var(--color-accent);
}

.video-post__related-grid {
    row-gap: var(--space-l);
}

.video-post__related-item {
    display: flex;
}

@media (width <= 960px) {
    .article-post--standard .article-post__share-rail,
    .article-post--standard .article-post__content--standard {
        grid-column: 1 / -1;
    }

    .article-post--standard .article-post__share-rail {
        position: static;
        height: auto;
        max-width: none;
        justify-self: stretch;
    }

    .article-post--standard .article-post__share-rail .article-share__actions {
        flex-direction: row;
    }

    .video-post__body-layout {
        grid-template-columns: 1fr;
    }

    .video-post__aside-card {
        position: static;
    }

    .video-post__content {
        max-width: none;
    }
}

@media (width >= 600px) {
    .article-post--standard .article-post__footer-spacer {
        display: block;
    }
}

@media (width >= 1200px) {
    .article-post--standard.article-post--has-toc .article-post__toc-rail,
    .article-post--standard.article-post--has-toc .article-post__footer-endcap {
        display: block;
    }
}

@media (width <= 640px) {
    .article-post--standard .article-post__hero-copy h1,
    .video-post__hero-copy h1 {
        max-inline-size: none;
    }

    .article-post--standard .article-share__button,
    .video-post .article-share__button {
        width: 2.75rem;
        height: 2.75rem;
    }

    .video-post__player-fallback {
        width: auto;
        border-radius: 1rem;
    }

    .video-post__share .article-share__button {
        flex-basis: auto;
    }
}
