/* ==========================================================================
   Wiki
   Overview, category and article templates. Loaded only on wiki pages (see functions.php).
   ========================================================================== */

/* Hero */
.e-con.gm-wiki-hero { isolation: isolate; overflow: hidden; background-image: linear-gradient(120deg, rgba(8, 31, 77, 0.55) 0%, rgba(13, 55, 133, 0) 45%, rgba(91, 202, 248, 0.28) 100%); }
.e-con.gm-wiki-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 1;
  border: 0;
  border-radius: 0;
  mix-blend-mode: normal;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(100deg, #000, transparent 70%);
  mask-image: linear-gradient(100deg, #000, transparent 70%);
}
.e-con.gm-wiki-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
}
/* Breadcrumb links on the dark hero */
.gm-wiki-crumbs a { color: #B3E6FC; text-decoration: none; border-bottom: 1px solid rgba(179, 230, 252, 0.4); }
.gm-wiki-crumbs a:hover { color: #FFFFFF; border-color: var(--e-global-color-uicore_secondary); }
.gm-wiki-crumbs .elementor-icon-list-item:not(:first-child)::before { content: "/"; margin-right: 8px; color: rgba(255, 255, 255, 0.4); }

/* Search field (same pattern as the FAQ search) */
.gm-wiki-search { position: relative; width: 100%; max-width: 640px; margin-inline: auto; }
.gm-wiki-search svg { position: absolute; left: 18px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); fill: none; stroke: #4B5A73; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.gm-wiki-search input {
  width: 100%;
  height: 56px;
  padding: 0 20px 0 52px;
  font-family: var(--e-global-typography-uicore_text-font-family), sans-serif;
  font-size: 17px;
  color: var(--e-global-color-uicore_headline);
  background: #FFFFFF;
  border: 1px solid transparent;
  border-radius: 6px;
  box-shadow: 0 12px 32px -12px rgba(8, 31, 77, 0.5);
}
.gm-wiki-search input::placeholder { color: #6B7A90; }
.gm-wiki-search input:focus { outline: none; border-color: var(--e-global-color-uicore_primary); box-shadow: 0 0 0 4px rgba(91, 202, 248, 0.55); }

/* Search results, hidden until the script adds .is-active */
.gm-wiki-results:not(.is-active) { display: none; }
.gm-wiki-cats.is-hidden { display: none; }
.gm-wiki-results .e-loop-item { border-bottom: 1px solid #D6E0EC; }
.gm-wiki-results .e-loop-item:last-child { border-bottom: 0; }
.gm-wiki-results .e-loop-item.is-hidden { display: none; }
.gm-wiki-results mark { padding: 0 1px; color: inherit; background: #D6F1FD; border-radius: 2px; }
.gm-wiki-status a { color: #0A77B4; }

/* Quick start card */
.gm-wiki-start__list { counter-reset: gm-wiki-start; }
.gm-wiki-start__list .e-loop-item { counter-increment: gm-wiki-start; }
.gm-wiki-start__list .e-loop-item > .e-con { position: relative; padding-left: 68px; }
.gm-wiki-start__list .e-loop-item > .e-con::before {
  content: counter(gm-wiki-start);
  position: absolute;
  left: 20px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  font: 700 16px / 1 var(--e-global-typography-uicore_primary-font-family), sans-serif;
  color: #081F4D;
  background: var(--e-global-color-uicore_secondary);
  border-radius: 50%;
}

/* Lists of article titles: hairlines between the rows */
.gm-wiki-card__list .e-loop-item, .gm-wiki-steps .e-loop-item { border-bottom: 1px solid #D6E0EC; }
.gm-wiki-card__list .e-loop-item:first-child { border-top: 1px solid #D6E0EC; }
.gm-wiki-steps .e-loop-item:last-child { border-bottom: 0; }
.gm-wiki-card__list .elementor-heading-title, .gm-wiki-start__list .elementor-heading-title, .gm-wiki-results .elementor-heading-title,
.gm-wiki-steps .elementor-heading-title, .gm-wiki-side .elementor-heading-title { text-wrap: balance; }
.gm-wiki-card__list .elementor-heading-title a:hover, .gm-wiki-steps .elementor-heading-title a:hover { color: #0A77B4; }

/* Category page: the articles as numbered steps */
.gm-wiki-steps { counter-reset: gm-wiki-step; }
.gm-wiki-steps .e-loop-item { counter-increment: gm-wiki-step; }
.gm-wiki-steps .e-loop-item > .e-con { position: relative; padding-left: 52px; }
.gm-wiki-steps .e-loop-item > .e-con::before {
  content: counter(gm-wiki-step);
  position: absolute;
  left: 0;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  font: 700 16px / 1 var(--e-global-typography-uicore_primary-font-family), sans-serif;
  color: var(--e-global-color-uicore_primary);
  background: #EAF8FE;
  border-radius: 50%;
}
@media (max-width: 767px) {
  .gm-wiki-steps .e-loop-item > .e-con { padding-left: 44px; }
  .gm-wiki-steps .e-loop-item > .e-con::before { width: 32px; height: 32px; font-size: 15px; }
}

/* Other categories */
.gm-wiki-others__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.gm-wiki-other { display: grid; gap: 4px; color: var(--e-global-color-uicore_headline); text-decoration: none; }
.gm-wiki-other img { display: block; width: 100%; height: auto; margin-bottom: 12px; border-radius: 6px; }
.gm-wiki-other__name { font-family: var(--e-global-typography-uicore_primary-font-family), sans-serif; font-size: 18px; font-weight: 700; }
.gm-wiki-other:hover .gm-wiki-other__name { color: #0A77B4; }
.gm-wiki-other__count { font-size: 15px; color: var(--e-global-color-uicore_body); }
.gm-wiki-other:focus-visible { outline: 3px solid var(--e-global-color-uicore_secondary); outline-offset: 2px; border-radius: 2px; }
@media (max-width: 1024px) { .gm-wiki-others__grid { gap: 20px; } }
@media (max-width: 767px) {
  .gm-wiki-others__grid { grid-template-columns: 1fr; gap: 16px; }
  .gm-wiki-other { grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 16px; align-items: center; }
  .gm-wiki-other img { grid-row: span 2; margin: 0; }
  .gm-wiki-other__name { align-self: end; }
  .gm-wiki-other__count { align-self: start; }
}

/* Article sidebar */
@media (min-width: 1025px) {
  .e-con.gm-wiki-side { position: sticky; top: 100px; max-height: calc(100vh - 124px); overflow-y: auto; }
}
.gm-wiki-side__list { border-left: 2px solid #D6E0EC; }
.gm-wiki-side__list .elementor-heading-title a { display: block; margin-left: -2px; padding: 7px 0 7px 16px; color: var(--e-global-color-uicore_body); border-left: 2px solid transparent; }
.gm-wiki-side__list .elementor-heading-title a:hover { color: var(--e-global-color-uicore_headline); border-left-color: #B4C3D6; }
.gm-wiki-side__list .elementor-heading-title a[aria-current="page"] { font-weight: 600; color: var(--e-global-color-uicore_primary); border-left-color: var(--e-global-color-uicore_secondary); }

/* Article content */
.gm-wiki-content { font-size: 17px; line-height: 1.7; color: var(--e-global-color-uicore_headline); }
.gm-wiki-content :is(p, ul, ol, figure, h2, h3) { margin-top: 0; margin-bottom: 0; }
.gm-wiki-content :is(p, ul:not(li ul), ol:not(li ol), figure, h2, h3) + :is(p, ul, ol, figure, h2, h3) { margin-top: 24px; }
.gm-wiki-content p { max-width: none; text-wrap: pretty; }
.gm-wiki-content figure { margin-left: 0; margin-right: 0; }
.gm-wiki-content a { color: #0A77B4; text-decoration: underline; text-underline-offset: 2px; }
.gm-wiki-content a:hover { color: var(--e-global-color-uicore_primary); }
.gm-wiki-content strong { font-weight: 600; }
.gm-wiki-content h2 { margin-top: 64px !important; font-size: clamp(22px, 1.2rem + 0.7vw, 28px); line-height: 1.3; text-wrap: balance; }
.gm-wiki-content h3 { margin-top: 48px !important; font-size: 20px; line-height: 1.3; text-wrap: balance; }
.gm-wiki-content :is(h2, h3) + * { margin-top: 16px !important; }

/* Note paragraphs (the Merknad style) and the old bold italic hint lines */
.gm-wiki-content .is-style-gm-note,
.gm-wiki-content p:has(> strong:only-child > em:only-child),
.gm-wiki-content p:has(> em:only-child > strong:only-child) {
  padding: 14px 18px;
  font-size: 15px;
  background: #EAF8FE;
  border-left: 3px solid var(--e-global-color-uicore_secondary);
  border-radius: 0 6px 6px 0;
}

/* Lists: level 1 reads as steps on a thin rail, deeper levels are smaller and muted */
.gm-wiki-content ul, .gm-wiki-content ol { padding: 0; list-style: none; }
.gm-wiki-content :is(ul, ol):not(li *) > li { position: relative; padding: 0 0 16px 36px; }
.gm-wiki-content :is(ul, ol):not(li *) > li:last-child { padding-bottom: 0; }
.gm-wiki-content :is(ul, ol):not(li *) > li::after { content: ""; position: absolute; left: 11px; top: 28px; bottom: 6px; width: 2px; background: #D6E0EC; }
.gm-wiki-content :is(ul, ol):not(li *) > li:last-child::after { display: none; }
.gm-wiki-content ul:not(li *) > li::before { content: ""; position: absolute; left: 6px; top: 0.5em; width: 12px; height: 12px; box-sizing: border-box; background: #FFFFFF; border: 3px solid var(--e-global-color-uicore_secondary); border-radius: 50%; }
.gm-wiki-content ol:not(li *) { counter-reset: gm-wiki-ol; }
.gm-wiki-content ol:not(li *) > li { counter-increment: gm-wiki-ol; padding-left: 44px; }
.gm-wiki-content ol:not(li *) > li::before {
  content: counter(gm-wiki-ol);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font: 700 14px / 1 var(--e-global-typography-uicore_primary-font-family), sans-serif;
  color: var(--e-global-color-uicore_primary);
  background: #EAF8FE;
  border-radius: 50%;
}
.gm-wiki-content ol:not(li *) > li::after { left: 13px; top: 34px; }
.gm-wiki-content li :is(ul, ol) { margin-top: 8px; font-size: inherit; line-height: inherit; font-weight: 400; color: var(--e-global-color-uicore_body); } /* same size and line height on every level */
.gm-wiki-content li li { position: relative; padding-left: 20px; }
.gm-wiki-content li li + li { margin-top: 6px; }
.gm-wiki-content li ul > li::before { content: ""; position: absolute; left: 2px; top: 0.66em; width: 6px; height: 6px; background: #0A77B4; border-radius: 50%; }
.gm-wiki-content li li ul > li::before { background: transparent; border: 1.5px solid #0A77B4; }
.gm-wiki-content li ol { counter-reset: gm-wiki-ol2; }
.gm-wiki-content li ol > li { counter-increment: gm-wiki-ol2; padding-left: 26px; }
.gm-wiki-content li ol > li::before { content: counter(gm-wiki-ol2) "."; position: absolute; left: 0; font-weight: 600; color: #0A77B4; }
@media (max-width: 767px) {
  .gm-wiki-content ul:not(li *) > li { padding-left: 30px; }
  .gm-wiki-content ol:not(li *) > li { padding-left: 38px; }
}

/* Screenshots, videos and captions */
.gm-wiki-content .wp-block-image, .gm-wiki-content .wp-block-video { margin-top: 32px !important; margin-bottom: 32px !important; }
.gm-wiki-content .wp-block-image img { display: block; max-width: 100%; height: auto; border: 1px solid #D6E0EC; border-radius: 6px; }
.gm-wiki-content .wp-block-video video { display: block; width: 100%; height: auto; background: #081F4D; border-radius: 6px; }
.gm-wiki-content figcaption { display: flex; gap: 8px; margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--e-global-color-uicore_body); text-align: left; text-wrap: pretty; }
.gm-wiki-content .wp-block-video figcaption::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  background: #0A77B4;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='m10 8.5 5.5 3.5-5.5 3.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='m10 8.5 5.5 3.5-5.5 3.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Tables scroll sideways on small screens */
.gm-wiki-content .wp-block-table { overflow-x: auto; }
.gm-wiki-content table { width: 100%; min-width: 32rem; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.gm-wiki-content :is(th, td) { padding: 12px; text-align: left; vertical-align: top; border: 0; border-bottom: 1px solid #D6E0EC; }
.gm-wiki-content thead th { font-weight: 600; background: var(--e-global-color-uicore_light); }
.gm-wiki-content td img { max-width: 64px; height: auto; }

/* Previous / next */
.gm-wiki-pn .elementor-post-navigation { gap: 16px; }
.gm-wiki-pn .elementor-post-navigation__link { flex: 1; }
.gm-wiki-pn .elementor-post-navigation__link a { display: grid; gap: 4px; height: 100%; padding: 16px 24px; background: var(--e-global-color-uicore_light); border-radius: 6px; }
.gm-wiki-pn .elementor-post-navigation__next a { justify-items: end; text-align: right; }
.gm-wiki-pn .post-navigation__prev--title, .gm-wiki-pn .post-navigation__next--title { text-wrap: balance; }
.gm-wiki-pn .elementor-post-navigation__separator-wrapper { display: none; }
@media (max-width: 767px) {
  .gm-wiki-pn .elementor-post-navigation { flex-direction: column; }
}
/* Elementor cuts the titles to one line and keeps the cards at 50%.
   Full titles and full width cards on phones. */
.elementor-widget.gm-wiki-pn .elementor-post-navigation .elementor-post-navigation__link { min-width: 0; overflow: visible; white-space: normal; text-overflow: clip; }
.elementor-widget.gm-wiki-pn .elementor-post-navigation .elementor-post-navigation__link a { display: flex; align-items: center; gap: 12px; box-sizing: border-box; }
.elementor-widget.gm-wiki-pn .elementor-post-navigation .elementor-post-navigation__next a { justify-content: flex-end; }
.elementor-widget.gm-wiki-pn .elementor-post-navigation :is(.elementor-post-navigation__link__prev, .elementor-post-navigation__link__next) { display: grid; gap: 4px; min-width: 0; }
.elementor-widget.gm-wiki-pn .post-navigation__arrow-wrapper { flex: none; }
@media (max-width: 767px) {
  .elementor-widget.gm-wiki-pn .elementor-post-navigation .elementor-post-navigation__link { width: 100%; }
}

/* Category images and a few fixes */
/* Category graphics from the [gru_wiki_category_image] shortcode */
.gm-wiki-media .elementor-shortcode img { display: block; width: 100%; height: auto; }
.gm-wiki-start .gm-wiki-media img { border-radius: 6px; }
.gm-wiki-card__title .elementor-heading-title { overflow-wrap: normal; hyphens: manual; } /* keep Saksbehandlingssystemet in one piece */
.gm-wiki-status { margin: 0; font-size: 15px; line-height: 1.5; color: var(--e-global-color-uicore_body); }
.gm-wiki-status:empty { display: none; }
.gm-wiki-snippet { flex: 0 0 100%; margin: 2px 0 0; font-size: 15px; line-height: 1.5; color: var(--e-global-color-uicore_body); text-wrap: pretty; } /* search match in the article text */
.gm-wiki-hero__title .elementor-heading-title { max-width: 22ch; text-wrap: balance; }
.elementor-widget.gm-wiki-card__all { margin-top: auto; padding-top: 8px; } /* "All N articles" link at the bottom of each card */
.gm-wiki-side__title a { color: #0A77B4; text-decoration: underline; text-underline-offset: 2px; }
.gm-wiki-side__title a:hover { color: var(--e-global-color-uicore_primary); }
@media (max-width: 1024px) {
  .elementor-widget.gm-wiki-start__list { grid-column: 1 / -1; } /* tablet: two articles side by side */
}
@media (max-width: 767px) {
  /* Saksbehandlingssystemet is one very long word, so category titles scale with the screen */
  .e-con.gm-wiki-hero--cat .elementor-widget.gm-wiki-hero__title .elementor-heading-title { font-size: clamp(24px, 7vw, 34px); }
  /* Phones: step titles in Figtree 600 17px (Elementor can't change the font per breakpoint) */
  .elementor-widget.gm-wiki-steps .e-loop-item .elementor-widget-theme-post-title .elementor-heading-title { font-family: var(--e-global-typography-uicore_text-font-family), sans-serif; font-weight: 600; font-size: 17px; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  /* Tablet: the card turns into a row, graphic on the sky band */
  .elementor-widget.gm-wiki-card__media { display: flex; align-items: center; background: linear-gradient(135deg, #EAF8FE, #D6F1FD); }
  .elementor-widget.gm-wiki-card__media > .elementor-widget-container { width: 100%; }
}
