:root {
  --paper: #f6f6f5;
  --ink: #161615;
  --muted: #8a8a86;
  --line: rgba(22, 22, 21, 0.4);
  --rec: #e5484d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* optical-breadboard dot grid, fading out behind the wordmark */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(22, 22, 21, 0.16) 1px, transparent 1.4px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 62% 52% at 50% 45%, transparent 34%, #000 78%);
  mask-image: radial-gradient(ellipse 62% 52% at 50% 45%, transparent 34%, #000 78%);
  pointer-events: none;
  z-index: 0;
}

/* faint grain so the surface doesn't feel flat */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

header, main, footer { position: relative; z-index: 1; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 2rem;
}

.rec {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rec);
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem 4rem;
}

.wordmark {
  font-size: clamp(2.9rem, 11vw, 7rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.035em;
  user-select: none;
}

/* viewfinder brackets around "ego" — the first-person frame */
.ego {
  position: relative;
  display: inline-block;
  padding: 0.04em 0.09em;
  margin-right: 0.04em;
}

.ego i {
  position: absolute;
  width: 0.16em;
  height: 0.16em;
  border: 0 solid var(--line);
}

.ego i:nth-child(1) { top: 0.16em; left: 0; border-top-width: 2px; border-left-width: 2px; }
.ego i:nth-child(2) { top: 0.16em; right: 0; border-top-width: 2px; border-right-width: 2px; }
.ego i:nth-child(3) { bottom: -0.04em; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.ego i:nth-child(4) { bottom: -0.04em; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* ---- viewfinder ------------------------------------------------------------
   The wordmark behaves like a handheld camera: the subject wanders inside the
   frame, autofocus hunts and re-locks, and the frame itself drifts as a whole.

   Three cycles, each with its own keyframes and its own non-harmonic duration
   (6.1s word / 7.3s frame / 9.7s focus). Nothing divides evenly into anything
   else, so they never realign and the motion does not read as a loop.

   Many irregular stops with ease-in-out between them is what keeps the motion
   smooth rather than jittery — the element is always easing toward the next
   waypoint, never snapping.

   Only transform and filter animate, both compositor-friendly. The brackets are
   positioned off .ego rather than .ego-text, so blurring the letters never
   touches the frame. */

.ego-text {
  display: inline-block;
  animation:
    vf-wander 6.1s ease-in-out infinite,
    vf-focus  9.7s ease-in-out infinite;
  will-change: transform, filter;
}

/* the subject wandering in the frame — em-based, so it scales with the wordmark */
@keyframes vf-wander {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  14%  { transform: translate3d(0.019em, -0.013em, 0) rotate(0.34deg); }
  28%  { transform: translate3d(-0.012em, -0.020em, 0) rotate(-0.24deg); }
  41%  { transform: translate3d(-0.022em, 0.008em, 0) rotate(0.29deg); }
  57%  { transform: translate3d(0.010em, 0.021em, 0) rotate(-0.31deg); }
  69%  { transform: translate3d(0.023em, 0.005em, 0) rotate(0.19deg); }
  84%  { transform: translate3d(-0.009em, 0.015em, 0) rotate(-0.16deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

/* autofocus — sharp, then a soft hunt, an overshoot, a lock. Twice per cycle.
   Deliberately gentle: the peaks only just soften the letters rather than
   washing them out, and the long cycle gives each ramp time to breathe. */
@keyframes vf-focus {
  0%, 21%   { filter: blur(0); }
  27%       { filter: blur(1.3px); }
  32%       { filter: blur(0.3px); }
  37%       { filter: blur(0.75px); }
  43%, 68%  { filter: blur(0); }
  74%       { filter: blur(1.6px); }
  79%       { filter: blur(0.45px); }
  84%       { filter: blur(0.15px); }
  89%, 100% { filter: blur(0); }
}

/* The frame drifts as ONE rigid unit: all four corners share a single animation
   with identical timing, so they stay in lockstep and the bracket rectangle
   never distorts. It is still independent of the word inside it — different
   keyframes, and 7.3s against the word's 6.1s.
   px-based, so the drift stays legible at small wordmark sizes. */
.ego i {
  will-change: transform;
  animation: vf-frame 7.3s ease-in-out infinite;
}

@keyframes vf-frame {
  0%   { transform: translate(0, 0); }
  16%  { transform: translate(1.6px, -1.1px); }
  33%  { transform: translate(-0.9px, -1.8px); }
  49%  { transform: translate(-1.9px, 0.7px); }
  67%  { transform: translate(0.8px, 1.7px); }
  84%  { transform: translate(1.8px, 0.5px); }
  100% { transform: translate(0, 0); }
}

.tagline {
  font-weight: 400;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: #4a4a46;
  margin-top: 2rem;
  max-width: 34ch;
  line-height: 1.5;
}

.credit {
  margin-top: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.6em;
}

.credit a {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: #4a4a46;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.1rem;
  transition: color 200ms ease, border-color 200ms ease;
}

.credit a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.credit a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-color: transparent;
}

.contact {
  margin-top: 4.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.contact a {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  transition: color 200ms ease, border-color 200ms ease;
}

.contact a:hover {
  color: var(--rec);
  border-color: var(--rec);
}

.contact a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-color: transparent;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7em;
  padding: 1.75rem 2rem;
}

/* .mono carries a trailing letter-spacing, so the dot sits slightly right of
   true centre between the names; the flex gap absorbs that evenly enough. */
.footer-dot {
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1;
}

/* transparent border rather than none, so the box does not shift on hover */
.footer-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.1rem;
  transition: color 200ms ease, border-color 200ms ease;
}

.footer-link:hover {
  color: var(--ink);
  border-color: var(--line);
}

.footer-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-color: transparent;
}

/* quiet arrival */
.rise {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.9s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.2s; }
.d3 { animation-delay: 0.45s; }
.d4 { animation-delay: 0.65s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* the footer sits at the viewport's bottom edge — a translate would poke
   past it and flash a scrollbar during the intro, so it fades in place */
footer.rise {
  transform: none;
  animation-name: fade-in;
}

@keyframes fade-in {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; opacity: 1; transform: none; }
  .rec-dot { animation: none; }
  .ego-text { animation: none; filter: none; transform: none; will-change: auto; }
  .ego i { animation: none; transform: none; will-change: auto; }
}

@media (max-width: 480px) {
  header, footer { padding: 1.25rem 1.25rem; }
  .mono { font-size: 0.625rem; letter-spacing: 0.14em; }
}
