/* ==========================================================================
   Lavkarboklubben – mobiltilpasning (offentlige sider)
   Legges inn ETTER eksisterende stilark. Påvirker ingenting over 760px,
   så desktop-versjonen er uendret.
   Krever: <meta name="viewport" content="width=device-width, initial-scale=1">
   og mobile.js (hamburgermeny + skjuling av tomme artikkelbilder).
   ========================================================================== */

/* Hamburger-knappen settes inn av mobile.js, men vises bare på mobil */
.lk-burger { display: none; }

@media (max-width: 760px) {

  html, body { min-width: 0 !important; width: auto !important; overflow-x: hidden; }
  body { -webkit-text-size-adjust: 100%; }

  /* Alle sentrerte 940/960px-containere blir flytende */
  #header_top .content,
  #content .content,
  #bottom .content,
  .service_content {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
  }

  #content img, #content video { max-width: 100% !important; height: auto !important; }
  #content iframe, #content embed, #content object { max-width: 100% !important; }

  /* ================================================================ HEADER */
  #header_top { height: auto !important; min-height: 64px; position: relative; z-index: 50; }
  #header_top .content { position: relative !important; height: 64px !important; }
  #header_top .logo {
    position: absolute !important;
    left: 16px !important; top: 10px !important;
    width: 190px !important; height: 45px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
  }
  #header_top .logo img { max-height: 45px; width: auto; }

  .lk-burger {
    display: flex !important;
    position: absolute; right: 8px; top: 8px;
    width: 48px; height: 48px;
    align-items: center; justify-content: center; flex-direction: column; gap: 5px;
    background: transparent; border: 0; padding: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .lk-burger span {
    display: block; width: 26px; height: 3px; border-radius: 2px;
    background: #fff; transition: transform .2s, opacity .2s;
  }
  body.lk-nav-open .lk-burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  body.lk-nav-open .lk-burger span:nth-child(2) { opacity: 0; }
  body.lk-nav-open .lk-burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* Menyene skjules og vises som et hvitt nedtrekkspanel */
  #header_top .menu,
  #header_top .menu_add,
  #header_top .help,
  #header_top .login { display: none !important; }

  body.lk-nav-open #header_top .content { height: auto !important; padding-top: 64px !important; padding-bottom: 12px !important; }
  body.lk-nav-open #header_top .menu,
  body.lk-nav-open #header_top .menu_add,
  body.lk-nav-open #header_top .help,
  body.lk-nav-open #header_top .login {
    display: block !important;
    position: static !important;
    width: auto !important; height: auto !important;
    left: auto !important; top: auto !important;
    background: #fff;
    margin: 0 0 1px;
  }
  body.lk-nav-open #header_top .menu { border-radius: 8px 8px 0 0; }
  body.lk-nav-open #header_top .login { border-radius: 0 0 8px 8px; }

  body.lk-nav-open #header_top .menu a,
  body.lk-nav-open #header_top .menu_add a {
    display: block !important;
    padding: 14px 16px !important;
    font-size: 16px !important;
    line-height: 20px;
    border-bottom: 1px solid #e6f3f6;
    color: #228da0 !important;
    font-weight: bold !important;
    text-shadow: none !important;
  }
  body.lk-nav-open #header_top .separator { display: none !important; }

  body.lk-nav-open #header_top .help { padding: 6px 16px; overflow: hidden; }
  body.lk-nav-open #header_top .help .item {
    float: none !important; display: inline-flex !important; align-items: center;
    width: auto !important; height: auto !important;
    margin: 0 24px 0 0 !important; padding: 10px 0;
  }
  body.lk-nav-open #header_top .help .link { font-size: 15px !important; color: #228da0 !important; margin-left: 6px; }

  body.lk-nav-open #header_top .login {
    display: flex !important; flex-wrap: wrap; gap: 10px; padding: 12px 16px;
  }
  body.lk-nav-open #header_top .login > a {
    flex: 1; text-align: center;
    padding: 12px 8px !important; font-size: 15px !important; font-weight: bold;
    border-radius: 6px; border: 1px solid #85cfde;
    color: #228da0 !important; text-decoration: none !important;
  }
  body.lk-nav-open #header_top .login > a.register {
    background: #228da0; border-color: #228da0; color: #fff !important;
  }

  /* Innloggingsskjemaet (åpnes av eksisterende JS) legger seg under knappene */
  #header_top #enter_form {
    position: static !important; order: 3; flex: 0 0 100%;
    width: 100% !important; height: auto !important;
    margin: 4px 0 0 !important; padding: 12px !important;
    box-sizing: border-box; box-shadow: none !important; border-radius: 6px;
  }
  #header_top #enter_form label { display: block; margin-bottom: 8px; font-size: 14px !important; }
  #header_top #enter_form input[type=text],
  #header_top #enter_form input[type=password] {
    width: 100% !important; height: 40px !important; box-sizing: border-box;
    font-size: 16px !important; /* hindrer iOS-zoom */
    padding: 8px;
  }
  #header_top #enter_form .submit {
    position: static !important; display: block; float: none !important;
    width: 100% !important; height: 44px !important; margin: 4px 0 10px !important;
  }

  /* =============================================================== FORSIDE */
  #welcome_top_block {
    height: auto !important;
    background-size: cover !important;
    background-position: 30% 100% !important;
    padding-bottom: 24px;
  }
  #welcome_top_block .content { position: relative !important; height: auto !important; }
  #welcome_top_block .message_closed {
    width: auto !important; height: auto !important;
    padding: 24px 0 8px !important;
    font-size: 15px !important; line-height: 1.5 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,.45);
  }
  #welcome_top_block .message_closed h3 { font-size: 20px !important; line-height: 1.3; margin: 0 0 10px; }
  #welcome_top_block .message_closed p { margin: 0 0 10px; }

  #welcome_top_block .offer,
  #welcome_top_block .offers_bar_container {
    position: static !important;
    width: auto !important; height: auto !important;
    left: auto !important; top: auto !important;
  }
  #welcome_top_block .offer { margin-top: 70px; }   /* lar grønnsaksbildet titte frem */
  #welcome_top_block .offer .title { width: auto !important; font-size: 16px !important; text-shadow: 0 1px 3px rgba(0,0,0,.45); }

  /* «Dette får du som medlem»: 4 kolonner -> 2x2 rutenett */
  #welcome_offers_bar { display: block !important; width: auto !important; height: auto !important; }
  #welcome_top_block .items_container {
    display: grid !important; grid-template-columns: 1fr 1fr; gap: 1px;
    width: auto !important; height: auto !important;
    background-color: rgba(34,141,160,.88) !important;
    background-image: none !important;
    border-radius: 6px; overflow: hidden; margin-top: 8px;
  }
  #welcome_top_block .items_container .item {
    display: block !important; width: auto !important; height: auto !important;
    padding: 12px !important; box-sizing: border-box;
    font-size: 13px !important; line-height: 1.35 !important; color: #fff !important;
    background: rgba(34,141,160,.92);
  }
  #welcome_top_block .items_container .item img { float: none !important; display: block; margin: 0 0 6px; }
  #welcome_top_block .items_container .item span { display: block !important; width: auto !important; color: rgba(255,255,255,.88) !important; }
  #welcome_top_block .items_container .item b { color: #fff !important; }

  /* Eksperter / suksesshistorier: to kolonner -> under hverandre */
  .peoples { height: auto !important; }
  .peoples .content { padding-top: 24px !important; padding-bottom: 8px !important; height: auto !important; }
  .peoples .item {
    float: none !important; display: block !important;
    width: auto !important; height: auto !important;
    margin: 0 0 28px !important; overflow: hidden;
  }
  .peoples .item .title { width: auto !important; font-size: 18px !important; margin-bottom: 12px; }
  .peoples .item .photo { width: 96px !important; height: 96px !important; margin: 0 14px 8px 0 !important; }
  .peoples .item .photo img { width: 96px !important; height: 96px !important; object-fit: cover; }
  .peoples .item .info { margin-left: 0 !important; width: auto !important; height: auto !important; }
  .peoples .item .photo + .info { margin-left: 110px !important; }
  .peoples .item .info .name,
  .peoples .item .info .expert_profile { width: auto !important; }
  .peoples .item .expert_description,
  .peoples .item .success_descr1,
  .peoples .item .success_descr2 {
    width: auto !important; height: auto !important; max-height: none !important;
    font-size: 14px !important; line-height: 1.45 !important;
  }
  .peoples .item .expert_button { margin-top: 12px; }

  /* Ikonraden (Medlemsfordeler / Kostdagbok / Hva er lavkarbo?) – beholder 3 kolonner */
  .bottom_bar { height: auto !important; }
  .bottom_bar .content {
    display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 8px;
    padding-top: 24px !important; padding-bottom: 24px !important; height: auto !important;
  }
  .bottom_bar .item {
    float: none !important; position: static !important;
    width: auto !important; height: auto !important; margin: 0 !important;
    text-align: center;
  }
  .bottom_bar .item .icon { width: auto !important; height: auto !important; }
  .bottom_bar .item .icon img { width: 64px !important; height: 64px !important; }
  .bottom_bar .item .title { width: auto !important; height: auto !important; font-size: 13px !important; line-height: 1.2 !important; margin-top: 6px; }
  .bottom_bar .item .description { width: auto !important; height: auto !important; font-size: 11px !important; line-height: 1.3 !important; }

  /* ================================================================ FOOTER */
  #bottom { height: auto !important; background-size: auto 100% !important; }
  #bottom .content { position: relative !important; height: auto !important; padding-top: 24px !important; padding-bottom: 24px !important; }
  #bottom .menu,
  #bottom .copy,
  #bottom .devel {
    position: static !important; width: auto !important; height: auto !important;
    left: auto !important; top: auto !important;
  }
  #bottom .menu { display: flex !important; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 24px; }
  #bottom .menu .item { display: inline-block; padding: 8px 0; font-size: 14px !important; float: none !important; margin: 0 !important; }
  #bottom .social { position: static !important; }
  #bottom .copy { margin-bottom: 8px; }
  #bottom .devel { text-align: left !important; }

  /* ======================================================= INNHOLDSSIDER */
  .old_main_content { width: auto !important; height: auto !important; }
  .service_content { padding-top: 16px !important; padding-bottom: 24px !important; height: auto !important; }
  .service_title_located { width: auto !important; font-size: 22px !important; line-height: 1.25 !important; height: auto !important; }
  .article_text { width: auto !important; font-size: 15px !important; line-height: 1.55 !important; }
  .article_text table { display: block; width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .article_text td, .article_text th { min-width: 90px; }

  /* Artikler / Hjelp: tabell-layout (kategorier | liste) -> kategorier som «chips» over listen */
  #articles > table,
  #articles > table > tbody,
  #articles > table > tbody > tr,
  #articles > table > tbody > tr > td { display: block !important; width: auto !important; padding: 0 !important; }
  #articles > table > tbody > tr > td:first-child {
    display: flex !important; flex-wrap: wrap; gap: 6px;
    padding-bottom: 8px !important; border-bottom: 1px solid #eee;
  }
  .service_group_ { float: none !important; width: auto !important; height: auto !important; margin: 0 !important; }
  #articles .service_group_ {
    display: inline-flex !important; align-items: center; gap: 6px;
    padding: 5px 6px 5px 12px !important;
    border: 1px solid #cfe9ef; border-radius: 16px; background: #fff;
  }
  #articles .service_group_ a { padding: 0 !important; margin: 0 !important; font-size: 13px !important; }
  #articles .service_group_ .count { position: static !important; float: none !important; margin: 0 !important; }

  .search_block {
    float: none !important; position: static !important;
    display: flex !important; gap: 8px;
    width: auto !important; margin: 16px 0 !important;
  }
  .search_block form { display: flex !important; gap: 8px; width: 100% !important; }
  .search_block input.text { flex: 1; width: auto !important; min-width: 0; font-size: 16px !important; box-sizing: border-box; }
  .search_block .button_narrow { flex: 0 0 auto; float: none !important; position: static !important; }

  .articles_list_item {
    width: auto !important; height: auto !important; margin-left: 0 !important;
    overflow: hidden; padding-bottom: 16px; float: none !important;
  }
  .articles_list_item .photo { width: 80px !important; height: auto !important; margin-right: 12px; }
  .articles_list_item .title,
  .articles_list_item .annotation { width: auto !important; height: auto !important; margin-left: 92px !important; }
  .articles_list_item .annotation { font-size: 14px !important; line-height: 1.45 !important; }
  /* Tomme 1x1-plassholderbilder (merkes av mobile.js) tar ikke plass */
  .articles_list_item.lk-nophoto .photo { display: none !important; }
  .articles_list_item.lk-nophoto .title,
  .articles_list_item.lk-nophoto .annotation { margin-left: 0 !important; }

  /* Suksesshistorier */
  .button_tell_story { float: none !important; margin: 0 0 16px !important; display: inline-block; }
  .story_list_item {
    width: auto !important; height: auto !important; margin-left: 0 !important;
    padding: 16px 0 !important; overflow: hidden;
  }
  .story_list_item .photos {
    float: none !important; width: auto !important; height: auto !important;
    display: flex; gap: 8px; margin-bottom: 10px;
  }
  .story_list_item .photos .item { width: 96px !important; height: 96px !important; float: none !important; margin: 0 !important; }
  .story_list_item .photos .item img { width: 96px !important; height: 96px !important; object-fit: cover; }
  .story_list_item .title,
  .story_list_item .note,
  .story_list_item .description { width: auto !important; height: auto !important; margin-left: 0 !important; }
  .story_list_item .description { font-size: 14px !important; line-height: 1.45 !important; }

  /* Popup-vinduer (kontakt o.l.) */
  #mandatory_window, .mandatory_window, .popup_window {
    width: auto !important; left: 12px !important; right: 12px !important; margin-left: 0 !important;
  }
}
