/* ==========================================================================
   Meme IDIATOR
   Every fixed size lives in the tokens below. Change one value here and it
   changes everywhere.
   ========================================================================== */
:root {
    --black: #000;
    --red: #f44336;
    --red-deep: #c62828;
    --concrete: #e8e8e8;
    --paper: #fff;

    --topbar-h: 56px;       /* top bar */
    --pane-max: 560px;      /* widest content of each half */
    --canvas-h: 360px;      /* picture frame of the editor (70% of the editor) */
    --ribbon-h: 150px;      /* tabs and controls above the picture (30% of the editor) */
    --ad-w: 300px;          /* ad slot, standard medium rectangle */
    --ad-h: 250px;
    --avatar-bar: 32px;     /* profile photo in the top bar */
    --avatar-post: 32px;    /* profile photo on a post */
    --avatar-profile: 96px; /* profile photo on the profile page */
    --feed-thumb-w: 196px;  /* picture of a post in the feed (7:4 shape, 112 px tall) */
    --post-h: 136px;        /* every post in the feed is exactly this tall */
}

/* ---------- Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--concrete);
    color: var(--black);
    font-family: 'Karla', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.4;
}

h1, h2, p {
    margin: 0;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--black);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--paper);
}

body.has-modal {
    overflow: hidden;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 2px solid var(--black);
    border-radius: 0;
    padding: 0.4rem 0.9rem;
    background: var(--paper);
    color: var(--black);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.btn:hover:not(:disabled) {
    background: var(--black);
    color: var(--paper);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-go {
    background: var(--red-deep);
    color: var(--paper);
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 1.2rem;
    letter-spacing: 0.03em;
    padding: 0.5rem 1.3rem;
}

.btn-go:hover:not(:disabled) {
    background: var(--black);
    color: var(--paper);
}

.btn-small {
    padding: 0.2rem 0.7rem;
    font-size: 0.9rem;
}

.btn-go.btn-small {
    font-size: 1.05rem;
    padding: 0.25rem 0.85rem;
}

.btn-on-dark {
    background: transparent;
    color: var(--paper);
    border-color: var(--paper);
}

.btn-on-dark:hover:not(:disabled) {
    background: var(--paper);
    color: var(--black);
}

.btn-block {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 16px;
    background: var(--black);
}

.logo {
    font-family: 'Anton', Impact, sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    color: var(--red);
    text-decoration: none;
}

.logo:hover {
    color: var(--paper);
}

.auth {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.topbar a:focus-visible,
.topbar button:focus-visible {
    outline-color: var(--paper);
    box-shadow: none;
}

/* ---------- Create / Feed switch (narrow screens) ---------- */
.view-bar {
    display: flex;
    background: var(--paper);
    border-bottom: 2px solid var(--black);
}

.view-bar button {
    flex: 1;
    padding: 0.7rem;
    border: 0;
    border-right: 2px solid var(--black);
    background: var(--paper);
    font-weight: 700;
}

.view-bar button:last-child {
    border-right: 0;
}

.view-bar button[aria-selected="true"] {
    background: var(--black);
    color: var(--paper);
}

/* ---------- The two halves ---------- */
.split {
    display: block;
}

.split[data-view="create"] .pane-feed,
.split[data-view="feed"] .pane-create {
    display: none;
}

.pane {
    padding: 16px;
}

.pane-inner {
    max-width: var(--pane-max);
    margin: 0 auto;
}

/* Wide screens: 50 / 50, each half scrolls on its own. */
@media (min-width: 1100px) {
    .page-home {
        height: 100vh;
        overflow: hidden;
    }

    .topbar {
        padding: 0 24px;
    }

    .view-bar {
        display: none;
    }

    .split {
        display: grid;
        grid-template-columns: 1fr 1fr;
        height: calc(100vh - var(--topbar-h));
    }

    .split[data-view] .pane {
        display: block;
        overflow-y: auto;
        padding: 24px;
    }

    .pane-feed {
        border-left: 2px solid var(--black);
    }
}

/* ---------- Editor ---------- */
.ad-slot {
    width: var(--ad-w);
    height: var(--ad-h);
    margin: 0 auto 16px;
}

/* Ribbon above the picture: the tabs choose what to change, the buttons on the right are always there.
   Nothing sits below the picture. */
.ribbon {
    display: flex;
    flex-direction: column;
    height: var(--ribbon-h);
    margin-bottom: 8px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.ribbon-bar {
    display: flex;
    flex: none;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    height: 38px;
    background: var(--concrete);
    border-bottom: 2px solid var(--black);
}

.ribbon-tabs {
    display: flex;
}

.ribbon-tabs button {
    padding: 0 14px;
    border: 0;
    border-right: 2px solid var(--black);
    background: transparent;
    font-weight: 700;
}

.ribbon-tabs button:hover:not([aria-selected="true"]) {
    background: var(--paper);
}

.ribbon-tabs button[aria-selected="true"] {
    background: var(--black);
    color: var(--paper);
}

.ribbon-tabs button:focus-visible {
    outline-offset: -4px;
    box-shadow: none;
}

.ribbon-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 6px;
}

.btn-icon {
    width: 32px;
    padding: 0.2rem 0;
}

.ribbon-panel {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    gap: 8px 12px;
    min-height: 0;
    padding: 10px 12px;
    overflow-y: auto;
}

#panel-picture .hint {
    flex-basis: 100%;
    margin: 0;
}

#panel-text {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
}

#panel-font,
#panel-color {
    display: grid;
    grid-template-columns: 2fr 2fr 1.3fr;
    gap: 12px;
    align-items: end;
    align-content: center;
}

.source-label {
    font-weight: 700;
}

.templates {
    display: inline-flex;
    gap: 8px;
}

.template-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid var(--black);
    border-radius: 50%;
}

.template-swatch:hover {
    transform: scale(1.12);
}

.layers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#layer-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.layer-chip {
    padding: 0.15rem 0.7rem;
    border: 2px solid var(--black);
    border-radius: 0;
    background: var(--paper);
    color: var(--black);
    font-size: 0.85rem;
    font-weight: 700;
}

.layer-chip.is-active {
    background: var(--black);
    color: var(--paper);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

#layer-text,
#layer-font,
.modal input {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid var(--black);
    border-radius: 0;
    background: var(--paper);
    color: var(--black);
    font-weight: 400;
}

#layer-text {
    flex: none;
    height: 52px;
    resize: none;
}

.field input[type=range] {
    width: 100%;
    margin: 6px 0;
    accent-color: var(--red-deep);
}

.field input[type=color] {
    width: 100%;
    height: 32px;
    padding: 2px;
    border: 2px solid var(--black);
    border-radius: 0;
    background: var(--paper);
    cursor: pointer;
}

.field.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
}

.field.check input {
    width: 20px;
    height: 20px;
    accent-color: var(--red-deep);
}

/* The picture frame never changes size; the picture fits inside it. */
.canvas-wrap {
    position: relative;
    width: 100%;
    height: var(--canvas-h);
    background: var(--black);
    border: 2px solid var(--black);
}

#meme-canvas {
    position: absolute;
    inset: 0;
    display: block;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
}

.hint {
    font-size: 0.85rem;
}

/* Messages (a wrong file, a restored meme) show over the bottom of the picture, so nothing is added below it. */
.canvas-wrap .status {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    margin: 0;
    padding: 6px 10px;
    background: var(--black);
    border-top: 2px solid var(--red-deep);
    color: var(--paper);
    font-size: 0.9rem;
    font-weight: 700;
}

.canvas-wrap .status:empty {
    display: none;
}

/* Phones: the buttons move to their own row and the picture is square. */
@media (max-width: 559px) {
    .ribbon {
        height: auto;
    }

    .ribbon-bar {
        flex-wrap: wrap;
        height: auto;
    }

    .ribbon-tabs {
        width: 100%;
        border-bottom: 2px solid var(--black);
    }

    .ribbon-tabs button {
        flex: 1;
        padding: 0.5rem 0;
    }

    .ribbon-tabs button:last-child {
        border-right: 0;
    }

    .ribbon-actions {
        width: 100%;
        padding: 6px;
    }

    .ribbon-actions .btn-go {
        flex: 1;
    }

    .ribbon-panel {
        min-height: 112px;
    }

    .canvas-wrap {
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* ---------- Feed ---------- */
.feed-tabs {
    display: flex;
    margin-bottom: 12px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.feed-tabs button {
    flex: 1;
    padding: 0.55rem;
    border: 0;
    background: var(--paper);
    font-weight: 700;
}

.feed-tabs button + button {
    border-left: 2px solid var(--black);
}

.feed-tabs button[aria-selected="true"] {
    background: var(--black);
    color: var(--paper);
}

/* A post is a compact row: small picture on the left, details on the right.
   Every post is the same height, so three or more fit on screen at once. */
.post {
    display: flex;
    gap: 12px;
    height: var(--post-h);
    margin-bottom: 12px;
    padding: 10px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.post-image {
    flex: none;
    align-self: flex-start;
    width: var(--feed-thumb-w);
    aspect-ratio: 7 / 4;
    padding: 0;
    background: var(--black);
    border: 2px solid var(--black);
}

.post-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.post-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: var(--avatar-post);
    height: var(--avatar-post);
    border: 2px solid var(--black);
    border-radius: 50%;
    color: var(--paper);
    font-family: 'Anton', Impact, sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.post-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.post-name {
    overflow: hidden;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-name:hover {
    text-decoration: underline;
}

.post-time {
    font-size: 0.8rem;
    color: #444;
}

.post-caption {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.post-actions {
    display: flex;
    gap: 2px;
    margin-left: -6px;
}

.post-actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    border: 0;
    background: transparent;
    font-weight: 700;
    font-size: 0.9rem;
}

.post-actions button:hover {
    background: var(--black);
    color: var(--paper);
}

.post-actions .report {
    margin-left: auto;
}

/* Phones: a smaller picture so the details still fit beside it. */
@media (max-width: 520px) {
    :root {
        --feed-thumb-w: 128px;
        --post-h: 108px;
    }

    .post {
        gap: 10px;
    }
}

.empty {
    padding: 24px;
    background: var(--paper);
    border: 2px solid var(--black);
    text-align: center;
}

.empty p {
    margin-bottom: 14px;
}

/* ---------- Register / login window and picture viewer ---------- */
.modal,
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.65);
}

/* The form inside the register/login window */
.modal .field {
    margin-bottom: 12px;
}

/* Register / login window: "Forgot password?" and "Back to login" */
.modal-intro {
    margin: 0 0 12px;
}

.modal-links {
    margin: -4px 0 12px;
    text-align: center;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--red-deep);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* Publish window */
.publish-preview {
    display: block;
    max-width: 100%;
    max-height: 240px;
    margin: 0 auto 12px;
    border: 2px solid var(--black);
}

.modal textarea {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid var(--black);
    border-radius: 0;
    font: inherit;
    font-weight: 400;
    resize: vertical;
}

.publish-usage {
    margin: 0 0 8px;
    font-size: 0.85rem;
}

/* Report window */
.reasons {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.reasons legend {
    margin-bottom: 6px;
    font-weight: 700;
}

.reason {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.reason input {
    width: auto;
    margin: 0;
    padding: 0;
    accent-color: var(--red-deep);
}

/* Likes: a filled red heart when you liked it */
.like.is-liked,
.like.is-liked:hover {
    color: var(--red-deep);
}

/* Follow next to the name on a post */
.post-follow {
    margin-left: auto;
    padding: 1px 8px;
    border: 2px solid var(--black);
    background: var(--paper);
    font-size: 0.75rem;
    font-weight: 700;
}

.post-follow:hover,
.post-follow.is-following {
    background: var(--black);
    color: var(--paper);
}

/* Like and comment buttons on profile meme cards */
.meme-card-actions {
    display: flex;
    gap: 12px;
}

.meme-card-actions button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.85rem;
}

/* Comments window */
.comments-list {
    max-height: 320px;
    margin-bottom: 12px;
    overflow-y: auto;
}

.comment {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--concrete);
}

.comment-avatar {
    flex: none;
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
}

.comment-main {
    min-width: 0;
    flex: 1;
}

.comment-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.comment-name {
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

.comment-time {
    color: #555;
    font-size: 0.75rem;
}

.comment-delete {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.75rem;
}

.comment-delete:hover,
.comment-delete[data-armed] {
    color: var(--red-deep);
    font-weight: 700;
}

.comment-body {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.comment-login {
    margin: 0;
    text-align: center;
}

/* "Sure? Delete" on your own post */
.post-actions [data-armed] {
    color: var(--red-deep);
    font-weight: 700;
}

/* "Remove watermark" offer in the Picture panel (hidden for Pro) */
.btn-remove-mark {
    margin-left: auto;
    border-color: var(--red-deep);
    color: var(--red-deep);
}

.btn-remove-mark .price-tag {
    padding: 0 6px;
    background: var(--red-deep);
    color: var(--paper);
}

.btn-remove-mark:hover:not(:disabled) .price-tag {
    background: var(--paper);
    color: var(--black);
}

/* Pro plan window: two plans to pick from */
.pro-intro {
    margin: 0 0 12px;
}

.plans {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.plan {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--black);
    cursor: pointer;
}

.plan:has(input:checked) {
    background: var(--black);
    color: var(--paper);
}

.plan input {
    width: auto;
    margin: 0;
    accent-color: var(--red);
}

.plan-name {
    font-weight: 700;
}

.plan-price {
    font-weight: 700;
    white-space: nowrap;
}

.plan-save {
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--red-deep);
    color: var(--paper);
    font-size: 0.75rem;
}

.field-hint {
    font-size: 0.8rem;
    font-weight: 400;
}

.form-message {
    min-height: 1.4em;
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.form-message.is-error {
    color: var(--red-deep);
}

.form-message.is-ok {
    color: #1b5e20;
}

/* Short notice at the bottom of the screen */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 70;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 10px 16px;
    background: var(--black);
    border: 2px solid var(--paper);
    color: var(--paper);
    font-weight: 700;
    transform: translateX(-50%);
}

/* Top bar: the signed-in person. Hidden until the session is known, with a failsafe so it always appears. */
.auth {
    align-items: center;
}

.auth:not(.is-ready) {
    visibility: hidden;
    animation: auth-show 0s 2s forwards;
}

@keyframes auth-show {
    to { visibility: visible; }
}

.bar-avatar {
    width: var(--avatar-bar);
    height: var(--avatar-bar);
    font-size: 0.75rem;
    border-color: var(--paper);
}

.modal,
.lightbox {
    overflow-y: auto;
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 24px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.modal-box h2 {
    margin-bottom: 12px;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 1.7rem;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.2rem 0.55rem;
    border: 0;
    background: transparent;
    font-size: 1.3rem;
}

.modal-tabs {
    display: flex;
    margin-bottom: 14px;
    border: 2px solid var(--black);
}

.modal-tabs button {
    flex: 1;
    padding: 0.45rem;
    border: 0;
    background: var(--paper);
    font-weight: 700;
}

.modal-tabs button + button {
    border-left: 2px solid var(--black);
}

.modal-tabs button[aria-selected="true"] {
    background: var(--black);
    color: var(--paper);
}

.modal-note {
    margin-bottom: 14px;
    padding: 6px 10px;
    background: var(--concrete);
    border-left: 4px solid var(--red-deep);
    font-size: 0.9rem;
}

.lightbox {
    background: rgba(0, 0, 0, 0.88);
}

.lightbox img {
    display: block;
    max-width: min(100%, 1120px);
    max-height: 100%;
    background: var(--black);
    border: 2px solid var(--paper);
}

.lightbox .modal-close {
    top: 12px;
    right: 16px;
    color: var(--paper);
}

.lightbox .modal-close:focus-visible {
    outline-color: var(--paper);
    box-shadow: none;
}

/* Phones: a tighter window so the whole form is visible without scrolling. */
@media (max-width: 559px) {
    .modal-box {
        padding: 16px;
    }

    .modal-box h2 {
        margin-bottom: 8px;
        font-size: 1.4rem;
    }

    .modal-tabs {
        margin-bottom: 10px;
    }

    .modal .field {
        margin-bottom: 8px;
    }

    .modal-note {
        margin-bottom: 0;
    }
}

/* ---------- Profile page ---------- */
.profile {
    max-width: var(--pane-max);
    margin: 0 auto;
    padding: 24px 16px;
}

.profile-back {
    display: inline-block;
    margin-bottom: 16px;
    font-weight: 700;
}

/* Header card: avatar on the left, name, @username, bio, counts and buttons on the right */
.profile-head {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.profile-avatar {
    flex: none;
    width: var(--avatar-profile);
    height: var(--avatar-profile);
    font-size: 2.2rem;
}

.profile-info {
    min-width: 0;
}

.profile-name {
    margin: 0;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 2rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.profile-handle {
    margin: 2px 0 8px;
    color: #555;
    font-size: 0.9rem;
}

.profile-bio {
    margin: 0 0 10px;
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
    font-size: 0.95rem;
}

.profile-stats strong {
    font-size: 1.1rem;
}

.profile-note {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: #555;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn.is-following {
    background: var(--black);
    color: var(--paper);
}

.profile-section {
    margin: 0 0 12px;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 1.5rem;
}

/* Meme grid: square pictures in cards, caption and date underneath */
.meme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.meme-grid > .empty {
    grid-column: 1 / -1;
}

.meme-card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 2px solid var(--black);
}

.meme-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-bottom: 2px solid var(--black);
    background: var(--black);
    cursor: zoom-in;
}

.meme-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.meme-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
}

.meme-card-caption {
    margin: 0;
    font-size: 0.9rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.meme-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    color: #555;
    font-size: 0.8rem;
}

.meme-card-delete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border: 0;
    background: none;
    color: var(--black);
    font-size: 0.8rem;
}

.meme-card-delete:hover,
.meme-card-delete[data-armed] {
    color: var(--red-deep);
    font-weight: 700;
}

@media (max-width: 480px) {
    .profile-head {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-stats,
    .profile-actions {
        justify-content: center;
    }

    .meme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

/* ---------- Text pages: FAQ, Terms, Privacy, Report content, Moderation ---------- */
.doc {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 16px 40px;
}

.doc-wide {
    max-width: 980px;
}

.doc h1 {
    margin: 0 0 8px;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 2.2rem;
    line-height: 1.1;
}

.doc h2 {
    margin: 28px 0 8px;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: 1.4rem;
}

.doc h3 {
    margin: 18px 0 6px;
    font-size: 1.05rem;
}

.doc p,
.doc li {
    line-height: 1.6;
}

.doc ul,
.doc ol {
    padding-left: 22px;
}

.doc a {
    color: var(--red-deep);
    font-weight: 700;
}

.doc-lead {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.doc-updated,
.doc-small {
    color: #555;
    font-size: 0.9rem;
}

.doc-points {
    margin: 0 0 20px;
    padding: 14px 18px 14px 34px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.doc-form {
    display: grid;
    gap: 14px;
    padding: 20px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.doc-form input[type="text"],
.doc-form input[type="email"],
.doc-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--black);
    border-radius: 0;
    background: var(--paper);
    font: inherit;
    font-weight: 400;
}

.doc-form .form-message {
    margin: 0;
}

.doc-after {
    padding: 20px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.faq dt {
    margin-top: 18px;
    font-weight: 700;
}

.faq dd {
    margin: 4px 0 0;
    line-height: 1.6;
}

/* Signup: "I am 13 or older and accept the Terms" */
.field.check.agree {
    align-items: flex-start;
    font-weight: 400;
}

.field.check.agree input {
    flex: none;
    margin-top: 2px;
}

.field.check.agree a {
    color: var(--red-deep);
    font-weight: 700;
}

/* ---------- Footer links ---------- */
.site-footer {
    padding: 20px 16px 28px;
    text-align: center;
    font-size: 0.9rem;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    margin-bottom: 6px;
}

.site-footer a {
    color: var(--black);
    font-weight: 700;
}

.site-footer p {
    margin: 0;
    color: #555;
}

.pane-feed .site-footer {
    padding-bottom: 8px;
}

/* ---------- Moderation page ---------- */
.admin-tabs {
    margin-bottom: 16px;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-card {
    padding: 16px;
    background: var(--paper);
    border: 2px solid var(--black);
}

.admin-card.is-closed {
    opacity: 0.6;
}

.admin-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-due {
    padding: 2px 8px;
    background: var(--black);
    color: var(--paper);
    font-weight: 700;
    font-size: 0.85rem;
}

.admin-due.is-urgent {
    background: var(--red-deep);
}

.admin-closed {
    font-weight: 700;
}

.admin-meme {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
}

.admin-thumb {
    flex: none;
    width: 140px;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid var(--black);
    background: var(--black);
    cursor: zoom-in;
}

.admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admin-meme-info p,
.admin-card p {
    margin: 0 0 4px;
}

.admin-state,
.admin-gone {
    color: #555;
    font-size: 0.9rem;
}

.admin-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 12px;
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.admin-facts dt {
    font-weight: 700;
}

.admin-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-reasons {
    margin: 0 0 12px;
    padding-left: 20px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-actions [data-armed] {
    background: var(--red-deep);
    color: var(--paper);
}

@media (max-width: 560px) {
    .admin-meme {
        flex-direction: column;
    }

    .admin-facts {
        grid-template-columns: 1fr;
    }
}

/* ---------- Cookie banner (only when Google Analytics is set up) ---------- */
.cookie-banner {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    max-width: 640px;
    margin: 0 auto;
    padding: 14px 16px;
    background: var(--paper);
    border: 2px solid var(--black);
    box-shadow: 4px 4px 0 var(--black);
}

.cookie-banner p {
    margin: 0;
    flex: 1 1 260px;
}

.cookie-banner a {
    color: var(--red-deep);
    font-weight: 700;
}

.cookie-actions {
    display: flex;
    gap: 8px;
}

/* Your own meme, hidden while a report is reviewed */
.hidden-badge {
    margin: 0;
    padding: 2px 6px;
    background: var(--red-deep);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 700;
    align-self: flex-start;
}

/* While the feed loads, keep its space so nothing below jumps when it appears. */
#feed-list.is-loading {
    min-height: 100vh;
}

/* Profile: fill the screen while loading, so the footer does not jump down when the memes arrive. */
.page-profile .profile {
    min-height: calc(100vh - var(--topbar-h));
}

.doc-after h2 {
    margin-top: 0;
}
