/* The Compendium — shared structural stylesheet. Theme-agnostic: every
   color here is a CSS custom property, defined per-theme by the
   server-rendered <style>:root{...}</style> block (see
   resources/views/components/theme-vars.blade.php). This file only owns
   layout/structure — grid, vote column, card shape, sort tabs, flair chip
   mechanics — never a literal color. */

* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--bg, #14110d);
    /* --bg-texture: a theme-provided data-URI SVG (feTurbulence grain) or
       'none'. --bg-vignette: a theme-provided radial-gradient() or
       'none'. Both live entirely in a theme's css_variables JSON — no
       static per-theme background asset to manage. */
    background-image: var(--bg-texture, none), var(--bg-vignette, none);
    background-repeat: repeat, no-repeat;
    background-size: auto, cover;
    background-attachment: fixed, fixed;
    color: var(--text, #ece2c8);
    font-family: var(--font-body, 'Alegreya', serif);
    line-height: 1.5;
    min-height: 100vh;
}

.panel-lifted {
    box-shadow: var(--panel-shadow, 0 8px 24px rgba(0,0,0,0.4));
}

a { color: var(--gold, #c9a15a); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .display {
    font-family: var(--font-display, 'Cinzel', serif);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-panel, #262019);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.site-title {
    font-size: 1.4rem;
    margin: 0;
}
.site-title a {
    /* Gold-foil title treatment: every theme defines --title-gradient
       (a flat two-stop "gradient" for grimoire-classic, a real
       multi-stop sweep for the D&D theme) so this clip technique is
       always active rather than conditionally enabled per theme. */
    background-image: var(--title-gradient, linear-gradient(var(--gold-hi, #e8c988), var(--gold-hi, #e8c988)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-nav { display: flex; align-items: center; gap: 1rem; font-size: 0.95rem; }
.site-nav form { display: inline; }
.site-nav button.linklike {
    background: none; border: none; color: var(--gold, #c9a15a);
    font: inherit; cursor: pointer; padding: 0; text-decoration: underline;
}

.uncustomized-note {
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.75;
    padding: 0.5rem 1.5rem 0;
}

.flash {
    margin: 1rem 1.5rem 0;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    background: var(--bg-panel, #262019);
    border: 1px solid var(--gold, #c9a15a);
}
.flash.error { border-color: #b0453e; }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-wide { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Sort tabs */
.sort-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: baseline;
}
.sort-tabs a {
    padding: 0.5rem 0.9rem;
    border-radius: 6px 6px 0 0;
    color: var(--text, #ece2c8);
    opacity: 0.7;
}
.sort-tabs a.active {
    opacity: 1;
    color: var(--gold-hi, #e8c988);
    border-bottom: 2px solid var(--gold, #c9a15a);
}
.sort-hint { font-size: 0.8rem; opacity: 0.65; margin: -0.5rem 0 1rem; }

.period-toggle { display: flex; gap: 0.5rem; margin-bottom: 1rem; font-size: 0.85rem; }
.period-toggle a { padding: 0.2rem 0.6rem; border: 1px solid var(--border, rgba(255,255,255,0.08)); border-radius: 4px; }
.period-toggle a.active { border-color: var(--gold, #c9a15a); color: var(--gold-hi, #e8c988); }

/* Post card */
.post-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
    background: var(--bg-panel, #262019);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.post-card.sponsored { border-color: var(--gold, #c9a15a); }

.vote-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding-top: 0.15rem;
}
.vote-column form { margin: 0; }
.vote-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text, #ece2c8); opacity: 0.55; font-size: 1.1rem; line-height: 1;
    padding: 0.15rem;
}
.vote-btn:hover { opacity: 1; color: var(--gold, #c9a15a); }
.vote-btn.voted-up { opacity: 1; color: #7fbf6a; }
.vote-btn.voted-down { opacity: 1; color: #c96a5a; }
.vote-score { font-weight: 600; font-size: 0.9rem; }

.post-title { margin: 0 0 0.2rem; font-size: 1.05rem; }
.post-meta { font-size: 0.8rem; opacity: 0.75; }
.post-meta a { color: inherit; text-decoration: underline; }
.post-domain { opacity: 0.65; }

.flair-chip {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.sponsored-badge, .affiliate-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    background: rgba(255,255,255,0.08);
    opacity: 0.85;
}

.post-body { margin-top: 0.6rem; }
.post-image img { max-width: 100%; border-radius: 8px; }
.post-embed { position: relative; padding-top: 56.25%; margin-top: 0.6rem; }
.post-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

/* Comment tree */
.comment-tree { list-style: none; margin: 0; padding: 0; }
.comment-tree .comment-tree { margin-left: 1.25rem; border-left: 1px solid var(--border, rgba(255,255,255,0.08)); padding-left: 0.75rem; }
.comment {
    padding: 0.5rem 0;
}
.comment-meta { font-size: 0.8rem; opacity: 0.7; }
.comment-body { margin: 0.25rem 0; }
.continue-thread { font-size: 0.85rem; }

.rank-badge {
    font-size: 0.75rem;
    opacity: 0.8;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 4px;
    padding: 0 0.35rem;
    margin-left: 0.3rem;
}

form.inline-form { display: inline; }

.btn {
    display: inline-block;
    background: var(--gold, #c9a15a);
    color: #1a1409;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--text, #ece2c8); border: 1px solid var(--border, rgba(255,255,255,0.08)); }

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; }
.field input, .field textarea, .field select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg, #14110d);
    color: var(--text, #ece2c8);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 6px;
    font-family: inherit;
}
.field-error { color: #d98b7f; font-size: 0.8rem; margin-top: 0.2rem; list-style: none; padding: 0; }
.auth-status { color: #7fbf6a; font-size: 0.9rem; margin-bottom: 1rem; }

/* Auth pages (login/register/password reset/etc.) — a centered card on
   the same themed backdrop as the rest of the site, replacing Breeze's
   stock Tailwind guest layout + Laravel logo. */
.auth-wrap {
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.auth-wordmark {
    font-family: var(--font-display, 'Cinzel', serif);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}
.auth-wordmark a {
    background-image: var(--title-gradient, linear-gradient(var(--gold-hi, #e8c988), var(--gold-hi, #e8c988)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-card {
    width: 100%;
    max-width: 26rem;
    padding: 1.75rem;
    background: var(--bg-panel, #262019);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 10px;
    box-shadow: var(--panel-shadow, 0 8px 24px rgba(0,0,0,0.4));
}
.auth-card p { font-size: 0.9rem; opacity: 0.85; }
.auth-card .field-row { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; gap: 1rem; }
.auth-card label.checkbox { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }

.post-type-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.post-type-tabs button {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-panel, #262019);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    color: var(--text, #ece2c8);
    cursor: pointer;
    border-radius: 6px;
}
.post-type-tabs button.active { border-color: var(--gold, #c9a15a); color: var(--gold-hi, #e8c988); }

table.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
table.admin-table th, table.admin-table td {
    text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    font-size: 0.9rem;
}

.community-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.community-tile {
    padding: 1rem; border-radius: 10px; background: var(--bg-panel, #262019);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
}

.pagination { display: flex; gap: 0.5rem; margin-top: 1rem; font-size: 0.9rem; }

.dm-decree {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 4px;
    background: rgba(255,255,255,0.08); margin-right: 0.4rem;
}
