/* ClamVault website. Monochrome, system type, no boxes. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --button: #1d1d1f;
  --button-text: #fbfbfd;
  --rule: rgba(0, 0, 0, 0.08);

  --footer-bg: #f0f0f3;
  --footer-mark: #e6e6ea;
  --footer-lip: rgba(255, 255, 255, 0.95);
  --footer-shade: rgba(0, 0, 0, 0.1);
  --footer-glow: rgba(29, 29, 31, 0.14);
  --footer-glow-2: rgba(29, 29, 31, 0.045);
  --footer-edge: 0 14px 30px -18px rgba(0, 0, 0, 0.18);

  --icon-light: block;
  --icon-dark: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #f5f5f7;
    --muted: #86868b;
    --button: #f5f5f7;
    --button-text: #000000;
    --rule: rgba(255, 255, 255, 0.12);

    --footer-bg: #161617;
    --footer-mark: #0f0f10;
    --footer-lip: rgba(255, 255, 255, 0.08);
    --footer-shade: rgba(0, 0, 0, 0.9);
    --footer-glow: rgba(255, 255, 255, 0.16);
    --footer-glow-2: rgba(255, 255, 255, 0.05);
    --footer-edge: 0 1px 0 rgba(255, 255, 255, 0.06);

    --icon-light: none;
    --icon-dark: block;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 21px;
  line-height: 1.45;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

img { display: block; }

.icon-light { display: var(--icon-light); }
.icon-dark { display: var(--icon-dark); }

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.top-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img { width: 30px; height: 30px; }

.top-link {
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
}

.top-link:hover { opacity: 0.7; }

/* Sections */

main { overflow-x: clip; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

.hero {
  text-align: center;
  padding-top: 120px;
  padding-bottom: 40px;
}

.hero-icon {
  width: 148px;
  height: 148px;
  margin: 0 auto 44px;
}

.hero-icon img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.18));
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

h1 { font-size: clamp(38px, 8.4vw, 104px); }

h2 { font-size: clamp(40px, 6.2vw, 76px); }

h3 {
  font-size: clamp(28px, 3.2vw, 38px);
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.lead {
  max-width: 640px;
  margin: 30px auto 0;
  font-size: clamp(21px, 2.2vw, 26px);
  color: var(--muted);
  letter-spacing: -0.018em;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 44px;
  padding: 17px 32px;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.button:hover { opacity: 0.86; }
.button:active { transform: scale(0.97); }

/* Shown where the download button will go, until ClamVault is out. */
.soon {
  display: inline-flex;
  margin: 44px 0 0;
  padding: 15px 30px;
  border: 2px solid var(--text);
  border-radius: 999px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}


.after-button {
  margin: 18px 0 0;
  font-size: 19px;
  color: var(--muted);
}

/* Tutorial */

.tutorial {
  padding-top: 140px;
  padding-bottom: 40px;
  text-align: center;
}

.tutorial .lead { margin-bottom: 64px; }

.stage-fit {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 980px;
  height: 620px;
  transform-origin: 0 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--f-text);
  user-select: none;
  -webkit-user-select: none;
}

.steps {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 56px auto 0;
  max-width: 360px;
}

.steps button {
  flex: 1;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
}

.steps button::before,
.steps button i {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
}

.steps button i {
  right: auto;
  width: 0;
  background: var(--text);
}

.caption {
  position: relative;
  height: 1.2em;
  margin: 24px auto 0;
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 650;
  letter-spacing: -0.032em;
}

.caption span {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.caption span.on {
  opacity: 1;
  transform: none;
}

/* Statements */

.statement {
  padding-top: 180px;
  text-align: center;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  max-width: 920px;
  margin: 96px auto 0;
  text-align: left;
}

.pair p {
  margin: 18px 0 0;
  color: var(--muted);
}

/* Text on the left, a looping outline drawing on the right. */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 56px;
  max-width: 1120px;
  padding-top: 180px;
}

.split h2 { font-size: clamp(40px, 5.2vw, 66px); }

.split .lead { margin-left: 0; margin-right: 0; }

.closing {
  padding-top: 200px;
  padding-bottom: 160px;
}

.closing .button, .closing .soon { margin-top: 48px; }

/* Both drawings share one scale and one centre line. */
.art {
  display: grid;
  place-items: center;
  margin-right: -48px;
}

.art svg {
  display: block;
  width: 82%;
  color: var(--text);
  overflow: visible;
}

.art svg * { transform-box: fill-box; }

.art .art-key { width: 68.3%; }

/* The key comes straight in from the right and goes into the keyhole up to its bow: what is inside
   the lock is hidden. It twists, and the shackle drops shut; then it all runs backwards. */
.art-key .key { animation: key-in 6.4s cubic-bezier(0.55, 0, 0.3, 1) infinite paused; }
.art-key .key-turn {
  transform-box: view-box;
  transform-origin: 200px 220px;
  animation: key-turn 6.4s cubic-bezier(0.5, 0, 0.3, 1) infinite paused;
}
.art-key .shackle { animation: shackle 6.4s cubic-bezier(0.5, 0, 0.3, 1) infinite paused; }

@keyframes key-in {
  0% { transform: translateX(100px); opacity: 0; }
  8% { transform: translateX(100px); opacity: 1; }
  32%, 78% { transform: translateX(-38px); opacity: 1; }
  92%, 100% { transform: translateX(100px); opacity: 0; }
}

@keyframes key-turn {
  0%, 34% { transform: scaleY(1); }
  42%, 64% { transform: scaleY(0.2); }
  72%, 100% { transform: scaleY(1); }
}

@keyframes shackle {
  0%, 42% { transform: translateY(-34px); }
  48% { transform: translateY(3px); }
  52%, 72% { transform: translateY(0); }
  80%, 100% { transform: translateY(-34px); }
}

/* Pages drop into the folder, its front closes, and a small lock clicks shut on it. */
.art-folder .papers { animation: papers 6.4s cubic-bezier(0.5, 0, 0.3, 1) infinite paused; }
.art-folder .flap { transform-origin: 50% 100%; animation: flap 6.4s cubic-bezier(0.5, 0, 0.3, 1) infinite paused; }
.art-folder .padlock { transform-origin: 50% 50%; animation: padlock 6.4s cubic-bezier(0.34, 1.4, 0.64, 1) infinite paused; }
.art-folder .padlock-shackle { animation: padlock-shackle 6.4s cubic-bezier(0.5, 0, 0.3, 1) infinite paused; }

@keyframes papers {
  0% { transform: translateY(-50px); opacity: 0; }
  10% { transform: translateY(-50px); opacity: 1; }
  30%, 86% { transform: translateY(0); opacity: 1; }
  96%, 100% { transform: translateY(-50px); opacity: 0; }
}

@keyframes flap {
  0%, 30% { transform: scaleY(0.42); }
  40%, 80% { transform: scaleY(1); }
  90%, 100% { transform: scaleY(0.42); }
}

@keyframes padlock {
  0%, 40% { transform: scale(0); }
  48%, 74% { transform: scale(1); }
  80%, 100% { transform: scale(0); }
}

@keyframes padlock-shackle {
  0%, 50% { transform: translateY(-9px); }
  56%, 100% { transform: translateY(0); }
}

.art.in svg * { animation-play-state: running; }

/* Footer: the page ends in rounded corners over a well, the footer's content stays put while the
   page slides off it, and the name is pressed into the well with a soft light over it. */

.footer {
  --r: 36px;
  position: relative;
  overflow: clip;
  container-type: inline-size;
  background: var(--footer-bg);
  color: var(--muted);
}

.footer::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: var(--r);
  border-radius: 0 0 var(--r) var(--r);
  background: var(--bg);
  box-shadow: var(--footer-edge);
  pointer-events: none;
}

.footer-held {
  position: relative;
  padding-top: calc(var(--r) + 56px);
}

@supports (animation-timeline: view()) {
  .footer-held {
    animation: footer-held linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@keyframes footer-held {
  from { transform: translateY(-100%); }
  to { transform: none; }
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 32px;
}

.footer .brand { font-size: 19px; color: var(--text); }

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-left: auto;
  font-size: 17px;
}

.footer nav a {
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer nav a:hover { opacity: 0.6; }

.footer .fine {
  flex-basis: 100%;
  margin: 0;
  font-size: 17px;
}

/* The name, as wide as the footer, its lower part below the window's edge. The light is a second
   layer of the same text, clipped to the letters, so its repaints leave the face alone. */
.footer-mark {
  --fs: 19.4cqw;
  position: relative;
  width: 100%;
  height: calc(var(--fs) * 0.76);
  margin-top: 40px;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.footer-mark span {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  font: 800 var(--fs)/0.9 -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  letter-spacing: -0.055em;
  text-indent: -0.05em;
  white-space: nowrap;
}

.footer-mark .face {
  color: var(--footer-mark);
  text-shadow:
    0 calc(var(--fs) * 0.006) calc(var(--fs) * 0.005) var(--footer-lip),
    0 calc(var(--fs) * -0.005) calc(var(--fs) * 0.007) var(--footer-shade);
}

.footer-mark .glow {
  color: transparent;
  background:
    radial-gradient(circle at var(--lx, 50%) var(--ly, 45%), var(--footer-glow), transparent 22%),
    radial-gradient(circle at var(--lx, 50%) var(--ly, 45%), var(--footer-glow-2), transparent 55%);
  -webkit-background-clip: text;
  background-clip: text;
  will-change: transform;
}

/* On a short page the main part grows, so the footer and its name still end at the window's bottom. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

body > main { flex: 1 0 auto; width: 100%; }

/* Overscrolling past the end continues the footer (footer.js sets .at-footer). */
html.at-footer { background: var(--footer-bg); }

/* Legal pages */

.doc {
  max-width: 740px;
  margin: 0 auto;
  padding: 110px 28px 120px;
}

.doc h1 { font-size: clamp(44px, 6vw, 68px); }

.doc .effective {
  margin: 22px 0 64px;
  color: var(--muted);
}

.doc h2 {
  margin: 64px 0 18px;
  font-size: 30px;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.doc p,
.doc li { color: color-mix(in srgb, var(--text) 82%, var(--bg)); }

.doc p { margin: 0 0 18px; }

.doc ul { margin: 0 0 18px; padding-left: 24px; }

.doc li { margin-bottom: 10px; padding-left: 4px; }

/* Small screens */

@media (max-width: 760px) {
  body { font-size: 19px; }
  .hero { padding-top: 80px; }
  .hero-icon { width: 120px; height: 120px; }
  .tutorial { padding-top: 110px; }
  .tutorial .lead { margin-bottom: 48px; }
  .statement { padding-top: 130px; }
  .pair { grid-template-columns: 1fr; gap: 48px; margin-top: 64px; }
  .split { grid-template-columns: 1fr; gap: 56px; padding-top: 130px; }
  .art { width: 100%; max-width: 300px; justify-self: center; margin-right: 0; }
  .closing { padding-top: 150px; padding-bottom: 120px; }
  .footer { --r: 28px; }
  .footer-held { padding-top: calc(var(--r) + 44px); }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer nav { margin-left: 0; justify-content: center; }
  .footer-mark { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .footer-held { animation: none; }
  .art svg * { animation: none !important; }
}
