/*
 * ertrion-editorial / assets/theme.css
 * Provisional editorial template, card T037, module M13. The publisher name
 * reaches the page only through slot values; this file carries none.
 *
 * Scope (D12): every selector branch starts with .tpl-ertrion-editorial-* or
 * #tpl-ertrion-editorial-*. Markup injected by the pipeline (the post-grid and
 * posts-container wrappers, post-item cards, the controller section) is reached
 * only through a scoped ancestor.
 *
 * Colour: every text/background pair is written as literal hex in one rule so
 * the validator's contrast probe can measure it. Layout uses logical
 * properties only, so the page stays correct when dir="rtl".
 *
 * Palette (M13): page #0B1020, surface #121A2E, raised #19233B,
 * text #F5F7FA, muted #A9B4C7, border #28334D, accent #49D3C7,
 * accent hover #8FE8E0, decorative violet #7C5CFC (never carries text).
 */

/* 1. Tokens and page root ------------------------------------------------ */

.tpl-ertrion-editorial-root {
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-6: 48px;
    --space-8: 64px;
    --space-10: 80px;
    --space-12: 96px;
    --gutter: 16px;
    --section-pad: 32px;
    --grid-gap: 24px;
    --radius-control: 8px;
    --radius-card: 14px;
    --shadow-rest: inset 0 1px 0 0 rgb(245 247 250 / 0.04), 0 12px 32px -12px rgb(2 5 12 / 0.7);
    --shadow-lift: inset 0 1px 0 0 rgb(245 247 250 / 0.06), 0 20px 40px -16px rgb(2 5 12 / 0.85), 0 0 0 1px rgb(73 211 199 / 0.35);
    --duration: 0.25s;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --font-heading: Georgia, "Times New Roman", Times, serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

    margin: 0;
    min-block-size: 100vh;
    min-block-size: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0;
    color: #F5F7FA;
    background-color: #0B1020;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tpl-ertrion-editorial-root *,
.tpl-ertrion-editorial-root *::before,
.tpl-ertrion-editorial-root *::after {
    box-sizing: border-box;
}

.tpl-ertrion-editorial-root ::selection {
    color: #0B1020;
    background-color: #49D3C7;
}

/* Generic link behaviour; :where() keeps it below every component rule. */
.tpl-ertrion-editorial-root :where(a) {
    color: #49D3C7;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--duration) var(--ease), background-color var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.tpl-ertrion-editorial-root :where(a):hover {
    color: #8FE8E0;
}

.tpl-ertrion-editorial-root :where(a):focus-visible {
    outline: 2px solid #49D3C7;
    outline-offset: 3px;
    border-radius: 4px;
}

.tpl-ertrion-editorial-container {
    inline-size: 100%;
    max-inline-size: 1200px;
    margin-inline: auto;
}

/* 2. Skip link ----------------------------------------------------------- */

.tpl-ertrion-editorial-skip-link {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    padding-inline: var(--space-2);
    font-weight: 700;
    text-decoration: none;
    color: #0B1020;
    background-color: #49D3C7;
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-rest);
    transform: translateY(-200%);
    transition: transform var(--duration) var(--ease);
}

.tpl-ertrion-editorial-skip-link:focus,
.tpl-ertrion-editorial-skip-link:hover {
    color: #0B1020;
    background-color: #49D3C7;
    transform: translateY(0);
}

.tpl-ertrion-editorial-skip-link:focus-visible {
    outline: 2px solid #F5F7FA;
    outline-offset: 3px;
}

/* 3. Header and navigation ----------------------------------------------- */

.tpl-ertrion-editorial-site-header {
    position: relative;
    padding-inline: var(--gutter);
    color: #F5F7FA;
    background-color: #0B1020;
    border-block-end: 1px solid #28334D;
}

/* Decorative hairline: teal fading into violet along the header's lower edge. */
.tpl-ertrion-editorial-site-header::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-end: -1px;
    block-size: 1px;
    background-image: linear-gradient(90deg, rgb(73 211 199 / 0) 0%, #49D3C7 35%, #7C5CFC 70%, rgb(124 92 252 / 0) 100%);
    pointer-events: none;
}

.tpl-ertrion-editorial-masthead {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    padding-block: var(--space-2) var(--space-1);
}

.tpl-ertrion-editorial-nameplate {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.tpl-ertrion-editorial-brand {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    overflow-wrap: anywhere;
    text-decoration: none;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
    color: #F5F7FA;
    background-color: #0B1020;
    border-radius: 4px;
    transition: color var(--duration) var(--ease);
}

.tpl-ertrion-editorial-brand:hover {
    text-decoration-line: underline;
    text-decoration-color: #49D3C7;
    color: #8FE8E0;
    background-color: #0B1020;
}

/* The negative inline margin lines the link text up with the wordmark while
   the link keeps its padded hit area. */
.tpl-ertrion-editorial-nav-list {
    display: flex;
    flex-direction: column;
    margin-block: 0;
    margin-inline: calc(-1 * var(--space-1));
    padding: 0;
    list-style: none;
}

.tpl-ertrion-editorial-nav-item {
    border-block-start: 1px solid #28334D;
}

.tpl-ertrion-editorial-nav-link {
    display: flex;
    align-items: center;
    min-block-size: 48px;
    padding-inline: var(--space-1);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    color: #A9B4C7;
    background-color: #0B1020;
    border: 1px solid #0B1020;
    border-radius: var(--radius-control);
    transition: color var(--duration) var(--ease), background-color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.tpl-ertrion-editorial-nav-link:hover {
    color: #F5F7FA;
    background-color: #121A2E;
    border-color: #28334D;
}

/* 4. Main, deck and the listing grid ------------------------------------- */

.tpl-ertrion-editorial-main {
    position: relative;
    isolation: isolate;
    flex: 1 0 auto;
    padding-block: var(--section-pad);
    padding-inline: var(--gutter);
    color: #F5F7FA;
    background-color: #0B1020;
    background-image:
        radial-gradient(56rem 26rem at 50% -6rem, rgb(73 211 199 / 0.1), rgb(73 211 199 / 0) 70%),
        radial-gradient(36rem 22rem at 88% 0%, rgb(124 92 252 / 0.1), rgb(124 92 252 / 0) 70%);
    background-repeat: no-repeat;
}

/* Decorative blueprint grid behind the top of the page, faded by a mask. */
.tpl-ertrion-editorial-main::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-start: 0;
    z-index: -1;
    block-size: 480px;
    background-image:
        linear-gradient(rgb(40 51 77 / 0.45) 1px, rgb(40 51 77 / 0) 1px),
        linear-gradient(90deg, rgb(40 51 77 / 0.45) 1px, rgb(40 51 77 / 0) 1px);
    background-size: 48px 48px;
    background-position: 50% 0;
    -webkit-mask-image: radial-gradient(ellipse 70% 100% at 50% 0%, #000000 0%, rgb(0 0 0 / 0) 75%);
    mask-image: radial-gradient(ellipse 70% 100% at 50% 0%, #000000 0%, rgb(0 0 0 / 0) 75%);
    pointer-events: none;
}

.tpl-ertrion-editorial-main:focus {
    outline: none;
}

.tpl-ertrion-editorial-deck {
    margin-block: 0 var(--space-6);
    margin-inline: 0;
    max-inline-size: 30ch;
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2rem);
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

/* Decorative accent rule above the deck. */
.tpl-ertrion-editorial-deck::before {
    content: "";
    display: block;
    inline-size: 48px;
    block-size: 2px;
    margin-block-end: var(--space-3);
    border-radius: 2px;
    background-image: linear-gradient(90deg, #49D3C7, #7C5CFC);
}

.tpl-ertrion-editorial-post-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--grid-gap);
    align-items: stretch;
}

/* The pipeline wraps the cards in its own div (post-grid or posts-container);
   letting that wrapper vanish makes each card a direct item of this grid.
   The template's own empty-state block is also a div child of this grid and
   must keep its box, so it is excluded. */
.tpl-ertrion-editorial-post-grid > div:not(.tpl-ertrion-editorial-empty) {
    display: contents;
}

/* 5. Listing cards (legacy card markup from the pipeline) ----------------- */

.tpl-ertrion-editorial-post-grid .post-item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    margin: 0;
    padding: var(--space-3);
    color: #F5F7FA;
    background-color: #121A2E;
    border: 1px solid #28334D;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-rest);
    transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

/* Decorative accent line that widens when the card is hovered or focused. */
.tpl-ertrion-editorial-post-grid .post-item::before {
    content: "";
    position: absolute;
    inset-block-start: -1px;
    inset-inline: var(--space-3);
    block-size: 2px;
    border-radius: 2px;
    background-image: linear-gradient(90deg, #49D3C7, #7C5CFC);
    opacity: 0.75;
    transform: scaleX(0.2);
    transform-origin: 50% 50%;
    transition: transform var(--duration) var(--ease), opacity var(--duration) var(--ease);
    pointer-events: none;
}

.tpl-ertrion-editorial-post-grid .post-item:hover,
.tpl-ertrion-editorial-post-grid .post-item:focus-within {
    transform: translateY(-4px);
    border-color: #3B4B6E;
    box-shadow: var(--shadow-lift);
}

.tpl-ertrion-editorial-post-grid .post-item:hover::before,
.tpl-ertrion-editorial-post-grid .post-item:focus-within::before {
    opacity: 1;
    transform: scaleX(1);
}

.tpl-ertrion-editorial-post-grid .post-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-inline-size: 0;
}

.tpl-ertrion-editorial-post-grid .post-link {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-block-size: 44px;
    text-decoration: none;
    color: #F5F7FA;
    background-color: #121A2E;
    border-radius: var(--radius-control);
}

.tpl-ertrion-editorial-post-grid .post-link:hover {
    color: #F5F7FA;
    background-color: #121A2E;
}

.tpl-ertrion-editorial-post-grid .post-number {
    align-self: flex-start;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    color: #49D3C7;
    background-color: #121A2E;
}

.tpl-ertrion-editorial-post-grid .post-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.125rem, 1rem + 0.5vw, 1.5rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    text-wrap: balance;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
}

.tpl-ertrion-editorial-post-grid .post-link:hover .post-title {
    text-decoration-line: underline;
    text-decoration-color: #49D3C7;
}

.tpl-ertrion-editorial-post-grid .post-excerpt {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
    color: #A9B4C7;
    background-color: #121A2E;
}

.tpl-ertrion-editorial-post-grid .post-excerpt a {
    text-decoration-line: underline;
    color: #49D3C7;
    background-color: #121A2E;
}

.tpl-ertrion-editorial-post-grid .post-excerpt a:hover {
    color: #8FE8E0;
    background-color: #121A2E;
}

/* 6. Empty editorial state ------------------------------------------------
   Two sources share one design: the section the site-creation controller
   renders for a page without articles, and this template's own block for an
   empty card collection. Both span the grid and stay centred. */

.tpl-ertrion-editorial-post-grid > div > section,
.tpl-ertrion-editorial-empty {
    position: relative;
    isolation: isolate;
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding-block: var(--space-8);
    padding-inline: var(--space-3);
    text-align: center;
    color: #F5F7FA;
    background: linear-gradient(#121A2E, #121A2E) padding-box, linear-gradient(135deg, #49D3C7 0%, #28334D 32%, #28334D 68%, #7C5CFC 100%) border-box;
    border: 1px solid transparent;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-rest);
}

/* Decorative glow and dot grid, faded toward the panel edges. */
.tpl-ertrion-editorial-post-grid > div > section::before,
.tpl-ertrion-editorial-empty::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-image:
        radial-gradient(ellipse 60% 55% at 50% 0%, rgb(73 211 199 / 0.16), rgb(73 211 199 / 0) 100%),
        radial-gradient(circle, #28334D 1px, rgb(40 51 77 / 0) 1.5px);
    background-size: 100% 100%, 24px 24px;
    background-position: 50% 0, 50% 50%;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000000 35%, rgb(0 0 0 / 0) 100%);
    mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000000 35%, rgb(0 0 0 / 0) 100%);
    pointer-events: none;
}

/* Decorative accent line centred on the panel's upper edge. */
.tpl-ertrion-editorial-post-grid > div > section::after,
.tpl-ertrion-editorial-empty::after {
    content: "";
    position: absolute;
    inset-block-start: -1px;
    inset-inline: 0;
    margin-inline: auto;
    inline-size: 96px;
    block-size: 2px;
    border-radius: 2px;
    background-image: linear-gradient(90deg, #49D3C7, #7C5CFC);
    pointer-events: none;
}

.tpl-ertrion-editorial-post-grid > div > section h1,
.tpl-ertrion-editorial-post-grid > div > section h2,
.tpl-ertrion-editorial-empty-title {
    margin: 0;
    max-inline-size: 20ch;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.tpl-ertrion-editorial-post-grid > div > section p,
.tpl-ertrion-editorial-empty-text {
    margin-block: var(--space-2) 0;
    margin-inline: 0;
    max-inline-size: 48ch;
    font-size: 1.125rem;
    line-height: 1.6;
    text-wrap: balance;
    color: #A9B4C7;
}

.tpl-ertrion-editorial-empty-label {
    margin-block: 0 var(--space-2);
    margin-inline: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #49D3C7;
}

/* 7. Footer --------------------------------------------------------------- */

.tpl-ertrion-editorial-site-footer {
    padding-block: var(--space-4);
    padding-inline: var(--gutter);
    color: #A9B4C7;
    background-color: #0B1020;
    border-block-start: 1px solid #28334D;
}

.tpl-ertrion-editorial-colophon {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.tpl-ertrion-editorial-copyright {
    margin: 0;
    font-size: 1rem;
}

.tpl-ertrion-editorial-footer-nav p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--space-1);
    margin-block: 0;
    margin-inline: calc(-1 * var(--space-1));
}

.tpl-ertrion-editorial-footer-nav a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    padding-inline: var(--space-1);
    text-decoration-line: underline;
    text-decoration-color: #3B4B6E;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    color: #F5F7FA;
    background-color: #0B1020;
    border-radius: var(--radius-control);
}

.tpl-ertrion-editorial-footer-nav a:hover {
    text-decoration-color: #49D3C7;
    color: #49D3C7;
    background-color: #0B1020;
}

/* 8. Tablet: 640px to 1024px ---------------------------------------------- */

@media (min-width: 640px) {
    .tpl-ertrion-editorial-root {
        --gutter: 32px;
        --section-pad: 48px;
        --grid-gap: 32px;
    }

    .tpl-ertrion-editorial-masthead {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2) var(--space-4);
        padding-block: var(--space-3);
    }

    .tpl-ertrion-editorial-nav-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-1);
        margin-inline: calc(-1 * var(--space-2));
    }

    .tpl-ertrion-editorial-nav-item {
        border-block-start: 0;
    }

    .tpl-ertrion-editorial-nav-link {
        min-block-size: 44px;
        padding-inline: var(--space-2);
    }

    .tpl-ertrion-editorial-post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tpl-ertrion-editorial-post-grid > div > section,
    .tpl-ertrion-editorial-empty {
        padding-block: var(--space-10);
        padding-inline: var(--space-6);
    }

    .tpl-ertrion-editorial-colophon {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1) var(--space-4);
    }
}

/* 9. Desktop: above 1024px ------------------------------------------------ */

@media (min-width: 1025px) {
    .tpl-ertrion-editorial-root {
        --gutter: 48px;
        --section-pad: 80px;
    }

    .tpl-ertrion-editorial-post-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tpl-ertrion-editorial-post-grid > div > section,
    .tpl-ertrion-editorial-empty {
        padding-block: var(--space-12);
    }
}

/* 10. Reduced motion: keep state changes, drop every translation --------- */

@media (prefers-reduced-motion: reduce) {
    .tpl-ertrion-editorial-skip-link {
        transition: none;
    }

    .tpl-ertrion-editorial-post-grid .post-item {
        transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    }

    .tpl-ertrion-editorial-post-grid .post-item:hover,
    .tpl-ertrion-editorial-post-grid .post-item:focus-within {
        transform: none;
    }

    .tpl-ertrion-editorial-post-grid .post-item::before,
    .tpl-ertrion-editorial-post-grid .post-item:hover::before,
    .tpl-ertrion-editorial-post-grid .post-item:focus-within::before {
        transform: none;
        transition: opacity var(--duration) var(--ease);
    }
}
