/* Staging — desktop header for Halo #38307. */
.front-desktop-nav { display: none; }
.wang-ung-brand-label { display: none; }
.front-search-panel { display: none; }

/* Use the same header design from normal laptop width upward. */
@media (min-width: 1024px) {
  #site-header { position: relative; z-index: 10; display: flow-root; }
  #site-header-inner { position: absolute; z-index: 100; top: 0; right: 0; left: 0; width: 100%; max-width: none; height: 90px; background: #fcfafa; }
  body.admin-bar #site-header-inner { top: 0; }
  .home .page-header.front-page { margin-top: 0; }
  /* The navigation is absolute so legacy page heroes must reserve its height.
     Keep the front page flush with its first editable block. */
  body:not(.home) #site-header { padding-top: 90px; }
  .page-id-41 #site-header-inner { background: #fcfafa; }
  .home .page-header.front-page .hero-buttons .button { background: rgba(13,41,70,.65); border-color: rgba(13,41,70,.65); color: #fff; }
  .home .page-header.front-page .hero-buttons .button:hover, .home .page-header.front-page .hero-buttons .button:focus-visible { background: rgba(23,68,111,.78); border-color: rgba(23,68,111,.78); color: #fff; }
  /* Keep the primary brand mark prominent: the shield rests slightly into the hero. */
  #site-header-inner .logo { z-index: 30; top: 7px; left: max(5vw, 64px); width: 250px; max-width: none; height: 98px; background: transparent; }
  #site-header-inner .logo a { position: relative; display: block; height: 100px; }
  #site-header-inner .logo a::after { content: 'WANG'; position: absolute; top: 26px; left: 106px; color: #0d2946; font: 700 28px/1 'Montserrat', sans-serif; letter-spacing: -.02em; }
  .page-id-41 #site-header-inner .logo { width: 250px; }
  .page-id-41 #site-header-inner .logo a::after { display: none; }
  .page-id-41 #site-header-inner .wang-ung-brand-label { position: absolute; top: 25px; left: 84px; display: inline-flex; align-items: center; gap: 9px; color: #0d2946; font: 700 24px/1 'Montserrat', sans-serif; letter-spacing: -.02em; white-space: nowrap; }
  .page-id-41 #site-header-inner .wang-ung-brand-label i { display: block; flex: 0 0 1px; width: 1px; height: 24px; margin: 0 1px; background: rgba(13,41,70,.55); }
  /* The W aligns to the navigation's centre while the point of the shield overlaps the hero. */
  #site-header-inner .logo .desktop { position: relative; width: 102px; max-width: none; height: 102px; overflow: visible; transform: translateY(-2px); background: none; }
  #site-header-inner .logo .desktop::before { content: ''; position: absolute; inset: 0; z-index: 0; background: #fff; clip-path: polygon(8% 0, 92% 0, 92% 76%, 91% 82%, 88% 87%, 83% 91%, 77% 93%, 61% 93%, 50% 100%, 39% 93%, 23% 93%, 17% 91%, 12% 87%, 9% 82%, 8% 76%); transform: scale(1.08); }
  #site-header-inner .logo .desktop::after { content: ''; position: absolute; inset: 1px; z-index: 1; background: center / contain no-repeat url('/wp-content/themes/wang/dist/images/wang-fav.svg'); }
  #site-header-inner .logo .desktop img { display: none; }
  #primary-menu { display: none; }
  .front-desktop-nav { display: flex; position: absolute; inset: 0; z-index: 20; align-items: center; justify-content: center; padding: 0 max(2vw, 26px); background: transparent; font-family: 'Montserrat', sans-serif; }
  .page-id-41 .header-wrapper { padding-top: 0; background: transparent; }
  .front-nav-links { display: flex; align-items: center; gap: clamp(17px, 1.25vw, 25px); }
  .front-nav-links--left { position: static; right: auto; left: auto; width: auto; margin: 0; }
  .front-nav-links--left::after { display: none; }
  .front-nav-mega { position: static; }
  .front-nav-links--right { position: absolute; right: max(3vw, 42px); margin: 0; gap: 18px; }
  .front-nav-links a, .front-nav-mega summary { position: relative; color: #0d2946; font-size: 18px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; list-style: none; }
  .front-nav-mega summary::-webkit-details-marker { display: none; }
  .front-nav-mega summary span, .front-nav-links a span { display: none; }
  .front-nav-mega summary::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 12px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s ease; }
  .front-nav-links > a, .front-nav-mega summary { transition: color .22s ease; }
  .front-nav-links > a::after, .front-nav-mega summary::before { content: ''; position: absolute; right: 0; bottom: -10px; left: 0; height: 2px; background: #349892; transform: scaleX(0); transform-origin: right center; transition: transform .24s ease; }
  .front-nav-links > a:hover, .front-nav-links > a:focus-visible, .front-nav-mega summary:hover, .front-nav-mega summary:focus-visible, .front-nav-mega[open] summary { color: #2e857d; }
  .front-nav-links > a:hover::after, .front-nav-links > a:focus-visible::after, .front-nav-mega summary:hover::before, .front-nav-mega summary:focus-visible::before, .front-nav-mega[open] summary::before { transform: scaleX(1); transform-origin: left center; }
  .front-nav-mega[open] summary::after { transform: rotate(225deg) translate(-3px, -3px); }
  .front-nav-divider { display: block; height: 30px; width: 1px; background: rgba(13,41,70,.24); }
  .front-nav-links--right a[href*="minside"] { display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border: 1px solid rgba(13,41,70,.22); border-radius: 24px; background: rgba(255,255,255,.38); }
  .front-nav-links--right a[href*="minside"]::before { content: ''; display: block; width: 16px; height: 16px; background: center / 16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230d2946' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.25'/%3E%3Cpath d='M5 21c.8-4.1 3.1-6.2 7-6.2s6.2 2.1 7 6.2'/%3E%3C/svg%3E"); }
  .front-nav-search { display: inline-flex !important; align-items: center; justify-content: center; gap: 9px; height: 44px; padding: 0 19px; border: 1px solid rgba(13,41,70,.28); border-radius: 24px; font-size: 16px !important; font-weight: 500 !important; line-height: 1 !important; }
  .front-nav-search::before { content: ''; display: block; flex: 0 0 18px; width: 18px; height: 18px; background: center / 18px 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d2946' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.8' cy='10.8' r='5.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E"); }
  .front-search-panel { position: fixed; z-index: 120; top: 90px; left: 50%; display: none; width: min(90vw, 720px); transform: translateX(-50%); padding: 26px 30px; background: #fff; border-top: 3px solid #349892; border-radius: 0; box-shadow: 0 18px 28px rgba(13,41,70,.2); }
  body.admin-bar .front-search-panel { top: 122px; }
  .front-search-panel.is-open { display: block; }
  .front-search-panel form { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; }
  .front-search-panel label { grid-column: 1 / -1; color: #5d6b7b; font: 600 14px/1 'Montserrat', sans-serif; letter-spacing: .08em; text-transform: uppercase; }
  .front-search-panel input { min-width: 0; height: 48px; padding: 0 16px; border: 1px solid rgba(13,41,70,.3); border-radius: 0; color: #0d2946; font: 500 16px/1 'Montserrat', sans-serif; }
  .front-search-panel button { height: 48px; padding: 0 20px; border: 0; border-radius: 0; background: #349892; color: #fff; font: 600 16px/1 'Montserrat', sans-serif; cursor: pointer; }
  .front-search-panel .front-search-close { width: 48px; padding: 0; background: transparent; border: 1px solid rgba(13,41,70,.3); color: #0d2946; font-size: 28px; font-weight: 300; }
  .front-mega-panel { position: absolute; z-index: 40; top: 90px; left: 50%; right: auto; width: min(90vw, 1440px); transform: translate(-50%, -10px); display: grid; grid-template-columns: 320px minmax(200px, .42fr) minmax(0, 1.58fr); min-height: 370px; padding: 0; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .24s ease, transform .24s ease, visibility 0s linear .24s; background: #fff; border-top: 3px solid #349892; box-shadow: 0 18px 28px rgba(13,41,70,.2); border-radius: 0; font-family: 'Montserrat', sans-serif; }
  .front-nav-mega[open] .front-mega-panel { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); transition-delay: 0s; }
  .front-mega-image { min-height: 370px; height: 100%; background: url('https://wang-staging.microsupport.no/content/2021/10/mbr-20190905-3350-2048x1367.jpg') 55% center/cover no-repeat; border-radius: 0; }
  .front-nav-mega--schools .front-mega-image { background-image: url('https://wang-staging.microsupport.no/content/2021/10/u6a1319-768x960.jpg'); background-position: center center; }
  .front-nav-mega--toppidrett .front-mega-image, .front-nav-mega--sports .front-mega-image, .front-nav-mega:nth-child(2) .front-mega-image { background-image: url('https://wang-staging.microsupport.no/content/2021/10/turn-1-1024x1536.jpg'); background-position: 64% center; }
  .front-mega-column { padding: 38px 30px 0; border-left: 1px solid rgba(13,41,70,.12); }
  .front-mega-image + .front-mega-column { border-left: 0; }
  .front-mega-label { margin: 0 0 20px; color: #5d6b7b; font-size: 14px; font-weight: 600; letter-spacing: .08em; }
  .front-mega-column a { display: flex; justify-content: space-between; gap: 20px; margin: 0 0 16px; color: #0d2946; font-size: 15px !important; font-weight: 500; transition: color .2s ease, padding-left .2s ease; }
  .front-mega-column a:hover, .front-mega-column a:focus-visible { padding-left: 7px; color: #57c0b8 !important; }
  .front-mega-column a span { color: currentColor; font-size: 25px; line-height: .6; transition: transform .2s ease; }
  .front-mega-column a:hover span, .front-mega-column a:focus-visible span { transform: translateX(5px); }
  .front-mega-list { columns: 1; }
  .front-mega-list--two-columns { columns: 2; column-gap: 38px; }
  .front-mega-column--wide { min-width: 390px; }
  .front-nav-mega--sports .front-mega-panel { grid-template-columns: 320px minmax(200px, .42fr) minmax(0, 1.58fr); min-height: 370px; }
  .front-nav-mega--sports .front-mega-column--wide { min-width: 440px; }
  .front-nav-mega--sports .front-mega-list--two-columns { column-gap: 30px; }
  .front-nav-mega--sports .front-mega-list--two-columns a { font-size: 16px; }
  .front-mega-list a { break-inside: avoid; }
  .front-mega-column:last-child .front-mega-list { columns: 3; column-gap: 16px; }
  .front-mega-column:last-child .front-mega-list a { margin-bottom: 16px; font-size: 15px; break-inside: avoid; }
  .front-mega-more { margin-top: 32px !important; padding-top: 22px; border-top: 1px solid rgba(13,41,70,.14); color: #2e857d !important; }

  /* The existing theme uses red for current menu items. Keep this redesigned navigation teal instead. */
  .front-desktop-nav a, .front-desktop-nav summary { color: #0d2946 !important; }
  .front-desktop-nav a:hover, .front-desktop-nav a:focus-visible,
  .front-desktop-nav .current-menu-item > a, .front-desktop-nav .current_page_item > a { color: #2e857d !important; }
  .front-desktop-nav .front-mega-more { color: #349892 !important; }
}

/* The front page starts directly with its first editable block. */
.home .entry-content { padding-top: 0; }
.home .entry-content > :first-child { margin-top: 0 !important; }

/* Let the front-page hero fill the complete first viewport. */
@media (min-width: 768px) {
  .home .block-hero-banner.hero-banner--height-full {
    --hero-banner-height: 100svh !important;
  }
}

/* Block library: descriptions make the examples useful as an editorial reference. */
.page-id-20765 .entry-content > .block-library-intro { max-width: 900px; margin: 0 auto 64px; padding: 38px 42px; background: #eef8fc; border-top: 3px solid #349892; color: #0d2946; }
.page-id-20765 .entry-content > .block-library-intro h2 { margin: 0 0 14px; font-family: 'Montserrat', sans-serif; font-size: clamp(30px, 3.4vw, 48px); line-height: 1.05; }
.page-id-20765 .entry-content > .block-library-intro p { max-width: 68ch; margin: 0; font-size: 17px; line-height: 1.6; }
.page-id-20765 .entry-content > .block-library-heading { width: min(1180px, 90%); margin: 92px auto 10px; color: #0d2946; font-family: 'Montserrat', sans-serif; font-size: clamp(30px, 3vw, 42px); line-height: 1.1; }
.page-id-20765 .entry-content > .block-library-description { width: min(1180px, 90%); max-width: 1180px; margin: 0 auto 30px; color: #46576a; font-size: 17px; line-height: 1.55; }
.page-id-20765 .entry-content > .block-library-description .block-library-badge { display: inline-block; margin-right: 10px; padding: 5px 9px; background: #349892; color: #fff; font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .06em; line-height: 1; text-transform: uppercase; vertical-align: 1px; }
@media (max-width: 767px) { .page-id-20765 .entry-content > .block-library-intro { margin-bottom: 42px; padding: 28px 24px; } .page-id-20765 .entry-content > .block-library-heading { margin-top: 62px; } }

/* Hold the centred navigation and the actions apart on narrower desktops. */
@media (min-width: 1024px) and (max-width: 1360px) {
  .front-nav-links { gap: 14px; }
  .front-nav-links a, .front-nav-mega summary { font-size: 16px; }
  .front-nav-links--right { right: 20px; gap: 12px; }
  .front-nav-links--right a[href*="minside"] { padding: 11px 14px; }
  .front-nav-search { width: 42px; height: 42px; padding: 0; font-size: 0 !important; }
  .front-nav-search::before { flex-basis: 18px; transform: translateX(2px); }
}

/* Compact ordinary page headers on phones without affecting the front page. */
@media (max-width: 767px) {
  /* School and sport detail pages: keep the mobile hero focused on its content. */
  .header-wrapper .page-header.parent-page .page-header-wrapper .header-image {
    display: none;
  }

  .header-wrapper .page-header.sub-page .page-header-wrapper {
    min-height: 0;
    padding: 38px 0 32px;
  }

  .header-wrapper .page-header.sub-page .page-header-wrapper .header-content {
    width: 100%;
  }

  .header-wrapper .page-header.sub-page .page-header-wrapper .header-content h1 {
    margin: .35em 0 .45em;
    font-size: clamp(30px, 8vw, 38px);
    line-height: 1.18;
  }
}

/* Keep ordinary content and archive pages compact below the global header.
   School/discipline hero pages use .parent-page and are intentionally excluded. */
@media (min-width: 768px) {
  .header-wrapper .page-header.sub-page:not(.contact) .page-header-wrapper {
    min-height: 300px;
    margin-top: 48px;
    width: min(956px, calc(100% - 48px));
    padding-left: 0;
  }

  #site-footer {
    margin-top: 64px;
  }
}

@media (max-width: 767px) {
  #site-footer {
    margin-top: 40px;
  }
}

/* When only one school matches, show it as a clear link instead of an empty-looking dropdown. */
.block-find .find.find--single .find-single-link {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 1.55em 2.15em;
  border: 1px solid #2e605c;
  background: #2e605c;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  text-transform: uppercase;
}
.block-find .find.find--single .find-single-link::after {
  content: '→';
  font-size: 1.2em;
}
.block-find .find.find--single .find-single-link:hover,
.block-find .find.find--single .find-single-link:focus-visible {
  background: #0c0705;
  border-color: #0c0705;
}
@media (max-width: 899px) {
  .block-find .find.find--single .find-single-link {
    width: 100%;
    justify-content: space-between;
  }
}

/* Fix search/archive pages: restore legacy navigation when the staging replacement is absent. */
@media (min-width: 768px) {
  body.search #primary-menu { display: block; }
  body.search .header-wrapper .page-header.sub-page .page-header-wrapper {
    min-height: 0;
    margin-top: 0;
    padding-top: 28px;
    padding-bottom: 28px;
  }
}

/* Search desktop: use the hamburger navigation control instead of full menu. */
@media (min-width: 768px) {
  body.search #primary-menu { display: block; }
  body.search #primary-menu #main-menu-toggle { display: block; position: absolute; top: 24px; right: 32px; z-index: 140; }
  body.search #primary-menu #main-menu-toggle button { display: block; width: 44px; height: 36px; padding: 0; border: 0; background: transparent; color: #0d2946; font-size: 28px; line-height: 36px; cursor: pointer; }
  body.search #primary-menu #main-menu-toggle .collapse { display: none; }
  body.search #primary-menu #main-menu { display: none; }
}

/* Search desktop final: full navigation, no hamburger. */
@media (min-width: 768px) {
  body.search #primary-menu #main-menu-toggle { display: none; }
  body.search #primary-menu #main-menu { display: block; }
}

/* Search pages use the same desktop header as the rest of the site. */
@media (min-width: 1024px) {
  body.search .front-desktop-nav { display: flex; }
  body.search #primary-menu { display: none; }
}

/* Contact page: remove excessive empty space above contact content. */
@media (min-width: 768px) {
  body.page-id-275 .page-header.sub-page.contact .page-header-wrapper {
    min-height: 0;
    margin-top: 0;
    padding-top: 28px;
    padding-bottom: 28px;
  }
}
