/* Zabarotti. One stylesheet for every public page; the admin inlines its own.
   Black, white and grays only. Two faces ship: Playfair Display for the name
   and headings, Inter for everything else. The coming-soon screen loads no
   face of its own: its handwriting is drawn, not set. */

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/fonts/playfair-display-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #000000;
  /* 6.4:1 on white. */
  --gray: #5c5c5c;
  --line: #e6e6e6;
  /* The footer: black gray, its type light gray (7.4:1), white on hover. */
  --foot: #161616;
  --foot-ink: #a3a3a3;
  --foot-hi: #ffffff;
  --serif: "Playfair Display", "Didot", "Bodoni 72", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
::selection { background: var(--ink); color: var(--paper); }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ------------------------------------------------------------- the name */

/* The home page is one screen: nothing to scroll, at any size. */
html.home, html.home body { height: 100%; overflow: hidden; }
html.home body { min-height: 0; height: 100vh; height: 100dvh; }

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.mark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  /* "Zabarotti" is 4.1em wide: 17vw fills a phone without touching its edges,
     the vh term keeps it small on a phone held sideways, and 9rem is where it stops. */
  font-size: clamp(2.6rem, min(17vw, 24vh), 9rem);
  line-height: 1;
  letter-spacing: .005em;
  text-align: center;
  white-space: nowrap;
}

/* ------------------------------------------------------------- footer */

.foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 12px var(--gutter);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--foot);
  color: var(--foot-ink);
  font-size: .75rem;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.foot__v { font-variant-numeric: tabular-nums; letter-spacing: .06em; text-transform: none; }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 22px; margin-left: auto; }
.foot nav a {
  display: inline-block;
  /* 12px type in a 36px tall hit area. */
  padding: 12px 0;
  text-decoration: none;
  transition: color .2s ease;
}
.foot nav a:hover, .foot nav a[aria-current="page"] { color: var(--foot-hi); }
.foot :focus-visible { outline-color: var(--foot-hi); outline-offset: 3px; }

@media (max-width: 380px) {
  .foot { letter-spacing: .08em; gap: 4px 16px; }
  .foot nav { gap: 0 14px; }
}

/* ------------------------------------------------------------- legal pages */

.top {
  padding: 22px var(--gutter) 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.top a {
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
}

.doc {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(40px, 9vw, 96px) var(--gutter) clamp(56px, 10vw, 112px);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  overflow-wrap: break-word;
}
.doc h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.3rem, 7vw, 3.5rem);
  line-height: 1.08;
}
.doc .meta {
  margin: 14px 0 0;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray);
}
.doc .lede { margin: 32px 0 0; font-size: 1.06rem; }
.doc h2 {
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  line-height: 1.2;
}
.doc p, .doc ul { margin: 14px 0 0; }
.doc ul { padding-left: 1.1em; }
.doc li + li { margin-top: 6px; }
.doc a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doc code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

/* ------------------------------------------------------------- 404 */

.lost { text-align: center; }
.lost .mark { font-size: clamp(4rem, min(20vw, 28vh), 9rem); font-variant-numeric: lining-nums; }
.lost p {
  margin: 20px 0 0;
  font-size: .75rem;
  line-height: 1.6;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray);
}
.lost p a { color: var(--ink); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* ------------------------------------------------------------- coming soon */

/* The coming-soon screen (assets/js/coming-soon.js). It covers the home page
   until the code is entered. Black on white, a faint dot pattern that clears
   behind the writing, and nothing else. */
html.is-gated, html.is-gated body { overflow: hidden; }

.cs {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(24px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  transition: opacity .6s ease, visibility .6s ease;
}
.cs::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #cfcfcf 1.05px, transparent 1.45px);
  background-size: 22px 22px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 50%, transparent 38%, #000 100%);
  mask-image: radial-gradient(ellipse 72% 62% at 50% 50%, transparent 38%, #000 100%);
}
.cs.is-open { opacity: 0; visibility: hidden; }

.cs__inner {
  position: relative;
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cs__art {
  position: relative;
  /* 4.09:1. The last term keeps it, and the field under it, inside a phone
     held sideways. */
  width: min(86vw, 680px, calc((100vh - 170px) * 4.09));
  width: min(86vw, 680px, calc((100dvh - 170px) * 4.09));
  min-width: 220px;
}
.cs__svg { display: block; width: 100%; height: auto; overflow: visible; fill: currentColor; }
/* The pen writes on a canvas laid exactly over the finished outline, which
   shows again, sharp, the moment the canvas is taken away. */
.cs__pen { position: absolute; inset: 0; width: 100%; height: 100%; }
.cs.is-writing .cs__svg { visibility: hidden; }

/* The field arrives on the form, so the shake on the field never replays it. */
.cs__form { margin: clamp(28px, 7vh, 56px) 0 0; animation: cs-in .9s cubic-bezier(.2, .7, .2, 1) .35s both; }

/* The field says what it is doing. At rest a light rule under "Enter code";
   under the pointer the rule darkens; chosen, a black rule grows out from the
   middle, the words step aside and the caret blinks where the digits will go;
   right, the rule holds black as the screen lifts. */
.cs__field {
  position: relative;
  display: block;
  width: min(240px, 72vw);
  cursor: text;
}
.cs__field::before,
.cs__field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}
.cs__field::before { height: 1px; background: #bdbdbd; transition: background-color .25s ease; }
.cs__field::after {
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.cs__field:hover::before { background: #6f6f6f; }
.cs__field:focus-within::after,
.cs.is-right .cs__field::after { transform: scaleX(1); }

.cs__input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  /* Letter spacing pads the right of the last digit too; the same on the
     left keeps the digits on the true centre. */
  padding: 0 0 0 .4em;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  /* 16px or more, so a phone does not zoom the page on focus. */
  font: 1.25rem/1 var(--sans);
  letter-spacing: .4em;
  text-align: center;
  caret-color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.cs__input::placeholder {
  color: #7a7a7a;
  font-size: 1rem;
  letter-spacing: .14em;
  opacity: 1;
  transition: opacity .2s ease, color .2s ease;
}
.cs__input:focus { outline: none; }
.cs__input:focus::placeholder { opacity: 0; }
.cs.is-wrong .cs__input { animation: cs-shake .42s ease; }
.cs.is-wrong .cs__field::before { background: var(--ink); }
@keyframes cs-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cs-shake {
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
