/* ==========================================================================
   Neubert Work · Basis
   Reset, typografi, formularelementer, hjælpeklasser.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Stop gummibånds-scroll bag dialoger på iOS */
  overscroll-behavior-y: none;
}

/* To meget svage lysfelter bag siden. Rent dekorativt. Samme greb som på
   strikkesiden, så de to sider ligner hinanden, når man skifter mellem dem. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 60% 40% at 12% -8%, var(--brand-soft), transparent 62%),
    radial-gradient(ellipse 55% 45% at 96% 2%,  var(--accent-soft), transparent 62%);
  opacity: .8;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -.011em;
  color: var(--ink);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }

p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--brand);
  text-decoration-color: color-mix(in oklab, var(--brand) 40%, transparent);
  text-underline-offset: .2em;
}
a:hover { text-decoration-color: currentColor; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--s-6) 0;
}

small { font-size: var(--text-sm); }

::selection {
  background: var(--selection);
  color: var(--ink);
}

/* --- Fokus: altid synligt, aldrig fjernet ------------------------------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* --- Formularelementer -------------------------------------------------- */
input, select, textarea, button {
  font: inherit;
  color: inherit;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.field > label,
.label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .003em;
}

.hint {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

/* :where() giver nul i specificitet. Det er med vilje: det her er
   *standardværdier*, og en komponent med en klasse skal kunne sætte sin
   egen bredde eller polstring uden at skulle overgå `input[type="search"]`,
   som ellers vejer tungere end en enkelt klasse. */
:where(.input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea) {
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  /* background-color, ikke background: genvejen ville nulstille
     background-image og -repeat, og så bliver pilen i <select> gentaget
     hen over hele feltet i stedet for at stå én gang i højre side. */
  background-color: var(--surface-raised);
  color: var(--ink);
  font-size: var(--text-md);
  transition: border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease),
              background-color var(--dur-2) var(--ease);
}

.input::placeholder,
input::placeholder,
textarea::placeholder { color: var(--ink-3); }

.input:hover,
input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) { border-color: var(--ink-3); }

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

input:disabled, select:disabled, textarea:disabled, button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

input[aria-invalid="true"] {
  border-color: var(--critical);
}
input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--critical) 30%, transparent);
}

textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.6;
}

select {
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='none' stroke='%23857b73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6.5 8 10.5l4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right .7rem center;
}
:root[data-theme="dark"] select,
:root:where(:not([data-theme="light"])) select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='none' stroke='%238b8493' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6.5 8 10.5l4-4'/></svg>");
}

/* Skjul number-spinners — vi bruger egne knapper */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Hjælpeklasser ------------------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -4rem;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: var(--r-md);
  background: var(--brand);
  color: var(--brand-on);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur-2) var(--ease);
}
.skip-link:focus { top: var(--s-4); }

[hidden] { display: none !important; }

.stack { display: flex; flex-direction: column; }
.row   { display: flex; align-items: center; }
.wrap  { flex-wrap: wrap; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.grow  { flex: 1 1 auto; min-width: 0; }
.center { justify-content: center; }
.between { justify-content: space-between; }
.text-center { text-align: center; }
.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Bevægelse: respektér brugerens valg -------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- Print -------------------------------------------------------------- */
@media print {
  body::before, .appbar, .toast-stack, .hero__search,
  .no-print { display: none !important; }
  body { background: #fff; }
  .tile { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  /* På papir er en genvej kun noget værd, hvis adressen står der. */
  .tile__link::after {
    content: " (" attr(href) ")";
    font-size: .75rem;
    color: #555;
    font-weight: 400;
  }
}
