/* =========================================================================
   Article page. The reading column is 720px, which lands at 65-72 characters
   at the body size, the range where long prose is comfortable.
   ========================================================================= */

.reading-progress {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: calc(var(--z-header) + 1);
    height: 3px;
    background: transparent;
}

.reading-progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 80ms linear;
}

.breadcrumb {
    padding-block: var(--space-3);
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb li + li::before {
    content: '/';
    margin-inline-end: var(--space-2);
    opacity: 0.5;
}

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

.article {
    max-width: var(--measure);
    margin-inline: auto;
    padding-block-end: var(--space-7);
}

.article-header {
    margin-block-end: var(--space-4);
}

.article h1 {
    font-size: var(--fs-xl);
    margin-block: var(--space-2) var(--space-3);
}

@media (min-width: 768px) {
    .article h1 {
        font-size: var(--fs-2xl);
    }
}

/* The dek is read before the body, so it sits between the two in weight. */
.article-dek {
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
    color: var(--text-muted);
    margin-block-end: var(--space-3);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding-block: var(--space-3);
    border-block: 1px solid var(--border);
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.article-meta strong {
    color: var(--text);
    font-weight: 600;
}

.article-figure {
    margin-block: var(--space-4);
}

.article-figure img {
    width: 100%;
    border-radius: var(--radius);
}

.article-figure figcaption {
    margin-block-start: var(--space-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ---------- Body -------------------------------------------------------- */

.article-body {
    font-size: 1.0625rem;              /* 17px */
    line-height: var(--lh-relaxed);
}

@media (min-width: 768px) {
    .article-body {
        font-size: 1.125rem;           /* 18px */
    }
}

.article-body > * + * {
    margin-block-start: var(--space-3);
}

.article-body h2 {
    font-size: var(--fs-lg);
    margin-block-start: var(--space-5);
}

.article-body h3 {
    font-size: var(--fs-md);
    margin-block-start: var(--space-4);
}

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body ul,
.article-body ol {
    padding-inline-start: var(--space-4);
}

.article-body li + li {
    margin-block-start: var(--space-2);
}

.article-body blockquote {
    margin-inline: 0;
    padding-inline-start: var(--space-3);
    border-inline-start: 3px solid var(--accent);
    font-family: var(--font-display);
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
}

.article-body img {
    width: 100%;
    border-radius: var(--radius-sm);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.article-body th,
.article-body td {
    padding: var(--space-2);
    border: 1px solid var(--border);
    text-align: start;
}

.article-body th {
    background: var(--surface);
    font-weight: 600;
}

/* ---------- Share ------------------------------------------------------- */

.share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-5);
    padding-block: var(--space-3);
    border-block: 1px solid var(--border);
}

.share-label {
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-inline-end: var(--space-2);
}

.share a,
.share button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--transition), border-color var(--transition);
}

.share a:hover,
.share button:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.share svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ---------- Attribution and disclosure ---------------------------------- */

.attribution {
    margin-block-start: var(--space-4);
    padding: var(--space-3);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: var(--fs-sm);
}

.attribution a {
    color: var(--accent);
    font-weight: 600;
}

/* ---------- Related ----------------------------------------------------- */

.related {
    max-width: var(--container);
    margin-block-start: var(--space-6);
}

.related-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .related-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.card h3 {
    font-size: var(--fs-base);
    line-height: var(--lh-snug);
    margin-block: var(--space-2) var(--space-1);
}

.card:hover h3 {
    color: var(--accent);
}

/* ---------- Next article bar, mobile only ------------------------------- */

.next-bar {
    position: fixed;
    inset-block-end: 56px;
    inset-inline: 0;
    z-index: calc(var(--z-header) - 1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg);
    border-block-start: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(16, 21, 28, 0.06);
    transform: translateY(120%);
    transition: transform var(--transition);
}

.next-bar.is-visible {
    transform: translateY(0);
}

.next-bar .label {
    flex: 0 0 auto;
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--accent);
}

.next-bar .title {
    font-size: var(--fs-sm);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .next-bar {
        display: none;
    }
}

/* ---------- Toast ------------------------------------------------------- */

.toast {
    position: fixed;
    inset-block-end: var(--space-5);
    inset-inline-start: 50%;
    z-index: var(--z-toast);
    transform: translate(-50%, 150%);
    padding: var(--space-2) var(--space-4);
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius);
    font-size: var(--fs-sm);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition);
}

.toast.is-visible {
    transform: translate(-50%, 0);
}
