/* ============================================================
   Timbrica — Forum V2
   Bank-grade overrides over profile.css. Loaded AFTER profile.css
   on forum routes so .pf-* tokens get neutralised, replaced with
   .fr-* tokens that read as serious / financial / editorial.

   Design choices:
   • No aurora background — solid neutral surface, no playful glow.
   • Fluid container clamp(320px, 95vw, 1180px) — adapts to device.
   • Borders + flat surfaces over gradients — bank UI grammar.
   • Indigo accent (#4f46e5) for action; everything else neutral
     slate/zinc to avoid visual noise.
   • Body text 15.5px/1.62 — long-form readability over density.
   ============================================================ */

:root {
    --fr-bg-deep: #f6f7fa;
    --fr-card-bg: #ffffff;
    --fr-card-edge: #e5e9f0;
    --fr-card-edge-hover: #cbd5e1;
    --fr-text-primary: #0f172a;
    --fr-text-secondary: #475569;
    --fr-text-muted: #64748b;
    --fr-accent: #4f46e5;
    --fr-accent-hover: #4338ca;
    --fr-accent-soft: #eef2ff;
    --fr-warn-bg: #fef9c3;
    --fr-warn-edge: #facc15;
    --fr-danger-bg: #fee2e2;
    --fr-danger-edge: #f87171;
    --fr-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --fr-shadow-md: 0 4px 12px -4px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

[data-theme="dark"] {
    --fr-bg-deep: #0a0e1a;
    --fr-card-bg: #111827;
    --fr-card-edge: #1f2937;
    --fr-card-edge-hover: #334155;
    --fr-text-primary: #f1f5f9;
    --fr-text-secondary: #cbd5e1;
    --fr-text-muted: #94a3b8;
    --fr-accent: #818cf8;
    --fr-accent-hover: #a5b4fc;
    --fr-accent-soft: rgba(99, 102, 241, .12);
    --fr-warn-bg: rgba(234, 179, 8, .15);
    --fr-warn-edge: #ca8a04;
    --fr-danger-bg: rgba(239, 68, 68, .15);
    --fr-danger-edge: #b91c1c;
    --fr-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --fr-shadow-md: 0 4px 12px -4px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .3);
}

/* Forum body: kill the aurora playfulness, neutral surface */
body.fr-page { background: var(--fr-bg-deep) !important; }
body.fr-page .pf-aurora,
body.fr-page .pf-cursor-glow { display: none !important; }
body.fr-page .pf-shell-active { background: var(--fr-bg-deep) !important; }

/* Container: fluid, capped at 1180px so long lines stay readable */
.fr-shell {
    position: relative;
    z-index: 1;
    width: clamp(320px, 95vw, 1180px);
    margin: 28px auto 80px;
    padding: 0 16px;
}
@media (min-width: 768px) { .fr-shell { padding: 0 24px; } }

/* Card primitive — flat, bordered, no gradients */
.fr-card {
    background: var(--fr-card-bg);
    border: 1px solid var(--fr-card-edge);
    border-radius: 14px;
    padding: 24px 28px;
    box-shadow: var(--fr-shadow-sm);
    margin-bottom: 18px;
}
.fr-card--elevated { box-shadow: var(--fr-shadow-md); }

/* Hero — serif headline, bank-editorial */
.fr-hero {
    padding: 36px 36px 32px;
}
.fr-hero__eyebrow {
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--fr-text-muted);
    margin-bottom: 12px;
    display: block;
}
.fr-hero__title {
    font-family: var(--pf-display-font, 'Fraunces', Georgia, serif);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
    color: var(--fr-text-primary);
    margin: 0;
}
.fr-hero__lead {
    font-size: 15.5px;
    color: var(--fr-text-secondary);
    line-height: 1.62;
    margin: 14px 0 0;
    max-width: 65ch;
}

/* Forum rules card — visible on every forum page, sets expectations */
.fr-rules {
    border-left: 3px solid var(--fr-warn-edge);
    background: var(--fr-card-bg);
    padding: 16px 20px 16px 22px;
}
.fr-rules__title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--fr-text-primary);
    margin: 0 0 8px;
    text-transform: uppercase;
}
.fr-rules__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.fr-rules__list li {
    font-size: 13.5px;
    color: var(--fr-text-secondary);
    line-height: 1.55;
    padding-left: 22px;
    position: relative;
}
.fr-rules__list li::before {
    content: "✕";
    position: absolute;
    left: 4px;
    top: 0;
    color: var(--fr-warn-edge);
    font-weight: 700;
    font-size: 12px;
}

/* Search row */
.fr-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.fr-search__input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--fr-card-bg);
    border: 1px solid var(--fr-card-edge);
    color: var(--fr-text-primary);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s;
}
.fr-search__input:focus {
    outline: none;
    border-color: var(--fr-accent);
    box-shadow: 0 0 0 3px var(--fr-accent-soft);
}
.fr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--fr-card-edge);
    background: var(--fr-card-bg);
    color: var(--fr-text-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.fr-btn:hover { border-color: var(--fr-card-edge-hover); }
.fr-btn--primary {
    background: var(--fr-accent);
    color: white;
    border-color: var(--fr-accent);
}
.fr-btn--primary:hover { background: var(--fr-accent-hover); border-color: var(--fr-accent-hover); }
.fr-btn--sm { padding: 7px 12px; font-size: 13px; }

/* Category rows */
.fr-cat-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.fr-cat-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid var(--fr-card-edge);
    border-radius: 0;
    background: var(--fr-card-bg);
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, background .15s;
    margin-top: -1px;  /* collapse adjacent borders */
}
.fr-cat-row:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.fr-cat-row:last-child  { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.fr-cat-row:hover { background: var(--fr-accent-soft); border-color: var(--fr-card-edge-hover); position: relative; z-index: 1; }
.fr-cat-row__icon {
    font-size: 30px;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--fr-bg-deep);
    border: 1px solid var(--fr-card-edge);
}
.fr-cat-row__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--fr-text-primary);
    margin: 0 0 3px;
}
.fr-cat-row__desc {
    font-size: 13.5px;
    color: var(--fr-text-secondary);
    line-height: 1.5;
    margin: 0;
}
.fr-cat-row__count {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}
.fr-cat-row__count-num {
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 18px;
    font-weight: 600;
    color: var(--fr-text-primary);
    line-height: 1;
}
.fr-cat-row__count-lbl {
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 10.5px;
    color: var(--fr-text-muted);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Thread list (category page) */
.fr-thread-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    border: 1px solid var(--fr-card-edge);
    background: var(--fr-card-bg);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
    margin-top: -1px;
}
.fr-thread-row:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.fr-thread-row:last-child  { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.fr-thread-row:hover { background: var(--fr-bg-deep); position: relative; z-index: 1; }
.fr-thread-row__title {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--fr-text-primary);
    margin: 0 0 4px;
    line-height: 1.4;
}
.fr-thread-row__meta {
    font-size: 12.5px;
    color: var(--fr-text-muted);
}
.fr-thread-row__pin { color: var(--fr-warn-edge); font-size: 14px; }
.fr-thread-row__lock { color: var(--fr-text-muted); font-size: 14px; }
.fr-thread-row__counts {
    text-align: right;
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 12.5px;
    color: var(--fr-text-muted);
    letter-spacing: .04em;
}

/* Post (single message in a thread) */
.fr-post {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 24px;
    padding: 24px 28px;
    background: var(--fr-card-bg);
    border: 1px solid var(--fr-card-edge);
    border-radius: 12px;
    margin-bottom: 12px;
}
.fr-post--first { border-left: 3px solid var(--fr-accent); }
.fr-post__author {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}
.fr-post__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--fr-bg-deep);
    border: 1px solid var(--fr-card-edge);
    display: grid;
    place-items: center;
    font-size: 24px;
}
.fr-post__avatar img { width: 100%; height: 100%; object-fit: cover; }
.fr-post__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--fr-text-primary);
    text-decoration: none;
    line-height: 1.3;
}
.fr-post__level {
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 10.5px;
    color: var(--fr-text-muted);
    letter-spacing: .06em;
}
.fr-post__meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 11.5px;
    color: var(--fr-text-muted);
    letter-spacing: .03em;
    margin-bottom: 12px;
}
.fr-post__meta a { color: var(--fr-accent); text-decoration: none; font-weight: 500; }
.fr-post__meta a:hover { text-decoration: underline; }
.fr-post__body {
    font-size: 15px;
    color: var(--fr-text-primary);
    line-height: 1.65;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Mod toolbar (admin only) */
.fr-mod {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--fr-warn-bg);
    border: 1px solid var(--fr-warn-edge);
    border-radius: 10px;
    margin-bottom: 18px;
}
.fr-mod__label {
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--fr-text-primary);
    align-self: center;
    margin-right: auto;
}

/* Form fields */
.fr-field { margin-bottom: 16px; }
.fr-field__label {
    display: block;
    font-family: var(--pf-mono-font, ui-monospace, monospace);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--fr-text-muted);
    margin-bottom: 8px;
}
.fr-field__input,
.fr-field__textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--fr-card-bg);
    border: 1px solid var(--fr-card-edge);
    color: var(--fr-text-primary);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s;
}
.fr-field__input:focus,
.fr-field__textarea:focus {
    outline: none;
    border-color: var(--fr-accent);
    box-shadow: 0 0 0 3px var(--fr-accent-soft);
}
.fr-field__textarea { line-height: 1.55; resize: vertical; min-height: 180px; }
.fr-field__hint {
    font-size: 11.5px;
    color: var(--fr-text-muted);
    margin-top: 6px;
    line-height: 1.5;
}
.fr-field__error {
    font-size: 13px;
    color: #dc2626;
    margin-top: 6px;
}

/* Notice cards (verify-required, errors) */
.fr-notice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px 22px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.fr-notice--warn {
    background: var(--fr-warn-bg);
    border: 1px solid var(--fr-warn-edge);
}
.fr-notice__icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.fr-notice__title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--fr-text-primary);
    margin: 0 0 6px;
}
.fr-notice__desc {
    font-size: 13.5px;
    color: var(--fr-text-secondary);
    line-height: 1.55;
    margin: 0 0 12px;
}

/* Pagination tweaks */
.fr-shell .pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    justify-content: center;
}
.fr-shell .pagination li a,
.fr-shell .pagination li span {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--fr-card-edge);
    background: var(--fr-card-bg);
    color: var(--fr-text-primary);
    font-size: 13.5px;
    text-decoration: none;
    min-width: 36px;
    text-align: center;
}
.fr-shell .pagination li.active span {
    background: var(--fr-accent);
    border-color: var(--fr-accent);
    color: white;
}
