/* --------------------------------------------------------------------------
   CMS additions to the v2 design: blocks the CMS renders that the design
   files (styles.css, article.css) don't cover. Loaded on every v2 page (views/layouts/v2_main.tpl);
   page-view blocks are used by views/pages/v2_content.tpl.
   -------------------------------------------------------------------------- */

/* Editor content: keep wide embeds, images and tables inside the column */
.article-text img,
.article-text iframe,
.article-text video,
.article-text table {
  max-width: 100%;
}

.article-text img {
  height: auto;
}

/* Tables Content::tables() could not rebuild (colspan/rowspan): at least scroll inside the column */
.article-text table:not(.v2-table) {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

/* Editor tables rebuilt by components/Content.php (views/pages/v2_content.tpl): first row = column
   headers, first column = row headers; wide grids (climate tables) arrive transposed (months as rows) */
.v2-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  -webkit-overflow-scrolling: touch;
}

.v2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.v2-table th,
.v2-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.v2-table tbody tr:last-child > * {
  border-bottom: 0;
}

.v2-table thead th {
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.v2-table th[scope="row"],
.v2-table thead th:first-child {
  text-align: left;
}

.v2-table th[scope="row"] {
  font-weight: 500;
  white-space: nowrap;
}

.v2-table td {
  color: var(--text-secondary);
}

.v2-table tbody tr:hover > * {
  background: #FAF9F6;
}

.v2-table p {
  margin: 0;
}

.v2-table p + p {
  margin-top: 8px;
}

/* 1×1 editor table (hotel description box) */
.v2-box {
  padding: 20px 24px;
  border-radius: var(--radius-card);
  background: var(--bg-soft);
}

.v2-box p {
  margin: 0;
}

.v2-box p + p {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .v2-table {
    font-size: 13px;
  }

  /* tighter cells so a 4-column table (climate) fits a 375px screen without side scrolling */
  .v2-table th,
  .v2-table td {
    padding: 10px 6px;
  }

  .v2-table tr > :first-child {
    padding-left: 12px;
  }

  .v2-table tr > :last-child {
    padding-right: 12px;
  }

  .v2-table thead th {
    font-size: 11px;
  }
}

.article-text ul,
.article-text ol {
  padding-left: 1.25em;
}

.article-gallery a {
  display: block;
}

/* Offices (pages with the map option) */
.offices {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.office {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.office__contacts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.office__title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.office__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.office__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.office__list .icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--navy);
}

.office__list a {
  color: var(--navy);
}

.office__map iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: 0;
}

@media (max-width: 640px) {
  .office {
    grid-template-columns: 1fr;
  }
}

/* Text pasted from Google Docs / Word carries inline fonts: use the design's */
.article-text [style*="font"] {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Google Docs sets white-space: pre-wrap on every <span>: a line break typed in the HTML source then shows as an empty
   line, and spaces at a line's end stick out of the column */
.article-text [style*="white-space"] {
  white-space: normal !important;
}

/* Google Docs paragraphs carry their own line-height (line-height: 1.38) without any font in the same style, so the
   rule above missed them: those articles had tighter lines than the rest */
.article-text [style*="line-height"] {
  line-height: inherit !important;
}

/* … and negative side margins (Word: margin-right: -0.85in): the paragraph ran 80px out of the text column and the
   whole page scrolled sideways on phones */
.article-text [style*="margin"][style*=" -"],
.article-text [style*="margin"][style*=":-"] {
  margin-right: 0 !important;
  margin-left: 0 !important;
}

/* Top-level blocks of the text are spaced by .article-text's gap alone: inline top / bottom margins from Google Docs
   (margin-top: 12pt; margin-bottom: 12pt) came on top of it and doubled the space between paragraphs */
.article-text > [style*="margin"] {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Google Docs image frame (<span style="display:inline-block;overflow:hidden;width:624px;height:416px">):
   a fixed size, wider than a phone screen */
.article-text span[style*="overflow:hidden"],
.article-text span[style*="overflow: hidden"] {
  max-width: 100%;
  height: auto !important;
}

/* Last resort for text the browser cannot break (a long address, words joined by &nbsp; that Content::spaces()
   left alone): break it inside the column instead of widening the page */
.article-text {
  overflow-wrap: break-word;
}

/* Non-article pages (no sidebar): content takes the full container width */
.article-body--full .article-content {
  flex: 1 1 auto;
  max-width: none;
}

/* Pages (not articles, which keep the design's eyebrow + title spacing/size):
   no extra space between breadcrumb and title — breadcrumb's own 20px/16px padding is enough */
.article-header--page {
  padding-top: 0;
}

/* Page/article title: design's 60px max read too big on CMS pages */
.article-header__title {
  font-size: clamp(30px, 3.33vw, 46px);
}

/* Header with title only (no image): the body's 64px top padding left too big a gap under the title */
.article-header--page.article-header--text + .article-body {
  padding-top: clamp(16px, 2.2vw, 32px);
}

/* No header at all (request form page, id 143, has no title/image): body starts right under
   the breadcrumb — its own 20px/16px bottom padding is the gap (was +64px empty space) */
.article-body--flush {
  padding-top: 0;
}

/* Article body on desktop: the design's text column is fixed at 760px and the gap grows to
   120px, so below ~1440px the sidebar got squeezed (~190px at 1190px) and its button
   overflowed. Here the gap shrinks with the screen (40px at ≤1100px → 120px at 1440px, the
   design value) and the sidebar keeps at least 320px; the text column gives way instead.
   From 1440px up the design is unchanged. */
@media (min-width: 1025px) {
  .article-body {
    column-gap: clamp(40px, calc(21.2vw - 185px), 120px);
  }

  .article-sidebar {
    min-width: 320px;
  }
}

/* Never let a sidebar button run out of its box */
.article-sidebar .btn {
  max-width: 100%;
  white-space: normal;
}

/* Footer without the newsletter above it ($newsletter = false): the newsletter's top
   padding used to give the footer its breathing room, so the footer takes it over */
.site-footer--no-newsletter {
  padding-top: 56px;
}

/* Share buttons for touch devices only (Messenger, SMS) start hidden; .share__btn's
   display: flex would otherwise override the hidden attribute */
.share__btn[hidden] {
  display: none;
}

/* Related article card without an image: neutral block with the logo mark */
.article-card__media--empty {
  background: var(--bg-soft) url("../img/favicon.svg") center / 48px no-repeat;
  opacity: 0.6;
}

/* Featured article (articles index) without an image */
.featured__image .article-card__media--empty {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
}

/* Lightbox (js/main.js initLightbox): full-size gallery image over the page */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483647; /* above third-party chat / cookie widgets, which use near-max values */
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 8px;
  padding: 56px 16px;
  background: #14253DF2; /* --navy-deep, 95% */
  color: var(--on-dark);
}

.lightbox[hidden],
.lightbox__btn[hidden],
.lightbox__caption[hidden] {
  display: none;
}

.has-lightbox,
.has-lightbox body {
  overflow: hidden;
}

.lightbox__figure {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100% - 32px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 60px #0000004D;
}

.lightbox__caption {
  color: var(--on-dark-soft);
  font-size: 14px;
  text-align: center;
}

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--on-dark-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lightbox__btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--glass);
  color: var(--on-dark);
  cursor: pointer;
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  background: var(--glass-line);
}

.lightbox__btn .icon {
  width: 22px;
  height: 22px;
}

.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.lightbox__nav--prev { grid-column: 1; justify-self: center; }
.lightbox__nav--next { grid-column: 3; justify-self: center; }

/* Phones: image uses the full width, arrows sit at the bottom corners (swipe works too) */
@media (max-width: 640px) {
  .lightbox {
    grid-template-columns: minmax(0, 1fr);
    padding: 64px 8px 76px;
  }

  .lightbox__figure { grid-column: 1; }

  .lightbox__nav {
    position: absolute;
    bottom: 12px;
  }

  .lightbox__nav--prev { left: 12px; }
  .lightbox__nav--next { right: 12px; }
}

/* Submenu: link of the open page (aria-current="page", set in v2_main.tpl), same look as hover */
.submenu__link[aria-current="page"] {
  background: var(--bg-soft);
  color: var(--brand-red);
  font-weight: 600;
}

/* Landing hero title: room for a two-line headline ("Nepamirštamos atostogos, / geriausios kainos" needs ~1010px at 76px;
   the design's 900px broke it into three). Lines balanced, so no single word is left on the last line. */
.hero__copy {
  max-width: 1100px;
}

.hero__title {
  max-width: 100%; /* flex item: without it a long word makes the title wider than the hero instead of wrapping */
  text-wrap: balance;
}

/* Small phones: one long word ("Nepamirštamos", "Незабываемый") is wider than the screen at the design's 40px minimum */
@media (max-width: 400px) {
  .hero__title {
    font-size: 34px;
    overflow-wrap: break-word;
  }
}

/* Footer columns, 1241px up to the design's 1440px: brand + three link columns are fixed (940px + gaps), so the contacts
   column got what was left: 25px at 1280px, and its button stuck out of the page (sideways scroll). The fixed columns now
   give way proportionally and contacts keeps the 180px it has at 1440px. From 1440px up nothing changes. */
@media (min-width: 1241px) {
  .footer-brand,
  .footer-col--destinations,
  .footer-col--operators,
  .footer-col--about {
    flex: 0 1 auto;
    min-width: 0;
  }

  .footer-col--contacts {
    flex: 1 0 180px;
  }
}

/* Footer "safe payments" line: one unbreakable line was wider than a small phone (RU text at 320px) */
@media (max-width: 640px) {
  .payments-label {
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* FAQ question is an h3 inside <summary> (heading outline); looks like the plain text it replaced */
.faq-item__title {
  font: inherit;
}

/* In-text headings: written in the editor or made from bold sub-titles by Content::headings().
   (article.css sets an in-text h2 like a paragraph; a sub-title has to read as one.) */
.article-text h2 {
  margin: 12px 0 6px;
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.3px;
}

.article-text h3 {
  margin: 8px 0 4px;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

/* Bold lead-in of a paragraph made a heading: stays in the line, the paragraph looks as before */
.article-text .v2-runin > .v2-runin__title,
.article-text .v2-runin > p {
  display: inline;
  margin: 0;
}

.article-text .v2-runin > .v2-runin__title {
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  letter-spacing: normal;
}

/* Article date under the title (recent articles only), same look as the card meta line */
.article-header__meta {
  margin-top: -6px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
}
