/* AuthorChe Poems — restored stable design
   Drop this file next to index.html and keep <link rel="stylesheet" href="styles.css"> in <head>. */

:root {
  --header-height: 68px;
  --radius-xs: 10px;
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 34px;
  --page-max: 980px;
  --side-width: min(86vw, 340px);

  --bg: #030712;
  --bg-2: #080d1c;
  --surface: rgba(9, 14, 31, 0.72);
  --surface-strong: rgba(15, 23, 42, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --surface-hover: rgba(255, 255, 255, 0.105);
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.24);
  --brand: #f59e0b;
  --brand-2: #fb7185;
  --brand-3: #60a5fa;
  --ok: #34d399;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.28);
  --glass-blur: blur(18px) saturate(130%);
  --selection: rgba(245, 158, 11, 0.33);
}

body.light-mode {
  --bg: #f8f2e8;
  --bg-2: #efe3d2;
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(18, 24, 38, 0.052);
  --surface-hover: rgba(18, 24, 38, 0.095);
  --text: #18120b;
  --text-soft: #433827;
  --muted: #77664c;
  --border: rgba(83, 64, 36, 0.18);
  --border-strong: rgba(83, 64, 36, 0.3);
  --brand: #b45309;
  --brand-2: #be123c;
  --brand-3: #2563eb;
  --shadow: 0 24px 70px rgba(91, 62, 27, 0.22);
  --shadow-soft: 0 14px 40px rgba(91, 62, 27, 0.15);
  --selection: rgba(180, 83, 9, 0.22);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  padding: calc(var(--header-height) + 28px) 18px 96px;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(96, 165, 250, 0.16), transparent 34rem),
    radial-gradient(circle at 84% 8%, rgba(251, 113, 133, 0.14), transparent 32rem),
    radial-gradient(circle at 50% 94%, rgba(245, 158, 11, 0.14), transparent 28rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 55%, var(--bg));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -5;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 82px 82px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
}

body.nav-open,
body.preloading {
  overflow: hidden;
}

::selection {
  background: var(--selection);
  color: var(--text);
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 70%, white);
  outline-offset: 4px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Animated background */
.cosmos-bg {
  position: fixed;
  inset: -18%;
  z-index: -10;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 25%, rgba(96, 165, 250, 0.22), transparent 22%),
    radial-gradient(circle at 78% 22%, rgba(251, 113, 133, 0.18), transparent 24%),
    radial-gradient(circle at 50% 78%, rgba(245, 158, 11, 0.16), transparent 22%);
  filter: blur(22px);
  animation: cosmosDrift 22s ease-in-out infinite alternate;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: -8;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  border-radius: 999px;
  background: currentColor;
  color: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
  opacity: 0.68;
  animation: twinkle var(--dur, 3s) ease-in-out var(--delay, 0s) infinite alternate;
}

body.light-mode .star {
  color: rgba(107, 76, 36, 0.42);
  box-shadow: 0 0 10px rgba(180, 83, 9, 0.32);
}

.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0.08),
    rgba(255,255,255,0.08) 1px,
    transparent 1px,
    transparent 5px
  );
}

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(245, 158, 11, 0.18), transparent 30rem),
    linear-gradient(135deg, #030712, #0b1022 55%, #030712);
  color: #fff;
  transition: opacity 0.65s ease, visibility 0.65s ease;
}

#preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.pre-orbit {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.pre-orbit-ring,
.pre-orbit-ring-2 {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: inset 0 0 30px rgba(96, 165, 250, 0.12), 0 0 44px rgba(245, 158, 11, 0.14);
}

.pre-orbit-ring {
  border-top-color: rgba(245, 158, 11, 0.92);
  border-right-color: rgba(251, 113, 133, 0.75);
  animation: spin 2.8s linear infinite;
}

.pre-orbit-ring-2 {
  inset: 0;
  transform: rotate(18deg);
  border-left-color: rgba(96, 165, 250, 0.85);
  border-bottom-color: rgba(52, 211, 153, 0.55);
  animation: spinReverse 4.2s linear infinite;
}

.pre-orbit-dot {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 13px;
  height: 13px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 24px var(--brand), 0 0 60px rgba(245, 158, 11, 0.5);
  animation: pulse 1.25s ease-in-out infinite alternate;
}

.pre-text-block {
  text-align: center;
  padding: 30px;
}

.pre-monogram {
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.92;
  background: linear-gradient(110deg, #fff, #fde68a 36%, #fb7185 68%, #bfdbfe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pre-tagdot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 10px;
}

.pre-tagdot-line {
  width: 52px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

.pre-tagdot-gem {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 18px rgba(255,255,255,0.7);
}

.pre-label {
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

/* Header */
.top-header {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  width: min(calc(100% - 28px), 1120px);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-soft);
  transition: transform 0.28s ease, border-color 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
}

.top-header.scrolled {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
}

#menu-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#menu-icon svg { width: 24px; height: 24px; }

#menu-icon:hover {
  transform: translateY(-1px) scale(1.02);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.donate-button,
.homepage-button,
.read-all-button,
.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  border: 1px solid color-mix(in srgb, var(--brand) 46%, transparent);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 30%, transparent);
  font-weight: 780;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.donate-button {
  min-height: 46px;
  padding: 0 19px;
}

.donate-button:hover,
.homepage-button:hover,
.read-all-button:hover,
.btn-small:hover {
  transform: translateY(-2px);
  filter: saturate(1.08) brightness(1.04);
  box-shadow: 0 18px 38px color-mix(in srgb, var(--brand) 38%, transparent);
}

.homepage-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 850;
  min-height: 46px;
  padding: 0 18px;
}

.btn-small {
  padding: 0.35rem 0.72rem;
  min-height: 34px;
  font-size: 0.92rem;
}

/* Side navigation */
.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 950;
  width: var(--side-width);
  height: 100dvh;
  padding: 22px 18px 26px;
  border-right: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at 20% 0%, rgba(245,158,11,0.16), transparent 18rem),
    color-mix(in srgb, var(--surface-strong) 95%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: 28px 0 72px rgba(0,0,0,0.38);
  transform: translateX(-105%);
  transition: transform 0.32s cubic-bezier(.2,.9,.2,1);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidenav.open { transform: translateX(0); }

.sidenav::before {
  content: "Вірші";
  display: block;
  margin: 44px 8px 18px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 2rem;
  line-height: 1;
}

.close-btn:hover { background: var(--surface-hover); }

#search-input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.2s ease, background 0.2s ease;
}

#search-input::placeholder { color: var(--muted); }
#search-input:focus { border-color: color-mix(in srgb, var(--brand) 70%, var(--border)); background: var(--surface-hover); }

.read-all-button {
  width: 100%;
  min-height: 46px;
  margin: 0 0 14px;
}

#poem-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#poem-list li { margin: 7px 0; }

#poem-list a {
  display: block;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--text-soft);
  background: transparent;
  line-height: 1.35;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#poem-list a:hover,
#poem-list a.active {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border);
  transform: translateX(3px);
}

/* Hero */
#chanalname {
  width: min(100%, var(--page-max));
  margin: 18px auto 14px;
  text-align: center;
  font-size: clamp(3rem, 12vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.1em;
  font-weight: 950;
  background: linear-gradient(115deg, var(--text) 0%, #fde68a 32%, var(--brand-2) 63%, var(--brand-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 16px 38px rgba(0,0,0,0.25));
}

#imagecontejner {
  width: min(100%, var(--page-max));
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}

#chanalimage {
  width: clamp(112px, 24vw, 184px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--surface-soft) 65%, transparent), var(--shadow);
}

/* Theme switch */
.theme-switch-wrapper {
  width: min(100%, var(--page-max));
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-soft);
}

.theme-switch-wrapper em {
  font-style: normal;
  font-size: 0.96rem;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  flex: 0 0 auto;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid var(--border);
  transition: 0.28s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.slider:before {
  content: "";
  position: absolute;
  height: 26px;
  width: 26px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,0.22);
  transition: 0.28s;
}

input:checked + .slider {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 999px; }

/* Content */
#content {
  width: min(100%, var(--page-max));
  margin: 0 auto;
}

.chanal {
  display: grid;
  gap: 22px;
}

.post {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-soft) 85%, transparent)),
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 22rem);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-soft);
  animation: cardIn 0.48s ease both;
}

.post::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255,255,255,0.12), transparent 24%, transparent 72%, rgba(255,255,255,0.06));
  opacity: 0.65;
}

.post > * { position: relative; z-index: 1; }

.post:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.post.tgusername {
  text-align: center;
  padding-block: 24px;
}

.post h2 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: clamp(1.58rem, 4.5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.055em;
  font-weight: 900;
}

.tgtext {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 1.4vw, 1.14rem);
}

.tgtext i {
  font-style: normal;
}

.tgtext code,
code {
  padding: 0.13em 0.42em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.tghashtag {
  display: inline-flex;
  align-items: center;
  margin: 12px 8px 0 0;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-3) 35%, var(--border));
  color: color-mix(in srgb, var(--brand-3) 70%, var(--text));
  background: color-mix(in srgb, var(--brand-3) 12%, transparent);
  font-weight: 760;
  font-size: 0.92rem;
  line-height: 1.2;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.tghashtag:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--brand-3) 20%, transparent);
  border-color: color-mix(in srgb, var(--brand-3) 55%, var(--border));
}

/* Footer */
#footer {
  width: min(100%, var(--page-max));
  margin: 34px auto 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

#footer p { margin: 6px 0; }

#footer a {
  color: var(--text);
  font-weight: 760;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
}

#footer a:hover { color: var(--brand); }

/* Empty/search/helper states added by JS */
.no-results {
  padding: 12px 13px;
  margin: 8px 0;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 15px;
  text-align: center;
}

/* Animations */
@keyframes cosmosDrift {
  0% { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  100% { transform: translate3d(1.5%, 1%, 0) scale(1.04); }
}

@keyframes twinkle {
  from { opacity: 0.28; transform: scale(0.88); }
  to { opacity: 0.92; transform: scale(1.18); }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
@keyframes pulse { to { transform: translateX(-50%) scale(1.3); } }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 760px) {
  :root { --header-height: 62px; }

  body {
    padding-inline: 12px;
    padding-top: calc(var(--header-height) + 22px);
    padding-bottom: 88px;
  }

  .top-header {
    top: 10px;
    width: calc(100% - 18px);
    min-height: var(--header-height);
    padding: 8px;
  }

  #menu-icon,
  .donate-button {
    min-height: 44px;
    height: 44px;
  }

  .donate-button { padding-inline: 15px; }

  .post {
    border-radius: 26px;
  }

  .tgtext {
    font-size: 1rem;
    line-height: 1.7;
  }

  .homepage-button {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 440px) {
  #chanalname { font-size: clamp(2.65rem, 18vw, 4.4rem); }

  .theme-switch-wrapper {
    justify-content: center;
  }

  .post h2 { letter-spacing: -0.04em; }

  .sidenav { width: min(92vw, 340px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body {
    padding: 0;
    background: #fff !important;
    color: #111 !important;
  }

  .top-header,
  .sidenav,
  .theme-switch-wrapper,
  .homepage-button,
  #preloader,
  .cosmos-bg,
  #starfield,
  .scanline {
    display: none !important;
  }

  #chanalname,
  .post h2 {
    color: #111 !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
  }

  .post,
  #footer {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
  }
}
