/* Sluja creations – sluja.fi
   Värit on koottu muuttujiksi. Tekstien kontrasti on tarkistettu
   tarkistusohjelmalla (sivusto/tarkistus/tarkista.py). */

:root {
  color-scheme: light dark;

  --tausta: #f6f4ef;
  --teksti: #1c1d1f;
  --teksti-heikko: #4b4d52;
  --viiva: #d8d3c8;
  --linkki: #0b5a61;
  --nappi-tausta: #0b5a61;
  --nappi-tausta-hover: #08454b;
  --nappi-teksti: #ffffff;
  --merkki-tausta: #f3e1b3;
  --merkki-teksti: #573a00;
  --huomio-tausta: #fbf1dc;
  --huomio-reuna: #c4860f;
  --fokus: #a8460a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tausta: #15171a;
    --teksti: #ebe8e2;
    --teksti-heikko: #b4b1ab;
    --viiva: #34373c;
    --linkki: #82d2d6;
    --nappi-tausta: #82d2d6;
    --nappi-tausta-hover: #a6e1e4;
    --nappi-teksti: #0a2427;
    --merkki-tausta: #3d3016;
    --merkki-teksti: #f4d68c;
    --huomio-tausta: #221e15;
    --huomio-reuna: #b9861f;
    --fokus: #f2b45c;
  }
}

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

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

body {
  margin: 0;
  background: var(--tausta);
  color: var(--teksti);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Tavutus vain kapeissa näkymissä (pieni puhelin tai suurennus),
   joissa pitkät yhdyssanat eivät muuten mahdu riville. */
@media (max-width: 22rem) {
  body {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
  }
}

.sivu {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 6.5rem) clamp(1rem, 5vw, 2rem) clamp(3rem, 8vw, 6rem);
}

/* Otsake */

h1,
h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  font-weight: 750;
}

.alaotsikko {
  margin: 0.5rem 0 0;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  color: var(--teksti-heikko);
}

.esittely {
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.375rem);
  line-height: 1.55;
}

/* Osiot */

.osio {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  padding-top: clamp(1.75rem, 4vw, 2.25rem);
  border-top: 1px solid var(--viiva);
}

h2 {
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 700;
}

.osio p {
  margin: 1rem 0 0;
}

.osion-otsikko {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
}

.osion-otsikko .merkki {
  margin: 0;
}

.merkki {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--merkki-tausta);
  color: var(--merkki-teksti);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.merkki::before {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

.osio .tilanne {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--huomio-reuna);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--huomio-tausta);
}

/* Linkit */

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

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

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

a.osoite {
  overflow-wrap: anywhere;
  -webkit-hyphens: none;
  hyphens: none;
}

.nappi {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--nappi-tausta);
  color: var(--nappi-teksti);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.nappi:hover {
  background: var(--nappi-tausta-hover);
}

.nappi:focus-visible {
  border-radius: 0.5rem;
}

/* Tulostus */

@media print {
  :root {
    --tausta: #ffffff;
    --teksti: #000000;
    --teksti-heikko: #333333;
    --linkki: #000000;
    --merkki-tausta: #ffffff;
    --merkki-teksti: #000000;
    --huomio-tausta: #ffffff;
  }

  .sivu {
    max-width: none;
    padding: 0;
  }

  .nappi {
    padding: 0;
    min-height: 0;
    background: none;
    color: #000000;
    text-decoration: underline;
  }

  .merkki {
    border: 1px solid #000000;
  }
}
