/*
 * apps.weidt.se: ett kort per app. Överst i kortet finns en scen med något att prova (lek.js), och
 * scenens mark går över i kortets färg, --ground. Korten ser likadana ut i ljust och mörkt läge.
 */

@font-face {
  font-family: Fraunces;
  src: url('fonts/Fraunces_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('fonts/Figtree_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('fonts/Figtree_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('fonts/Figtree_700Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f4f5f2;
  --text: #1d2320;
  --muted: #5b635e;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141715;
    --text: #edf0eb;
    --muted: #a5ada7;
  }
}

.idag {
  --sky: linear-gradient(#f4e4bb, #efd095);
  --ground: #fffaf0;
  --ink: #33230a;
  --soft: #6e5a35;
  --accent: #f2b530;
  --on-accent: #2a1d05;
}
.beredskap {
  --sky: linear-gradient(#f3ecdd, #e3e7d8);
  --ground: #213d33;
  --ink: #f7f1e6;
  --soft: #c6cdb9;
  --accent: #dba758;
  --on-accent: #23190a;
}
.bunkra {
  --sky: linear-gradient(#0b1531, #16302a);
  --ground: #11211c;
  --ink: #f0e3c8;
  --soft: #b3bba8;
  --accent: #dba758;
  --on-accent: #23190a;
}
.kasivra {
  --sky: #efe9dc;
  --ground: #ffffff;
  --ink: #1c1a17;
  --soft: #625d55;
  --accent: #1c1a17;
  --on-accent: #ffffff;
}
.saldometer {
  --sky: linear-gradient(#2f4f94, #1a2f60);
  --ground: #0b1531;
  --ink: #ffffff;
  --soft: #b6c2de;
  --accent: #ecd07f;
  --on-accent: #1a2747;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 Figtree, system-ui, sans-serif;
}
h1,
h2,
p {
  margin: 0;
}
h1,
h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.wrap {
  width: min(100% - 2.5rem, 64rem);
  margin-inline: auto;
}

.top {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem);
  text-align: center;
}
h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
}
.lead {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  text-wrap: balance;
}
.jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem 1.5rem;
  margin-top: 2.25rem;
}
.jump a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  width: 7rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}
.jump a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.jump img {
  width: 4.5rem;
  border-radius: 22.5%;
}

.apps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.app {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 1.75rem;
  background: var(--ground);
  color: var(--ink);
  scroll-margin-top: 1.5rem;
}
.bunkra {
  grid-column: 1 / -1;
}

/* Scenen */
.stage {
  position: relative;
  height: 26rem;
  overflow: hidden;
  background: var(--sky);
}
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.controls button {
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  line-height: 1.2;
}
.controls button:disabled {
  opacity: 0.45;
  cursor: default;
}
.hint {
  font-size: 0.9375rem;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Idag */
.sun {
  transform: translateY(calc(-30px - var(--done, 0) * 36px));
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.todo {
  position: relative;
  display: grid;
  gap: 0.5rem;
  width: min(100% - 2.5rem, 21rem);
  margin: 0 auto;
  padding: 1.5rem 0 0;
  list-style: none;
}
.todo button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.125rem;
  padding: 0.5rem 1.125rem;
  border: 0;
  border-radius: 1.125rem;
  background: #ffffff;
  font-weight: 600;
  text-align: left;
  box-shadow: 0 0.5rem 1.25rem rgb(122 72 30 / 0.16);
}
.ring {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  border: 2.5px solid #8a8476;
  border-radius: 50%;
}
.when {
  margin-left: auto;
  color: #85620a;
  font-size: 0.9375rem;
}
.todo [aria-pressed='true'] .ring {
  border-color: #f2b530;
  background: #f2b530;
}
.todo [aria-pressed='true'] .ring::before {
  content: '';
  width: 0.4rem;
  height: 0.75rem;
  margin-top: -0.15rem;
  border: solid #2a1d05;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.todo [aria-pressed='true'] .what {
  color: #6e6a60;
  text-decoration: line-through;
}
.todo li:first-child [aria-pressed='false'] {
  animation: ring 3s infinite;
}
@keyframes ring {
  0%,
  72%,
  100% {
    transform: none;
  }
  76%,
  84%,
  92% {
    transform: translateX(-4px) rotate(-1.4deg);
  }
  80%,
  88%,
  96% {
    transform: translateX(4px) rotate(1.4deg);
  }
}

/* Min beredskap */
.pantry {
  position: relative;
  padding: 1rem 1.25rem 0;
  color: #213d33;
  text-align: center;
}
.days {
  font: 600 2.75rem/1.1 Fraunces, Georgia, serif;
}
.days strong {
  font-weight: inherit;
}
.pantry .controls {
  margin-top: 0.5rem;
}
.water,
.food {
  opacity: 0;
  transition: opacity 0.3s;
}
.water.in,
.food.in {
  opacity: 1;
}

/* Bunkra */
.bunkra .stage {
  height: 30rem;
}
.storm-controls {
  position: absolute;
  inset: auto 0 1rem;
  padding: 0 1rem;
  text-align: center;
}
.storm-controls .hint {
  margin-bottom: 0.375rem;
}
.storm-controls [aria-pressed='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ground);
}
.window,
.glow,
.candle,
.stars,
.moon {
  transition:
    opacity 0.5s,
    fill 0.5s;
}
.candle,
.rain {
  opacity: 0;
}
.dark .window {
  fill: #2b3430;
}
.dark .glow {
  opacity: 0;
}
.dark.lit .candle {
  opacity: 1;
}
.dark.lit .window {
  fill: #8a6934;
}
.dark.lit .glow {
  opacity: 0.5;
}
.clouds {
  transform: translateY(-220px);
  transition: transform 1.6s ease-out;
}
.smoke {
  opacity: 0.55;
}
.rain {
  position: absolute;
  inset: -3rem;
  pointer-events: none;
  background:
    repeating-linear-gradient(100deg, rgb(207 224 224 / 0.2) 0 1px, transparent 1px 17px),
    repeating-linear-gradient(100deg, transparent 0 9px, rgb(207 224 224 / 0.13) 9px 11px, transparent 11px 34px);
  transition: opacity 0.8s;
}
.storming .rain {
  opacity: 1;
}
.storming .clouds {
  transform: none;
}
.storming .stars,
.storming .moon {
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .storming .rain {
    animation: rain 0.9s linear infinite;
  }
  .storming .tree {
    animation: sway 1.1s ease-in-out infinite alternate;
  }
  .smoke {
    animation: smoke 4s ease-in-out infinite alternate;
  }
}
@keyframes rain {
  to {
    transform: translateX(-34.52px);
  }
}
@keyframes sway {
  from {
    transform: skewX(-3deg);
  }
  to {
    transform: skewX(-9deg);
  }
}
@keyframes smoke {
  to {
    transform: translateX(10px);
    opacity: 0.25;
  }
}

/* Kasivra */
.paper {
  position: relative;
  width: min(100% - 2.5rem, 23rem);
  height: 100%;
  margin: 1.75rem auto 0;
  padding: 1.5rem 1.5rem 0;
  border-radius: 0.375rem;
  background: #ffffff;
  box-shadow: 0 0.5rem 1.5rem rgb(60 45 20 / 0.12);
}
.paper label {
  color: var(--soft);
  font-size: 0.9375rem;
}
.paper input {
  display: block;
  width: 100%;
  margin-top: 0.125rem;
  padding: 0.375rem 0;
  border: 0;
  border-bottom: 2px solid #1c1a17;
  border-radius: 0;
  background: transparent;
  font: 600 1.125rem/1.4 Fraunces, Georgia, serif;
}
.sentence {
  min-height: 3.25rem;
  margin-top: 0.75rem;
  overflow-wrap: anywhere;
}
.sentence button {
  padding: 0 0.25rem;
  border: 0;
  border-radius: 0.3125rem;
  background: #f0e8d6;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}
.sentence [aria-pressed='true'] {
  background: #ffe39a;
  text-decoration: none;
}
.paper .hint {
  color: var(--soft);
}
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.625rem 0 0;
  padding: 0;
  list-style: none;
}
.cards li {
  max-width: 100%;
  padding: 0.25rem 0.75rem;
  border-left: 4px solid #e0a92e;
  border-radius: 0.375rem;
  background: #fbf3dc;
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.pen {
  pointer-events: none;
}

/* Saldometer */
.gauge {
  position: relative;
  width: min(100% - 3rem, 20rem);
  margin: 0 auto;
  padding-top: 1.75rem;
}
.gauge svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.amount {
  position: relative;
  display: grid;
  margin-top: -5.25rem;
  text-align: center;
}
.amount strong {
  font: 600 2.125rem/1.15 Fraunces, Georgia, serif;
}
.gauge input {
  width: 100%;
  height: 2.75rem;
  margin: 0.5rem 0 0;
  accent-color: #ecd07f;
}
.pane {
  fill: #ecd07f;
  opacity: 0.1;
  transition: opacity 0.4s;
}
.pane.on {
  opacity: 0.9;
}

/* Om appen */
.info {
  flex: 1;
  padding: 1.75rem;
}
.info .text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
}
.with-phone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.75rem;
  gap: 1.25rem;
  padding-bottom: 0;
}
.with-phone .text {
  padding-bottom: 1.75rem;
}
.phone {
  align-self: end;
  height: 17rem;
  padding: 0.3125rem 0.3125rem 0;
  overflow: hidden;
  border-radius: 1.375rem 1.375rem 0 0;
  background: #16130f;
  box-shadow: 0 0.5rem 1.5rem rgb(20 25 20 / 0.28);
}
.phone img {
  border-radius: 1.125rem 1.125rem 0 0;
}
.name {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.name img {
  flex: none;
  width: 4rem;
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
}
h2 {
  font-size: 1.75rem;
}
.status,
.note {
  color: var(--soft);
  font-size: 0.9375rem;
}
.tagline {
  margin-bottom: 0.5rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.35;
}
.facts {
  display: grid;
  gap: 0.375rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}
.facts li {
  position: relative;
  padding-left: 1.5rem;
  line-height: 1.45;
  text-wrap: pretty;
}
.facts li::before {
  content: '';
  position: absolute;
  top: 0.45em;
  left: 0;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--accent);
}
.button {
  margin-top: auto;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.note {
  margin-bottom: 1.5rem;
}
.button:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.button:focus-visible {
  outline-color: var(--ink);
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 2.5rem 0 3.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
footer a {
  text-underline-offset: 0.25em;
}

@media (min-width: 58rem) {
  .bunkra .text {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 1fr;
    column-gap: 3rem;
    align-items: start;
    justify-items: start;
  }
  .bunkra .text > * {
    grid-column: 1;
  }
  .bunkra .tagline + p {
    grid-row: 3 / span 2;
  }
  .bunkra .facts {
    grid-area: 1 / 2 / span 2 / auto;
    margin-top: 0;
  }
  .bunkra .note {
    grid-area: 3 / 2;
    margin-bottom: 1rem;
  }
  .bunkra .button {
    grid-area: 4 / 2;
    margin-top: 0;
  }
}
@media (max-width: 58rem) {
  .apps {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 30rem) {
  .jump {
    column-gap: 0;
  }
  .jump a {
    width: 33%;
  }
  .info {
    padding: 1.5rem 1.25rem;
  }
  .with-phone {
    display: block;
    padding-bottom: 1.5rem;
  }
  .with-phone .text {
    padding-bottom: 0;
  }
  .phone {
    display: none;
  }
}

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