/* To My Doctors – nettsiden. Tusjen: blekk på papir, én blå penn, håndskrevne overskrifter.
   Fargene er de samme som i appen (Assets.xcassets), lyse og mørke. */

@font-face {
  font-family: "Shantell Sans";
  src: url("fonts/ShantellSans-wght.ttf") format("truetype");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("fonts/Karla-wght.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #FFFEFA;
  --ink: #1B1B1A;
  --ink-2: #4F4B43;
  --pen: #233E9B;
  --highlighter: #C9D8F8;
  --rule: #B9B4A8;
  --field: #FFFFFF;
  --hand: "Shantell Sans", "Comic Sans MS", "Chalkboard SE", cursive;
  --text: "Karla", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1B18;
    --ink: #F3EFE4;
    --ink-2: #C4BDAE;
    --pen: #A8BAF4;
    --highlighter: #2E3B5E;
    --rule: #5C5850;
    --field: #272622;
  }
}

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

html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

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

/* Overskrifter: håndskrift */
h1, h2, h3, .appnavn, .kommer, .merke, nav, .sterk {
  font-family: var(--hand);
}
h1 {
  font-size: clamp(1.75rem, 1.5rem + 2.6vw, 3.1rem);
  font-weight: 700;
  line-height: 1.18;
  margin: .2em 0 .45em;
  letter-spacing: -.005em;
}
h2 {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 2.2em 0 0;
}
h3 {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.6em 0 .35em;
}
p, ul, ol, dl { margin: 0 0 .85em; }
ul { padding-left: 1.3em; }
li { margin-bottom: .45em; }
li::marker { color: var(--ink-2); }

.ingress { font-size: 1.3rem; line-height: 1.45; }
.dato { color: var(--ink-2); }

a {
  color: var(--pen);
  text-decoration-thickness: .09em;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: .16em; }
:focus-visible {
  outline: 3px solid var(--pen);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Håndtegnede streker (SVG som bygg.py lager). Strekene er pynt og skjult for skjermlesere. */
.strek path {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.strek .hoved { stroke-width: 1.9px; }
.strek .nib { stroke-width: 1.1px; }

.regel { display: block; width: 100%; height: 7px; margin: .3em 0 .8em; overflow: visible; }
.regel.lett path { stroke: var(--rule); }
.regel.lett .hoved { stroke-width: 1.5px; }

.boks { position: relative; }
.boks > .boks-strek {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}

.marker { position: relative; z-index: 0; white-space: nowrap; }
.marker > .marker-strek {
  position: absolute; z-index: -1;
  left: -.22em; right: -.22em; bottom: -.04em;
  width: calc(100% + .44em); height: .62em;
  overflow: visible;
}
.marker-strek path {
  fill: none;
  stroke: var(--highlighter);
  stroke-width: .42em;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* Sidehode */
.hopp {
  position: absolute; left: 1rem; top: 0;
  transform: translateY(-110%);
  background: var(--paper); color: var(--pen);
  padding: .6rem 1rem; font-weight: 700; z-index: 10;
}
.hopp:focus { transform: translateY(.6rem); }

.utkast-stripe {
  margin: 0;
  background: var(--highlighter);
  color: var(--ink);
  text-align: center;
  font-weight: 700;
  padding: .45rem 1rem;
  font-size: 1rem;
}

.topp {
  max-width: 68rem;
  margin: 0 auto;
  padding: .8rem 1rem .2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "merke sprak" "nav nav";
  align-items: center;
  gap: .2rem 1rem;
}
.merke {
  grid-area: merke;
  display: inline-flex; align-items: center; gap: .6rem;
  justify-self: start;
  color: var(--ink); text-decoration: none;
  font-size: 1.35rem; font-weight: 600;
  min-height: 44px;
}
.merke img { width: 44px; height: 44px; border-radius: 10px; }
.merke .logo-sh { display: none; }
.topp .sprak {
  grid-area: sprak;
  font-family: var(--hand);
  font-size: 1.08rem; font-weight: 500;
  display: inline-flex; align-items: center;
  min-height: 44px; padding: .2rem .4rem;
}
nav { grid-area: nav; }
nav ul {
  list-style: none; margin: 0 0 0 -.5rem; padding: 0;
  display: flex; flex-wrap: wrap;
  gap: 0 .1rem;
}
nav li { margin: 0; }
nav a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: .2rem .5rem;
  color: var(--ink); text-decoration: none;
  font-size: 1.08rem; font-weight: 500;
  text-decoration-skip-ink: none;
}
nav a:hover { text-decoration: underline; text-decoration-thickness: .08em; }
nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--pen);
  text-decoration-thickness: .14em;
  text-underline-offset: .3em;
}
@media (min-width: 52rem) {
  .topp {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "merke nav sprak";
  }
  nav ul { justify-content: flex-end; margin: 0; }
}

/* Innhold */
main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}
main > section.bred, main > .bred { max-width: none; }

@media (min-width: 64rem) {
  main.appside { max-width: 64rem; }
  main.appside > section:not(.bred):not(.apphode) { max-width: 44rem; }
}

/* Appsiden */
.apphode {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 2.2rem;
  align-items: center;
  margin-top: .6rem;
}
.appikon { width: 6.5rem; height: 6.5rem; border-radius: 1.45rem; }
.appnavn {
  font-size: 1.25rem; font-weight: 600;
  color: var(--ink-2);
  margin: 0;
}
@media (min-width: 46rem) {
  .apphode { grid-template-columns: auto 1fr; }
  .appikon { width: 11rem; height: 11rem; border-radius: 2.4rem; }
}
.kommer {
  display: inline-block;
  font-size: 1.25rem; font-weight: 600;
  padding: .6rem 1.25rem;
  margin: .4rem 0 0;
}

.steg { list-style: none; padding: 0; margin: 0; counter-reset: steg; }
.steg > li {
  counter-increment: steg;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 3rem;
  margin: 0 0 2.6rem;
}
.steg h3::before {
  content: counter(steg) ". ";
  color: var(--pen);
}
.steg h3 { margin-top: .4em; }
.steg > li:not(.med-bilde) .steg-tekst { max-width: 44rem; }
@media (min-width: 52rem) {
  .steg > li.med-bilde { grid-template-columns: minmax(0, 1fr) 17rem; align-items: start; }
}

.skjerm {
  margin: 0 auto;
  width: min(100%, 16.5rem);
  padding: .55rem;
}
.skjerm img {
  display: block;
  border-radius: .6rem;
  border: 1px solid var(--rule);
}
.skjerm figcaption {
  font-size: 1rem;
  color: var(--ink-2);
  text-align: center;
  padding: .55rem .3rem .2rem;
}

.to-kort {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  margin: 1.2rem 0 1.4rem;
}
@media (min-width: 46rem) {
  .to-kort { grid-template-columns: 1fr 1fr; }
}
.kort { padding: 1.1rem 1.3rem .5rem; }
.kort h3 { margin-top: 0; }
.kort h2 { margin-top: 0; margin-bottom: .6rem; }
.sterk { font-weight: 700; font-size: 1.2rem; }

main > .kort { margin: 1.6rem 0; }

.fakta { display: grid; grid-template-columns: 1fr; gap: .1rem 1.4rem; }
.fakta dt { font-weight: 700; margin-top: .45rem; }
.fakta dd { margin: 0; }
@media (min-width: 40rem) {
  .fakta { grid-template-columns: max-content 1fr; }
  .fakta dt, .fakta dd { margin-top: .45rem; }
}

.utkast-boks {
  padding: .9rem 1.2rem .3rem;
  margin: .4rem 0 1.4rem;
  background: var(--highlighter);
  border-radius: 1rem;
}
.utkast-boks p { margin-bottom: .6em; }
.ansvarlig { padding: .9rem 1.2rem .2rem; margin: 0 0 1.6rem; }

.mangler {
  outline: 2px dashed var(--pen);
  outline-offset: 1px;
  padding: 0 .2em;
  font-weight: 700;
  color: var(--pen);
}

/* Sidefot: hvem som står bak, på hver side */
.bunn {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1rem 2.4rem;
  font-size: 1.0625rem;
}
.bunn-innhold {
  display: grid;
  grid-template-columns: 1fr;
  gap: .4rem 2.4rem;
}
@media (min-width: 46rem) {
  .bunn-innhold { grid-template-columns: 1.3fr 1fr; }
}
.bunn-hvem { font-weight: 700; font-size: 1.15rem; margin-bottom: .3em; }
.bunn ul { list-style: none; padding: 0; }
.bunn li { margin: 0; }
.bunn li a {
  display: inline-flex; align-items: center; min-height: 44px;
}
.liten { font-size: .95rem; color: var(--ink-2); }
.liten a { color: inherit; }

/* Svært smal skjerm, eller stor tekst: overstrekingen slippes så ordene kan brytes,
   og sidehodet stables. */
@media (max-width: 22rem) {
  .marker { white-space: normal; }
  .marker > .marker-strek { display: none; }
  .topp { grid-template-columns: 1fr; grid-template-areas: "merke" "sprak" "nav"; }
  .topp .sprak { justify-self: start; padding-left: 0; }
  .appikon { width: 5rem; height: 5rem; border-radius: 1.1rem; }
  p, li, dd { hyphens: auto; -webkit-hyphens: auto; }
  a, .merke, .appnavn { hyphens: none; -webkit-hyphens: none; }
  a[href^="mailto:"] { overflow-wrap: anywhere; }
  .kort, .utkast-boks, .ansvarlig { padding-left: .9rem; padding-right: .9rem; }
}

@media print {
  nav, .hopp, .utkast-stripe { display: none; }
  .merke .logo-farge { display: none; }
  .merke .logo-sh { display: inline; }
  body { font-size: 11pt; }
  a { color: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
