/* Layout: quiet gallery-wall page. Name set large, one wide watercolor as the
   hero, then a plain bio and three masonry walls. The paintings carry the color;
   the page stays in cool coastal greys so nothing competes with them. */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("fonts/karla-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("fonts/karla-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #f2f3f1;        /* sea-mist white */
  --surface: #e7e9e6;   /* slightly deeper, behind images */
  --ink: #1c2226;       /* body text */
  --muted: #5d676c;     /* captions, secondary */
  --rule: #cfd4d2;
  --accent: #2c5966;    /* Kattegatt blue-green */
  --accent-ink: #f2f3f1;

  --display: "Cormorant Garamond", Garamond, "Palatino Linotype", Georgia, serif;
  --body: "Karla", "Segoe UI", system-ui, -apple-system, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 2.3rem;
  --step-3: clamp(3rem, 8vw, 6rem);

  --maxw: 1180px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191b;
    --surface: #1d2326;
    --ink: #e4e7e5;
    --muted: #97a2a6;
    --rule: #2e3639;
    --accent: #8fbcc7;
    --accent-ink: #15191b;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 14px max(20px, env(safe-area-inset-right, 0px)) 14px max(20px, env(safe-area-inset-left, 0px));
  display: flex; align-items: baseline; gap: 24px; justify-content: space-between;
}
.brand {
  font-family: var(--display); font-weight: 600; font-size: 1.35rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.nav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); text-decoration: none; white-space: nowrap;
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.nav a:hover, .nav a.active { color: var(--ink); }

@media (max-width: 760px) {
  .topbar-inner { flex-direction: column; gap: 6px; padding-block: 10px; }
  .nav { width: 100%; gap: 18px; padding-bottom: 2px; }
  html { scroll-padding-top: 96px; }
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(40px, 8vw, 96px); }
.hero-text { padding-bottom: clamp(28px, 4vw, 48px); }
h1 {
  font-family: var(--display); font-weight: 500; font-size: var(--step-3);
  line-height: 1; letter-spacing: -0.01em; margin: 0;
}
.tagline {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: var(--step-2); color: var(--accent); margin: 8px 0 0;
}
/* Banner strip, never wider than the page content. Which part of the
   painting shows is set by hero_focus_y in content.json (0 = top, 100 = bottom). */
.hero-image { margin-block: 0; }
.hero-image img {
  width: 100%; height: auto; aspect-ratio: 4 / 1;
  object-fit: cover;
  background: var(--surface);
}
.hero-image figcaption {
  font-size: var(--step--1); color: var(--muted); padding-top: 10px;
}
@media (max-width: 760px) {
  .hero-image { padding-left: 0; padding-right: 0; }
  .hero-image img { aspect-ratio: 2.2 / 1; }
  .hero-image figcaption {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
  }
}

/* ---------- Section titles ---------- */
.section-title {
  font-family: var(--display); font-weight: 500; font-size: var(--step-2);
  line-height: 1.15; margin: 0 0 20px; text-wrap: balance;
}
h3 {
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.muted { color: var(--muted); }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  padding-block: clamp(64px, 9vw, 120px);
}
.about-main p { max-width: 62ch; margin: 0 0 1em; }
.about-main p:first-of-type { font-size: var(--step-1); line-height: 1.5; }
.about-facts { display: flex; flex-direction: column; gap: 32px; }
.fact-block ul { list-style: none; margin: 0; padding: 0; }
.fact-block li {
  padding: 7px 0; border-top: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.5;
}
.fact-block li:last-child { border-bottom: 1px solid var(--rule); }
.fact-block p { font-size: var(--step--1); margin: 0 0 10px; }
.portrait { margin: 32px 0 0; max-width: 340px; }
.portrait img { width: 100%; background: var(--surface); }
.portrait.flipped img { transform: scaleX(-1); }
.portrait figcaption { font-size: var(--step--1); color: var(--muted); margin-top: 6px; }

@media (max-width: 860px) {
  .about { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Galleries ---------- */
.gallery-section { padding-block: clamp(48px, 7vw, 96px); border-top: 1px solid var(--rule); }
.gallery-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.count { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

/* Rows read left to right in the order set in the admin page. Each painting
   gets a share of the row matching its width/height ratio (--ar), so all
   paintings in a row end up the same height and none are cropped. */
.gallery { --row-h: 270px; display: flex; flex-wrap: wrap; gap: 36px 24px; }
.gallery::after { content: ""; flex: 999 1 0; }   /* stops the last row from stretching */
.work { flex: var(--ar) 1 calc(var(--ar) * var(--row-h)); min-width: 0; margin: 0; }
@media (max-width: 760px) { .gallery { --row-h: 170px; gap: 28px 16px; } }
.work-open {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  background: var(--surface);
}
.work-open img {
  width: 100%; height: auto;
  transition: opacity .25s ease, transform .4s ease;
}
.work-open:hover img { opacity: .92; }
.work figcaption { display: flex; flex-direction: column; gap: 1px; padding-top: 10px; }
.work-title { font-family: var(--display); font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.work-meta { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

/* ---------- News + contact ---------- */
.contact { padding-block: clamp(64px, 9vw, 120px); border-top: 1px solid var(--rule); }
.news { margin-bottom: clamp(48px, 6vw, 80px); max-width: 62ch; }
.news-text { font-size: var(--step-1); margin: 0; }
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 88px);
}
@media (max-width: 860px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.contact-info p { max-width: 46ch; margin-top: 0; }
.contact-info dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 24px 0 0; }
.contact-info dt {
  color: var(--muted); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; padding-top: 3px;
}
.contact-info dd { margin: 0; font-size: var(--step-1); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.contact-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: var(--step--1); }
.req { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-bottom-color: var(--muted);
  padding: 11px 12px; border-radius: 2px; width: 100%;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field textarea { resize: vertical; min-height: 140px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn {
  align-self: flex-start; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 2px; padding: 12px 22px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.form-status { margin: 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface); }
.form-status.err { border-left-color: #b4412f; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--rule); padding-block: 28px; color: var(--muted); font-size: var(--step--1); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- Lightbox (always dark, like a viewing room) ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #0e1112; color: #e4e7e5;
  display: none; flex-direction: column;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(10, 12, 13, .9); }
.lb-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-bar {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 14px max(20px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
.lb-caption { display: flex; flex-direction: column; min-width: 0; }
.lb-title { font-family: var(--display); font-size: 1.5rem; font-weight: 600; }
.lb-meta { color: #97a2a6; font-size: var(--step--1); }
.lb-controls { display: flex; align-items: center; gap: 8px; }
.lb-pos { color: #97a2a6; font-size: var(--step--1); font-variant-numeric: tabular-nums; margin-right: 8px; }
.lb-btn {
  font: inherit; font-size: 1.1rem; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #3a4447; background: transparent; color: #e4e7e5; cursor: pointer;
}
.lb-btn:hover { background: #1f2629; }
