/* mekct.ru — shared chrome (header/footer/nav/auth/vars). Page-specific CSS lives
   inline per page in {% block head_extra %}. Phase 1 (2026-06-17). */

:root {
    --bg: #ffffff; --bg-sec: #f5f5f7; --bg-tertiary: #e8e8ed;
    --text: #1d1d1f; --text-sec: #6e6e73; --text-muted: #aeaeb2;
    --accent: #007aff; --accent-l: rgba(0,122,255,0.06);
    --border: rgba(0,0,0,0.08); --max-w: 640px; --max-wide: 1100px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-sec); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* header */
.header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.header-inner { max-width: var(--max-wide); margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
@media (max-width: 900px) { .header-inner { padding: 0 16px; height: 50px; } }
.h-left { display: flex; align-items: center; gap: 12px; }
.menu-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-sec); position: relative; }
.menu-btn:hover { background: var(--bg-sec); }
.menu-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.dropdown { position: absolute; top: calc(100% + 8px); left: 0; width: 220px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); padding: 8px; display: none; z-index: 200; }
.dropdown.open { display: block; animation: dropIn 0.15s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-sec); transition: all 0.15s; }
.dd-item:hover { background: var(--bg-sec); color: var(--text); }
.dd-item i { width: 16px; text-align: center; font-size: 14px; }

/* logo */
.logo { font-family: 'Space Grotesk', sans-serif; font-size: 21px; font-weight: 700; letter-spacing: -0.8px; color: var(--text); display: inline-flex; align-items: baseline; gap: 1px; }
.logo-dots { display: inline-flex; align-items: flex-end; gap: 3px; margin-left: 1px; vertical-align: baseline; height: 0.6em; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text); animation: dot-jump 1.5s ease-in-out infinite both; }
.dot:nth-child(1) { animation-delay: 0s; } .dot:nth-child(2) { animation-delay: 0.2s; } .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-jump { 0%,80%,100% { transform: translateY(0) scale(0.7); opacity: 0.3; } 40% { transform: translateY(-5px) scale(1.1); opacity: 1; } }

/* nav */
.h-nav { display: flex; gap: 20px; align-items: center; }
@media (max-width: 900px) { .h-nav { display: none; } }
.h-nav a { font-size: 14px; font-weight: 500; color: var(--text-sec); transition: color 0.2s; }
.h-nav a:hover { color: var(--text); }
.h-nav a.active { color: var(--text); }
.h-right { display: flex; align-items: center; gap: 10px; }
.login-btn { padding: 8px 18px; border-radius: 100px; font-size: 13px; font-weight: 600; background: var(--accent); color: white; transition: background 0.2s; }
.login-btn:hover { background: #0066d6; }

/* content base (pages may override max-width/margin in head_extra) */
.content { width: 100%; flex: 1; }
/* simple-page container (recent / my / 404 / edit / stats) */
.page { max-width: 760px; margin: 0 auto; padding: 24px 20px; width: 100%; }
@media (max-width: 600px) { .page { padding: 16px; } }

/* footer */
.footer { padding: 24px 32px; border-top: 1px solid var(--border); background: var(--bg); }
@media (max-width: 900px) { .footer { padding: 20px 16px; } }
.footer-inner { max-width: var(--max-wide); margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer a { font-size: 12px; color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* auth overlay (included on every page via base) */
.auth-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); z-index: 10001; display: none; backdrop-filter: blur(2px); }

::-webkit-scrollbar { width: 0; }

/* ===== comments (TG-style) ===== */
.cmt-wrap { max-width: var(--max-w); margin: 8px auto 48px; padding: 0 16px; }
.cmt-title { font-size: 16px; font-weight: 700; margin: 18px 0 12px; }
.cmt-title span { color: var(--text-muted); font-weight: 400; }
.cmt-list { display: flex; flex-direction: column; gap: 10px; }
.cmt { display: flex; gap: 8px; max-width: 88%; }
.cmt.mine { margin-left: auto; flex-direction: row-reverse; }
.cmt-av { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg,#6366f1,#4f46e5); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden; }
.cmt-av img { width: 100%; height: 100%; object-fit: cover; }
.cmt-body { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.cmt.mine .cmt-body { background: var(--accent-l); border-color: rgba(0,122,255,0.15); }
.cmt-name { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.cmt-text { font-size: 14px; line-height: 1.5; color: var(--text); word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; }
.cmt-meta { display: flex; align-items: center; gap: 14px; margin-top: 5px; font-size: 11px; color: var(--text-muted); }
.cmt-meta button { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 3px; padding: 0; }
.cmt-meta button.liked { color: #e0245e; }
.cmt-replies { margin-top: 10px; padding-left: 22px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cmt-form { display: flex; gap: 8px; align-items: center; margin-top: 16px; position: sticky; bottom: 0; background: var(--bg-sec); padding: 10px 0; }
.cmt-input { flex: 1; padding: 11px 15px; background: var(--bg); border: 1px solid var(--border); border-radius: 22px; font-size: 15px; font-family: inherit; outline: none; }
.cmt-input:focus { border-color: var(--accent); }
.cmt-send { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmt-send:hover { background: #0066d6; }
.cmt-login { text-align: center; padding: 18px; background: var(--bg); border: 1px dashed var(--border); border-radius: 12px; color: var(--text-sec); font-size: 14px; margin-top: 12px; }
.cmt-login button { color: var(--accent); font-weight: 600; }
.cmt-empty { text-align: center; color: var(--text-muted); padding: 22px; font-size: 14px; }
.cmt-reply-form { display: flex; gap: 6px; margin-top: 8px; }
.cmt-reply-form input { flex: 1; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; font-size: 14px; font-family: inherit; outline: none; }
/* Telegram-style reply quote inside a comment bubble */
.cmt-quote { display: block; border-left: 3px solid var(--accent); background: rgba(0,122,255,0.07); border-radius: 0 8px 8px 0; padding: 4px 8px; margin: 0 0 6px; cursor: pointer; }
.cmt-quote-name { display: block; font-size: 12px; font-weight: 700; color: var(--accent); }
.cmt-quote-text { display: block; font-size: 12px; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-more-btn { display: block; width: 100%; margin: 12px 0 4px; padding: 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.cmt-more-btn:hover { background: var(--bg-sec); }
.cmt-hl { border-radius: 14px; animation: cmtHl 1.6s ease; }
@keyframes cmtHl { 0%, 100% { background: transparent; } 25% { background: var(--accent-l); } }

/* ===== like button (shared: post page + channel feed) ===== */
.like-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sec); cursor: pointer; padding: 4px 10px; border-radius: 100px; transition: all 0.15s; background: none; border: none; font-family: inherit; }
.like-btn:hover { background: var(--bg-sec); }
.like-btn.liked { color: #e0245e; }
.like-btn i { font-size: 14px; }
.ch-last { font-size: 12px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== channel modal ===== */
.chm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10050; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.chm-overlay.open { display: flex; animation: dropIn 0.18s ease-out; }
.chm-card { background: var(--bg); border-radius: 20px; max-width: 380px; width: 100%; padding: 28px 24px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,0.25); }
.chm-av { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 14px; background: linear-gradient(135deg,#6366f1,#4f46e5); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 36px; overflow: hidden; }
.chm-av img { width: 100%; height: 100%; object-fit: cover; }
.chm-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.chm-subs { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.chm-desc { font-size: 14px; line-height: 1.6; color: var(--text-sec); margin-bottom: 20px; white-space: pre-wrap; word-wrap: break-word; max-height: 220px; overflow-y: auto; }
.chm-actions { display: flex; gap: 8px; }
.chm-actions a, .chm-actions button { flex: 1; padding: 11px; border-radius: 100px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chm-open { background: var(--accent); color: #fff; }
.chm-sub { background: var(--accent-l); color: var(--accent); border: none; }
.chm-sub.subscribed { background: var(--bg-sec); color: var(--text-sec); }
.chm-close { position: absolute; top: 16px; right: 20px; font-size: 22px; color: #fff; cursor: pointer; }
