/* ================== Base & layout ================== */
@font-face{
  font-family: 'ArchitectsDaughter';
  src: url('fonts/ArchitectsDaughter.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Tema-variabler */
:root{
  --glass-alpha: 0.2;           /* sort glas: sænk for mere baggrund (fx 0.85) */
  --glass-blur: 5px;
  --text-color: #f9fafb;         /* hvid tekst */
  --edge-shadow: rgba(0,0,0,0.35);/* blød skygge til kanter */
}

/* Body: sticky footer + baggrund (billede + mørk overlay) */
body{
  min-height: 100vh;
  display: flex; flex-direction: column;
  color: var(--text-color);

  background-image:
    linear-gradient(135deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.35) 100%),
    url('images/bg.jpg'); /* sti er relativ til /data/style.css */
  background-size: cover, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  background-color: #0b0b0b; /* fallback */
}

/* Links */

a {
  color: #93c5fd;
  font-family: ArchitectsDaughter, Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

a:active {
  opacity: 0.7;
}

/* Mobil */
@media (max-width: 768px) {
  a {
    font-size: 1.2rem;
    padding: 8px 0;
    display: inline-block;
  }
}

/* ================== Header / Footer: sort glas + blød kant ================== */
.site-header,
.site-footer{
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0,0,0,var(--glass-alpha));
  border: none; border-radius: 0;
  backdrop-filter: blur(var(--glass-blur)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(120%);
}
.site-header{ box-shadow: 0 12px 24px var(--edge-shadow); }  /* blød kant under header */
.site-footer{
  gap: 12px; flex-wrap: wrap;
  position: relative;                                         /* anker for toast */
  box-shadow: 0 -12px 24px var(--edge-shadow);                /* blød kant over footer */
}

.logo img { height: 48px; width: auto; display: block; }
.title h1{
  font-family: 'ArchitectsDaughter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: .2px;
  margin: 0;
  font-size: 1.8rem;
}

/* ================== Content fylder resten ================== */
.content-wrap{
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  gap: 0;
  padding: 0;             /* full-bleed = ingen “kanter” i siderne */
  min-height: 0;
}
.content-fill{
  flex: 1 1 auto; min-height: 0;
  display: flex;
}

/* ====== Visningstilstand: glas-FRI (tekst direkte på baggrunden) ====== */
.content-view{
  flex: 1 1 auto; min-height: 0; overflow: auto;
  padding: 20px;
  background: transparent;
  border: 0; box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ====== Editor-tilstand: hvid “papir”-flade, stor og centreret ====== */
#editorForm{
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;

  background: #ffffff; color: #111827;
  padding: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);

  width: min(1400px, 96vw);
  margin: 24px auto;      /* centrér */
  min-height: 78vh;       /* fylder det meste af skærmen */
}

/* Editor textarea */
.editor{
  flex: 1 1 auto; min-height: 60vh;
  width: 100%;

  background: #ffffff; color: #111827; caret-color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;

  font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  outline: none; resize: vertical; overflow: auto;
}
#editorForm ::placeholder{ color: #6b7280; }

/* ================== Knapper ================== */
.footer-actions{ display: flex; gap: 10px; align-items: center; }
.inline{ display: inline; }

.btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  padding: 10px 14px; border-radius: 10px; cursor: pointer;
  transition: transform .02s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.btn:active{ transform: translateY(1px); }
.btn.primary{ background: #111827; border-color: #111827; }

/* ================== Typografi for indhold ================== */
.content-view { line-height: 1.7; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.content-view h1,
.content-view h2,
.content-view h3,
.content-view h4,
.content-view h5,
.content-view h6 {
  margin: 1.6rem 0 0.8rem; line-height: 1.25; font-weight: 800; color: #ffffff;
}
.content-view h1 { font-size: 2.25rem; }
.content-view h2 { font-size: 1.875rem; }
.content-view h3 { font-size: 1.5rem; }
.content-view h4 { font-size: 1.25rem; }
.content-view h5 { font-size: 1.125rem; }
.content-view h6 { font-size: 1rem; letter-spacing: .02em; }

.content-view p { margin: 0 0 1rem; }
.content-view p + p { margin-top: 0.5rem; }
.content-view strong, .content-view b { font-weight: 700; }
.content-view em, .content-view i { font-style: italic; }
.content-view a { color: #93c5fd; text-decoration: none; }
.content-view a:hover { text-decoration: underline; }

.content-view ul, .content-view ol { margin: 0.75rem 0 1rem 1.5rem; padding: 0; }
.content-view li + li { margin-top: .35rem; }
.content-view ul { list-style: disc; }
.content-view ol { list-style: decimal; }

.content-view figure { margin: 1.25rem 0; }
.content-view figcaption { font-size: .9rem; color: rgba(255,255,255,.8); }

.content-view blockquote {
  margin: 1.25rem 0; padding: .75rem 1rem;
  border-left: 4px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.05);
  color: #e5e7eb; border-radius: 6px;
}

.content-view code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .95em;
  background: rgba(0,0,0,.45);
  padding: .15em .4em; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
}
.content-view pre {
  margin: 1rem 0; padding: 1rem; overflow: auto;
  background: rgba(0,0,0,.55); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
}
.content-view pre code { background: transparent; border: 0; padding: 0; font-size: 0.95rem; line-height: 1.6; display: block; }

.content-view hr { height: 1px; border: 0; margin: 2rem 0; background: rgba(255,255,255,.18); }

.content-view table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.content-view th, .content-view td { padding: .75rem .8rem; border-bottom: 1px solid rgba(255,255,255,.12); text-align: left; vertical-align: top; }
.content-view thead th { background: rgba(255,255,255,.06); font-weight: 700; }
.content-view tbody tr:nth-child(odd) { background: rgba(255,255,255,.02); }

.content-view ::selection { background: rgba(147,197,253,.35); }

/* ================== Billeder – pæn default uden upscaling ================== */
/* Global default for billeder UDEN klasse (kun i indholdet) */
.content-view img:not([class]){
  display: block;
  margin: 0.75rem auto;            /* centrér */
  width: auto;                      /* ingen tvungen upscaling */
  max-width: min(100%, 960px);      /* cap på store skærme */
  height: auto;

  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  background: #0b0b0b;
}

/* ====== .img – utility med størrelses-modifiers, stadig uden upscaling ====== */
.content-view figure.img{
  margin: 1.25rem auto;
  max-width: min(90vw, var(--img-max, 960px));
  text-align: center;
}
.content-view img.img,
.content-view figure.img > img{
  display: block;
  margin: 0.75rem auto;
  width: auto;                               /* skaler ned, aldrig op */
  max-width: min(100%, var(--img-max, 960px));
  height: auto;

  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  background: #0b0b0b;
  transition: transform .12s ease, box-shadow .2s ease;
}
.content-view img.img:hover,
.content-view figure.img > img:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.42);
}
.content-view figure.img > figcaption{
  margin-top: .5rem; font-size: .92rem; color: rgba(255,255,255,.8);
}
/* Størrelses-modifiers */
.content-view .img.img--sm{ --img-max: 480px; }
.content-view .img.img--md{ --img-max: 720px; }
.content-view .img.img--lg{ --img-max: 960px; }
.content-view .img.img--xl{ --img-max: 1200px; }
.content-view .img.img--full{ --img-max: 100vw; }
.content-view .img.img--native{ --img-max: 99999px; }

/* ================== A11Y utils ================== */
.sr-only{
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* Formularfelter i footer på mørk baggrund */
.site-footer input[type="password"]{
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.site-footer input[type="password"]::placeholder{ color: #cbd5e1; }

/* ================== Flash/Status som toast over footeren ================== */
.flash{
  position: absolute;
  left: 50%;
  bottom: 100%;              /* lige over footeren */
  transform: translate(-50%, -10px);
  z-index: 1000;

  display: inline-flex; align-items: center; gap: 8px;

  max-width: min(720px, 90vw);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);

  font-size: 14px; line-height: 1.4;
  color: #eafaf2;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);

  transition: opacity .35s ease, transform .25s ease;
  cursor: pointer;
}
.flash--ok{
  background: rgba(16,185,129,0.20);
  border-color: rgba(16,185,129,0.55);
  color: #d1fae5;
}
.flash--error{
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.55);
  color: #fecaca;
}
.flash.is-hidden{
  opacity: 0;
  transform: translate(-50%, -14px) scale(0.98);
  pointer-events: none;
}

/* ================== Mobile (≤640px) ================== */
@media (max-width: 640px){
  /* iOS performance: undgå fixed bg på mobil */
  body{
    background-attachment: scroll, scroll;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .site-header{
    flex-direction: column; align-items: center; gap: 8px;
    text-align: center; padding: 12px 14px;
    box-shadow: 0 8px 16px var(--edge-shadow);
  }
  .logo img{ height: 40px; }
  .title h1{ font-size: 1.25rem; }

  /* Skjul footer på mobil (og dermed også toasten) */
  .site-footer{ display: none !important; }
  .flash{ display: none; }

  /* Editor fylder stadig godt */
  #editorForm{
    width: 100%;
    margin: 12px; padding: 16px;
    min-height: 70vh;
  }
  .editor{ min-height: 55vh; }

  /* Skaler overskrifter lidt ned */
  .content-view h1 { font-size: 1.9rem; }
  .content-view h2 { font-size: 1.6rem; }
  .content-view h3 { font-size: 1.3rem; }
}

/* ================== Tablet (≤768px) ================== */
@media (max-width: 768px){
  .title h1{ font-size: 1.35rem; }
}

/* ===== Billede-justering: venstre/højre wrap ===== */
/* Gælder både <img class="img …"> og <figure class="img …"> */
.content-view img.img.img--right,
.content-view figure.img.img--right{
  float: right;
  margin: .5rem 0 .75rem 1rem;            /* luft til venstre */
  max-width: min(48%, var(--img-max, 480px));
}

.content-view img.img.img--left,
.content-view figure.img.img--left{
  float: left;
  margin: .5rem 1rem .75rem 0;            /* luft til højre */
  max-width: min(48%, var(--img-max, 480px));
}

/* På mobil/tablet: drop floats, vis centralt under tekst */
@media (max-width: 768px){
  .content-view img.img.img--left,
  .content-view img.img.img--right,
  .content-view figure.img.img--left,
  .content-view figure.img.img--right{
    float: none;
    display: block;
    margin: .75rem auto;
    max-width: min(100%, var(--img-max, 960px));
  }
}

/* ===== Tekstjustering (brug på p, div, h1–h6, ul/ol, figure osv.) ===== */
.content-view .text-left   { text-align: left; }
.content-view .text-center { text-align: center; }
.content-view .text-right  { text-align: right; }
.content-view .text-justify{ text-align: justify; text-justify: inter-word; }

/* Valgfrit: “layout-width” wrappers til pænere læselinje */
.content-view .narrow { max-width: 60ch; margin: 0 auto; }
.content-view .wide   { max-width: 80ch; margin: 0 auto; }

/* (Valgfrit) Desktop-only højre/venstre – mobil får normal alignment */
@media (min-width: 769px){
  .content-view .md-text-right { text-align: right; }
  .content-view .md-text-left  { text-align: left; }
  .content-view .md-text-center{ text-align: center; }
}

/* ========== Mobile: centrer alt tekst (men ikke kode/tabeller) ========== */
@media (max-width: 640px){
  /* Centrer typiske tekstblokke */
  .content-view,
  .content-view p,
  .content-view h1,
  .content-view h2,
  .content-view h3,
  .content-view h4,
  .content-view h5,
  .content-view h6,
  .content-view blockquote,
  .content-view figcaption,
  .content-view li {
    text-align: center !important; /* overstyrer .text-left/.text-right på mobil */
  }

  /* Lister ser pænest ud med bullets/tal “indenfor” ved centreret tekst */
  .content-view ul, .content-view ol{
    list-style-position: inside;
    margin-left: 0;
  }

  /* Undtagelser – behold venstrejusteret for læsbarhed */
  .content-view pre,
  .content-view code,
  .content-view table,
  .content-view thead th,
  .content-view tbody td,
  .content-view tfoot td {
    text-align: left !important;
  }
}
