/*
 * Nordic Auto Blog — frontend styles.
 * Colours, type and buttons follow the existing site: white pages, Montserrat 400/600,
 * #000F2B headings, #3A3A3A text, teal links, square outlined buttons, no shadows or rounded corners.
 */

/* ---------- Header on news pages ----------
 * Works together with the Nordic Auto Header plugin, which adds .is-pinned (fixed),
 * .is-hero-blend (near the top: transparent) and .nav-hidden (scrolling down).
 */
body.nab-news-page,
body.nab-news-page #page,
body.nab-news-page .site-content { background-color: #fff; }

/* Before the header plugin pins it, keep the header out of the flow so pinning never makes the page jump. */
body.nab-news-page #masthead:not(.is-pinned) { position: absolute; left: 0; right: 0; width: 100%; z-index: 999; }

/* Let the header plugin's background show through Astra's header rows. */
body.nab-news-page #masthead :is(.ast-primary-header-bar, .main-header-bar, .ast-above-header-bar, .ast-below-header-bar) {
  background: transparent !important;
}

/* At the top (transparent over white): dark logo, Astra's normal teal links. */
body.nab-news-page #masthead .custom-logo-link img { filter: invert(1); transition: filter .35s ease; }
body.nab-news-page #masthead .main-header-menu .menu-link,
body.nab-news-page #masthead .menu-toggle { transition: color .35s ease; }

/* Pinned and scrolled past the top (frosted navy from the header plugin): white logo, light links. */
body.nab-news-page #masthead.is-pinned:not(.is-hero-blend) .custom-logo-link img { filter: none; }
body.nab-news-page #masthead.is-pinned:not(.is-hero-blend) #ast-desktop-header .main-header-menu > .menu-item > .menu-link { color: #F3F9FB; }
body.nab-news-page #masthead.is-pinned:not(.is-hero-blend) .menu-toggle { color: #F3F9FB; }
body.nab-news-page #masthead.is-pinned:not(.is-hero-blend) .ast-mobile-svg { fill: #F3F9FB; }

/* ---------- Base ---------- */
.nab {
  --nab-heading: #000F2B;
  --nab-text: #3A3A3A;
  --nab-muted: #667085;
  --nab-teal: #1A6C7A;
  --nab-slate: #153243;
  --nab-tint: #F3F9FB;
  --nab-line: rgba(7, 26, 59, .13);
  --nab-font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --nab-gutter: 20px;
  --nab-top: calc(var(--nab-header-h, 70px) + 56px);
  font-family: var(--nab-font);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--nab-text);
  overflow-wrap: anywhere;
}
.nab *, .nab *::before, .nab *::after { box-sizing: border-box; }
.nab :is(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  color: var(--nab-heading);
  font-family: var(--nab-font);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
  clear: none; /* Astra sets clear: both on headings, which would push titles below the floated picture */
}
.nab p { margin: 0; }
.nab .nab-container { width: min(1140px, 100% - 2 * var(--nab-gutter)); margin-inline: auto; }
.nab .nab-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.nab :where(a, button, input):focus-visible { outline: 3px solid var(--nab-teal); outline-offset: 3px; }
.nab .nab-date { display: block; color: var(--nab-muted); font-size: 14px; line-height: 1.5; }

/* Same as the site's "OM OSS" button. */
.nab .nab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  max-width: 100%;
  padding: 16px 40px;
  border: 2px solid var(--nab-slate);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--nab-heading);
  font: 600 12px/1 var(--nab-font);
  letter-spacing: 2px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 150ms, color 150ms;
}
.nab .nab-button:hover { background: var(--nab-slate); color: #fff; }

.nab .nab-media { position: relative; overflow: hidden; background: var(--nab-tint); }
.nab .nab-media img {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover; border-radius: 0; box-shadow: none;
}

/* ---------- Page spacing (content starts below the header) ---------- */
.nab.nab-overview--top, .nab.nab-single { padding-top: var(--nab-top); }
.nab .nab-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 32px;
  color: var(--nab-teal); font-size: 14px; font-weight: 600; text-decoration: none;
}
.nab .nab-back:hover { text-decoration: underline; }

/* ---------- Article (article page and newest item on the overview) ---------- */
.nab .nab-article__wide-image { aspect-ratio: 16 / 9; margin-bottom: 40px; }
.nab .nab-article { display: flow-root; } /* contains the floated picture */
.nab .nab-article__head { margin-bottom: 28px; }
.nab .nab-article__intro { max-width: 760px; }
.nab .nab-article__title { font-size: 40px; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.nab .nab-article--fremhevet .nab-article__title { font-size: 46px; }
.nab .nab-article__title a { color: inherit; text-decoration: none; }
.nab .nab-article__title a:hover { text-decoration: underline; text-decoration-color: var(--nab-teal); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.nab .nab-article__intro .nab-date { margin-top: 12px; }
.nab .nab-ingress { margin-top: 20px; color: var(--nab-slate); font-size: 19px; line-height: 1.6; }
.nab .nab-article__image { float: right; width: min(42%, 480px); aspect-ratio: 4 / 3; margin: 0 0 24px 48px; }

.nab .nab-prose { max-width: 760px; font-size: 17px; line-height: 1.75; }
.nab .nab-prose > * { margin: 0; }
.nab .nab-prose > * + * { margin-top: 1.1em; }
.nab .nab-prose h2 { margin-top: 48px; font-size: 26px; }
.nab .nab-prose h3 { margin-top: 36px; font-size: 21px; }
.nab .nab-prose :is(h4, h5, h6) { margin-top: 28px; font-size: 18px; }
.nab .nab-prose :is(h2, h3, h4, h5, h6) + * { margin-top: 12px; }
.nab .nab-prose :is(ul, ol) { padding-left: 1.25em; }
.nab .nab-prose li + li { margin-top: .4em; }
.nab .nab-prose li::marker { color: var(--nab-teal); }
.nab .nab-prose a { color: var(--nab-teal); text-decoration: underline; text-underline-offset: 3px; }
.nab .nab-prose a:hover { color: var(--nab-heading); }
.nab .nab-prose strong { font-weight: 600; }
.nab .nab-prose img { display: block; max-width: 100%; height: auto; }
.nab .nab-prose blockquote { margin-left: 0; padding-left: 24px; border-left: 4px solid var(--nab-teal); color: var(--nab-slate); }

.nab .nab-highlight { display: flow-root; max-width: 760px; margin-top: 40px; padding: 24px 28px; border-left: 4px solid var(--nab-teal); background: var(--nab-tint); }
.nab .nab-highlight__title { margin-bottom: 6px; color: var(--nab-heading); font-weight: 600; }
.nab .nab-article__cta { margin-top: 32px; }

.nab .nab-gallery {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
  margin: 48px 0 0; padding: 0; list-style: none; clear: both;
}
.nab .nab-gallery--1 { grid-template-columns: minmax(0, 1fr); }
.nab .nab-gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nab .nab-gallery li { aspect-ratio: 4 / 3; margin: 0; }
.nab .nab-gallery--1 li { aspect-ratio: 16 / 9; }
.nab .nab-gallery a { position: absolute; inset: 0; }
.nab .nab-gallery a:focus-visible { outline-offset: -4px; }

/* ---------- Lists of earlier news ("tidligere nyheter", "flere nyheter") ---------- */
.nab .nab-list { margin-top: 80px; padding: 56px 0 96px; border-top: 1px solid var(--nab-line); }
.nab.nab-overview:not(.nab-overview--top) .nab-list { margin-top: 0; padding-top: 0; border-top: 0; }
.nab .nab-list__head { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 32px; }
.nab .nab-list__title { font-size: 28px; line-height: 1.2; }

.nab .nab-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px;
  align-items: start; margin: 0; padding: 0; list-style: none;
}
.nab .nab-grid__item { margin: 0; padding: 0; list-style: none; }
.nab .nab-card { position: relative; min-width: 0; }
.nab .nab-card--text { padding-top: 16px; border-top: 1px solid var(--nab-line); }
.nab .nab-card__image { aspect-ratio: 3 / 2; margin-bottom: 16px; }
.nab .nab-card__title { margin-top: 6px; font-size: 19px; line-height: 1.3; }
.nab .nab-card__excerpt { margin-top: 8px; font-size: 15px; line-height: 1.6; }
.nab :is(.nab-card__title, .nab-card__excerpt) {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.nab .nab-card__link { color: inherit; text-decoration: none; }
.nab .nab-card__link::after { content: ""; position: absolute; inset: 0; }
.nab .nab-card:is(:hover, :focus-within) .nab-card__link {
  text-decoration: underline; text-decoration-color: var(--nab-teal);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.nab .nab-card .nab-card__link:focus-visible { outline: none; }
.nab .nab-card:has(.nab-card__link:focus-visible) { outline: 3px solid var(--nab-teal); outline-offset: 6px; }

.nab .nab-more { margin-top: 48px; text-align: center; }
.nab .nab-more__error { margin-top: 12px; font-size: 14px; }

.nab .nab-empty { padding-bottom: 96px; }
.nab .nab-empty h2 { font-size: 28px; }
.nab .nab-empty p { margin-top: 12px; }
.nab .nab-empty .nab-button { margin-top: 12px; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .nab { --nab-gutter: 24px; }
  .nab .nab-article__image { margin-left: 32px; }
  .nab .nab-article__title { font-size: 34px; }
  .nab .nab-article--fremhevet .nab-article__title { font-size: 38px; }
  .nab .nab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .nab { --nab-gutter: 16px; --nab-top: calc(var(--nab-header-h, 70px) + 32px); }
  .nab .nab-article__wide-image { margin-bottom: 28px; }
  .nab .nab-article__image { float: none; width: 100%; margin: 0 0 24px; }
  .nab .nab-article__head { margin-bottom: 20px; }
  .nab .nab-article__title, .nab .nab-article--fremhevet .nab-article__title { font-size: 28px; }
  .nab .nab-ingress { font-size: 17px; }
  .nab .nab-prose { font-size: 16px; }
  .nab .nab-prose h2 { margin-top: 36px; font-size: 22px; }
  .nab .nab-prose h3 { font-size: 19px; }
  .nab .nab-highlight { padding: 20px; }
  .nab .nab-gallery:not(.nab-gallery--1) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .nab .nab-list { margin-top: 56px; padding: 40px 0 64px; }
  .nab .nab-list__title { font-size: 24px; }
  .nab .nab-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .nab .nab-list .nab-button, .nab .nab-more .nab-button { width: 100%; }
  .nab .nab-button { padding-inline: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .nab *, body.nab-news-page #masthead * { transition: none !important; }
}
