/* Homepage styles + hooks for the intro and the feature scripts. */

@font-face {
  font-family: "Fira Code";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/fira-code-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Fira Code";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/fira-code-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f6f3;
  --text: #121826;
  --muted: #5c677b;
  --line: rgba(18, 24, 38, 0.14);
  --accent: #4c6783;
}

body.dark {
  --bg: #0c1220;
  --text: #e6ebf2;
  --muted: #97a3b6;
  --line: rgba(230, 235, 242, 0.14);
  --accent: #9caec4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Fira Code", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

main {
  position: relative;
  max-width: 36rem;
  margin: 0 auto;
  padding: 18vh 24px 64px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.intro {
  margin: 0 0 48px;
  color: var(--muted);
}

dl {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  margin: 0;
  border-top: 1px solid var(--line);
}

dt,
dd {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6rem;
}

a {
  color: var(--text);
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

dd a {
  display: inline-block;
  margin: -12px 0;
  padding: 12px 0;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

footer {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  color: var(--muted);
  font-size: 0.78rem;
}

.theme-toggle {
  margin: -12px -12px -12px 0;
  padding: 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

/* XOR intro: content stays hidden until the name is decrypted. */
.js-intro main > :not(.stage) {
  visibility: hidden;
  opacity: 0;
}

.js-intro.name-in main > h1,
.js-intro.revealed main > :not(.stage) {
  visibility: visible;
  opacity: 1;
  transition: opacity 450ms ease;
}

.js-intro.name-in:not(.revealed) main > h1 { transition: none; }
.js-intro.revealed main > .intro { transition-delay: 80ms; }
.js-intro.revealed main > dl { transition-delay: 160ms; }
.js-intro.revealed main > footer { transition-delay: 240ms; }

.stage {
  position: absolute;
  left: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre;
  font-variant-ligatures: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

.stage.on {
  opacity: 1;
  transition: none;
}

.stage .col {
  color: var(--text);
  background: var(--line);
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--line);
}

.stage .pt { color: var(--text); }
.stage .done { opacity: 0.55; }
.noise { color: var(--muted); }

h1.replayable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Early reveal: contact details fade in while the name is still decrypting. */
.js-intro.content-in main > :not(.stage) {
  visibility: visible;
  opacity: 1;
  transition: opacity 450ms ease;
}

/* Features that draw behind the page put their element in #bg. */
#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

body {
  position: relative;
  z-index: 0;
}
