:root {
  --ink: #2c2a26;
  --paper: #f7f2ea;
  --teal: #1a4d4a;
  --ember: #c45c26;
  --sand: #e8dcc8;
  --muted: #6b6560;
  --line: rgba(44, 42, 38, 0.12);
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(196, 92, 38, 0.12), transparent 45%),
    radial-gradient(ellipse at 90% 10%, rgba(26, 77, 74, 0.14), transparent 40%),
    linear-gradient(180deg, #faf6f0 0%, var(--paper) 40%, #efe6d8 100%);
}

body {
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.6rem;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.25rem; }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.flash {
  background: rgba(26, 77, 74, 0.1);
  border-left: 3px solid var(--teal);
  padding: 0.7rem 0.9rem;
  margin: 0.8rem 0;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--teal);
  background: rgba(255,255,255,0.55);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.badge.muted { color: var(--muted); }

.event-list,
.post-list,
.simple-list,
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-list li,
.post-list li {
  margin: 0 0 0.65rem;
}

.event-link,
.post-link {
  display: block;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.event-link--cover {
  padding: 0;
}

.event-cover {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--sand);
}

.event-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.event-meta {
  display: block;
  padding: 1rem;
}

.event-link:hover,
.post-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(44, 42, 38, 0.08);
}

.event-link strong,
.post-link strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.event-link .muted,
.post-link .muted {
  display: block;
  margin-bottom: 0.25rem;
}

.post-link--thumb {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.65rem;
}

.post-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--sand);
}

.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-thumb-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(26, 77, 74, 0.18), transparent 55%),
    linear-gradient(225deg, rgba(196, 92, 38, 0.16), transparent 50%),
    var(--sand);
}

.post-meta {
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0.2rem 0.2rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-image.is-hovedbilde {
  outline: 2px solid rgba(26, 77, 74, 0.35);
  outline-offset: 2px;
  border-radius: calc(var(--radius) + 2px);
}

.event-hero {
  margin: 0.5rem 0 1rem;
}

.event-hero img,
.post-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.img-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.img-actions {
  margin: 0.4rem 0 0;
}

.cover-picker {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr 1fr;
}

.cover-picker li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
}

.cover-picker li.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(26, 77, 74, 0.2);
}

.cover-picker img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.cover-picker-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
}

.bilde-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 18, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.bilde-overlay[hidden] {
  display: none !important;
}

.bilde-overlay-panel {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: 92vh;
  background: #111;
  border-radius: 10px;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.bilde-overlay-panel img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.bilde-overlay-close {
  position: sticky;
  top: 0.4rem;
  float: right;
  margin: 0.4rem 0.4rem 0 0;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

body.overlay-open {
  overflow: hidden;
}

.feillogg {
  margin: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  overflow: auto;
}

.notif-panel {
  margin-bottom: 1.4rem;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notif-list li {
  border-bottom: 1px solid var(--line);
}

.notif-list li:last-child {
  border-bottom: none;
}

.notif-link {
  display: block;
  padding: 0.7rem 0;
  color: inherit;
  text-decoration: none;
}

.notif-link:hover {
  text-decoration: none;
  color: var(--teal);
}

.notif-link em {
  font-style: normal;
  font-weight: 700;
  font-family: var(--font-display);
}

.simple-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.user-admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
}

.pin-reset-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.pin-reset-form input[type="text"] {
  width: 7.5rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
}

.profil-panel {
  text-align: center;
}

.profil-avatar {
  width: 110px;
  height: 110px;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--sand);
}

.profil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-size: 2.5rem;
}

.post-gallery {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.post-image {
  margin: 0;
}

.post-image figcaption {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.caption-form {
  margin-top: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.caption-form[hidden] {
  display: none !important;
}

.caption-empty[hidden] {
  display: none !important;
}

.text-block .text-body {
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}

.comment-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.comment-list li:last-child {
  border-bottom: none;
}

@media (min-width: 700px) {
  .post-gallery {
    grid-template-columns: 1fr 1fr;
  }
}

#loginW, #passWorld {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem 1.4rem;
  box-shadow: 0 18px 40px rgba(44, 42, 38, 0.08);
}

.login-card .brand {
  display: block;
  font-size: 2.6rem;
  margin: 0 0 0.15rem;
  color: var(--ink);
}

.login-lead {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

.login-error {
  color: #8a2b1a;
  background: rgba(196, 92, 38, 0.12);
  padding: 0.6rem 0.75rem;
  margin: 0 0 1rem;
  list-style: none;
}

label {
  display: block;
  margin: 0 0 0.9rem;
}

label span,
label strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea { resize: vertical; }

label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label.check input { width: auto; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover { text-decoration: none; filter: brightness(1.05); }

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-secondary {
  background: var(--sand);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--ember);
  border: 1px solid rgba(196, 92, 38, 0.35);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.file-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.inline-form label { margin: 0; flex: 1; min-width: 160px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand,
.brand {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.topbar-title {
  flex: 1;
  color: var(--muted);
  font-size: 0.95rem;
}

.topbar-nav {
  display: flex;
  gap: 0.85rem;
  margin-left: auto;
}

.topbar-nav a {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

body > .flash {
  max-width: 720px;
  margin: 0.75rem auto 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

.panel {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0 1rem;
}

