/*
  stil.css – Dödsboguiden och RVSMR AB
  Färger från appens designsystem "Pärmen i mossgrönt"
  (dodsboguiden/Assets.xcassets/Farg, ljust och mörkt läge).
  Papperston som bakgrund, mossgrönt som handling, ockra som markering, aldrig rött.
  Inga externa resurser: systemtypsnitt, inga webbfonter, inga bilder utanför assets/.
*/

/* ---------- Färger (tokens) ---------- */

:root {
  color-scheme: light dark;

  --background: #F7F4EE;          /* Farg/background: varmt papper */
  --surface: #FFFDF8;             /* Farg/surface: kort */
  --surface-sunken: #EFEADF;      /* Farg/surface-sunken */
  --text: #1B2822;                /* Farg/text */
  --text-secondary: #34433B;      /* Farg/text-secondary */
  --primary: #2C5A46;             /* Farg/primary: mossgrön handling */
  --primary-text-on: #FFFFFF;     /* Farg/primary-text-on */
  --accent: #E8B24C;              /* Farg/accent: ockra, bara yta och linje */
  --accent-text-on: #1B2822;      /* Farg/accent-text-on */
  --deadline-text: #5C3B06;       /* Farg/deadline-text */
  --status-deadline-surface: #FBEFD2;
  --status-done-surface: #E4EEE6;
  --border: #D9D2C4;              /* Farg/border */
  --border-strong: #7F7666;       /* Farg/border-strong */
  --focus: #1D4E7E;               /* Farg/focus */

  --radie: 16px;
  --radie-liten: 10px;
  --bredd: 68rem;
  --textbredd: 40rem;
  --sidmarginal: clamp(1rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111A16;
    --surface: #1A2520;
    --surface-sunken: #0C1310;
    --text: #F1EEE6;
    --text-secondary: #CDD5D0;
    --primary: #A3CDB5;
    --primary-text-on: #0F1A15;
    --accent: #E6BC66;
    --accent-text-on: #1B2822;
    --deadline-text: #F5D594;
    --status-deadline-surface: #33291A;
    --status-done-surface: #1B3328;
    --border: #33413A;
    --border-strong: #7E8C84;
    --focus: #A9CDF2;
  }
}

/* ---------- Grund ---------- */

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;           /* 17 px, som brödtext i iOS */
  line-height: 1.6;
  overflow-wrap: break-word;
  hyphens: manual;                /* ord ska aldrig delas av webbläsaren */
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.7rem, 1.3rem + 2.4vw, 2.75rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem);
  margin-top: 0;
}

h3 {
  font-size: 1.2rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.25em;
}

li + li {
  margin-top: 0.35em;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

strong {
  font-weight: 650;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---------- Hoppa till innehållet ---------- */

.hoppa {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 10;
  background: var(--primary);
  color: var(--primary-text-on);
  padding: 0.6rem 1rem;
  border-radius: var(--radie-liten);
  font-weight: 600;
  text-decoration: none;
}

.hoppa:focus {
  top: 1rem;
}

/* ---------- Sidhuvud ---------- */

.sidhuvud {
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.sidhuvud__inre {
  max-width: var(--bredd);
  margin: 0 auto;
  padding: 0.9rem var(--sidmarginal);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.varumarke {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.2rem;
}

.varumarke img {
  width: 40px;
  height: 40px;
  border-radius: 9px;            /* ungefär appikonens hörn i liten storlek */
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.25rem;
}

.nav li + li {
  margin-top: 0;
}

.nav a {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radie-liten);
  color: var(--text);
  text-decoration: none;
  font-weight: 550;
}

.nav a:hover {
  background: var(--surface-sunken);
}

.nav a[aria-current="page"] {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

/* ---------- Innehåll ---------- */

.innehall {
  max-width: var(--bredd);
  margin: 0 auto;
  padding: 2.5rem var(--sidmarginal) 3rem;
}

/* En textsida (integritet, villkor, support): lagom radlängd. */
.textsida {
  max-width: var(--textbredd);
}

.avsnitt {
  margin: 0 0 3.5rem;
}

.avsnitt > h2 {
  margin-bottom: 0.75rem;
}

.ingress {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text);
  max-width: var(--textbredd);
}

.liten {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.smal {
  max-width: var(--textbredd);
}

/* Platshållare som ägaren ska fylla i före publicering. Syns tydligt med flit. */
.platshallare {
  background: var(--status-deadline-surface);
  color: var(--deadline-text);
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  padding: 0 0.25em;
  font-weight: 600;
  /* Långa platshållare får brytas, så att de inte går utanför sidan på 320 px. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Hjältedel (överst på appsidan) ---------- */

.hjalte {
  display: grid;
  gap: 2rem;
  align-items: center;
  margin-bottom: 3.5rem;
}

.hjalte__ikon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}

.hjalte__bild {
  justify-self: center;
  max-width: 300px;
  width: 100%;
  border-radius: 22px;
  border: 1px solid var(--border);
}

@media (min-width: 52rem) {
  .hjalte {
    grid-template-columns: 1.3fr 1fr;
    gap: 3rem;
  }
}

/* ---------- Knappar ---------- */

.knapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-text-on);
  border: 2px solid var(--primary);
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
  line-height: 1.3;
}

.knapp:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.knapp--sekundar {
  background: transparent;
  color: var(--primary);
}

.knapprad {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0 0.75rem;
}

/* ---------- Kort ---------- */

.kort {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radie);
  padding: 1.25rem 1.25rem 0.5rem;
}

.kort > h3 {
  margin-bottom: 0.4rem;
}

.kortlista {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.kortlista > li + li {
  margin-top: 0;
}

/* Ett helt kort som är en länk, med ikon och text (startsidan). */
.lankkort {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radie);
  padding: 1.1rem 1.25rem;
  margin: 1rem 0 2rem;
  color: var(--text);
  font-weight: 650;
  font-size: 1.15rem;
  text-decoration: none;
}

.lankkort:hover {
  border-color: var(--primary);
}

.lankkort img {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  flex: none;
}

/* Ockra markering, som "Nästa steg" och datumraden i appen. Ockra är bara linje
   och yta, aldrig textfärg på ljus botten. */
.markering {
  border-left: 4px solid var(--accent);
  background: var(--status-deadline-surface);
  border-radius: 0 var(--radie-liten) var(--radie-liten) 0;
  padding: 0.9rem 1.1rem 0.1rem;
  margin: 0 0 1.25rem;
}

/* Lugn grön ruta för något som är bra att veta. */
.notis {
  background: var(--status-done-surface);
  border-radius: var(--radie-liten);
  padding: 0.9rem 1.1rem 0.1rem;
  margin: 0 0 1.25rem;
}

/* ---------- De fyra stegen ---------- */

.steg {
  list-style: none;
  counter-reset: steg;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.steg > li {
  counter-increment: steg;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radie);
  padding: 1.25rem 1.25rem 0.5rem;
  margin: 0;
}

.steg > li::before {
  content: counter(steg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.steg h3 {
  margin-bottom: 0.35rem;
}

/* ---------- Listor ---------- */

/* Lista med bock, för det som ingår. */
.bocklista {
  list-style: none;
  padding: 0;
}

.bocklista > li {
  position: relative;
  padding-left: 1.9rem;
}

.bocklista > li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.45em;
  width: 0.45rem;
  height: 0.85rem;
  border: solid var(--primary);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

/* Lista med streck, för det appen inte är. */
.strecklista {
  list-style: none;
  padding: 0;
}

.strecklista > li {
  position: relative;
  padding-left: 1.6rem;
}

.strecklista > li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.8em;
  width: 0.8rem;
  border-top: 2px solid var(--border-strong);
}

/* ---------- Skärmbilder ---------- */

.skarmbilder {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 2rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
}

.skarmbilder > li + li {
  margin-top: 0;
}

.skarmbilder--ipad {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}

.skarmbild {
  margin: 0;
}

.skarmbild img {
  width: 100%;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.skarmbilder--ipad .skarmbild img {
  border-radius: 16px;
}

.skarmbild figcaption {
  margin-top: 0.75rem;
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.skarmbild figcaption strong {
  display: block;
  color: var(--text);
}

/* ---------- Pris ---------- */

.pris {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

/* ---------- Frågor och svar (support) ---------- */

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radie-liten);
  padding: 0 1.1rem;
  margin: 0 0 0.75rem;
}

summary {
  cursor: pointer;
  font-weight: 650;
  padding: 0.9rem 0;
  min-height: 44px;
}

details[open] summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

/* ---------- Tabell ---------- */

.tabell-ram {
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

.tabell-ram:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 20rem;
  font-size: 0.97rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 650;
  background: var(--surface-sunken);
}

/* ---------- Sidfot ---------- */

.sidfot {
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.sidfot__inre {
  max-width: var(--bredd);
  margin: 0 auto;
  padding: 2rem var(--sidmarginal) 2.5rem;
}

.sidfot p {
  margin: 0 0 0.5rem;
}

.sidfot a {
  color: var(--primary);
}

.sidfot ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.sidfot li + li {
  margin-top: 0;
}

/* ---------- Utskrift ---------- */

@media print {
  /* Utskriften blir alltid ljus, också från en enhet i mörkt läge. */
  :root {
    color-scheme: light;
    --background: #FFFFFF;
    --surface: #FFFFFF;
    --surface-sunken: #EFEADF;
    --text: #1B2822;
    --text-secondary: #34433B;
    --primary: #2C5A46;
    --primary-text-on: #FFFFFF;
    --accent: #E8B24C;
    --accent-text-on: #1B2822;
    --deadline-text: #5C3B06;
    --status-deadline-surface: #FBEFD2;
    --status-done-surface: #E4EEE6;
    --border: #D9D2C4;
    --border-strong: #7F7666;
    --focus: #1D4E7E;
  }

  .hoppa,
  .nav,
  .knapprad {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .kort,
  .steg > li,
  details {
    border-color: #999;
    break-inside: avoid;
  }
}

/* ---------- Mindre rörelse ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
