:root {
  color-scheme: light dark;
  --bg: #fafaf8;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e1;
  --link-line: #bdbdb6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161615;
    --ink: #ececea;
    --muted: #9a9a96;
    --line: #2b2b29;
    --link-line: #55554f;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161615;
  --ink: #ececea;
  --muted: #9a9a96;
  --line: #2b2b29;
  --link-line: #55554f;
}

:root[data-theme="light"] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.65 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration-color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Layout */

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: 560px;
  margin: 0 auto;
  padding: 96px 24px 40px;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

.name {
  font-size: 17px;
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
}

.title {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
}

.bio p {
  margin: 0 0 16px;
}

.cta-row {
  margin-top: 24px;
}

.cta {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}

.cta:hover {
  opacity: 0.88;
}

/* Work list */

.work {
  margin-top: 64px;
}

.section-heading {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.work-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.work-main {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.work-role,
.work-years {
  color: var(--muted);
}

.work-years {
  white-space: nowrap;
  font-size: 15px;
}

/* Footer */

.footer {
  margin-top: 56px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer p {
  margin: 0;
}

.footer-end {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme switch */

.theme-switch {
  appearance: none;
  position: relative;
  width: 30px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--link-line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex: none;
}

.theme-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.theme-switch[aria-checked="true"]::after {
  transform: translateX(12px);
  background: var(--ink);
}

.theme-switch:hover {
  border-color: var(--muted);
}

/* Bigger tap area on touch screens without changing the look */
.theme-switch::before {
  content: "";
  position: absolute;
  inset: -12px;
}

#clock {
  font-variant-numeric: tabular-nums;
}

/* Ball button */

.ball-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px;
  margin-right: -4px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.ball-btn svg {
  transition: transform 0.5s ease;
}

.ball-btn:hover {
  color: var(--ink);
}

.ball-btn:hover svg {
  transform: rotate(180deg);
}

.ball-btn.is-nudging svg {
  animation: nudge 0.9s cubic-bezier(0.3, 0.7, 0.4, 1) 1;
}

@keyframes nudge {
  0% {
    transform: translateY(0) rotate(0);
  }
  30% {
    transform: translateY(-9px) rotate(-40deg);
  }
  55% {
    transform: translateY(0) rotate(-70deg);
  }
  72% {
    transform: translateY(-3px) rotate(-80deg);
  }
  100% {
    transform: translateY(0) rotate(-90deg);
  }
}

/* Keepy-uppy */

.keepy {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.keepy[hidden] {
  display: none;
}

.keepy-pitch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.keepy-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px;
  pointer-events: none;
}

.keepy-score {
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}

.keepy-score.is-bumped {
  transform: scale(1.12);
}

.keepy-best {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  min-height: 1.4em;
}

.keepy-close {
  pointer-events: auto;
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.keepy-close:hover {
  color: var(--ink);
}

.keepy-msg {
  position: absolute;
  inset: auto 0 15%;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

body.is-playing {
  overflow: hidden;
}

/* Small screens */

@media (max-width: 520px) {
  .container {
    padding-top: 56px;
  }

  .work-main {
    flex-direction: column;
    gap: 0;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .ball-btn:hover svg {
    transform: none;
  }

  .ball-btn.is-nudging svg {
    animation: none;
  }

  .keepy-score,
  .theme-switch::after {
    transition: none;
  }
}
