/* ================================
   NAVBAR
================================ */
#mainNavbar {
  padding-top: 2rem;
  padding-bottom: 1rem;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.navbar a,
.navbar-brand {
  color: var(--link-color);
  font-weight: bold;
  font-size: 14pt;
}
.navbar a:hover,
.navbar a:focus { color: var(--link-hover-color); }
.navbar-nav .current-menu-item > a,
.navbar-nav .current_page_item > a {
  color: var(--active-link-color);
  font-weight: bold;
}
.navbar-nav { padding-right: 2rem; }
#mainNavbar .custom-logo {
  max-height: 40px;
  height: auto;
  width: auto;
}
.bg-almost-black { background-color: #0d0d0d !important; }

/* ================================
   HERO
================================ */
.hero-section{
  position: relative;
  width: 100%;
  min-height: var(--hero-min-h, 520px);
  /* Stabil viewport-enhet: */
  height: 100svh; /* iOS/Android hanterar adressraden bättre */
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--hero-text-color, #fff);
}

@supports (height: 100dvh){
  .hero-section{ height: 100dvh; } /* modern browsers */
}

/* Bakgrunder */
.hero-video,
.hero-img,
.hero-yt-iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center; /* justera vid behov */
  z-index: -2;
}
.hero-img.fallback{ background:#222; }
.hero-overlay{
  position: absolute; inset: 0;
  background: rgba(0,0,0,var(--hero-overlay, .5));
  z-index: -1;
}

.hero-section + * { margin-top: 0; }

/* Lazy YouTube knapp */
.hero-yt-lazy{
  position:absolute; inset:0; width:100%; height:100%;
  background-size: cover; background-position:center;
  border:0; padding:0; cursor: pointer; z-index:-2; /* ligger bakom overlay */
}
.hero-yt-play{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:64px; height:64px; border-radius:50%;
  display:grid; place-items:center; font-size:28px; line-height:1;
  background:rgba(255,255,255,.7);
}

#hero-rotator { position: relative; width: 100%; }

#hero-rotator .rotator-item{
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .75rem;

  /* fade-läge */
  opacity: 0;
  pointer-events: none;
  z-index: 0;

  will-change: opacity;
  transition: opacity .6s ease;
}

#hero-rotator .rotator-item.active{
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* Säkerställ att knappen inte sträcks */
.hero-button-custom{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  white-space: nowrap;
}

/* Debug */
/*#hero-rotator .rotator-item [data-aos] { 
  opacity: 1 !important; transform: none !important; transition: none !important;
}*/



.hero-title{ 
  margin:0 0 .35rem 0; 
  font-weight:700;
  /* mobil → desktop */
  font-size: clamp(28px, 4.5vw + 0.4rem, 56px);
}
.hero-lead{
  margin:0; opacity:.95;
  font-size: clamp(16px, 2.2vw + .4rem, 22px);
  max-width: 78ch; margin-inline:auto;
}
.hero-text-wrapper{ position: relative; z-index: 1; }

/* CTA-knapp */
.hero-button-custom{
  width: auto;
  background: transparent;
  display: inline-flex; 
  align-items: center;
  color: var(--btn-color, #fff);
  border: 2px solid currentColor;
  transition: background-color .25s, color .25s, border-color .25s;
}
.hero-button-custom:hover{
  background: var(--btn-hover, #0b5ed7);
  color:#fff; border-color: var(--btn-hover, #0b5ed7);
}
.hero-text-wrapper{ max-width: 900px; margin-inline: auto; }
@media (max-width: 576px){
  .hero-button-custom{ padding:.5rem 1rem; font-size:1rem; }
}


/* Mobiljusteringar */
@media (max-width: 576px){
  .hero-section{ min-height: 420px; }
  /* Dölj video på små skärmar om den ändå skulle råka röra sig igenom */
  
}

/* Lägg till i style.css */
.hero-video,
.hero-img { 
  object-position: var(--hero-focus-x, 50%) var(--hero-focus-y, 50%);
}

/* På mobil: lyft fokus lite uppåt (= 35% från toppen) */
@media (max-width: 576px){
  .hero-section{
    --hero-focus-x: 50%;
    --hero-focus-y: 35%;
  }
}

/* liggande läge på mobiler/tablets */
@media (orientation: landscape) and (max-width: 992px){
  .hero-section{ height: 75dvh; min-height: 360px; }
}
@media (min-width: 992px){
  .hero-button-custom{ padding: .7rem 1.25rem; }
}

/* ================================
   FEATURED / COVER IMAGES
================================ */
.page-featured-image {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
}
.page-featured-image img,
.single-hero__img {
  object-fit: cover;
  width: 100%;
  height: clamp(220px, 45vh, 540px);
  display: block;
}

/* Single hero overlay */
.single-hero {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
}
.single-hero__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  background: linear-gradient(to top,
    rgba(0,0,0,0.45) 0%,
    rgba(0,0,0,0.15) 40%,
    rgba(0,0,0,0) 75%);
  padding-bottom: clamp(16px, 4vw, 48px);
  max-width: 100%;
  overflow-x: hidden;
}

/* ================================
   BLOG LIST (archive/home)
================================ */
.blog-list-wrap {
  padding-top: clamp(24px, 4vw, 72px);
  padding-bottom: clamp(32px, 5vw, 96px);
}
.blog-list { display: grid; gap: 1.25rem; }

/* Card */
.bl-item {
  position: relative;
  display: grid;
  grid-template-columns: 35% 65%;
  align-items: stretch;
  gap: 1rem;
  text-decoration: none;
  color: var(--ph-card-text, var(--text-color));
  background: var(--ph-card-bg, var(--bs-body-bg, #fff));
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.bl-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.12);
}

/* Bildkolumn */
.bl-media {
  position: relative;
  width: 100%;
  align-self: stretch;
  min-height: 220px;
  overflow: hidden;
}
.bl-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-thumb--placeholder { width: 100%; height: 100%; background: linear-gradient(135deg,#1c2a38,#92bde9); }

/* Textkolumn */
.bl-body {
  padding: 1rem 1rem 1rem 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: .5rem;
}
.bl-title {
  display: block;
  margin: 0 0 .35rem 0;
  line-height: 1.2;
  font-weight: 700;
  font-size: clamp(1.05rem, 1vw + .85rem, 1.35rem);
}
.bl-title, .bl-excerpt, .bl-cats, .bl-cat { color: inherit; }
.bl-title a, .bl-media-link { color: inherit; text-decoration: none; }
.bl-title a:hover { text-decoration: underline; }

.bl-cats {
  margin-bottom: .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
}
.bl-cat {
  background: rgba(13,110,253,.18);
  color: inherit;
  border-radius: 999px;
  padding: .3rem .6rem;
  font-size: .86rem;
}

/* Meta/Tags inne i kort */
.bl-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  margin-bottom: .4rem;
  opacity: .9;
}
.bl-author a { color: inherit; text-decoration: none; }
.bl-author a:hover { text-decoration: underline; }
.bl-date { color: inherit; opacity: .85; }
.bl-meta-sep { opacity: .5; }

.bl-tags {
  display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-bottom: .5rem;
}
.bl-tag {
  font-size: .78rem;
  line-height: 1;
  padding: .28rem .5rem;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  background: rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.08);
}
.bl-tag:hover { text-decoration: underline; }

/* Pagination */
.pagination ul {
  display: flex; gap: .5rem; list-style: none; padding: 0; margin: 1.25rem 0 0;
}
.pagination a,
.pagination span {
  display: inline-block;
  padding: .5rem .75rem;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  text-decoration: none;
  color: inherit;
}
.pagination .current {
  background: #0d6efd; color: #fff; border-color: #0d6efd;
}

/* ================================
   SINGLE POST (under hero)
================================ */
.post-meta {
  display: flex;
  align-items: center;
  gap: .75rem 1.25rem;
  flex-wrap: wrap;
  padding: clamp(12px, 2vw, 18px) 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.post-meta__left { display: grid; gap: .35rem; }

.post-meta__row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.post-meta__author a { color: inherit; text-decoration: none; font-weight: 600; }
.post-meta__author a:hover { text-decoration: underline; }

.post-meta__cats {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem;
}
.post-meta__cat {
  font-size: .9rem; line-height: 1; padding: .35rem .6rem;
  background: rgba(13,110,253,.08); color: #0d6efd;
  border-radius: 999px; text-decoration: none;
}
.post-meta__cat:hover { text-decoration: underline; }
.post-meta__sep { opacity: .4; margin: 0 .25rem; }
.post-meta__date { color: #6c757d; font-size: .95rem; }

.post-meta__tags {
  display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center;
}
.post-meta__tag {
  font-size: .8rem; line-height: 1; padding: .3rem .55rem;
  border-radius: 999px; text-decoration: none; color: inherit;
  background: rgba(0,0,0,.06); border: 1px solid rgba(0,0,0,.09);
}
.post-meta__tag:hover { text-decoration: underline; }

.single-post .single-content > *:first-child { margin-top: 0; }

/* Archive header */
.archive-header {
  padding-bottom: .5rem; margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08); /* justera för ljust tema */
}
.archive-title {
  margin: 0 0 .25rem 0;
  font-size: clamp(1.25rem, 1.2vw + 1rem, 1.75rem);
  font-weight: 800;
}
.archive-description { opacity: .85; }

/* ================================
   KOMMENTARER
================================ */
.ph-comments-wrap { max-width: 100%; overflow-x: hidden; position: relative; }

#ph-commentform,
#ph-commentform > * { min-width: 0; max-width: 100%; }

#ph-commentform input[type="text"],
#ph-commentform input[type="email"],
#ph-commentform input[type="url"],
#ph-commentform textarea {
  display: block; width: 100%; max-width: 100%; box-sizing: border-box;
  background: #111; color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; padding: .75rem 1rem;
}
#ph-commentform .required { color: #dc3545; }

#ph-commentform .comment-form-cookies-consent {
  display: flex; align-items: flex-start; gap: .5rem;
  flex-wrap: wrap; white-space: normal;
}
#ph-commentform .comment-form-cookies-consent label {
  min-width: 0; max-width: 100%; white-space: normal;
}
#ph-commentform .form-submit { max-width: 100%; }
#ph-submit { max-width: 100%; }

.ph-comments-wrap * { word-break: break-word; overflow-wrap: anywhere; }

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 768px) {
  /* Blog cards stack */
  .bl-item { grid-template-columns: 1fr; gap: .75rem; }
  .bl-media { min-height: 0; aspect-ratio: 16/9; }
  .bl-body  { padding: .75rem .9rem 1rem .9rem; }

  /* Post meta layout */
  .post-meta { flex-direction: column; align-items: flex-start; }
}

/* Små videos i kolumner (om du använder klassen) */
.video-column { max-height: 200px; margin: 0 auto; }


/* Låt Custom HTML-block behålla leverantörens (Instagram m.fl.) egen layout */
.wp-block-html img,
.wp-block-html video,
.wp-block-html iframe {
  /* neutralisera globala regler */
  max-width: none !important;
  height: auto !important;
  display: inline !important; /* många embeds förväntar inline-beteende */
  border: 0;
}

/* Vissa Instagram-embeds använder ratio-box + absolut positionerade lager */
.wp-block-html .EmbedFrame,
.wp-block-html .EmbeddedMedia {
  position: static;          /* låt inbäddarens CSS styra */
  overflow: visible;         /* förhindra att saker klipps */
}

/* (valfritt) säkerställ att våra lightbox-regler inte spiller över */
.wp-block-html .wp-lightbox-overlay,
.wp-block-html .lightbox-trigger {
  display: initial !important;
}

/* --- Fixa att Instagram/embeds får styra sin egen höjd --- */
.instagram-media iframe,
.wp-block-embed iframe,
.wp-embed-aspect-16-9 iframe,
.wp-embed-aspect-4-3 iframe,
.wp-embed-aspect-1-1 iframe,
.wp-block-html iframe {
  width: 100% !important;
  height: 100% !important;  /* överstyr height:auto från theme-styles.css */
  display: block;
}

/* (säkerhetsbälte) se till att kortet inte klipps av någon overflow */
blockquote.instagram-media { overflow: visible !important; }

