/*
 * Blue linen with a fern border, ivory tiles.
 */
:root {
  --linen: #cfe1ef;
  --porcelain: #faf8f1;
  --ink: #17251f;
  --muted: #4d5c55;
  --jade: #1f6554;
  --jade-pressed: #164a3e;
  --brass: #b68b49;
  --cloth: #f5f0e8;
  --summary: #e8f0f6;
  --summary-edge: #c3d6e6;
  --sheet-shadow: 0 22px 48px -28px rgb(31 64 92 / 0.55), 0 2px 6px -2px rgb(31 64 92 / 0.18);
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --linen: #15243a;
    --porcelain: #1d3049;
    --ink: #f1ece1;
    --muted: #b7c3d1;
    --jade: #8fd0b4;
    --jade-pressed: #b5e2ce;
    --brass: #cfa460;
    --cloth: #1f2e44;
    --summary: #253a56;
    --summary-edge: #34506f;
    --sheet-shadow: 0 22px 48px -24px rgb(0 0 0 / 0.7);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--linen) url("assets/linen.jpg") 0 0 / 256px;
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}

@media (prefers-color-scheme: dark) {
  body { background-image: none; }
}

main { flex: 1; }

a { color: var(--jade); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; border-radius: 4px; }

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

/* The mat's fern border, top and bottom of every page. */
.toile {
  height: 57px;
  background: url("assets/toile-top.jpg") 0 0 / auto 100% repeat-x;
}
.toile-bottom { background-image: url("assets/toile-bottom.jpg"); }

@media (prefers-color-scheme: dark) {
  /* The same fern print, recoloured as pale blue on night blue. */
  .toile { background-image: url("assets/toile-top-dark.jpg"); }
  .toile-bottom { background-image: url("assets/toile-bottom-dark.jpg"); }
}

/* Header */
.site-header {
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 18px 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 1.05rem/1.2 var(--serif);
  color: var(--ink);
  text-decoration: none;
}
.brand img { border-radius: 8px; box-shadow: 0 2px 4px rgb(31 64 92 / 0.25); }

.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-header nav a { color: var(--ink); text-decoration: none; padding: 4px 0; }
.site-header nav a:hover { color: var(--jade); }
.site-header nav a[aria-current="page"] {
  color: var(--jade);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brass);
}

/* Home: the title spelled in tiles, as on the app's home screen. */
.hero {
  position: relative;
  max-width: 62rem;
  margin: 0 auto;
  padding: clamp(36px, 8vw, 88px) 16px clamp(40px, 7vw, 72px);
  text-align: center;
}

.hero h1 { margin: 0; }

.tile-title {
  --gap: clamp(3px, 0.9vw, 8px);
  --t: clamp(30px, calc((100vw - 32px - 7 * var(--gap)) / 8), 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--gap) * 1.6);
}

.tile-row {
  display: flex;
  gap: var(--gap);
  perspective: 900px;
}

.tile {
  position: relative;
  width: var(--t);
  aspect-ratio: 119 / 168;
  transform-style: preserve-3d;
  animation: turn-up 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) backwards;
  animation-delay: calc(var(--i) * 70ms + 250ms);
}

.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  filter: drop-shadow(0 6px 6px rgb(28 58 86 / 0.28));
}
.tile .back {
  transform: rotateY(180deg);
  opacity: 0;
  animation: inherit;
  animation-name: back-shown;
}

/* Each tile starts face down and turns over, as the app's splash screen does. The
   back is also hidden by opacity once the tile passes edge-on, so the title reads
   face up even where backface-visibility is ignored. */
@keyframes turn-up {
  from { transform: rotateY(180deg); }
  to { transform: rotateY(0); }
}
@keyframes back-shown {
  0%, 49% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.with-friends {
  display: block;
  margin-top: 0.5em;
  font: 600 clamp(1.45rem, 4.2vw, 2.1rem)/1.2 var(--serif);
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hero .lede {
  max-width: 33rem;
  margin: 1.4rem auto 1.8rem;
  font-size: 1.1rem;
}

.button {
  display: inline-block;
  background: var(--jade);
  color: var(--porcelain);
  border-radius: 14px;
  padding: 13px 26px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 6px 14px -6px rgb(22 74 62 / 0.6);
}
.button:hover { background: var(--jade-pressed); }

@media (prefers-color-scheme: dark) {
  .button { color: #10261f; box-shadow: none; }
}

/* Loose tiles on the table, wide screens only. */
.scatter {
  position: absolute;
  width: 74px;
  height: auto;
  filter: drop-shadow(0 8px 8px rgb(28 58 86 / 0.25));
  display: none;
}
@media (min-width: 960px) {
  .scatter { display: block; }
  .scatter-1 { left: 2%; top: 22%; rotate: -9deg; }
  .scatter-2 { right: 3%; top: 14%; rotate: 7deg; }
  .scatter-3 { right: 8%; bottom: 8%; rotate: -4deg; }
}

/* Home: links to the documents, on a porcelain strip. */
.doc-links {
  list-style: none;
  max-width: 54rem;
  width: calc(100% - 32px);
  margin: 0 auto clamp(40px, 7vw, 72px);
  padding: 0;
  display: grid;
  background: var(--porcelain);
  border-radius: 14px;
  box-shadow: var(--sheet-shadow);
  overflow: hidden;
}
.doc-links li + li { border-top: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); }
@media (min-width: 720px) {
  .doc-links { grid-template-columns: repeat(3, 1fr); }
  .doc-links li + li { border-top: 0; border-left: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); }
}
.doc-links a {
  display: block;
  height: 100%;
  padding: 22px 24px 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.5;
}
.doc-links strong {
  display: block;
  margin-bottom: 4px;
  font: 700 1.2rem/1.3 var(--serif);
  color: var(--jade);
}
.doc-links a:hover strong { text-decoration: underline; text-underline-offset: 0.18em; }

/* Documents: a porcelain sheet laid on the mat. */
.sheet {
  width: calc(100% - 32px);
  max-width: 46rem;
  margin: clamp(20px, 5vw, 44px) auto clamp(40px, 7vw, 64px);
  padding: clamp(28px, 6vw, 56px) clamp(22px, 6vw, 60px) clamp(32px, 6vw, 56px);
  background: var(--porcelain);
  border-radius: 14px;
  box-shadow: var(--sheet-shadow);
  outline: 1px solid color-mix(in srgb, var(--brass) 55%, transparent);
  outline-offset: -10px;
}

.sheet h1 {
  font: 700 clamp(2rem, 6vw, 2.6rem)/1.15 var(--serif);
  margin: 0 0 0.4rem;
}
.sheet h2 {
  font: 600 1.4rem/1.25 var(--serif);
  margin: 2.4rem 0 0.6rem;
}
.sheet h3 {
  font: 700 1.1rem/1.35 var(--serif);
  margin: 1.8rem 0 0.35rem;
}
.sheet h2 + h3 { margin-top: 1rem; }
.sheet p { margin: 0 0 1rem; }

.updated { color: var(--muted); margin-top: 0; }

.sheet ul { padding-left: 1.3rem; margin: 0 0 1rem; }
.sheet li + li { margin-top: 0.45rem; }
.sheet li::marker { color: var(--brass); }

.summary {
  background: var(--summary);
  border: 1px solid var(--summary-edge);
  border-radius: 10px;
  padding: 4px 24px 8px;
  margin: 1.6rem 0;
}
.sheet .summary h2 { margin-top: 1.1rem; }

/* Footer: on the cloth of the fern border. */
.site-footer {
  background: var(--cloth);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: 6px 16px 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--jade); }
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .tile { animation: none; }
}
