/* Lappen website. Same tokens as the app (src/theme): one typeface, one
   green accent, green-tinted neutrals, light and dark, 4pt spacing. */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("/lappen/fonts/familjen-grotesk-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/lappen/fonts/familjen-grotesk-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/lappen/fonts/familjen-grotesk-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f8fbf9;
  --surface: #edf1ee;
  --text: #191f1a;
  --muted: #565d57;
  --border: #d7dcd8;
  --border-strong: #818883;
  --accent: #1d723e;
  --accent-pressed: #116031;
  --on-accent: #f6fcf7;
  /* Links: the accent where it reads as text. */
  --link: #1d723e;
  --link-hover: #116031;
  --mark-red: #e24942;
  --mark-yellow: #b98800;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1310;
    --surface: #191d1a;
    --text: #e7ede8;
    --muted: #9fa7a1;
    --border: #2d322e;
    --border-strong: #646b66;
    /* Same green as light. It is too dark for text here (3.1:1), so
       links use the text color and keep their underline. */
    --link: #e7ede8;
    --link-hover: #9fa7a1;
    --mark-red: #ff7266;
    --mark-yellow: #f6c330;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* In-page links land below the sticky header. */
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--link-hover);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Footer stays at the bottom of the window on short pages. */
body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.wrap,
.bar {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(var(--space-6), env(safe-area-inset-left));
  padding-right: max(var(--space-6), env(safe-area-inset-right));
}
.wrap {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Header: full width and sticky, name left, language switch right. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: env(safe-area-inset-top);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
/* Logo lockup proportions, frozen: mark 28/22 of the name's size, gap
   8/22, tracking -0.01em, and the L's stem centred on the mark. The app's
   Wordmark uses the same ratios. */
.site-name {
  display: inline-flex;
  align-items: center;
  gap: calc(8em / 22);
  min-height: 44px;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-name .mark {
  flex: none;
  width: calc(28em / 22);
  height: calc(28em / 22);
}
/* Centres the L's stem on the mark: the line box middle is 480/1200 em
   above the baseline, the stem's middle (0-780) is at 390. Up by the
   difference. Checked on screen at 10x zoom. */
.site-name span {
  position: relative;
  top: -0.075em;
}
/* Lines up the middle of the capitals with the middle of the n in the
   name. Measured on screen at 10x zoom (browsers round small text's
   metrics, so the 15px label doesn't follow the font maths exactly). */
.lang-switch {
  position: relative;
  top: 0.075em;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

main {
  flex: 1 0 auto;
  padding-bottom: var(--space-16);
}

h1,
h2 {
  /* Long Swedish compounds break instead of overflowing on phones. */
  overflow-wrap: break-word;
  hyphens: auto;
}
h1 {
  font-size: clamp(32px, 9vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: var(--space-8) 0 var(--space-4);
  text-wrap: balance;
}
h2 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  margin: var(--space-12) 0 var(--space-3);
  text-wrap: balance;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-1);
}
p,
ul,
ol {
  margin: 0 0 var(--space-4);
  max-width: 65ch;
}
ul,
ol {
  padding-left: 1.25em;
}
li + li {
  margin-top: var(--space-2);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 15px;
}

/* Landing: the promise on its own, then a live-looking list and the
   three benefits. */
.hero {
  padding: var(--space-12) 0 0;
  text-align: center;
}
.hero h1 {
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 760px) {
  .hero {
    /* Plus the showcase's 48px, the same 64px as above. */
    padding: var(--space-16) 0 var(--space-4);
  }
}
.hero h1 {
  font-size: clamp(44px, 9vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin-top: 0;
  /* The cap height sits 0.27em below the line box's top but the baseline only
     0.12em above its bottom; the difference evens out the space above the
     headline (to the header) and below it (to the preview). */
  margin-bottom: 0.15em;
  max-width: 14ch;
  /* The hero's words always fit (inköpslistor is 4.9em wide), so they wrap
     whole instead of being hyphenated. */
  hyphens: manual;
}
.showcase {
  display: grid;
  gap: var(--space-12);
  padding-top: var(--space-12);
}
@media (min-width: 760px) {
  .showcase {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}
.preview {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-4) 0 var(--space-2);
  max-width: 360px;
  width: 100%;
}
.preview-title {
  font-weight: 700;
  font-size: 22px;
  padding: 0 var(--space-4) var(--space-3);
}
.preview ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.preview li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: 0 var(--space-4);
  border-top: 1px solid var(--border);
  margin: 0;
}
.preview li span {
  flex: 1;
}
.preview .done span {
  color: var(--muted);
  text-decoration: line-through;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
/* Same checkbox as the app (src/components/checkbox.tsx): 24px square,
   6px radius, 1.5px border, and a 12 x 7 L rotated into a centred tick. */
.box {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  flex: none;
  position: relative;
}
.done .box {
  background: var(--accent);
  border-color: var(--accent);
}
.done .box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 7px;
  border: solid var(--on-accent);
  border-width: 0 0 2px 2px;
  transform: translate(-50%, -50%) translateY(-1px) rotate(-45deg);
}
.benefits {
  display: grid;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: none;
}
.benefits li {
  margin: 0;
}
.benefits strong {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.stores {
  color: var(--muted);
}

/* Join page: the code, large. */
.code {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: var(--space-4) 0 var(--space-6);
  user-select: all;
}

/* Tables in the legal pages scroll sideways on phones. */
.table {
  overflow-x: auto;
  margin: 0 0 var(--space-6);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 15px;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-3) var(--space-3) 0;
  border-top: 1px solid var(--border);
}
th {
  font-weight: 600;
}
/* Phones: each row becomes a block, each cell labelled with its column. */
@media (max-width: 599px) {
  table {
    min-width: 0;
  }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  tr {
    display: block;
    border-top: 1px solid var(--border);
    padding: var(--space-4) 0;
  }
  td {
    display: block;
    border: 0;
    padding: 0;
  }
  td + td {
    margin-top: var(--space-3);
  }
  td:first-child {
    font-weight: 600;
    font-size: 17px;
  }
  td + td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 13px;
  }
}
.updated {
  color: var(--muted);
  font-size: 15px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0 var(--space-12);
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--space-4);
  margin-bottom: var(--space-6);
}
/* Phones: one link per row, close together. 32px rows still clear the
   24px minimum target size (WCAG 2.2 AA). */
@media (max-width: 559px) {
  .site-footer nav {
    flex-direction: column;
    align-items: center;
  }
  .site-footer nav a {
    min-height: 32px;
  }
}
.site-footer address {
  font-style: normal;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.site-footer address span:first-child {
  color: var(--text);
  font-weight: 600;
}
.site-footer a {
  color: var(--text);
  text-decoration: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.site-footer a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: no-preference) {
  a {
    transition: color 0.15s ease-out;
  }
}
