:root {
  --matrix-glyph-size: max(14px, 1.25vw);
}

@font-face {
  font-family: "Matrix Code";
  src: url("../../assets/matrix-code.ttf") format("truetype");
  font-display: block;
}

:root {
  color-scheme: dark;
  --page: #090d0b;
  --ink: #fff2de;
  --muted: #baad9d;
  --line: rgba(255, 242, 222, 0.16);
  --accent: #ff9d66;
  --accent-2: #8ed8c3;
  --matrix: #7cff72;
  --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 157, 102, 0.2), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(142, 216, 195, 0.13), transparent 24rem),
    linear-gradient(rgba(255, 242, 222, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 242, 222, 0.035) 1px, transparent 1px),
    var(--page);
  background-size: auto, auto, 28px 28px, 28px 28px, auto;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration-color: rgba(255, 157, 102, 0.7);
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--accent);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 0.28rem;
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.site-header,
main {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  width: min(43rem, calc(100% - 24px));
  min-height: 2.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 12px;
  padding: 0.34rem 0.42rem 0.34rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 13, 11, 0.86);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

.wordmark,
.eyebrow,
.matrix-trigger {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  color: var(--muted);
}

.site-nav a {
  font-size: 0.88rem;
  text-decoration: none;
}

.matrix-trigger,
.hero-matrix-trigger,
.home-link,
.matrix-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease, background 160ms ease;
}

.matrix-trigger {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 242, 222, 0.07);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matrix-trigger span {
  color: var(--accent-2);
  font-size: 1rem;
  line-height: 0;
}

.matrix-trigger:hover,
.hero-matrix-trigger:hover,
.home-link:hover {
  border-color: rgba(142, 216, 195, 0.8);
  background: rgba(142, 216, 195, 0.11);
  color: var(--ink);
  transform: translateY(-1px);
}

main {
  padding-bottom: 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 8vw, 7rem);
  align-items: start;
  min-height: 80vh;
  padding: clamp(7rem, 13vw, 11rem) clamp(0rem, 3vw, 3rem) 5rem;
}

.hero-copy {
  max-width: 44rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
}

h1,
p {
  margin-top: 0;
}

h1 {
  font-family: var(--font-display);
  font-weight: 520;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 700px;
  margin-bottom: 1.5rem;
  font-size: clamp(3rem, 6.5vw, 6rem);
  line-height: 0.94;
}

p {
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.17rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.hero-matrix-trigger,
.home-link {
  padding: 0.72rem 0.9rem;
  border-radius: 0.35rem;
  background: rgba(255, 242, 222, 0.06);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.hero-matrix-trigger span:last-child,
.home-link span:last-child {
  color: var(--accent-2);
  font-size: 1.1rem;
}

.portrait-card {
  width: min(15rem, 24vw);
  margin-top: 1rem;
}

.portrait-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0.5rem;
  border: 1px solid rgba(255, 242, 222, 0.16);
  border-radius: 999px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 157, 102, 0.28), transparent 36%),
    rgba(255, 242, 222, 0.1);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.32);
}

.portrait-frame::after {
  position: absolute;
  inset: 0.2rem;
  border: 2px solid rgba(255, 157, 102, 0.6);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  object-position: center 42%;
}

.portrait-caption {
  margin: 0.9rem 0 0;
  color: var(--quiet, #9c8f80);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.matrix-mode {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #010603;
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease 350ms;
}

.matrix-renderer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  pointer-events: none;
}

.matrix-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0 28%, rgba(0, 4, 1, 0.42) 78%, rgba(0, 2, 0, 0.84) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.matrix-signoff {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  margin: 0;
  color: #d9ffd3;
  filter: drop-shadow(0 0 7px #39ff58);
  font-family: "Matrix Code", monospace;
  font-size: var(--matrix-glyph-size);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 1;
  text-transform: none;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.matrix-signoff span {
  display: inline-block;
  opacity: 0;
  will-change: opacity, transform;
}

.matrix-exit {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  padding: 0.35rem 0.48rem;
  border-color: rgba(124, 255, 114, 0.3);
  border-radius: 0.2rem;
  background: rgba(0, 10, 2, 0.76);
  color: rgba(124, 255, 114, 0.72);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 240ms ease 1.25s, color 160ms ease, border-color 160ms ease;
}

.matrix-exit:hover {
  border-color: rgba(124, 255, 114, 0.72);
  background: rgba(124, 255, 114, 0.1);
  color: #e9ffe7;
}

body.matrix-active {
  overflow: hidden;
  background: #010603;
  transition: background 1.15s ease;
}

body.matrix-active .site-shell {
  z-index: 2;
  pointer-events: none;
}

body.matrix-active .site-header {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transition: background 600ms ease, border-color 600ms ease, box-shadow 600ms ease;
}

.matrix-falling {
  will-change: color, filter, opacity, transform;
}

body.matrix-active .matrix-falling {
  color: var(--matrix) !important;
  filter: drop-shadow(0 0 5px rgba(88, 255, 98, 0.72));
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(105vh + var(--matrix-distance, 0px))) rotate(var(--matrix-tilt, 0deg));
  transition:
    color 320ms ease var(--matrix-delay),
    filter 320ms ease var(--matrix-delay),
    opacity 260ms ease calc(var(--matrix-delay) + 850ms),
    transform var(--matrix-duration) cubic-bezier(0.55, 0.06, 0.82, 0.4) var(--matrix-delay);
}

body.matrix-active .matrix-mode {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 900ms ease 350ms;
}

body.matrix-active .matrix-exit {
  opacity: 1;
}

body.matrix-returning .matrix-exit {
  opacity: 0;
  transition: opacity 160ms ease;
}

body.matrix-returning .site-shell {
  opacity: 0;
  pointer-events: none;
}

body.matrix-returning .matrix-mode {
  opacity: 1;
  pointer-events: none;
  transition: none;
}

@media (max-width: 720px) {
  .site-header {
    width: calc(100% - 20px);
    padding-left: 0.62rem;
  }

  .site-nav {
    gap: 0.5rem;
  }

  .site-nav > a {
    display: none;
  }

  .matrix-trigger {
    font-size: 0.6rem;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 6rem;
  }

  .portrait-card {
    width: min(12rem, 58vw);
    justify-self: center;
    margin-top: 0;
  }

  .matrix-exit {
    top: 0.75rem;
    right: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
