:root {
  --custom-bg: #0f1117;
  --custom-surface: #1b1f27;
  --custom-surface-soft: rgba(255, 255, 255, 0.03);
  --custom-border: rgba(255, 255, 255, 0.08);
  --custom-border-soft: rgba(255, 255, 255, 0.05);
  --custom-text: #c9d1d9;
  --custom-muted: #8b949e;
  --custom-muted-strong: #9aa4b2;
  --custom-accent: #4ecca3;
  --custom-accent-bright: #78ffb4;
  --custom-accent-contrast: #08111b;
}

body {
  color: var(--custom-text);
  background: var(--custom-bg);
}

p {
  color: var(--custom-text);
  font-family: "Roboto", sans-serif;
  line-height: 1.5;
  letter-spacing: 0.05em;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--custom-accent);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

a:hover,
a:focus {
  color: #1e1e1e;
  background: var(--custom-accent);
  border-bottom-color: var(--custom-accent);
}

blockquote {
  margin: 0;
  padding-left: 15px;
  color: var(--custom-text);
  font-family: "Roboto Mono", monospace;
  border-left: 3px solid #3ddc97;
}

blockquote p {
  font: inherit;
  letter-spacing: inherit;
}

hr {
  border-top: 3px dotted rgb(153, 153, 200);
}

code {
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}

img {
  border: none;
}

time {
  color: var(--custom-muted);
}

.nav-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.nav-tools {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.premium-status {
  font-family: "Roboto Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.premium-status--active {
  color: var(--custom-accent-bright);
}

.premium-status--inactive {
  color: #ff8f8f;
}

.site-search {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}

.site-search__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--custom-text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--custom-border);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.8;
  transition:
    opacity 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.site-search__toggle:hover,
.site-search__toggle:focus {
  color: var(--custom-accent-contrast);
  background: var(--custom-accent-bright);
  border-color: var(--custom-accent-bright);
  opacity: 1;
  outline: none;
}

.site-search__toggle .feather {
  width: 18px;
  height: 18px;
}

.site-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  display: none;
  width: min(380px, calc(100vw - 32px));
  padding: 8px;
  background: rgba(27, 31, 39, 0.98);
  border: 1px solid var(--custom-border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.site-search--open .site-search__panel {
  display: block;
}

.site-search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-search__input {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  min-height: 0;
  padding: 7px 10px;
  color: var(--custom-text);
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.2;
  letter-spacing: 0;
  background: #0f1117;
  border: 1px solid var(--custom-border);
  border-radius: 8px;
  outline: none;
}

.site-search__input:focus {
  border-color: rgba(120, 255, 180, 0.6);
  box-shadow: 0 0 0 3px rgba(120, 255, 180, 0.08);
}

.site-search__results {
  max-height: min(360px, calc(100vh - 170px));
  margin-top: 8px;
  overflow-y: auto;
}

.site-search__result {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  color: var(--custom-text);
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.site-search__result:hover,
.site-search__result:focus,
.site-search__result--active {
  color: var(--custom-text);
  background: rgba(120, 255, 180, 0.08);
  outline: none;
}

.site-search__result-title {
  color: var(--custom-text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.site-search__result-meta {
  color: var(--custom-accent-bright);
  font-size: 0.74rem;
  line-height: 1.2;
  opacity: 0.85;
}

.site-search__result-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--custom-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.site-search__empty {
  padding: 14px 10px 6px;
  color: var(--custom-muted);
  font-size: 0.9rem;
}

.description {
  color: var(--custom-text);
}

::-webkit-scrollbar {
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--custom-accent);
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  background: #393e46;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--custom-accent) #393e46;
}

.post-content,
.posts,
.tag-cloud,
.taxonomy-info {
  background: var(--custom-surface);
  border: 1px solid var(--custom-border-soft);
  border-radius: 20px;
}

.post-content {
  margin-top: 40px;
  padding: 0 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.posts,
.tag-cloud {
  margin-top: 20px;
  padding: 25px 30px 30px 50px;
}

.posts {
  margin-top: 0 !important;
}

.list-item {
  position: relative;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0 30px 30px;
  background: var(--custom-surface);
  border: 1px solid var(--custom-border-soft);
  border-radius: 18px;
}

.post-tags {
  margin-top: 2rem;
}

.post-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 2px 6px;
  color: #aab3c5;
  font-size: 10px;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--custom-border);
  border-radius: 5px;
}

.post-content .title h1 {
  margin-top: 20px;
  margin-bottom: 1rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
}

.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 0.4rem;
}

.post-meta-row .post-badges {
  gap: 0.5rem;
}

.post-note {
  margin-top: 4px;
  color: #888;
  font-size: 0.8rem;
}

.post-author {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--custom-border-soft);
}

.author-left,
.author-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--custom-border-soft);
}

.author-name {
  font-size: 0.9rem;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.post-author:hover .author-name {
  opacity: 1;
}

.reading-time {
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0.6;
}

.post-views {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  color: var(--custom-muted);
  font-size: 0.85rem;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.7;
}

.post-views__icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-views__count {
  font-variant-numeric: tabular-nums;
}

.subscribe-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
}

.telegram-button,
.max-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 16px;
  color: var(--custom-text) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--custom-border);
  border-radius: 10px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.max-button {
  margin-top: 5px;
}

.telegram-button:hover,
.max-button:hover {
  color: var(--custom-text) !important;
  background: rgba(255, 255, 255, 0.04);
}

.telegram-button svg,
.max-button svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.post-media img,
.post-media video {
  width: 100%;
  margin-top: 0.8rem;
  object-fit: cover;
  border-radius: 12px;
}

.post-media iframe {
  width: 100%;
  height: auto;
  padding-top: 10px;
  aspect-ratio: 16 / 9;
}

.expert-block {
  margin: 32px 0;
  padding: 24px;
  color: var(--custom-text);
  font-family: "Roboto Mono", monospace;
  background: var(--custom-surface);
  border: 1px solid var(--custom-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.expert-block p {
  font: inherit;
  letter-spacing: inherit;
}

.expert-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.expert-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.expert-meta {
  flex: 1;
}

.expert-name {
  color: var(--custom-accent-bright);
  font-size: 18px;
  font-weight: 700;
}

.expert-role {
  color: var(--custom-muted);
  font-size: 14px;
}

.expert-button {
  padding: 8px 14px;
  color: var(--custom-accent-contrast);
  font-size: 14px;
  text-decoration: none;
  background: var(--custom-accent-bright);
  border: 0;
  border-radius: 8px;
  transition: opacity 0.2s ease;
}

.expert-button:hover {
  opacity: 0.9;
}

.expert-content {
  margin-top: 16px;
  color: var(--custom-text);
  line-height: 1.6;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 30px 0;
}

.banner-grid a,
.banner-grid a:hover {
  all: unset;
  display: block;
  cursor: pointer;
}

.banner-grid img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.banner-grid a:hover img {
  opacity: 0.75;
  transform: scale(0.97);
}

.image-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.image-row img {
  width: 100%;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.image-row img:hover {
  transform: scale(1.03);
}

#modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
}

#modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
}

.related-posts {
  margin-top: 3rem;
}

.related-posts h1 {
  margin-bottom: 1.5rem;
  font-size: 2rem;
  line-height: 1.2;
}

.related-container {
  padding: 1.4rem;
  background: var(--custom-surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
}

.related-item {
  padding: 1rem 0;
}

.related-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.related-link {
  padding: 0 0.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(120, 255, 180, 0.7);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.related-link:hover {
  color: var(--custom-accent-contrast);
  background: var(--custom-accent-bright);
  border-color: var(--custom-accent-bright);
}

.related-date {
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0.65;
}

.related-description {
  margin-top: 0.65rem;
  color: var(--custom-muted-strong);
  font-size: 0.95rem;
  line-height: 1.7;
}

.tg-comments-wrapper {
  margin-top: 2rem;
}

.tg-comments-inner {
  position: relative;
  max-height: 850px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tg-comments-inner::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 120px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(8, 17, 27, 0),
    rgba(8, 17, 27, 1)
  );
}

.tg-comments-inner.expanded {
  max-height: 9999px;
}

.tg-comments-inner.expanded::after {
  display: none;
}

.tg-comments-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  color: var(--custom-text);
  font: inherit;
  font-weight: 600;
  background: var(--custom-surface-soft);
  border: 1px solid var(--custom-border);
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.tg-comments-toggle:hover {
  color: var(--custom-accent-contrast);
  background: var(--custom-accent-bright);
  border-color: var(--custom-accent-bright);
  transform: translateY(-1px);
}

.post-embed-card {
  margin: 20px 0;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--custom-border);
  border-radius: 16px;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.post-embed-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.post-embed-description {
  margin: 0 0 14px;
  line-height: 1.55;
  opacity: 0.82;
}

.post-embed-link {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.taxonomy-header {
  margin-bottom: 0;
}

.taxonomy-count {
  margin-top: 0.5rem;
  opacity: 0.7;
}

.taxonomy-description {
  margin-top: 1rem;
  line-height: 1.7;
}

.taxonomy-description ul {
  margin-top: 1rem;
}

.taxonomy-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.taxonomy-footer-content {
  line-height: 1.8;
}

.taxonomy-info {
  margin-top: 20px;
  margin-bottom: 12px;
  padding: 25px 30px 30px;
  line-height: normal;
}

.taxonomy-info p:first-child {
  margin-top: 0;
}

.taxonomy-info p:last-child {
  margin-bottom: 0;
}

.taxonomy-info ul {
  line-height: 1.6;
}

.external-link-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.15em;
  vertical-align: middle;
}

.premium-box {
  position: relative;
  margin: 40px 0;
  padding: 32px;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.15),
    rgba(59, 130, 246, 0.08)
  );
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 16px;
}

.premium-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #7c3aed;
}

.premium-box h3 {
  margin-top: 18px;
  margin-bottom: 12px;
  color: #fff;
}

.premium-box p {
  margin-bottom: 24px;
  color: #cbd5e1;
}

.premium-button {
  display: inline-block;
  padding: 12px 24px;
  color: white !important;
  font-weight: 700;
  text-decoration: none;
  background: #7c3aed;
  border-radius: 10px;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.premium-button:hover {
  background: #8b5cf6;
  transform: translateY(-2px);
}

.premium-badge {
  position: relative;
  display: inline-block;
  margin-left: 0;
  padding: 4px 12px;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  background: linear-gradient(135deg, #c9a227, #a67c00);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 4px 12px rgba(234, 179, 8, 0.15);
  cursor: help;
}

.premium-tooltip {
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  box-sizing: border-box;
  width: 280px;
  padding: 12px 14px;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
  background: #171b24;
  border: 1px solid rgba(250, 204, 21, 0.2);
  border-radius: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%);
  transition: 0.15s ease;
}

.premium-badge:hover .premium-tooltip {
  opacity: 1;
  visibility: visible;
}

.premium-note {
  margin-top: 16px;
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
}

.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 9999;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(760px, calc(100% - 40px));
  padding: 18px 22px;
  background: rgba(27, 31, 39, 0.92);
  border: 1px solid rgba(120, 255, 180, 0.15);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(120, 255, 180, 0.05),
    0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.cookie-banner__text {
  min-width: 0;
  color: var(--custom-text);
  font-size: 0.9rem;
  line-height: 1.6;
  opacity: 0.9;
  overflow-wrap: anywhere;
}

.cookie-banner__text a {
  color: var(--custom-accent-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(120, 255, 180, 0.7);
}

.cookie-banner__text a:hover {
  color: var(--custom-accent-contrast);
  background: var(--custom-accent-bright);
  border-color: var(--custom-accent-bright);
}

.cookie-banner__button {
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 12px 22px;
  color: var(--custom-accent-contrast);
  font: inherit;
  font-weight: 700;
  background: var(--custom-accent-bright);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.cookie-banner__button:hover {
  box-shadow:
    0 0 15px rgba(120, 255, 180, 0.35),
    0 0 30px rgba(120, 255, 180, 0.15);
  transform: translateY(-2px);
}

.cookie-banner__button:active {
  transform: translateY(0);
}

.spoiler-box {
  margin: 1.5rem 0;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(120, 255, 180, 0.03),
    rgba(255, 255, 255, 0.01)
  );
  border: 1px solid rgba(120, 255, 180, 0.08);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(120, 255, 180, 0.03),
    0 10px 30px rgba(0, 0, 0, 0.2);
}

.spoiler-title {
  padding: 16px 20px;
  color: var(--custom-text);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.spoiler-title:hover {
  background: var(--custom-surface-soft);
}

.spoiler-title::-webkit-details-marker {
  display: none;
}

.spoiler-title::before {
  content: ">";
  display: inline-block;
  margin-right: 10px;
  color: var(--custom-accent-bright);
  transition: transform 0.2s ease;
}

.spoiler-box[open] .spoiler-title::before {
  transform: rotate(90deg);
}

.spoiler-content {
  padding: 20px;
  font-family: "Roboto Mono", monospace;
  line-height: 1.65;
  letter-spacing: 0;
}

.spoiler-content p {
  font: inherit;
  letter-spacing: inherit;
}

.spoiler-content > *:first-child {
  margin-top: 0;
}

.spoiler-content > *:last-child {
  margin-bottom: 0;
}

.mastodon-post {
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .nav-wrap {
    align-items: stretch;
  }

  .nav-tools {
    justify-content: flex-start;
  }

  .site-search {
    position: static;
    justify-content: flex-start;
  }

  .site-search__panel {
    right: auto;
    left: 0;
    width: 100%;
  }

  .banner-grid {
    grid-template-columns: 1fr;
  }

  .cookie-banner {
    bottom: 10px;
    left: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: auto;
    max-width: none;
    right: 10px;
    padding: 16px;
    transform: none;
  }

  .cookie-banner__text {
    font-size: 0.85rem;
  }

  .cookie-banner__button {
    width: 100%;
  }

  .premium-tooltip {
    position: fixed;
    top: 50%;
    right: auto;
    left: 50%;
    width: min(280px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    z-index: 1000;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 600px) {
  .expert-header {
    grid-template-columns: auto 1fr;
  }

  .expert-button {
    grid-column: span 2;
    text-align: center;
  }

  .post-author {
    flex-wrap: wrap;
    gap: 6px;
  }

  .author-right {
    width: 100%;
    justify-content: flex-start;
  }
}
