@font-face {
    font-family: 'OldEnglish';
    src: url('../fonts/OPTIEngraversOldEnglish.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --echobox-bg: #000000;
    --echobox-text: #ffffff;
    --echobox-muted: #a0aec0;
    --echobox-border: rgba(255, 255, 255, 0.28);
    --echobox-border-hover: rgba(255, 255, 255, 0.55);
    --echobox-accent: #b4161b;
    --echobox-serif: Georgia, "Times New Roman", serif;
    --echobox-sans: "Poppins", Inter, Arial, Helvetica, sans-serif;
    --echobox-oldeng: 'OldEnglish', Georgia, serif;
    --echobox-max: 680px;
    --echobox-max-reader: 760px;
    --echobox-max-grid: 1080px;
    --echobox-max-hub: 520px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.link-page {
    margin: 0;
    min-height: 100dvh;
    background: var(--echobox-bg);
    color: var(--echobox-text);
    font-family: var(--echobox-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

.echobox-shell {
    width: min(100%, var(--echobox-max));
    min-height: 100dvh;
    margin: 0 auto;
    padding:
        max(28px, env(safe-area-inset-top))
        max(20px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom))
        max(20px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
}

.echobox-shell--wide,
.echobox-shell--reader {
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

.echobox-shell--wide {
    padding-top: max(16px, env(safe-area-inset-top));
}

.echobox-profile {
    text-align: center;
    padding: 12px 0 28px;
}

.echobox-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin-bottom: 18px;
    border: 2px solid var(--echobox-border);
    border-radius: 50%;
    color: var(--echobox-text);
    font-family: var(--echobox-oldeng);
    font-size: 2.75rem;
    line-height: 1;
}

.echobox-name {
    margin: 0 0 10px;
    font-size: clamp(1.35rem, 4.8vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
}

.echobox-bio {
    margin: 0 auto;
    max-width: 30ch;
    color: var(--echobox-muted);
    font-size: 0.92rem;
    font-weight: 400;
}

.echobox-links {
    display: grid;
    gap: 12px;
    flex: 1;
    align-content: center;
    padding: 8px 0 28px;
}

.echobox-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 14px 20px;
    border: 1px solid var(--echobox-border);
    border-radius: 9999px;
    background: transparent;
    color: var(--echobox-text);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.echobox-link:active {
    transform: scale(0.985);
}

.echobox-footer {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    color: var(--echobox-muted);
    font-size: 0.78rem;
}

.echobox-footer p {
    margin: 0 0 8px;
}

.echobox-footer a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.echobox-subheader {
    padding: 0 16px 16px;
}

.echobox-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--echobox-muted);
    font-size: 0.82rem;
}

.echobox-breadcrumb a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.echobox-subheader-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.echobox-subtitle {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.echobox-meta {
    margin: 4px 0 0;
    color: var(--echobox-muted);
    font-size: 0.82rem;
}

.echobox-inline-link {
    color: var(--echobox-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.echobox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
}

.echobox-grid-item {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #111111;
}

.echobox-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.echobox-grid-item--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    background: #141414;
}

.echobox-grid-placeholder {
    color: var(--echobox-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.echobox-empty {
    flex: 1;
    display: grid;
    place-content: center;
    gap: 16px;
    padding: 48px 20px;
    text-align: center;
    color: var(--echobox-muted);
}

.echobox-reader-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding:
        max(10px, env(safe-area-inset-top))
        16px
        12px;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.echobox-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--echobox-muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.echobox-reader-label {
    color: var(--echobox-text);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
}

.echobox-reader-bar .echobox-inline-link {
    justify-self: end;
}

.echobox-post-hero {
    margin: 0;
}

.echobox-post-hero img {
    width: 100%;
    display: block;
}

.echobox-hero-caption {
    margin: 0;
    padding: 10px 16px 0;
    color: var(--echobox-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.echobox-hero-caption span {
    display: block;
}

.echobox-hero-attribution {
    margin-top: 4px;
    font-size: 0.76rem;
    opacity: 0.85;
}

.echobox-post-content {
    padding: 22px 16px 0;
}

.echobox-kicker {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--echobox-accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.echobox-disclaimer {
    margin: 0 0 10px;
    color: var(--echobox-muted);
    font-size: 0.82rem;
}

.echobox-post-content h1 {
    margin: 0 0 12px;
    font-family: var(--echobox-serif);
    font-size: clamp(1.55rem, 5.5vw, 2rem);
    font-weight: 700;
    line-height: 1.15;
}

.echobox-standfirst {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    line-height: 1.5;
}

.echobox-byline {
    margin-bottom: 20px;
    color: var(--echobox-muted);
    font-size: 0.84rem;
}

.echobox-body {
    font-family: var(--echobox-serif);
    font-size: 1.05rem;
    line-height: 1.75;
}

.echobox-body p,
.echobox-body ul,
.echobox-body ol,
.echobox-body blockquote,
.echobox-body figure {
    margin: 0 0 1.1em;
}

.echobox-body h2,
.echobox-body h3 {
    font-family: var(--echobox-sans);
    margin: 1.6em 0 0.6em;
    line-height: 1.25;
}

.echobox-body a {
    color: #ff8a8f;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.echobox-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.echobox-body blockquote {
    border-left: 3px solid var(--echobox-accent);
    padding-left: 16px;
    color: rgba(255, 255, 255, 0.88);
}

.echobox-reader-footer {
    display: grid;
    gap: 14px;
    margin-top: 28px;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.echobox-text-link {
    text-align: center;
    color: var(--echobox-muted);
    font-size: 0.88rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (min-width: 640px) {
    .echobox-shell:not(.echobox-shell--wide):not(.echobox-shell--reader) {
        width: min(100%, var(--echobox-max-hub));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .echobox-shell--wide {
        width: 100%;
        max-width: var(--echobox-max-grid);
        margin: 0 auto;
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .echobox-shell--reader .echobox-reader-bar,
    .echobox-shell--reader .echobox-post-hero,
    .echobox-shell--reader .echobox-post-content,
    .echobox-shell--reader .echobox-reader-footer {
        width: min(100%, var(--echobox-max-reader));
        margin-left: auto;
        margin-right: auto;
    }

    .echobox-shell--wide .echobox-subheader {
        padding-left: 0;
        padding-right: 0;
    }

    .echobox-grid {
        gap: 3px;
    }

    .echobox-grid-item {
        border-radius: 4px;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .echobox-grid-item:hover {
        transform: scale(1.02);
        z-index: 1;
    }

    .echobox-link:hover {
        border-color: var(--echobox-border-hover);
        background: rgba(255, 255, 255, 0.04);
    }

    .echobox-back:hover,
    .echobox-inline-link:hover,
    .echobox-text-link:hover {
        color: var(--echobox-text);
    }
}

@media (min-width: 768px) {
    .echobox-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .echobox-post-hero img {
        border-radius: 8px;
    }

    .echobox-hero-caption {
        padding-left: 0;
        padding-right: 0;
    }

    .echobox-post-content {
        padding-top: 28px;
    }

    .echobox-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        max-width: 100%;
    }
}

@media (min-width: 1024px) {
    :root {
        --echobox-max-reader: 820px;
        --echobox-max-grid: 1200px;
    }

    .echobox-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }

    .echobox-profile {
        padding: 24px 0 36px;
    }

    .echobox-avatar {
        width: 108px;
        height: 108px;
        font-size: 3rem;
    }

    .echobox-subtitle {
        font-size: 1.35rem;
    }

    .echobox-post-content h1 {
        font-size: 2.15rem;
    }

    .echobox-body {
        font-size: 1.1rem;
    }
}

@media (min-width: 1280px) {
    .echobox-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}
