:root {
  --bg: #0e0e0f;
  --bg-2: #161618;
  --line: #2a2a2d;
  --text: #ecebe8;
  --muted: #8d8c88;
  --accent: #d9b77e;
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: .01em; margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
body:not([data-admin]) .admin-only { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
  transition: background .3s;
}
body:not(.home) .topbar, .topbar.solid { background: rgba(14,14,15,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name { font-family: var(--serif); font-size: 26px; letter-spacing: .04em; }
.brand-sub { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.topbar nav { display: flex; gap: 26px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- hero / slideshow ---------- */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 420px;
  overflow: hidden; background: #000; cursor: zoom-in;
}
.hero-slide {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  opacity: 0; transition: opacity 1.6s ease;
  will-change: opacity, transform;
}
.hero-slide.show { opacity: 1; }
.hero-slide.kb { animation: kenburns 9s ease-out forwards; }
@keyframes kenburns {
  from { transform: scale(1.08) translate(var(--kx, 0), var(--ky, 0)); }
  to   { transform: scale(1); }
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent); pointer-events: none;
}
.hero-caption {
  position: absolute; z-index: 2; left: clamp(16px, 4vw, 48px); bottom: clamp(24px, 6vh, 64px);
  pointer-events: none; transition: opacity .6s;
}
.hero-date { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 44px); line-height: 1.1; }
.hero-exif { color: #c9c7c2; font-size: 13px; letter-spacing: .04em; margin-top: 6px; }
.hero-controls {
  position: absolute; z-index: 2; right: clamp(16px, 4vw, 48px); bottom: clamp(24px, 6vh, 64px);
  display: flex; align-items: center; gap: 14px; color: #bbb; font-size: 12px;
}
.hero-pause {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4);
  background: rgba(0,0,0,.3); color: #fff; font-size: 11px; cursor: pointer;
}
.hero-pause:hover { border-color: var(--accent); color: var(--accent); }
.hero-hint { opacity: .7; }
.hero-scroll {
  position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 28px; color: #fff; opacity: .6; animation: bob 2.4s infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 6px); } }
.hero-empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; cursor: default;
  background: radial-gradient(circle at 50% 40%, #222, #000);
}
.hero-empty h1 { font-size: clamp(40px, 7vw, 84px); }
.hero-empty a { color: var(--accent); }

/* ---------- layout ---------- */
.wrap { max-width: 1600px; margin: 0 auto; padding: 96px clamp(16px, 4vw, 48px) 48px; }
.home .wrap { padding-top: 64px; }
.wrap.narrow { max-width: 760px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 48px; }

input[type=search], input[type=text], input[type=password], input[type=date] {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 14px; border-radius: 6px; font: inherit; outline: none; min-width: 0;
}
input:focus { border-color: var(--accent); }
input[type=date] { color-scheme: dark; }
.search input { width: min(360px, 80vw); }

.btn {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 6px; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: #111; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
button.link:hover { color: var(--accent); }

/* ---------- arkiv ---------- */
.year-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.year-nav a { border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px; font-size: 13px; }
.year-nav a:hover { border-color: var(--accent); }
.year { margin-bottom: 56px; scroll-margin-top: 90px; }
.year-title { font-size: 34px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 20px; }
.year-title span { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 12px; }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.album-card { display: block; }
.album-cover { aspect-ratio: 3/2; overflow: hidden; background: var(--bg-2); border-radius: 4px; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, filter .6s; filter: saturate(.92); }
.album-card:hover img { transform: scale(1.05); filter: none; }
.album-info { display: flex; flex-direction: column; padding-top: 10px; }
.album-date { font-family: var(--serif); font-size: 21px; }
.album-title { color: var(--accent); font-size: 14px; }
.album-count { color: var(--muted); font-size: 12px; letter-spacing: .06em; }

/* ---------- galleri (justified rows i ren CSS) ---------- */
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery::after { content: ""; flex-grow: 1e4; }
.g-item {
  position: relative; display: block; overflow: hidden; background: var(--bg-2); cursor: zoom-in;
  flex-grow: var(--r); flex-basis: calc(var(--r) * 240px); border-radius: 2px;
}
.g-item i { display: block; padding-bottom: calc(100% / var(--r)); }
.g-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s, opacity .4s; opacity: 0; }
.g-item img.loaded { opacity: 1; }
.g-item:hover img { transform: scale(1.03); }
.g-item span {
  position: absolute; inset: auto 0 0 0; padding: 18px 10px 6px; font-size: 12px; color: #ddd;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent); opacity: 0; transition: opacity .3s;
}
.g-item:hover span { opacity: 1; }
.gallery-empty { color: var(--muted); padding: 24px 0; }

/* ---------- albumside ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a:hover { color: var(--accent); }
.album-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.album-head h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.05; }
.album-sub { margin: 6px 0 0; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
#album-title { color: var(--accent); font-size: 17px; }
.album-tools { display: flex; gap: 10px; }
.pager { display: flex; justify-content: space-between; margin-top: 48px; font-family: var(--serif); font-size: 20px; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,5,6,.97);
  display: flex; align-items: center; justify-content: center;
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.lightbox figure { margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; }
.lb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 24px 72px 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 60px rgba(0,0,0,.6); transition: opacity .3s; user-select: none; }
.lb-stage img.loading { opacity: .25; }
.lb-spinner {
  position: absolute; width: 34px; height: 34px; border: 2px solid #444; border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; opacity: 0; transition: opacity .2s;
}
.lb-stage img.loading + .lb-spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.lightbox figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 48px) 18px;
}
.lb-title { font-family: var(--serif); font-size: 22px; }
.lb-exif { color: var(--muted); font-size: 13px; }
.lb-actions { display: flex; gap: 18px; align-items: center; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.lb-actions a, .lb-actions button { color: #bbb; cursor: pointer; background: none; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; padding: 0; }
.lb-actions a:hover, .lb-actions button:hover { color: var(--accent); }
.lb-delete:hover { color: #e66 !important; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 2; background: none; border: 0; color: #ccc; cursor: pointer;
  font: 300 46px/1 var(--sans); padding: 10px 16px; opacity: .7;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; color: var(--accent); }
.lb-close { top: 8px; right: 12px; }
.lb-prev { left: 6px; top: 45%; }
.lb-next { right: 6px; top: 45%; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }
body.lb-open { overflow: hidden; }

/* ---------- upload ---------- */
.upload-page h1 { font-size: 46px; margin-bottom: 8px; }
.login { display: flex; flex-direction: column; gap: 14px; max-width: 360px; margin: 10vh auto 0; }
.error { color: #f08080; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1.5px dashed #444; border-radius: 10px; padding: 52px 20px; margin: 26px 0 16px;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(217,183,126,.06); }
.dropzone input { display: none; }
.dz-icon { font-size: 40px; color: var(--accent); line-height: 1; }
.options { margin-bottom: 18px; color: var(--muted); }
.options summary { cursor: pointer; }
.options label { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; color: var(--text); }
.upload-bar { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; }
.queue { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.queue li {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
.queue img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; background: #222; }
.q-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-sub { font-size: 12px; color: var(--muted); }
.q-sub a { color: var(--accent); }
.q-bar { height: 3px; background: #2a2a2a; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.q-bar div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.queue li.done .q-bar div { background: #6c6; }
.queue li.failed .q-bar div { background: #e66; width: 100%; }
.queue li.failed .q-sub { color: #f08080; }
.q-remove { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }

.footer { text-align: center; color: #5c5b58; font-size: 12px; letter-spacing: .08em; padding: 40px 16px 50px; border-top: 1px solid #1c1c1e; }

@media (max-width: 640px) {
  .brand-sub, .hero-hint { display: none; }
  .topbar nav { gap: 16px; font-size: 12px; }
  .g-item { flex-basis: calc(var(--r) * 140px); }
  .gallery { gap: 4px; }
  .lb-stage { padding: 56px 0 0; }
  .lb-prev, .lb-next { top: auto; bottom: 90px; }
  .albums { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .album-date { font-size: 17px; }
}

/* ---------- formatvalg i lightbox ---------- */
.lb-formats { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.lb-formats .fmt {
  background: none; border: 0; border-radius: 5px; color: #aaa; cursor: pointer; font: inherit;
  padding: 4px 12px; display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.lb-formats .fmt span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.lb-formats .fmt small { font-size: 10px; color: var(--muted); min-height: 1em; }
.lb-formats .fmt:hover:not(:disabled) { color: var(--accent); }
.lb-formats .fmt.active { background: var(--accent); color: #111; }
.lb-formats .fmt.active small { color: #3a3125; }
.lb-formats .fmt:disabled { opacity: .35; cursor: not-allowed; }
.lightbox figcaption { row-gap: 10px; }
code { background: var(--bg-2); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
