/* ===== Шрифты: Inter, лежат на нашем сервере (без Google Fonts) ===== */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url(/assets/fonts/Inter-Regular.woff) format("woff"); }
@font-face { font-family: "Inter"; font-weight: 400; font-style: italic; font-display: swap; src: url(/assets/fonts/Inter-Italic.woff) format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url(/assets/fonts/Inter-SemiBold.woff) format("woff"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url(/assets/fonts/Inter-Bold.woff) format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 800; font-style: normal; font-display: swap; src: url(/assets/fonts/InterDisplay-ExtraBold.woff) format("woff"); }

:root {
  --bg: #ffffff;
  --fg: #0c0c0d;
  --muted: #74747a;
  --line: #ebebed;
  --card: #f3f3f5;
  --accent: #ff4f00;
  --radius: 18px;
  --wrap: 1240px;
  --narrow: 720px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Inter Display", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e10; --fg: #f3f3f4; --muted: #96969e; --line: #232328; --card: #18181c; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 17px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; width: 100%; }
.wrap-narrow { max-width: calc(var(--narrow) + 48px); margin: 0 auto; padding: 0 24px; width: 100%; }
.muted { color: var(--muted); }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-ghost { background: var(--card); color: var(--fg); }
.btn-ghost:hover { opacity: 1; background: var(--line); }
.btn-tg { background: #2aabee; color: #fff; }
.btn-danger { color: #e5372b; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); transition: background .15s;
}
.icon-btn:hover { background: var(--line); }

/* ===== Шапка ===== */
.hdr {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.hdr-in { display: flex; align-items: center; gap: 32px; height: 64px; }
.logo { font: 800 26px/1 var(--display); letter-spacing: -0.035em; white-space: nowrap; }
.logo-dot { color: var(--accent); }
.logo-sm { font-size: 22px; }
.nav { display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { font-weight: 600; font-size: 15px; color: var(--muted); white-space: nowrap; padding: 6px 0; transition: color .15s; }
.nav a:hover, .nav a.on { color: var(--fg); }
.hdr-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
@media (max-width: 720px) {
  .wrap, .wrap-narrow { padding: 0 18px; }
  .hdr-in { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 0 16px; }
  .hdr-in .logo { flex: 1; height: 40px; display: flex; align-items: center; }
  .nav { order: 3; flex-basis: 100%; gap: 20px; padding: 4px 0 8px; }
  .nav:empty { display: none; }
  .hdr-in:has(.nav:empty) { padding-bottom: 12px; }
  .hdr .btn-sm span { display: none; }
  .hdr .btn-sm { width: 40px; height: 40px; padding: 0; }
}

/* ===== Метаданные ===== */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); font-weight: 500; }
.tag { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.badge { background: var(--card); color: var(--fg); padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-plan { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* ===== Большая карточка сверху ===== */
.hero {
  position: relative; display: block; margin: 28px 0 0; border-radius: 28px; overflow: hidden;
  background: #111; isolation: isolate; color: #fff;
}
.hero-media { aspect-ratio: 2.1 / 1; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.hero:hover .hero-media img { transform: scale(1.025); }
.hero-body {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 120px 44px 40px;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.5) 45%, transparent 100%);
}
.hero .meta { color: rgba(255,255,255,.8); }
.hero .tag { background: var(--accent); color: #fff; padding: 5px 9px; border-radius: 7px; }
.hero-title {
  font: 800 clamp(30px, 4.4vw, 58px)/1.02 var(--display); letter-spacing: -0.03em;
  margin: 14px 0 0; max-width: 960px; text-wrap: balance;
}
.hero-excerpt {
  margin: 14px 0 0; max-width: 720px; font-size: 18px; line-height: 1.45; color: rgba(255,255,255,.85);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-text { background: var(--card); color: var(--fg); }
.hero-text .hero-body { position: static; background: none; padding: 56px 44px; }
.hero-text .meta { color: var(--muted); }
.hero-text .hero-excerpt { color: var(--muted); -webkit-line-clamp: 3; }
@media (max-width: 720px) {
  .hero { margin: 14px -18px 0; border-radius: 0; }
  .hero-media { aspect-ratio: 4 / 5; }
  .hero-body { padding: 120px 20px 26px; }
  .hero-text .hero-body { padding: 36px 20px; }
  .hero-excerpt { font-size: 16px; }
}

/* ===== Лента ===== */
.page-h { font: 800 clamp(34px, 5vw, 56px)/1 var(--display); letter-spacing: -0.03em; margin: 36px 0 0; }
.feed-h { font: 800 30px/1 var(--display); letter-spacing: -0.025em; margin: 56px 0 24px; }
.page-h + .feed .feed-h { margin-top: 28px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 28px; }
.page-h + .feed .grid { margin-top: 28px; }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; gap: 34px; } .feed-h { margin: 40px 0 20px; font-size: 26px; } }
.card-link { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.card-media { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--card); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.card-link:hover .card-media img { transform: scale(1.04); }
.card-play {
  position: absolute; left: 14px; bottom: 14px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.card-play svg { margin-left: 2px; }
.card-body { display: flex; flex-direction: column; gap: 9px; }
.card-title { font: 700 21px/1.24 var(--font); letter-spacing: -0.018em; margin: 0; text-wrap: pretty; transition: color .15s; }
.card-link:hover .card-title { color: color-mix(in srgb, var(--fg) 70%, transparent); }
.card-excerpt {
  margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-text .card-link { background: var(--card); border-radius: var(--radius); padding: 26px; transition: background .15s; }
.card-text .card-link:hover { background: var(--line); }
.card-text .card-title { font-size: 23px; }
.card-text .card-excerpt { -webkit-line-clamp: 5; }
.more {
  display: flex; align-items: center; justify-content: center; margin: 56px auto 0; width: max-content;
  height: 48px; padding: 0 28px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 600;
  transition: background .15s, border-color .15s;
}
.more:hover { background: var(--card); border-color: var(--card); }
.more.loading { opacity: .5; pointer-events: none; }
.empty { text-align: center; padding: 120px 0; }
.empty h1 { font: 800 40px/1.1 var(--display); letter-spacing: -0.03em; margin: 0 0 12px; }
.empty p { color: var(--muted); margin: 0 0 28px; }

/* ===== Статья ===== */
.post-head { padding-top: 48px; }
.post-title {
  font: 800 clamp(34px, 5.2vw, 54px)/1.06 var(--display); letter-spacing: -0.032em;
  margin: 16px 0 0; text-wrap: balance; overflow-wrap: break-word;
}
.post-body { font-size: 19px; line-height: 1.65; padding-top: 30px; padding-bottom: 8px; overflow-wrap: break-word; }
.post-body > * { margin: 0 0 1.1em; }
.post-body h2 { font: 800 30px/1.2 var(--display); letter-spacing: -0.024em; margin: 1.7em 0 .55em; }
.post-body h3 { font: 700 23px/1.3 var(--font); letter-spacing: -0.015em; margin: 1.5em 0 .5em; }
.post-body > :first-child { margin-top: 0; }
.post-body a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.post-body a:hover { text-decoration-color: var(--accent); }
.post-body b, .post-body strong { font-weight: 700; }
.post-body blockquote {
  margin: 1.6em 0; padding: 2px 0 2px 24px; border-left: 3px solid var(--accent);
  font-size: 22px; line-height: 1.5; font-weight: 500; letter-spacing: -0.01em;
}
.post-body ul, .post-body ol { padding-left: 1.3em; }
.post-body li { margin: .35em 0; padding-left: .2em; }
.post-body li::marker { color: var(--muted); }
.post-body code { font: .86em/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--card); padding: .15em .4em; border-radius: 6px; }
.post-body hr { border: 0; height: auto; margin: 2.4em 0; text-align: center; overflow: visible; }
.post-body hr::after { content: "• • •"; letter-spacing: .7em; color: var(--muted); font-size: 18px; }
.post-body figure { margin: 2.2em -60px; }
.post-body figure img { margin: 0 auto; border-radius: 16px; background: var(--card); width: auto; max-width: 100%; height: auto; }
.post-body figure video { margin: 0 auto; border-radius: 16px; background: #000; width: 100%; height: auto; }
.post-body figure .portrait { max-height: min(82vh, 860px); width: auto; }
.post-body figure video.portrait { height: min(82vh, 860px); max-width: 100%; }
.post-body figure iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 16px; background: #000; }
.post-body figcaption { font-size: 14px; line-height: 1.45; color: var(--muted); text-align: center; margin: 12px auto 0; max-width: var(--narrow); padding: 0 24px; }
@media (max-width: 860px) {
  .post-body figure { margin: 1.8em -24px; }
  .post-body figure img, .post-body figure video, .post-body figure iframe { border-radius: 0; }
}
@media (max-width: 720px) {
  .post-head { padding-top: 30px; }
  .post-body { font-size: 18px; line-height: 1.62; }
  .post-body figure { margin: 1.6em -18px; }
  .post-body h2 { font-size: 26px; }
  .post-body blockquote { font-size: 20px; padding-left: 18px; }
}
.post-foot { padding-top: 24px; padding-bottom: 8px; }
.share { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 28px; border-top: 1px solid var(--line); }
.sub {
  display: flex; align-items: center; gap: 16px; margin-top: 28px; padding: 20px 22px; border-radius: var(--radius);
  background: color-mix(in srgb, #2aabee 10%, var(--bg)); font-size: 15px; line-height: 1.45; color: var(--muted);
}
.sub b { color: var(--fg); font-size: 16px; }
.sub-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #2aabee; color: #fff; display: grid; place-items: center; }
.related { padding-bottom: 20px; }

/* ===== Подвал ===== */
.ftr { margin-top: 96px; border-top: 1px solid var(--line); padding: 40px 0 32px; }
.ftr-in { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.ftr-text { color: var(--muted); max-width: 440px; margin: 10px 0 0; font-size: 15px; }
.ftr-links { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; font-weight: 600; font-size: 15px; }
.ftr-links a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); transition: color .15s; }
.ftr-links a:hover { color: var(--fg); }
.ftr-login { opacity: .6; }
.ftr-copy { color: var(--muted); font-size: 13px; margin-top: 28px; }

/* ===== Вход, управление, настройки ===== */
.auth, .adm { padding-top: 56px; }
.auth h1, .adm h1 { font: 800 38px/1.1 var(--display); letter-spacing: -0.03em; margin: 0 0 28px; }
.form { display: flex; flex-direction: column; gap: 18px; max-width: 520px; }
.form label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 14px; }
.form small { color: var(--muted); font-weight: 400; font-size: 13px; }
.form input, .form textarea {
  font: inherit; font-weight: 400; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--fg); outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--fg); }
.form input[type=color] { width: 72px; height: 44px; padding: 4px; }
.form .btn { align-self: flex-start; }
.form-err { color: #e5372b; margin: 0; }
.form-ok { color: #1a9a4a; font-weight: 600; }
.pw-form { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.pw-form h2 { font: 800 26px/1.15 var(--display); letter-spacing: -0.02em; margin: 0; }
.adm-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.adm-head h1 { margin: 0; }
.adm-row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.adm-title { font-weight: 700; font-size: 18px; line-height: 1.3; }
.adm-title:hover { color: var(--accent); }
.adm-actions { display: flex; gap: 8px; flex: none; }
.adm-foot { display: flex; gap: 24px; margin-top: 32px; font-weight: 600; color: var(--muted); }
.adm-foot a:hover { color: var(--fg); }
@media (max-width: 560px) { .adm-row { flex-direction: column; align-items: stretch; } .adm-actions { justify-content: flex-start; } }

/* ===== Instant View ===== */
.iv-note {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px;
  padding: 16px 18px; border-radius: 16px; border: 1.5px dashed var(--line); font-size: 14px; line-height: 1.45; color: var(--muted);
}
.iv-note b { color: var(--fg); }
.iv-note .btn { flex: none; }
.iv-setup { margin-top: 18px; padding-top: 26px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.iv-setup h2 { font: 800 26px/1.15 var(--display); letter-spacing: -0.02em; margin: 0; }
.iv-setup p { margin: 0; font-size: 15px; line-height: 1.5; }
.iv-setup ol { margin: 0; padding-left: 1.3em; font-size: 15px; line-height: 1.55; }
.iv-setup li { margin: .35em 0; }
.iv-setup a { color: var(--accent); }
.iv-setup code { font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--card); padding: 2px 6px; border-radius: 6px; }
.iv-tpl { display: flex; flex-direction: column; gap: 8px; }
.iv-tpl textarea { font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace !important; background: var(--card) !important; resize: vertical; }
.iv-tpl .btn { align-self: flex-start; }
@media (max-width: 560px) { .iv-note { flex-direction: column; align-items: flex-start; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #111; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
