/* ==========================================================================
   Home page (loaded only on "/", after base.css + cards.css).
   Hero + search card · section helpers · early-booking panel · destination grid ·
   theme tiles · holiday cards · Greece band · blog/tools wrappers · SEO link cloud.
   Cards themselves (.ocard, .dest-tile, .post-card, .tool-card) live in cards.css.
   ========================================================================== */

/* ---------- Section helpers ---------- */
/* "Виж всички" link on the right of a section head */
.more-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--blue); font-size: 0.9375rem; font-weight: 600; white-space: nowrap;
}
.more-link i { font-size: 1.05em; transition: transform var(--t-fast) var(--ease); }
.more-link:hover { color: var(--blue-700); }
.more-link:hover i { transform: translateX(3px); }
.rail__nav { display: inline-flex; gap: 8px; }
.section__actions .rail__nav { margin-left: 6px; }
.section__more .btn i { font-size: 1.05em; }

/* ---------- Hero (Priceline): light band, H1 + white search card left, rounded photo right ---------- */
/* z-index + isolation: the search popovers live inside the hero and must stay above the sections below it */
.hero {
  position: relative; isolation: isolate; z-index: 5;
  padding: 40px 0 24px;
  background: linear-gradient(180deg, var(--blue-50) 0%, var(--blue-50) 35%, var(--white) 100%);
}
.hero__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: stretch; }
.hero__main { position: relative; z-index: 2; min-width: 0; }
.hero__title {
  font-size: clamp(2rem, 0.9rem + 2.6vw, 2.875rem); line-height: 1.08; font-weight: 800;
  letter-spacing: -0.025em; text-wrap: balance;
}
.hero__sub { margin-top: 12px; max-width: 54ch; font-size: 1.0625rem; color: var(--muted); text-wrap: pretty; }

/* White search card; on desktop it overlaps the photo a little (inspiration 2) */
.hero__card {
  position: relative; margin-top: 24px; margin-right: -96px; padding: 4px 24px 24px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-float);
}
.hero__media { position: relative; min-height: 420px; overflow: hidden; border-radius: 24px; background: var(--blue-100); }
.hero__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 32% 50%; }

/* Scope buttons styled as Priceline tabs: icon + label, blue underline when active */
.scope { display: flex; gap: 4px; margin-inline: -8px; box-shadow: inset 0 -1px 0 var(--line); }
.scope__btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 12px;
  color: var(--navy); font-size: 0.9375rem; font-weight: 600; white-space: nowrap;
  transition: color var(--t-fast);
}
.scope__btn::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--blue);
  transform: scaleX(0); transition: transform var(--t-med) var(--ease);
}
.scope__btn:hover, .scope__btn[aria-pressed="true"] { color: var(--blue); }
.scope__btn[aria-pressed="true"]::after { transform: none; }
.scope__btn:focus-visible { outline-offset: -3px; }
.scope__icon { display: inline-grid; place-items: center; width: 24px; height: 24px; font-size: 22px; color: var(--muted); transition: color var(--t-fast); }
.scope__btn:hover .scope__icon, .scope__btn[aria-pressed="true"] .scope__icon { color: var(--blue); }
.scope__icon .flag { width: 22px; height: 15px; }

/* Search fields: bordered boxes, small muted label above the value, 2x2 grid */
.search { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.search__field { position: relative; min-width: 0; }
.search__trigger {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 12px;
  width: 100%; min-height: 62px; padding: 9px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--white); text-align: left;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search__trigger:hover { border-color: var(--blue); }
.search__trigger[aria-expanded="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.search__icon { grid-column: 1; grid-row: 1 / 3; font-size: 22px; color: var(--blue); }
.search__label { grid-column: 2; grid-row: 1; font-size: 0.75rem; font-weight: 500; line-height: 1.25; color: var(--muted); }
.search__value {
  grid-column: 2; grid-row: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.9375rem; font-weight: 600; line-height: 1.35; color: var(--navy);
}
.search__value.is-placeholder { font-weight: 500; color: var(--text); }
.search__caret { grid-column: 3; grid-row: 1 / 3; font-size: 14px; color: var(--muted); transition: transform var(--t-med) var(--ease); }
.search__trigger[aria-expanded="true"] .search__caret { transform: rotate(180deg); color: var(--blue); }
.search__submit { grid-column: 1 / -1; margin-top: 4px; }

/* Popovers: white floating panels under their trigger */
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown);
  width: max(100%, 320px); max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), visibility 0s linear var(--t-fast);
}
.popover.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.popover--right { left: auto; right: 0; }
.popover__search { position: sticky; top: -8px; z-index: 1; margin: -8px -8px 4px; padding: 8px; background: var(--white); border-bottom: 1px solid var(--line); }
.popover__search input {
  width: 100%; height: 44px; padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong); border-radius: 10px; color: var(--navy); font-size: 0.9375rem;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%235F6C84' viewBox='0 0 256 256'%3E%3Cpath d='M229.66 218.34l-50.07-50.06a88.11 88.11 0 1 0-11.31 11.31l50.06 50.07a8 8 0 0 0 11.32-11.32ZM40 112a72 72 0 1 1 72 72 72.08 72.08 0 0 1-72-72Z'/%3E%3C/svg%3E") 12px 50% no-repeat;
}
.popover__search input::placeholder { color: var(--subtle); }
.popover__search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.popover__group { padding: 4px 0; }
.popover__group + .popover__group, .opt + .popover__group { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.popover__heading { display: flex; align-items: center; gap: 8px; padding: 6px 10px 4px; font-size: 0.8125rem; font-weight: 700; color: var(--muted); }
.popover__done { margin-top: 8px; }

.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm); text-align: left;
  color: var(--navy); font-size: 0.9375rem; font-weight: 500; line-height: 1.3;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.opt:hover, .opt:focus-visible { background: var(--blue-50); }
.opt:focus-visible { outline-offset: -2px; }
.opt[aria-selected="true"], .opt[aria-checked="true"] { color: var(--blue-700); font-weight: 600; }
.opt__lead { display: inline-flex; align-items: center; gap: 10px; }
.opt__lead i { flex: none; font-size: 18px; color: var(--blue); }
.opt__sub { display: block; margin-top: 1px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.opt__count { flex: none; font-size: 0.8125rem; font-weight: 500; color: var(--subtle); font-variant-numeric: tabular-nums; }
.opt__check {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong); border-radius: 5px; color: transparent; font-size: 13px;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.opt[aria-checked="true"] .opt__check { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* Quick links under the search card */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.quick a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--white);
  color: var(--navy); font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.quick a:hover { border-color: var(--blue); color: var(--blue-700); }
.quick a i { font-size: 16px; color: var(--star); }

.hero + .band { margin-top: 24px; }

/* ---------- Early-booking panel: navy, ladder, CTAs, photo with a soft edge ---------- */
.eb {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  border-radius: var(--r-xl); background: var(--navy); color: var(--white);
}
.eb__content { position: relative; z-index: 1; display: flex; flex-direction: column; padding: 40px 8px 36px 40px; }
.eb__title { color: var(--white); font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.eb__text { margin-top: 10px; max-width: 52ch; color: rgba(255, 255, 255, .82); }
.eb__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.eb__media { position: relative; min-height: 320px; }
.eb__media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 45%); mask-image: linear-gradient(90deg, transparent 0, #000 45%);
}

/* ---------- Destinations (spa.cz grid): 5 columns desktop ---------- */
.dest-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 16px; }
.dest-all { margin-top: 12px; }

/* ---------- Theme tiles: bordered, icon in a blue-50 square, label + count ---------- */
.themes { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.themes > li { display: flex; min-width: 0; }
.theme {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); color: var(--navy);
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.theme:hover { color: var(--navy); border-color: var(--blue-100); box-shadow: var(--shadow-hover); }
.theme__icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--blue-50); color: var(--blue); font-size: 22px;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.theme:hover .theme__icon { background: var(--blue); color: var(--white); }
.theme__text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.theme__name { font-size: 0.9375rem; font-weight: 600; line-height: 1.3; transition: color var(--t-fast); }
.theme:hover .theme__name { color: var(--blue-700); }
.theme__count { font-size: 0.8125rem; color: var(--muted); }
.theme__arrow { flex: none; font-size: 18px; color: var(--subtle); transition: transform var(--t-fast) var(--ease), color var(--t-fast); }
.theme:hover .theme__arrow { color: var(--blue); transform: translateX(3px); }

/* ---------- Holidays: image cards with the name and dates on the photo (TUI) ---------- */
.hol-rail .rail__track { list-style: none; }
.hol-rail .rail__track > li { display: flex; min-width: 0; }
.hcard {
  position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end;
  width: 100%; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--r-lg);
  background: var(--navy-2); color: var(--white);
}
.hcard:hover { color: var(--white); }
.hcard:focus-visible { outline-offset: 3px; border-radius: var(--r-lg); }
.hcard__media { position: absolute; inset: 0; z-index: -2; }
.hcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.hcard:hover .hcard__media img { transform: scale(1.04); }
.hcard__media > i { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; color: rgba(255, 255, 255, .22); }
.hcard::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(11, 31, 68, 0) 35%, rgba(11, 31, 68, .85) 100%); }
.hcard__body { display: grid; gap: 4px; padding: 16px; }
.hcard__count {
  position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: var(--r-xs); background: var(--white); color: var(--navy); font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.hcard__count--soon { color: var(--muted); font-weight: 600; }
.hcard__name { color: var(--white); font-size: 1.125rem; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 12px rgba(11, 31, 68, .35); }
.hcard__dates { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: rgba(255, 255, 255, .92); }
.hcard__dates i { flex: none; font-size: 15px; }

/* ---------- Greece: calm blue-50 band, intro + facts on the left, offer cards on the right ---------- */
.gr-band__inner { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
.gr-band__intro { display: flex; flex-direction: column; gap: 16px; }
.gr-band__intro .section__desc { margin-top: -8px; }
.gr-facts { list-style: none; display: grid; gap: 12px; }
.gr-facts li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.9375rem; line-height: 1.45; color: var(--text); }
.gr-facts i { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--white); color: var(--blue); font-size: 18px; }
.gr-facts b { color: var(--navy); font-weight: 600; }
.gr-band__btn { align-self: flex-start; margin-top: 4px; }

/* ---------- SEO link cloud: compact columns on a soft box ---------- */
.linkcloud { padding: 28px 32px 24px; border-radius: var(--r-xl); background: var(--soft); }
.linkcloud__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.linkcloud__title { font-size: 1.25rem; }
.linkcloud__cols { list-style: none; columns: 4 200px; column-gap: 24px; margin-top: 18px; }
.linkcloud__cols li { break-inside: avoid; }
.linkcloud__cols a { display: inline-block; padding: 5px 0; color: var(--text); font-size: 0.875rem; line-height: 1.4; }
.linkcloud__cols a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (min-width: 901px) and (max-width: 1200px) {
  /* the ladder needs the room; the photo becomes a narrower strip */
  .eb { grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr); }
}

@media (min-width: 901px) and (max-width: 1080px) {
  /* 4 offers stay in one row instead of 3 + 1 */
  .section > .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 12px; }
  .dest-grid { gap: 20px 12px; }
}

@media (max-width: 1080px) {
  .gr-band__inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .gr-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theme { gap: 12px; padding-inline: 14px; }
  .theme__arrow { display: none; }
}

@media (max-width: 900px) {
  .hero { padding-top: 32px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr); }
  .hero__media { display: none; }
  .hero__card { margin-right: 0; }

  .eb { grid-template-columns: minmax(0, 1fr); }
  .eb__media { order: -1; min-height: 200px; }
  .eb__media img { -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 100%); mask-image: linear-gradient(180deg, #000 45%, transparent 100%); }
  .eb__content { padding: 4px 28px 28px; }

  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 641px) and (max-width: 900px) {
  .dest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* five resorts: two wide tiles on top, three below, no empty cells */
  .dest-grid:has(> :nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dest-grid:has(> :nth-child(5):last-child) > * { grid-column: span 2; }
  .dest-grid:has(> :nth-child(5):last-child) > :nth-child(-n+2) { grid-column: span 3; }

  /* three cards: a swipe row instead of 2 + 1 */
  .gr-band .card-grid, .home-blog .post-grid {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 16px) / 2.2); gap: 16px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scroll-padding-inline: var(--gutter);
  }
  .gr-band .card-grid::-webkit-scrollbar, .home-blog .post-grid::-webkit-scrollbar { display: none; }
  .gr-band .card-grid > *, .home-blog .post-grid > * { scroll-snap-align: start; }
  /* portrait holiday cards: more of them per view than the base rail */
  .hol-rail .rail__track { grid-auto-columns: calc((100% - 3 * 16px) / 3.3); }
}

/* touch screens: tabs and pills get a 44px target */
@media (pointer: coarse) {
  .section__actions .seg button, .linkcloud .pill { min-height: 44px; }
}

@media (max-width: 640px) {
  .section__actions:has(.seg) { width: 100%; }
  .section__actions .seg { width: 100%; }
  .section__actions .seg button { flex: 1; justify-content: center; min-height: 44px; }
  .rail__nav { display: none; } /* rails are swiped on phones */
  /* rails run edge to edge on phones */
  .rail__track { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }

  /* Hero */
  .hero { padding: 24px 0 12px; }
  .hero__title { font-size: 1.875rem; }
  .hero__sub { margin-top: 8px; font-size: 1rem; }
  .hero__card { margin-top: 20px; margin-inline: -4px; padding: 0 14px 16px; }
  .scope { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; margin-inline: -6px; }
  .scope__btn { flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px 10px; font-size: 0.75rem; white-space: normal; text-align: center; line-height: 1.2; }
  .scope__btn::after { left: 6px; right: 6px; }
  /* fields stacked full width: half-width boxes would cut the values */
  .search { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; }
  .search__trigger { min-height: 56px; padding: 7px 12px; column-gap: 10px; }
  .search__icon { font-size: 20px; }

  /* popovers become bottom sheets */
  .popover {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-drawer) + 2);
    width: 100%; max-height: min(75vh, calc(100vh - var(--header-h) - 24px));
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0; border-radius: 20px 20px 0 0; opacity: 1;
    transform: translateY(100%); transition: transform 280ms var(--ease), visibility 0s linear 280ms;
  }
  .popover.is-open { transform: none; transition: transform 280ms var(--ease); }
  .popover--right { left: 0; right: 0; }
  .popover::before { content: ""; display: block; width: 40px; height: 4px; margin: -6px auto 10px; border-radius: 2px; background: var(--line-strong); }
  .popover__search { top: -16px; margin: -4px -16px 4px; padding: 8px 16px; }
  .search:has(.popover.is-open)::after { content: ""; position: fixed; inset: 0; z-index: calc(var(--z-drawer) + 1); background: rgba(11, 31, 68, .45); }

  .quick {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 16px calc(-1 * var(--gutter)) 0; padding: 2px var(--gutter);
  }
  .quick::-webkit-scrollbar { display: none; }
  .quick a { flex: none; min-height: 44px; }

  /* Early booking */
  .eb__media { min-height: 160px; }
  .eb__content { padding: 0 20px 24px; }
  .eb__actions { margin-top: 22px; }
  .eb__actions .btn { width: 100%; }

  /* Destinations: 2 columns, the first tile full width when the count is odd */
  .dest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .dest-grid > :first-child:nth-last-child(odd) { grid-column: 1 / -1; }

  /* Themes */
  .themes { gap: 10px; }
  .theme { gap: 10px; min-height: 68px; padding: 12px; }
  .theme__icon { width: 40px; height: 40px; font-size: 20px; }
  .theme__name { font-size: 0.875rem; }

  /* Holidays */
  .hol-rail .rail__track { grid-auto-columns: 62%; }

  /* Greece */
  .gr-facts { grid-template-columns: minmax(0, 1fr); }
  .gr-band__btn { align-self: stretch; }

  /* Link cloud */
  .linkcloud { padding: 22px 18px 16px; border-radius: var(--r-lg); }
  .linkcloud__cols { columns: 2; column-gap: 16px; }
  .linkcloud__cols a { padding: 7px 0; }
  .linkcloud .pill { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .hcard:hover .hcard__media img { transform: none; }
}
