/* ==========================================================================
   Divi Overrides — HAOK Mladost
   Loaded LAST so these rules win the cascade over Divi's own stylesheet.

   Rules here target Divi's generated .et_pb_* classes. Divi ships highly
   specific selectors, so overrides typically need the `body` prefix and
   !important — especially for buttons:

     body .et_pb_button.haokm-cta { ... !important; }

   Prefer adding a custom `haokm-` class to the module (Advanced > Attributes)
   and scoping overrides to that class rather than to numbered selectors like
   .et_pb_button_0, which are fragile and change as modules are reordered.
   ========================================================================== */

/* Primary button (red) — matches the prototype's .btn .btn-crvena.
   Apply the class "haokm-btn" to a Button module via Advanced > Attributes. */
body .et_pb_button.haokm-btn,
body .et_pb_button.haokm-btn:visited {
  background-color: var(--haokm-red) !important;
  color: var(--haokm-white) !important;
  border: 0 !important;
  border-radius: var(--haokm-radius-sm) !important;
  padding: 0.85em 1.6em !important;
  font-family: var(--haokm-font-heading) !important;
  font-weight: 800 !important;
  font-size: clamp(0.8rem, 0.6rem + 0.4vw, 0.9rem) !important;
  line-height: 1.1 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

/* Divi injects an arrow pseudo-element on hover that shifts padding — disable it. */
body .et_pb_button.haokm-btn::after,
body .et_pb_button.haokm-btn::before {
  display: none !important;
}

body .et_pb_button.haokm-btn:hover,
body .et_pb_button.haokm-btn:focus {
  background-color: var(--haokm-red-dark) !important;
  color: var(--haokm-white) !important;
  transform: translateY(-2px) !important;
  box-shadow: var(--haokm-shadow-hover) !important;
  padding: 0.85em 1.6em !important; /* hold padding so the button doesn't jump */
}

/* Keyboard focus ring — black (a red ring on a red button is invisible) */
body .et_pb_button.haokm-btn:focus-visible {
  outline: 2px solid var(--haokm-black) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  body .et_pb_button.haokm-btn:hover,
  body .et_pb_button.haokm-btn:focus {
    transform: none !important;
  }
}

/* ==========================================================================
   News hero slider — native Divi Post Slider styled to match the prototype
   (ai-research/prijedlog: hero "zadnjih 5 vijesti").
   Apply class "haokm-news-slider" to the Post Slider module via
   Advanced > Attributes. Builder: Fullwidth Section > Post Slider, Posts
   Number 5, category Vijesti, Date/Desc, featured image as bg, overlay ON,
   show excerpt + date meta, more button "Pročitaj više".
   ========================================================================== */

.haokm-news-slider .et_pb_slider,
.haokm-news-slider .et_pb_slide {
  min-height: clamp(360px, 52vw, 560px);
}

/* Directional dark gradient (left -> right) over the featured image */
.haokm-news-slider .et_pb_slide_overlay_container {
  background: linear-gradient(90deg, rgba(26, 24, 24, 0.85) 0%, rgba(26, 24, 24, 0.45) 50%, rgba(26, 24, 24, 0.15) 100%) !important;
}

/* Caption: bottom-left, constrained to container width */
.haokm-news-slider .et_pb_slide_description {
  max-width: var(--haokm-max-width);
  margin: 0 auto;
  padding: 0 22px 48px !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
}

/* Date (post meta) */
.haokm-news-slider .post-meta {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 8px;
}
.haokm-news-slider .post-meta a {
  color: var(--haokm-white) !important;
}

/* Title */
.haokm-news-slider .et_pb_slide_title {
  font-family: var(--haokm-font-heading);
  font-size: clamp(1.5rem, 3.6vw, 2.7rem);
  max-width: 760px;
  margin: 0 0 12px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

/* Excerpt */
.haokm-news-slider .et_pb_slide_content {
  max-width: 620px;
  font-size: 1.02rem;
  margin-bottom: 1.25em;
}

/* Yellow "Pročitaj više" button (slider variant) */
.haokm-news-slider .et_pb_more_button.et_pb_button {
  background-color: var(--haokm-yellow) !important;
  color: var(--haokm-black) !important;
  border: 0 !important;
  border-radius: var(--haokm-radius-sm) !important;
  padding: 12px 1em !important;
  font-family: var(--haokm-font-heading) !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}
.haokm-news-slider .et_pb_more_button.et_pb_button:hover {
  background-color: #f0b400 !important;
  padding: 12px 1em !important;
}

/* Arrows — round, glassy, red on hover */
.haokm-news-slider .et-pb-slider-arrows .et-pb-arrow-prev,
.haokm-news-slider .et-pb-slider-arrows .et-pb-arrow-next {
  width: 50px;
  height: 50px;
  line-height: 50px;
  background: rgba(255, 255, 255, 0.18) !important;
  border-radius: 50% !important;
  color: var(--haokm-white) !important;
  backdrop-filter: blur(4px);
}
.haokm-news-slider .et-pb-arrow-prev:hover,
.haokm-news-slider .et-pb-arrow-next:hover {
  background: var(--haokm-red) !important;
}

/* Dots — yellow active, elongated */
.haokm-news-slider .et-pb-controllers a {
  background: rgba(255, 255, 255, 0.45) !important;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.haokm-news-slider .et-pb-controllers a.et-pb-active-control {
  background: var(--haokm-yellow) !important;
  width: 28px;
  border-radius: 6px;
}

/* Hide excerpt on phones (prototype hides .slide-caption p) */
@media (max-width: 767px) {
  .haokm-news-slider .et_pb_slide_content {
    display: none;
  }
}

/* ==========================================================================
   Sidebar widgets — box frame + title bar, and the competitions link list.
   Build each box as a Code module (Theme Builder sidebar) containing:
     <div class="haokm-widget">
       <div class="haokm-widget__head">Naslov</div>
       <div class="haokm-widget__body"> … modules / markup … </div>
     </div>
   List rules are scoped under .haokm-widget so they out-specify Divi's
   default .et_pb_text ul/li styling without needing !important.
   ========================================================================== */

/* Card frame */
.haokm-widget {
  background: var(--haokm-white);
  border-radius: var(--haokm-radius);
  box-shadow: var(--haokm-shadow);
  overflow: hidden;
}

/* Black header bar + yellow tick + Montserrat uppercase title */
.haokm-widget__head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--haokm-black);
  color: var(--haokm-white);
  padding: 14px 18px;
  font-family: var(--haokm-font-heading);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.haokm-widget__head::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 18px;
  background: var(--haokm-yellow);
  border-radius: 4px;
}

/* Body padding */
.haokm-widget__body {
  padding: 18px;
}

/* ---- Competitions list (external result links) ---- */
.haokm-widget .haokm-comp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.haokm-widget .haokm-comp-list li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--haokm-gray-border);
}
.haokm-widget .haokm-comp-list li:last-child {
  border-bottom: 0;
}
.haokm-widget .haokm-comp-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 4px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--haokm-black);
  transition: color 0.2s ease, padding-left 0.2s ease;
}
.haokm-widget .haokm-comp-list a:hover,
.haokm-widget .haokm-comp-list a:focus-visible {
  color: var(--haokm-red);
  padding-left: 8px;
}
.haokm-widget .haokm-comp-list a .ext {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--haokm-red);
  opacity: 0.7;
}

/* ---- Partner logo grid (2 per row) — inside a .haokm-widget body ---- */
.haokm-widget .haokm-partneri-grid {
  display: grid;
  /* minmax(0, 1fr) lets tracks shrink below the image's intrinsic width,
     preventing grid blowout (logos overflowing out of the widget). */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.haokm-widget .haokm-partneri-grid a {
  min-width: 0; /* allow the grid item to shrink with its track */
  min-height: 84px; /* uniform cell height; grows if needed, never clips */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--haokm-beige-light);
  border: 1px solid var(--haokm-gray-border);
  border-radius: 10px;
  padding: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.haokm-widget .haokm-partneri-grid a:hover,
.haokm-widget .haokm-partneri-grid a:focus-visible {
  border-color: var(--haokm-red);
  box-shadow: var(--haokm-shadow);
  transform: translateY(-2px);
}
.haokm-widget .haokm-partneri-grid img {
  width: auto; /* override Divi's default img width: 100% so logos keep ratio */
  height: auto;
  max-width: 100%;
  max-height: 52px; /* clamp logo height so tall (portrait) logos aren't cut off */
  object-fit: contain;
  filter: grayscale(0.2);
  transition: filter 0.2s ease;
}
.haokm-widget .haokm-partneri-grid a:hover img,
.haokm-widget .haokm-partneri-grid a:focus-visible img {
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .haokm-widget .haokm-partneri-grid a:hover,
  .haokm-widget .haokm-partneri-grid a:focus-visible {
    transform: none;
  }
}

/* ==========================================================================
   Section heading — Heading module styled like the prototype's .section-head
   (red rounded bar on the left, thin line filling the space on the right).
   Both decorations are pseudo-elements, so no extra markup is needed: just one
   Heading module with the class "haokm-section-head" (Advanced > Attributes).
   ========================================================================== */

/* Container becomes a flex row; its ::after is the line that fills the right. */
.haokm-section-head .et_pb_heading_container {
  display: flex;
  align-items: center;
  gap: 14px;
}
.haokm-section-head .et_pb_heading_container::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  background: var(--haokm-gray-border);
}

/* The heading text itself: uppercase, no margin, room for the left bar.
   Divi names this element .et_pb_module_header (older: .et_pb_heading_text). */
.haokm-section-head .et_pb_module_header,
.haokm-section-head .et_pb_heading_text {
  position: relative;
  flex: 0 1 auto;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 16px;
/*  text-transform: uppercase;
  letter-spacing: 0.5px;*/
  line-height: 1.2;
}

/* Left rounded red bar. */
.haokm-section-head .et_pb_module_header::before,
.haokm-section-head .et_pb_heading_text::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 6px;
  border-radius: 6px;
  background: var(--haokm-red);
}

/* ==========================================================================
   Pagination — DiviFlash Post Grid pagination styled like the prototype's
   .pagination (white pill boxes, red for the current page + hover).
   DiviFlash always outputs .df-pagination with .page-numbers items, so we
   scope to that — no class to add. Current page is a <span class="current">,
   numbers/prev/next are <a>, so both element types are styled together.
   ========================================================================== */

.df-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

/* The boxes — applies to number links, the current page span, and prev/next */
.df-pagination .page-numbers {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;            /* room for word labels like "Novije"/"Starije" */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--haokm-white);
  box-shadow: var(--haokm-shadow);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--haokm-black);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Current page + hover/focus on links → red */
.df-pagination span.page-numbers.current,
.df-pagination a.page-numbers:hover,
.df-pagination a.page-numbers:focus-visible {
  background: var(--haokm-red);
  color: var(--haokm-white);
}

/* The "…" gap (DiviFlash outputs span.dots) — plain text, no box */
.df-pagination .page-numbers.dots {
  background: transparent;
  box-shadow: none;
  min-width: 0;
  padding: 0 4px;
}

/* ==========================================================================
   Single post — article card, styled like the prototype's <article class="article">
   (ai-research/prijedlog/vijest.html). Built in Divi Theme Builder > Single Post
   template as ONE single-column Row with the class "haokm-article" (the white
   card). The Featured Image breaks full-bleed to the top; everything else sits
   in the padded column. Helper classes go on the individual modules; the post
   body (Post Content module) is styled through .haokm-art-text so headings,
   images and galleries written in the editor pick up the look automatically.
   ========================================================================== */

/* The card = the Row */
.haokm-article {
  position: relative;               /* anchor for the absolute category tag */
  background: var(--haokm-white);
  border-radius: var(--haokm-radius);
  box-shadow: var(--haokm-shadow);
  overflow: hidden;
}

/* Column holds the "art-body" padding (prototype: 30px 38px 38px) */
/*.haokm-article .et_pb_column {
  padding: 30px 38px 38px;
}*/

.haokm-article .et_pb_column:first-child {
  padding-bottom: 0;
}

.haokm-article .et_pb_column:first-child + .et_pb_column {
  padding-top: 18px;
}

/* ---- Cover: Featured Image module, class "haokm-art-cover" ----
   Negative margins pull it flush to the card edges (cancels column padding). */
.haokm-article .haokm-art-cover {
  /* margin: -30px -38px 24px !important; */
}
.haokm-article .haokm-art-cover .et_pb_image_wrap,
.haokm-article .haokm-art-cover img {
  display: block;
  width: 100%;
}
.haokm-article .haokm-art-cover img {
  /* aspect-ratio: 16 / 8; */           /* or use Divi 5.5 Section > Aspect Ratio */
  object-fit: cover;
}

/* Category tag overlaid on the cover — a Text module, class "haokm-art-tag" */
.haokm-article .haokm-art-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  margin: 0;
  background: var(--haokm-red);
  color: var(--haokm-white);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 12px;
  border-radius: 6px;
  line-height: 1;
}

/* ---- Meta row (date · author · views) — Text module, class "haokm-art-meta".
   Type the items as <span>…</span> with <span class="dot"></span> between. ---- */
.haokm-article .haokm-art-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--haokm-gray-text);
  margin-bottom: 12px;
}
.haokm-article .haokm-art-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--haokm-gray-border);
}

/* ---- Title (Post Title or Heading module rendering H1) ---- */
.haokm-article h1 {
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  margin: 0 0 18px;
  color: var(--haokm-black);
}

/* ---- Lead paragraph — Text module, class "haokm-lead" ---- */
.haokm-article .haokm-lead {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--haokm-black);
  border-left: 4px solid var(--haokm-red);
  padding-left: 16px;
  margin: 0 0 22px;
}

/* ---- Body — Post Content module, class "haokm-art-text" ----
   Styles the_content() output written in the WordPress editor. */
.haokm-article .haokm-art-text .et-l--post .et_pb_row_0.et_pb_row {
  padding: 0!important;
}
.haokm-article .haokm-art-text p {
  margin: 0 0 16px;
  color: var(--haokm-gray-text);
  font-size: 1.01rem;
}
.haokm-article .haokm-art-text h2 {
  font-size: 1.25rem;
  margin: 28px 0 12px;
  color: var(--haokm-black);
}
.haokm-article .haokm-art-text figure {
  margin: 24px 0;
}
.haokm-article .haokm-art-text figure img {
  border-radius: var(--haokm-radius-sm);
  display: block;
  width: 100%;
}
.haokm-article .haokm-art-text figcaption {
  font-size: 0.82rem;
  color: var(--haokm-gray-text);
  margin-top: 8px;
  text-align: center;
}
/* WordPress Gallery block → match the prototype's 4-up .art-gallery grid */
.haokm-article .haokm-art-text .wp-block-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 24px 0;
}
.haokm-article .haokm-art-text .wp-block-gallery figure {
  margin: 0;
}
.haokm-article .haokm-art-text .wp-block-gallery img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 0.2s ease;
}
.haokm-article .haokm-art-text .wp-block-gallery img:hover {
  transform: scale(1.04);
}

/* ---- Footer: tags + share — Code module, class "haokm-art-foot" ---- */
.haokm-article .haokm-art-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--haokm-gray-border);
  margin-top: 28px;
  padding-top: 20px;
}
.haokm-article .haokm-tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.haokm-article .haokm-tags-row a {
  background: var(--haokm-beige);
  border: 1px solid var(--haokm-gray-border);
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--haokm-black);
  text-decoration: none;
}
.haokm-article .haokm-tags-row a:hover {
  border-color: var(--haokm-red);
  color: var(--haokm-red);
}
.haokm-article .haokm-share {
  display: flex;
  gap: 10px;
  align-items: center;
}
.haokm-article .haokm-share span {
  font-size: 0.82rem;
  font-weight: 700;
}
.haokm-article .haokm-share a {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--haokm-beige);
  transition: background-color 0.2s ease;
}
.haokm-article .haokm-share a:hover {
  background: var(--haokm-red);
}
.haokm-article .haokm-share svg {
  width: 17px;
  height: 17px;
  fill: var(--haokm-black);
}
.haokm-article .haokm-share a:hover svg {
  fill: var(--haokm-white);
}
/* Copy-link "copied" confirmation (toggled by main.js) */
.haokm-article .haokm-share a.haokm-copy.is-copied {
  background: var(--haokm-red);
}
.haokm-article .haokm-share a.haokm-copy.is-copied svg {
  fill: var(--haokm-white);
}

@media (prefers-reduced-motion: reduce) {
  .haokm-article .haokm-art-text .wp-block-gallery img:hover {
    transform: none;
  }
}

/* Tablet / phone — shrink the body padding (prototype @ 768px) */
@media (max-width: 980px) {
  .haokm-article .et_pb_column {
    padding: 22px 20px 28px;
  }
  .haokm-article .haokm-art-cover {
    margin: -22px -20px 24px !important;
  }
  .haokm-article .haokm-art-text .wp-block-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Gallery card title — [haokm_gallery_seasons] / [haokm_photo_albums].

   The component itself lives in main.css; only the h2 is repeated here. The
   shortcodes run inside a Divi Text module, and Divi emits heading typography
   for that module (`.et_pb_text_x h2`, plus its default `h2 { padding-bottom }`)
   in CSS that loads AFTER the child theme stylesheets. Specificity is equal,
   so Divi wins on source order — that is why the album titles rendered far
   larger than the identical season cards: the season page's Text module has no
   heading typography set, the album template's does.

   Size comes from --haokm-gallery-title-size (declared on .haok-gallery-grid
   in main.css) so there is still one place to change it.
   ========================================================================== */
body .haok-gallery-card .haok-gallery-card-content h2 {
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--haokm-font-heading) !important;
  font-size: var(--haokm-gallery-title-size) !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  color: var(--haokm-black) !important;
}
body .haok-gallery-card:hover .haok-gallery-card-content h2 {
  color: var(--haokm-red) !important;
}

/* ---- Add Divi class overrides below ---- */

/* Disable post grid animation */
.difl_postgrid:not(.vb) * {
    transition: none !important;
}

.mfp-container {
    touch-action: pan-y;
    overscroll-behavior-x: contain;
}
