/* ============================================================
   1. ACCESSIBILITY
   ============================================================ */

/* Skip-to-content link */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 6px 0;
}

.skip-to-content:focus {
    position: fixed;
    top: 0;
    outline: 2px solid var(--pico-primary);
    outline-offset: 2px;
}


/* ============================================================
   2. BASE / GLOBAL
   ============================================================ */

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Overflow and base sizing */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    overflow-x: hidden;
}


/* ============================================================
   3. TYPOGRAPHY & LINKS
   ============================================================ */

/* Long content wrapping */
pre,
code,
kbd,
samp {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

pre {
    overflow-x: auto;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    border-radius: 6px;
}

/* Links */
a {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

a.share-btn:hover {
    cursor: pointer;
}

a.share-btn-visited {
    text-decoration: none;
}

hgroup a {
    text-decoration: none;
}


/* ============================================================
   4. MEDIA & EMBEDS
   ============================================================ */

/* Images */
img {
    max-width: 100%;
    height: auto;
}


/* ============================================================
   5. TABLES
   ============================================================ */

table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: fit-content;
}


/* ============================================================
   6. LAYOUT (CONTAINERS)
   ============================================================ */

.container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

main.container {
    position: relative;
    overflow-x: auto;
    width: 100%;
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Header & Footer shared layout */
header,
footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

/* Header specific layout*/
header {
    margin-top: 2.6rem;
    margin-bottom: 1.8rem;
}


/* ============================================================
   7. MD-BLOCK
   ============================================================ */

md-block,
md-span,
.markdown-body {
    max-width: 100%;
    overflow-x: auto;
}

md-block pre {
    overflow-x: auto;
    white-space: pre;
}

md-block code {
    white-space: pre-wrap;
    word-break: break-word;
}


/* ============================================================
   8. CONTENT LIST
   ============================================================ */

#content-list > table.content-table > thead {
    display: none;
}

#content-list > table.content-table > tbody {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0;
}

#content-list > table > tbody > tr.list__row{
    display: grid;
    margin-bottom: 2rem;
}

#content-list tr.list__row > td {
    border-bottom: 0;
    padding-left: 0;
    padding-bottom: 0;
}

#content-list tr.list__row > td.list__data-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}

#content-list tr.list__row > td.list__data-summary {
    padding-top: .8rem;
    padding-bottom: .6rem;
}

#content-list tr.list__row > td.list__data-taxonomies {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}

.content-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.content-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    background-color: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
    border-radius: 10rem;
}


/* ============================================================
   9. PAGINATION
   ============================================================ */

.content-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
}

.content-pagination button {
    min-width: 2.5rem;
    text-align: center;
    cursor: pointer;
}

.content-pagination button.active {
    background-color: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}

.content-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.content-pagination span {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin: 0 -.3rem;
    color: var(--pico-muted-color);
}


/* ============================================================
   10. ARTICLE
   ============================================================ */

#article__actions {
    margin-top: 3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}


/* ============================================================
   11. FOOTER
   ============================================================ */

footer {
    margin-top: 1rem;
}

footer::before {
    content: "";
    width: 98%;
    margin: 0 auto;
    border-top: 1px solid var(--pico-contrast);
}

footer.container {
    padding-top: 0;
}

.footer__copyright {
    padding: 1rem 0.5rem 1rem 0.5rem;
    margin-bottom: 0;
}

.footer__links {
    padding-left: 0.5rem;
}

.footer__links-list {
    display: flex;
    flex-wrap: wrap;
}

.footer__link-icon {
    transform: scale(.8);
}


/* ============================================================
   12. STATES
   ============================================================ */

.loading,
.content-empty,
.content-error {
    text-align: center;
    padding: 3rem;
    color: var(--pico-muted-color);
}

.content-error {
    color: var(--pico-del-color);
}


/* ============================================================
   13. ANIMATIONS
   ============================================================ */

.fade-in {
    animation: fadeIn 1.6s ease-out forwards;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}


/* ============================================================
   14. MEDIA QUERIES
   ============================================================ */

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    pre,
    code {
        font-size: 0.85rem;
    }

    table {
        font-size: 0.85rem;
    }

    .content-card h2 {
        font-size: 1.25rem;
    }

    .content-meta {
        font-size: 0.75rem;
    }
}

/* Tablet+ (min-width: 768px) */
@media (min-width: 768px) {
    main.container {
        max-width: 768px;
        padding-right: var(--pico-spacing);
        padding-left: var(--pico-spacing);
        margin-bottom: 1rem;
    }

    header.container,
    footer.container {
        max-width: 950px;
        padding-right: var(--pico-spacing);
        padding-left: var(--pico-spacing);
    }
}
