:root {
  color-scheme: light;
  --paper: #f5f3ec;
  --ink: #22251f;
  --olive: #69764d;
  --muted: #72766a;
  --discord: #6267a3;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --paper: #1d201b;
  --ink: #eeeae0;
  --olive: #acbb8a;
  --muted: #a4aa99;
  --discord: #a6a8e8;
}

* { box-sizing: border-box; }

button { border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--olive); outline-offset: 6px; border-radius: 4px; }

html { min-height: 100%; background: var(--paper); transition: background-color 160ms ease; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none;
}

::selection { color: var(--paper); background: var(--olive); }

.page {
  min-height: 100svh;
  padding: 30px clamp(24px, 5vw, 80px);
  display: grid;
  grid-template-rows: auto 1fr;
}

header { position: relative; display: flex; align-items: center; justify-content: space-between; }

.theme-toggle { position: relative; width: 40px; height: 40px; color: var(--olive); touch-action: none; user-select: none; -webkit-user-select: none; }
.theme-toggle svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.theme-toggle path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon, [data-theme="night"] .sun-icon { display: none; }
[data-theme="night"] .moon-icon { display: block; }
.theme-toggle.is-low-gravity::after { content: ''; position: absolute; inset: -5px; border: 1px dotted currentColor; border-radius: 50%; pointer-events: none; opacity: .65; }

.avatar-frame {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 0 8px #f2a4cb55;
}

.avatar-frame:focus-visible { border-radius: 50%; }
.steam { position: absolute; left: 50%; top: -42px; width: 80px; height: 88px; transform: translateX(-50%); opacity: 0; pointer-events: none; }
.is-brewing .steam { opacity: 1; }

.avatar {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.avatar-decoration {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  pointer-events: none;
}

main { display: grid; place-items: center; padding: 65px 0 85px; }
.greeting { position: relative; width: min(780px, 100%); }
h1 { margin: 0; font-weight: 400; }

.intro {
  display: block;
  margin: 0 0 8px 7px;
  font-size: clamp(25px, 3.5vw, 38px);
  letter-spacing: -.055em;
  line-height: 1.25;
  white-space: nowrap;
}

.name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(78px, 15.6vw, 185px);
  letter-spacing: -.075em;
  line-height: 1.05;
  white-space: nowrap;
}

.socials { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: 25px 0 0 7px; }
.social-tag { position: relative; display: inline-flex; align-items: center; gap: 10px; font: 400 clamp(14px, 1.4vw, 17px)/1.4 Arial, Helvetica, sans-serif; letter-spacing: .005em; white-space: nowrap; text-decoration: none; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.social-tag svg { flex: 0 0 18px; width: 18px; height: 18px; fill: currentColor; pointer-events: none; }
.discord { color: var(--discord); }
.x-tag, .github-tag { color: var(--ink); }
.tag-baseline { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.physics-soft > .tag-text { visibility: hidden; }
.social-tag::before { content: ''; position: absolute; inset: -4px; }

.period { position: relative; color: var(--olive); letter-spacing: inherit; line-height: inherit; }
.dot { display: inline-block; }
.dot-baseline { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.period.is-released .dot, .period.is-released .grab-target { visibility: hidden; }
.letter { position: relative; display: inline; font: inherit; letter-spacing: inherit; line-height: inherit; vertical-align: baseline; }
.letter, .period, .avatar-frame, .smile { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; pointer-events: none; }
.grab-target { position: absolute; display: block; pointer-events: auto; cursor: grab; touch-action: none; }
.period .grab-target { clip-path: ellipse(50% 50%); }
.avatar-frame::before, .smile::before { content: ''; position: absolute; inset: 0; clip-path: ellipse(50% 50%); pointer-events: auto; }
.avatar, .smile svg, .smile svg * { pointer-events: none; }
.letter.is-released, .physics-placeholder { visibility: hidden; pointer-events: none; }
.letter-baseline { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.physics-playground { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.physics-playground .physics-piece { position: absolute; inset: auto; top: 0; left: 0; right: auto; margin: 0; transition: none; transform-origin: center; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; will-change: transform; }
.physics-playground .physics-piece.social-tag { cursor: pointer; }
.physics-playground .physics-piece.theme-toggle { cursor: pointer; }
.physics-piece.is-swallowed { visibility: hidden; pointer-events: none; }
.physics-letter::before, .physics-dot::before { content: ''; position: absolute; inset: -4px; }
.physics-dot::before { clip-path: ellipse(50% 50%); }
.physics-playground .physics-piece.avatar-frame, .physics-playground .physics-piece.smile { pointer-events: none; }
.physics-playground .physics-piece.physics-h { pointer-events: none; }
.physics-h::before { clip-path: var(--grab-shape); pointer-events: auto; }
.physics-playground .physics-piece.physics-soft { pointer-events: none; }
.physics-soft::before { inset: calc(-1 * var(--soft-padding)); clip-path: var(--soft-grab); pointer-events: auto; }
.physics-piece.is-dragging { cursor: grabbing; }
.physics-piece > svg { display: block; overflow: visible; pointer-events: none; }
.physics-letter > canvas { position: absolute; display: block; pointer-events: none; }
.physics-deformation { position: absolute; display: none; pointer-events: none; }
.physics-soft > .physics-deformation { display: block; }
.physics-soft > .avatar, .physics-soft > .avatar-decoration, .physics-soft > svg { visibility: hidden; }
.physics-soft.physics-dot { background: none; }
.physics-soft.avatar-frame { box-shadow: none; }
.physics-letter svg { fill: var(--ink); }
.physics-dot { border-radius: 50%; background: var(--olive); }

.smile {
  position: absolute;
  top: -38px;
  right: 16px;
  width: 68px;
  color: var(--olive);
  transform: rotate(-7deg);
  transition: transform 350ms ease;
}

.smile path { fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.smile svg { display: block; width: 100%; overflow: visible; }
.smile:focus-visible { border-radius: 50%; }
.cat-face, .shoggoth-face { display: none; }
.is-cat .cat-face { display: block; }
.is-shoggoth .shoggoth-face { display: block; }
.is-cat .human-face, .is-shoggoth .human-face { display: none; }
.smile .cat-nose, .smile .shoggoth-pupil { fill: currentColor; }
.is-snacking .shoggoth-mouth { fill: currentColor; }
.greeting:hover .smile { transform: rotate(12deg); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.touch-pad { display: none; }

@media (pointer: coarse) and (hover: none) {
  /* Native touch regions retain near-miss drags without disabling page scrolling. */
  .touch-pad { display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: calc(100% + 32px); height: calc(100% + 32px); min-width: 48px; min-height: 48px; pointer-events: auto; touch-action: none; }
  .physics-soft .touch-pad { width: calc(100% + 32px + 2 * var(--soft-padding)); height: calc(100% + 32px + 2 * var(--soft-padding)); }
}

@media (max-width: 560px) {
  .page { padding-top: 23px; padding-bottom: 23px; }
  .avatar-frame, .avatar { width: 40px; height: 40px; }
  main { padding: 70px 0; }
  .intro { margin-left: 3px; }
  .socials { gap: 12px 18px; margin-left: 3px; margin-top: 20px; }
  .name { font-size: clamp(72px, 18vw, 100px); }
  .smile { top: -78px; right: 6px; width: 48px; }
}

@media (max-width: 360px) {
  .socials { gap: 12px 14px; }
  .social-tag { gap: 8px; font-size: 13px; }
  .social-tag svg { flex-basis: 16px; width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { transition: none; }
  .avatar-decoration { display: none; }
  .smile { transition: none; }
}
