/* Lag innhold. Studentdemokratiet-profilen: Inter, sort #1F1E1E på all tekst, blå, gul og korall,
   litt avrundede hjørner (ca. 1/8 av kortsiden), aldri piller. */
@font-face {
  font-family: Inter;
  src: url(/fonter/inter.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --sort: #1F1E1E;
  --hvit: #FFFFFF;
  --bla: #98C8F7;
  --lysbla: #EDF6FF;
  --gul: #FFC85E;
  --lysgul: #FFF1D7;
  --korall: #FFADA2;
  --lyskorall: #FFEFF1;
  --demp: #55595E;
  --linje: #D5E6F7;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lysbla);
  color: var(--sort);
  font: 500 17px/1.45 Inter, -apple-system, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
main:focus { outline: none; }
h1, h2, p { margin: 0; }
svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fylt { fill: currentColor; stroke: none; }

/* Hodet: korall etikett og tittelen i gul boks, som storyene */
.hode { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 2px 6px; }
.etikett {
  background: var(--korall);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
  padding: 0.32em 0.6em 0.36em;
  border-radius: 0.3em;
}
.tittel { font-weight: 700; font-size: 38px; line-height: 1.06; letter-spacing: -0.01em; }
.tittel span { display: inline-block; background: var(--gul); padding: 0.06em 0.26em 0.1em; border-radius: 0.15em; }
.hode .under { color: var(--sort); font-size: 16px; max-width: 30em; }

.kort {
  background: var(--hvit);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kort h2 { font-size: 17px; font-weight: 700; }
.kort[hidden] { display: none; }
.rad { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 14px; color: var(--demp); line-height: 1.4; }
.hint.midt { text-align: center; margin-top: -4px; }
.ki-merke { font-size: 13px; color: var(--demp); text-align: center; margin-top: 8px; }

/* Knapper */
.knapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--hvit);
  color: var(--sort);
  font: 700 16px/1.2 Inter, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--linje);
  transition: transform 120ms ease-out, background-color 150ms ease-out;
  touch-action: manipulation;
}
.knapp:active:not(:disabled) { transform: scale(0.97); }
.knapp:disabled { opacity: 0.45; cursor: default; }
.knapp:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-within {
  outline: 3px solid var(--sort);
  outline-offset: 2px;
}
.knapp.stor { width: 100%; min-height: 56px; font-size: 18px; border-radius: 12px; }
.knapp.fylt { background: var(--gul); box-shadow: none; }
.knapp.stille { background: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.knapp.liten { min-height: 44px; padding: 0 14px; font-size: 15px; }
.toppknapper { display: flex; justify-content: flex-start; margin: -4px 0 -2px -8px; }
.toppknapper .knapp { text-decoration: none; }

/* Velg bilde */
.velg-bilde {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 170px;
  border-radius: 14px;
  background: var(--lysbla);
  text-align: center;
  padding: 18px;
  cursor: pointer;
}
.velg-bilde svg { width: 40px; height: 40px; stroke-width: 1.5; }
.velg-bilde .stort { font-weight: 700; font-size: 18px; }
.velg-bilde .lite { font-size: 14px; color: var(--demp); }
.valgt-bilde img { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 14px; background: var(--lysbla); }

textarea, input[type="text"] {
  width: 100%;
  font: 500 17px/1.45 Inter, system-ui, sans-serif;
  color: var(--sort);
  background: var(--hvit);
  border: 1.5px solid var(--linje);
  border-radius: 12px;
  padding: 12px 14px;
  resize: none;
}
textarea { min-height: 96px; overflow: hidden; }
.felt textarea { min-height: 0; }
textarea::placeholder, input::placeholder { color: #8A8F95; }

.mikrofon { background: var(--lysbla); box-shadow: none; }
.mikrofon[data-tilstand="tar-opp"] { background: var(--korall); }
.mikrofon[data-tilstand="tar-opp"] svg { animation: puls 1.2s ease-in-out infinite; }
@keyframes puls { 50% { opacity: 0.35; } }
.mikrofon .prikker { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--sort); border-right-color: transparent; animation: snurr 0.8s linear infinite; }
@keyframes snurr { to { transform: rotate(360deg); } }

/* Valg i rad */
.segment {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  background: var(--lysbla);
  padding: 4px;
  border-radius: 12px;
}
.segment button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sort);
  font: 600 16px/1.2 Inter, system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.segment button[aria-checked="true"] { background: var(--bla); font-weight: 700; }
main > .segment { background: var(--hvit); }

/* Laster */
.laster { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 70px 0 40px; text-align: center; }
.laster .stort { font-weight: 700; font-size: 22px; }
.laster .lite { color: var(--demp); font-size: 15px; }
.streker-anim { width: 72px; height: 72px; overflow: visible; margin-bottom: 8px; }
.streker-anim line { stroke: var(--korall); stroke-width: 9; stroke-linecap: round; animation: strek 1.1s ease-in-out infinite; }
.streker-anim line:nth-child(2) { animation-delay: 0.15s; }
.streker-anim line:nth-child(3) { animation-delay: 0.3s; }
@keyframes strek { 0%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Forhåndsvisning */
.forhandsvisning { display: flex; justify-content: center; }
.lerret {
  display: block;
  height: auto;
  border-radius: 14px;
  background: var(--bla);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.lerret.drar { cursor: grabbing; }
.forhandsvisning.story .lerret { width: min(100%, calc((100svh - 300px) * 0.5625)); min-width: 220px; }
.forhandsvisning.innlegg .lerret { width: min(100%, calc((100svh - 300px) * 0.8)); min-width: 260px; }

.varianter { display: flex; justify-content: center; gap: 12px; }
.variant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 4px;
  border-radius: 12px;
  font: 600 14px/1.2 Inter, system-ui, sans-serif;
  color: var(--sort);
  cursor: pointer;
}
.variant canvas { width: 62px; height: auto; border-radius: 7px; box-shadow: 0 0 0 1.5px var(--linje); }
.variant.innlegg canvas { width: 72px; }
.variant[aria-checked="true"] canvas { box-shadow: 0 0 0 3px var(--sort); }
.variant[aria-checked="true"] span { font-weight: 700; }

.felt { display: flex; flex-direction: column; gap: 5px; }
.felt span { font-size: 14px; font-weight: 600; color: var(--demp); }


#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 20px);
  max-width: min(92vw, 480px);
  background: var(--sort);
  color: var(--hvit);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  z-index: 10;
}
#toast.vis { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
