/* ==========================================================
   Translitera Press — stylesheet (light & dark themes)
   ========================================================== */

:root {
    --bg: #faf8f4;
    --surface: #ffffff;
    --surface-2: #f3efe7;
    --text: #1b2230;
    --muted: #5a6373;
    --border: #e4ded2;
    --primary: #1f3a5f;
    --primary-hover: #17304f;
    --on-primary: #ffffff;
    --accent: #b4532c;
    --accent-soft: #f7e8df;
    --success-bg: #e6f4ea; --success-text: #1e5b33;
    --error-bg: #fbe9e7;   --error-text: #8a2a1c;
    --shadow: 0 1px 2px rgba(20, 28, 40, .05), 0 8px 24px rgba(20, 28, 40, .06);
    --radius: 14px;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0e131b;
    --surface: #151c27;
    --surface-2: #1b2431;
    --text: #e9e6df;
    --muted: #9aa3b2;
    --border: #283241;
    --primary: #9cbde6;
    --primary-hover: #b8d0ee;
    --on-primary: #0e131b;
    --accent: #e48f63;
    --accent-soft: #2c211b;
    --success-bg: #163222; --success-text: #9fd8b1;
    --error-bg: #3a1c17;   --error-text: #f2b3a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16.5px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3 {
    font-family: var(--serif);
    line-height: 1.2;
    margin: 0 0 .6em;
    font-weight: 600;
    letter-spacing: -.01em;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.container.narrow { width: min(480px, 100% - 40px); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }

.skip-link {
    position: absolute; left: -999px; top: 10px; z-index: 100;
    background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 10px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.eyebrow {
    font-family: var(--sans);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .8em;
}

.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 72px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 38px; height: 38px; color: var(--primary); }
.brand-dot { fill: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.brand-sub { font-size: .7rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }

.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.main-nav a {
    display: block; padding: 8px 14px; border-radius: 999px;
    color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }

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

.theme-toggle, .nav-toggle {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; display: grid; place-items: center;
    transition: transform .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: rotate(-12deg); background: var(--surface-2); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle { display: none; gap: 4px; align-content: center; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px;
    font: 600 .95rem/1 var(--sans);
    text-decoration: none; cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: #fff; color: #1f3a5f; }
.btn-light:hover { background: #f3efe7; color: #1f3a5f; }
.btn-danger { background: transparent; color: var(--error-text); border-color: color-mix(in srgb, var(--error-text) 35%, transparent); }
.btn-danger:hover { background: var(--error-bg); color: var(--error-text); }
.btn-small { padding: 7px 14px; font-size: .85rem; }

.link-arrow { font-weight: 600; text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; position: relative; overflow: hidden; }
.hero::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(600px 300px at 85% 20%, var(--accent-soft), transparent 70%),
        radial-gradient(500px 300px at 10% 100%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%);
    pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hero-art { display: flex; justify-content: center; }
.glyph-card {
    position: relative; width: min(380px, 100%); aspect-ratio: 1;
    border-radius: 28px; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 38px 38px;
    background-position: -1px -1px;
}
.glyph { position: absolute; font-family: var(--serif); line-height: 1; color: var(--primary); }
.g1 { font-size: 7.5rem; left: 14%; top: 22%; font-weight: 600; }
.g2 { font-size: 4.6rem; right: 14%; top: 10%; color: var(--accent); }
.g3 { font-size: 3.6rem; right: 18%; bottom: 14%; font-style: italic; }
.g4 { font-size: 2.8rem; left: 16%; bottom: 12%; color: var(--muted); }
.g5 { font-size: 2.6rem; right: 40%; bottom: 30%; color: var(--accent); opacity: .85; }
.g6 { font-size: 2.2rem; left: 50%; top: 8%; color: var(--muted); font-style: italic; }

/* ---------- Page hero ---------- */
.page-hero { padding: 72px 0 40px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--bg)); }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.section-head { margin-bottom: 36px; max-width: 680px; }
.section-head-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; max-width: none; }

.split { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.feature p { color: var(--muted); font-size: .95rem; margin: 0; }
.feature-icon {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.feature-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.value-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.value { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.value p { color: var(--muted); margin: 0; }
.value-num { font-family: var(--serif); font-size: 1.1rem; color: var(--accent); font-weight: 700; display: block; margin-bottom: 10px; }

/* ---------- Prose ---------- */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.4em; margin-bottom: .4em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .5em; }

/* ---------- Journal cards ---------- */
.journal-list { display: grid; gap: 24px; }
.journal-card {
    display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 20px; padding: 28px; box-shadow: var(--shadow);
    transition: transform .2s ease, border-color .2s ease;
}
.journal-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.journal-logo {
    aspect-ratio: 1; border-radius: 14px; background: #fff;
    border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; padding: 14px;
}
.journal-logo img { width: 100%; height: 100%; object-fit: contain; }
.journal-initials { font-family: var(--serif); font-weight: 700; font-size: 2.2rem; color: #1f3a5f; letter-spacing: .04em; }
.journal-title { font-size: 1.55rem; margin-bottom: .3em; }
.journal-meta { color: var(--muted); font-size: .9rem; margin-bottom: .6em; }
.journal-desc { color: var(--muted); }
.journal-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 20px; }
.tag {
    font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
}

.empty-state { padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

.note-box {
    margin-top: 28px; padding: 26px 28px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-2);
    border-left: 4px solid var(--accent);
}
.note-box p { margin: 0; color: var(--muted); }

/* ---------- Info list ---------- */
.info-list { margin: 0; display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.info-list > div { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { color: var(--muted); font-size: .9rem; }
.info-list dd { margin: 0; font-weight: 500; }

/* ---------- Policies ---------- */
.policy-layout { display: grid; grid-template-columns: 250px 1fr; gap: 56px; align-items: start; }
.policy-toc { position: sticky; top: 100px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc-title { font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.policy-toc ol { margin: 0; padding-left: 1.2em; font-size: .92rem; }
.policy-toc li { margin-bottom: 6px; }
.policy-toc a { text-decoration: none; color: var(--text); }
.policy-toc a:hover { color: var(--accent); }
.policy-body h2 { font-size: 1.55rem; padding-top: 8px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 48px; align-items: start; }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.contact-list li { display: flex; gap: 14px; align-items: flex-start; }
.contact-list svg { width: 22px; height: 22px; flex: none; margin-top: 3px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contact-list .label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.contact-list a { word-break: break-word; }

/* ---------- CTA ---------- */
.cta { padding: 0 0 80px; }
.cta-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 32px;
    padding: 44px 48px; border-radius: 24px;
    background: #1f3a5f; color: #fff;
    background-image: radial-gradient(400px 200px at 90% 0%, rgba(228, 143, 99, .35), transparent 70%);
}
[data-theme="dark"] .cta-inner { background-color: #1a2c45; }
.cta-inner h2 { color: #fff; margin-bottom: .3em; }
.cta-inner p { color: rgba(255, 255, 255, .8); margin: 0; max-width: 60ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-top: 56px; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-name { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; margin-bottom: .4em; }
.footer-heading { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: .85rem; }
.footer-bottom p { margin: 0; }

/* ---------- Forms & admin ---------- */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: .93rem; }
.form input[type="text"], .form input[type="email"], .form input[type="url"],
.form input[type="password"], .form input[type="number"], .form textarea {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
    font: inherit; font-weight: 400;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.form input[type="file"] { font: inherit; font-size: .9rem; color: var(--muted); }
.form .checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.req { color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.optional { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.optional summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.optional[open] { display: grid; gap: 14px; }
.optional[open] summary { margin-bottom: 4px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: .95rem; }
.alert ul { margin: 0; padding-left: 1.1em; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.9rem; }

.admin-bar { padding: 40px 0 28px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.admin-bar-inner { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.admin-bar h1 { font-size: 2rem; margin: 0; }
.admin-links { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-links a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 500; }
.admin-links a:hover { border-color: var(--primary); }
.admin-links .danger-link { color: var(--error-text); }

.admin-section { padding-top: 36px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.count { font-family: var(--sans); font-size: .8rem; background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 999px; }

.admin-journals { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.admin-journals li { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.aj-logo { width: 56px; height: 56px; border-radius: 10px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; padding: 4px; }
.aj-logo img { width: 100%; height: 100%; object-fit: contain; }
.aj-logo span { font: 700 .8rem var(--serif); color: #1f3a5f; }
.aj-info { min-width: 0; }
.aj-info strong { display: block; line-height: 1.3; }
.aj-url { font-size: .82rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-actions { display: flex; gap: 6px; }
.aj-actions form { margin: 0; }

.current-logo { display: flex; align-items: center; gap: 14px; }
.current-logo img { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .policy-layout { grid-template-columns: 1fr; gap: 28px; }
    .policy-toc { position: static; }
    .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .nav-toggle { display: grid; }
    .main-nav {
        position: absolute; top: 72px; left: 0; right: 0;
        background: var(--surface); border-bottom: 1px solid var(--border);
        padding: 12px 20px 20px; display: none;
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; }
    .main-nav a { padding: 12px 16px; border-radius: 10px; }
    .header-actions { margin-left: auto; }

    .hero { padding: 56px 0 48px; }
    .hero-inner, .split, .contact-grid { grid-template-columns: 1fr; gap: 32px; }
    .hero-art { order: -1; }
    .glyph-card { width: min(260px, 100%); }
    .g1 { font-size: 5rem; } .g2 { font-size: 3.2rem; } .g3 { font-size: 2.6rem; }
    .g4 { font-size: 2rem; } .g5 { font-size: 1.9rem; } .g6 { font-size: 1.6rem; }

    .journal-card { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
    .journal-logo { width: 140px; }
    .cta-inner { flex-direction: column; align-items: flex-start; padding: 32px 28px; }
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
    .section-head-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
    .feature-grid, .value-grid { grid-template-columns: 1fr; }
    .info-list > div { grid-template-columns: 1fr; gap: 2px; }
    .admin-journals li { grid-template-columns: 48px 1fr; }
    .aj-actions { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
