/* Paperkiss website. One stylesheet for the landing page and the documents. */

@font-face {
  font-family: "Besley";
  src: url("/fonts/besley.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Besley";
  src: url("/fonts/besley-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bench: #170e08;      /* the walnut bench everything sits on */
  --cotton: #f4f0e7;     /* cotton paper */
  --soot: #2a2623;       /* type on paper */
  --soot-soft: #5d554e;  /* secondary type on paper */
  --oxblood: #84242a;    /* the first ink */
  --brass: #d3b170;      /* type on the bench */
  --brass-dim: #a88d5b;
  --lid: #571b20;        /* the cloth lid of the kit */

  --serif: "Besley", "Rockwell", "Iowan Old Style", Georgia, serif;
  --ink: var(--oxblood);
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--serif);
  color: var(--brass);
  background-color: var(--bench);
  background-image:
    radial-gradient(ellipse at 50% 42%, rgb(0 0 0 / 0) 30%, rgb(0 0 0 / 0.55) 100%),
    url("/img/wood.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Landing page ---------- */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 3.5svh, 2.5rem);
  padding: clamp(1.5rem, 5svh, 3.5rem) 0.5rem 1rem;
}

/* The open kit: paper on the left, the plate on the right, hinged between. */
.kit {
  --half: 920 / 1288;
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 54rem, (100svh - 13rem) * 1.4286);
  aspect-ratio: 1840 / 1288;
  perspective: 2400px;
  -webkit-tap-highlight-color: transparent;
}

.kit:focus-visible {
  outline-offset: 6px;
  border-radius: 10px;
}

.half {
  position: relative;
  display: block;
}

.half img,
.impression,
.shade,
.face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.half img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Each piece carries its own shadow so it travels with the fold. */
.paper > img,
.face {
  filter: drop-shadow(0 0.9rem 1.1rem rgb(0 0 0 / 0.5));
}

/* Ink on the sheet. The mask carries the impression; the colour is the ink. */
.impression {
  background-color: var(--ink);
  -webkit-mask: url("/img/forme-print.png") center / 100% 100% no-repeat;
  mask: url("/img/forme-print.png") center / 100% 100% no-repeat;
  mix-blend-mode: multiply;
  opacity: 0;
}

.kit.is-printed .impression {
  opacity: 0.94;
}

/* The lid's shadow falling across the sheet as the kit closes. */
.shade {
  background: #000;
  opacity: 0;
  -webkit-mask: url("/img/paper.webp") center / 100% 100% no-repeat;
  mask: url("/img/paper.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}

.bed {
  z-index: 1;
  transform-origin: left center;
  transform-style: preserve-3d;
}

.face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* The outside of the kit, seen only while it is shut. */
.face.back {
  transform: rotateY(180deg);
}

.face.back::before {
  content: "";
  position: absolute;
  inset: 2.2% 2.4%;
  border-radius: 3.5% / 2.5%;
  background:
    linear-gradient(100deg, rgb(255 255 255 / 0.07), rgb(0 0 0 / 0.16)),
    var(--lid);
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.35),
    inset 0 0 0 0.55rem var(--lid),
    inset 0 0 0 calc(0.55rem + 1px) rgb(211 177 112 / 0.55);
}

.soon {
  margin: 0;
  font-size: clamp(1.125rem, 0.9rem + 1.1vw, 1.5rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: balance;
}

.site-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  padding: 1rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  font-size: 0.875rem;
  color: var(--brass-dim);
}

.site-links a {
  padding: 0.35rem 0;
  text-decoration: none;
}

.site-links a:hover {
  color: var(--brass);
  text-decoration: underline;
}

/* ---------- Documents: privacy, terms, support ---------- */

.sheet {
  width: min(100% - 2rem, 46rem);
  margin: clamp(1rem, 5vw, 3.5rem) auto 0;
  padding: clamp(1.75rem, 6vw, 4.5rem) clamp(1.375rem, 7vw, 5rem) clamp(2.5rem, 7vw, 5rem);
  color: var(--soot);
  background-color: var(--cotton);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.25),
    0 1.5rem 2.5rem rgb(0 0 0 / 0.45);
  font-size: 1.0625rem;
  line-height: 1.72;
}

.sheet a {
  color: var(--oxblood);
}

.sheet :focus-visible {
  outline-color: var(--oxblood);
}

.letterhead {
  display: inline-block;
  margin-bottom: clamp(2rem, 6vw, 3.5rem);
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.sheet h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sheet .dated {
  margin: 0 0 2.25rem;
  color: var(--soot-soft);
  font-style: italic;
}

.sheet h2 {
  margin: 2.5rem 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

.sheet p,
.sheet ul {
  margin: 0 0 1rem;
  max-width: 66ch;
}

.sheet ul {
  padding-left: 1.2em;
}

.sheet li {
  margin-bottom: 0.4rem;
}

.sheet .lede {
  font-size: 1.1875rem;
  line-height: 1.6;
}

.sheet h1 + .lede {
  margin-top: 1.5rem;
}

.sheet .imprint {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(42 38 35 / 0.2);
  color: var(--soot-soft);
  font-size: 0.9375rem;
  line-height: 1.6;
}

@media (prefers-reduced-motion: no-preference) {
  .site-links a {
    transition: color 120ms ease;
  }
}
