:root {
  --bg: #fff;
  --text: #111;
  --muted: #767676;
  --line: #e6e6e6;
  --row: 320px;
  --serif: "EB Garamond", "EB Garamond Fallback", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
}

a { color: inherit; text-decoration: none; }

.top, main, .bottom {
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 40px;
}

/* Header: name left, galleries and the two meta links right. */

.top {
  display: flex;
  align-items: baseline;
  gap: 12px 40px;
  padding-block: 32px 48px;
}
.name {
  margin-right: auto;
  font: 400 24px/1.2 var(--serif);
  letter-spacing: 0.005em;
}
.top nav {
  display: flex;
  gap: 4px 24px;
}
.top nav a { color: var(--muted); transition: color 0.15s; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.top .meta {
  padding-left: 40px;
  border-left: 1px solid var(--line);
}

/* Headings */

h1 {
  margin: 0 0 28px;
  font: 400 40px/1.1 var(--serif);
}

.lead {
  max-width: 18em;
  margin: 8px 0 56px;
  font: 400 clamp(30px, 4.2vw, 54px)/1.12 var(--serif);
}

/* Front page: one cover per gallery. The frame fixes the shape, so all four
   line up exactly whatever the photo's own proportions. */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.tile { display: block; }
.frame {
  display: block;
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f3f3f3;
}
.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.tile:hover img { opacity: 0.88; }
.label {
  display: block;
  margin-top: 14px;
  font: 400 22px/1.2 var(--serif);
}

/* Justified photo rows: each photo grows in proportion to its aspect ratio,
   so every row ends up the same height. */

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.grid::after {
  content: "";
  flex: 1000000 1 0;
}
.ph {
  flex: calc(var(--r) * 1000) 1 calc(var(--r) * var(--row));
  background: #f3f3f3;
  cursor: zoom-in;
}
.ph img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--r);
}

/* Footer */

.bottom {
  display: flex;
  gap: 24px;
  margin-top: 96px;
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.bottom a:hover { color: var(--text); }

/* Om mig */

.about {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 580px);
  gap: 64px;
  align-items: start;
}
.about img {
  width: 100%;
  height: auto;
}
.about h1 { margin-bottom: 24px; }
.about p { margin: 0 0 1em; font: 400 19px/1.55 var(--serif); }
.about a, .contact a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: #bbb; }
.about a:hover, .contact a:hover { text-decoration-color: currentColor; }

/* Kontakt */

.contact-wrap {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 420px);
  justify-content: space-between;
  gap: 64px;
  align-items: start;
}
.contact-photo { width: 100%; height: auto; display: block; }
.contact h1 { margin-bottom: 20px; }
.contact > p { margin: 0 0 28px; font: 400 19px/1.55 var(--serif); }
.status { padding: 12px 16px; border: 1px solid var(--line); }
.contact > p.status { font: inherit; }
.status.err { border-color: #c44; }
form { display: grid; gap: 20px; margin-bottom: 32px; }
label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  background: transparent;
  resize: vertical;
}
input:focus, textarea:focus { outline: none; border-bottom-color: var(--text); }
input::placeholder { color: #aaa; }
button {
  justify-self: start;
  margin-top: 8px;
  font: inherit;
  padding: 11px 32px;
  color: var(--bg);
  background: var(--text);
  border: 0;
  cursor: pointer;
}
button:hover { background: #333; }
.hp { position: absolute; left: -9999px; }
.direct { color: var(--muted); font-size: 13px; }

/* Lightbox */

.lb {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.98);
  padding: 56px 88px;
}
.lb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lb button {
  position: absolute;
  margin: 0;
  padding: 16px;
  color: var(--muted);
  background: none;
  font-size: 13px;
}
.lb button:hover { color: var(--text); background: none; }
.lb .close { top: 8px; right: 16px; }
.lb .prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb .next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb .count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 13px; color: var(--muted); }

/* Medium screens */

@media (max-width: 1000px) {
  .top { flex-wrap: wrap; }
  .name { flex-basis: 100%; }
  .top .meta { margin-left: auto; padding-left: 0; border: 0; }
  .contact-wrap { grid-template-columns: 1fr; }
  .contact-photo { display: none; }
}

/* Narrow screens */

@media (max-width: 700px) {
  :root { --row: 160px; }
  .top, main, .bottom { padding-inline: 16px; }
  .top { padding-block: 22px 32px; gap: 10px 16px; }
  .name { font-size: 21px; }
  .top nav { gap: 4px 16px; }
  .name { flex-basis: 100%; }
  .top .meta { margin-left: 0; padding-left: 0; border: 0; }
  h1 { font-size: 32px; }
  .lead { margin-bottom: 36px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 20px 10px; }
  .label { font-size: 19px; margin-top: 8px; }
  .grid { gap: 4px; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about img { max-width: 220px; }
  .bottom { margin-top: 64px; }
  .lb { padding: 48px 8px; }
  .lb .prev, .lb .next { display: none; }
}
