@font-face {
  font-family: "Lexend";
  src: url("/assets/lexend-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The three colours. The script picks a scheme at random, and the colour button swaps them. */
  --main: #D63F27;
  --paper: #F4F1EA;
  --ink: #111111;

  --frame: 1rem;    /* thin frame on the top, left and right */
  --foot: 3.5rem;   /* deeper bottom edge that holds the footer */
  --vh: 100vh;

  --p: 0;           /* scroll progress, 0 to 1. Set by the script. */

  /* Logo size: big on the first screen, small once it has moved to the top left. */
  --fs: clamp(2.75rem, min(13vw, 20vh), 8.5rem);
  --fs-end: 1.5rem;
  --logo-h: calc(var(--fs) * 1.9);
  --logo-top: calc(var(--vh) - var(--foot) - 6.25rem - var(--logo-h));
}
@supports (height: 100svh) {
  :root {
    --vh: 100svh;
    --fs: clamp(2.75rem, min(13vw, 20svh), 8.5rem);
  }
}

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

html { background: var(--paper); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--main);
  font-family: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.125rem;
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 0.1em; }
a:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }

/* ---------- Screens ---------- */

.screen {
  position: relative;
  min-height: var(--vh);
  background: var(--bg);
  color: var(--fg);
  clip-path: inset(0);   /* clips this screen's pinned copy of the frame, logo, links and footer */
}
.hero     { --bg: var(--main);   --fg: var(--paper); --edge: var(--paper); --foot-fg: var(--main); }
.products { --bg: var(--paper); --fg: var(--main);   --edge: var(--main);   --foot-fg: var(--paper); }
.contact  { --bg: var(--main);   --fg: var(--paper); --edge: var(--paper); --foot-fg: var(--main); }

/* ---------- Pinned pieces (one copy per screen) ---------- */

.frame {
  position: fixed;
  inset: 0;
  z-index: 2;
  border: var(--frame) solid var(--edge);
  border-bottom-width: var(--foot);
  pointer-events: none;
}

/* A plain band behind the small logo and links, so the product list slides under it. */
.head-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  height: calc(var(--frame) + var(--fs-end) * 1.9 + 2rem);
  background: var(--bg);
}

.logo {
  position: fixed;
  z-index: 3;
  margin: 0;
  top: calc(var(--logo-top) * (1 - var(--p)) + (var(--frame) + 1rem) * var(--p));
  left: calc(50% * (1 - var(--p)) + (var(--frame) + 1.5rem) * var(--p));
  transform: translateX(calc(-50% * (1 - var(--p))));
  font-size: calc(var(--fs) * (1 - var(--p)) + var(--fs-end) * var(--p));
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.045em;
  text-align: center;
  white-space: nowrap;
}
.logo a:hover { text-decoration: none; }

.top-links {
  position: fixed;
  z-index: 3;
  top: calc((var(--frame) + 2rem) * (1 - var(--p)) + (var(--frame) + 1.6rem) * var(--p));
  /* Ends up sitting just to the right of the small logo. */
  left: calc(50% * (1 - var(--p)) + (var(--frame) + 3.5rem + var(--fs-end) * 4.6) * var(--p));
  transform: translateX(calc(-50% * (1 - var(--p))));
  display: flex;
  gap: calc(2.5rem * (1 - var(--p)) + 1.25rem * var(--p));
  font-size: calc(1.375rem * (1 - var(--p)) + 1.125rem * var(--p));
  font-weight: 700;
  white-space: nowrap;
}

/* The colour button at the top right. Each click moves to the next colour scheme. */
.theme-switch {
  display: none;
  position: fixed;
  z-index: 3;
  top: calc(var(--frame) + 0.75rem);
  right: calc(var(--frame) + 1rem);
}
.js .theme-switch { display: block; }
.theme-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.theme-switch button:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.theme-switch svg { width: 1.9rem; height: 1.9rem; }

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: var(--foot);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(var(--frame) + 1rem);
  color: var(--foot-fg);
  font-size: 1.1875rem;
  font-weight: 700;
}
.foot-links { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 2.5rem; }
.foot-links a { white-space: nowrap; }
.foot-place {
  grid-column: 3;
  justify-self: end;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}


/* A button that looks like the footer links. */
.link-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 0.1em; }
.link-button:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }

/* ---------- Cookie choice ---------- */

/* A small card at the bottom right, just above the footer. One copy serves every screen:
   its outline only shows where the ground behind it is the same colour as the card. */
.cookie-card {
  --card-h: 9.5rem;
  position: fixed;
  z-index: 5;
  right: calc(var(--frame) + 1rem);
  bottom: calc(var(--foot) + 1rem);
  width: 18rem;
  max-width: calc(100vw - 2 * var(--frame) - 2rem);
  padding: 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--main);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cookie-card[hidden] { display: none; }
.cookie-card p { margin: 0; }
.cookie-card a { font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }
.cookie-buttons { display: flex; gap: 0.5rem; }
.cookie-buttons button {
  padding: 0.35rem 0.9rem;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cookie-buttons button:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.cookie-current { font-size: 1rem; }
.cookie-current[hidden] { display: none; }

/* On smaller screens the logo and arrow move up, so the card never covers them. */
@media (max-width: 75rem) {
  .cookie-open {
    --logo-top: calc(var(--vh) - var(--foot) - 6.25rem - var(--logo-h) - 10rem);
  }
  .cookie-open .scroll-hint { margin-bottom: 10rem; }
}

/* ---------- First screen ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1.5rem calc(var(--foot) + 1.25rem);
}
.scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
}
.scroll-hint svg { width: 2.75rem; height: 2.75rem; }

/* ---------- Products screen ---------- */

.products {
  padding: 7.5rem 2.5rem calc(var(--foot) + 4rem);
}
/* The heading and the products share one grid, centred in the window, so the space on the
   left and right is always equal and the heading lines up with the first phone. */
.products-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 14rem));
  justify-content: center;
  align-items: start;
  gap: 3.5rem clamp(1.25rem, 6vw, 6rem);
}
.products h2 { grid-column: 1 / -1; margin: 0 0 -1.5rem; font-size: 1.375rem; font-weight: 700; }
.product-grid { display: contents; list-style: none; margin: 0; padding: 0; }

/* Every product is one column: the phone, with its words directly underneath and no wider than the phone. */
.product {
  --phone-w: 14rem;   /* width of the phone, and of the words under it */
  --u: 1.2rem;        /* scales the phone's corners and edges */
  width: min(100%, var(--phone-w));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.product-text { display: flex; flex-direction: column; gap: 0.5rem; }
.product-name {
  margin: 0;
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.product-line { margin: 0; color: var(--ink); font-size: 1.125rem; }
.product-status {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.product-link { font-size: 1.25rem; font-weight: 700; white-space: nowrap; }
.link-short { display: none; }   /* shown on narrow screens, where the full address will not fit */

/* Not used at the moment: every product has the same weight.
   Adding the class "product--big" gives a product a bigger phone that runs down two rows. */
.product--big {
  --phone-w: 20rem;
  --u: 1.75rem;
  grid-row: span 2;
}
.product--big .product-name { font-size: 2.75rem; line-height: 1; letter-spacing: -0.045em; }
.product--big .product-line { font-size: 1.375rem; }
.product--big .product-text { gap: 0.9rem; }

/* The phone: a flat line drawing made from two thin outlines and a short line. */
.phone {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 18.5;
  padding: calc(var(--u) * 1.4) calc(var(--u) * 0.55) calc(var(--u) * 0.9);
  border: 2px solid currentColor;
  border-radius: calc(var(--u) * 1.6);
}
.phone::before {
  content: "";
  position: absolute;
  top: calc(var(--u) * 0.65);
  left: 50%;
  width: 22%;
  border-top: 2px solid currentColor;
  transform: translateX(-50%);
}
.phone-screen {
  height: 100%;
  border: 1.5px solid currentColor;
  border-radius: calc(var(--u) * 0.6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.phone-screen { position: relative; }
.phone-screen img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.phone-soon { padding: 0.5rem; font-size: 1.1875rem; font-weight: 700; line-height: 1.2; }

/* ---------- Contact screen (also "about us") ---------- */

.contact {
  display: flex;
  align-items: center;
  padding: 7.5rem 2.5rem calc(var(--foot) + 4rem);
}
.contact-inner {
  width: min(100%, 46rem);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.contact h2 { margin: 0; font-size: 1.375rem; font-weight: 700; }
.contact h2:not(:first-child) { margin-top: 2.5rem; }
.about-text {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.contact-email {
  align-self: flex-start;
  font-weight: 900;
  font-size: clamp(1.125rem, 5.4vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 62rem) {
  :root { --foot: 5.5rem; }
  .site-footer {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    row-gap: 0.35rem;
  }
  .foot-links, .foot-place { grid-column: 1; justify-self: center; }
  .foot-links { gap: 0 1.75rem; }
}
@media (max-width: 62rem) {
  .products-inner { grid-template-columns: repeat(2, minmax(0, 14rem)); }
  /* Two columns, always. A big product is the same size as the others here. */
  .product, .product--big { --phone-w: 14rem; --u: 1.2rem; grid-row: auto; }
  .product--big .product-name { font-size: 1.75rem; line-height: 1.05; letter-spacing: -0.035em; }
  .product--big .product-line { font-size: 1.125rem; }
  .product--big .product-text { gap: 0.5rem; }
}
@media (max-width: 40rem) {
  .products, .contact { padding-left: 2rem; padding-right: 2rem; }
  .products-inner { gap: 2.5rem 1.25rem; }
  .products h2 { margin-bottom: -0.5rem; }
  .product, .product--big { --u: 0.9rem; }
  .product-name, .product--big .product-name { font-size: 1.375rem; }
  .product-link { font-size: 1.125rem; }
  .link-long { display: none; }
  .link-short { display: inline; }
  .product-status { font-size: 1rem; letter-spacing: 0.04em; }
}
@media (max-width: 40rem) {
  :root { --fs-end: 1.25rem; }
  .theme-switch { right: calc(var(--frame) + 0.25rem); }
  .theme-switch button { width: 2.5rem; height: 2.5rem; }
  .top-links {
    left: calc(50% * (1 - var(--p)) + (var(--frame) + 2.75rem + var(--fs-end) * 4.6) * var(--p));
    gap: calc(2.5rem * (1 - var(--p)) + 0.9rem * var(--p));
    font-size: calc(1.375rem * (1 - var(--p)) + 1.0625rem * var(--p));
  }
  .site-footer { padding: 0 0.5rem; }
  .cookie-card { left: calc(var(--frame) + 1rem); width: auto; }
  .foot-links { gap: 0 clamp(0.6rem, 3.5vw, 1.25rem); }
}

/* Very narrow phones: slightly smaller header so the links clear the colour button. */
@media (max-width: 23.5rem) {
  :root { --fs-end: 1.125rem; }
  .foot-links { font-size: 1.0625rem; }
  .top-links {
    gap: calc(2.5rem * (1 - var(--p)) + 0.7rem * var(--p));
    font-size: calc(1.375rem * (1 - var(--p)) + 1rem * var(--p));
  }
}

/* Short screens, such as a phone on its side: a smaller logo so it clears the links. */
@media (max-height: 30rem) {
  :root { --fs: clamp(2rem, min(13vw, 15vh), 8.5rem); }
}
@supports (height: 100svh) {
  @media (max-height: 30rem) {
    :root { --fs: clamp(2rem, min(13vw, 15svh), 8.5rem); }
  }
}

/* ---------- Reading page (privacy policy) ---------- */

.page { --bg: var(--paper); --fg: var(--main); --edge: var(--main); --foot-fg: var(--paper); }
.page { padding: 7.5rem 2rem calc(var(--foot) + 4rem); }
/* No big first screen here, so the logo and links sit small at the top left from the start. */
.page { --p: 1; }
.prose { max-width: 44rem; margin: 0 auto; color: var(--ink); font-size: 1.125rem; font-weight: 400; line-height: 1.6; }
.prose h1 { margin: 0 0 1.5rem; color: var(--main); font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 900; line-height: 1; letter-spacing: -0.045em; }
.prose h2 { margin: 3rem 0 0.75rem; color: var(--main); font-size: 1.75rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.prose p { margin: 0 0 1rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose strong { font-weight: 700; }
.prose a { font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.table-scroll { margin: 0 0 1rem; overflow-x: auto; }
.table-scroll:focus-visible { outline: 3px solid var(--main); outline-offset: 2px; }
.prose table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 1rem; line-height: 1.4; }
.prose th, .prose td { padding: 0.6rem 0.75rem; border: 1.5px solid var(--ink); text-align: left; vertical-align: top; }
.prose th { font-weight: 700; }
