/* ============================================================
   FANFIC SITE THEME — Design System
   Light / Dark via data-theme="dark" on <html>
   ============================================================ */

/* ---- Variables ---- */
:root {
    --accent: #c71585;
    --accent-soft: rgba(199, 21, 133, .12);
    --accent-hover: rgba(199, 21, 133, .2);
    --green: #4caf50;
    --red: #e53935;

    --bg: #f5f4ff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border: #e0dcf8;
    --border-soft: #ede9ff;
    --text: #1a1532;
    --text-muted: #7c728e;
    --text-light: #b0a8c8;
    --shadow: 0 2px 12px rgba(80, 60, 140, .08);
    --shadow-lg: 0 8px 32px rgba(80, 60, 140, .14);
    --radius: 10px;
    --radius-sm: 6px;
    --header-h: 60px;
}

[data-theme="dark"] {
    --bg: #0f0e1a;
    --bg-card: #1a1830;
    --bg-input: #201e36;
    --border: #2e2a4a;
    --border-soft: #262244;
    --text: #eae6ff;
    --text-muted: #9b93bc;
    --text-light: #5a5275;
    --shadow: 0 2px 12px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .6);
}

/* ---- Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    transition: background .2s, color .2s;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ---- Site Wrapper ---- */
.ff-site-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================================================
   HEADER
   ================================================================ */
.ff-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: background .2s, border-color .2s;
}

.ff-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.ff-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.ff-logo:hover {
    text-decoration: none;
}

.ff-logo__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--accent-soft);
    border-radius: 50%;
    font-size: 1rem;
}

.ff-logo__icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent);
}

.ff-logo__text {
    font-family: Georgia, serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .01em;
}

/* Nav */
.ff-nav {
    flex: 1;
}

.ff-nav ul.pages {
    display: flex;
    align-items: center;
    gap: 7px;
    list-style: none;
}

.ff-nav ul.pages li a {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.ff-nav ul.pages li a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.ff-nav ul.pages li.selected a {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(199, 21, 133, .25);
}

/* Theme toggle */
.ff-theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}

.ff-theme-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.ff-theme-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ================================================================
   MAIN
   ================================================================ */
.ff-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Regular page content */
.ff-content-wrap {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 36px 20px 60px;
}

/* Welcome block (empty site) */
.welcome {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.welcome h1 {
    font-family: Georgia, serif;
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 12px;
}

/* ================================================================
   AUTH PAGES — centered card layout
   ================================================================ */

/* Self-centers via margin: auto in the flex-column ff-main */
.ff-auth-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 40px 16px;
}

/* Decorative background blob (progressive enhancement) */
.ff-auth-wrap::before {
    content: '';
    position: fixed;
    top: -20%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(199, 21, 133, .1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

/* Auth card */
.ff-auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px 36px;
    position: relative;
}

.ff-auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 0 0 3px 3px;
}

/* Brand in auth card */
.ff-auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.ff-auth-brand__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--accent-soft);
    border-radius: 50%;
    margin-bottom: 12px;
}

.ff-auth-brand__icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--accent);
}

.ff-auth-brand__name {
    display: block;
    font-family: Georgia, serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}

.ff-auth-brand__sub {
    font-size: .8rem;
    color: var(--text-muted);
}

.ff-auth-divider {
    border: none;
    border-top: 1px solid var(--border-soft);
    margin: 0 0 24px;
}

/* Override Webasyst auth form inputs */
.ff-auth-card input[type=text],
.ff-auth-card input[type=email],
.ff-auth-card input[type=password] {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    background: var(--bg-input);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .95rem !important;
    transition: border-color .15s, box-shadow .15s;
    margin-bottom: 14px;
}

.ff-auth-card input[type=text]:focus,
.ff-auth-card input[type=email]:focus,
.ff-auth-card input[type=password]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.ff-auth-card input[type=submit],
.ff-auth-card button[type=submit] {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(199, 21, 133, .3);
    transition: background .15s, box-shadow .15s;
    margin-top: 4px;
}

.ff-auth-card input[type=submit]:hover,
.ff-auth-card button[type=submit]:hover {
    background: #a8126d;
    box-shadow: 0 4px 14px rgba(199, 21, 133, .4);
}

.ff-auth-card label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ff-auth-card a {
    color: var(--accent);
    font-size: .85rem;
}

.ff-auth-card .error,
.ff-auth-card .wa-error {
    background: rgba(229, 57, 53, .08);
    border: 1px solid rgba(229, 57, 53, .28);
    border-radius: var(--radius-sm);
    color: var(--red);
    padding: 10px 14px;
    font-size: .88rem;
    margin-bottom: 14px;
}

.ff-auth-card .wa-auth-form .wa-field.wa-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.ff-auth-card .wa-auth-form .wa-field.wa-check label {
    text-transform: none;
    font-size: .85rem;
    font-weight: 400;
    margin: 0;
}

/* Auth footer link */
.ff-auth-footer {
    margin-top: 16px;
    text-align: center;
    font-size: .8rem;
    color: var(--text-light);
}

/* ================================================================
   PAGE CONTENT
   ================================================================ */
article.content {
    padding: 0;
}

#page {
    line-height: 1.75;
}

#page h1, #page h2, #page h3 {
    font-family: Georgia, serif;
    color: var(--text);
    margin-bottom: .75rem;
    margin-top: 1.5rem;
    line-height: 1.3;
}

#page h1 {
    font-size: 2rem;
    margin-top: 0;
}

#page h2 {
    font-size: 1.4rem;
}

#page h3 {
    font-size: 1.1rem;
}

#page p {
    margin-bottom: 1rem;
    color: var(--text);
}

#page ul, #page ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

#page li {
    margin-bottom: .25rem;
}

#page blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 1rem 0;
    color: var(--text-muted);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--text-muted);
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.chevron.right::after {
    content: '›';
    margin-left: 4px;
}

.sub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 20px;
}

.sub-links a.button {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--text-muted);
    background: var(--bg-card);
    transition: all .15s;
    text-decoration: none;
}

.sub-links a.button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ================================================================
   MY PROFILE
   ================================================================ */
.ff-content-wrap h1:first-child {
    font-family: Georgia, serif;
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--text);
}

.wa-form {
    max-width: 600px;
}

.wa-form .wa-field {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    align-items: baseline;
    flex-wrap: wrap;
}

.wa-form .wa-field .wa-name {
    width: 160px;
    flex-shrink: 0;
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.wa-form .wa-field .wa-value {
    flex: 1;
    color: var(--text);
    font-size: .9rem;
}

.wa-form input[type=text],
.wa-form input[type=email],
.wa-form input[type=password],
.wa-form select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .9rem;
    transition: border-color .15s;
}

.wa-form input:focus, .wa-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.button {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    margin-right: 8px;
    margin-top: 12px;
}

.button:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.button.gray {
    color: var(--text-muted);
}

/* ================================================================
   ERROR PAGE
   ================================================================ */
.ff-error-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.ff-error-code {
    font-family: Georgia, serif;
    font-size: 6rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 12px;
    opacity: .4;
}

.ff-error-msg {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.ff-error-back {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .9rem;
    box-shadow: 0 2px 8px rgba(199, 21, 133, .3);
    transition: background .15s;
    text-decoration: none;
}

.ff-error-back:hover {
    background: #a8126d;
    text-decoration: none;
}

/* ================================================================
   FOOTER
   ================================================================ */
.ff-footer {
    border-top: 1px solid var(--border-soft);
    padding: 20px;
    text-align: center;
}

.copyright {
    font-size: .78rem;
    color: var(--text-light);
}

.copyright a {
    color: var(--text-muted);
}

.copyright a:hover {
    color: var(--accent);
}

#ff-site-nav .button {
    font-size: .85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    margin: 0;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 640px) {
    .ff-logo__text {
        font-size: 1rem;
    }

    .ff-nav ul.pages li a {
        padding: 5px 10px;
        font-size: .82rem;
    }

    .ff-auth-card {
        padding: 28px 20px 24px;
    }

    .ff-content-wrap {
        padding: 24px 16px 48px;
    }
}
