@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&display=swap');

/* Meirbruk Marknad – skogsgrøn frå Marknad-logoen + oker frå «bruk» */
body.marknad {
  --bg: #F1F2E8;          /* grøntona papir */
  --band: #E8EADC;        /* feltet bak galleriet */
  --ink: #23271F;
  --muted: #5E6158;
  --line: rgba(14, 61, 48, 0.16);
  --primary: #0E3D30;        /* t-skjorta i logoen */
  --primary-dark: #0A2F25;
  --foot: #07231B;
  --ochre: #C8862A;          /* «BRUK» i logoen */
  --ochre-hover: #B5761F;
  --ochre-text: #9E6516;
  --rail: #2B2B28;           /* same tone som kleshengaren */

  font-family: 'Work Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

/* TOPPLINJE */
.mk-top {
  max-width: 1140px;
  margin: 0 auto;
  padding: 26px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.mk-top-logo img { height: 27px; width: auto; }
.mk-top-addr {
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-decoration: none;
}
.mk-top-addr:hover { color: var(--ochre-text); text-decoration: underline; text-underline-offset: 3px; }

/* HERO: logoen hengjer på ei klesstong */
.mk-hero {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 24px 44px;
  text-align: center;
}
.mk-rail {
  --logo-w: clamp(170px, 19vw, 220px);
  position: relative;
  padding-top: 4px;
}
/* stonga med knottar i endane */
.mk-rail::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: calc(4px + var(--logo-w) * 0.047);
  height: 3px;
  border-radius: 3px;
  background: var(--rail);
}
.mk-rail::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px;
  top: calc(4px + var(--logo-w) * 0.047 - 3px);
  height: 9px;
  background:
    radial-gradient(circle, var(--rail) 4px, transparent 4.5px) left center / 9px 9px no-repeat,
    radial-gradient(circle, var(--rail) 4px, transparent 4.5px) right center / 9px 9px no-repeat;
}
.mk-title { margin: 0; line-height: 0; position: relative; z-index: 1; }
.mk-title img {
  width: var(--logo-w);
  height: auto;
  margin: 0 auto;
  transform-origin: 49% 3%;
  animation: swing 1.8s cubic-bezier(.3,.6,.4,1) both;
}
@keyframes swing {
  0%   { transform: rotate(-7deg); }
  30%  { transform: rotate(4.5deg); }
  55%  { transform: rotate(-2.2deg); }
  78%  { transform: rotate(0.9deg); }
  100% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .mk-title img { animation: none; }
}

.mk-tagline {
  margin: 18px 0 0;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  color: var(--muted);
}

/* TRE SPALTER */
.mk-strip {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr);
  gap: 0 36px;
  margin-top: 36px;
  padding: 28px 0 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mk-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ochre-text);
}
.mk-badge::before, .mk-badge::after {
  content: ""; width: 14px; height: 1px; background: currentColor; opacity: .55;
}
.mk-item h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  margin: 10px 0 8px;
  line-height: 1.2;
}
.mk-item p {
  margin: 0 auto;
  max-width: 26em;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}
.mk-divider { width: 1px; align-self: stretch; margin: 6px 0; background: var(--line); }

/* FRÅ HYLLENE – ligg i eit eige felt i full breidd */
.mk-finds {
  max-width: 1140px;
  margin: 22px auto 0;
  padding: 46px 24px 72px;
  background: var(--band);
  clip-path: inset(0 -100vmax);
  box-shadow: 0 0 0 100vmax var(--band);
}
.mk-finds-head { text-align: center; margin-bottom: 22px; }
.mk-finds-head h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  margin: 10px 0 8px;
}
.mk-finds-head p { margin: 0; color: var(--muted); font-size: 15px; }

.mk-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 28px;
  max-width: 1000px;
}
.mk-filter button {
  font: 500 14px/1 'Work Sans', system-ui, sans-serif;
  color: var(--primary);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.mk-filter button:hover { border-color: var(--primary); }
.mk-filter button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #F6F2EA;
}
.mk-filter button:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

.mk-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 560px) { .mk-gallery { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (min-width: 900px) { .mk-gallery { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.mk-gallery img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #DEE0D0;
}
.mk-gallery img[hidden] { display: none; }
.mk-gallery .mk-feature {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: auto;
  height: 0;              /* lèt dei andre bileta styre radhøgda */
  min-height: 100%;
}
.mk-gallery.is-filtered .mk-feature {
  grid-column: auto;
  grid-row: auto;
  aspect-ratio: 1;
  height: auto;
  min-height: 0;
}
/* Filtrert: tre bilete fyller ei rad på breie skjermar */
@media (min-width: 900px) {
  .mk-gallery.is-filtered { grid-template-columns: repeat(3, 1fr); max-width: 860px; margin: 0 auto; }
}

/* CTA */
.mk-cta {
  background: var(--primary);
  color: #F6F2EA;
  padding: 64px 24px;
  text-align: center;
}
.mk-cta .inner { max-width: 600px; margin: 0 auto; }
.mk-cta h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #fff;
  text-wrap: balance;
}
.mk-cta p { margin: 0 0 24px; color: rgba(246,242,234,.8); }
.mk-btn {
  display: inline-block;
  background: var(--ochre);
  color: #1E1A16;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 6px;
  transition: background-color .2s;
}
.mk-btn:hover { background: var(--ochre-hover); }
.mk-btn:focus-visible { outline: 3px solid #F6F2EA; outline-offset: 3px; }
.mk-cta .mk-cta-note {
  margin: 36px auto 0;
  padding-top: 22px;
  border-top: 1px solid rgba(246,242,234,.18);
  font-size: 14px;
  color: rgba(246,242,234,.7);
}
.mk-cta-note a { color: var(--ochre); font-weight: 700; text-decoration: none; }
.mk-cta-note a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* FOOTER */
body.marknad .site-foot {
  background: var(--foot);
  color: rgba(246,242,234,.62);
  font-size: 13px;
  padding: 44px 24px 24px;
  opacity: 1;
}
body.marknad .site-foot .inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
}
body.marknad .site-foot strong { color: #fff; display: block; margin-bottom: 6px; }
body.marknad .site-foot p { margin: 3px 0; }
body.marknad .site-foot .cross {
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  text-align: center; opacity: 1;
}
body.marknad .site-foot a { color: var(--ochre); text-decoration: none; }
body.marknad .site-foot a:hover { color: #fff; }
.foot-logo { height: 27px; width: auto; margin-bottom: 1.1rem; display: block; }

@media (max-width: 640px) {
  .mk-top-logo img { height: 23px; }
  .mk-top-addr { font-size: 12px; }
  .mk-hero { padding: 28px 20px 36px; }
  .mk-strip { grid-template-columns: 1fr; padding: 8px 0; }
  .mk-item { padding: 20px 0; }
  .mk-divider { width: 48px; height: 1px; margin: 0 auto; }
  .mk-finds-head h2, .mk-cta h2 { font-size: 24px; }
}

/* Mobil: framheva bilete blir kvadratisk, filter på éi rad som kan sveipast */
@media (max-width: 559px) {
  .mk-gallery .mk-feature { aspect-ratio: 1; height: auto; min-height: 0; }
  .mk-filter {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    margin: 0 -24px 22px;
    padding: 2px 24px 6px;
    scrollbar-width: none;
  }
  .mk-filter::-webkit-scrollbar { display: none; }
  .mk-filter button { flex: none; }
}
