/* ============================= */
/* 🖋️ Шрифты */
@font-face {
  font-family: 'Arimo';
  src: url('fonts/arimo_wght.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ============================= */
/* 🎨 Переменные и темы */
:root {
  --bg: rgb(255, 255, 255);
  --fg: #111;
  --accent: #00bfa6;
  --glass-blur: blur(20px);
  --glass-shadow: rgba(0, 0, 0, 0.1);
  --page-bg: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-shadow: rgba(0, 0, 0, 0.1);
  --code-bg: rgba(245, 245, 245, 0.95);
  --code-shadow: rgba(0, 0, 0, 0.1);
  --color-a: #00bfa6;
  --color-a-hover: var(--accent);
}

body.dark {
  --bg: rgb(30, 30, 30);
  --fg: #f1f1f1;
  --accent: #00e6b8;
  --glass-shadow: rgba(0, 0, 0, 0.6);
  --page-bg: #1e1e1e;
  --card-bg: rgba(45, 45, 45, 0.95);
  --card-shadow: rgba(0, 0, 0, 0.7);
  --code-bg: rgba(45, 45, 45, 0.95);
  --code-shadow: rgba(0, 0, 0, 0.7);
  --color-a: #00e6b8;
}

/* ============================= */
/* 🌐 Базовые стили */
body {
  margin: 0;
  font-family: 'Arimo', sans-serif;
  line-height: 1.4rem;
  background: var(--page-bg);
  color: var(--fg);
  transition: background 0.5s, color 0.5s;

  display: flex;
  flex-direction: column;
  gap: 25px;
}

a {
  color: var(--color-a);
  text-decoration: none;
}

a:hover {
  color: var(--color-a-hover);
}

/* ============================= */
/* 🖼️ Header */
header {
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-shadow);
}

/* Контейнер логотипа и эффекта матрицы */
.container {
  position: relative;
  height: 50px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  z-index: 10;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
  position: relative;
  z-index: 20;
}

/* Эффект "Matrix" */
.matrix-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  font-size: 1.2rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
}

.matrix-effect span {
  position: absolute;
  bottom: 0;
  animation: drop 5s linear infinite;
  opacity: 0;
}

@keyframes drop {
  0% {
    bottom: -100%;
    opacity: 1;
  }

  100% {
    bottom: 100%;
    opacity: 0;
  }
}

/* ============================= */
/* 🔹 Основное содержимое */
.other-content {
  padding: 20px;
  color: #fff;
}

/* ============================= */
/* ✨ Эффекты */
@keyframes flicker {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ============================= */
/* 🧭 Навигация */
nav a {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 500;
}

/* ============================= */
/* 🌟 Hero */
.hero {
  text-align: center;
  padding: 2rem 1rem; /* немного пространства сверху и снизу */
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); /* масштабируется от 2rem до 3rem */
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.4rem); /* масштабируется от 1rem до 1.4rem */
  opacity: 0.85;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 1200px; /* ограничиваем ширину для читаемости */
}


/* ============================= */
/* 📦 Дополнительно: можно добавить cards, footer и прочее в следующем шаге */


/* ============================= */
/* 📚 Блог и карточки */

.news_blog_center {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
}

.news_blog {
  width: 75%;
}

.blog {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.search_center {
  z-index: 1000;
  position: sticky;
  top: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-right: 10px;
}

.search-wrapper {

  margin: 0 auto 2rem;
  width: 100%;
}

.search-wrapper input {
  width: 100%;
  height: 40px;
  font-size: 1rem;
  border: 2px solid #444;
  border-radius: 12px;
  background: var(--bg);
  color: #fff;
  outline: none;
  transition: border 0.3s ease;
}

.search-wrapper input::placeholder {
  padding-left: 20px;
}

.search-wrapper input::placeholder:focus {
  padding-left: 20px;
}

.search-wrapper input:focus {
  border-color: #00ffcc;
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
}

/* Плавающий placeholder (label) */
.search-wrapper label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: 1rem;
  pointer-events: none;
  transition: 0.3s ease;
}

.search-wrapper input:focus+label,
.search-wrapper input:not(:placeholder-shown)+label {
  top: 4px;
  font-size: 0.75rem;
  color: #00ffcc;
}

/* Анимация "shake" */
@keyframes shake {
  0% {
    transform: translateY(-50%) translateX(0);
  }

  25% {
    transform: translateY(-50%) translateX(-5px);
  }

  50% {
    transform: translateY(-50%) translateX(5px);
  }

  75% {
    transform: translateY(-50%) translateX(-5px);
  }

  100% {
    transform: translateY(-50%) translateX(0);
  }
}

.search-wrapper label.shake {
  animation: shake 0.4s ease;
}


mark {
  background: #facc15;
  color: #000;
  padding: 0 2px;
  border-radius: 3px;
}


/* Сетка карточек */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  width: 95%;
}

/* ============================= */

.card.hidden {
  display: none;
}


/* 🃏 Карточки */
.card {
  flex: 1 1 400px; /* адаптивная ширина */
  width: 400px;
  max-height: 250px;
  min-height: 250px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  /* улучшенный шрифт */
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  line-height: 1.5;
}

/* Заголовок карточки */
.card h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem); /* плавно масштабируется от 1.1 до 1.5rem */
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  color: var(--fg);
}

/* Описание карточки */
.card p {
  font-size: clamp(0.9rem, 2vw, 1.1rem); /* плавно масштабируется от 0.9 до 1.1rem */
  margin: 0;
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}


.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ============================= */
/* Адаптивность карточек */
@media (max-width: 768px) {
  .hero {
    text-align: left;
    padding: 20px;
  }

  .card {
    min-height: max-content;
    /* подстраиваем высоту под контент */
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .grid {
    width: 100%;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .card {
    max-width: 85%;
    max-height: fit-content;
  }
}


/* ============================= */
/* 📄 Страница поста */
main.post {
  font-size: clamp(1rem, 2.5vw, 1.4rem); /* масштабируемый основной текст */
  line-height: clamp(1.8rem, 3vw, 2.2rem); /* адаптивный межстрочный интервал */
  max-width: 60%;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: var(--fg);
}

main.post h1 {
  font-size: clamp(1.8rem, 5vw, 2.2rem); /* масштабируемый заголовок */
  line-height: clamp(2.5rem, 6vw, 3.2rem); /* адаптивный межстрочный интервал */
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--accent);
}


main.post img {
  width: 100%;
  height: auto;
  /* подстраивается под контент */
  object-fit: contain;
  border-radius: 8px;
  background-color: rgba(0, 255, 221, 0.15);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 25px var(--code-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

main.post img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

main.post article {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Таблица */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 0.95em;
}

table th,
table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
}

table th {
  background: var(--page-bg);
  font-weight: bold;
}

table tr:nth-child(even) {
  background: var(--glass-shadow);
}

/* Адаптивность */
@media screen and (max-width: 768px) {

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  table thead {
    display: none;
  }

  table tr {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: var(--glass-blur);
  }

  table td {
    text-align: right;
    padding-left: 50%;
    position: relative;
  }

  table td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: 45%;
    font-weight: bold;
    text-align: left;
  }
}

blockquote {
  position: relative;
  padding: 25px 30px 25px 60px;
  margin: 30px 0;
  font-style: italic;
  background: rgba(0, 255, 255, 0.05);
  border-left: 6px solid var(--accent);
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
  color: var(--color-p-news);
  line-height: 1.6;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

blockquote::before {
  content: "“";
  position: absolute;
  top: 10px;
  left: 25px;
  font-size: 3rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent);
  opacity: 0.8;
}

blockquote::after {
  content: "”";
  position: absolute;
  bottom: -10px;
  right: 25px;
  font-size: 3rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent);
  opacity: 0.8;
}


/* ============================= */
/* Адаптивность */
@media (max-width: 992px) {

  .news_blog {
  width: 90%;
}

  main.post {
    max-width: 90%;
    font-size: 1.2rem;
    line-height: 2rem;
  }

  main.post h1 {
    font-size: 1.8rem;
    line-height: 2.6rem;
  }
}

@media (max-width: 600px) {
  main.post {
    max-width: 95%;
    font-size: 1rem;
    line-height: 1.8rem;
    padding: 0 0.5rem;
  }

  main.post h1 {
    font-size: 1.5rem;
    line-height: 2.2rem;
  }
}

/* ============================= */
/* 📌 Footer */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  opacity: 0.7;
  color: var(--fg);
  background: var(--bg);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-shadow);
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============================= */
/* 💻 Code block window */
.code-block {
  margin: 1.5rem 0;
  font-family: monospace;
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--glass-shadow);
  box-shadow: 0 4px 20px var(--code-shadow);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.code-block:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px var(--code-shadow);
}

.code-header,
.code-content {
  padding: 0.7rem 1rem;
  background: var(--code-bg);
}

.code-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--glass-shadow);
}

.dots {
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot:nth-child(1) {
  background: #ff5f56;
}

.dot:nth-child(2) {
  background: #ffbd2e;
}

.dot:nth-child(3) {
  background: #27c93f;
}

.title {
  flex-grow: 1;
  text-align: center;
  font-size: 0.9rem;
}

.copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--fg);
  transition: color 0.3s ease;
}

.copy-btn:hover {
  color: var(--accent);
}

/* ============================= */
/* 🔹 Tooltip for copy button */
.tooltip {
  position: absolute;
  top: -40px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2000;
}

/* ============================= */
/* 🔔 Global copy notification */
#copyNotification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 3000;
}


/* Sticky Ad macOS style */
#stickyAd {
  position: fixed;
  bottom: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  z-index: 2000;
  transition: bottom 0.5s ease, opacity 0.5s ease, border-radius 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

#stickyAd.minimized {
  height: 50px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* macOS window top bar */
#stickyAd .title-bar {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--code-bg);
}

.window-btns {
  display: flex;
  gap: 0.4rem;
}

.window-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.close {
  background: #ff5f56;
}

.minimize {
  background: #ffbd2e;
}

.maximize {
  background: #27c93f;
}

#stickyAdContent {
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

/* ============================= */
/* 🔹 Контейнер для адаптива (iframe) */
.iframe_page {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.iframe_wrapper {
  position: relative;
  width: 100%;
  max-width: 90vw;
  /* ограничение по ширине */
  max-height: 480px;
  /* ограничение по высоте */
  aspect-ratio: 16 / 9;
  /* сохраняем пропорции */
  overflow: hidden;
  border-radius: 12px;
  /* мягкие углы */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iframe_wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  /* добавим плавный эффект при hover */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iframe_wrapper iframe:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}


@media (max-width: 800px) {
  body {
    line-height: 2em;
  }

  .hero h1 {
    font-size: 2em;
  }

  .iframe_wrapper {
    max-width: 85%;
    min-height: 500px;
  }
}

.tools-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 20px;
  justify-content: center;
  margin-top: 25px;
}

.tool-btn {
  padding: 12px 25px;
  background: var(--color-a);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.3s, transform 0.2s;
}

.tool-btn:hover {
  background: var(--color-a-hover);
  transform: scale(1.05);
  color: #f1f1f1;
}

@media(max-width: 700px) {
  .tools-buttons {
    flex-direction: column;
    gap: 10px;
  }

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

}

select {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--glass-shadow);
  font-family: monospace;
}

.comments {
  background-color: #ffffff;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 2px 2px 10px #ffffff;
  border-top: 20px solid var(--accent);
  border-left: 20px solid #27c93f;
  border-right: 20px solid #27c93f;
  border-bottom: 20px solid var(--accent);
}

.comments h4 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--accent);
  color: #111;
}