:root {
  --fg: #1a1815;
  --fg-muted: #6b6557;
  --bg-base:  #e6dfd2;          /* varm steintone, litt mørkere – gir mer kontrast */
  --bg-light: #f6f0e3;          /* høylys */
  --bg-warm:  #f0d9b5;          /* svak varm "sol"-flekk */
  --bg-dark:  #c9bfac;          /* mørkere åre */
  --bg-deep:  #998c74;          /* dyp skygge for vignett */
  --line: rgba(80, 70, 50, 0.18);
  --accent: #1a1815;
  --max: 1400px;
  --gap: clamp(16px, 2.5vw, 32px);
  --pad: clamp(20px, 4vw, 48px);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg-base);
  /* Layer-rekkefølge (øverst først): grain → varm sollys-flekk → 4 årer → vignett */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse 45% 35% at 30% 40%, rgba(245, 225, 190, 0.55), transparent 65%),
    radial-gradient(ellipse 70% 55% at 12% 18%, var(--bg-light), transparent 55%),
    radial-gradient(ellipse 60% 50% at 92% 12%, var(--bg-dark), transparent 55%),
    radial-gradient(ellipse 80% 50% at 78% 85%, var(--bg-light), transparent 60%),
    radial-gradient(ellipse 55% 50% at 18% 95%, var(--bg-dark), transparent 55%),
    radial-gradient(ellipse 130% 100% at 50% 50%, transparent 35%, rgba(70, 55, 35, 0.18) 100%);
  background-attachment: fixed;
  background-size: 420px 420px, auto, auto, auto, auto, auto, auto;
  /* Veldig langsom drift – knapt merkbar, men gir liv */
  animation: marble-drift 90s ease-in-out infinite alternate;
}

@keyframes marble-drift {
  0%   { background-position: 0 0,        0 0,    0 0,    0 0,    0 0,    0 0,    0 0; }
  100% { background-position: 60px 90px,  -2% 1%, 2% -1%, -2% 1%, 1% -1%, -1% 1%, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--pad);
  max-width: var(--max);
  margin: 0 auto;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 500;
  letter-spacing: 0.5px;
}
.site-nav {
  display: flex;
  gap: clamp(16px, 2.5vw, 32px);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav a {
  position: relative;
  padding: 4px 0;
  color: var(--fg-muted);
  transition: color .15s ease;
}
.site-nav a:hover,
.site-nav a.active { color: var(--fg); }
.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--fg);
}

/* ---------- Main ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) 80px;
}

.hero {
  padding: clamp(32px, 6vw, 72px) 0 clamp(40px, 7vw, 88px);
  max-width: 880px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4.2vw, 48px);
  line-height: 1.2;
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.2px;
}

/* ---------- Grid (forside) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
}
.card {
  display: block;
  position: relative;
}
.card-image {
  aspect-ratio: 4 / 3;
  background: rgba(214, 206, 190, 0.45);
  overflow: hidden;
  /* Stein-ramme: tynn lys kant + myk skygge ned i marmoren */
  border: 1px solid rgba(255, 250, 240, 0.55);
  box-shadow:
    0 1px 0 rgba(255, 250, 240, 0.4) inset,
    0 14px 28px -10px rgba(60, 45, 25, 0.22),
    0 4px 10px -4px rgba(60, 45, 25, 0.18);
  transition: box-shadow .35s ease, transform .35s ease;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .3s;
}
.card:hover .card-image {
  box-shadow:
    0 1px 0 rgba(255, 250, 240, 0.5) inset,
    0 22px 40px -12px rgba(60, 45, 25, 0.28),
    0 6px 14px -6px rgba(60, 45, 25, 0.22);
  transform: translateY(-2px);
}
.card:hover .card-image img { transform: scale(1.04); }
.card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 0;
}
.card-meta h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 2vw, 24px);
  margin: 0;
  letter-spacing: 0.2px;
}
.card-meta .year {
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
}

/* ---------- Galleri-side ---------- */
.gallery-header {
  padding: clamp(24px, 4vw, 48px) 0 clamp(28px, 5vw, 56px);
  max-width: 760px;
}
.gallery-header .back {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.gallery-header .back:hover { color: var(--fg); }
.gallery-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 56px);
  margin: 12px 0 8px;
  letter-spacing: 0.2px;
  line-height: 1.1;
}
.gallery-header .year {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.gallery-header .description {
  margin-top: 16px;
  color: var(--fg-muted);
  max-width: 64ch;
}

/* Masonry-aktig kolonne-layout: enkel og holder seg konsistent på alle nettlesere */
.masonry {
  column-count: 1;
  column-gap: var(--gap);
}
@media (min-width: 700px)  { .masonry { column-count: 2; } }
@media (min-width: 1100px) { .masonry { column-count: 3; } }
.masonry .photo {
  break-inside: avoid;
  margin: 0 0 var(--gap);
}
.masonry img {
  width: 100%;
  cursor: zoom-in;
  background: rgba(214, 206, 190, 0.45);
  border: 1px solid rgba(255, 250, 240, 0.5);
  box-shadow:
    0 12px 24px -10px rgba(60, 45, 25, 0.20),
    0 4px 8px -4px rgba(60, 45, 25, 0.16);
  transition: filter .2s, box-shadow .35s ease, transform .35s ease;
}
.masonry img:hover {
  filter: brightness(0.98);
  box-shadow:
    0 18px 32px -12px rgba(60, 45, 25, 0.26),
    0 6px 12px -6px rgba(60, 45, 25, 0.20);
  transform: translateY(-2px);
}

/* ---------- Lightbox ---------- */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,8,8,0.96);
  z-index: 100;
  display: grid;
  place-items: center;
  cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
#lightbox button {
  position: absolute;
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 16px 20px;
  opacity: .7;
  transition: opacity .2s;
}
#lightbox button:hover { opacity: 1; }
.lightbox-close { top: 12px;  right: 12px; font-size: 36px; }
.lightbox-prev  { left: 8px;  top: 50%; transform: translateY(-50%); font-size: 60px; }
.lightbox-next  { right: 8px; top: 50%; transform: translateY(-50%); font-size: 60px; }

/* ---------- Statiske sider (about/contact) ---------- */
.page {
  max-width: 64ch;
  padding: clamp(24px, 4vw, 48px) 0 64px;
}
.page h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4.5vw, 48px);
  margin: 0 0 24px;
  letter-spacing: 0.2px;
  line-height: 1.15;
}
.page p { margin: 0 0 1em; }
.page a { border-bottom: 1px solid var(--line); }
.page a:hover { border-color: var(--fg); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px var(--pad);
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}

/* ---------- Mobile ---------- */
@media (max-width: 540px) {
  .site-header { padding-bottom: 12px; }
  .site-nav { gap: 16px; }
  .site-nav a { font-size: 12px; }
  .grid { grid-template-columns: 1fr; }
}
