/* ===== Medieval Full-Bleed Jump-Proof CSS ===== */

/* Full height, no white edges */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Medieval background - full bleed */
body {
    display: flex;
    flex-direction: column;
    font-family: 'MedievalSharp', cursive, sans-serif;
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black; /* fallback if image missing */
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    color: #f3d8b6;
}

/* Text shadow for medieval feel */
body, h1, h2, h3, p, a, button {
    text-shadow:
        -0.5px -0.5px 0 rgba(0,0,0,0.6),  
         0.5px -0.5px 0 rgba(0,0,0,0.6),
        -0.5px  0.5px 0 rgba(0,0,0,0.6),
         0.5px  0.5px 0 rgba(0,0,0,0.6);
}

/* ===== Medieval Header uden sticky + skygge ===== */
header {
    background-color: rgba(0, 0, 0, 0.7);
    position: relative;
    top: 0;
    z-index: 1000;
    min-height: 80px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

/* Container for header content */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    height: 80px;
    padding: 0 20px;
}

/* Logo placeholder */
a.logo-link {
    display: block;
    width: 140px;
    height: 70px;
    flex-shrink: 0;
    background: url('images/logo-placeholder.png') no-repeat center center;
    background-size: contain;
}

/* Selve logoet */
.logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Navigation */
nav a:link,
nav a:visited {
    color: #f3d8b6;
    text-decoration: none;
    margin: 0 15px;
    font-size: 0.95rem;
    line-height: 80px;
    transition: color 0.2s ease-in-out;
}

nav a:hover,
.nav-link.active {
    color: #d4a017;
}

/* ===== Main Content ===== */
main {
    flex: 1;
    padding: 50px 20px;
    box-sizing: border-box;
    padding-bottom: 90px;
}

/* Intro box */
.intro {
    text-align: center;
    padding: 15px 30px;
    background-color: rgba(0, 0, 0, 0.5);
    margin: calc(100px + 20px) auto 25px auto;
    max-width: 500px;
    border-radius: 8px;
}

/* Buttons */
button {
    background-color: #7a4b1b;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    color: #f3d8b6;
    transition: background-color 0.3s ease;
}
button:hover { background-color: #5c3513; }

/* ===== Footer ===== */
footer {
    position: relative;
    padding: 13px;
    background-color: rgba(0,0,0,0.7);
    color: #f3d8b6;
    text-align: center;
    font-size: 0.85rem;
}

/* Contact link glow */
.kontakt-link:link,
.kontakt-link:visited {
    color: #f3d8b6;
    text-decoration: none;
}
.kontakt-link:hover {
    color: #d4a017 !important;
    text-shadow: 0 0 10px rgba(212,160,23,0.9),
                 0 0 20px rgba(212,160,23,0.7),
                 0 0 30px rgba(212,160,23,0.5);
    text-decoration: underline;
    animation: portalGlow 1.2s infinite alternate;
}

/* Glow animation */
@keyframes portalGlow {
    0% {
        text-shadow: 0 0 10px rgba(212,160,23,0.9),
                     0 0 20px rgba(212,160,23,0.7),
                     0 0 30px rgba(212,160,23,0.5);
    }
    100% {
        text-shadow: 0 0 15px rgba(212,160,23,1),
                     0 0 30px rgba(212,160,23,0.8),
                     0 0 45px rgba(212,160,23,0.6);
    }
}

/* ===== Projekt-grid ===== */
.projekt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding: 0 10px;
}

/* ===== Projekt-card ===== */
.projekt-card {
    background-color: rgba(0, 0, 0, 0.45);
    border: 2px solid #7a4b1b;
    border-radius: 8px;
    padding: 15px;
    text-align: left;
    color: #f3d8b6;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s, border-color 0.3s, transform 0.2s ease-in-out;
}
.projekt-card:hover {
    background-color: rgba(90, 40, 10, 0.65);
    border-color: #b76b2a;
    transform: translateY(-3px);
}

.eventyr-button {
    display: inline-block;
    background-color: #7a4b1b;
    color: #f3d8b6;
    text-decoration: none;
    padding: 12px 28px;
    font-size: 16px;
    font-family: inherit;
    border-radius: 6px;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}
.eventyr-button:hover { background-color: #5c3513; }

/* Back-knap */
.back-button {
    position: absolute;
    top: -0.8cm;
    left: 12px;
    background-color: #7a4b1b;
    color: #f3d8b6;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    transition: background-color 0.3s ease;
    z-index: 1;
}
.back-button:hover { background-color: #5c3513; }

/* Fade in/out */
body { opacity: 0; animation: fadeIn 0.6s ease forwards; }
body.fade-out { opacity: 0; transition: opacity 0.4s ease; }
@keyframes fadeIn { to { opacity: 1; } }

/* Breadcrumb */
.breadcrumb {
    color: #fdf5e6;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    margin: 0.5rem;
}
.breadcrumb:hover { background-color: rgba(255, 255, 255, 0.1); }

/* ===== Fugle-galleri ===== */
.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.gallery figure {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    text-align: center;
    padding-bottom: 10px;
}

.gallery img {
    display: block;
    width: 250px;
    height: auto;
    border-bottom: 2px solid #7a4b1b;
}

.gallery figcaption {
    margin-top: 5px;
    font-size: 1em;
    color: #f3d8b6;
    font-family: 'MedievalSharp', cursive, sans-serif;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    border-radius: 5px;
}

/* ===== Baggrund til Projekter-siden ===== */
body.projekter-bg {
    background: url('images/bg-projekter.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
}

/* ===== Baggrund til D&D-siden ===== */
body.dnd-bg {
    background: url('images/bg-dnd.jpg') no-repeat center center fixed;
    background-size: contain;
    background-color: black;
    position: relative;
}
body.dnd-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    pointer-events: none;
    z-index: -1;
}

/* ===== Baggrund til fugle-siden ===== */
body.fugle-bg {
    background: url('images/bg-fugle.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.fugle-bg::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.40);
    z-index: -1;
}

/* ===== Baggrund til forsiden ===== */
body.forside-bg {
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.forside-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: -1;
}

/* ===== Baggrund til Om mig-siden ===== */
body.om-mig-bg {
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.om-mig-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: -1;
}

/* ===== Baggrund til Kontakt-siden ===== */
body.kontakt-bg {
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.kontakt-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: -1;
}

/* ===== Baggrund til Jellyfin-siden ===== */
body.jellyfin-bg {
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.jellyfin-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: -1;
}

/* ===== Baggrund til Raspberry Pi-siden ===== */
body.raspberrypi-bg {
    background: url('images/castle-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: black;
    position: relative;
}
body.raspberrypi-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: -1;
}

/* ===== Lightbox til galleri ===== */
#lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 20px;
}
#lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  border: 5px solid #7a4b1b;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
#lightbox-caption {
  margin-top: 12px;
  color: #f3d8b6;
  font-family: 'MedievalSharp', cursive, sans-serif;
  font-size: 1.1rem;
  text-align: center;
}
#lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 2rem;
  line-height: 1;
  color: #f3d8b6;
  cursor: pointer;
  user-select: none;
}

/* ===== Jellyfin & Raspberry Pi: link-fix ===== */
body.jellyfin-bg a:link,
body.jellyfin-bg a:visited,
body.raspberrypi-bg a:link,
body.raspberrypi-bg a:visited {
  color: #f3d8b6;
  text-decoration: none;
}
body.jellyfin-bg a:hover,
body.raspberrypi-bg a:hover {
  color: #d4a017;
  text-decoration: underline;
}

/* ===== Raspberry Pi grid ===== */
.pi-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap:20px;
  align-items:start;
  margin-top: 10px;
}
.pi-card{
  background: rgba(0,0,0,0.35);
  border:2px solid #7a4b1b;
  border-radius:12px;
  padding:12px;
  box-shadow:0 4px 10px rgba(0,0,0,.5);
}
.pi-card img{
  width:100%;
  height:auto;
  display:block;
  border-radius:8px;
}
.pi-card .caption{
  margin-top:8px;
  text-align:center;
  color:#f3d8b6;
  font-style:italic;
}

/* ========================================================= */
/* ===================  Mobile tweaks  ===================== */
/* ========================================================= */

/* Generelle font-sizes der skalerer pænt */
h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 4.5vw, 1.6rem); }
p, a, li, figcaption, button { font-size: clamp(0.95rem, 3.8vw, 1.05rem); }

/* Safe-area til telefoner med notch + ekstra bundpadding til content */
:root { --safe: env(safe-area-inset-bottom); }
main { padding-bottom: max(90px, var(--safe)); }

/* Undgå overbredde på medier */
img, video, figure { max-width: 100%; height: auto; }
figure { margin: 0; }

/* Tablet og ned */
@media (max-width: 768px) {
  /* Scroll-perf: fixed baggrund kan lagge på mobil */
  body { background-attachment: scroll; }

  header { min-height: 64px; }
  .header-container { height: 64px; padding: 0 12px; }
  nav a { margin: 0 8px; line-height: 64px; }

  main { padding: 30px 14px 80px; }
  .intro { margin: calc(64px + 12px) auto 18px; max-width: 95%; }

  /* Gallerier */
  .gallery { gap: 12px; }
  .gallery img { width: 100%; max-width: 100%; }
  .gallery figure { width: min(420px, 100%); padding-bottom: 8px; }

  /* Pi-grid: tættere kolonner på mobil */
  .pi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
  .pi-card { padding: 10px; border-radius: 10px; }

  /* Touch-venlige mål til klik */
  a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Små telefoner */
@media (max-width: 480px) {
  header { min-height: 56px; }
  .header-container { height: 56px; }
  nav a { margin: 0 6px; font-size: 0.9rem; line-height: 56px; }

  main { padding: 24px 12px 72px; }

  /* Gør kort/billeder fuldbredde */
  .gallery figure { width: 100%; }
  .pi-grid { grid-template-columns: 1fr; }

  /* Back-knap: undgå overlap med footer og intro */
  .back-button {
    position: static;
    display: inline-block;
    margin: 10px 0 0;
  }

  /* Dæmp tunge skygger på helt små skærme for læsbarhed */
  body, h1, h2, h3, p, a, button {
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
  }
}

/* Valgfrit mørkt overlay – kan tændes med .has-overlay på <body> */
body.has-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 0; /* holdes lavt så dine side-specifikke overlays stadig fungerer */
}
/* Fjern hvid streg/underline fra tilbage-knappen */
.back-button {
  text-decoration: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  display: inline-block;
}

/* Sikrer at farven forbliver som du vil */
.back-button:link,
.back-button:visited,
.back-button:hover,
.back-button:active {
  color: #f3d8b6;
  text-decoration: none !important;
}
.back-button {
  margin-bottom: 10px;
}
