/* BIOME Lab — design system
   Blodrød (#4E1510) på varm off-white (#F8F7F2).
   Alle farver i HSL. Tokens are read by the Tailwind config in templates/base.html.

   Plain CSS port of the React project's src/index.css. Tailwind's CDN build cannot run
   @apply in an external file, so the former @apply rules are written out explicitly.
   Base rules use `html body ...` selectors so they win over Tailwind's preflight reset
   (element selectors) while still losing to utility classes. */

@font-face {
  font-family: "Open Sauce One";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/open-sauce-one-latin-300-normal.9d9e69368d20.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Open Sauce One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/open-sauce-one-latin-400-normal.e8cb386eaf2a.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Open Sauce One";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/open-sauce-one-latin-500-normal.f2757ae67332.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Brand palette */
  --background: 45 25% 96%;          /* #F8F7F2 varm off-white */
  --foreground: 5 66% 18%;           /* #4E1510 blodrød */

  --surface-sand: 42 22% 92%;        /* lys neutral overflade */
  --surface-creme: 45 25% 96%;       /* hovedbaggrund */
  --ink: 5 66% 18%;                  /* #4E1510 hovedtekst */
  --ink-soft: 7 28% 34%;             /* dæmpet rødbrun sekundær */
  --accent-taupe: 5 50% 32%;         /* lysere blodrød accent */

  --card: 45 25% 97%;
  --card-foreground: 5 66% 18%;

  --popover: 45 25% 97%;
  --popover-foreground: 5 66% 18%;

  --primary: 5 66% 18%;              /* blodrød */
  --primary-foreground: 45 30% 96%;  /* off-white */

  --secondary: 42 22% 92%;
  --secondary-foreground: 5 66% 18%;

  --muted: 40 16% 88%;
  --muted-foreground: 8 20% 40%;

  --accent: 5 50% 32%;
  --accent-foreground: 45 30% 96%;

  --destructive: 0 60% 35%;
  --destructive-foreground: 45 30% 96%;

  --border: 5 50% 32%;               /* accent — bruges med /30 */
  --input: 7 28% 34%;
  --ring: 5 50% 32%;

  --radius: 0.25rem;                 /* 4px */
}
/* Vi har bevidst ingen dark mode — paletten er én tone. */

html {
  scroll-behavior: smooth;
}

html body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: "Open Sauce One", ui-sans-serif, system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.7;
  font-feature-settings: "ss01", "cv11";
}

html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6 {
  font-family: "Cormorant Garamond", "EB Garamond", ui-serif, Georgia, serif;
  font-weight: 300;
  letter-spacing: -0.015em;
  color: hsl(var(--ink));
}

/* Former `@apply text-*` sizes (font-size + line-height). */
html body h1 { font-size: 2.25rem; line-height: 2.5rem; }
html body h2 { font-size: 1.875rem; line-height: 2.25rem; }
html body h3 { font-size: 1.5rem; line-height: 2rem; }
html body h4 { font-size: 1.25rem; line-height: 1.75rem; }

@media (min-width: 768px) {
  html body h1 { font-size: 3rem; line-height: 1; }
  html body h2 { font-size: 2.25rem; line-height: 2.5rem; }
  html body h3 { font-size: 1.875rem; line-height: 2.25rem; }
  html body h4 { font-size: 1.5rem; line-height: 2rem; }
}

@media (min-width: 1024px) {
  html body h1 { font-size: 3.75rem; line-height: 1; }
  html body h2 { font-size: 3rem; line-height: 1; }
}

html body p {
  color: hsl(var(--ink-soft));
}

::selection {
  background: hsl(var(--accent-taupe) / 0.3);
  color: hsl(var(--ink));
}

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

/* ---- Components ---- */

.hero-fullbleed-overlay {
  background: linear-gradient(to top, hsl(var(--primary) / 0.85) 0%, hsl(var(--primary) / 0.75) 50%, transparent 70%),
    linear-gradient(to bottom, hsl(var(--primary) / 0.45), transparent 20%);
}

.hero-inset-overlay {
  background: linear-gradient(to top right, hsl(var(--primary) / 0.95) 0%, hsl(var(--primary) / 0.72) 40%, transparent 70%),
    linear-gradient(to top, hsl(var(--primary) / 0.55) 0%, transparent 35%);
}

.hero-inset-image {
  object-position: 62% 50%;
}

@media (min-width: 768px) {
  .hero-inset-image { object-position: 50% 70%; }
}

/* Læselig prosa-bredde — maks 65 karakterer */
:where(.prose-narrow) {
  max-width: 38rem;
}

/* Tynd accent-divider */
:where(.divider-thin) {
  height: 1px;
  background: hsl(var(--accent-taupe) / 0.3);
  width: 100%;
}

/* Lille label */
:where(.eyebrow) {
  font-family: "Open Sauce One", sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--accent-taupe));
}

/* Sektion-padding — 120px desktop, mindre mobil */
:where(.section-y) {
  padding-top: 5rem;
  padding-bottom: 5rem;
}
@media (min-width: 768px) {
  :where(.section-y) { padding-top: 7rem; padding-bottom: 7rem; }
}
@media (min-width: 1024px) {
  :where(.section-y) { padding-top: 8rem; padding-bottom: 8rem; }
}

/* Legal/long-form prose */
.legal-prose h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.75rem;
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: hsl(var(--ink));
}
.legal-prose h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--ink));
}
.legal-prose ul {
  list-style: disc;
  padding-left: 1.25rem;
  color: hsl(var(--ink) / 0.85);
}
.legal-prose ul li { margin: 0.25rem 0; }
html body .legal-prose p { color: hsl(var(--ink) / 0.85); }
.legal-prose strong { color: hsl(var(--ink)); font-weight: 600; }

/* ---- Animation helpers (the former "utilities" layer) ---- */

.hero-image-enter {
  opacity: 0;
  transform: scale(1.04);
  transition: transform 1600ms cubic-bezier(0.22, 1, 0.36, 1), opacity 1600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-copy-enter {
  opacity: 0;
  transform: translateY(12px);
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1) 300ms, opacity 900ms cubic-bezier(0.22, 1, 0.36, 1) 300ms;
}
.hero-image-enter.is-loaded, .hero-copy-enter.is-loaded {
  opacity: 1;
  transform: none;
}

/* Default HeroImage load-in: soft fade from a light blur. */
.hero-image-fade {
  opacity: 0;
  filter: blur(12px);
  transition: opacity 1400ms ease-out, filter 1400ms ease-out;
}
.hero-image-fade.is-loaded {
  opacity: 1;
  filter: blur(0);
}

@keyframes hero-breathe-subtle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes hero-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-breathe-subtle { animation: hero-breathe-subtle 20s ease-in-out infinite; }
  .hero-breathe { animation: hero-breathe 20s ease-in-out infinite; }
}

/* Subtil scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Toast (replaces the React "sonner" toasts) */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  max-width: calc(100vw - 2rem);
  width: 22rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid hsl(var(--accent-taupe) / 0.3);
  border-radius: 6px;
  background: hsl(var(--background));
  color: hsl(var(--ink));
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px hsl(var(--primary) / 0.12);
  animation: toast-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast[data-kind="error"] {
  border-color: hsl(var(--destructive));
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 250ms ease, transform 250ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-image-enter, .hero-copy-enter { opacity: 1; transform: none; transition: none; }
  .hero-image-fade { opacity: 1; filter: none; transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .toast { animation: none; }
  html { scroll-behavior: auto; }
}

/* Site header: transparent over the page, solid after scrolling (set by main.js). */
.site-header {
  border-bottom: 1px solid transparent;
  transition: background-color 500ms, border-color 500ms, backdrop-filter 500ms;
}
.site-header.is-solid {
  background-color: hsl(var(--background) / 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: hsl(var(--accent-taupe) / 0.2);
}

/* Native <details> accordion (lab tests on /behandlinger). */
.accordion-item { border-bottom: 1px solid hsl(var(--accent-taupe) / 0.3); }
.accordion-item summary { list-style: none; cursor: pointer; }
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item[open] .accordion-chevron { transform: rotate(180deg); }
.accordion-chevron { transition: transform 200ms ease; }

/* Submit button label while an HTMX request is running ("Tilmeld" -> "Sender…"). */
.label-busy { display: none; }
.htmx-request .label-idle { display: none; }
.htmx-request .label-busy { display: inline; }

/* Form errors */
.form-error-text { color: hsl(var(--destructive)); }

/* Portal app shell: mobile drawer + desktop collapse (Emilie pattern, BiomeLab tokens). */
@media (max-width: 767.98px) {
  html.page-portal #portal-sidebar {
    transform: translateX(-100%);
  }

  html.page-portal #portal-shell:has(#portal-nav-toggle:checked) #portal-sidebar {
    transform: translateX(0);
  }

  html.page-portal:has(#portal-nav-toggle:checked),
  html.page-portal:has(#portal-nav-toggle:checked) body {
    overflow: hidden;
  }
}

@media (min-width: 768px) {
  html.page-portal {
    --portal-nav-width: 14rem;
    --portal-nav-collapsed-width: 4rem;
    --portal-nav-header-height: 3.75rem;
  }

  html.page-portal body {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }

  html.page-portal #portal-shell .portal-layout-grid {
    grid-template-columns: var(--portal-nav-width) minmax(0, 1fr) !important;
    grid-template-rows: var(--portal-nav-header-height) minmax(0, 1fr) !important;
  }

  html.page-portal #portal-shell .portal-top-left-cell,
  html.page-portal #portal-shell .portal-top-bar {
    height: var(--portal-nav-header-height);
    min-height: var(--portal-nav-header-height);
  }

  /* Logo is centered on the full portal shell, not only the strip beside Portal. */
  html.page-portal #portal-shell .portal-top-logo {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 25;
    height: var(--portal-nav-header-height);
    transform: translateX(-50%);
  }

  html.page-portal #portal-shell #portal-sidebar,
  html.page-portal #portal-shell .portal-top-left-cell {
    width: var(--portal-nav-width) !important;
    min-width: var(--portal-nav-width) !important;
    max-width: var(--portal-nav-width) !important;
  }

  html.page-portal #portal-shell.portal-nav-collapsed .portal-layout-grid {
    grid-template-columns: var(--portal-nav-collapsed-width) minmax(0, 1fr) !important;
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar,
  html.page-portal #portal-shell.portal-nav-collapsed .portal-top-left-cell {
    width: var(--portal-nav-collapsed-width) !important;
    min-width: var(--portal-nav-collapsed-width) !important;
    max-width: var(--portal-nav-collapsed-width) !important;
  }

  html.page-portal #portal-shell.portal-nav-collapsed .portal-top-left-cell {
    justify-content: flex-start;
    gap: 0.5rem;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    z-index: 30;
    transition: width 200ms ease-out, min-width 200ms ease-out, max-width 200ms ease-out;
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-nav-collapse-toggle {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 1;
    width: var(--portal-nav-collapsed-width);
    transform: translateY(-50%);
  }

  html.page-portal #portal-shell.portal-nav-collapsed .portal-top-left-label {
    flex: 0 0 auto;
    margin-left: var(--portal-nav-collapsed-width);
    padding-right: 0.75rem;
    white-space: nowrap;
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    z-index: 30;
    transition: width 200ms ease-out, min-width 200ms ease-out, max-width 200ms ease-out;
  }

  html.page-portal #portal-shell.portal-nav-collapsed .portal-layout-grid:has(#portal-sidebar:focus-within, .portal-top-left-cell:focus-within) :is(#portal-sidebar, .portal-top-left-cell) {
    width: var(--portal-nav-width) !important;
    min-width: var(--portal-nav-width) !important;
    max-width: var(--portal-nav-width) !important;
  }

  @media (hover: hover) and (pointer: fine) {
    html.page-portal #portal-shell.portal-nav-collapsed .portal-layout-grid:has(#portal-sidebar:hover, .portal-top-left-cell:hover) :is(#portal-sidebar, .portal-top-left-cell) {
      width: var(--portal-nav-width) !important;
      min-width: var(--portal-nav-width) !important;
      max-width: var(--portal-nav-width) !important;
    }
  }

  html.page-portal #portal-shell.portal-nav-collapsed.portal-nav-hover :is(#portal-sidebar, .portal-top-left-cell) {
    width: var(--portal-nav-width) !important;
    min-width: var(--portal-nav-width) !important;
    max-width: var(--portal-nav-width) !important;
  }

  @media (prefers-reduced-motion: reduce) {
    html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar,
    html.page-portal #portal-shell.portal-nav-collapsed .portal-top-left-cell {
      transition-duration: 0s;
    }
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar .portal-sidebar-inner {
    box-sizing: border-box;
    min-width: var(--portal-nav-width);
    width: var(--portal-nav-width);
    padding-left: 0;
    padding-right: 0.75rem;
    align-items: stretch;
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar .portal-sidebar-link {
    padding-left: 0;
  }

  html.page-portal #portal-shell.portal-nav-collapsed #portal-sidebar .portal-sidebar-link > svg {
    box-sizing: content-box;
    margin-left: calc((var(--portal-nav-collapsed-width) - 20px) / 2);
    margin-right: calc((var(--portal-nav-collapsed-width) - 20px) / 2);
  }

  html.page-portal #portal-shell.portal-nav-collapsed [data-portal-collapse-chevron] {
    transform: rotate(180deg);
  }
}
