/* =========================================================
   CONFESIONARIO X — STYLESHEET v2
   ========================================================= */

/* ─── Google Fonts are loaded in header.php ─── */

/* ─── CSS Custom Properties ─── */
:root {
    /* Theme: Claro editorial */
    --bg: #f7f3ee;
    --bg-glow: #efe7de;
    --surface: #fffdfa;
    --surface-2: #f4ede4;
    --text: #241d1c;
    --text-muted: #736462;
    --line: #ddcfc5;
    --primary: #9f1239;
    --primary-hover: #be123c;
    --on-primary: #ffffff;
    --secondary: #f4ede8;
    --secondary-hover: #eadfd7;
    --on-secondary: #241d1c;
    --accent: #c08b2c;
    --on-accent: #ffffff;
    --accent-light: rgba(192, 139, 44, .14);
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --on-danger: #ffffff;
    --ok: #166534;
    --ok-bg: #dcfce7;
    --err: #991b1b;
    --err-bg: #fee2e2;
    --link: #9f1239;

    /* Spacing & shape */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-card: 0 4px 16px rgba(100, 60, 30, .12);
    --shadow-hover: 0 8px 28px rgba(100, 60, 30, .22);
    --shadow-glow: 0 0 0 3px rgba(124, 45, 62, .18);
}

/* ─── Dark theme ─── */
[data-theme="dark"] {
    /* Theme: Sensual nocturno */
    --bg: #050505;
    --bg-glow: #110507;
    --surface: #161616;
    --surface-2: #1f1b1d;
    --text: #ffffff;
    --text-muted: #c5b9bb;
    --line: #322529;
    --primary: #d90429;
    --primary-hover: #ef233c;
    --on-primary: #ffffff;
    --secondary: #211517;
    --secondary-hover: #2a1c1f;
    --on-secondary: #ffffff;
    --accent: #9d0208;
    --on-accent: #ffffff;
    --accent-light: rgba(217, 4, 41, .18);
    --danger: #ef233c;
    --danger-hover: #ff4d61;
    --on-danger: #ffffff;
    --ok: #8ce99a;
    --ok-bg: #132219;
    --err: #ffd0d5;
    --err-bg: #3a1017;
    --link: #ef233c;
}

/* ─── Gray (slate) theme ─── */
[data-theme="gray"] {
    /* Theme: Gris sobrio */
    --bg: #e8ebef;
    --bg-glow: #dce1e8;
    --surface: #f8fafc;
    --surface-2: #edf1f5;
    --text: #18202a;
    --text-muted: #5f6b7a;
    --line: #cad3dd;
    --primary: #475569;
    --primary-hover: #334155;
    --on-primary: #ffffff;
    --secondary: #e9eef4;
    --secondary-hover: #dde5ee;
    --on-secondary: #18202a;
    --accent: #7c8aa0;
    --on-accent: #ffffff;
    --accent-light: rgba(124, 138, 160, .18);
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --on-danger: #ffffff;
    --ok: #15803d;
    --ok-bg: #dcfce7;
    --err: #991b1b;
    --err-bg: #fee2e2;
    --link: #475569;
}

/* ─── Sepia theme ─── */
[data-theme="sepia"] {
    --bg: #2e2318;
    --bg-glow: #3d2e1e;
    --surface: #3d2e1e;
    --surface-2: #4e3b26;
    --text: #f5ead4;
    --text-muted: #c4a97a;
    --line: #6e5035;
    --primary: #e2a84e;
    --primary-hover: #d09540;
    --on-primary: #1c1007;
    --secondary: #4e3b26;
    --secondary-hover: #624d33;
    --on-secondary: #f5ead4;
    --accent: #e2a84e;
    --on-accent: #1c1007;
    --accent-light: rgba(226, 168, 78, .2);
    --danger: #f87171;
    --danger-hover: #ef4444;
    --on-danger: #1c1007;
    --ok: #a3e635;
    --ok-bg: #1a2a05;
    --err: #fca5a5;
    --err-bg: #2a0f0f;
    --link: #e2a84e;
}

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    line-height: 1.65;
    transition: background-color .3s, color .3s;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color .15s;
}

a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* ─── Typography ─── */
h1,
h2,
h3,
h4 {
    margin: 0 0 .65rem;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    color: var(--text);
    letter-spacing: -.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(1.6rem, 4vw, 2.25rem);
    font-weight: 700;
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    font-weight: 700;
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

p {
    margin: 0 0 .9rem;
}

/* ─── Navigation / Topbar ─── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    height: 54px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background .3s, border-color .3s;
}

.brand {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
    color: var(--primary-hover);
}

.brand i {
    font-size: 1rem;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.nav-center a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.nav-center a:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-center a.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--accent-light);
}

.notif-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    border-radius: var(--radius-pill);
    background: var(--danger);
    color: var(--on-danger);
    font-size: .68rem;
    font-weight: 700;
    padding: 0 4px;
}

/* Theme switching buttons */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 3px;
}

.theme-btn {
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--text);
    transition: background .15s, color .15s;
    padding: 0;
}

.theme-btn:hover {
    background: var(--surface);
    color: var(--primary);
}

.theme-btn.active {
    background: var(--primary);
    color: var(--on-primary);
}

.theme-btn title {
    display: none;
}

/* Auth links */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Hamburger (mobile) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text);
    position: relative;
    z-index: 150;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}

/* Mobile nav drawer */
#mobile-nav {
    display: none;
    flex-direction: column;
    gap: 2px;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 12px 20px 16px;
    z-index: 99;
    animation: slideDown .2s ease;
}

#mobile-nav.open {
    display: flex;
}

#mobile-nav a {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

#mobile-nav a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Page Container ─── */
.container {
    width: 90vw;
    max-width: 1400px;
    margin: 14px auto;
    padding: 0 10px 24px;
}

/* ─── Hero / Section Header ─── */
.hero {
    background: linear-gradient(140deg, var(--surface), var(--surface-2));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--accent-light);
    pointer-events: none;
}

/* ─── Grid & Cards ─── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-card);
    transition: transform .22s ease, box-shadow .22s ease;
    animation: fadeInUp .4s ease both;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animations for grid children */
.grid .card:nth-child(1) {
    animation-delay: .04s;
}

.grid .card:nth-child(2) {
    animation-delay: .08s;
}

.grid .card:nth-child(3) {
    animation-delay: .12s;
}

.grid .card:nth-child(4) {
    animation-delay: .16s;
}

.grid .card:nth-child(5) {
    animation-delay: .20s;
}

.grid .card:nth-child(6) {
    animation-delay: .24s;
}

.card p {
    color: var(--text-muted);
}

.card h2,
.card h3 {
    color: var(--text);
    font-weight: 600;
}

.card .content {
    color: var(--text-muted);
    line-height: 1.65;
}

/* Story card extras */
.card-story {
    border-top: 3px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-story h3 {
    margin-bottom: 2px;
}

.card-story h3 a {
    color: var(--text);
}

.card-story h3 a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* Excerpt with fade */
.excerpt {
    position: relative;
    max-height: 80px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.6;
}

.excerpt::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(transparent, var(--surface));
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

/* ─── Star Ratings ─── */
.stars {
    display: inline-flex;
    gap: 2px;
    color: var(--accent);
    font-size: .85rem;
}

.stars .star-empty {
    color: var(--line);
}

.rating-label {
    font-size: .8rem;
    color: var(--text-muted);
    vertical-align: middle;
}

/* Interactive star rating (radio) */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
    width: fit-content;
}

.star-rating input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.star-rating label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--line);
    transition: color .15s;
    padding: 0 2px;
    user-select: none;
}

.star-rating input:checked~label,
.star-rating label:hover,
.star-rating label:hover~label {
    color: var(--accent);
}

/* ─── Read-time indicator ─── */
.read-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    color: var(--text-muted);
}

/* ─── Forms ─── */
.form {
    display: grid;
    gap: 10px;
}

.form-group {
    display: grid;
    gap: 5px;
}

.form-label {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .01em;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 85%, transparent 15%);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

textarea {
    min-height: 130px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: .7;
}

/* Auth box */
.auth-box {
    max-width: 420px;
    margin: 0 auto;
    animation: fadeInUp .35s ease both;
}

.auth-tagline {
    font-family: "Playfair Display", serif;
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-style: italic;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    border-radius: var(--radius-sm);
    padding: .4rem .9rem;
    font-size: .8rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--on-primary);
    box-shadow: 0 4px 12px rgba(124, 45, 62, .35);
}

.btn-secondary {
    background: var(--secondary);
    border-color: var(--line);
    color: var(--on-secondary);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-accent {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}

.btn-accent:hover {
    filter: brightness(1.1);
    color: var(--on-accent);
}

.btn-paypal {
    background: #FFC439 !important;
    color: #003087 !important;
    border-color: #FFC439 !important;
    font-weight: 700;
}

.btn-paypal:hover {
    background: #F2BA36 !important;
    color: #003087 !important;
}

.btn-danger {
    background: var(--danger);
    color: var(--on-danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
    color: var(--on-danger);
}

.btn-sm {
    min-height: 30px;
    padding: .3rem .75rem;
    font-size: .8rem;
}

.btn-lg {
    min-height: 48px;
    padding: .7rem 1.5rem;
    font-size: 1rem;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ─── Alerts ─── */
.alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert.success {
    background: var(--ok-bg);
    color: var(--ok);
    border-color: rgba(20, 83, 45, .25);
}

.alert.error {
    background: var(--err-bg);
    color: var(--err);
    border-color: rgba(127, 29, 29, .25);
}

/* ─── Badge & Tags ─── */
.badge {
    display: inline-block;
    font-size: .73rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-light);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
    letter-spacing: .02em;
    text-transform: uppercase;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 2px 10px;
    font-size: .76rem;
    background: var(--surface-2);
    color: var(--text-muted);
    transition: background .15s, color .15s;
}

.tag-pill:hover {
    background: var(--accent-light);
    color: var(--primary);
}

/* ─── Meta & Utilities ─── */
.meta {
    color: var(--text-muted);
    font-size: .84rem;
    line-height: 1.45;
}

.divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}

.disabled-link {
    pointer-events: none;
    opacity: .5;
}

/* ─── Pagination ─── */
.pagination-nav {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── Avatars ─── */
.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    object-fit: cover;
    border: 2px solid var(--line);
    background: var(--surface-2);
}

.avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-pill);
    object-fit: cover;
    border: 3px solid var(--primary);
    background: var(--surface-2);
}

.avatar-xl {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-pill);
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 5px var(--accent-light);
    background: var(--surface-2);
}

.profile-preview {
    width: 76px;
    height: 76px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--line);
}

.author-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Profile pages ─── */
.profile-banner {
    height: 110px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    position: relative;
}

.profile-head {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 0 24px 20px;
}

.profile-avatar-wrap {
    margin-top: -48px;
    position: relative;
    z-index: 1;
}

.profile-info h1 {
    margin-bottom: 2px;
}

.profile-kpis {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.kpi-value {
    font-family: "Playfair Display", serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-label {
    font-size: .74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ─── Story content (reading view) ─── */
.story-content {
    font-family: "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
    font-size: 1.125rem;
    line-height: 1.85;
    max-width: 72ch;
    color: var(--text);
}

/* ─── Story header (show page) ─── */
.story-header {
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.story-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

/* ─── Rank cards (top lists) ─── */
.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-number {
    font-family: "Playfair Display", serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 32px;
    text-align: center;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-info a {
    color: var(--text);
    font-weight: 600;
}

.rank-info a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* ─── Forms — filters ─── */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.story-search-form {
    gap: 8px;
    width: 100%;
    max-width: 760px;
    justify-self: end;
}

.story-search-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}

.story-search-input {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface-2) 80%, transparent 20%);
    padding: 0 10px;
}

.story-search-input i {
    color: var(--text-muted);
    font-size: .86rem;
}

.story-search-input input {
    border: none;
    background: transparent;
    padding: 7px 0;
    box-shadow: none;
}

.story-search-input:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.stories-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(420px, 56%);
    align-items: start;
    gap: 10px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.check-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 7px 12px;
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: .85rem;
}

.check-chip:has(input:checked) {
    border-color: var(--primary);
    background: var(--accent-light);
    color: var(--primary);
}

.check-chip input {
    width: auto;
    accent-color: var(--primary);
}

/* ─── Age check ─── */
.age-check-form {
    max-width: 380px;
    margin: 0 auto;
    text-align: center;
}

/* ─── Footer ─── */
.footer {
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    padding: 32px 24px 20px;
}

.footer-grid {
    max-width: 1140px;
    margin: 0 auto 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.footer-col h4 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-family: "Inter", sans-serif;
    font-weight: 700;
}

.footer-col a,
.footer-col p {
    display: block;
    color: var(--text-muted);
    font-size: .85rem;
    margin-bottom: 6px;
    transition: color .15s;
}

.footer-col a:hover {
    color: var(--primary);
    text-decoration: none;
}

.footer-bottom {
    max-width: 1140px;
    margin: 0 auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
}

/* ─── Admin styles ─── */
.admin-summary-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.admin-kpi {
    padding: 18px 20px;
    text-align: center;
    border-top: 3px solid var(--accent);
}

.admin-kpi h3 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary);
}

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

.admin-module-nav {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: var(--surface);
}

.admin-table th,
.admin-table td {
    text-align: left;
    vertical-align: top;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: .875rem;
}

.admin-table th {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    position: sticky;
    top: 0;
    font-weight: 700;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--surface-2);
}

/* ─── Messages ─── */
.message-thread {
    display: grid;
    gap: 12px;
}

.message-bubble {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.message-bubble.outgoing {
    border-color: var(--accent-light);
    background: color-mix(in srgb, var(--surface) 70%, var(--accent-light) 30%);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .topbar {
        padding: 0 16px;
    }

    .nav-center,
    .nav-auth {
        display: none !important;
    }

    .theme-switcher {
        display: none !important;
    }

    .hamburger {
        display: flex;
    }

    .stories-toolbar {
        grid-template-columns: 1fr;
    }

    .story-search-form {
        max-width: 100%;
        justify-self: stretch;
    }

    .story-search-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: 94vw;
        padding: 0 8px 20px;
        margin-top: 12px;
    }

    .hero {
        padding: 12px;
    }

    .card {
        padding: 12px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .footer {
        padding: 24px 16px 16px;
    }

    .profile-head {
        padding: 0 16px 16px;
    }
}

@media (max-width: 400px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   CONTEMPORARY UI OVERRIDES
   ========================================================= */

body {
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--accent-light) 72%, transparent) 0%, transparent 32%),
        radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 28%),
        radial-gradient(circle at 22% 30%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 12%),
        radial-gradient(circle at 78% 24%, color-mix(in srgb, var(--primary) 9%, transparent) 0%, transparent 14%),
        radial-gradient(circle at 18% 76%, color-mix(in srgb, var(--accent-light) 90%, transparent) 0%, transparent 10%),
        radial-gradient(circle at 86% 72%, color-mix(in srgb, var(--primary) 7%, transparent) 0%, transparent 13%),
        linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg-glow) 62%, var(--bg)) 100%);
}

body.menu-open {
    overflow: hidden;
}

.topbar {
    padding: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 10%, var(--line));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .01)),
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--bg) 88%, var(--surface)));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 140;
}

.topbar-shell {
    width: min(100%, 100vw);
    max-width: none;
    min-height: 82px;
    margin: 0 auto;
    padding: 10px 24px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 16px;
}

.brand {
    color: var(--text);
    gap: 0;
    min-width: 0;
    align-self: center;
    justify-self: start;
    position: relative;
    z-index: 2;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
    color: var(--on-primary);
    box-shadow: 0 18px 30px rgba(0, 0, 0, .28);
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    overflow: hidden;
}

.brand-mark-logo {
    width: clamp(220px, 24vw, 340px);
    height: clamp(48px, 5.2vw, 62px);
    border-radius: 14px;
    padding: 2px 0;
    justify-content: flex-start;
    align-items: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

.brand-mark-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

.brand-copy {
    display: grid;
    gap: 1px;
}

.brand-copy strong {
    font-family: "Playfair Display", serif;
    color: var(--text);
    font-size: 1.18rem;
}

.brand-copy small {
    color: var(--text-muted);
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nav-center a {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1rem;
    color: color-mix(in srgb, var(--text) 92%, var(--text-muted));
}

.nav-center a.active {
    background: color-mix(in srgb, var(--accent-light) 65%, transparent);
    border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
}

.nav-center {
    justify-self: center;
    min-width: 0;
    gap: 2px;
    width: 100%;
    justify-content: center;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.theme-trigger {
    min-width: 40px;
    width: 40px;
    padding-inline: 0;
    border-radius: 999px;
}

.nav-user-chip {
    display: inline-flex;
    flex-direction: column;
    padding: 7px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    border: 1px solid var(--line);
    line-height: 1.15;
}

.nav-user-label {
    color: var(--text-muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.nav-register-btn {
    border-radius: 999px;
    padding-inline: 14px;
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 7, .42);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity .2s ease;
}

.mobile-nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

#mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--bg) 88%, var(--surface)));
    border-left: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
    padding: 18px 18px 24px;
    z-index: 130;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform .24s ease;
    box-shadow: -24px 0 48px rgba(0, 0, 0, .18);
}

#mobile-nav.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface) 94%, transparent));
    z-index: 2;
}

.mobile-nav-title-wrap {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.2rem;
    color: var(--text);
}

.mobile-nav-copy {
    color: var(--text-muted);
    margin: 0 0 6px;
    font-size: .92rem;
}

.mobile-nav-close {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
}

.mobile-nav-close i {
    line-height: 1;
    pointer-events: none;
}

.mobile-nav-form {
    padding: 4px 0;
}

.mobile-theme-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.mobile-theme-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.mobile-theme-option {
    justify-content: flex-start;
    gap: 10px;
    min-height: 42px;
    border-radius: 14px;
    padding-inline: 14px;
}

.mobile-theme-option span {
    font-size: .9rem;
}

.container {
    margin: 26px auto;
    padding-bottom: 32px;
}

.page-shell {
    position: relative;
}

.site-page .page-shell::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: min(300px, 38vw);
    height: 300px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-light) 80%, transparent) 0%, transparent 70%);
    pointer-events: none;
    opacity: .8;
}

.site-page .page-shell::after {
    content: '';
    position: absolute;
    inset: 60px 0 auto auto;
    width: min(420px, 44vw);
    height: 320px;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 10%, transparent) 0%, transparent 68%);
    pointer-events: none;
    opacity: .6;
}

.hero {
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
}

.form-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.auth-page .page-shell {
    min-height: calc(100vh - 180px);
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(320px, .95fr);
    gap: 26px;
    align-items: stretch;
}

.auth-layout-wide {
    grid-template-columns: minmax(280px, .9fr) minmax(420px, 1.1fr);
}

.auth-showcase {
    padding: 34px;
    border-radius: 28px;
    min-height: 560px;
    border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
    background: linear-gradient(140deg, color-mix(in srgb, var(--primary) 16%, var(--surface)) 0%, color-mix(in srgb, var(--accent) 12%, var(--surface-2)) 100%);
    overflow: hidden;
    box-shadow: 0 28px 60px rgba(55, 28, 20, .14);
    position: relative;
}

.auth-showcase-minimal {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-showcase-minimal .auth-tagline {
    max-width: 28rem;
}

.auth-activation-card {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
    background: color-mix(in srgb, var(--accent-light) 35%, var(--surface));
}

.auth-activation-card strong {
    font-size: 1rem;
    color: var(--primary);
}

.auth-activation-card p {
    margin: 0;
    color: var(--text);
}

.auth-activation-link-wrap {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.auth-activation-link {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
}

.profile-dashboard {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.profile-sidebar {
    position: sticky;
    top: 102px;
    display: grid;
    gap: 18px;
}

.profile-sidebar-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-summary-grid {
    display: grid;
    gap: 10px;
}

.profile-summary-item {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-2) 78%, transparent);
    border: 1px solid var(--line);
}

.profile-summary-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.profile-quick-actions {
    display: grid;
    gap: 8px;
}

.profile-main {
    min-width: 0;
}

.profile-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.profile-panel {
    display: grid;
    gap: 12px;
    height: fit-content;
}

.profile-panel-wide {
    grid-column: 1 / -1;
}

.profile-panel-head {
    display: grid;
    gap: 4px;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-2) 78%, transparent);
    border: 1px solid var(--line);
}

.switch-row input {
    width: auto;
    margin: 0;
}

.profile-preview-empty {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--surface-2) 68%, transparent);
}

.profile-draft-list {
    display: grid;
    gap: 8px;
}

.profile-draft-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.profile-draft-item:last-child {
    border-bottom: none;
}

.auth-showcase::before,
.auth-showcase::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.auth-showcase::before {
    width: 280px;
    height: 280px;
    right: -60px;
    top: -40px;
    background: color-mix(in srgb, var(--accent-light) 95%, transparent);
}

.auth-showcase::after {
    width: 220px;
    height: 220px;
    left: -50px;
    bottom: -70px;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    color: var(--text-muted);
    margin-bottom: 18px;
}

.auth-showcase h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 5vw, 3.4rem);
    margin-bottom: 16px;
}

.auth-tagline {
    font-size: 1.05rem;
    color: color-mix(in srgb, var(--text) 85%, var(--text-muted));
    font-style: normal;
}

.auth-feature-list {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 74%, transparent);
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.auth-feature i {
    margin-top: 3px;
    color: var(--accent);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    width: 100%;
    max-width: 440px;
}

.auth-box-wide {
    max-width: 620px;
}

.auth-card {
    padding: 24px;
    border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: 0 26px 48px rgba(34, 22, 17, .14);
}

.auth-card-head {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}

.auth-inline-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.auth-footnote {
    margin: 4px 0 0;
}

.w-100 {
    width: 100%;
}

.flash-fallback {
    box-shadow: var(--shadow-card);
}

.footer {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 88%, transparent), var(--surface-2));
}

@media (max-width: 900px) {
    .profile-dashboard {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
    }

    .profile-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar-shell {
        min-height: 64px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px 14px;
        align-items: center;
    }

    .topbar {
        padding: 0;
    }

    .brand {
        max-width: 100%;
        overflow: hidden;
    }

    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 999px;
        border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
        background: color-mix(in srgb, var(--surface) 90%, transparent);
        justify-self: end;
        align-self: center;
        flex-shrink: 0;
        position: fixed;
        top: 11px;
        right: 14px;
    }

    .hamburger span {
        position: absolute;
        width: 18px;
        transform-origin: center;
    }

    .hamburger[aria-expanded="true"] span:nth-child(1) {
        transform: rotate(45deg);
    }

    .hamburger[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .hamburger[aria-expanded="true"] span:nth-child(3) {
        transform: rotate(-45deg);
    }

    .auth-layout,
    .auth-layout-wide {
        grid-template-columns: 1fr;
    }

    .auth-showcase {
        min-height: auto;
    }
}

@media (min-width: 901px) {
    #mobile-nav,
    .mobile-nav-backdrop {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .profile-sidebar-top,
    .profile-draft-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand-copy,
    .nav-user-chip {
        display: none;
    }

    .brand-mark-logo {
        width: clamp(170px, 48vw, 220px);
        height: 42px;
        padding: 0;
    }

    #mobile-nav a {
        padding: 12px 14px;
        border-radius: 14px;
        font-size: 1rem;
        font-weight: 500;
        background: color-mix(in srgb, var(--surface) 86%, transparent);
        border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    }

    .auth-showcase,
    .auth-card {
        padding: 20px;
        border-radius: 22px;
    }

    .form-split {
        grid-template-columns: 1fr;
    }

    .auth-inline-links {
        flex-direction: column;
    }
}

@media (min-width: 901px) {
    .hamburger {
        display: none !important;
    }
}
