/* =====================================================================
   Idiotarbejde.dk — style.css
   Designsystem fra docs/design.md. Tokens som CSS custom properties.
   Hardcode aldrig farver; brug variablerne.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Fonte — selvhostede (.woff2 i assets/fonts/). Falder tilbage til
   systemfonte hvis filerne mangler. Se assets/fonts/README.md.
   --------------------------------------------------------------------- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------------
   Tokens
   --------------------------------------------------------------------- */
:root {
  /* Brand */
  --brand:          #4B3BFF;
  --brand-strong:   #3A2BE6;
  --brand-tint:     #ECEBFF;
  --brand-contrast: #FFFFFF;

  /* Neutraler */
  --bg:            #FCFCFD;
  --bg-alt:        #F4F4F8;
  --surface:       #FFFFFF;
  --border:        #E4E4ED;
  --border-strong: #15131F;
  --text:          #15131F;
  --text-muted:    #5B5870;
  --text-subtle:   #8C89A0;

  /* Sværhedsgrad */
  --easy:    #15803D;  --easy-bg:   #DCFCE7;
  --medium:  #B45309;  --medium-bg: #FEF3C7;
  --hard:    #B91C1C;  --hard-bg:   #FEE2E2;

  /* Skygger */
  --shadow-soft: 0 2px 8px rgba(21,19,31,.06), 0 8px 24px rgba(21,19,31,.05);
  --shadow-hard: 5px 5px 0 var(--border-strong);

  /* Form & radius */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Typografi */
  --font-display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --step-hero:    clamp(2.25rem, 5vw, 3.5rem);
  --step-h1:      clamp(2rem, 4vw, 3.25rem);
  --step-h2:      clamp(1.5rem, 2.5vw, 2.25rem);
  --step-h3:      1.375rem;
  --step-body:    1.0625rem;
  --step-small:   .9375rem;
  --step-eyebrow: .8125rem;

  /* Spacing & layout */
  --space-1: .25rem;  --space-2: .5rem;  --space-3: .75rem;  --space-4: 1rem;
  --space-6: 1.5rem;  --space-8: 2rem;   --space-12: 3rem;   --space-16: 4rem;
  --space-24: 6rem;

  --container: 1180px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  /* Højde på sticky chip-bar — bruges til scroll-margin på sektioner */
  --chipbar-h: 60px;
}

[data-theme="dark"] {
  --brand:          #6E62FF;
  --brand-strong:   #8478FF;
  --brand-tint:     #1C1840;
  --brand-contrast: #FFFFFF;

  --bg:            #0C0B14;
  --bg-alt:        #131120;
  --surface:       #17152A;
  --border:        #2A2740;
  --border-strong: #6E62FF;
  --text:          #F3F2FA;
  --text-muted:    #ACA9C2;
  --text-subtle:   #726F8C;

  --easy:    #4ADE80;  --easy-bg:   #0E2A18;
  --medium:  #FBBF24;  --medium-bg: #2A2008;
  --hard:    #F87171;  --hard-bg:   #2C1414;

  --shadow-soft: 0 2px 10px rgba(0,0,0,.4);
  --shadow-hard: 5px 5px 0 var(--brand);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  line-height: 1.05;
}

a { color: var(--brand); text-decoration-thickness: .08em; text-underline-offset: .15em; }

img, svg { max-width: 100%; height: auto; display: block; }

/* Synligt fokus (tilgængelighed) */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip-link */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-contrast);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: var(--space-4); }

/* ---------------------------------------------------------------------
   Layout-hjælpere
   --------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand);
  margin: 0 0 var(--space-3);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------
   Header
   --------------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}
.brand-link { display: inline-flex; align-items: center; }
.brand-link img { height: 34px; width: auto; }
.brand-logo--dark { display: none; }
[data-theme="dark"] .brand-logo--light { display: none; }
[data-theme="dark"] .brand-logo--dark  { display: block; }
.header-actions { display: flex; align-items: center; gap: var(--space-3); }

/* ---------------------------------------------------------------------
   Tema-toggle
   --------------------------------------------------------------------- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform .16s ease, box-shadow .16s ease;
}
.theme-toggle:hover { transform: translate(-2px,-2px); box-shadow: 4px 4px 0 var(--border-strong); }
.theme-toggle .icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .icon-light { display: none; }
[data-theme="dark"] .theme-toggle .icon-dark  { display: block; }

/* ---------------------------------------------------------------------
   Knapper — signaturskygge
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}
.btn--primary {
  background: var(--brand);
  color: var(--brand-contrast);
  box-shadow: var(--shadow-hard);
}
.btn--primary:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--border-strong); }
.btn--secondary { background: var(--surface); color: var(--text); }
.btn--secondary:hover { transform: translate(-2px,-2px); box-shadow: 4px 4px 0 var(--border-strong); }

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */
.hero { padding-block: clamp(var(--space-16), 10vw, var(--space-24)) var(--space-16); }
.hero__inner { max-width: 50rem; } /* venstrestillet; centreres IKKE */
.hero h1 {
  font-size: var(--step-hero);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: .95;
  margin: 0 0 var(--space-6);
}
.hero__sub {
  font-size: var(--step-h3);
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 0 var(--space-8);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); }

/* Highlight-marker bag et nøgleord */
.mark {
  background: var(--brand-tint);
  color: inherit;
  padding: 0 .15em;
  border-radius: var(--radius-sm);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------------------------------------------------------------------
   Sticky kategori-chips
   --------------------------------------------------------------------- */
.chipbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.chipbar__scroll {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-block: var(--space-4);
}
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-family: var(--font-mono);
  font-size: var(--step-small);
  padding: .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .16s ease, color .16s ease;
}
.chip:hover,
.chip[aria-current="true"] { border-color: var(--brand); color: var(--brand); }

/* ---------------------------------------------------------------------
   Kategori-sektioner
   --------------------------------------------------------------------- */
.section { padding-block: var(--space-12); scroll-margin-top: var(--space-8); }
.section:nth-of-type(even) { background: var(--bg-alt); }

.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.section__head h2 {
  font-size: var(--step-h2);
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
}
.section__icon { font-size: 1.1em; }
.section__count {
  font-family: var(--font-mono);
  font-size: var(--step-small);
  color: var(--text-subtle);
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

/* ---------------------------------------------------------------------
   Værktøjskort — hele kortet klikbart via "stretched link"
   --------------------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.card:focus-within { box-shadow: var(--shadow-soft); }

.card__title {
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
.card__title a {
  color: var(--text);
  text-decoration: none;
}
/* Stretched link: dækker hele kortet, så det er klikbart */
.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.card:hover .card__title a { color: var(--brand); }
.card__title a:focus-visible { outline: none; } /* fokus vises på kortet i stedet */
.card:has(.card__title a:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }

.card__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--step-small);
}
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-size: var(--step-small);
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: var(--radius-pill);
  /* over stretched link, så badges forbliver synlige/læsbare */
  position: relative;
  z-index: 1;
}
.badge--free     { background: var(--brand-tint); color: var(--brand-strong); }
.badge--freemium { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.badge--easy     { background: var(--easy-bg);   color: var(--easy); }
.badge--medium   { background: var(--medium-bg); color: var(--medium); }
.badge--hard     { background: var(--hard-bg);   color: var(--hard); }

/* ---------------------------------------------------------------------
   Setup-notice (vises hvis DB ikke er klar endnu)
   --------------------------------------------------------------------- */
.notice {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-8);
  box-shadow: var(--shadow-hard);
  margin-block: var(--space-12);
}
.notice h2 { font-size: var(--step-h2); margin-bottom: var(--space-4); }
.notice ol { margin: 0; padding-left: 1.4em; }
.notice li { margin-bottom: var(--space-2); }
.notice code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--bg-alt);
  padding: .1em .35em;
  border-radius: var(--radius-sm);
}
.notice pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--step-small);
}

/* ---------------------------------------------------------------------
   Formular (submit.php)
   --------------------------------------------------------------------- */
.form-wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding-block: var(--space-16) var(--space-12);
}
.form-intro { margin-bottom: var(--space-8); }
.form-intro h1 {
  font-size: var(--step-h1);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: var(--space-3);
}
.form-intro__sub { color: var(--text-muted); margin: 0; }

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}
/* Felter der skal spænde hele bredden */
.form > .form-sep,
.form > .form-section-note,
.form > .form-actions,
.form > .field--full { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .form { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: var(--space-2); }

.label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-small);
}
.req { color: var(--brand); }

.input,
.textarea,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--step-body);
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .85rem;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.textarea { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.select { appearance: none; cursor: pointer; }
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select[aria-invalid="true"] { border-color: var(--hard); }

/* Fieldsets (radios) uden standard-ramme */
.fieldset { border: 0; margin: 0; padding: 0; }
.fieldset > .label { display: block; margin-bottom: var(--space-1); }
.radio-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.radio {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  font-size: var(--step-small);
  padding: .5rem .8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color .16s ease;
}
.radio:hover { border-color: var(--brand); }
.radio:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-strong);
}
.radio input { accent-color: var(--brand); }

.field__foot { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.char-count { color: var(--text-subtle); font-family: var(--font-mono); font-size: var(--step-eyebrow); white-space: nowrap; }
.char-count.is-over { color: var(--hard); }

.field__error { color: var(--hard); font-size: var(--step-small); font-weight: 600; }
.field__error:empty { display: none; }

.form__error {
  border: 2px solid var(--hard);
  background: var(--hard-bg);
  color: var(--hard);
  border-radius: var(--radius);
  padding: var(--space-4);
  font-weight: 600;
  margin-bottom: var(--space-6);
}

/* Samtykke */
.consent { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.consent input { margin-top: .25rem; accent-color: var(--brand); flex: 0 0 auto; }
.consent span { font-size: var(--step-small); color: var(--text-muted); }
.consent-details { margin-top: var(--space-2); }
.consent-details summary { cursor: pointer; color: var(--brand); font-size: var(--step-small); }
.consent-details p { color: var(--text-muted); font-size: var(--step-small); margin: var(--space-2) 0 0; }

.form-sep { border: 0; border-top: 1px solid var(--border); margin: var(--space-2) 0; }
.form-section-note { color: var(--text-subtle); font-size: var(--step-small); margin: 0; }

.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-2); }

/* Captcha (kontakt.php) */
.captcha-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.captcha-img { border: 2px solid var(--border-strong); border-radius: var(--radius); display: block; }
.input--code { max-width: 12rem; text-transform: uppercase; letter-spacing: .25em; font-family: var(--font-mono); }

/* Honeypot — skjult for mennesker, tilgængeligt for bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------------------------------------------------------------------
   Prose (privatlivspolitik, lange tekstsider)
   --------------------------------------------------------------------- */
.prose {
  max-width: var(--container); /* fyld bredden som forsiden */
  margin-inline: auto;
  padding-block: var(--space-16) var(--space-12);
}
.prose h1 {
  font-size: var(--step-h1);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: var(--space-3);
}
.prose h2 {
  font-size: var(--step-h3);
  margin-top: var(--space-12);
  margin-bottom: var(--space-3);
}
.prose p { color: var(--text-muted); }
.prose ul { padding-left: 1.3em; }
.prose li { color: var(--text-muted); margin-bottom: var(--space-2); }
.prose__updated { color: var(--text-subtle); font-size: var(--step-small); margin-top: 0; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding-block: var(--space-16);
  margin-top: var(--space-12);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-8);
  align-items: start;
}
.site-footer h2 { font-size: var(--step-h3); margin-bottom: var(--space-3); }
.site-footer p { color: var(--text-muted); max-width: 48ch; margin: 0 0 var(--space-4); }
.footer-nav { display: flex; flex-direction: column; gap: var(--space-2); }
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: var(--step-small);
}

@media (max-width: 640px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Bevægelse — staggered hero-reveal
   --------------------------------------------------------------------- */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero h1,
.hero__sub,
.hero__actions {
  animation: reveal-up .5s ease both;
}
.hero__sub      { animation-delay: .08s; }
.hero__actions  { animation-delay: .16s; }

/* Respektér prefers-reduced-motion: sluk alt */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .btn:hover, .theme-toggle:hover, .card:hover { transform: none; }
}
