/* =========================================================================
   estnor.ee (concept) — design system ported from seriell-sanierung.de
   One stylesheet, no build step.
   Aufbau: 1) Tokens  2) Basis  3) Layout-Utilities  4) Komponenten
           5) Seitenspezifisch  6) EstNor-Erweiterungen (Sub-Nav, Breadcrumb,
              Timeline, Gallery, House-Cards — Bereiche, die seriell-sanierung.de
              nicht braucht, im selben Tonsystem)
   ========================================================================= */

/* 1) TOKENS ------------------------------------------------------------------ */
:root {
  --paper:        #f6f4ee;
  --paper-alt:    #efece2;
  --surface:      #ffffff;
  --ink:          #1b211d;
  --ink-soft:     #4b544d;
  --line:         #e3ddd0;

  --spruce:       #1c4f23;   /* Primary: spruce/timber + sustainability (matches the real EstNor logo green) */
  --spruce-deep:  #133517;
  --spruce-tint:  #e8f0e9;
  --ochre:        #dd8a2c;   /* Accent: warm fibre-cement / brick tone   */
  --ochre-deep:   #b96f1c;

  --font-display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Inter', 'Helvetica Neue', Arial, sans-serif;

  /* One corner radius everywhere — the product cards' 4px. The three
     names are kept so nothing has to be re-classed, but they're equal. */
  --r-sm: 4px;
  --r-md: 4px;
  --r-lg: 4px;

  --wrap: 1140px;
  --pad-section: clamp(3.5rem, 8vw, 6.5rem);
  --shadow: 0 1px 2px rgba(19, 52, 42, .04), 0 12px 32px -12px rgba(19, 52, 42, .12);
}

/* 2) BASIS ----------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
  /* iOS/iPadOS rubber-band overscroll reveals the canvas beyond the page.
     Don't bounce where the browser honours this (Safari 16+, Chrome), and
     where it still does, paint the canvas paper above and footer-green
     below so a bounce past the footer shows green, not a light strip. */
  overscroll-behavior-y: none;
  /* Canvas is paper; one green layer, 100 000px tall, anchored so its top
     edge sits exactly at the page's bottom edge and does not repeat — so a
     bounce past the footer reveals green however far it goes, while a
     bounce at the top reveals paper. (A half/half gradient tiled beyond
     the page and showed a paper strip right after the footer.) */
  background: linear-gradient(var(--spruce-deep), var(--spruce-deep)) 0 calc(100% + 100000px) / 100% 100000px no-repeat, var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  min-height: 100vh; /* the body's paper always covers the viewport; the green half of the html canvas only ever shows beyond the page end */
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

p, h1, h2, h3, dd, .check li, .buildup span { hyphens: auto; }
.nav a, .btn, .brand-caption { hyphens: manual; white-space: nowrap; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--spruce-deep);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 .55em;
  font-weight: 600;
}
h1 { font-size: clamp(2.15rem, 5vw, 3.35rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.24rem; }

p { margin: 0 0 1.1em; max-width: 64ch; }
a { color: var(--spruce); }
a:hover { color: var(--spruce-deep); }

img, svg { max-width: 100%; display: block; }

ul { margin: 0 0 1.1em; padding-left: 1.2em; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--spruce-deep); color: #fff;
  padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0; z-index: 200;
}
.skip-link:focus { left: 0; color: #fff; }

:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }

/* 3) LAYOUT-UTILITIES --------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.25rem);
}

.section { padding-block: var(--pad-section); }
.section--alt  { background: var(--paper-alt); }
.section--tint { background: var(--spruce-tint); }
.section--dark {
  background: var(--spruce-deep);
  color: #d9e4dd;
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }
.section--dark a { color: #fff; }

.section-head { max-width: 46rem; margin-bottom: 2.6rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center p { margin-inline: auto; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ochre-deep);
  margin-bottom: .9em;
}
.section--dark .eyebrow { color: var(--ochre); }

.lead { font-size: 1.16rem; color: var(--ink-soft); max-width: 56ch; }
.section--dark .lead { color: #cddbd2; }

.grid { display: grid; gap: 1.75rem; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
/* Grid items don't shrink below their content's intrinsic size by default
   — a replaced element like the contact-page map <iframe> can otherwise
   force its whole column (and the page) wider than the viewport. */
.split > * { min-width: 0; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.stack-sm > * + * { margin-top: .6rem; }
.center-text { text-align: center; margin-inline: auto; }

/* 4) KOMPONENTEN --------------------------------------------------------- */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .96rem;
  line-height: 1;
  padding: .92em 1.5em;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, color .14s ease, border-color .14s ease;
}
.btn-primary { background: var(--spruce); color: #fff; }
.btn-primary:hover { background: var(--spruce-deep); color: #fff; transform: translateY(-1px); }
.btn-ghost { border-color: currentColor; color: var(--spruce-deep); background: transparent; }
.btn-ghost:hover { background: var(--spruce-deep); color: #fff; border-color: var(--spruce-deep); }
.section--dark .btn-primary { background: var(--ochre); color: #1c130a; }
.section--dark .btn-primary:hover { background: #ea9a3f; color: #1c130a; }
.section--dark .btn-ghost { color: #fff; }
.section--dark .btn-ghost:hover { background: #fff; color: var(--spruce-deep); }

.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.6rem; }

/* Header / Navigation */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246, 244, 238, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .55rem; }

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-decoration: none; }
.brand-logo { width: auto; height: 58px; display: block; }
.brand-caption { font-size: .72rem; color: var(--ink-soft); letter-spacing: .015em; }
@media (max-width: 480px) { .brand-logo { height: 50px; } }

.bar-right { display: flex; align-items: center; gap: 1.1rem; }

.nav { display: flex; align-items: center; gap: 1.35rem; }
.nav > ul { display: flex; gap: 1.15rem; list-style: none; margin: 0; padding: 0; } /* scoped to the top-level list only — .submenu is also a <ul> nested inside, and must not inherit this row layout */
.nav ul li { position: relative; }
.nav a { text-decoration: none; color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.nav > ul > li > a:hover, .nav a[aria-current="page"] { color: var(--spruce-deep); }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--ochre); }

/* Dropdown sub-navigation (estnor.ee has more page depth than seriell-sanierung.de) */
.has-sub > a .chev { width: 9px; height: 9px; margin-left: .3em; transition: transform .15s ease; display: inline-block; vertical-align: middle; }
.has-sub:focus-within > a .chev { transform: rotate(180deg); }
.submenu {
  position: absolute; top: 100%; left: -.9rem; min-width: 230px; margin-top: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: .4rem;
  list-style: none; margin-block: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
/* The right-most dropdown (About Us) opens to the right of its trigger like
   the others; near the burger breakpoint that put its 230px past the viewport
   edge and gave the page a few px of sideways scroll. Anchor it right instead. */
.nav > ul > li.has-sub:last-child .submenu { left: auto; right: -.9rem; }
.has-sub:focus-within .submenu,
.has-sub.is-open .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.has-sub.is-open > a .chev { transform: rotate(180deg); }
.submenu li a { display: block; padding: .6em .75em; border-radius: var(--r-sm); font-size: .89rem; }
.submenu li a:hover { background: var(--spruce-tint); color: var(--spruce-deep); }
/* Hover-to-open only for devices that actually have a mouse — on touch,
   a tap fires :hover too, and it then stays "stuck" open with no plain
   hover-elsewhere gesture to close it again (classic mobile-Safari trap).
   Touch/coarse-pointer screens get :focus-within (tap opens, tap outside
   or another tap closes it) instead, same as keyboard users always have. */
@media (hover: hover) and (pointer: fine) {
  .has-sub:hover > a .chev { transform: rotate(180deg); }
  .has-sub:hover .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
}

/* Language switcher — a dropdown, styled like the nav's own has-sub
   dropdowns: a small pill trigger showing the current language, hover/
   focus reveals a vertical menu of all 5. */
.lang-switch { position: relative; flex-shrink: 0; }
.lang-switch-trigger {
  display: inline-flex; align-items: center; gap: .35em;
  font-family: var(--font-display); font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: .34em .85em; line-height: 1; cursor: pointer;
}
.lang-switch-trigger .chev { width: 8px; height: 8px; transition: transform .15s ease; }
.lang-switch:focus-within .lang-switch-trigger { color: var(--spruce-deep); border-color: var(--spruce); }
.lang-switch:focus-within .lang-switch-trigger .chev { transform: rotate(180deg); }

.lang-switch-menu {
  position: absolute; top: 100%; right: 0; left: 0; margin-top: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: .3rem; list-style: none; margin-block: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  z-index: 20;
}
.lang-switch:focus-within .lang-switch-menu,
.lang-switch.is-open .lang-switch-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-switch.is-open .lang-switch-trigger { color: var(--spruce-deep); border-color: var(--spruce); }
.lang-switch.is-open .lang-switch-trigger .chev { transform: rotate(180deg); }
.lang-switch-menu a {
  display: block; padding: .42em .3em; border-radius: var(--r-sm); text-align: center;
  font-family: var(--font-display); font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-soft); text-decoration: none;
}
.lang-switch-menu a:hover { background: var(--spruce-tint); color: var(--spruce-deep); }
.lang-switch-menu a[aria-current="true"] { background: var(--spruce); color: #fff; }
/* Same touch-vs-mouse split as .has-sub above: only a real hover-capable
   pointer gets the hover-to-open behavior, so a tap on a touchscreen
   can't leave this dropdown stuck open with no hover-elsewhere to close it. */
@media (hover: hover) and (pointer: fine) {
  .lang-switch:hover .lang-switch-trigger { color: var(--spruce-deep); border-color: var(--spruce); }
  .lang-switch:hover .lang-switch-trigger .chev { transform: rotate(180deg); }
  .lang-switch:hover .lang-switch-menu { opacity: 1; visibility: visible; transform: translateY(0); }
}

/* Two copies of the language switcher exist (see partials/head.php): one
   in the header bar for desktop, one inside the mobile nav drawer — only
   one is ever visible at a time, so it never has to compete with the logo
   and burger for space on a phone-width screen. The mobile copy skips the
   trigger/hover-dropdown entirely (touch has no hover) and instead shows
   its menu as a permanently-open row, matching how .submenu also becomes
   a static list on mobile instead of a hover dropdown. */
#lang-switch-nav { display: none; }
#lang-switch-nav .lang-switch-trigger { display: none; }
#lang-switch-nav .lang-switch-menu {
  position: static; opacity: 1; visibility: visible; transform: none;
  box-shadow: none; border: 0; padding: 0; margin-top: 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}

.nav-burger { display: none; }
@media (max-width: 1120px) {
  .nav-burger {
    display: flex; flex-direction: column; gap: 5px;
    padding: .55rem; cursor: pointer; border: 1px solid var(--line);
    border-radius: var(--r-sm); background: var(--surface);
  }
  .nav-burger span { width: 22px; height: 2px; background: var(--spruce-deep); display: block; }
  /* The drawer fills the screen below the sticky header (its height is
     measured into --header-h by main.js), scrolls on its own, and the page
     behind is locked and dimmed while it's open — so it reads as a menu
     panel rather than a strip with the page showing through underneath. */
  .nav {
    /* absolute, not fixed: the header's backdrop-filter makes it the
       containing block anyway, and it is sticky at the top of the viewport
       while the drawer is open (page scroll locked), so top: 100% of the
       header is the header's bottom edge on screen */
    position: absolute; top: 100%; left: 0; right: 0; height: calc(100dvh - var(--header-h, 96px));
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 1rem;
    background: var(--paper);
    padding: 1.25rem clamp(1.15rem, 4vw, 2.25rem) max(2rem, env(safe-area-inset-bottom));
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .site-header { background: var(--paper); }
  .nav > ul { flex-direction: column; gap: 1rem; }
  .nav a { font-size: 1.06rem; }
  .nav-toggle:checked ~ .nav { transform: translateY(0); opacity: 1; pointer-events: auto; }

  /* Move the language switcher out of the header bar (no room next to the
     logo + burger on a phone) and into the mobile nav drawer instead. */
  #lang-switch-bar { display: none; }
  #lang-switch-nav { display: inline-flex; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); width: 100%; }

  /* Let a long tagline wrap instead of forcing the header wider than the
     viewport (the base rule keeps it on one line on desktop, on purpose). */
  .brand-caption { white-space: normal; max-width: 58vw; }

  /* On mobile the dropdown becomes a static indented list, no hover needed */
  .submenu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; margin: .4rem 0 0 1rem; padding: 0;
    display: flex; flex-direction: column; gap: .55rem;
    border-left: 2px solid var(--line); padding-left: .9rem;
  }
  .submenu li a { padding: 0; font-size: .95rem; color: var(--ink-soft); }
  .has-sub > a .chev { display: none; }
}

/* Hero — full-bleed photo fading into the paper */
.hero {
  position: relative;
  isolation: isolate;
  background: var(--paper);
  min-height: 100vh;   /* fallback for browsers without dvh */
  min-height: 100dvh;  /* real visible viewport — ignores mobile browser chrome */
  display: flex;
  align-items: flex-start;
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(6.5rem, 13vw, 9.5rem);
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; display: block; }
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 55% 40%;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(100deg,
      rgba(246,244,238,.93) 0%,
      rgba(246,244,238,.78) 26%,
      rgba(246,244,238,.42) 58%,
      rgba(246,244,238,.12) 100%),
    linear-gradient(to top, var(--paper) 2%, rgba(246,244,238,.12) 24%, rgba(246,244,238,0) 46%);
}
.hero-inner { position: relative; }
.hero-inner .eyebrow { margin-bottom: 1em; }
.hero-title { margin-bottom: .5em; max-width: 24ch; hyphens: manual; }
.hero-title > span { display: block; }
.hero-accent {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic; font-weight: 500; letter-spacing: 0;
  color: var(--spruce);
  font-size: .95em;
}
.hero .lead { margin-bottom: 0; max-width: 52ch; }
.hero .btn-row { margin-top: 1.75rem; }
@media (max-width: 700px) {
  .hero-bg::after {
    background:
      linear-gradient(to top, var(--paper) 3%, rgba(246,244,238,.68) 46%, rgba(246,244,238,.4) 100%),
      linear-gradient(100deg, rgba(246,244,238,.55), rgba(246,244,238,.14) 85%);
  }
}

/* Serial Renovation page: its own photo (a renovated apartment block)
   and the intro split pulled up over the hero's faded base, the same
   way the homepage floats its product grid — otherwise the full-height
   hero leaves a lot of empty space above the first section. Two
   side-by-side text columns on a bare photo would be hard to read, so
   the split gets a surface panel. */
.hero--renovation .hero-bg img { object-position: 50% 45%; }
.hero--renovation { padding-block-end: calc(clamp(10rem, 30vh, 18rem) + 2.5rem); }
.renovation-intro { padding-block-start: 0; }
.renovation-intro .split {
  position: relative; margin-top: clamp(-18rem, -30vh, -10rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: clamp(1.5rem, 3.5vw, 2.75rem);
}
@media (max-width: 900px) { .renovation-intro .split { margin-top: clamp(-14rem, -24vh, -8rem); } .hero--renovation { padding-block-end: calc(clamp(8rem, 24vh, 14rem) + 2.5rem); } }
@media (max-width: 700px) { .renovation-intro .split { margin-top: clamp(-12rem, -20vh, -6rem); } .hero--renovation { padding-block-end: calc(clamp(6rem, 20vh, 12rem) + 2rem); } }

/* Section landing pages (Products, References, Contact) use the same
   photo hero, but shorter than the homepage's full-viewport one — the
   page's own content should start within the first screen. */
.hero--page { min-height: 62vh; min-height: 62dvh; padding-block: clamp(2.5rem, 6vw, 4rem) clamp(4rem, 8vw, 6rem); }
.hero--page .hero-bg img { object-position: 50% 50%; }

/* Smaller inner-page hero (no photo — used on section/sub-pages) */
.page-hero { min-height: 0; padding-block: clamp(2.6rem, 6vw, 4rem); background: var(--paper-alt); }
.page-hero .hero-title { max-width: 34ch; }
.breadcrumb { font-size: .82rem; color: var(--ink-soft); display: flex; gap: .45em; flex-wrap: wrap; margin-bottom: 1.1rem; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--spruce-deep); text-decoration: underline; }

/* Prefab-panel motif */
.panel-stack {
  --gap: 8px;
  aspect-ratio: 5 / 4;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--gap);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--gap);
  box-shadow: var(--shadow);
}
.panel-stack i {
  display: block;
  border-radius: 4px;
  background: var(--spruce-tint);
  border: 1px solid #d5e0d3;
  position: relative;
}
.panel-stack i::after {
  content: ""; position: absolute; inset: 22% 60% 22% 14%;
  border: 1.5px solid #c2d1bf; border-radius: 2px;
}
.panel-stack i:nth-child(1) { grid-row: span 2; background: var(--spruce); border-color: var(--spruce); }
.panel-stack i:nth-child(1)::after { border-color: rgba(255,255,255,.5); }
.panel-stack i:nth-child(4) { grid-row: span 2; }
.panel-stack i:nth-child(6) { background: var(--ochre); border-color: var(--ochre); }
.panel-stack i:nth-child(6)::after { border-color: rgba(255,255,255,.55); }
.panel-stack i:nth-child(9) { grid-column: span 2; }

/* Stat row */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
@media (max-width: 820px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { border-top: 2px solid var(--ochre); padding-top: 1rem; }
.stat b {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem); color: var(--spruce-deep);
}
.stat span { font-size: .9rem; color: var(--ink-soft); }
.section--dark .stat span { color: #bccabf; }
.section--dark .stat b { color: #fff; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.7rem;
  height: 100%;
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card--tint { background: var(--spruce-tint); border-color: #d5e0d3; }

/* Numbered steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.75rem; grid-template-columns: repeat(4, 1fr); counter-reset: s; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.steps li { border-top: 2px solid var(--ochre); padding-top: 1rem; }
.steps li::before {
  counter-increment: s; content: counter(s, decimal-leading-zero);
  font-family: var(--font-display); font-weight: 700; font-size: 1.4rem;
  color: var(--ochre-deep); display: block; margin-bottom: .4rem;
}
.section--dark .steps li::before { color: var(--ochre); }
.steps h3 { font-size: 1.08rem; margin-bottom: .3em; }
.steps p { font-size: .93rem; margin-bottom: 0; }
.section--dark .steps p { color: #cddbd2; }

/* Checklist */
.check { list-style: none; margin: 1.3rem 0 0; padding: 0; display: grid; gap: .85rem; }
.check li { position: relative; padding-left: 1.9rem; color: var(--ink-soft); }
.section--dark .check li { color: #cddbd2; }
.check li::before {
  content: ""; position: absolute; left: 0; top: .1em;
  width: 1.15rem; height: 1.15rem; border-radius: 4px;
  background: var(--spruce);
  -webkit-mask: no-repeat center/72% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
  mask: no-repeat center/72% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
  background-color: var(--spruce);
}
.section--dark .check li::before { background-color: var(--ochre); }

/* Optional "Download PDF" link next to a certificate's checklist text */
.pdf-link {
  display: inline-flex; align-items: center; gap: .3em; margin-left: .5em;
  font-size: .82rem; font-weight: 600; color: var(--spruce); text-decoration: none;
  white-space: nowrap;
}
.pdf-link::before {
  content: ""; width: .8em; height: .8em; flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: no-repeat center/100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v11.6l4-4 1.4 1.4-6.4 6.4-6.4-6.4L5.9 10.6l4 4V3h2zM5 19h14v2H5z'/%3E%3C/svg%3E");
  mask: no-repeat center/100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v11.6l4-4 1.4 1.4-6.4 6.4-6.4-6.4L5.9 10.6l4 4V3h2zM5 19h14v2H5z'/%3E%3C/svg%3E");
}
.pdf-link:hover { color: var(--spruce-deep); text-decoration: underline; }

/* Element build-up (layer list) */
.buildup { list-style: none; margin: 1.4rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.buildup li { display: flex; gap: 1rem; padding: 1rem 1.3rem; border-top: 1px solid var(--line); }
.buildup li:first-child { border-top: 0; }
.buildup b { font-family: var(--font-display); color: var(--spruce-deep); min-width: 2.2rem; }
.buildup span { color: var(--ink-soft); font-size: .96rem; }

/* Project cards */
.project-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.project-figure { aspect-ratio: 4 / 3; background: var(--spruce-tint); }
.project-figure svg { width: 100%; height: 100%; }
.project-body { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }
.project-body .meta { font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ochre-deep); margin-bottom: .5rem; }
.project-body h3 { margin-bottom: .4em; }
.project-body p { font-size: .95rem; }
.project-stats { display: flex; gap: 1.6rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.project-stats div b { display: block; font-family: var(--font-display); font-size: 1.05rem; color: var(--spruce-deep); }
.project-stats div span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }

.tag { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; background: var(--spruce-tint); color: var(--spruce); padding: .3em .7em; border-radius: 999px; }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }

/* CTA band */
.cta-band { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.cta-band > div { max-width: 44rem; }
.cta-band h2 { margin-bottom: .4em; }
.cta-band p { margin-bottom: 0; }

/* Notice / placeholder callout */
.callout {
  border: 1px dashed var(--ochre-deep);
  background: #fbeee0;
  color: #7a4c14;
  border-radius: var(--r-sm);
  padding: .85rem 1.1rem;
  font-size: .92rem;
  margin: 1.4rem 0;
}
.callout b { color: inherit; }

/* Contact form */
.contact-form { display: grid; gap: 1.05rem; margin-top: 1.4rem; }
.contact-form, .contact-form label, .contact-form select { min-width: 0; width: 100%; } /* a <select>'s widest <option> (varies by language) shouldn't force this grid wider */
.contact-form label { display: grid; gap: .35rem; font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.contact-form input, .contact-form textarea, .contact-form select {
  font: inherit; padding: .72em .9em;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink);
}
.contact-form input:focus, .contact-form textarea:focus, .contact-form select:focus { outline: 2px solid var(--spruce); outline-offset: 1px; background: #fff; }
.contact-form .hp { position: absolute; left: -9999px; }
.contact-form button { justify-self: start; margin-top: .3rem; }

.form-note { font-size: .86rem; color: var(--ink-soft); }
.form-ok  { background: var(--spruce-tint); border: 1px solid #cde0cc; color: var(--spruce-deep); padding: 1rem 1.2rem; border-radius: var(--r-sm); margin-bottom: 1.2rem; }
.form-err { background: #fbe4e0; border: 1px solid #f0c4bb; color: #8f3a2a; padding: 1rem 1.2rem; border-radius: var(--r-sm); margin-bottom: 1.2rem; }

/* Contact definition list */
.contact-dl { display: grid; gap: 1rem; margin: 1.6rem 0; }
.contact-dl dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.contact-dl dd { margin: .2rem 0 0; font-family: var(--font-display); font-weight: 600; color: var(--spruce-deep); font-size: 1.05rem; }

/* Prose (long-form text pages) */
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.4rem; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }

/* Footer */
.site-footer { background: var(--spruce-deep); color: #c4d3c9; padding-block: 3.25rem 1.5rem; }
.site-footer a { color: #c4d3c9; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.foot-grid { display: grid; grid-template-columns: 1.7fr repeat(3, minmax(0, 1fr)); gap: 2rem; }
@media (max-width: 1000px) { .foot-grid { grid-template-columns: 1fr 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }
@media (max-width: 620px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-contact { margin-top: 1.1rem !important; }
.foot-social { display: flex; gap: .6rem; margin: 0; }
.foot-bottom { align-items: center; }
.foot-social a {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: var(--r-sm); border: 1px solid rgba(255,255,255,.18); color: #c4d3c9;
}
.foot-social a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.site-footer h2 a { color: #fff; }
.foot-brand p { color: #a9bcb0; font-size: .92rem; max-width: 38ch; }
.foot-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: #fff; margin-bottom: .7rem; }
.foot-logo img { height: 3.7rem; width: auto; display: block; margin-bottom: .55rem; }
.site-footer h2 { font-size: .8rem; letter-spacing: .09em; text-transform: uppercase; color: #fff; margin-bottom: .9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .92rem; }
.foot-bottom { margin-top: 2.75rem; padding-top: 1.4rem; border-top: 1px solid rgba(255,255,255,.12); display: flex; gap: 1rem 2rem; flex-wrap: wrap; justify-content: space-between; }
.foot-bottom p { margin: 0; font-size: .82rem; color: #8ba393; }

/* About Us: certificates & memberships as a logo wall — one card per mark
   (a card may carry two logos, e.g. Sentral godkjenning + DiBK), with the
   company registry data in a compact two-column list beneath. */
.cert-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.cert-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.25rem 1.25rem 1.1rem; display: flex; flex-direction: column; gap: .9rem; }
.cert-logos { height: 64px; display: flex; align-items: center; gap: 1rem; }
.cert-logos img { max-height: 64px; max-width: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.cert-logos img[src$=".svg"] { height: 40px; }
.cert-grid p { margin: 0; font-size: .9rem; color: var(--ink-soft); line-height: 1.5; }
.registry { margin-top: 3rem; }
.registry-dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem 2rem; }
@media (max-width: 900px) { .cert-grid, .registry-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .cert-grid { grid-template-columns: 1fr; } }

/* Production page photo mosaic: 3 equal 4:3 tiles per row, the first one
   spanning 2x2 as a feature; tiles are buttons opening the shared lightbox. */
.photo-mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.photo-tile { margin: 0; padding: 0; border: 0; background: var(--spruce-deep); border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4 / 3; cursor: pointer; display: block; box-shadow: var(--shadow); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.photo-tile:hover img, .photo-tile:focus-visible img { transform: scale(1.03); }
.photo-tile:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.photo-tile--feature { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
@media (max-width: 700px) { .photo-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } .photo-tile--feature { grid-column: span 2; grid-row: auto; aspect-ratio: 4 / 3; } }

/* Serial Renovation > Process: numbered steps with an illustration each,
   the element-layer diagram, and the animation. */
.process-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.process-steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.process-steps figure { margin: 0; aspect-ratio: 500 / 263; background: #fff; border-bottom: 1px solid var(--line); }
.process-steps figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.process-steps li > div { padding: 1.1rem 1.25rem 1.3rem; }
.process-num { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--ochre-deep); display: block; margin-bottom: .3rem; }
.process-steps h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.process-steps p { margin: 0; font-size: .92rem; color: var(--ink-soft); }
@media (max-width: 900px) { .process-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .process-steps { grid-template-columns: 1fr; } }
.process-video { display: block; width: 100%; max-width: 960px; margin-inline: auto; border-radius: var(--r-md); background: var(--spruce-deep); box-shadow: var(--shadow); }

/* 5) SEITENSPEZIFISCH ---------------------------------------------------- */

.badge-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.9rem; align-items: center; }
.badge-row span {
  font-size: .76rem; font-weight: 500; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .32em .8em; background: rgba(255,255,255,.75);
  white-space: nowrap;
}

/* 6) ESTNOR-ERWEITERUNGEN ------------------------------------------------- */
/* Components estnor.ee needs that seriell-sanierung.de didn't — built in the
   same token system (spruce/ochre/paper) so the whole site reads as one. */

/* House-type teaser cards (home, houses overview) */
.house-card { position: relative; text-decoration: none; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: var(--spruce-deep); min-height: 340px; display: flex; flex-direction: column; justify-content: flex-end; }
.house-card .art { position: absolute; inset: 0; }
.house-card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.house-card .content { position: relative; padding: 1.7rem; background: linear-gradient(180deg, transparent, rgba(15,23,19,.88) 62%); }
.house-card h3 { color: #fff; font-size: 1.3rem; }
.house-card p { color: rgba(246,241,228,.8); font-size: .92rem; }

/* Bento grid (home): mixes house-card product tiles with plain stat cells
   in an asymmetric grid, instead of a separate product row + stat row. */
.bento-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 220px; gap: 1.1rem; }
.bento-grid .house-card { min-height: 0; border-radius: var(--r-sm); }
.bento-grid .house-card .content { padding: 1.4rem; background: none; }
.bento-grid .house-card h3 { font-size: 1.15rem; margin: .1rem 0 .3rem; }
.bento-grid .house-card p { font-size: .85rem; max-width: 42ch; }
.bento-grid .span-2 { grid-column: span 2; }
/* Pull the grid up so its top row overlaps the hero's bottom edge —
   scoped to the homepage product section only (.bento-grid is reused
   without this effect wherever else it might appear). The hero is full
   viewport height now, so the offset scales with vh (clamped so it
   never crowds the hero text on a short window or shrinks to nothing
   on a tall one) instead of a single fixed rem value. */
.home-products { padding-block-start: 0; }
.home-products .bento-grid { margin-top: clamp(-22rem, -36vh, -14rem); position: relative; }
/* The hero's bottom padding must always be at least that overlap plus a
   gap, so the pulled-up grid lands below the hero text on every screen —
   with a short viewport (tablet in landscape) the text otherwise ran
   under the cards. Each breakpoint mirrors the grid's own margin-top. */
.hero--home { padding-block-end: calc(clamp(14rem, 36vh, 22rem) + 2.5rem); }
/* Full-height, brand-tinted photo overlay (replaces the generic dark
   fade elsewhere) — sits on .art, before .content in source order, so it
   washes the whole photo while staying under the text. */
.bento-grid .house-card .art::after, .products-grid .house-card .art::after { content: ""; position: absolute; inset: 0; }
/* Products index: same photo cards + brand tint as the homepage bento, text over the tint rather than a second gradient */
.products-grid .house-card .content { background: none; }
/* Three cards don't split evenly into two columns — stack them on tablets instead of leaving one orphan */
@media (max-width: 900px) { .products-grid { grid-template-columns: 1fr; } .products-grid .house-card { min-height: 300px !important; } }
.house-card--element .art::after { background: linear-gradient(180deg, rgba(19,53,23,.15) 0%, rgba(19,53,23,.55) 55%, rgba(19,53,23,.93) 100%); }
.house-card--modular .art::after { background: linear-gradient(180deg, rgba(28,79,35,.2) 0%, rgba(28,79,35,.6) 55%, rgba(28,79,35,.94) 100%); }
.house-card--facade .art::after { background: linear-gradient(180deg, rgba(32,92,41,.2) 0%, rgba(32,92,41,.6) 50%, rgba(32,92,41,.94) 100%); }
.house-card--renovation .art::after { background: linear-gradient(180deg, rgba(37,106,47,.2) 0%, rgba(37,106,47,.6) 50%, rgba(37,106,47,.94) 100%); }
@media (max-width: 900px) {
  .bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 200px; }
  .home-products .bento-grid { margin-top: clamp(-19rem, -32vh, -12rem); }
  .hero--home { padding-block-end: calc(clamp(12rem, 32vh, 19rem) + 2.5rem); }
}
@media (max-width: 620px) {
  .bento-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .bento-grid .house-card { min-height: 220px; }
  .bento-grid .span-2 { grid-column: span 1; }
  /* The hero is full height here too now, so keep the overlap — just a
     touch gentler, since a single stacked column has less room either
     side of the first card. */
  .home-products .bento-grid { margin-top: clamp(-17rem, -28vh, -10rem); }
  .hero--home { padding-block-end: calc(clamp(10rem, 28vh, 17rem) + 2rem); }
}

/* Reference cards — homepage teaser (3 latest) and the full References
   page grid. Same house-card visual language as the bento product tiles,
   but these are buttons that open .ref-lightbox instead of links. */
/* Real photos in content sections (modular houses page): a bordered
   card with the image filling it, and a 3-up row of them. */
.photo-card { margin: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); aspect-ratio: 4 / 3; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A labelled diagram must never be cropped: natural aspect, shown whole. (Must come after the base rules above.) */
.photo-card--diagram { aspect-ratio: auto; background: #fff; padding: .75rem; }
.photo-card--diagram img { height: auto; object-fit: contain; }
/* Element cross-section: full-width render with numbered SVG markers, a
   legend of numbered chips beneath, and hover/focus links between the two. */
.diagram-annotated { position: relative; padding: 0; margin: 0; }
.diagram-markers { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.diagram-marker { cursor: default; transition: transform .15s ease; transform-box: fill-box; transform-origin: center; }
.diagram-marker circle { fill: var(--spruce-deep); stroke: #fff; stroke-width: 6; transition: fill .15s ease; }
.diagram-marker text { fill: #fff; font-family: var(--font-display); font-weight: 700; font-size: 52px; text-anchor: middle; pointer-events: none; }
.diagram-marker.is-active circle, .diagram-marker:hover circle { fill: var(--ochre-deep); }
.diagram-tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  background: var(--spruce-deep); color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap;
  padding: .4em .75em; border-radius: var(--r-sm); box-shadow: var(--shadow);
}
.diagram-tip::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--spruce-deep); }
.diagram-legend { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: .6rem; }
.diagram-legend li { display: flex; }
.diagram-legend button {
  width: 100%; height: 100%; display: flex; align-items: center; gap: .6rem; text-align: left; cursor: default;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .55rem .75rem;
  font: inherit; font-size: .88rem; color: var(--ink); line-height: 1.3; transition: border-color .15s ease, background .15s ease;
}
.diagram-legend button:hover, .diagram-legend button:focus-visible, .diagram-legend button.is-active { border-color: var(--ochre-deep); background: #fff; outline: none; }
.diagram-legend b { flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--spruce-deep); color: #fff; font-family: var(--font-display); font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; transition: background .15s ease; }
.diagram-legend button:hover b, .diagram-legend button:focus-visible b, .diagram-legend button.is-active b { background: var(--ochre-deep); }
@media (max-width: 1000px) { .diagram-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .diagram-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } .diagram-marker text { font-size: 64px; } .diagram-marker circle { r: 60; } }
.photo-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 700px) { .photo-row { grid-template-columns: 1fr; } }

/* References page category filter (?type=...) */
.ref-filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.ref-filter a {
  display: inline-block; padding: .45em 1em; border-radius: var(--r-sm); font-size: .88rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
}
.ref-filter a:hover { border-color: var(--spruce); color: var(--spruce); }
.ref-filter a[aria-current="true"] { background: var(--spruce-deep); border-color: var(--spruce-deep); color: #fff; }
.ref-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; }
.ref-card {
  position: relative; display: block; width: 100%; height: 280px;
  margin: 0; padding: 0; border: 0; border-radius: var(--r-lg); overflow: hidden;
  background: var(--spruce-deep); box-shadow: var(--shadow);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.ref-card-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-photo-placeholder {
  background-color: #e2ddd0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 10px, rgba(0,0,0,.03) 10px 20px);
}
.ref-card-fade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(15,23,19,.88) 62%); }
.ref-view-icon {
  position: absolute; top: .9rem; right: .9rem; width: 34px; height: 34px; border-radius: 999px;
  background: rgba(19,53,23,.4); display: flex; align-items: center; justify-content: center;
}
.ref-card-content { position: absolute; inset: auto 0 0 0; padding: 1.7rem; }
.ref-tag {
  display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: .68rem;
  letter-spacing: .04em; background: var(--ochre); color: #1c130a; padding: .3em .75em;
  border-radius: 999px; margin: 0 0 .7em;
}
.ref-card-title { display: block; color: #fff; font-size: 1.2rem; margin: 0 0 .3rem; }
.ref-card-category { display: block; color: rgba(246,241,228,.85); font-size: .85rem; }
@media (max-width: 900px) { .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .ref-grid { grid-template-columns: 1fr; } .ref-card { height: 240px; } }

/* Reference lightbox — the click-to-open album overlay. Hidden by
   default (partials/reference-lightbox.php sets [hidden]); JS
   (assets/js/references.js) toggles it and fills in the focused
   reference's photos/title/description. */
.ref-lightbox {
  position: fixed; inset: 0; z-index: 1000; padding: 2rem;
  background: rgba(19,53,23,.6);
  display: flex; align-items: center; justify-content: center;
}
.ref-lightbox[hidden] { display: none; }
body.ref-lightbox-open { overflow: hidden; }
.ref-lightbox-panel {
  position: relative; width: min(880px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 24px 64px -16px rgba(10,20,14,.5);
}
.ref-lightbox-media { position: relative; flex-shrink: 0; background: var(--spruce-deep); }
.ref-media-frame { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; }
/* contain, not cover: an album photo must never be cropped — wide before/after composites and portrait shots letterbox on the dark ground instead */
.ref-media-frame img, .ref-media-frame .ref-photo-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ref-lightbox-close, .ref-lightbox-prev, .ref-lightbox-next {
  position: absolute; width: 40px; height: 40px; border: 0; border-radius: 999px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ref-lightbox-close { top: .9rem; right: .9rem; background: rgba(255,255,255,.92); color: var(--spruce-deep); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.ref-lightbox-prev, .ref-lightbox-next { top: 50%; transform: translateY(-50%); background: rgba(19,53,23,.45); color: #fff; }
.ref-lightbox-prev { left: .9rem; }
.ref-lightbox-next { right: .9rem; }
.ref-lightbox-count {
  position: absolute; bottom: .9rem; right: .9rem; border-radius: 999px;
  background: rgba(19,53,23,.6); color: #fff; font-family: var(--font-display);
  font-size: .72rem; font-weight: 600; padding: .35em .9em;
}
.ref-lightbox-prev[hidden], .ref-lightbox-next[hidden], .ref-lightbox-count[hidden], .ref-lightbox-thumbs[hidden] { display: none; }
.ref-lightbox-thumbs { display: flex; gap: .6rem; padding: 1rem 1.5rem; overflow-x: auto; flex-shrink: 0; -webkit-overflow-scrolling: touch; }
.ref-lightbox-thumbs button {
  flex: 0 0 auto; width: 74px; height: 52px; padding: 0; border-radius: var(--r-sm); overflow: hidden;
  border: 2px solid transparent; background: var(--paper-alt); opacity: .55; cursor: pointer;
}
.ref-lightbox-thumbs button.is-active { opacity: 1; border-color: var(--ochre); }
.ref-lightbox-thumbs img, .ref-lightbox-thumbs .ref-photo-placeholder { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-lightbox-body { padding: .5rem 2rem 2rem; overflow-y: auto; }
.ref-lightbox-category {
  font-family: var(--font-display); font-size: .76rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ochre-deep); margin-bottom: .8em;
}
.ref-lightbox-title { margin: 0 0 .5em; font-size: 1.6rem; color: var(--spruce-deep); }
.ref-lightbox-location[hidden] { display: none; }
.ref-lightbox-location { display: flex; align-items: center; gap: .4em; color: var(--ink-soft); font-size: .95rem; margin-bottom: .9em; }
.ref-lightbox-desc { color: var(--ink-soft); line-height: 1.55; max-width: 68ch; margin: 0 0 1em; }
.ref-lightbox-cta { font-family: var(--font-display); font-weight: 600; font-size: .95rem; }
@media (max-width: 700px) {
  .ref-lightbox { padding: 0; }
  .ref-lightbox-panel { width: 100%; height: 100%; max-height: 100dvh; border-radius: 0; }
  .ref-media-frame { aspect-ratio: 4 / 3; }
  .ref-lightbox-close, .ref-lightbox-prev, .ref-lightbox-next { width: 44px; height: 44px; }
  .ref-lightbox-body { padding: .5rem 1.25rem 1.5rem; }
  .ref-lightbox-title { font-size: 1.35rem; }
}

.stat-cell {
  border-radius: var(--r-sm); padding: 1.5rem; display: flex; flex-direction: column;
  justify-content: space-between; background: var(--surface); border: 1px solid var(--line);
}
.stat-cell .tag { background: transparent; padding: 0; color: var(--ink-soft); }
.stat-cell b { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--spruce-deep); display: block; }
.stat-cell span { font-size: .82rem; color: var(--ink-soft); margin-top: .2rem; display: block; }
.stat-cell--dark { background: var(--spruce-deep); border-color: var(--spruce-deep); }
.stat-cell--dark .tag { color: #9fb8ab; }
.stat-cell--dark b { color: var(--ochre); }
.stat-cell--dark span { color: #c9d6cd; }
.stat-cell--ochre { background: var(--ochre); border-color: var(--ochre); }
.stat-cell--ochre .tag { color: rgba(19,53,23,.7); }
.stat-cell--ochre b { color: var(--spruce-deep); }
.stat-cell--ochre span { color: var(--spruce-deep); }

/* History timeline (About EstNor) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 2.1rem; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 1.9rem; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(-2.1rem - 1px); transform: translateX(-50%); top: .2rem; width: 11px; height: 11px; border-radius: 50%; background: var(--ochre); border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--ochre); }
.timeline .year { font-family: var(--font-display); font-weight: 700; color: var(--spruce-deep); font-size: 1.1rem; display: block; margin-bottom: .2rem; }
.section--alt .timeline li::before { border-color: var(--paper-alt); }

/* Gallery grid */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.gallery-grid .tile { aspect-ratio: 1/1; border-radius: var(--r-md); overflow: hidden; position: relative; }
.gallery-grid .tile.tall { grid-row: span 2; aspect-ratio: 1/2.15; }
.gallery-grid .tile svg { width: 100%; height: 100%; }
.gallery-grid .tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: .85rem 1rem; font-size: .82rem; font-weight: 600; color: #fff; background: linear-gradient(180deg, transparent, rgba(15,23,19,.85)); }
/* Explicit placement of the 6 tiles (2 tall + 4 square, in that fixed markup
   order on every language's gallery.php) so the two tall tiles land in
   different columns — left to the grid's own auto-placement, both tall
   tiles fell into column 1 and stacked, leaving column 1 twice as tall as
   columns 2/3 with a lot of dead space beside it. */
.gallery-grid .tile:nth-of-type(1) { grid-column: 1; grid-row: 1 / span 2; }
.gallery-grid .tile:nth-of-type(2) { grid-column: 3; grid-row: 1; }
.gallery-grid .tile:nth-of-type(3) { grid-column: 3; grid-row: 2; }
.gallery-grid .tile:nth-of-type(4) { grid-column: 1; grid-row: 3; }
.gallery-grid .tile:nth-of-type(5) { grid-column: 2; grid-row: 3; }
.gallery-grid .tile:nth-of-type(6) { grid-column: 2; grid-row: 1 / span 2; }
@media (max-width: 620px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .gallery-grid .tile.tall { grid-row: span 1; aspect-ratio: 1/1; }
  .gallery-grid .tile:nth-of-type(n) { grid-column: auto; grid-row: auto; }
}

/* Map embed frame */
.map-frame { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); margin-top: 2rem; }
.map-frame iframe { width: 100%; height: 320px; border: 0; display: block; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
