:root {
  color-scheme: light dark;
  --background: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #d8d8d8;
  --line-strong: #111111;
  --grid-line: #f1f1f1;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #d8d8d8;
  --line-strong: #111111;
  --grid-line: #f1f1f1;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111111;
  --text: #f7f7f7;
  --muted: #a7a7a7;
  --line: #333333;
  --line-strong: #f7f7f7;
  --grid-line: #1f1f1f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background: #111111;
    --text: #f7f7f7;
    --muted: #a7a7a7;
    --line: #333333;
    --line-strong: #f7f7f7;
    --grid-line: #1f1f1f;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
  color: var(--text);
  font-family:
    "Helvetica Neue",
    Helvetica,
    Arial,
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), var(--grid-line) calc(100% - 1px)),
    var(--background);
  background-size: clamp(64px, 12vw, 148px) 100%;
}

body::before,
body::after {
  position: fixed;
  left: clamp(20px, 5vw, 64px);
  right: clamp(20px, 5vw, 64px);
  height: 1px;
  background: var(--line);
  content: "";
  pointer-events: none;
}

body::before {
  top: clamp(20px, 5vw, 56px);
}

body::after {
  bottom: clamp(20px, 5vw, 56px);
}

.theme-toggle {
  position: fixed;
  z-index: 1;
  top: clamp(20px, 5vw, 56px);
  right: clamp(20px, 5vw, 64px);
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--background);
  color: var(--muted);
  cursor: pointer;
  place-items: center;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    background-color 180ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.theme-toggle__icon {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  opacity: 0;
  transform: scale(0.88);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.theme-toggle__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

:root:not([data-theme]) .theme-toggle__icon--moon,
:root[data-theme="light"] .theme-toggle__icon--moon,
:root[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__icon--moon {
    opacity: 0;
    transform: scale(0.88);
  }

  :root:not([data-theme]) .theme-toggle__icon--sun {
    opacity: 1;
    transform: scale(1);
  }
}

.profile {
  display: grid;
  width: min(100% - 40px, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(72px, 12vh, 132px) 0;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.portrait {
  width: clamp(112px, 18vw, 168px);
  aspect-ratio: 1;
  margin: 0 0 clamp(32px, 6vh, 56px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--background);
}

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

h1 {
  margin: 0;
  font-family:
    "Nunito",
    "Helvetica Neue",
    Helvetica,
    Arial,
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
  font-size: clamp(2.45rem, 6.5vw, 4.65rem);
  font-weight: 600;
  letter-spacing: 0.055em;
  line-height: 1.02;
  color: var(--text);
}

.tagline {
  max-width: 44rem;
  margin: clamp(24px, 4vh, 36px) 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.6vw, 1.06rem);
  line-height: 1.75;
}

.tagline span {
  display: block;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: clamp(40px, 7vh, 64px);
}

.links a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.05rem;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--line-strong);
  background: var(--text);
  color: var(--background);
}

.links a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

@media (max-width: 560px) {
  body {
    background-size: 72px 100%;
  }

  .profile {
    width: min(100% - 32px, 420px);
    padding: 56px 0;
  }

  h1 {
    font-size: clamp(2.5rem, 12.5vw, 3.45rem);
  }

  .tagline {
    max-width: 18rem;
  }

  .links {
    width: 100%;
    gap: 8px;
  }

  .links a {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle__icon,
  .links a {
    transition: none;
  }
}
