@font-face {
  font-family: 'Manrope';
  src: url('/fonts/Manrope-Variable.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

/* Lugna Almanackan: varmt papper som standard, mörkt skogsläge via data-theme="dark". */
:root {
  color-scheme: light;
  --paper: #F8F5EF;
  --surface: #FFFFFF;
  --surface-soft: #F1ECE2;
  --ink: #16332F;
  --muted: #50615C;
  --accent: #147A73;
  --accent-hover: #0F5F59;
  --on-accent: #FFFFFF;
  --line: #E3DDD1;
  --shadow: 0 12px 32px rgba(22, 51, 47, 0.06);
  --display: 'Fraunces', Georgia, serif;
  --text: 'Manrope', 'Segoe UI', sans-serif;
  --radius: 20px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #131918;
  --surface: #1C2523;
  --surface-soft: #24302D;
  --ink: #F2EFE8;
  --muted: #AAB9B4;
  --accent: #4AB8AD;
  --accent-hover: #6FCFC5;
  --on-accent: #0F1F1D;
  --line: #31403C;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(100% - 40px, 760px);
  margin: 32px auto 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: 'opsz' 110;
  letter-spacing: -0.03em;
  font-size: 24px;
  color: var(--ink);
  text-decoration: none;
}

.brand-icon {
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 140ms ease, color 140ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle-to-dark,
.theme-toggle-to-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-to-light { display: none; }
:root[data-theme='dark'] .theme-toggle-to-dark { display: none; }
:root[data-theme='dark'] .theme-toggle-to-light { display: inline-flex; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.13em;
  font-weight: 800;
  text-transform: uppercase;
  margin: 44px 0 0;
  color: var(--accent);
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: 'opsz' 110;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h1 {
  font-size: clamp(32px, 5.5vw, 48px);
  margin: 12px 0 18px;
}

h2 {
  font-size: 24px;
  margin: 0 0 14px;
}

.lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 620px;
  margin: 0 0 8px;
}

section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 24px 0;
}

section p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

section p strong {
  color: var(--ink);
}

a {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 4px;
}

label {
  display: block;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0;
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 240px;
  font-size: 14px;
}

button:not(.theme-toggle) {
  font: 700 15px var(--text);
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 20px;
  min-height: 44px;
  cursor: pointer;
  margin: 8px 12px 8px 0;
  transition: background-color 140ms ease, border-color 140ms ease;
}

button:not(.theme-toggle):hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--line);
  margin: 0;
}

button.secondary:hover {
  background: var(--surface-soft);
  border-color: var(--accent);
}

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

.muted, footer {
  color: var(--muted);
  font-size: 14px;
}

footer {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

li { margin: 10px 0; }

.rows {
  padding: 0;
  margin: 0;
  list-style: none;
}

.rows li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.rows li:first-child {
  border-top: 0;
  padding-top: 6px;
}

.rows li:last-child {
  padding-bottom: 4px;
}

.rows li strong {
  color: var(--ink);
  font-size: 16px;
}

dl { margin: 0; }
dl > div {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
dl > div:first-child { border-top: 0; }
dt {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
dd {
  margin: 4px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.permissions {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.permissions input {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin: 0 10px 0 0;
  accent-color: var(--accent);
}

.permissions label {
  font-weight: 600;
  margin: 12px 0;
  cursor: pointer;
}

@media (max-width: 560px) {
  main { margin-top: 20px; }
  .tagline { display: none; }
  .eyebrow { margin-top: 32px; }
  section { padding: 20px; }
  button:not(.theme-toggle) { width: 100%; margin-right: 0; }
  .rows li {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle, button { transition: none; }
}
