/* Kallebo Sommerhus – shared stylesheet (warm & rustic, mobile-first) */

:root {
  --color-bg: #f6efe3;
  --color-bg-alt: #ece0c8;
  --color-surface: #fffdf8;
  --color-text: #2c2018;
  --color-text-soft: #5a4a3a;
  --color-primary: #3f5636;
  --color-primary-dark: #2c3d26;
  --color-accent: #8a4b32;
  --color-accent-dark: #6c3a26;
  --color-header-bg: #2c2622;
  --color-border: #d9c9a8;
  --color-danger: #8a2c2c;
  --font-heading: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(44, 32, 24, 0.12);
  --content-width: 1080px;
}

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

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-primary-dark);
  line-height: 1.25;
}

h2 {
  position: relative;
  padding-bottom: 0.5rem;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3rem;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

a { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; transition: color 0.15s ease; }
a:hover { color: var(--color-accent-dark); }

img { max-width: 100%; }

::selection { background: var(--color-accent); color: #fff; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Background photo slideshow ---------- */

.bg-slideshow {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--color-bg);
}

.bg-slideshow__slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  animation-name: bg-slideshow-fade;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .bg-slideshow__slide {
    animation: none;
  }
  .bg-slideshow__slide:first-child {
    opacity: 1;
  }
}

/* ---------- Site header / nav ---------- */

.site-header {
  background: var(--color-header-bg);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.site-header__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.site-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.7rem;
  color: #fff;
  text-align: center;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
  text-align: center;
  color: #fff;
  font-size: 1.4rem;
}

.navbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  border-top: 3px solid var(--color-primary);
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar a, .navbar .subnav-label {
  display: block;
  padding: 0.85rem 1rem;
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar a:hover, .navbar .subnav:hover .subnav-label, .navbar a[aria-current="page"] {
  background: var(--color-primary);
  color: #fff;
}

.nav-account {
  padding: 0.85rem 1rem;
  color: #d9c9a8;
  font-size: 0.95rem;
}

.subnav {
  position: relative;
}

.subnav-content {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: var(--color-primary-dark);
  box-shadow: var(--shadow);
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.subnav-content a {
  padding: 0.7rem 1rem;
  white-space: nowrap;
}

.subnav:hover .subnav-content,
.subnav:focus-within .subnav-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .nav-toggle-label { display: block; }

  .navbar {
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }

  .nav-toggle:checked ~ nav .navbar {
    max-height: 720px;
  }

  .subnav-content {
    position: static;
    box-shadow: none;
  }
}

/* ---------- Page content ---------- */

main.mainpage {
  max-width: var(--content-width);
  margin: 1.5rem auto;
  padding: 1.25rem 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(20, 14, 8, 0.25);
  border-top: 4px solid var(--color-primary);
}

main.mainpage h2:first-child { margin-top: 0; }

.lede {
  color: var(--color-text-soft);
  font-size: 1.05rem;
}

/* ---------- Buttons / forms ---------- */

.button, button, input[type="submit"] {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 1.1rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(44, 32, 24, 0.25);
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover, button:hover, input[type="submit"]:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(44, 32, 24, 0.3);
}

.button:active, button:active, input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(44, 32, 24, 0.25);
}

.button--accent { background: var(--color-accent); }
.button--accent:hover { background: var(--color-accent-dark); }

form label { display: block; margin: 0.5rem 0 0.2rem; font-weight: bold; }

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form textarea,
form input[type="file"] {
  width: 100%;
  max-width: 420px;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form input[type="date"]:focus,
form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(138, 75, 50, 0.2);
}

form textarea { max-width: 100%; }

.form-error {
  color: var(--color-danger);
  font-weight: bold;
  background: rgba(138, 44, 44, 0.08);
  border-left: 3px solid var(--color-danger);
  padding: 0.6rem 0.8rem;
  border-radius: 0 6px 6px 0;
}

.form-note {
  color: var(--color-text-soft);
  font-size: 0.9rem;
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-primary);
  padding: 0.6rem 0.8rem;
  border-radius: 0 6px 6px 0;
}

.pending-banner {
  background: var(--color-bg-alt);
  border-bottom: 3px solid var(--color-accent);
  color: var(--color-text);
  text-align: center;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
}

.facebook-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.facebook-link img { width: 28px; }

/* ---------- Cards / posts (guestbook, pump house) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.post-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 1rem;
  border-top: 4px solid var(--color-accent);
  box-shadow: 0 1px 4px rgba(44, 32, 24, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.post-card { display: block; text-decoration: none; color: inherit; }
a.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(44, 32, 24, 0.18);
}

.post-card h3 { margin: 0 0 0.15rem; }
.post-card .post-meta { color: var(--color-text-soft); font-size: 0.85rem; margin-bottom: 0.6rem; }
.post-card img { border-radius: 6px; margin-bottom: 0.6rem; }
.post-card p { white-space: pre-line; margin: 0; }

/* ---------- Post feed (gæstebog: likes, tags, comments) ---------- */

.post-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.post-feed__item p:not(:last-child) { margin-bottom: 0.6rem; }

.post-tags { font-size: 0.9rem; color: var(--color-text-soft); }

.post-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.75rem 0;
}

.post-comments {
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.post-comment {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
}

.post-comment__meta {
  font-size: 0.85rem;
  color: var(--color-text-soft);
  margin-bottom: 0.2rem !important;
}

.post-comment-form {
  margin-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
}

.post-comment-form textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.4rem 0 0.75rem;
}

.tag-picker__option {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: normal;
  font-size: 0.9rem;
}

.tag-picker-details {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.tag-picker-details summary {
  cursor: pointer;
  color: var(--color-text-soft);
}

.group-badge--small {
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  margin-left: 0.3rem;
}

/* ---------- Gallery ---------- */

.gallery-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.gallery-filter__option {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
}

.gallery-filter__option:hover {
  border-color: var(--color-primary);
}

.gallery-filter__option--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: bold;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.gallery-tile {
  display: block;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(44, 32, 24, 0.18);
}

.gallery-tile img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

.gallery-tile:hover img {
  transform: scale(1.04);
}

.gallery-tile--back {
  background: var(--color-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-tile--back:hover {
  background: var(--color-primary-dark);
}

.gallery-tile__back-icon {
  font-size: 2.2rem;
  line-height: 1;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-tile--back span:last-child {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: bold;
}

.gallery-tile span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Slideshow (big, high-contrast, few controls — built for easy use) ---------- */

.slideshow-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.96);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
}

.slideshow-overlay.is-open {
  display: flex;
}

.slideshow-overlay__image-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-overlay__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease;
}

.slideshow-overlay__counter {
  color: #fff;
  font-size: 1.3rem;
  margin: 0.75rem 0 0.25rem;
  text-align: center;
}

.slideshow-overlay__download {
  color: #d9c9a8;
  font-size: 0.85rem;
  text-align: center;
  text-decoration: underline;
}

.slideshow-overlay__speed-label {
  color: #d9c9a8;
  font-size: 0.95rem;
  margin: 0.75rem 0 0.25rem;
  text-align: center;
}

.slideshow-overlay__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.slideshow-btn {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: bold;
  padding: 1rem 1.6rem;
  min-width: 110px;
  min-height: 3.4rem;
  border: none;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.slideshow-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

.slideshow-btn--speed[aria-pressed="true"] {
  background: var(--color-accent);
}

.slideshow-btn--close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--color-danger);
  min-width: unset;
}

.slideshow-btn--close:hover { background: #6c2020; }

@media (max-width: 640px) {
  .slideshow-btn {
    font-size: 1.05rem;
    padding: 0.9rem 1.2rem;
    min-width: 90px;
  }
}

/* ---------- Document / archive lists (julehilsner, generalforsamling, historie) ---------- */

.doc-list { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }

.minutes-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: 0 1px 4px rgba(44, 32, 24, 0.1);
}

@media (min-width: 700px) {
  .minutes-entry { grid-template-columns: 2fr 1fr; }
}

.minutes-entry .minutes-text { white-space: pre-line; }
.minutes-entry .minutes-links { display: flex; flex-direction: column; gap: 0.5rem; align-self: start; }

.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.photo-strip img {
  flex: 1 1 240px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  border: 3px solid var(--color-border);
}

/* For small old scanned/GIF photos (often under 150px native): cropping+stretching these
   to fill a large box like the default .photo-strip treatment turns them to mush. This
   variant caps a modest height and never crops, so photos stay a supporting element
   instead of standing out full-size — sized down to fit the surrounding text, not the
   other way around. */
.photo-strip--contain {
  justify-content: center;
}

.photo-strip--contain img {
  flex: 0 1 auto;
  width: auto;
  height: auto;
  max-height: 160px;
  max-width: 100%;
  object-fit: contain;
  background: #fff;
}

.photo-strip-figure {
  margin: 1.25rem 0;
  text-align: center;
}

.photo-strip-figure figcaption {
  color: var(--color-text-soft);
  font-style: italic;
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 640px) {
  .contact-grid { grid-template-columns: 2fr 1fr; }
}

.contact-grid img { border-radius: var(--radius); }

/* ---------- Rules / lists ---------- */

.rules-list { text-align: left; padding-left: 1.4rem; }
.rules-list li { margin: 0.6rem 0; }

/* ---------- Long-form document reader (Historie section) ---------- */

.doc-reader {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
}

.doc-reader p { white-space: pre-line; }

.doc-video {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 1rem auto;
  border-radius: var(--radius);
  background: #000;
}

.doc-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.doc-reader .doc-source-note {
  color: var(--color-text-soft);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-top: 2rem;
}

/* ---------- Booking ---------- */

.calendar-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr: a grid track's implicit minimum is its content's
     min-content size, so a long nowrap booker name in .calendar-day__label would
     otherwise force this column past its 1/7 share — blowing out the whole grid (and
     the page) wider than the viewport instead of actually truncating with ellipsis. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin: 1rem 0;
}

.calendar-weekday {
  text-align: center;
  font-weight: bold;
  color: var(--color-text-soft);
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

.calendar-day {
  min-height: 56px;
  background: var(--color-bg-alt);
  border-radius: 6px;
  padding: 0.3rem;
  font-size: 0.8rem;
}

.calendar-day--empty {
  background: transparent;
}

.calendar-day--booked {
  background: var(--color-accent);
  color: #fff;
}

.calendar-day--past {
  opacity: 0.45;
}

.calendar-day--selectable {
  cursor: pointer;
  transition: background-color 0.1s ease, transform 0.1s ease;
}

.calendar-day--selectable:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}

.calendar-day--range-start,
.calendar-day--range-end {
  background: var(--color-primary) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px var(--color-primary-dark);
}

.calendar-day--in-range {
  background: var(--color-primary-light, #cfe0d3) !important;
}

.calendar-day__number {
  display: block;
  font-weight: bold;
}

.calendar-day__label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-line label { display: inline; margin: 0; font-weight: normal; }

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table th {
  color: var(--color-primary-dark);
  font-family: var(--font-heading);
}

.data-table tbody tr:hover {
  background: var(--color-bg-alt);
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #fff;
}

.status-badge--afventer, .status-badge--pending { background: #a5762f; }
.status-badge--godkendt, .status-badge--approved { background: var(--color-primary); }
.status-badge--afvist, .status-badge--rejected { background: var(--color-danger); }
.status-badge--annulleret { background: var(--color-text-soft); }

.group-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: bold;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.inline-form label {
  display: inline;
  margin: 0;
  font-weight: normal;
}

.inline-form input[type="text"] {
  width: auto;
  max-width: 220px;
}

.inline-form select {
  padding: 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  color: var(--color-text-soft);
  font-size: 0.85rem;
  padding: 1.5rem 1rem 2.5rem;
}

/* ---------- Utility ---------- */

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
