/* M K Myklebust Entreprenør AS — Bestillas style (playbooks/designs/bestillas/DNA.md).
   Per client only the tokens in :root, the logo, photos and text change. */

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f2f2f2;           /* the one grey band (Om oss) */
  --ink: #2b2b2b;               /* text and footer */
  --muted: #656b74;
  --accent: #e30613;            /* logo red (vector logo in their 2025 brochure) */
  --accent-80: rgba(227, 6, 19, .8);
  --on-accent: #ffffff;         /* white on #e30613 = 4.9:1 */
  --line: #c4c4c4;
  --line-faint: #e4e4e4;
  --foot-line: #3d3f43;
  --overlay: rgba(0, 0, 0, .38);

  --f-head: Poppins, Manrope, Arial, Helvetica, sans-serif;
  --f-body: Manrope, Arial, Helvetica, sans-serif;
  --h1: clamp(2.6rem, 9vw, 8.875rem);     /* 142px */
  --h2: clamp(2.5rem, 5.5vw, 5rem);       /* 80px  */
  --row: clamp(1.375rem, 2.2vw, 2rem);    /* 32px  */
  --body: 1.125rem;                       /* 18px  */

  --max: 1340px;
  --pad: 16px;
  --edge: max(var(--pad), calc((100vw - var(--max)) / 2 + 15px));  /* viewport edge to content */
  --sec: clamp(80px, 10vw, 140px);        /* section top padding */
  --ease: cubic-bezier(.65, 0, .35, 1);
}
@media (min-width: 1200px) { :root { --pad: 60px; --edge: max(var(--pad), calc((100vw - var(--max)) / 2 + 127px)); } }
@media (min-width: 768px) and (max-width: 1199px) { :root { --pad: 40px; } }

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url("/fonts/poppins-latin-400.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url("/fonts/poppins-latin-600.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url("/fonts/poppins-latin-700.woff2") format("woff2"); }
@font-face { font-family: Manrope; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-latin.woff2") format("woff2"); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--body)/1.6 var(--f-body); overflow-x: clip; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: var(--h2); }
h3 { font-size: var(--row); font-weight: 600; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { padding-inline: var(--edge); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; }
.label { display: block; font: 400 14px/1.4 var(--f-body); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }

/* ---------- Header ---------- */
.top { position: absolute; inset: 0 0 auto; z-index: 10; height: 101px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-inline: max(var(--pad), calc((100vw - var(--max)) / 2 + 15px)); color: #fff; }
.top .logo img { width: clamp(150px, 15vw, 210px); }
.top nav { display: flex; gap: clamp(20px, 3vw, 52px); }
.top nav a, .top .tel { font: 500 16px/1 var(--f-body); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { text-decoration: underline; text-underline-offset: 6px; }
.top .tel { font-weight: 600; white-space: nowrap; }
.plain .top { color: var(--ink); }
.burger { display: none; width: 44px; height: 44px; border: 0; background: none; color: inherit; padding: 8px; cursor: pointer; }
.burger span, .burger span::before, .burger span::after { display: block; width: 28px; height: 3px; border-radius: 2px; background: currentColor; position: relative; transition: transform .3s var(--ease); }
.burger span::before, .burger span::after { content: ""; position: absolute; left: 0; }
.burger span::before { top: -9px; }
.burger span::after { top: 9px; }
.menu-open .burger span { background: transparent; }
.menu-open .burger span::before { transform: translateY(9px) rotate(45deg); }
.menu-open .burger span::after { transform: translateY(-9px) rotate(-45deg); }
.drawer { position: fixed; inset: 0; z-index: 9; background: var(--ink); color: #fff; padding: 120px var(--pad) 40px; display: flex; flex-direction: column; justify-content: space-between; transform: translateY(-100%); transition: transform .5s var(--ease); visibility: hidden; }
.menu-open .drawer { transform: none; visibility: visible; }
.drawer nav a { display: block; font: 700 2.25rem/1.25 var(--f-head); text-decoration: none; padding: 6px 0; }
.drawer .small { font-size: 16px; color: #c9cbd0; }
.drawer .small a { color: #fff; }
.menu-open .top { color: #fff; position: fixed; }
.menu-open .top .logo .ink { display: none; }
.menu-open .top .logo .white { display: block; }
.logo .white { display: block; }
.logo .ink { display: none; }
.plain .logo .white { display: none; }
.plain .logo .ink { display: block; }
.menu-open.plain .logo .white { display: block; }
.menu-open.plain .logo .ink { display: none; }
@media (max-width: 991px) {
  .top nav, .top .tel { display: none; }
  .burger { display: block; }
  .top { height: 84px; }
}

/* ---------- Text + circle button ---------- */
.btn { position: relative; display: inline-flex; align-items: center; min-height: 50px; padding: 0 66px 0 0; font: 600 16px/1 var(--f-body); text-decoration: none; color: var(--ink); background: none; border: 0; cursor: pointer; isolation: isolate; }
.btn::after { content: ""; position: absolute; right: 0; top: 0; width: 50px; height: 50px; border: 1px solid currentColor; border-radius: 50px; transition: width .3s var(--ease); z-index: -1; }
.btn svg { position: absolute; right: 13px; top: 50%; width: 24px; height: 24px; margin-top: -12px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.btn span { transition: transform .3s var(--ease); }
.btn:hover::after, .btn:focus-visible::after { width: calc(100% + 24px); right: -12px; }
.btn:hover span { transform: translateX(10px); }
.btn.white { color: #fff; }
.btn.accent { color: var(--accent); }

/* ---------- Floating round CTA ---------- */
.cta { position: fixed; right: 60px; bottom: 50px; z-index: 8; width: 166px; height: 166px; border-radius: 50%; display: grid; place-items: center; text-align: center; background: var(--accent-80); color: var(--on-accent); font: 400 18px/1.2 var(--f-head); text-decoration: none; transition: background .3s var(--ease), transform .3s var(--ease); }
.cta:hover { background: var(--accent); }
.cta.m { display: none; }
@media (max-width: 767px) {
  .cta { width: 96px; height: 96px; right: 16px; bottom: 16px; font-size: 15px; background: var(--accent); }
  .cta.d { display: none; }
  .cta.m { display: grid; }
}
.menu-open .cta { display: none; }

/* ---------- Hero (home) ---------- */
.hero { position: relative; min-height: max(600px, 100svh); max-height: 980px; color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 140px var(--edge) 70px; overflow: hidden; background: var(--ink); }
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero picture img { animation: settle 1.2s var(--ease) both; }
.hero::after { content: ""; position: absolute; inset: 0; background: var(--overlay); }
.hero > *:not(picture) { position: relative; z-index: 1; }
.hero h1 { font-size: var(--h1); line-height: 1.1; }
.hero h1 .row { display: block; overflow: hidden; padding-bottom: .06em; }
.hero h1 .row + .row { margin-top: -.18em; }
.hero h1 .row span { display: block; animation: rowUp 1.4s var(--ease) both; }
.hero h1 .row + .row span { animation-delay: .12s; }
.hero .btn { margin-top: clamp(28px, 4vw, 48px); align-self: flex-start; }
.hero .intro { margin-top: auto; padding-top: 48px; max-width: 470px; font: 500 16px/1.6 var(--f-body); }
.hero .intro p { margin: 0; }
@media (max-width: 767px) { .hero .intro { padding-right: 104px; } }
@keyframes rowUp { from { transform: translateY(130%); } to { transform: none; } }
@keyframes settle { from { transform: scale(1.25); } to { transform: none; } }

/* ---------- Sections ---------- */
.sec { padding-top: var(--sec); position: relative; }
.sec.grey { background: var(--surface); }
.head { display: grid; gap: 24px 30px; align-items: start; }
.head p { max-width: 470px; margin: 0; }
.head p + p { margin-top: 1em; }
.head .btn { margin-top: 28px; }
.right { max-width: 520px; }
@media (min-width: 992px) {
  .head { grid-template-columns: 7fr 5fr; }
  .head > :nth-child(2) { padding-top: 14px; }
  .split { display: grid; grid-template-columns: 7fr 5fr; gap: 30px; }
}

/* photo anchored bottom-left, bleeding off the left edge */
.bleed { margin-left: calc(-1 * var(--edge)); align-self: end; overflow: hidden; }
.bleed img { width: 100%; }
.bleed.cap img { max-height: 760px; object-fit: cover; object-position: center; }
.bleed.top { align-self: start; }
@media (min-width: 992px) { .bleed.top { position: sticky; top: 40px; } }
@media (max-width: 991px) { .bleed { margin-right: calc(-1 * var(--edge)); } .bleed img { max-height: 560px; object-fit: cover; } }

/* ---------- Hairline list (services, facts, references) ---------- */
.rows { overflow: hidden; }
.rows li { position: relative; }
.rows li::after { content: ""; position: absolute; left: 0; bottom: 0; width: 120vw; height: 1px; background: var(--line); }
.rows li:last-child::after { display: none; }
.rows a, .rows .r { min-height: clamp(96px, 9vw, 130px); display: flex; align-items: center; justify-content: space-between; gap: 20px; font: 600 var(--row)/1.2 var(--f-head); text-decoration: none; padding: 20px 0; }
.rows a .arrow { flex: none; width: 50px; height: 50px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; opacity: 0; transform: translateX(20px); transition: opacity .3s var(--ease), transform .3s var(--ease); color: var(--accent); }
.rows a .arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.rows a:hover .arrow, .rows a:focus-visible .arrow { opacity: 1; transform: none; }
.rows small { display: block; font: 400 16px/1.5 var(--f-body); color: var(--muted); margin-top: 6px; }
@media (hover: none) { .rows a .arrow { opacity: 1; transform: none; } }

.tenester .split { margin-top: clamp(40px, 6vw, 80px); }
.tenester .rows { margin-bottom: clamp(40px, 6vw, 90px); }
.tenester .more { margin: 30px 0 clamp(60px, 8vw, 120px); }
@media (min-width: 992px) {
  .tenester .split > .bleed { grid-column: 1; grid-row: 1 / span 2; margin-right: 6vw; }
  .tenester .rows, .tenester .more { grid-column: 2; }
}

/* Om oss band */
.om { padding-bottom: 0; }
.om .split { margin-top: clamp(60px, 8vw, 120px); align-items: end; }
.om .bleed { max-width: 1032px; }
.facts { padding-bottom: clamp(40px, 6vw, 80px); }
.facts .r { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
.facts b { font: 700 var(--h2)/1 var(--f-head); }
.facts small { margin: 0; }
@media (max-width: 991px) { .om .split { display: flex; flex-direction: column-reverse; align-items: stretch; } .facts { padding-top: 0; } }

/* Certificate rings */
.rings { display: flex; flex-wrap: wrap; margin-top: clamp(40px, 6vw, 80px); padding-bottom: var(--sec); }
.rings a, .rings div { width: clamp(150px, 19vw, 280px); aspect-ratio: 1; border: 1px solid var(--line-faint); border-radius: 50%; display: grid; place-items: center; margin-right: clamp(-24px, -1.6vw, -10px); background: rgba(255, 255, 255, .6); text-decoration: none; }
.rings a:hover { border-color: var(--line); }
.rings img { max-width: min(130px, 46%); max-height: min(130px, 46%); width: auto; object-fit: contain; }
.rings span { display: block; text-align: center; font-size: 13px; color: var(--muted); margin-top: 10px; max-width: 18ch; line-height: 1.3; }
.rings .in { display: flex; flex-direction: column; align-items: center; }

/* References list */
.refs .split { margin-top: clamp(40px, 6vw, 80px); }
.ref { padding: clamp(28px, 4vw, 56px) 0; }
.ref h3 { font: 600 14px/1.4 var(--f-body); text-transform: uppercase; letter-spacing: .06em; }
.ref .where { float: right; font-size: 14px; color: var(--muted); }
.ref p { margin: 12px 0 0; }
.refs .rows { margin-bottom: clamp(40px, 6vw, 80px); }
@media (min-width: 992px) {
  .refs .split > .bleed { grid-column: 1; grid-row: 1 / span 2; margin-right: 8vw; }
  .refs .split > .rows, .refs .split > .more { grid-column: 2; }
}

/* ---------- Contact ---------- */
.form { display: grid; gap: 0 clamp(30px, 6vw, 80px); margin-top: clamp(30px, 5vw, 70px); }
.field { position: relative; padding: 26px 0 0; margin-top: 30px; }
.field label { position: absolute; top: 0; left: 0; }
.field input, .field textarea { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: 400 18px/1.5 var(--f-body); color: var(--ink); padding: 10px 0 14px; border-radius: 0; resize: vertical; }
.field textarea { min-height: 52px; height: 52px; }
.field input:focus, .field textarea:focus { outline: 0; border-bottom-color: var(--accent); }
.form .send { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 40px; flex-wrap: wrap; }
.form .send p { font-size: 14px; color: var(--muted); margin: 0; max-width: 46ch; }
.hp { position: absolute; left: -9999px; }
.notice { display: none; margin: 30px 0 0; padding: 16px 0; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }
.notice.show { display: block; }
@media (min-width: 768px) { .form { grid-template-columns: 1fr 1fr; } .form .send, .form .notice { grid-column: 1 / -1; } }

.info { display: grid; gap: 34px 30px; margin-top: clamp(50px, 7vw, 100px); }
.info .label { margin-bottom: 13px; }
.info p { margin: 0; }
.info a { text-decoration: none; }
.info a:hover { text-decoration: underline; }
.info .big { font: 600 var(--row)/1.2 var(--f-head); }
@media (min-width: 768px) { .info { grid-template-columns: repeat(3, 1fr); } }

.people { margin-top: 10px; }
.people .r { flex-wrap: wrap; font-size: clamp(1.25rem, 1.8vw, 1.625rem); }
.people small { margin: 4px 0 0; }
.people a { text-decoration: none; font: 600 18px/1.2 var(--f-body); white-space: nowrap; }

.bw { margin-top: clamp(80px, 10vw, 140px); }
.bw img { width: 100%; height: clamp(260px, 38vw, 560px); object-fit: cover; }

/* ---------- Footer ---------- */
.foot { background: var(--ink); color: #fff; }
.foot .grid { display: grid; border-left: 1px solid var(--foot-line); border-right: 1px solid var(--foot-line); margin-inline: max(0px, calc((100vw - var(--max)) / 2)); }
.foot .cell { padding: 40px var(--pad); border-bottom: 1px solid var(--foot-line); }
.foot .cell + .cell { border-top: 0; }
.foot .label { color: var(--muted); margin-bottom: 13px; }
.foot p { margin: 0 0 22px; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot .logo img { width: 220px; }
.foot .menu { columns: 2; column-gap: 30px; }
.foot .menu a { display: block; padding: 3px 0; }
@media (max-width: 991px) { .foot .cell:empty { display: none; } }
.foot .copy { color: var(--muted); font-size: 14px; padding-block: 30px; border-bottom: 0; }
.foot .duo { display: flex; gap: 40px; flex-wrap: wrap; }
@media (min-width: 992px) {
  .foot .grid { grid-template-columns: repeat(3, 1fr); }
  .foot .cell { border-right: 1px solid var(--foot-line); padding: 52px 40px; }
  .foot .cell:nth-child(3n) { border-right: 0; }
  .foot .wide { grid-column: 1 / -1; border-right: 0; }
  .foot .tall { min-height: 300px; }
}

/* ---------- Subpages ---------- */
.plain main { padding-top: 101px; }
.page-head { padding-top: clamp(50px, 7vw, 110px); }
.page-head h1 { font-size: var(--h2); }
.page-head .crumb { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.page-head .crumb a { text-decoration: none; }
.page-head .crumb a:hover { text-decoration: underline; }
.body-sec { padding-top: clamp(60px, 8vw, 110px); }
.prose { max-width: 680px; }
.prose h2 { font-size: var(--row); font-weight: 600; margin: 1.8em 0 .6em; }
.prose ul { margin: 0 0 1em; }
.prose li { padding: 10px 0; border-bottom: 1px solid var(--line-faint); }
.prose a { color: var(--accent); }
.lead { font-size: clamp(1.125rem, 1.6vw, 1.375rem); line-height: 1.55; }
.cols { display: grid; gap: 40px 30px; }
@media (min-width: 992px) { .cols { grid-template-columns: 7fr 5fr; } .cols .stick { position: sticky; top: 40px; align-self: start; } }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin-top: 30px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figure { margin: 0; }
.gallery figcaption { font-size: 14px; color: var(--muted); padding-top: 8px; }

/* machine list */
.mlist .r { display: grid; grid-template-columns: 70px 1fr; gap: 4px 20px; min-height: 0; padding: 22px 0; font-size: clamp(1.125rem, 1.6vw, 1.5rem); }
.mlist .y { font: 400 16px/1.9 var(--f-body); color: var(--muted); }
.mlist small { grid-column: 2; margin: 0; }
.group { margin-top: clamp(50px, 7vw, 90px); }
.group > h2 { font-size: var(--row); font-weight: 600; margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.tags li { border: 1px solid var(--line); border-radius: 50px; padding: 8px 18px; font-size: 16px; }

/* call band at the end of subpages */
.call { padding: var(--sec) 0 0; }
.call h2 a { text-decoration: none; }
.call h2 a:hover { color: var(--accent); }

/* ---------- Reveal on scroll (only when JS runs) ---------- */
.js .rv { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
.js .rv-img img { transform: scale(1.4); transform-origin: left center; transition: transform 1s var(--ease) .2s; }
.js .rv-img.in img { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .rv { opacity: 1; transform: none; }
  .js .rv-img img { transform: none; }
}
