/* ================================================================
   ETHOS FOUNDATION — HELP SCOUT KNOWLEDGE BASE
   Refactored stylesheet — mobile-first
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
  --color-primary:      #F07D00;
  --color-primary-dark: #C15700;
  --color-bg:           #F9F9FA;
  --color-text:         #2C2C2C;
  --color-headings:     #1A1A1A;
  --color-border:       #e8e8e8;
  --color-white:        #ffffff;
  --font-heading: 'Montserrat', sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-ui:      'Montserrat', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────── */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* ── Typography — Headings ──────────────────────────────────────── */
h1, h2, h3,
.title,
.contentWrapper h1 {
  font-family: var(--font-heading);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--color-headings);
}

/* ── Typography — Body ──────────────────────────────────────────── */
p, li, div {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
}

/* ── Links ──────────────────────────────────────────────────────── */
a, a:hover, a:focus {
  color: var(--color-primary);
}

/* ── Form Elements ──────────────────────────────────────────────── */
input, button, select, textarea {
  font-family: var(--font-ui);
}

input:focus,
textarea:focus {
  box-shadow: 0 0 0 1px var(--color-primary) inset !important;
  border-color: var(--color-primary) !important;
}

button {
  appearance: none;
  border-radius: 0;
}

/* ── Navigation ─────────────────────────────────────────────────── */
#mainNav .brand {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  text-decoration: none !important;
}

/* Глушим системный текст, если он есть */
#mainNav .brand > text {
  font-size: 0 !important;
}

/* Убиваем размер картинки, если лого загружено через админку */
#mainNav .brand img {
  max-width: 32px !important;
  max-height: 32px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  display: block !important;
}

/* Убиваем размер спана, если лого грузится старым костылем */
#mainNav .brand span {
  display: block !important;
  text-indent: -9000px;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  background-size: contain !important;
  background-position: center !important;
}

#mainNav .brand::after {
  content: 'БАЗА ЗНАНИЙ';
  font-family: var(--font-heading);
  font-size: 16px !important;
  font-weight: 700;
  color: #1A1A1A;
  letter-spacing: 1px;
}

/* ── Search Bar ─────────────────────────────────────────────────── */
#docsSearch {
  padding-top: 70px !important;
  padding-bottom: 50px !important;
}

#docsSearch h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--color-headings);
  margin-bottom: 35px !important;
}

#docsSearch form,
#searchBar form,
form#searchBar {
  position: relative !important;
  display: block !important; /* Убираем ломучий flex */
  max-width: 600px !important;
  height: 52px !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

#docsSearch input[type="text"],
#docsSearch input[type="search"],
form#searchBar input[type="text"],
form#searchBar input[type="search"] {
  display: block !important;
  width: 100% !important;
  height: 52px !important;
  /* 140px справа — пустая зона, чтобы текст не залезал под кнопку */
  padding: 0 140px 0 25px !important; 
  border: 2px solid var(--color-primary, #F07D00) !important;
  border-radius: 50px !important;
  box-sizing: border-box !important;
  background-color: white !important;
  font-size: 16px !important;
  margin: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

#docsSearch button[type="submit"],
#docsSearch button,
form#searchBar button {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  height: 52px !important; /* Высота строго равна инпуту */
  margin: 0 !important;
  padding: 0 35px !important;
  background-color: var(--color-primary, #F07D00) !important;
  color: white !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  border: none !important;
  /* Скругляем только правые углы, чтобы лечь поверх инпута */
  border-radius: 0 50px 50px 0 !important; 
  cursor: pointer !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#docsSearch button[type="submit"]:hover,
#docsSearch button:hover,
form#searchBar button:hover {
  background-color: var(--color-primary-dark, #C15700) !important;
}

/* ── Category Grid ──────────────────────────────────────────────── */
.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.category-list .category {
  display: flex;
  flex-direction: column;
  width: 100% !important;
  max-width: none !important;
  min-height: 200px;
  padding: 30px !important;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-sizing: border-box !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.category-list .category:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* ── Article Page ───────────────────────────────────────────────── */
body.article-page {
  background-color: var(--color-bg);
}

#fullArticle {
  max-width: 900px !important;
  margin: 0 auto !important;
  padding: 50px 80px !important;
  background-color: var(--color-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
}

#fullArticle h1.title {
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.3;
  margin-bottom: 1.5em;
}

#fullArticle h2 {
  font-size: clamp(18px, 3vw, 22px);
  line-height: 1.4;
  margin-top: 2em;
  margin-bottom: 0.8em;
}

#fullArticle h2 a,
#fullArticle h2 a:hover,
#fullArticle a:hover h2 {
  color: var(--color-headings);
  text-decoration: none;
}

#fullArticle h3 {
  font-size: 17px;
  line-height: 1.4;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

#fullArticle p,
#fullArticle ul,
#fullArticle ol,
#fullArticle li,
#fullArticle div,
#fullArticle blockquote,
#fullArticle dd,
#fullArticle table {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 1.2em;
}

#fullArticle ul,
#fullArticle ol {
  padding-left: 1.5em;
  margin-top: 0.5em;
}

#fullArticle li {
  margin-bottom: 0.5em;
}

#fullArticle blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1.5em;
  margin-left: 0;
  color: #555;
  font-style: italic;
}

#fullArticle dt {
  padding: 0;
  width: 26px;
  height: 26px;
  line-height: 26px;
  background: var(--color-primary);
  font-weight: 500;
  font-size: 14px;
}

#fullArticle dd {
  padding-top: 0;
}

#fullArticle dd p:first-child {
  margin-top: 0;
}

p + ul {
  margin-top: -1em;
}

/* ── Callout list size override ─────────────────────────────────── */
#fullArticle .callout-yellow ul,
#fullArticle .callout-blue ul,
#fullArticle .callout-red ul,
#fullArticle .callout-green ul,
#fullArticle .callout ul,
#fullArticle .private-note ul,
#fullArticle .callout-yellow ol,
#fullArticle .callout-blue ol,
#fullArticle .callout-red ol,
#fullArticle .callout-green ol,
#fullArticle .callout ol,
#fullArticle .private-note ol,
#fullArticle .callout-yellow li,
#fullArticle .callout-blue li,
#fullArticle .callout-red li,
#fullArticle .callout-green li,
#fullArticle .callout li,
#fullArticle .private-note li {
  font-size: 14px;
}

/* ── Platform Icons ─────────────────────────────────────────────── */
#fullArticle .ios .platform::before,
.tabButton.ios::before {
  content: url("https://s3.us-east-1.amazonaws.com/tgl.public/support/os-system-apple-3.svg");
  display: inline;
  height: 100%;
  float: left;
  margin: 0 6px 0 0;
}

#fullArticle .android .platform::before,
.tabButton.android::before {
  content: url("https://s3.us-east-1.amazonaws.com/tgl.public/support/android-1.svg");
  display: inline;
  height: 100%;
  float: left;
  margin: 0 6px 0 0;
}

#fullArticle .platform {
  font-size: 17px;
  font-weight: bold;
  color: #666;
  border-bottom: 1px solid #ccc;
  padding-bottom: 1px;
}

/* ── Screenshots ────────────────────────────────────────────────── */
#fullArticle .screenshots {
  display: flex;
  flex-direction: row;
  justify-content: center;
  margin-top: 10px;
}

#fullArticle .screenshots img {
  margin-top: 0;
}

#fullArticle .screenshots .ios,
#fullArticle .screenshots .android {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 50%;
  max-width: 350px;
  height: auto;
  margin: 0 10px;
}

#fullArticle .screenshots .platform {
  border-bottom: none;
  margin-bottom: 0;
}

#fullArticle img.screenshot {
  max-width: 100%;
}

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs nav {
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.tabs nav button {
  font-size: 17px;
  color: #666;
  padding: 10px 15px;
  background: var(--color-white);
  border: 1px solid #666;
  border-radius: 5px;
  margin-right: 10px;
  line-height: 21px;
  box-shadow: none;
  text-shadow: none;
  box-sizing: border-box;
}

.tabs nav button.active {
  font-weight: bold;
  border-width: 3px;
}

.tabs .tab {
  margin-top: 15px;
}

/* ── Article Footer ─────────────────────────────────────────────── */
.articleFoot {
  margin-top: 3em;
  padding-top: 2em;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
  color: #888;
}

.articleFoot p,
.articleFoot time {
  font-style: normal;
}

/* ── Sidebar & Article List ─────────────────────────────────────── */
#contentArea,
.contentWrapper {
  width: 100% !important;
  max-width: 950px !important;
  margin: 0 auto !important;
  float: none !important;
}

#contentArea {
  font-size: 17px;
  line-height: 1.4;
  margin-top: 30px !important;
}

#sidebar .nav-list a {
  font-size: 1em;
}

.articleList {
  font-size: 1em;
}

.articleList a {
  line-height: 1em;
}

/* ── Promo Banner ───────────────────────────────────────────────── */
.ethos-promo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 15px;
  max-width: 800px;
  margin: 40px auto 30px !important;
  padding: 24px 32px !important;
  background-color: rgba(240, 125, 0, 0.08);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text, #2C2C2C);
  line-height: 1.5;
}

.ethos-promo-banner a {
  color: var(--color-primary, #F07D00);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid rgba(240, 125, 0, 0.3);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

.ethos-promo-banner a:hover {
  color: var(--color-primary, #F07D00);
  border-color: var(--color-primary, #F07D00);
}

/* ── Ethos CTA Button ───────────────────────────────────────────── */
a.ethoslink {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  height: fit-content;
  margin-left: auto !important;
  border-radius: 50px;
  background-color: var(--color-primary);
  color: var(--color-white);
  padding: 10px 24px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a.ethoslink:hover,
a.ethoslink:focus {
  color: var(--color-white);
  opacity: 0.8;
  text-decoration: none;
}

/* ── Hide unwanted Help Scout elements ──────────────────────────── */
.siteFooter,
footer {
  display: none !important;
}

a[href*='contact'],
#contact {
  display: none !important;
}

.printArticle {
  display: none !important;
}

/* ── Responsive: Desktop (≥ 1024px) ────────────────────────────── */
@media (min-width: 1024px) {
  .contentWrapper {
    padding: 70px 90px;
  }
}

/* ── Responsive: Mobile (≤ 768px) ──────────────────────────────── */
@media (max-width: 768px) {
  /* ── Header ──────────────────────────────────────────────────── */
  #mainNav .container-fluid {
    flex-wrap: wrap !important;
    height: auto !important;
    padding: 10px 15px 15px !important;
    box-sizing: border-box !important;
  }

  #mainNav .brand::after {
    display: none !important;
  }

  a.ethoslink {
    display: flex !important;
    width: 100% !important;
    justify-content: center !important;
    margin: 15px 0 0 0 !important;
    box-sizing: border-box !important;
  }

  /* ── Search heading ──────────────────────────────────────────── */
  #docsSearch h1 {
    font-size: 22px !important;
    margin-bottom: 25px !important;
    padding: 0 15px !important;
    line-height: 1.3 !important;
  }

  /* ── Search form ─────────────────────────────────────────────── */
  #docsSearch form,
  #searchBar form,
  form#searchBar {
    width: calc(100% - 30px) !important;
    margin: 0 15px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* ── Search input ────────────────────────────────────────────── */
  #docsSearch input[type="text"],
  #docsSearch input[type="search"],
  #searchBar input[type="text"],
  #searchBar input[type="search"],
  form#searchBar input[type="text"],
  form#searchBar input[type="search"] {
    padding: 0 60px 0 20px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  /* ── Search button — icon only ───────────────────────────────── */
  #docsSearch button[type="submit"],
  #docsSearch button,
  #searchBar button,
  form#searchBar button {
    width: 50px !important;
    padding: 0 !important;
    font-size: 0 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 20px !important;
  }

  /* ── Promo banner ────────────────────────────────────────────── */
  .ethos-promo-banner {
    width: calc(100% - 30px) !important;
    margin: 20px 15px 10px !important;
    box-sizing: border-box !important;
    padding: 15px !important;
    font-size: 13px !important;
  }

  /* ── Category grid ───────────────────────────────────────────── */
  .category-list {
    grid-template-columns: 1fr !important;
    padding: 0 15px !important;
    box-sizing: border-box !important;
  }

  .category-list .category {
    padding: 20px !important;
  }

  /* ── Article ─────────────────────────────────────────────────── */
  #fullArticle {
    padding: 25px 15px !important;
    box-sizing: border-box !important;
  }

  /* ── Nav collapse (Help Scout native) ───────────────────────── */
  .navbar .btn-navbar {
    margin-top: 32px;
  }

  .nav-collapse {
    background-color: var(--color-white);
    z-index: 1000;
  }

  .nav {
    width: 100%;
    z-index: 1000;
  }

  .nav .in .collapse {
    border-bottom: 1px solid #ccc;
    width: 100%;
  }
}

/* ── Responsive: Desktop nav (≥ 769px) ─────────────────────────── */
@media (min-width: 769px) {
  .nav-collapse .collapse {
    text-align: right;
  }

  .navbar .nav {
    position: relative;
  }
}
