:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --ink: #f5f5f3;
  --muted: rgba(245, 245, 243, 0.58);
  --accent: #d4ff3a;
  --accent-2: #ff3d6b;
  --beat-zoom: 1;
  --beat-glow: 0;
  --sway-boost: 1;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg,
.bg-sweep,
.bg-glow {
  position: fixed;
  pointer-events: none;
}

.bg,
.bg-sweep {
  transform: scale3d(var(--beat-zoom), var(--beat-zoom), 1);
}

.bg {
  inset: -8%;
  z-index: -3;
  background: #0a0a0c;
}

.bg-glow {
  inset: -8%;
  z-index: -2;
  opacity: calc(0.35 + var(--beat-glow) * 0.65);
  background:
    radial-gradient(60% 55% at 20% 16%, rgba(212, 255, 58, 0.2), transparent 70%),
    radial-gradient(55% 45% at 82% 86%, rgba(255, 61, 107, 0.16), transparent 70%);
  will-change: opacity;
}

.bg-sweep {
  inset: -55%;
  z-index: -2;
  overflow: hidden;
  opacity: calc(0.55 + var(--beat-glow) * 0.45);
}

.bg-sweep::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg 255deg,
    rgba(212, 255, 58, 0.16) 285deg,
    rgba(255, 61, 107, 0.14) 315deg,
    transparent 345deg 360deg
  );
  filter: blur(48px);
  transform: translateZ(0);
  animation: sweep-rotate 40s linear infinite;
}

.bg-extra {
  inset: 0;
  z-index: -1;
  transform: none;
  background-image: radial-gradient(rgba(245, 245, 243, 0.045) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.45;
  mix-blend-mode: overlay;
}

html.on-beat .bg,
html.on-beat .bg-sweep {
  transform: scale3d(calc(var(--beat-zoom) + 0.035), calc(var(--beat-zoom) + 0.035), 1);
}

@keyframes sweep-rotate {
  to {
    transform: rotate(360deg) translateZ(0);
  }
}

@keyframes gup-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-3deg);
  }

  33% {
    transform: translate3d(-10px, 8px, 0) rotate(-1deg);
  }

  66% {
    transform: translate3d(6px, -12px, 0) rotate(-5deg);
  }
}

@keyframes flutter {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(8deg);
  }

  40% {
    transform: translate3d(-14px, -10px, 0) rotate(14deg);
  }

  70% {
    transform: translate3d(8px, 6px, 0) rotate(4deg);
  }
}

@keyframes sway-photo {
  0%,
  100% {
    transform: rotate(-2.6deg) translate3d(0, 0, 0);
  }

  35% {
    transform: rotate(-1.2deg) translate3d(calc(6px * var(--sway-boost)), calc(-10px * var(--sway-boost)), 0);
  }

  70% {
    transform: rotate(-3.8deg) translate3d(calc(-5px * var(--sway-boost)), calc(7px * var(--sway-boost)), 0);
  }
}

@keyframes sway-photo-inner {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1.05);
  }

  50% {
    transform: translate3d(calc(-4px * var(--sway-boost)), calc(5px * var(--sway-boost)), 0) scale(1.08);
  }
}

@keyframes sway-tape {
  0%,
  100% {
    transform: translateX(-50%) rotate(3deg);
  }

  50% {
    transform: translateX(calc(-50% + 4px)) rotate(6deg);
  }
}

@keyframes sway-name {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  30% {
    transform: translate3d(calc(4px * var(--sway-boost)), calc(-6px * var(--sway-boost)), 0) rotate(0.4deg);
  }

  65% {
    transform: translate3d(calc(-5px * var(--sway-boost)), calc(4px * var(--sway-boost)), 0) rotate(-0.35deg);
  }
}

@keyframes sway-block {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  40% {
    transform: translate3d(calc(7px * var(--sway-boost)), calc(-5px * var(--sway-boost)), 0) rotate(0.25deg);
  }

  75% {
    transform: translate3d(calc(-6px * var(--sway-boost)), calc(6px * var(--sway-boost)), 0) rotate(-0.2deg);
  }
}

@keyframes sway-item {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(calc(5px * var(--sway-boost)), calc(-4px * var(--sway-boost)), 0);
  }
}

@keyframes sway-icon {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  50% {
    transform: translate3d(0, calc(-5px * var(--sway-boost)), 0) rotate(6deg);
  }
}

@keyframes sway-masthead {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(calc(-4px * var(--sway-boost)), calc(8px * var(--sway-boost)), 0);
  }
}

.edelweiss {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 0;
  width: clamp(80px, 9vw, 124px);
  opacity: 0.28;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  transform: rotate(8deg);
  animation: flutter 14s ease-in-out infinite;
}

.gup-mark {
  position: fixed;
  top: clamp(36px, 5vh, 72px);
  right: clamp(20px, 3vw, 56px);
  z-index: -1;
  width: clamp(160px, 18vw, 280px);
  opacity: 0.1;
  filter: grayscale(1) brightness(2.6) contrast(1.1);
  pointer-events: none;
  transform: rotate(-3deg);
  animation: gup-drift 20s ease-in-out infinite;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: clamp(40px, 7vw, 96px);
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) clamp(20px, 4vw, 40px) 140px;
  isolation: isolate;
}

.content {
  contain: layout style;
}

.masthead {
  position: sticky;
  top: clamp(40px, 6vw, 72px);
  align-self: start;
}

.photo {
  position: relative;
  width: 248px;
  margin: 0 0 32px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #1a1a1d;
  border-radius: 2px;
  transform: rotate(-2.6deg);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 6px 14px rgba(0, 0, 0, 0.45);
}

.photo img {
  width: 110%;
  height: 110%;
  margin: -5% 0 0 -5%;
  object-fit: cover;
  object-position: center 26%;
  filter: contrast(1.04) saturate(1.06);
}

.tape {
  position: absolute;
  top: -14px;
  left: 50%;
  z-index: 2;
  width: 88px;
  height: 26px;
  background: rgba(245, 245, 243, 0.36);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  border-left: 1px dashed rgba(245, 245, 243, 0.5);
  border-right: 1px dashed rgba(245, 245, 243, 0.5);
  transform: translateX(-50%) rotate(3deg);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.name {
  margin: 0;
  font-family: "Boldonse", sans-serif;
  font-size: clamp(4.4rem, 8vw, 7.4rem);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.06em;
  text-transform: lowercase;
}

.cursor {
  display: inline-block;
  width: 0.14em;
  height: 0.78em;
  margin-left: 0.06em;
  background: var(--accent);
  transform: translateY(0.06em);
  animation: blink 1.1s steps(2, end) 1.15s infinite;
}

.socials {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: rgba(245, 245, 243, 0.72);
  background: rgba(245, 245, 243, 0.04);
  border: 1px solid rgba(245, 245, 243, 0.14);
  border-radius: 10px;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.social-link svg {
  width: 22px;
  height: 22px;
}

.social-link:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  transform: translate3d(0, -2px, 0);
}

.content {
  width: 100%;
  max-width: 660px;
}

.block {
  margin: 0 0 clamp(64px, 9vw, 92px);
}

.block:last-child {
  margin-bottom: 0;
}

.block h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  line-height: 1;
  text-transform: uppercase;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(212, 255, 58, 0.18);
}

html.on-beat .dot {
  box-shadow:
    0 0 0 4px rgba(212, 255, 58, 0.18),
    0 0 18px rgba(212, 255, 58, 0.55);
}

p {
  margin: 0 0 1em;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.04rem;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -0.005em;
}

.block > p {
  color: rgba(245, 245, 243, 0.86);
  font-size: 1.12rem;
}

.item {
  margin: 36px 0 0;
}

.item:first-of-type {
  margin-top: 4px;
}

.item p {
  margin-top: 14px;
}

.item-title {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font-family: "Boldonse", sans-serif;
  font-size: clamp(2.2rem, 4.2vw, 3.1rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.05em;
  text-decoration: none;
  text-transform: lowercase;
  transition: color 200ms ease;
}

.item-title:hover {
  color: var(--accent);
}

.item-title:hover .arrow {
  transform: translate3d(6px, -2px, 0);
  color: var(--accent);
}

.item-title:hover .item-glyph {
  background: var(--accent);
}

.item-title .all-caps {
  text-transform: uppercase;
}

.item-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(245, 245, 243, 0.05);
}

.item-glyph {
  display: inline-block;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(245, 245, 243, 0.18) 0 2px,
      transparent 2px 7px
    ),
    rgba(245, 245, 243, 0.06);
  transition: background 200ms ease;
}

.arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.62em;
  color: rgba(245, 245, 243, 0.45);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  transition:
    transform 220ms ease,
    color 200ms ease;
}

.comment-form {
  margin-top: 8px;
}

.comment-form.is-locked {
  opacity: 0.72;
}

.comment-form .comment-nickname,
.comment-form textarea {
  width: 100%;
  padding: 14px 16px;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  background: rgba(245, 245, 243, 0.03);
  border: 1px solid rgba(245, 245, 243, 0.16);
  border-radius: 2px;
}

.comment-form .comment-nickname {
  margin-bottom: 10px;
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
}

.comment-form .comment-nickname:focus,
.comment-form textarea:focus {
  outline: 2px solid rgba(212, 255, 58, 0.45);
  outline-offset: 2px;
}

.comment-form .comment-nickname:disabled,
.comment-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.comment-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.comment-counter {
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}

.turnstile-widget {
  margin-top: 14px;
  min-height: 65px;
}

.comment-submit {
  margin-left: auto;
  padding: 11px 18px;
  color: var(--bg);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--accent);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}

.comment-submit:hover:not(:disabled) {
  transform: translate3d(0, -1px, 0);
}

.comment-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.comment-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.74rem;
}

.comment-status[data-type="error"] {
  color: #ff8aa3;
}

.comment-status[data-type="success"] {
  color: var(--accent);
}

.comment-list {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.comment-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.comment-item {
  padding: 16px 18px;
  background: rgba(245, 245, 243, 0.03);
  border: 1px solid rgba(245, 245, 243, 0.1);
  border-radius: 2px;
}

.comment-nickname-display {
  display: block;
  margin: 0 0 8px;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.comment-body {
  margin: 0 0 10px;
  color: rgba(245, 245, 243, 0.88);
  font-size: 1.02rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-meta {
  display: block;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

body.sway-live .masthead {
  animation: sway-masthead 11s ease-in-out infinite;
}

body.sway-live .content {
  animation: sway-block 11.5s ease-in-out -2s infinite;
}

html.on-beat {
  --sway-boost: 1.45;
}

body.is-ready .photo {
  animation: photo-in 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

body.is-ready .name {
  animation: name-in 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
}

body.is-ready .socials {
  animation: name-in 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

body.is-ready #about {
  animation: block-in 0.78s cubic-bezier(0.16, 1, 0.3, 1) 0.48s both;
}

body.is-ready #projects {
  animation: block-in 0.78s cubic-bezier(0.16, 1, 0.3, 1) 0.68s both;
}

body.is-ready #affiliations {
  animation: block-in 0.78s cubic-bezier(0.16, 1, 0.3, 1) 0.88s both;
}

body.is-ready #comments {
  animation: comments-in 0.78s cubic-bezier(0.16, 1, 0.3, 1) 1.08s both;
}

@keyframes comments-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes photo-in {
  from {
    opacity: 0;
    transform: rotate(-7deg) translate3d(-18px, 36px, 0) scale(0.96);
  }

  to {
    opacity: 1;
    transform: rotate(-2.6deg);
  }
}

@keyframes name-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes block-in {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

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

@media (max-width: 880px) {
  html {
    scroll-behavior: auto;
  }

  body {
    overflow-x: clip;
    touch-action: manipulation;
  }

  .bg,
  .bg-sweep,
  .bg-glow {
    transform: none;
  }

  .bg-glow,
  .bg-sweep {
    opacity: 0.35;
    will-change: auto;
  }

  html.on-beat .bg,
  html.on-beat .bg-sweep {
    transform: none;
  }

  .bg-sweep::before {
    filter: blur(36px);
    animation-duration: 72s;
  }

  .bg-extra {
    mix-blend-mode: normal;
    opacity: 0.45;
  }

  .edelweiss,
  .gup-mark {
    animation: none;
  }

  .masthead {
    position: relative;
    top: auto;
    isolation: isolate;
    contain: layout style;
  }

  .photo {
    width: 208px;
    margin-bottom: 24px;
    contain: paint;
    transform: rotate(-2.6deg);
  }

  .photo img {
    width: 100%;
    height: 100%;
    margin: 0;
  }

  body.sway-live .masthead,
  body.sway-live .content,
  body.sway-live .photo,
  body.sway-live .photo img,
  body.sway-live .tape,
  body.sway-live .name,
  body.sway-live .block,
  body.sway-live .item,
  body.sway-live .item-icon {
    animation: none !important;
  }

  body.is-ready .photo {
    animation: photo-in-mobile 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
  }

  body.is-ready .name {
    animation: fade-in-mobile 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
  }

  body.is-ready .socials {
    animation: fade-in-mobile 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
  }

  body.is-ready #about,
  body.is-ready #projects,
  body.is-ready #affiliations,
  body.is-ready #comments {
    animation: fade-in-mobile 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  body.is-ready #about {
    animation-delay: 0.48s;
  }

  body.is-ready #projects {
    animation-delay: 0.68s;
  }

  body.is-ready #affiliations {
    animation-delay: 0.88s;
  }

  body.is-ready #comments {
    animation-delay: 1.08s;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 44px;
    padding-bottom: 100px;
  }

  .name {
    font-size: clamp(3.6rem, 18vw, 5.6rem);
  }

  .edelweiss {
    right: 12px;
    bottom: 12px;
    width: 80px;
  }

  .gup-mark {
    top: 16px;
    right: 16px;
    width: clamp(120px, 32vw, 180px);
    opacity: 0.09;
  }
}

@keyframes photo-in-mobile {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-in-mobile {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 480px) {
  .item-title {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .bg,
  .bg-sweep,
  .bg-glow {
    transform: none !important;
  }

  .bg-sweep::before {
    animation: none !important;
  }

  body.sway-live .masthead,
  body.sway-live .content,
  body.sway-live .photo,
  body.sway-live .photo img,
  body.sway-live .tape,
  body.sway-live .name,
  body.sway-live .block,
  body.sway-live .item,
  body.sway-live .item-icon {
    animation: none !important;
  }
}
