/* Strof landing page.
   One screen. Words on the left, the lock on the right: a ring of file names
   around a padlock that turns a quarter to open. The page is the vault:
   locked, every line on it is noise.

   Colours and typefaces are the app's own. The fonts are bundled in fonts/
   so the page makes no third-party requests. */

@font-face {
  font-family: "Martian Mono";
  src: url("fonts/MartianMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Martian Mono";
  src: url("fonts/MartianMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}

/* Medium at 87.5% width, for the headline. */
@font-face {
  font-family: "Martian Mono";
  src: url("fonts/MartianMono-SemiCondensedMedium.ttf") format("truetype");
  font-weight: 500;
  font-stretch: 87.5%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Tight";
  src: url("fonts/InterTight-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --void: #0a0c0b;
  --panel: #121614;
  --line: #252d29;
  --line2: #333d38;
  --text: #e7ede9;
  --muted: #8d9892;
  --cipher: #56635c;
  --lime: #c6f03c;
  --limet: #c6f03c; /* lime as text; deep olive on light surfaces */
  --lime-line: rgba(198, 240, 60, 0.5);
  --lime-glow: rgba(198, 240, 60, 0.45);

  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --void: #f2f4f1;
    --panel: #ffffff;
    --line: #d9ded8;
    --line2: #c3cbc3;
    --text: #0e120f;
    --muted: #58625c;
    --cipher: #9aa59e;
    --limet: #4a6300;
    --lime-line: rgba(90, 125, 0, 0.55);
    --lime-glow: rgba(150, 200, 0, 0.4);
  }
}

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

html,
body {
  height: 100%;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--lime);
  color: #0a0c0b;
}

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

/* ---------------------------------------------------------------- wall */

.wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  margin: 0;
  overflow: hidden;
  color: var(--cipher);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 22px;
  white-space: pre;
  opacity: 0.12;
  transition: opacity 1s;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

body.locked .wall {
  opacity: 0.6;
}

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

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  max-width: 1440px;
  min-height: 100%;
  margin-inline: auto;
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
}

@media (min-width: 760px) {
  .page {
    padding-right: max(48px, env(safe-area-inset-right, 0px));
    padding-left: max(48px, env(safe-area-inset-left, 0px));
  }
}

.bar {
  padding-block: 26px;
}

.word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 4px;
}

.cur {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--lime);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  padding-block: 2vh 4vh;
}

/* ---------------------------------------------------------------- copy */

.copy {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3.4vh, 36px);
  min-width: 0;
}

.h1 {
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-stretch: 87.5%;
  font-size: clamp(40px, 5.3vw, 94px);
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.h1 .a {
  display: block;
  color: var(--muted);
}

.h1 .b {
  display: block;
  color: var(--text);
}

.h1 em {
  color: var(--limet);
  font-style: normal;
}

.say {
  max-width: 36ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
}

/* main.js holds the paragraph at the size of its plain text: an invisible
   copy keeps the space and the live, encryptable text is laid over it. */
.say.holds {
  position: relative;
  overflow: hidden;
}

.say .ghost {
  visibility: hidden;
}

.say.holds .s {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.plat {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.plat a {
  border-bottom: 1px solid var(--lime-line);
  color: inherit;
  text-decoration: none;
}

.plat a:hover {
  border-bottom-color: var(--limet);
}

.plat a:focus-visible {
  outline: 2px solid var(--limet);
  outline-offset: 3px;
}

.h1 .a,
.h1 .b,
.h1 em,
.say,
.plat {
  transition: color 0.7s;
}

body.locked .h1 .a,
body.locked .h1 .b,
body.locked .h1 em,
body.locked .say,
body.locked .plat {
  color: var(--cipher);
}

/* ---------------------------------------------------------------- lock */

.lock {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-self: end;
  width: min(46vw, 74vh);
  max-width: 100%;
}

/* The wall stops short of the lock. Without this the locked page's noise
   runs straight through the ring and the hint, in the same grey, and the one
   control that opens the page is the hardest thing on it to read. */
.lock::before {
  content: "";
  position: absolute;
  inset: -7%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--void) 78%, transparent);
  pointer-events: none;
}

.dial {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.dial:active {
  cursor: grabbing;
}

.dial:focus-visible {
  outline: 2px solid var(--limet);
  outline-offset: 4px;
}

.dial svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#rot {
  transform-box: view-box;
  transform-origin: 240px 240px;
  transition: transform 1.15s cubic-bezier(0.7, 0, 0.2, 1);
}

.fr {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}

.tick {
  stroke: var(--line2);
  stroke-width: 2;
}

.lbl {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  transition: fill 0.6s;
}

body:not(.locked) .lbl-u,
body.locked .lbl-l {
  fill: var(--limet);
}

.ptr {
  stroke: var(--limet);
  stroke-width: 3;
}

.rt {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 15px;
  white-space: pre;
  transition: fill 0.7s;
}

body.locked .rt {
  fill: var(--cipher);
}

.ring1 {
  fill: none;
  stroke: var(--line2);
  stroke-width: 12;
  stroke-dasharray: 12 6.4 24 6.4 8 6.4 18 6.4 6 6.4;
}

.ring2 {
  fill: none;
  stroke: var(--cipher);
  stroke-width: 12;
  stroke-dasharray: 6 52 12 76 8 44;
  stroke-dashoffset: 16;
}

.core {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 2;
}

/* The padlock. Open, its shackle is lifted and swung aside. */
.pl-shackle,
.pl-groove {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  transform: translateY(-18px) rotate(-8deg);
  transform-box: view-box;
  transform-origin: 214px 252px;
  transition:
    transform 0.6s cubic-bezier(0.34, 1.35, 0.64, 1),
    stroke 0.4s,
    stroke-opacity 0.4s;
}

.pl-shackle {
  stroke: var(--limet);
  stroke-width: 13;
}

.pl-groove {
  stroke: #0a0c0b;
  stroke-opacity: 0.22;
  stroke-width: 3;
}

.pl-body {
  fill: var(--lime);
  stroke: var(--limet);
  stroke-width: 4;
  filter: drop-shadow(0 0 18px var(--lime-glow));
  transition:
    fill 0.4s,
    stroke 0.4s;
}

.pl-plate {
  fill: none;
  stroke: #0a0c0b;
  stroke-opacity: 0.18;
  stroke-width: 1.5;
  transition:
    stroke 0.4s,
    stroke-opacity 0.4s;
}

.pl-shine {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: square;
  stroke-opacity: 0.5;
  stroke-width: 4;
  transition: stroke-opacity 0.4s;
}

.pl-hole {
  fill: #0a0c0b;
  stroke: #0a0c0b;
  stroke-linejoin: miter;
  stroke-width: 2;
  transition:
    fill 0.4s,
    stroke 0.4s;
}

body.locked .pl-shackle,
body.locked .pl-groove {
  transform: none;
}

body.locked .pl-shackle {
  stroke: var(--muted);
}

body.locked .pl-groove {
  stroke: var(--panel);
  stroke-opacity: 1;
}

body.locked .pl-body {
  fill: var(--panel);
  stroke: var(--muted);
  filter: none;
}

body.locked .pl-plate {
  stroke: var(--line2);
  stroke-opacity: 1;
}

body.locked .pl-shine {
  stroke-opacity: 0.08;
}

body.locked .pl-hole {
  fill: var(--void);
  stroke: var(--muted);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-block: 2vh 3vh;
  }

  .lock {
    justify-self: center;
    width: min(86vw, 440px);
  }
}

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

  #rot,
  .wall,
  .pl-shackle,
  .pl-groove {
    transition: none;
  }
}
